diff options
-rw-r--r-- | sky/compact.cpp | 34 | ||||
-rw-r--r-- | sky/compact.h | 9 | ||||
-rw-r--r-- | sky/struc.h | 10 |
3 files changed, 31 insertions, 22 deletions
diff --git a/sky/compact.cpp b/sky/compact.cpp index 5d21b288ac..0ba548cc7d 100644 --- a/sky/compact.cpp +++ b/sky/compact.cpp @@ -40,10 +40,13 @@ #define COMPACT_SIZE (sizeof(compactOffsets)/sizeof(uint32)) #define EXTCOMPACT_SIZE (sizeof(extCompactOffsets)/sizeof(uint32)) #define MEGASET_SIZE (sizeof(megaSetOffsets)/sizeof(uint32)) +#define TURNTABLE_SIZE (sizeof(turnTableOffsets)/sizeof(uint32)) #define OFFS(type,item) (((uint32)(&((type*)0)->item))) #define MK32(type,item) OFFS(type, item),0,0,0 #define MK16(type,item) OFFS(type, item),0 +#define MK32_A5(type, item) MK32(type, item[0]), MK32(type, item[1]), \ + MK32(type, item[2]), MK32(type, item[3]), MK32(type, item[4]) namespace SkyCompact { @@ -122,6 +125,13 @@ static const uint32 megaSetOffsets[] = { MK32(MegaSet, standTalk), }; +static const uint32 turnTableOffsets[] = { + MK32_A5(TurnTable, turnTableUp), + MK32_A5(TurnTable, turnTableDown), + MK32_A5(TurnTable, turnTableLeft), + MK32_A5(TurnTable, turnTableRight), + MK32_A5(TurnTable, turnTableTalk), +}; void *getCompactElem(Compact *cpt, uint32 off) { if (off < COMPACT_SIZE) @@ -136,33 +146,33 @@ void *getCompactElem(Compact *cpt, uint32 off) { return((uint8 *)(cpt->extCompact->megaSet0) + megaSetOffsets[off]); off -= MEGASET_SIZE; - if (off < 5*5*4) - return ((void **)(cpt->extCompact->megaSet0->turnTable))[off/4]; + if (off < TURNTABLE_SIZE) + return ((uint8 *)(cpt->extCompact->megaSet0->turnTable) + turnTableOffsets[off]); - off -= 5*5*4; + off -= TURNTABLE_SIZE; if (off < MEGASET_SIZE) return((uint8 *)(cpt->extCompact->megaSet1) + megaSetOffsets[off]); off -= MEGASET_SIZE; - if (off < 5*5*4) - return ((void **)(cpt->extCompact->megaSet1->turnTable))[off/4]; + if (off < TURNTABLE_SIZE) + return ((uint8 *)(cpt->extCompact->megaSet0->turnTable) + turnTableOffsets[off]); - off -= 5*5*4; + off -= TURNTABLE_SIZE; if (off < MEGASET_SIZE) return((uint8 *)(cpt->extCompact->megaSet2) + megaSetOffsets[off]); off -= MEGASET_SIZE; - if (off < 5*5*4) - return ((void **)(cpt->extCompact->megaSet2->turnTable))[off/4]; + if (off < TURNTABLE_SIZE) + return ((uint8 *)(cpt->extCompact->megaSet0->turnTable) + turnTableOffsets[off]); - off -= 5*5*4; + off -= TURNTABLE_SIZE; if (off < MEGASET_SIZE) return((uint8 *)(cpt->extCompact->megaSet3) + megaSetOffsets[off]); off -= MEGASET_SIZE; - if (off < 5*5*4) - return ((void **)(cpt->extCompact->megaSet3->turnTable))[off/4]; - off -= 5*5*4; + if (off < TURNTABLE_SIZE) + return ((uint8 *)(cpt->extCompact->megaSet0->turnTable) + turnTableOffsets[off]); + off -= TURNTABLE_SIZE; error("Offset %X out of bounds of compact", off + COMPACT_SIZE + EXTCOMPACT_SIZE + 4 * MEGASET_SIZE + 4 * 5*5*4); } diff --git a/sky/compact.h b/sky/compact.h index d1572f305a..02a5911652 100644 --- a/sky/compact.h +++ b/sky/compact.h @@ -912,7 +912,6 @@ namespace SkyCompact { extern uint16 burke_st_down[]; extern uint16 burke_u_to_r[]; extern uint16 burke_d_to_r[]; - extern uint16 *burke_turnTable[5][5]; extern ExtCompact burke_ext; extern Compact burke; extern uint16 shake_seq[]; @@ -1318,7 +1317,6 @@ namespace SkyCompact { extern uint16 babs_t_to_d[]; extern uint16 babs_t_to_l[]; extern uint16 babs_t_to_r[]; - extern uint16 *sc36_babs_turnTable[5][5]; extern ExtCompact sc36_babs_ext; extern Compact sc36_babs; extern uint16 sc36_col_down4[]; @@ -1536,7 +1534,6 @@ namespace SkyCompact { extern uint16 spu_d_to_r[]; extern uint16 spu_down[]; extern uint16 spu_st_up[]; - extern uint16 *spunky_turnTable[5][5]; extern ExtCompact spunky_ext; extern Compact spunky; extern uint16 sc38_video_anim[]; @@ -1601,7 +1598,6 @@ namespace SkyCompact { extern uint16 shades_l_to_d[]; extern uint16 shades_r_to_u[]; extern uint16 shades_r_to_l[]; - extern uint16 *shades_turnTable[5][5]; extern ExtCompact shades_ext; extern Compact shades; extern uint16 liftc2_down[]; @@ -2123,7 +2119,6 @@ namespace SkyCompact { extern uint16 medi_r_to_u[]; extern uint16 medi_r_to_d[]; extern uint16 medi_r_to_l[]; - extern uint16 *medi_turnTable[5][5]; extern ExtCompact medi_ext; extern Compact medi; extern uint16 sc71_mouse_list[]; @@ -2215,7 +2210,6 @@ namespace SkyCompact { extern uint16 wit_u_to_r[]; extern uint16 wit_r_to_u[]; extern uint16 wit_t_to_l[]; - extern uint16 *witness_turnTable[5][5]; extern ExtCompact witness_ext; extern Compact witness; extern uint16 sc72_logic_list[]; @@ -2246,7 +2240,6 @@ namespace SkyCompact { extern uint16 gal_r_to_u[]; extern uint16 gal_r_to_d[]; extern uint16 gal_r_to_l[]; - extern uint16 *gallagher_turnTable[5][5]; extern ExtCompact gallagher_ext; extern Compact gallagher; extern uint16 sc73_joey_fight1[]; @@ -2386,7 +2379,6 @@ namespace SkyCompact { extern uint16 ken_r_to_u[]; extern uint16 ken_r_to_d[]; extern uint16 ken_r_to_l[]; - extern uint16 *ken_turnTable[5][5]; extern ExtCompact ken_ext; extern Compact ken; extern uint16 sc76_floor_table[]; @@ -2992,7 +2984,6 @@ namespace SkyCompact { extern uint16 lamb_r_to_u[]; extern uint16 lamb_r_to_d[]; extern uint16 lamb_r_to_l[]; - extern uint16 *lamb_turnTable[5][5]; extern ExtCompact lamb_ext; extern Compact lamb; extern uint16 bfoster_left[]; diff --git a/sky/struc.h b/sky/struc.h index 90f1cfc090..367c2d2700 100644 --- a/sky/struc.h +++ b/sky/struc.h @@ -48,6 +48,14 @@ struct dataFileHeader { uint16 s_compressed_size; }; +struct TurnTable { + uint16 *turnTableUp[5]; + uint16 *turnTableDown[5]; + uint16 *turnTableLeft[5]; + uint16 *turnTableRight[5]; + uint16 *turnTableTalk[5]; +}; + struct MegaSet { uint16 gridWidth; uint16 colOffset; @@ -64,7 +72,7 @@ struct MegaSet { uint16 *standLeft; uint16 *standRight; uint16 *standTalk; - void *turnTable; + TurnTable *turnTable; }; struct ExtCompact { |