Skip to content

Commit

Permalink
hover shoes
Browse files Browse the repository at this point in the history
  • Loading branch information
kion-dgl committed Jun 21, 2024
1 parent 61ac56c commit 76cc048
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fixtures/shoes-hover.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"name": "20_HOVER_RIGHT_FOOT",
"triCount": 128,
"quadCount": 128,
"vertCount": 128,
"triOfs": 8421504,
"quadOfs": 8421504,
"vertOfs": 8421504,
"triShadowOfs": 8421504,
"quadShadowOfs": 8421504
},
{
"name": "21_HOVER_LEFT_FOOT",
"triCount": 128,
"quadCount": 128,
"vertCount": 128,
"triOfs": 8421504,
"quadOfs": 8421504,
"vertOfs": 8421504,
"triShadowOfs": 8421504,
"quadShadowOfs": 0
}
]
57 changes: 57 additions & 0 deletions tests/shoes-hover.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { test, expect } from "bun:test";
import { readFileSync } from "fs";
import ByteReader from '../src/ByteReader';
import shoesHover from '../fixtures/shoes-hover.json'

type MeshHeader = {
name: string;
triCount: number;
quadCount: number;
vertCount: number;
triOfs: number;
quadOfs: number;
vertOfs: number;
triShadowOfs: number;
quadShadowOfs: number;
}

test("Reading the strip offsets for the shoes", () => {

const buffer = readFileSync(`./bin/PL00P005.BIN`);
const dat = buffer.subarray(0x30, 0x30 + 0x2b40);
const reader = new ByteReader(dat.buffer as ArrayBuffer);

const FEET_OFS = 0x1800
const names = ["20_HOVER_RIGHT_FOOT", "21_HOVER_LEFT_FOOT"];
reader.seek(FEET_OFS);

const meshes: MeshHeader[] = [];
names.forEach((name) => {

const triCount = reader.readUInt8();
const quadCount = reader.readUInt8();
const vertCount = reader.readUInt8();
reader.seekRel(1);

const triOfs = reader.readUInt32();
const quadOfs = reader.readUInt32();
const vertOfs = reader.readUInt32();
const triShadowOfs = reader.readUInt32();
const quadShadowOfs = reader.readUInt32();

meshes.push({
name,
triCount,
quadCount,
vertCount,
triOfs,
quadOfs,
vertOfs,
triShadowOfs,
quadShadowOfs
})
});

expect(meshes).toEqual(shoesHover);

});

0 comments on commit 76cc048

Please sign in to comment.