modelize titles and backgrounds

This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent d7b510193f
commit e1454e5937
9 changed files with 11 additions and 6 deletions
@@ -1,4 +1,4 @@
export function bitSet(items: number[], nbytes: number): Buffer {
export function bitmap(items: number[], nbytes: number): Buffer {
const buf = Buffer.alloc(nbytes);
for (const item of items) {
+2
View File
@@ -3,6 +3,7 @@ import iconv = require("iconv-lite");
import { car } from "./_car";
import { chara } from "./_chara";
import { LoadProfileResponse2 } from "../response/loadProfile2";
import { bitmap } from "./_bitmap";
export function loadProfile2(res: LoadProfileResponse2) {
// Story stuff
@@ -34,6 +35,7 @@ export function loadProfile2(res: LoadProfileResponse2) {
chara(res.chara).copy(buf, 0x070c);
buf.writeUInt16LE(res.background, 0x071c);
buf.writeUInt16LE(res.title, 0x071e);
bitmap(res.titles, 0xb4).copy(buf, 0x720);
buf.writeInt32LE(res.teamId, 0x07e0);
car(res.car).copy(buf, 0x0c5c);
+2 -2
View File
@@ -1,3 +1,4 @@
import { bitmap } from "./_bitmap";
import { LoadStockerResponse } from "../response/loadStocker";
export function loadStocker(res: LoadStockerResponse) {
@@ -5,8 +6,7 @@ export function loadStocker(res: LoadStockerResponse) {
buf.writeInt16LE(0x00a8, 0x0000);
buf.writeUInt8(res.status, 0x0002);
//buf.fill(0xff, 0x0003, 0x000a);
buf.writeUInt8(0x08, 0x0008);
bitmap(res.backgrounds, 0x24).copy(buf, 0x0003);
return buf;
}