diff --git a/src/game/bg.c b/src/game/bg.c index 640955cb0..be420950c 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -86,12 +86,12 @@ u32 var800a4920; u32 g_BgSection3; struct room *g_Rooms; u8 *g_MpRoomVisibility; -s16 g_BgForceOnscreenRooms[350]; +RoomNum g_BgForceOnscreenRooms[350]; s32 g_BgNumForceOnscreenRooms; u16 g_BgUnloadDelay240; u16 g_BgUnloadDelay240_2; u32 var800a4bf4; -s16 g_GlareRooms[100]; +RoomNum g_GlareRooms[100]; u32 *g_BgPrimaryData2; struct bgroom *g_BgRooms; struct bgportal *g_BgPortals; @@ -135,7 +135,7 @@ void bgUnpausePropsInRoom(u32 roomnum, bool tintedglassonly) struct prop *prop; struct defaultobj *obj; s16 *propnumptr; - s16 rooms[2]; + RoomNum rooms[2]; s16 propnums[256]; rooms[0] = roomnum; @@ -869,11 +869,11 @@ Gfx *bgRenderRoomInXray(Gfx *gdl, s32 roomnum) Gfx *bgRenderSceneInXray(Gfx *gdl) { - s16 *roomnumptr; - s16 *room; + RoomNum *roomnumptr; + RoomNum *room; s16 i; s32 j; - s16 roomnumsbyprop[200]; + RoomNum roomnumsbyprop[200]; struct prop *prop; struct prop **ptr; s32 k; @@ -969,15 +969,15 @@ Gfx *bgRenderScene(Gfx *gdl) s32 firstroomnum = -1; s32 i; s32 roomnum; - s16 roomnumsbyprop[200]; + RoomNum roomnumsbyprop[200]; struct prop **ptr; struct drawslot *thing; - s16 *roomnumptr; + RoomNum *roomnumptr; struct prop *prop; s16 tmp; - s16 *room; + RoomNum *room; s16 roomorder[60]; - s16 roomnums[60]; + RoomNum roomnums[60]; g_NumRoomsWithGlares = 0; @@ -4619,7 +4619,7 @@ bool bgRoomIsLoaded(s32 room) return g_Rooms[room].loaded240; } -bool bgRoomContainsCoord(struct coord *pos, s16 roomnum) +bool bgRoomContainsCoord(struct coord *pos, RoomNum roomnum) { struct coord copy; copy.x = pos->x; @@ -4646,7 +4646,7 @@ bool bgRoomContainsCoord(struct coord *pos, s16 roomnum) * - The normal points towards the front of the portal. * - The room on the front side is roomnum2. */ -bool bgTestPosInRoomCheap(struct coord *pos, s16 roomnum) +bool bgTestPosInRoomCheap(struct coord *pos, RoomNum roomnum) { s32 i; @@ -4672,7 +4672,7 @@ bool bgTestPosInRoomCheap(struct coord *pos, s16 roomnum) return true; } -bool bgTestPosInRoomExpensive(struct coord *pos, s16 roomnum) +bool bgTestPosInRoomExpensive(struct coord *pos, RoomNum roomnum) { s32 t5; struct coord *next; @@ -4780,7 +4780,7 @@ bool bgTestPosInRoomExpensive(struct coord *pos, s16 roomnum) return true; } -bool bgTestPosInRoom(struct coord *pos, s16 roomnum) +bool bgTestPosInRoom(struct coord *pos, RoomNum roomnum) { if (g_Rooms[roomnum].flags & ROOMFLAG_COMPLICATEDPORTALS) { return bgTestPosInRoomExpensive(pos, roomnum); @@ -4809,7 +4809,7 @@ bool bgTestPosInRoom(struct coord *pos, s16 roomnum) * to pos and writes the room number to the bestroom pointer. The bestroom * pointer is a pointer to a single s16 rather than an array. */ -void bgFindRoomsByPos(struct coord *posarg, s16 *inrooms, s16 *aboverooms, s32 max, s16 *bestroom) +void bgFindRoomsByPos(struct coord *posarg, RoomNum *inrooms, RoomNum *aboverooms, s32 max, RoomNum *bestroom) { s32 inlen = 0; s32 abovelen = 0; @@ -5332,7 +5332,7 @@ void bgTickPortalsXray(void) bgChooseRoomsToLoad(); } -void bgAddToSnake(s16 fromroomnum, s16 roomnum, s16 depth, struct screenbox *box) +void bgAddToSnake(RoomNum fromroomnum, RoomNum roomnum, s16 depth, struct screenbox *box) { struct bgsnakeitem *item; s32 i; @@ -5419,10 +5419,10 @@ void bgConsumeSnakeItem(struct bgsnakeitem *item) s32 i; s16 portalnum; s16 prevvalidcount; - s16 prevfoundroom; - s16 newfoundroom; + RoomNum prevfoundroom; + RoomNum newfoundroom; s16 side; - s16 tmp; + RoomNum tmp; bool pass; struct portalmetric *metric; struct screenbox prevbox; @@ -5832,7 +5832,7 @@ Gfx *bgRenderSceneAndLoadCandidate(Gfx *gdl) return gdl; } -s32 bgGetForceOnscreenRooms(s16 *rooms, s32 len) +s32 bgGetForceOnscreenRooms(RoomNum *rooms, s32 len) { s32 i; @@ -5845,7 +5845,7 @@ s32 bgGetForceOnscreenRooms(s16 *rooms, s32 len) return i; } -s32 bgRoomGetNeighbours(s32 roomnum, s16 *dstrooms, s32 len) +s32 bgRoomGetNeighbours(s32 roomnum, RoomNum *dstrooms, s32 len) { s32 count = 0; s32 i; @@ -5991,7 +5991,7 @@ bool bgPortalExists(s32 portalnum) void bgPortalSwapRooms(s32 portal) { - s16 tmp = g_BgPortals[portal].roomnum1; + RoomNum tmp = g_BgPortals[portal].roomnum1; g_BgPortals[portal].roomnum1 = g_BgPortals[portal].roomnum2; g_BgPortals[portal].roomnum2 = tmp; } @@ -6210,10 +6210,10 @@ void bgCalculatePortalBbox(s32 portalnum, struct coord *bbmin, struct coord *bbm } } -void bgFindEnteredRooms(struct coord *bbmin, struct coord *bbmax, s16 *rooms, s32 maxlen, bool arg4) +void bgFindEnteredRooms(struct coord *bbmin, struct coord *bbmax, RoomNum *rooms, s32 maxlen, bool arg4) { - s16 room; - s16 otherroom; + RoomNum room; + RoomNum otherroom; s32 portalnum; struct coord propbbmin; struct coord propbbmax; diff --git a/src/game/body.c b/src/game/body.c index 38c313aba..5d272d3d7 100644 --- a/src/game/body.c +++ b/src/game/body.c @@ -346,7 +346,7 @@ s32 bodyChooseHead(s32 bodynum) void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex) { struct pad pad; - s16 rooms[2]; + RoomNum rooms[2]; struct chrdata *chr; struct modeldef *headmodeldef; struct model *model; @@ -531,9 +531,9 @@ void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex) } } -struct prop *bodyAllocateEyespy(struct pad *pad, s16 room) +struct prop *bodyAllocateEyespy(struct pad *pad, RoomNum room) { - s16 rooms[2]; + RoomNum rooms[2]; struct prop *prop; struct chrdata *chr; struct model *model; diff --git a/src/game/bondbike.c b/src/game/bondbike.c index 5b33c3feb..4ef6948f2 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -107,7 +107,7 @@ void bbikeTryDismountAngle(f32 relativeangle, f32 distance) struct hoverbikeobj *bike; f32 angle; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; s32 result; f32 ymax; f32 ymin; @@ -371,11 +371,11 @@ s32 bbikeCalculateNewPosition(struct coord *vel, f32 angledelta) { s32 result = CDRESULT_NOCOLLISION; struct coord dstpos; - s16 dstrooms[8]; + RoomNum dstrooms[8]; struct hov hov; bool hasvel = false; struct hoverbikeobj *bike = (struct hoverbikeobj *) g_Vars.currentplayer->hoverbike->obj; - s16 spa8[20]; + RoomNum spa8[20]; f32 xdiff; f32 zdiff; f32 ymax; @@ -530,7 +530,7 @@ void bbikeUpdateVertical(struct coord *pos) { struct defaultobj *bike = g_Vars.currentplayer->hoverbike->obj; f32 angle; - s16 newrooms[8]; + RoomNum newrooms[8]; bool newinlift; struct prop *lift = NULL; f32 ground; diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index 7d4ace04e..9dd2b7f43 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -39,7 +39,7 @@ u32 g_EyespyMaxFallSpeed = 3000; * position 50 units above the current position, or less if the eyespy is near * the top of its height range. */ -f32 eyespyFindGround(s16 *floorroom) +f32 eyespyFindGround(RoomNum *floorroom) { struct prop *prop = g_Vars.currentplayer->eyespy->prop; s32 inlift; @@ -75,7 +75,7 @@ s32 eyespyTryMoveUpwards(f32 yvel) struct prop *prop = g_Vars.currentplayer->eyespy->prop; struct chrdata *chr = prop->chr; struct coord dstpos; - s16 dstrooms[8]; + RoomNum dstrooms[8]; s32 types; u32 stack; f32 f0; @@ -118,9 +118,9 @@ s32 eyespyCalculateNewPosition(struct coord *vel) struct prop *eyespyprop = g_Vars.currentplayer->eyespy->prop; struct chrdata *chr = eyespyprop->chr; struct coord dstpos; - s16 dstrooms[8]; - s16 floorroom; - s16 sp74[24]; + RoomNum dstrooms[8]; + RoomNum floorroom; + RoomNum sp74[24]; s32 types; s32 i; f32 ymin; @@ -713,7 +713,7 @@ void eyespyProcessInput(bool allowbuttons) f32 angle; f32 ascendspeed = 0.0f; f32 prevverta = g_Vars.currentplayer->eyespy->verta; - s16 prevrooms[8]; + RoomNum prevrooms[8]; s32 contpad2; u32 stack[5]; f32 tmp; diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index 1388160ec..e44c6d170 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -284,7 +284,7 @@ bool bgrabTryMoveUpwards(f32 y) { bool result; struct coord newpos; - s16 rooms[8]; + RoomNum rooms[8]; f32 ymax; f32 ymin; f32 radius; @@ -320,7 +320,7 @@ s32 bgrabCalculateNewPosition(struct coord *delta, f32 angle, bool arg2) s32 cdresult = CDRESULT_NOCOLLISION; s32 i; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; bool ismoving = false; f32 ymax; f32 ymin; diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 0aca40646..45bd3626d 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -4280,7 +4280,7 @@ struct modeldef *bgunGetCartModeldef(void) return g_Vars.currentplayer->gunctrl.cartmodeldef; } -void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, s16 *rooms, Mtxf *matrix1, struct coord *velocity, Mtxf *matrix2, struct prop *prop, struct coord *pos) +void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, RoomNum *rooms, Mtxf *matrix1, struct coord *velocity, Mtxf *matrix2, struct prop *prop, struct coord *pos) { struct prop *objprop = obj->prop; @@ -4325,7 +4325,7 @@ void bgun0f09ed2c(struct defaultobj *obj, struct coord *newpos, Mtxf *arg2, stru { struct prop *objprop = obj->prop; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; if (objprop) { struct prop *playerprop = g_Vars.currentplayer->prop; @@ -4348,7 +4348,7 @@ void bgun0f09ed2c(struct defaultobj *obj, struct coord *newpos, Mtxf *arg2, stru } } -struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *velocity) +struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset *gset, struct coord *pos, RoomNum *rooms, Mtxf *arg4, struct coord *velocity) { struct defaultobj *obj = NULL; struct weaponfunc *basefunc; @@ -4457,7 +4457,7 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset) struct weaponobj *weapon; struct coord muzzlepos; struct coord spawnpos; - s16 spawnrooms[8]; + RoomNum spawnrooms[8]; bool droppinggrenade = false; struct hand *hand; struct coord aimpos; @@ -6748,7 +6748,7 @@ void bgunUpdateSmoke(struct hand *hand, s32 handnum, s32 weaponnum, struct weapo if (hand->createsmoke && (hand->state != HANDSTATE_ATTACK || hand->forcecreatesmoke)) { struct coord smokepos; - s16 smokerooms[2]; + RoomNum smokerooms[2]; s32 smoketype = SMOKETYPE_MUZZLE_AUTOMATIC; switch (weaponnum) { @@ -11413,7 +11413,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum) #endif } -void bgunPlayGlassHitSound(struct coord *pos, s16 *rooms, s32 texturenum) +void bgunPlayGlassHitSound(struct coord *pos, RoomNum *rooms, s32 texturenum) { if (g_Vars.lvupdate240 > 0) { struct sndstate **handle = bgunAllocateAudioHandle(); @@ -11428,7 +11428,7 @@ void bgunPlayGlassHitSound(struct coord *pos, s16 *rooms, s32 texturenum) } } -void bgunPlayBgHitSound(struct gset *gset, struct coord *hitpos, s32 texturenum, s16 *rooms) +void bgunPlayBgHitSound(struct gset *gset, struct coord *hitpos, s32 texturenum, RoomNum *rooms) { #if VERSION >= VERSION_NTSC_1_0 struct sndstate **handle; diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 8e1c2893e..2b8890203 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -394,7 +394,7 @@ f32 bmoveCalculateLookahead(void) struct coord sp100; u32 stack; struct coord spf0; - s16 spe0[8]; + RoomNum spe0[8]; s32 i; f32 angle; f32 value; @@ -403,9 +403,9 @@ f32 bmoveCalculateLookahead(void) u32 stack6; struct coord spbc; struct coord spb0; - s16 spa0[8]; - s16 sp90[8]; - s16 sp80[8]; + RoomNum spa0[8]; + RoomNum sp90[8]; + RoomNum sp80[8]; s32 j; f32 sp78; s32 indextoremove; @@ -1808,7 +1808,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } -void bmoveFindEnteredRoomsByPos(struct player *player, struct coord *mid, s16 *rooms) +void bmoveFindEnteredRoomsByPos(struct player *player, struct coord *mid, RoomNum *rooms) { struct coord bbmin; struct coord bbmax; @@ -1826,7 +1826,7 @@ void bmoveFindEnteredRoomsByPos(struct player *player, struct coord *mid, s16 *r bgFindEnteredRooms(&bbmin, &bbmax, rooms, 7, false); } -void bmoveFindEnteredRooms(struct player *player, s16 *rooms) +void bmoveFindEnteredRooms(struct player *player, RoomNum *rooms) { bmoveFindEnteredRoomsByPos(player, &player->prop->pos, rooms); } diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 545e7d779..e32d6668b 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -187,7 +187,7 @@ s32 bwalkTryMoveUpwards(f32 amount) { bool result; struct coord newpos; - s16 rooms[8]; + RoomNum rooms[8]; u32 stack; u32 types; f32 ymax; @@ -235,9 +235,9 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, s32 result = CDRESULT_NOCOLLISION; f32 halfradius; struct coord dstpos; - s16 dstrooms[8]; + RoomNum dstrooms[8]; bool copyrooms = false; - s16 sp64[22]; + RoomNum sp64[22]; s32 types; f32 ymax; f32 ymin; @@ -392,7 +392,7 @@ bool bwalkCalculateNewPositionWithPush(struct coord *delta, f32 rotateamount, bo } else if (obstacle->type == PROPTYPE_CHR) { struct chrdata *chr = obstacle->chr; struct coord newpos; - s16 newrooms[8]; + RoomNum newrooms[8]; f32 movingdist; f32 xdist; f32 zdist; @@ -713,10 +713,10 @@ void bwalkUpdateVertical(void) f32 ground; bool onladder; bool onladder2 = false; - s16 rooms[8]; + RoomNum rooms[8]; struct coord testpos; struct coord newpos; - s16 newrooms[8]; + RoomNum newrooms[8]; s32 newinlift; struct prop *lift = NULL; f32 sumground; diff --git a/src/game/bot.c b/src/game/bot.c index 9c017c7d8..017405eec 100644 --- a/src/game/bot.c +++ b/src/game/bot.c @@ -227,7 +227,7 @@ void botSpawn(struct chrdata *chr, u8 respawning) struct defaultobj *obj; struct aibot *aibot = chr->aibot; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; if (chr->prop) { prop = chr->prop->child; @@ -660,8 +660,8 @@ void botCheckPickups(struct chrdata *chr) s32 i; s16 *propnumptr; s16 propnums[260]; - s16 allrooms[22]; - s16 neighbours[12]; + RoomNum allrooms[22]; + RoomNum neighbours[12]; roomsCopy(chr->prop->rooms, allrooms); @@ -1208,7 +1208,7 @@ void botApplyProtect(struct chrdata *chr, struct prop *prop) chr->aibot->forcemainloop = true; } -void botApplyDefend(struct chrdata *chr, struct coord *pos, s16 *room, f32 angle) +void botApplyDefend(struct chrdata *chr, struct coord *pos, RoomNum *room, f32 angle) { chr->aibot->command = AIBOTCMD_DEFEND; chr->aibot->defendholdpos.x = pos->x; @@ -1219,7 +1219,7 @@ void botApplyDefend(struct chrdata *chr, struct coord *pos, s16 *room, f32 angle chr->aibot->forcemainloop = true; } -void botApplyHold(struct chrdata *chr, struct coord *pos, s16 *room, f32 angle) +void botApplyHold(struct chrdata *chr, struct coord *pos, RoomNum *room, f32 angle) { chr->aibot->command = AIBOTCMD_HOLD; chr->aibot->defendholdpos.x = pos->x; @@ -1521,7 +1521,7 @@ void botChooseGeneralTarget(struct chrdata *botchr) s32 i; s32 j; bool distancesdone[MAX_MPCHRS]; - s16 room = -1; + RoomNum room = -1; struct chrdata *trychr; s32 playernum; diff --git a/src/game/botact.c b/src/game/botact.c index 5d5a78fe9..f691b305e 100644 --- a/src/game/botact.c +++ b/src/game/botact.c @@ -440,7 +440,7 @@ s32 botactGetShootInterval60(s32 weaponnum, s32 funcnum) * * Return true if a route was found, false if not. */ -bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct coord *topos, s16 *fromrooms, s16 *torooms, struct projectile *projectile) +bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct coord *topos, RoomNum *fromrooms, RoomNum *torooms, struct projectile *projectile) { struct waypoint *from = waypointFindClosestToPos(frompos, fromrooms); struct waypoint *to = waypointFindClosestToPos(topos, torooms); @@ -479,7 +479,7 @@ bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct co void botactGetRocketNextStepPos(u16 padnum, struct coord *pos) { struct pad pad; - s16 rooms[2]; + RoomNum rooms[2]; padUnpack(padnum, PADFIELD_ROOM | PADFIELD_POS, &pad); diff --git a/src/game/botmgr.c b/src/game/botmgr.c index 595c7c43c..59778fbff 100644 --- a/src/game/botmgr.c +++ b/src/game/botmgr.c @@ -28,7 +28,7 @@ void botmgrRemoveAll(void) void botmgrAllocateBot(s32 chrnum, s32 aibotnum) { - s16 rooms[1]; + RoomNum rooms[1]; struct prop *prop; struct chrdata *chr; struct aibot *aibot; diff --git a/src/game/botroom.c b/src/game/botroom.c index e72898295..b27308f13 100644 --- a/src/game/botroom.c +++ b/src/game/botroom.c @@ -46,16 +46,16 @@ * It's likely that these don't ever overflow, or they overflow minimally which * has no serious effect, but this should be investigated further. */ -bool botroomFindPos(s16 room, struct coord *pos, f32 *angleptr, s32 *padnumptr, s32 *covernumptr) +bool botroomFindPos(RoomNum room, struct coord *pos, f32 *angleptr, s32 *padnumptr, s32 *covernumptr) { s32 i; struct waypoint *waypoint; s32 waypointnum; - s32 covernums[40]; /// written to stack + s32 covernums[40]; s32 covercount; - struct cover cover; // written to stack - s16 rooms[2]; // written to stack - s32 padnums[40]; // written to stack + struct cover cover; + RoomNum rooms[2]; + s32 padnums[40]; s32 padcount; s32 totalcount; struct pad pad; diff --git a/src/game/camera.c b/src/game/camera.c index 3a4b5ee14..2c1f833de 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -597,10 +597,10 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct drawslot *drawslot) * correct address to camIsPosInScreenBox so it can interpret the pointer as a * drawslot. */ -bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2) +bool camIsPosInFovAndVisibleRoom(RoomNum *rooms, struct coord *pos, f32 arg2) { s32 i; - s16 room; + RoomNum room; bool hasdata = false; struct drawslot *thisthing; struct screenbox box; @@ -640,5 +640,5 @@ bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2) return false; } - return camIsPosInScreenBox(pos, arg2, (struct drawslot *) (&box.array[-1][0])); + return camIsPosInScreenBox(pos, arg2, (struct drawslot *) &(((u8 *) &box)[-((uintptr_t) &(((struct drawslot *)0)->box))])); } diff --git a/src/game/chr.c b/src/game/chr.c index 398b5f169..667d1350a 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -197,7 +197,7 @@ void chrSetPerimEnabled(struct chrdata *chr, bool enable) * pos and rooms for the chr. It does collision checks and updates dstpos and * dstrooms to valid ones if needed. */ -void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstrooms, bool arg3) +void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, RoomNum *dstrooms, bool arg3) { f32 ymax; f32 ymin; @@ -210,7 +210,7 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom f32 halfradius; struct defaultobj *chair = NULL; s32 cdresult; - s16 sp84[20]; + RoomNum sp84[20]; #if VERSION < VERSION_NTSC_1_0 s32 i; #endif @@ -478,14 +478,14 @@ void chrCalculatePushPos(struct chrdata *chr, struct coord *dstpos, s16 *dstroom } #if VERSION >= VERSION_NTSC_1_0 -bool chr0f01f264(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3, bool arg4) +bool chr0f01f264(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 arg3, bool arg4) #else -bool chr0f01f264(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3) +bool chr0f01f264(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 arg3) #endif { bool result; struct coord newpos; - s16 newrooms[8]; + RoomNum newrooms[8]; f32 ymax; f32 ymin; f32 radius; @@ -520,7 +520,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3 struct prop *lift; s32 i; f32 ground; - s16 spfc[8]; + RoomNum spfc[8]; f32 manground = chr->manground; s32 race = CHRRACE(chr); f32 yincrement = 0.0f; @@ -531,7 +531,7 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3 f32 lvupdate60f; f32 lvupdate60freal; struct coord spd0; - s16 spc0[8]; + RoomNum spc0[8]; #endif // NTSC beta reads g_Vars lvupdate properties throughout this function, @@ -775,9 +775,9 @@ bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f3 arg2->y -= chr->manground; } else { struct coord *sp98; - s16 *sp94; + RoomNum *sp94; struct coord sp88; - s16 sp78[8]; + RoomNum sp78[8]; f32 ground; struct modelnode *node; u16 nodetype; @@ -1290,7 +1290,7 @@ void chrInit(struct prop *prop, u8 *ailist) } struct prop *chr0f020b14(struct prop *prop, struct model *model, - struct coord *pos, s16 *rooms, f32 faceangle, u8 *ailist) + struct coord *pos, RoomNum *rooms, f32 faceangle, u8 *ailist) { struct chrdata *chr; struct coord testpos; @@ -1345,7 +1345,7 @@ struct prop *chr0f020b14(struct prop *prop, struct model *model, return prop; } -struct prop *chrAllocate(struct model *model, struct coord *pos, s16 *rooms, f32 faceangle, u8 *ailist) +struct prop *chrAllocate(struct model *model, struct coord *pos, RoomNum *rooms, f32 faceangle, u8 *ailist) { struct prop *prop = propAllocate(); @@ -1871,7 +1871,7 @@ void chrHandleJointPositioned(s32 joint, Mtxf *mtx) } } -void chr0f021fa8(struct chrdata *chr, struct coord *pos, s16 *rooms) +void chr0f021fa8(struct chrdata *chr, struct coord *pos, RoomNum *rooms) { struct coord lower; struct coord upper; @@ -1904,7 +1904,7 @@ void chr0f021fa8(struct chrdata *chr, struct coord *pos, s16 *rooms) bgFindEnteredRooms(&lower, &upper, rooms, 7, true); } -void chr0f022084(struct chrdata *chr, s16 *room) +void chr0f022084(struct chrdata *chr, RoomNum *room) { chr0f021fa8(chr, &chr->prop->pos, room); } diff --git a/src/game/chraction.c b/src/game/chraction.c index 65b834e5a..4ca511b18 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -1520,7 +1520,7 @@ f32 chrGetAttackEntityRelativeAngle(struct chrdata *chr, s32 attackflags, s32 en { f32 angle; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; if (attackflags & ATTACKFLAG_AIMFORWARD) { return 0; @@ -5109,13 +5109,13 @@ void chrDie(struct chrdata *chr, s32 aplayernum) } } -bool func0f03645c(struct chrdata *chr, struct coord *arg1, s16 *arg2, struct coord *arg3, struct coord *arg4, s32 arg5) +bool func0f03645c(struct chrdata *chr, struct coord *arg1, RoomNum *arg2, struct coord *arg3, struct coord *arg4, s32 arg5) { bool result = false; f32 ymax; f32 ymin; f32 radius; - s16 rooms[8]; + RoomNum rooms[8]; struct prop *prop = chr->prop; chrGetBbox(prop, &radius, &ymax, &ymin); @@ -5132,7 +5132,7 @@ bool func0f03645c(struct chrdata *chr, struct coord *arg1, s16 *arg2, struct coo return result; } -bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, struct coord *vector, f32 arg6, u32 types) +bool func0f03654c(struct chrdata *chr, struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, struct coord *vector, f32 arg6, u32 types) { struct coord tmp; f32 a; @@ -5144,7 +5144,7 @@ bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coo f32 radius; struct coord sp5c; struct coord sp50; - s16 sp40[8]; + RoomNum sp40[8]; f32 mult; prop = chr->prop; @@ -5302,15 +5302,15 @@ bool chrCanJumpInDirection(struct chrdata *chr, bool side, f32 distance) return propchrHasClearLineToPos(prop, &dstpos, &vector); } -bool chrIsRoomOffScreen(struct chrdata *chr, struct coord *waypos, s16 *wayrooms) +bool chrIsRoomOffScreen(struct chrdata *chr, struct coord *waypos, RoomNum *wayrooms) { struct prop *prop = chr->prop; - s16 sp7c[20]; + RoomNum sp7c[20]; u32 stack; s32 i; - s16 sp64[8]; + RoomNum sp64[8]; bool offscreen = true; - s16 sp50[8]; + RoomNum sp50[8]; if ((chr->hidden & CHRHFLAG_CLOAKED) == 0 || USINGDEVICE(DEVICE_IRSCANNER)) { func0f065dfc(&prop->pos, prop->rooms, waypos, sp64, sp7c, 20); @@ -5364,7 +5364,7 @@ void chrGoPosInitMagic(struct chrdata *chr, struct waydata *waydata, struct coor chrSetLookAngle(chr, angle); } -void chrGoPosGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, s16 *rooms, u32 *flags) +void chrGoPosGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, RoomNum *rooms, u32 *flags) { struct waypoint *waypoint = chr->act_gopos.waypoints[chr->act_gopos.curindex]; struct pad pad; @@ -5396,7 +5396,7 @@ void chrGoPosGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, } } -void chrGoPosGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, s16 *rooms) +void chrGoPosGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, RoomNum *rooms) { chrGoPosGetCurWaypointInfoWithFlags(chr, pos, rooms, NULL); } @@ -5421,7 +5421,7 @@ s32 chrGoPosCalculateBaseTtl(struct chrdata *chr) f32 zdiff; u32 stack; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; f32 speed; chrGoPosGetCurWaypointInfo(chr, &pos, rooms); @@ -5487,7 +5487,7 @@ void chrGoPosConsiderRestart(struct chrdata *chr) void chrGoPosInitExpensive(struct chrdata *chr) { struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; chrGoPosGetCurWaypointInfo(chr, &pos, rooms); @@ -5600,7 +5600,7 @@ s16 chrPatrolCalculatePadNum(struct chrdata *chr, s32 numsteps) return *padnumptr; } -void chrPatrolGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, s16 *rooms, u32 *flags) +void chrPatrolGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, RoomNum *rooms, u32 *flags) { s32 padnum = chrPatrolCalculatePadNum(chr, 0); struct pad pad; @@ -5619,14 +5619,14 @@ void chrPatrolGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos } } -void chrPatrolGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, s16 *rooms) +void chrPatrolGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, RoomNum *rooms) { chrPatrolGetCurWaypointInfoWithFlags(chr, pos, rooms, NULL); } void func0f037580(struct chrdata *chr) { - s16 rooms[8]; + RoomNum rooms[8]; chr->act_patrol.waydata.mode = WAYMODE_INIT; chr->act_patrol.waydata.iter = 0; @@ -5645,26 +5645,26 @@ void func0f0375b0(struct chrdata *chr) func0f037580(chr); } -void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, struct coord *arg3, s16 *rooms) +void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, struct coord *arg3, RoomNum *rooms) { - s16 sp118[8]; + RoomNum sp118[8]; f32 ymax; f32 ymin; f32 radius; f32 ground; u16 floorcol; u8 floortype; - s16 floorroom; + RoomNum floorroom; struct coord spf4; struct prop *prop = chr->prop; union modelrwdata *rwdata; struct waypoint *waypoint; struct coord spdc; - s16 spcc[8]; + RoomNum spcc[8]; u32 stack[4]; struct pad pad; struct coord sp5c; - s16 sp4c[8]; + RoomNum sp4c[8]; chr->invalidmove = 0; chr->lastmoveok60 = g_Vars.lvframe60; @@ -5773,7 +5773,7 @@ void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, st */ void chrCalculatePosition(struct chrdata *chr, struct coord *pos) { - s16 rooms[8]; + RoomNum rooms[8]; f32 frac; if (chr->actiontype == ACT_PATROL && chr->act_patrol.waydata.mode == WAYMODE_MAGIC) { @@ -6075,7 +6075,7 @@ void chrGoPosChooseAnimation(struct chrdata *chr) } } -bool chrGoToRoomPos(struct chrdata *chr, struct coord *pos, s16 *room, u32 goposflags) +bool chrGoToRoomPos(struct chrdata *chr, struct coord *pos, RoomNum *room, u32 goposflags) { struct prop *prop = chr->prop; struct waypoint *nextwaypoint; @@ -6083,7 +6083,7 @@ bool chrGoToRoomPos(struct chrdata *chr, struct coord *pos, s16 *room, u32 gopos struct waypoint *waypoints[MAX_CHRWAYPOINTS]; s32 i; struct coord curwppos; - s16 curwprooms[8]; + RoomNum curwprooms[8]; s32 isgopos = chr->actiontype == ACT_GOPOS && (chr->act_gopos.flags & GOPOSMASK_SPEED) == (goposflags & 0xff & GOPOSMASK_SPEED) && !chrGoPosIsWaiting(chr); @@ -6249,15 +6249,15 @@ void chrStartPatrol(struct chrdata *chr, struct path *path) s32 *padnumptr; struct pad pad; struct coord nextpos; - s16 nextrooms[8]; - s16 rooms[8]; + RoomNum nextrooms[8]; + RoomNum rooms[8]; f32 ymax; f32 ymin; f32 radius; f32 bestdistance = 0; s32 nextstep = -1; struct prop *prop = chr->prop; - s16 sp60[2]; + RoomNum sp60[2]; if (CHRRACE(chr) != RACE_EYESPY) { // Do some kind of collision test with the pad to resume from... @@ -6361,11 +6361,11 @@ void chrRecordLastVisibleTargetTime(struct chrdata *chr) chr->lastvisibletarget60 = g_Vars.lvframe60; } -bool chrHasLosToEntity(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, bool allowextraheight, u32 attackflags, u32 entityid) +bool chrHasLosToEntity(struct chrdata *chr, struct coord *chrpos, RoomNum *chrrooms, bool allowextraheight, u32 attackflags, u32 entityid) { bool result = false; struct coord targetpos; - s16 targetrooms[8]; + RoomNum targetrooms[8]; struct prop *targetprop; struct chrdata *targetchr; u32 types; @@ -6404,7 +6404,7 @@ bool chrHasLosToEntity(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, if (allowextraheight && (chr->chrflags & CHRCFLAG_LOSEXTRAHEIGHT)) { struct coord frompos; - s16 fromrooms[8]; + RoomNum fromrooms[8]; frompos.x = chrpos->x; frompos.y = chrpos->y + 70; @@ -6451,7 +6451,7 @@ bool chrHasLosToEntity(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, return result; } -bool chrHasLosToAttackTarget(struct chrdata *chr, struct coord *pos, s16 *rooms, bool allowextraheight) +bool chrHasLosToAttackTarget(struct chrdata *chr, struct coord *pos, RoomNum *rooms, bool allowextraheight) { u32 attackflags = ATTACKFLAG_AIMATTARGET; u32 entityid = 0; @@ -6464,16 +6464,16 @@ bool chrHasLosToAttackTarget(struct chrdata *chr, struct coord *pos, s16 *rooms, return chrHasLosToEntity(chr, pos, rooms, allowextraheight, attackflags, entityid); } -bool chrHasLosToChr(struct chrdata *chr, struct chrdata *target, s16 *room) +bool chrHasLosToChr(struct chrdata *chr, struct chrdata *target, RoomNum *room) { bool cansee = false; u32 stack; - s16 sp88[] = {-1, 0, 0, 0, 0, 0, 0, 0}; + RoomNum sp88[] = {-1, 0, 0, 0, 0, 0, 0, 0}; if (!botIsTargetInvisible(chr, target)) { struct prop *prop = chr->prop; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; pos.x = prop->pos.x; pos.y = chr->ground + chr->height - 20; @@ -6529,12 +6529,12 @@ bool chrHasLosToTarget(struct chrdata *chr) return cansee; } -bool chrHasLosToPos(struct chrdata *chr, struct coord *pos, s16 *rooms) +bool chrHasLosToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms) { struct prop *prop = chr->prop; bool result = false; struct coord eyepos; - s16 chrrooms[8]; + RoomNum chrrooms[8]; eyepos.x = prop->pos.x; eyepos.y = chr->ground + chr->height - 20; @@ -6558,7 +6558,7 @@ bool chrHasLosToPos(struct chrdata *chr, struct coord *pos, s16 *rooms) * Wasteful because this function calculates angles then does nothing with them. * chrHasLosToPos is called with the same arguments regardless. */ -bool chrHasLosToPosWasteful(struct chrdata *chr, struct coord *pos, s16 *rooms) +bool chrHasLosToPosWasteful(struct chrdata *chr, struct coord *pos, RoomNum *rooms) { f32 facingangle = chrGetInverseTheta(chr); f32 posangle = atan2f(pos->x - chr->prop->pos.x, pos->z - chr->prop->pos.z); @@ -7122,7 +7122,7 @@ bool chrGoToPad(struct chrdata *chr, s32 padnum, u32 goposflags) if (padnum >= 0) #endif { - s16 rooms[2]; + RoomNum rooms[2]; struct pad pad; padUnpack(padnum, PADFIELD_ROOM | PADFIELD_POS, &pad); @@ -7234,8 +7234,8 @@ bool chrGoToProp(struct chrdata *chr, struct prop *prop, u32 goposflags) bool chrGoToPos(struct chrdata *chr, struct coord *pos, u32 goposflags) { - s16 inrooms[21]; - s16 aboverooms[21]; + RoomNum inrooms[21]; + RoomNum aboverooms[21]; if (chrIsReadyForOrders(chr)) { #if VERSION >= VERSION_NTSC_1_0 @@ -7246,7 +7246,7 @@ bool chrGoToPos(struct chrdata *chr, struct coord *pos, u32 goposflags) if (g_NumChrsSeenPlayerRecently2 < 10) #endif { - s16 *rooms = NULL; + RoomNum *rooms = NULL; bgFindRoomsByPos(pos, inrooms, aboverooms, 20, NULL); @@ -7372,7 +7372,7 @@ bool chrTryRunFromTarget(struct chrdata *chr) f32 ymin; f32 radius; struct coord dst; - s16 rooms[8]; + RoomNum rooms[8]; struct coord diff; f32 distance; @@ -7492,7 +7492,7 @@ bool chrGoToCoverProp(struct chrdata *chr) f32 propheight; f32 chrheight; struct coord dstpos; - s16 dstrooms[8]; + RoomNum dstrooms[8]; propGetBbox(prop, &propradius, &propymax, &propymin); propGetBbox(chrprop, &chrradius, &chrymax, &chrymin); @@ -9032,7 +9032,7 @@ bool func0f03e9f4(struct chrdata *chr, struct attackanimconfig *animcfg, bool fi f32 sqdist; bool holdturn; struct coord targetpos; - s16 targetrooms[8]; + RoomNum targetrooms[8]; sp178 = targetprop->pos.x - chrprop->pos.x; sp174 = targetprop->pos.y - chrprop->pos.y; @@ -9867,10 +9867,10 @@ void chrTickShoot(struct chrdata *chr, s32 handnum) bool shotdue; bool makebeam; struct coord gunpos; - s16 gunrooms[8]; + RoomNum gunrooms[8]; struct coord hitpos; bool hitsomething; - s16 hitrooms[8]; + RoomNum hitrooms[8]; bool queriedhitrooms; s32 tickspershot; @@ -11771,7 +11771,7 @@ void func0f044b68(struct coord *arg0, struct coord *arg1, struct coord *arg2) * This is similar to chrNavCheckForObstacle. The difference between the two are * not yet understood. */ -bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, s32 arg9) +bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, RoomNum *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, s32 arg9) { struct coord spd4; f32 spd0; @@ -11791,8 +11791,8 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom f32 radius2; struct coord sp6c; struct coord sp60; - s16 sp50[8]; - s16 sp40[8]; + RoomNum sp50[8]; + RoomNum sp40[8]; struct prop *prop = chr->prop; chrGetBbox(prop, &radius2, &ymax, &ymin); @@ -11928,7 +11928,7 @@ bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *chrpos, s16 *chrroom * This is similar to chrNavCanSeeNextPos. The only difference is this one uses * the value1 and value2 variables. */ -bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, bool hasobstacle) +bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, RoomNum *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, bool hasobstacle) { struct coord spd4; f32 spd0; @@ -11950,8 +11950,8 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr f32 radius2; struct coord sp6c; struct coord sp60; - s16 sp50[8]; - s16 sp40[8]; + RoomNum sp50[8]; + RoomNum sp40[8]; struct prop *prop = chr->prop; chrGetBbox(prop, &radius2, &ymax, &ymin); @@ -12656,7 +12656,7 @@ bool chrGoPosUpdateLiftAction(struct chrdata *chr, u32 curpadflags, bool arg2, b // Waiting for door to close or lift to arrive at destination if (arg2 || chr->liftaction == LIFTACTION_WAITINGONLIFT) { // Continue waiting - s16 rooms[] = {0, -1}; + RoomNum rooms[] = {0, -1}; u32 stack2; rooms[0] = nextpad.room; @@ -12727,13 +12727,13 @@ void chrTickGoPos(struct chrdata *chr) { struct waypoint *waypoint; struct coord nextpos; - s16 nextrooms[8]; + RoomNum nextrooms[8]; struct prop *prop = chr->prop; bool enteringmagic = false; struct pad pad; bool sp240 = true; struct coord curwppos; - s16 curwprooms[8]; + RoomNum curwprooms[8]; u32 curwpflags; chr->act_gopos.flags &= ~(GOPOSFLAG_CROUCH | GOPOSFLAG_DUCK); @@ -13025,7 +13025,7 @@ void chrTickPatrol(struct chrdata *chr) bool enteringmagic; u32 flags = 0; struct coord sp58; - s16 sp48[8]; + RoomNum sp48[8]; s32 arrivinglaterally; s32 arriving; bool advance; @@ -13742,7 +13742,7 @@ f32 chrGetAngleToTarget(struct chrdata *chr) return chrGetAngleToPos(chr, &prop->pos); } -void chrGetAttackEntityPos(struct chrdata *chr, u32 attackflags, s32 entityid, struct coord *pos, s16 *rooms) +void chrGetAttackEntityPos(struct chrdata *chr, u32 attackflags, s32 entityid, struct coord *pos, RoomNum *rooms) { struct prop *targetprop; struct chrdata *targetchr; @@ -14585,7 +14585,7 @@ bool waypointIsWithin90DegreesOfPosAngle(struct waypoint *waypoint, struct coord * those are in the quadrant then no further checks are made and the function * returns -1. */ -s32 chrFindWaypointWithinPosQuadrant(struct coord *pos, s16 *rooms, f32 angle, u8 quadrant) +s32 chrFindWaypointWithinPosQuadrant(struct coord *pos, RoomNum *rooms, f32 angle, u8 quadrant) { struct waypoint *waypoint = waypointFindClosestToPos(pos, rooms); s32 neighbournum; @@ -14716,7 +14716,7 @@ bool chrSetChrPresetToChrNearSelf(u8 checktype, struct chrdata *chr, f32 distanc bool chrSetChrPresetToChrNearPad(u32 checktype, struct chrdata *chr, f32 distance, s32 padnum) { struct pad pad; - s16 rooms[2]; + RoomNum rooms[2]; padnum = chrResolvePadId(chr, padnum); padUnpack(padnum, PADFIELD_POS | PADFIELD_ROOM, &pad); @@ -14727,19 +14727,19 @@ bool chrSetChrPresetToChrNearPad(u32 checktype, struct chrdata *chr, f32 distanc return chrSetChrPresetToChrNearPos(checktype, chr, distance, &pad.pos, rooms); } -bool chrSetChrPresetToChrNearPos(u8 checktype, struct chrdata *chr, f32 distance, struct coord *pos, s16 *rooms) +bool chrSetChrPresetToChrNearPos(u8 checktype, struct chrdata *chr, f32 distance, struct coord *pos, RoomNum *rooms) { s32 i; s16 *propnumptr; s16 propnums[256]; - s16 allrooms[21]; + RoomNum allrooms[21]; f32 xmin = pos->x - distance; f32 xmax = pos->x + distance; f32 ymin = pos->y - distance; f32 ymax = pos->y + distance; f32 zmin = pos->z - distance; f32 zmax = pos->z + distance; - s16 neighbours[11]; + RoomNum neighbours[11]; roomsCopy(rooms, allrooms); @@ -14912,7 +14912,7 @@ bool chrSetPadPresetToPadOnRouteToTarget(struct chrdata *chr) return false; } -bool chrIsPosOffScreen(struct coord *pos, s16 *rooms) +bool chrIsPosOffScreen(struct coord *pos, RoomNum *rooms) { bool offscreen = true; s32 i; @@ -14943,12 +14943,12 @@ bool chrIsPosOffScreen(struct coord *pos, s16 *rooms) * If the spawn cannot happen, the function return false. */ #if VERSION >= VERSION_NTSC_1_0 -bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool force, bool onlysurrounding) +bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, RoomNum *rooms, f32 angle, bool allowonscreen, bool force, bool onlysurrounding) { struct coord testpos; s32 i; u32 types; - s16 testrooms[8]; + RoomNum testrooms[8]; f32 ymin; f32 ymax = 200; f32 curangle = angle; @@ -15030,12 +15030,12 @@ bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angl * ntsc-beta's version of this function doesn't have the onlysurrounding argument * nor out of bounds checking, and lacks the reduction for the volume test. */ -bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool force) +bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, RoomNum *rooms, f32 angle, bool allowonscreen, bool force) { struct coord testpos; s32 i; u32 types; - s16 testrooms[8]; + RoomNum testrooms[8]; f32 curangle = angle; if (force) { @@ -15084,11 +15084,11 @@ bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angl * triggered, but the function will not attempt to spawn the chr until the next * time it's called. */ -struct prop *chrSpawnAtCoord(s32 bodynum, s32 headnum, struct coord *pos, s16 *rooms, f32 angle, u8 *ailist, u32 spawnflags) +struct prop *chrSpawnAtCoord(s32 bodynum, s32 headnum, struct coord *pos, RoomNum *rooms, f32 angle, u8 *ailist, u32 spawnflags) { struct prop *prop; struct coord pos2; - s16 rooms2[8]; + RoomNum rooms2[8]; s32 stack; if (chrsGetNumFree() > 1) { @@ -15199,7 +15199,7 @@ struct prop *chrSpawnAtPad(struct chrdata *basechr, s32 body, s32 head, s32 pad_ { s32 resolved_pad_id = chrResolvePadId(basechr, pad_id); struct pad pad; - s16 room[2]; + RoomNum room[2]; f32 fvalue; padUnpack(resolved_pad_id, PADFIELD_POS | PADFIELD_LOOK | PADFIELD_ROOM, &pad); fvalue = atan2f(pad.look.x, pad.look.z); @@ -15253,10 +15253,10 @@ void func0f04b740(void) // empty } -bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle, bool force) +bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 angle, bool force) { struct coord pos2; - s16 rooms2[8]; + RoomNum rooms2[8]; bool result = false; u32 nodetype; union modelrwdata *rwdata; @@ -15356,7 +15356,7 @@ bool chrCheckCoverOutOfSight(struct chrdata *chr, s32 covernum, bool soft) s32 chrAssignCoverByCriteria(struct chrdata *chr, u16 criteria, s32 refdist) { - s16 rooms[8]; + RoomNum rooms[8]; struct cover cover; struct covercandidate tmp; s32 oldcover; @@ -15619,7 +15619,7 @@ bool chrRunFromPos(struct chrdata *chr, u32 goposflags, f32 rundist, struct coor { f32 curdistfrompos; struct coord delta; - s16 rooms[8]; + RoomNum rooms[8]; if (chrIsReadyForOrders(chr)) { delta.x = chr->prop->pos.x - frompos->x; @@ -16010,12 +16010,12 @@ bool audioWasNotPlayedRecently(s16 audioid) } #if VERSION >= VERSION_NTSC_1_0 -Gfx *chrsRenderChrStats(Gfx *gdl, s16 *rooms) +Gfx *chrsRenderChrStats(Gfx *gdl, RoomNum *rooms) { return gdl; } #else -Gfx *chrsRenderChrStats(Gfx *gdl, s16 *rooms) +Gfx *chrsRenderChrStats(Gfx *gdl, RoomNum *rooms) { s32 x; s32 y; @@ -16127,7 +16127,7 @@ void chrAvoid(struct chrdata *chr) f32 zdiff; f32 halfchrradius; f32 chrangle = modelGetChrRotY(chr->model); - s16 dstrooms[8]; + RoomNum dstrooms[8]; struct coord dstpos; // @bug: This shouldn't be here, and the perim is not enabled again diff --git a/src/game/chraicommands.c b/src/game/chraicommands.c index f7aba6865..49e55c0e6 100644 --- a/src/game/chraicommands.c +++ b/src/game/chraicommands.c @@ -2361,7 +2361,7 @@ bool aiObjectMoveToPad(void) u16 padnum = cmd[4] | (cmd[3] << 8); Mtxf matrix; struct pad pad; - s16 rooms[2]; + RoomNum rooms[2]; if (obj && obj->prop) { padUnpack(padnum, PADFIELD_POS | PADFIELD_LOOK | PADFIELD_UP | PADFIELD_ROOM, &pad); @@ -5184,7 +5184,7 @@ bool aiChrMoveToPad(void) bool pass = false; f32 theta; struct pad pad; - s16 rooms[2]; + RoomNum rooms[2]; struct chrdata *chr2; if (chr && chr->prop) { @@ -9611,7 +9611,7 @@ bool aiSetDrCarollImages(void) bool aiSetRoomFlag(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - s16 roomnum = cmd[3] | cmd[2] << 8; + RoomNum roomnum = cmd[3] | cmd[2] << 8; s16 flag = cmd[5] | cmd[4] << 8; g_Rooms[roomnum].flags |= flag; @@ -9658,7 +9658,7 @@ bool aiShowCutsceneChrs(void) bool aiConfigureEnvironment(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - s16 room_id = (cmd[3] | (cmd[2] << 8)); + RoomNum room_id = (cmd[3] | (cmd[2] << 8)); s32 value = cmd[5]; s32 i; diff --git a/src/game/dlights.c b/src/game/dlights.c index 3def7eaf0..c00836a0a 100644 --- a/src/game/dlights.c +++ b/src/game/dlights.c @@ -311,7 +311,7 @@ void roomSetDefaults(struct room *room) room->lightop_duration240 = 0; } -Gfx *lightsSetForRoom(Gfx *gdl, s16 roomnum) +Gfx *lightsSetForRoom(Gfx *gdl, RoomNum roomnum) { Lights1 *lights = gfxAllocate(sizeof(Lights1)); @@ -989,7 +989,7 @@ bool lightTickBroken(s32 roomnum, s32 lightnum) f32 rand1 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1 f32 rand2 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1 s32 sparktype = -1; - s16 smokerooms[2]; + RoomNum smokerooms[2]; struct bgroom *room; spc8.x = light->bbox[1].x - light->bbox[0].x; diff --git a/src/game/dyntex.c b/src/game/dyntex.c index 33600ae35..97ebf827c 100644 --- a/src/game/dyntex.c +++ b/src/game/dyntex.c @@ -354,7 +354,7 @@ void dyntexSetCurrentType(s16 type) g_DyntexCurType = type; } -void dyntexSetCurrentRoom(s16 roomnum) +void dyntexSetCurrentRoom(RoomNum roomnum) { s32 i; diff --git a/src/game/explosions.c b/src/game/explosions.c index 43a8a8e62..18ce20f59 100644 --- a/src/game/explosions.c +++ b/src/game/explosions.c @@ -81,18 +81,18 @@ struct explosiontype g_ExplosionTypes[] = { /*25*/ { 640, 480, 32, 11.2, 1600, 1000, 1000, 180, 2, 5, SMOKETYPE_NONE, 0x80a4, 4 }, }; -bool explosionCreateSimple(struct prop *prop, struct coord *pos, s16 *rooms, s16 type, s32 playernum) +bool explosionCreateSimple(struct prop *prop, struct coord *pos, RoomNum *rooms, s16 type, s32 playernum) { return explosionCreate(prop, pos, rooms, type, playernum, false, NULL, 0, NULL); } -bool explosionCreateComplex(struct prop *prop, struct coord *pos, s16 *rooms, s16 type, s32 playernum) +bool explosionCreateComplex(struct prop *prop, struct coord *pos, RoomNum *rooms, s16 type, s32 playernum) { struct coord sp100; struct coord sp88; struct explosiontype *etype; bool makescorch = true; - s16 room; + RoomNum room; f32 y; struct prop *collisionprop; @@ -232,8 +232,8 @@ void explosionAlertChrs(f32 *radius, struct coord *noisepos) #endif } -bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exprooms, - s16 type, s32 playernum, bool makescorch, struct coord *arg6, s16 room, struct coord *arg8) +bool explosionCreate(struct prop *sourceprop, struct coord *exppos, RoomNum *exprooms, + s16 type, s32 playernum, bool makescorch, struct coord *arg6, RoomNum room, struct coord *arg8) { u32 stack; struct explosion *exp = NULL; @@ -314,8 +314,8 @@ bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exproom struct coord portal2bbmax; struct coord spd4; struct coord spc8; - s16 otherroom; - s16 otherroom2; + RoomNum otherroom; + RoomNum otherroom2; f32 mult = 1; s32 stack4; s32 portalnum2; @@ -626,7 +626,7 @@ bool explosionOverlapsProp(struct explosion *exp, struct prop *prop, struct coor { bool result = false; s32 i; - s16 rooms[8]; + RoomNum rooms[8]; if (exp->type == EXPLOSIONTYPE_HUGE25) { result = true; diff --git a/src/game/lv.c b/src/game/lv.c index 0aed98d9d..57a3feb6f 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -1607,9 +1607,9 @@ Gfx *lvRender(Gfx *gdl) || debugIsChrStatsEnabled() || debug0f11ee40()) { #if VERSION < VERSION_NTSC_1_0 - s16 spc8[21]; - s16 spb0[11]; - s16 sp9c[10]; + RoomNum spc8[21]; + RoomNum spb0[11]; + RoomNum sp9c[10]; s32 j; sp9c[0] = g_Vars.currentplayer->memcamroom; @@ -2063,7 +2063,7 @@ void lvTick(void) // Check if another player is in a nearby room for (playernum = 0; playernum < PLAYERCOUNT() && !foundnearbychr; playernum++) { if (g_Vars.players[playernum]->isdead == false) { - s16 *rooms = g_Vars.players[playernum]->prop->rooms; + RoomNum *rooms = g_Vars.players[playernum]->prop->rooms; s32 r; for (r = 0; rooms[r] != -1 && !foundnearbychr; r++) { diff --git a/src/game/mplayer/scenarios.c b/src/game/mplayer/scenarios.c index 4ee3e806c..e2c144d21 100644 --- a/src/game/mplayer/scenarios.c +++ b/src/game/mplayer/scenarios.c @@ -64,10 +64,10 @@ struct mpscenario { Gfx *(*radarextrafunc)(Gfx *gdl); bool (*radarchrfunc)(Gfx **gdl, struct prop *prop); bool (*highlightpropfunc)(struct prop *prop, s32 *colour); - bool (*spawnfunc)(f32 arg0, struct coord *pos, s16 *rooms, struct prop *prop, f32 *arg4); + bool (*spawnfunc)(f32 arg0, struct coord *pos, RoomNum *rooms, struct prop *prop, f32 *arg4); s32 (*maxteamsfunc)(void); - bool (*isroomhighlightedfunc)(s16 room); - void (*highlightroomfunc)(s16 room, s32 *arg1, s32 *arg2, s32 *arg3); + bool (*isroomhighlightedfunc)(RoomNum room); + void (*highlightroomfunc)(RoomNum room, s32 *arg1, s32 *arg2, s32 *arg3); void *unk3c; // never hooked into nor fired void (*readsavefunc)(struct savebuffer *buffer); void (*writesavefunc)(struct savebuffer *buffer); @@ -791,7 +791,7 @@ bool scenarioHighlightProp(struct prop *prop, s32 *colour) * * CTC uses this to ensure the chrs spawn near their base. */ -f32 scenarioChooseSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop) +f32 scenarioChooseSpawnLocation(f32 chrradius, struct coord *pos, RoomNum *rooms, struct prop *prop) { f32 result; @@ -917,7 +917,7 @@ s32 scenarioGetMaxTeams(void) /** * This callback is unused. */ -bool scenarioIsRoomHighlighted(s16 room) +bool scenarioIsRoomHighlighted(RoomNum room) { if (g_MpScenarios[g_MpSetup.scenario].isroomhighlightedfunc) { return g_MpScenarios[g_MpSetup.scenario].isroomhighlightedfunc(room); @@ -931,7 +931,7 @@ bool scenarioIsRoomHighlighted(s16 room) * * Used in CTC for the team bases and in KOH for the hill. */ -void scenarioHighlightRoom(s16 room, s32 *arg1, s32 *arg2, s32 *arg3) +void scenarioHighlightRoom(RoomNum room, s32 *arg1, s32 *arg2, s32 *arg3) { if (g_MpScenarios[g_MpSetup.scenario].highlightroomfunc) { g_MpScenarios[g_MpSetup.scenario].highlightroomfunc(room, arg1, arg2, arg3); @@ -1351,7 +1351,7 @@ void scenarioHandleDroppedToken(struct chrdata *chr, struct prop *prop) struct defaultobj *obj; struct pad pad; Mtxf mtx; - s16 rooms[2]; + RoomNum rooms[2]; if (g_MpSetup.scenario == MPSCENARIO_CAPTURETHECASE) { for (i = 0; i < ARRAYCOUNT(g_ScenarioData.ctc.tokens); i++) { diff --git a/src/game/mplayer/scenarios/capturethecase.inc b/src/game/mplayer/scenarios/capturethecase.inc index 652561aca..b701a69c2 100644 --- a/src/game/mplayer/scenarios/capturethecase.inc +++ b/src/game/mplayer/scenarios/capturethecase.inc @@ -457,7 +457,7 @@ void ctcAddPad(s32 *cmd) } } -bool ctcChooseSpawnLocation(f32 arg0, struct coord *pos, s16 *rooms, struct prop *prop, f32 *arg4) +bool ctcChooseSpawnLocation(f32 arg0, struct coord *pos, RoomNum *rooms, struct prop *prop, f32 *arg4) { struct chrdata *chr = prop->chr; s32 index = radarGetTeamIndex(chr->team); @@ -477,7 +477,7 @@ s32 ctcGetMaxTeams(void) return 4; } -bool ctcIsRoomHighlighted(s16 room) +bool ctcIsRoomHighlighted(RoomNum room) { s32 i; @@ -490,7 +490,7 @@ bool ctcIsRoomHighlighted(s16 room) return false; } -void ctcHighlightRoom(s16 roomnum, s32 *arg1, s32 *arg2, s32 *arg3) +void ctcHighlightRoom(RoomNum roomnum, s32 *arg1, s32 *arg2, s32 *arg3) { s32 i; diff --git a/src/game/mplayer/scenarios/kingofthehill.inc b/src/game/mplayer/scenarios/kingofthehill.inc index ae926e975..2a837ff23 100644 --- a/src/game/mplayer/scenarios/kingofthehill.inc +++ b/src/game/mplayer/scenarios/kingofthehill.inc @@ -658,12 +658,12 @@ void kohAddHill(s32 *cmd) } } -bool kohIsRoomHighlighted(s16 room) +bool kohIsRoomHighlighted(RoomNum room) { return room == g_ScenarioData.koh.hillrooms[0]; } -void kohHighlightRoom(s16 roomnum, s32 *arg1, s32 *arg2, s32 *arg3) +void kohHighlightRoom(RoomNum roomnum, s32 *arg1, s32 *arg2, s32 *arg3) { if (roomnum == g_ScenarioData.koh.hillrooms[0]) { f32 a = *arg1; diff --git a/src/game/nbomb.c b/src/game/nbomb.c index c38e0265d..9ef9e2839 100644 --- a/src/game/nbomb.c +++ b/src/game/nbomb.c @@ -431,7 +431,7 @@ void nbombInflictDamage(struct nbomb *nbomb) s16 propnums[256]; struct coord bbmin; struct coord bbmax; - s16 roomnums[54]; + RoomNum roomnums[54]; s16 *propnumptr; s32 i; struct gset gset; diff --git a/src/game/objectives.c b/src/game/objectives.c index 7cc60ae29..61e147e26 100644 --- a/src/game/objectives.c +++ b/src/game/objectives.c @@ -455,7 +455,7 @@ void objectiveCheckRoomEntered(s32 currentroom) } } -void objectiveCheckThrowInRoom(s32 arg0, s16 *inrooms) +void objectiveCheckThrowInRoom(s32 arg0, RoomNum *inrooms) { struct criteria_throwinroom *criteria = g_ThrowInRoomCriterias; @@ -464,7 +464,7 @@ void objectiveCheckThrowInRoom(s32 arg0, s16 *inrooms) s32 room = chrGetPadRoom(NULL, criteria->pad); if (room >= 0) { - s16 requirerooms[2]; + RoomNum requirerooms[2]; requirerooms[0] = room; requirerooms[1] = -1; diff --git a/src/game/padhalllv.c b/src/game/padhalllv.c index 20f1f24b8..7d55e2be9 100644 --- a/src/game/padhalllv.c +++ b/src/game/padhalllv.c @@ -73,12 +73,12 @@ void navSetSeed(u32 upper, u32 lower) * The function will return NULL if there are no waypoints at all within the * position's room or its neighbours. */ -struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms) +struct waypoint *waypointFindClosestToPos(struct coord *pos, RoomNum *rooms) { struct waypoint *closest = NULL; - s16 allrooms[30]; + RoomNum allrooms[30]; s32 candlen = 0; - s16 neighbours[10]; + RoomNum neighbours[10]; s32 i; s32 j; struct waypoint *candwaypoints[10]; @@ -152,7 +152,7 @@ struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms) // Check which candidates have line of sight for (i = 0; i < candlen; i++) { struct pad pad; - s16 padrooms[8]; + RoomNum padrooms[8]; padUnpack(candwaypoints[i]->padnum, PADFIELD_POS | PADFIELD_ROOM, &pad); @@ -185,10 +185,10 @@ struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms) for (i = 0; i < candlen; i++) { if (checkmore[i] && (sp250[i].x != sp1d8[i].x || sp250[i].z != sp1d8[i].z)) { struct pad pad; - s16 padrooms[8]; + RoomNum padrooms[8]; struct coord sp98; struct coord tmppos; - s16 tmprooms[8]; + RoomNum tmprooms[8]; f32 mult; padUnpack(candwaypoints[i]->padnum, PADFIELD_POS | PADFIELD_ROOM, &pad); diff --git a/src/game/player.c b/src/game/player.c index b3de7af4e..0e7278e30 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -211,7 +211,7 @@ s32 g_NumDeathAnimations = 0; * @dangerous: If there are too many pads (24+) in the setup then array * overflows may occur. */ -f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms, struct prop *prop, s16 *pads, s32 numpads) +f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, RoomNum *dstrooms, struct prop *prop, s16 *pads, s32 numpads) { u8 verybadpads[24]; u8 badpads[24]; @@ -226,7 +226,7 @@ f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms // "sl" prefixes are for shortlist s16 slpadindexes[8]; struct coord slpositions[4]; - s16 slrooms[4][8]; + RoomNum slrooms[4][8]; f32 slangles[4]; s32 sllen = 0; @@ -237,9 +237,9 @@ f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms u8 stack2[0x10]; struct pad pad; s32 stack3[2]; - s16 tmppadrooms[2]; + RoomNum tmppadrooms[2]; f32 bestsqdist; - s16 neighbours[20]; + RoomNum neighbours[20]; // Iterate all spawn pads and populate the category arrays for (p = 0; p < numpads; p++) { @@ -472,7 +472,7 @@ f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms return dstangle; } -f32 playerChooseGeneralSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop) +f32 playerChooseGeneralSpawnLocation(f32 chrradius, struct coord *pos, RoomNum *rooms, struct prop *prop) { return playerChooseSpawnLocation(chrradius, pos, rooms, prop, g_SpawnPoints, g_NumSpawnPoints); } @@ -480,7 +480,7 @@ f32 playerChooseGeneralSpawnLocation(f32 chrradius, struct coord *pos, s16 *room void playerStartNewLife(void) { struct coord pos = {0, 0, 0}; - s16 rooms[8]; + RoomNum rooms[8]; f32 angle; s32 *cmd = g_StageSetup.intro; f32 groundy; @@ -3366,9 +3366,9 @@ void playerTick(bool arg0) rocket->base.realrot[0][0] * rocket->base.realrot[0][0] + rocket->base.realrot[1][0] * rocket->base.realrot[1][0] + rocket->base.realrot[2][0] * rocket->base.realrot[2][0]); - s16 inrooms[21]; - s16 aboverooms[21]; - s16 bestroom; + RoomNum inrooms[21]; + RoomNum aboverooms[21]; + RoomNum bestroom; s16 outofbounds = false; sp2b8[0][0] = rocket->base.realrot[0][0] / sp2a8; @@ -4921,14 +4921,14 @@ void playerSetCameraMode(s32 mode) g_Vars.currentplayer->cameramode = mode; } -void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, struct coord *pos2, s16 *rooms2) +void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, struct coord *pos2, RoomNum *rooms2) { bool done = false; - s16 inrooms[21]; - s16 aboverooms[21]; - s16 sp54[8]; - s16 bestroom; - s16 tmp; + RoomNum inrooms[21]; + RoomNum aboverooms[21]; + RoomNum sp54[8]; + RoomNum bestroom; + RoomNum tmp; s32 i; s32 room; @@ -5022,7 +5022,7 @@ void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, str void player0f0c1ba4(struct coord *pos, struct coord *up, struct coord *look, struct coord *memcampos, s32 memcamroom) { - s16 rooms[2]; + RoomNum rooms[2]; rooms[0] = memcamroom; rooms[1] = -1; diff --git a/src/game/playerreset.c b/src/game/playerreset.c index 0e786b62c..aed9245f3 100644 --- a/src/game/playerreset.c +++ b/src/game/playerreset.c @@ -110,7 +110,7 @@ struct cmd32 { void playerReset(void) { struct coord pos = {0, 0, 0}; - s16 rooms[8]; + RoomNum rooms[8]; f32 turnanglerad = 0; f32 groundy; bool hasdefaultweapon = false; diff --git a/src/game/prop.c b/src/game/prop.c index 12360bc08..2a0c496f3 100644 --- a/src/game/prop.c +++ b/src/game/prop.c @@ -391,11 +391,11 @@ Gfx *propRender(Gfx *gdl, struct prop *prop, bool xlupass) * terminal in the pre-bg pass and the screen in the post-bg pass, likely to * avoid Z-fighting issues. */ -Gfx *propsRender(Gfx *gdl, s16 renderroomnum, s32 renderpass, s16 *roomnumsbyprop) +Gfx *propsRender(Gfx *gdl, RoomNum renderroomnum, s32 renderpass, RoomNum *roomnumsbyprop) { struct prop **ptr; struct prop *prop; - s16 *proprooms; + RoomNum *proprooms; if (renderpass == RENDERPASS_OPA_PREBG || renderpass == RENDERPASS_OPA_POSTBG) { // Iterate onscreen props near to far @@ -592,22 +592,22 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc s32 sparktype; #ifdef AVOID_UB - s16 rooms[131]; + RoomNum rooms[131]; #else - s16 rooms[124]; + RoomNum rooms[124]; #endif - s16 spc8[8]; - s16 spb8[8]; + RoomNum spc8[8]; + RoomNum spb8[8]; s32 uVar6; - s16 *roomsptr; + RoomNum *roomsptr; struct prop *prop; struct coord spa0; struct defaultobj *obj; bool doexplosiveshells; struct coord sp8c; - s16 sp7c[8]; - s16 sp6c[8]; + RoomNum sp7c[8]; + RoomNum sp6c[8]; struct prop *hitprop; bgun0f0a9494(arg6); @@ -1688,7 +1688,7 @@ void propsTickPlayer(bool islastplayer) s32 savedslotupdate240_60; f32 savedslotupdate240f; struct g_vars *vars = &g_Vars; - s16 *rooms; + RoomNum *rooms; u8 mostindex; u8 leastindex; u8 runstateindex; @@ -2215,8 +2215,8 @@ void propsTickPadEffects(void) struct pad pad; u32 stack; struct coord up; - s16 rooms[2]; - s16 rooms2[2]; + RoomNum rooms[2]; + RoomNum rooms2[2]; s32 type; if (g_LastPadEffectIndex >= 0) { @@ -2306,8 +2306,8 @@ void propsTestForPickup(void) s16 *propnumptr; s32 i; s16 propnums[256]; - s16 allrooms[21]; - s16 tmp[11]; + RoomNum allrooms[21]; + RoomNum tmp[11]; if (g_Vars.currentplayer->bondmovemode != MOVEMODE_CUTSCENE && !g_PlayerInvincible @@ -2853,10 +2853,10 @@ bool propIsOfCdType(struct prop *prop, u32 types) return result; } -void roomsCopy(s16 *src, s16 *dst) +void roomsCopy(RoomNum *src, RoomNum *dst) { - s16 *srcptr = src; - s16 *dstptr = dst; + RoomNum *srcptr = src; + RoomNum *dstptr = dst; s32 val; while ((val = *srcptr) != -1) { @@ -2871,7 +2871,7 @@ void roomsCopy(s16 *src, s16 *dst) /** * Append newrooms to dstrooms without duplicates. */ -void roomsAppend(s16 *newrooms, s16 *dstrooms, s32 maxlen) +void roomsAppend(RoomNum *newrooms, RoomNum *dstrooms, s32 maxlen) { s32 i; @@ -2887,12 +2887,12 @@ void roomsAppend(s16 *newrooms, s16 *dstrooms, s32 maxlen) } } -bool arrayIntersects(s16 *a, s16 *b) +bool arrayIntersects(RoomNum *a, RoomNum *b) { - s16 *aptr = a; - s16 aval = *aptr; - s16 *bptr; - s16 bval; + RoomNum *aptr = a; + RoomNum aval = *aptr; + RoomNum *bptr; + RoomNum bval; while (aval != -1) { bptr = b; bval = *bptr; @@ -2951,7 +2951,7 @@ s32 roomAllocatePropListChunk(s32 room, s32 prevchunkindex) return -1; } -void propRegisterRoom(struct prop *prop, s16 room) +void propRegisterRoom(struct prop *prop, RoomNum room) { s32 prev = -1; s32 i; @@ -2979,7 +2979,7 @@ void propRegisterRoom(struct prop *prop, s16 room) } } -void propDeregisterRoom(struct prop *prop, s16 room) +void propDeregisterRoom(struct prop *prop, RoomNum room) { bool removed = false; s32 prev = -1; @@ -3033,8 +3033,8 @@ void propDeregisterRoom(struct prop *prop, s16 room) */ void propDeregisterRooms(struct prop *prop) { - s16 *rooms = prop->rooms; - s16 room = *rooms; + RoomNum *rooms = prop->rooms; + RoomNum room = *rooms; while (room != -1) { propDeregisterRoom(prop, room); @@ -3050,8 +3050,8 @@ void propDeregisterRooms(struct prop *prop) */ void propRegisterRooms(struct prop *prop) { - s16 *rooms = prop->rooms; - s16 room = *rooms; + RoomNum *rooms = prop->rooms; + RoomNum room = *rooms; while (room != -1) { propRegisterRoom(prop, room); @@ -3060,9 +3060,9 @@ void propRegisterRooms(struct prop *prop) } } -void func0f065d1c(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms, s16 *morerooms, u32 arg5) +void func0f065d1c(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms, RoomNum *morerooms, u32 arg5) { - s16 stackrooms[8]; + RoomNum stackrooms[8]; s32 index; s32 i; @@ -3080,12 +3080,12 @@ void func0f065d1c(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newr newrooms[index] = -1; } -void func0f065dd8(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms) +void func0f065dd8(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms) { func0f065d1c(pos, rooms, newpos, newrooms, NULL, 0); } -void func0f065dfc(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms, s16 *morerooms, u32 arg5) +void func0f065dfc(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms, RoomNum *morerooms, u32 arg5) { func0f065d1c(pos, rooms, newpos, newrooms, morerooms, arg5); @@ -3098,16 +3098,16 @@ void func0f065dfc(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newr } } -void func0f065e74(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms) +void func0f065e74(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms) { func0f065dfc(pos, rooms, newpos, newrooms, NULL, 0); } -void func0f065e98(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *dstrooms) +void func0f065e98(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *dstrooms) { - s16 inrooms[21]; - s16 aboverooms[21]; - s16 *ptr = NULL; + RoomNum inrooms[21]; + RoomNum aboverooms[21]; + RoomNum *ptr = NULL; s32 i; bgFindRoomsByPos(pos2, inrooms, aboverooms, 20, NULL); @@ -3148,10 +3148,10 @@ void func0f065e98(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *dstroo * to get 256 props in a small space without exhausing the memory of the * console, you could potentially achieve arbitrary code execution. */ -void roomGetProps(s16 *rooms, s16 *propnums, s32 len) +void roomGetProps(RoomNum *rooms, s16 *propnums, s32 len) { s16 *writeptr = propnums; - s32 room; + RoomNum room; s32 i; s32 j; diff --git a/src/game/propobj.c b/src/game/propobj.c index 198b84644..ff0392a62 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -989,7 +989,7 @@ struct defaultobj *objFindByPadNum(s32 padnum) return NULL; } -struct defaultobj *objFindByPos(struct coord *pos, s16 *rooms) +struct defaultobj *objFindByPos(struct coord *pos, RoomNum *rooms) { struct prop *prop = g_Vars.activeprops; u8 *sp38; @@ -1353,7 +1353,7 @@ struct modelrodata_bbox *objFindBboxRodata(struct defaultobj *obj) return modelFindBboxRodata(obj->model); } -s32 objGetAverageBrightnessInRooms(s16 *rooms, s32 brightnesstype) +s32 objGetAverageBrightnessInRooms(RoomNum *rooms, s32 brightnesstype) { s32 brightness = 0; s32 i; @@ -2142,7 +2142,7 @@ struct prop *objInitWithAutoModel(struct defaultobj *obj) return objInitWithModelDef(obj, g_ModelStates[obj->modelnum].modeldef); } -void func0f06a580(struct defaultobj *obj, struct coord *pos, Mtxf *matrix, s16 *rooms) +void func0f06a580(struct defaultobj *obj, struct coord *pos, Mtxf *matrix, RoomNum *rooms) { struct prop *prop = obj->prop; @@ -2171,13 +2171,13 @@ f32 func0f06a620(struct defaultobj *obj) return 4; } -void func0f06a650(struct defaultobj *obj, struct coord *pos, Mtxf *arg2, s16 *rooms) +void func0f06a650(struct defaultobj *obj, struct coord *pos, Mtxf *arg2, RoomNum *rooms) { struct modelrodata_bbox *bbox; - s16 room; + RoomNum room; f32 sp3c; struct coord newpos; - s16 newrooms[2]; + RoomNum newrooms[2]; bbox = modelFindBboxRodata(obj->model); @@ -2201,14 +2201,14 @@ void func0f06a650(struct defaultobj *obj, struct coord *pos, Mtxf *arg2, s16 *ro } } -void func0f06a730(struct defaultobj *obj, struct coord *arg1, Mtxf *mtx, s16 *rooms, struct coord *centre) +void func0f06a730(struct defaultobj *obj, struct coord *arg1, Mtxf *mtx, RoomNum *rooms, struct coord *centre) { struct modelrodata_bbox *bbox = modelFindBboxRodata(obj->model); f32 min = objGetLocalYMin(bbox); f32 max = objGetLocalYMax(bbox); struct coord pos2; Mtxf sp70; - s16 rooms2[8]; + RoomNum rooms2[8]; f32 curval; f32 y; f32 maxval; @@ -2327,12 +2327,12 @@ void func0f06a730(struct defaultobj *obj, struct coord *arg1, Mtxf *mtx, s16 *ro func0f06a580(obj, &pos2, &sp70, rooms2); } -void func0f06ab60(struct defaultobj *obj, struct coord *arg1, Mtxf *arg2, s16 *rooms, struct coord *arg4) +void func0f06ab60(struct defaultobj *obj, struct coord *arg1, Mtxf *arg2, RoomNum *rooms, struct coord *arg4) { struct modelrodata_bbox *bbox; f32 mult; struct coord newpos; - s16 newrooms[8]; + RoomNum newrooms[8]; Mtxf sp5c; Mtxf sp1c; @@ -3108,7 +3108,7 @@ bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, s return result; } -bool projectileFindCollidingProp(struct prop *prop, struct coord *pos1, struct coord *pos2, u32 cdtypes, struct coord *arg4, struct coord *arg5, s16 *rooms) +bool projectileFindCollidingProp(struct prop *prop, struct coord *pos1, struct coord *pos2, u32 cdtypes, struct coord *arg4, struct coord *arg5, RoomNum *rooms) { bool result = false; f32 dist; @@ -3232,9 +3232,9 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2, struct coord sp1c4; u32 stack; bool s0; - s16 spcc[120]; - s16 *ptr; - s16 spb8[8]; + RoomNum spcc[120]; + RoomNum *ptr; + RoomNum spb8[8]; s32 i; f32 scale = 1.0f; @@ -3287,7 +3287,7 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2, } } } else { - s16 spa0[2]; + RoomNum spa0[2]; spa0[0] = spcc[i]; spa0[1] = -1; @@ -3377,7 +3377,7 @@ bool func0f06d37c(struct defaultobj *obj, struct coord *arg1, struct coord *arg2 bool sp98 = false; struct coord sp8c; struct coord sp80; - s16 rooms[8]; + RoomNum rooms[8]; struct coord sp64; struct coord sp58; struct coord sp4c; @@ -3966,7 +3966,7 @@ void objLand2(struct defaultobj *obj, struct coord *arg1, struct coord *arg2) struct modelrodata_bbox *bbox = modelFindBboxRodata(obj->model); f32 ymin = objGetLocalYMin(bbox); struct prop *prop = obj->prop; - s16 newrooms[8]; + RoomNum newrooms[8]; func0f06e9cc(arg2, &sp40); mtx00015f04(obj->model->scale, &sp40); @@ -3987,7 +3987,7 @@ void boltLand(struct weaponobj *weapon, struct coord *arg1) s32 beamnum; f32 zmax; struct prop *prop; - s16 newrooms[8]; + RoomNum newrooms[8]; bbox = modelFindBboxRodata(weapon->base.model); prop = weapon->base.prop; @@ -4023,7 +4023,7 @@ void knifeLand(struct defaultobj *obj, struct coord *arg1, struct coord *arg2) struct modelrodata_bbox *bbox = modelFindBboxRodata(obj->model); f32 zero = 0.0f; struct prop *prop = obj->prop; - s16 newrooms[8]; + RoomNum newrooms[8]; struct coord sp1c; // @bug? Should these be assigned to zero? @@ -4175,7 +4175,7 @@ bool propExplode(struct prop *prop, s32 exptype) if (prop->parent) { struct prop *parent = prop->parent; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; while (parent->parent) { parent = parent->parent; @@ -5159,10 +5159,10 @@ f32 objGetHov04(struct defaultobj *obj) return result; } -void hovUpdateGround(struct defaultobj *obj, struct hov *hov, struct coord *pos, s16 *rooms, f32 matrix[3][3]) +void hovUpdateGround(struct defaultobj *obj, struct hov *hov, struct coord *pos, RoomNum *rooms, f32 matrix[3][3]) { f32 ground; - s16 testrooms[8]; + RoomNum testrooms[8]; struct coord testpos; if (g_Vars.lvframe60 > hov->nexttick60) { @@ -5194,8 +5194,8 @@ void hovTick(struct defaultobj *obj, struct hov *hov) struct modelrodata_bbox *bbox; struct coord sp1b4; struct coord sp1a8; - s16 sp198[8]; - s16 sp188[8]; + RoomNum sp198[8]; + RoomNum sp188[8]; Mtxf sp148; Mtxf sp108; Mtxf spc8; @@ -5206,7 +5206,7 @@ void hovTick(struct defaultobj *obj, struct hov *hov) f32 spb4; f32 xrot; f32 spac; - s16 sp9c[8]; + RoomNum sp9c[8]; struct coord sp90; bool sp8c; f32 radius; @@ -5481,7 +5481,7 @@ s32 func0f072144(struct defaultobj *obj, struct coord *arg1, f32 arg2, bool arg3 f32 sp460[3][3]; f32 yrot; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; struct hov prevhov; struct hov *hov = NULL; union geounion geounion; @@ -5632,7 +5632,7 @@ void hovercarStartNextPath(struct hovercarobj *hovercar) s32 *pads; struct pad pad; Mtxf matrix; - s16 rooms[2]; + RoomNum rooms[2]; hovercarFindNextPath(hovercar); @@ -6008,7 +6008,7 @@ bool rocketTickFbw(struct weaponobj *rocket) struct coord newpos; struct coord dir; u32 stack[2]; - s16 newrooms[8]; + RoomNum newrooms[8]; if (projectile->ownerprop && projectile->ownerprop->type == PROPTYPE_CHR) { ownerchr = projectile->ownerprop->chr; @@ -6185,7 +6185,7 @@ s32 projectileLaunch(struct defaultobj *obj, struct projectile *projectile, stru } if (cdresult == CDRESULT_NOCOLLISION) { - s16 rooms[8]; + RoomNum rooms[8]; func0f065e74(&prop->pos, prop->rooms, &projectile->nextsteppos, rooms); @@ -6197,7 +6197,7 @@ s32 projectileLaunch(struct defaultobj *obj, struct projectile *projectile, stru roomsCopy(rooms, prop->rooms); } else if (cdresult != CDRESULT_NOCOLLISION && obj->type == OBJTYPE_WEAPON) { struct weaponobj *weapon = (struct weaponobj *)obj; - s16 rooms[8]; + RoomNum rooms[8]; if (weapon->weaponnum == WEAPON_ROCKET || weapon->weaponnum == WEAPON_HOMINGROCKET) { weapon->timer240 = 0; @@ -6228,7 +6228,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded) bool result = false; struct prop *prop = obj->prop; struct coord sp5c8; - s16 sp5b8[8]; + RoomNum sp5b8[8]; struct coord sp5ac; f32 sp5a8; struct coord sp59c; @@ -6662,7 +6662,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded) result = true; } else if (projectile->flags & PROJECTILEFLAG_AIRBORNE) { f32 sp390; - s16 roomnum; + RoomNum roomnum; struct coord sp380; f32 sp37c; f32 realrot[3][3]; @@ -7147,7 +7147,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded) if (!handled) { if (cdresult != CDRESULT_COLLISION) { - s16 rooms[8]; + RoomNum rooms[8]; func0f065e74(&prop->pos, prop->rooms, &sp5dc, rooms); @@ -7158,7 +7158,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded) propDeregisterRooms(prop); roomsCopy(rooms, prop->rooms); } else { - s16 rooms[8]; + RoomNum rooms[8]; if (g_EmbedProp && (g_EmbedProp->type == PROPTYPE_CHR || g_EmbedProp->type == PROPTYPE_PLAYER)) { sp5dc.x = prop->pos.x; @@ -7444,7 +7444,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded) if (projectile->speed.f[0] != 0.0f || projectile->speed.f[2] != 0.0f || projectile->unk060 < 1.0f) { f32 f12; f32 spa4; - s16 roomnum; + RoomNum roomnum; s32 i; f32 sp98 = objGetRotatedLocalYMinByMtx3(objFindBboxRodata(obj), obj->realrot); #if VERSION >= VERSION_NTSC_1_0 @@ -7882,7 +7882,7 @@ void platformDisplaceProps(struct prop *platform, s16 *propnums, struct coord *p if (g_Vars.players[playernum]->inlift && !g_Vars.players[playernum]->onladder && !g_Vars.players[playernum]->isfalling) { struct coord sp78; - s16 sp68[8]; + RoomNum sp68[8]; f32 ydist = newpos->y - prevpos->y; if (ydist != 0.0f) { @@ -7975,7 +7975,7 @@ void liftTick(struct prop *prop) f32 frac; s32 move; struct coord newpos; - s16 newrooms[8]; + RoomNum newrooms[8]; struct coord prevpos; #if VERSION >= VERSION_NTSC_1_0 f32 prevdist; @@ -9009,11 +9009,11 @@ void autogunTickShoot(struct prop *autogunprop) if (fireleft || fireright) { struct coord gunpos; - s16 gunrooms[8]; + RoomNum gunrooms[8]; struct coord dir; bool missed = false; struct coord hitpos; - s16 hitrooms[8]; + RoomNum hitrooms[8]; bool makebeam = (autogun->firecount % 4) == 0; struct prop *targetprop = autogun->target; struct modelnode *flashnode; @@ -9773,7 +9773,7 @@ void chopperIncrementMovement(struct prop *prop, f32 goalroty, f32 goalrotx, str { struct defaultobj *obj = prop->obj; struct chopperobj *chopper = (struct chopperobj *)obj; - s16 newrooms[8]; + RoomNum newrooms[8]; struct coord newpos; f32 curroty; f32 currotx; @@ -10066,10 +10066,10 @@ void chopperTickFall(struct prop *chopperprop) if (cdExamLos09(&chopperprop->pos, chopperprop->rooms, &newpos, CDTYPE_BG) == CDRESULT_COLLISION) { struct coord sp74; - s16 room; + RoomNum room; struct coord sp64; f32 ground; - s16 newrooms[8]; + RoomNum newrooms[8]; chopperprop->pos.y += 100; ground = cdFindGroundAtCyl(&chopperprop->pos, 5, chopperprop->rooms, NULL, NULL); @@ -10369,7 +10369,7 @@ void hovercarTick(struct prop *prop) bool stopping; struct pad pad; struct coord sp214; - s16 sp210[2]; + RoomNum sp210[2]; struct hovercarobj *hovercar = (struct hovercarobj *) prop->obj; struct defaultobj *obj = &hovercar->base; u32 stack; @@ -10380,11 +10380,11 @@ void hovercarTick(struct prop *prop) struct prop *doorprop; struct coord sp1e4; struct coord sp1d8; - s16 sp1d6; + RoomNum sp1d6; f32 x; f32 z; struct coord sp1c0; - s16 sp1b0[8]; + RoomNum sp1b0[8]; struct modelrodata_bbox *bbox; f32 ymin; s32 *padnum; @@ -10397,7 +10397,7 @@ void hovercarTick(struct prop *prop) f32 sp180; f32 sp15c[3][3]; struct coord sp150; - s16 sp140[8]; + RoomNum sp140[8]; f32 tmp2; f32 sp138; struct coord sp12c; @@ -11026,7 +11026,7 @@ s32 objTickPlayer(struct prop *prop) struct modelrenderdata sp476 = {0, 1, 3}; Mtxf sp412; struct coord sp400; - s16 sp384[8]; + RoomNum sp384[8]; struct hov *hov = NULL; if (fulltick) { @@ -11112,7 +11112,7 @@ s32 objTickPlayer(struct prop *prop) struct modelrenderdata sp312 = {0, 1, 3}; Mtxf sp248; struct coord sp236; - s16 sp220[8]; + RoomNum sp220[8]; s32 numchrs; Mtxf sp152; s32 sp148; @@ -14387,7 +14387,7 @@ bool objDrop(struct prop *prop, bool lazy) struct model *model; Mtxf spf0; struct coord spe4; - s16 rooms[8]; + RoomNum rooms[8]; if ((obj->hidden & OBJHFLAG_EMBEDDED) && obj->embedment->projectile) { struct projectile *projectile2 = obj->embedment->projectile; @@ -14704,7 +14704,7 @@ void objCheckDestroyed(struct defaultobj *obj, struct coord *pos, s32 playernum) struct prop *prop = obj->prop; struct prop *rootprop = prop; s16 exptype = g_PropExplosionTypes[8 + obj->modelnum]; - s16 rooms[8]; + RoomNum rooms[8]; // If in Deep Sea outro if (g_Vars.tickmode == TICKMODE_CUTSCENE && g_CutsceneAnimNum == ANIM_CUT_PAM_OUTRO_CAM) { @@ -18761,7 +18761,7 @@ s32 weaponTestForPickup(struct prop *prop) return objTestForPickup(prop); } -void weaponSetGunfireVisible(struct prop *prop, bool visible, s16 room) +void weaponSetGunfireVisible(struct prop *prop, bool visible, RoomNum room) { u32 stack[4]; bool flash = false; @@ -19297,12 +19297,12 @@ void doorDeactivatePortal(struct doorobj *door) } } -struct prop *doorInit(struct doorobj *door, struct coord *pos, Mtxf *mtx, s16 *rooms, struct coord *coord, struct coord *centre) +struct prop *doorInit(struct doorobj *door, struct coord *pos, Mtxf *mtx, RoomNum *rooms, struct coord *coord, struct coord *centre) { struct prop *prop; union modelrodata *rodata; Mtxf sp38; - s16 sp28[8]; + RoomNum sp28[8]; door->base.flags |= OBJFLAG_00000100; prop = objInitWithAutoModel(&door->base); @@ -19805,10 +19805,10 @@ s32 doorIsOpen(struct doorobj *door) return (door->mode == DOORMODE_IDLE || door->mode == DOORMODE_WAITING) && door->frac >= door->maxfrac; } -s32 func0f08e5a8(s16 *rooms2, struct screenbox *box) +s32 func0f08e5a8(RoomNum *rooms2, struct screenbox *box) { bool result = false; - s16 *rooms = rooms2; + RoomNum *rooms = rooms2; s32 roomnum = *rooms; while (roomnum != -1) { @@ -19913,8 +19913,8 @@ bool posIsInObjFadeDistance(struct coord *pos, f32 modelscale) bool func0f08e8ac(struct prop *prop, struct coord *pos, f32 arg2, bool arg3) { - s16 *rooms; - s32 roomnum; + RoomNum *rooms; + RoomNum roomnum; bool result = false; u32 stack; @@ -21123,7 +21123,7 @@ void projectileCreate(struct prop *fromprop, struct fireslotthing *arg1, struct f32 z; f32 sqdist; struct prop *obstacle = NULL; - s16 sp1c8[8]; + RoomNum sp1c8[8]; u8 forcebeam = false; struct beam beam; struct coord frompos; diff --git a/src/game/propsnd.c b/src/game/propsnd.c index 9e4b07fde..6cd41bd3c 100644 --- a/src/game/propsnd.c +++ b/src/game/propsnd.c @@ -232,7 +232,7 @@ void psTickChannel(s32 channelnum) #endif { struct coord *pos = NULL; - s16 *rooms = NULL; + RoomNum *rooms = NULL; s32 newvol; s32 newpan; s32 newfx; @@ -261,7 +261,7 @@ void psTickChannel(s32 channelnum) } } else { if (pos && rooms) { - s16 *tmprooms; + RoomNum *tmprooms; if (channel->flags & PSFLAG_IGNOREROOMS) { tmprooms = NULL; @@ -645,7 +645,7 @@ void psStopOneShootChannel(struct prop *prop) s16 psCreate(struct pschannel *channel, struct prop *prop, s16 soundnum, s16 padnum, s32 vol, u16 flags, u16 flags2, s32 type, - struct coord *pos, f32 pitch, s16 *rooms, s32 room, + struct coord *pos, f32 pitch, RoomNum *rooms, s32 room, f32 dist1, f32 dist2, f32 dist3) { union soundnumhack spac; @@ -1123,12 +1123,12 @@ void psModify(s32 channelnum, s32 volume, s16 padnum, struct prop *prop, s32 vol } } -s32 psCalculateVol(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, s16 *rooms, s16 soundnum, s32 arg6, f32 *playerdistptr) +s32 psCalculateVol(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, RoomNum *rooms, s16 soundnum, s32 arg6, f32 *playerdistptr) { union soundnumhack sp6c; union soundnumhack sp68; f32 playerdist; - s16 roomnum; + RoomNum roomnum; s32 s0; s32 i; @@ -1382,7 +1382,7 @@ s32 psCalculatePan(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, f32 playe * If the given soundnum were to play at the given world position, calculate the * final volume and pan and write them to the vol and pan pointers. */ -void psGetTheoreticalVolPan(struct coord *pos, s16 *rooms, s16 soundnum, s32 *vol, s32 *pan) +void psGetTheoreticalVolPan(struct coord *pos, RoomNum *rooms, s16 soundnum, s32 *vol, s32 *pan) { f32 dist1; f32 dist2; @@ -1434,7 +1434,7 @@ void psGetTheoreticalVolPan(struct coord *pos, s16 *rooms, s16 soundnum, s32 *vo } #endif -void psApplyVolPan(struct sndstate *handle, struct coord *pos, f32 dist1, f32 dist2, f32 dist3, s16 *rooms, s16 soundnum, s32 arg7, f32 *distanceptr) +void psApplyVolPan(struct sndstate *handle, struct coord *pos, f32 dist1, f32 dist2, f32 dist3, RoomNum *rooms, s16 soundnum, s32 arg7, f32 *distanceptr) { union soundnumhack sp5c; union soundnumhack sp58; diff --git a/src/game/room.c b/src/game/room.c index 51e889ac8..8ee216e86 100644 --- a/src/game/room.c +++ b/src/game/room.c @@ -47,8 +47,8 @@ */ u8 *g_RoomMtxAges; -s16 *g_RoomMtxLinkedRooms; -s16 *g_RoomMtxBaseRooms; +RoomNum *g_RoomMtxLinkedRooms; +RoomNum *g_RoomMtxBaseRooms; f32 *g_RoomMtxScales; Mtxf *g_RoomMtxMatrices; diff --git a/src/game/roomreset.c b/src/game/roomreset.c index dd5ab8c01..d02e12820 100644 --- a/src/game/roomreset.c +++ b/src/game/roomreset.c @@ -15,10 +15,10 @@ void roomsReset(void) g_RoomMtxNumSlots = PLAYERCOUNT() >= 2 ? 200 : 120; g_RoomMtxAges = mempAlloc(ALIGN16(g_RoomMtxNumSlots), MEMPOOL_STAGE); - g_RoomMtxLinkedRooms = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(s16)), MEMPOOL_STAGE); - g_RoomMtxBaseRooms = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(s16)), MEMPOOL_STAGE); - g_RoomMtxScales = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(f32)), MEMPOOL_STAGE); - g_RoomMtxMatrices = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(Mtxf)), MEMPOOL_STAGE); + g_RoomMtxLinkedRooms = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(*g_RoomMtxLinkedRooms)), MEMPOOL_STAGE); + g_RoomMtxBaseRooms = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(*g_RoomMtxBaseRooms)), MEMPOOL_STAGE); + g_RoomMtxScales = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(*g_RoomMtxScales)), MEMPOOL_STAGE); + g_RoomMtxMatrices = mempAlloc(ALIGN16(g_RoomMtxNumSlots * sizeof(*g_RoomMtxMatrices)), MEMPOOL_STAGE); for (i = 0; i < PLAYERCOUNT(); i++) { g_Vars.players[i]->lastroomforoffset = -1; diff --git a/src/game/setup.c b/src/game/setup.c index fd0d5f718..d532db458 100644 --- a/src/game/setup.c +++ b/src/game/setup.c @@ -389,7 +389,7 @@ void setupCreateObject(struct defaultobj *obj, s32 cmdindex) struct coord centre; f32 scale; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; struct prop *prop2; u32 flag40; u32 stack; @@ -1084,7 +1084,7 @@ void setupCreateDoor(struct doorobj *door, s32 cmdindex) struct prop *prop; s32 siblingcmdindex; struct coord pos; - s16 rooms[8]; + RoomNum rooms[8]; Mtxf finalmtx; struct coord centre; Mtxf zrotmtx; diff --git a/src/game/setupcover.c b/src/game/setupcover.c index d03a0cb44..7a592b953 100644 --- a/src/game/setupcover.c +++ b/src/game/setupcover.c @@ -26,13 +26,13 @@ void setupPrepareCover(void) { s32 i; s32 numcovers = g_PadsFile->numcovers; - s16 *roomsptr; + RoomNum *roomsptr; f32 scale = 1; struct coord aimpos; struct cover cover; u16 specialcovernums[1024]; - s16 inrooms[21]; - s16 aboverooms[21]; + RoomNum inrooms[21]; + RoomNum aboverooms[21]; g_CoverFlags = mempAlloc(ALIGN16(numcovers * sizeof(u16)), MEMPOOL_STAGE); g_CoverRooms = mempAlloc(ALIGN16(numcovers * sizeof(s32)), MEMPOOL_STAGE); @@ -80,7 +80,7 @@ void setupPrepareCover(void) s32 room = cdFindFloorRoomAtPos(cover.pos, roomsptr); if (room > 0) { - g_CoverRooms[i] = (s16)room; + g_CoverRooms[i] = (RoomNum)room; } else { g_CoverRooms[i] = roomsptr[0]; } @@ -106,7 +106,7 @@ void setupPrepareCover(void) s32 aimroom = cdFindFloorRoomAtPos(&aimpos, roomsptr); if (aimroom > 0) { - g_CoverFlags[i] |= (g_CoverRooms[i] == (s16)aimroom) ? COVERFLAG_AIMSAMEROOM : COVERFLAG_AIMDIFFROOM; + g_CoverFlags[i] |= (g_CoverRooms[i] == (RoomNum)aimroom) ? COVERFLAG_AIMSAMEROOM : COVERFLAG_AIMDIFFROOM; } else { g_CoverFlags[i] |= (g_CoverRooms[i] == roomsptr[0]) ? COVERFLAG_AIMSAMEROOM : COVERFLAG_AIMDIFFROOM; } diff --git a/src/game/setuppads.c b/src/game/setuppads.c index d4f4a9a8f..9e629fdad 100644 --- a/src/game/setuppads.c +++ b/src/game/setuppads.c @@ -28,15 +28,15 @@ void setupPreparePads(void) { struct packedpad *packedpad; - s16 *roomsptr; + RoomNum *roomsptr; s32 padnum; s32 numpads; s32 roomnum; struct pad pad; struct waypoint *waypoint; struct waygroup *waygroup; - s16 inrooms[24]; - s16 aboverooms[22]; + RoomNum inrooms[24]; + RoomNum aboverooms[22]; s32 offset; g_PadsFile = (struct padsfileheader *)g_StageSetup.padfiledata; diff --git a/src/game/setuputils.c b/src/game/setuputils.c index 8f1288899..b62fc2d64 100644 --- a/src/game/setuputils.c +++ b/src/game/setuputils.c @@ -186,7 +186,7 @@ bool setup0f092304(struct defaultobj *obj, struct coord *arg1, struct coord *arg return setupGetObjBbox(obj, &obj->prop->pos, obj->realrot, arg1, arg2); } -void setup0f09233c(struct defaultobj *obj, struct coord *pos, f32 realrot[3][3], s16 *rooms) +void setup0f09233c(struct defaultobj *obj, struct coord *pos, f32 realrot[3][3], RoomNum *rooms) { struct coord a; struct coord b; diff --git a/src/game/shards.c b/src/game/shards.c index b3235a352..8291ac7a4 100644 --- a/src/game/shards.c +++ b/src/game/shards.c @@ -19,7 +19,7 @@ struct shard *g_Shards; s32 g_NextShardNum = 0; bool g_ShardsActive = false; -void shardCreate(s16 room, struct coord *pos, f32 rotx, f32 size, s32 type); +void shardCreate(RoomNum room, struct coord *pos, f32 rotx, f32 size, s32 type); void shardsCreate(struct coord *pos, f32 *rotx, f32 *roty, f32 *rotz, f32 relxmin, f32 relxmax, f32 relymin, f32 relymax, s32 type, struct prop *prop) { @@ -111,7 +111,7 @@ void shardsCreate(struct coord *pos, f32 *rotx, f32 *roty, f32 *rotz, f32 relxmi } } -void shardCreate(s16 room, struct coord *pos, f32 rotx, f32 size, s32 type) +void shardCreate(RoomNum room, struct coord *pos, f32 rotx, f32 size, s32 type) { f32 velx = RANDOMFRAC() * 2.0f - 1.0f; f32 vely = RANDOMFRAC() * 1.12f - 0.12f; @@ -211,7 +211,7 @@ void shardCreate(s16 room, struct coord *pos, f32 rotx, f32 size, s32 type) Gfx *shardsRenderWood(Gfx *gdl) { if (g_ShardsActive) { - s16 prevroom = 0; + RoomNum prevroom = 0; s32 i; Mtxf shardmtx; s32 j; @@ -325,7 +325,7 @@ Gfx *shardsRenderWood(Gfx *gdl) Gfx *shardsRenderGlass(Gfx *gdl) { if (g_ShardsActive) { - s16 prevroom = 0; + RoomNum prevroom = 0; s32 i; Mtxf shardmtx; s32 j; diff --git a/src/game/smoke.c b/src/game/smoke.c index af2439db1..edc7d5e37 100644 --- a/src/game/smoke.c +++ b/src/game/smoke.c @@ -261,7 +261,7 @@ Gfx *smokeRenderPart(struct smoke *smoke, struct smokepart *part, Gfx *gdl, stru return gdl; } -struct smoke *smokeCreate(struct coord *pos, s16 *rooms, s16 type) +struct smoke *smokeCreate(struct coord *pos, RoomNum *rooms, s16 type) { struct smoke *smoke = NULL; s32 playercount = PLAYERCOUNT(); @@ -326,7 +326,7 @@ struct smoke *smokeCreate(struct coord *pos, s16 *rooms, s16 type) return smoke; } -bool smokeCreateForHand(struct coord *pos, s16 *rooms, s16 type, s32 handnum) +bool smokeCreateForHand(struct coord *pos, RoomNum *rooms, s16 type, s32 handnum) { struct smoke *smoke; s32 i; @@ -368,7 +368,7 @@ bool smokeCreateForHand(struct coord *pos, s16 *rooms, s16 type, s32 handnum) * smoke parts have a size of zero. Perhaps the caller is supposed to check if * this function returns false and reuse the zero-sized smoke parts if so? */ -bool smokeCreateWithSource(void *source, struct coord *pos, s16 *rooms, s16 type, bool srcispadeffect) +bool smokeCreateWithSource(void *source, struct coord *pos, RoomNum *rooms, s16 type, bool srcispadeffect) { struct smoke *smoke; s32 i; @@ -415,7 +415,7 @@ void smokeCreateAtProp(struct prop *prop, s16 type) smokeCreateWithSource(prop, &prop->pos, prop->rooms, type, false); } -void smokeCreateAtPadEffect(struct padeffectobj *effect, struct coord *pos, s16 *rooms, s16 type) +void smokeCreateAtPadEffect(struct padeffectobj *effect, struct coord *pos, RoomNum *rooms, s16 type) { smokeCreateWithSource(effect, pos, rooms, type, true); } @@ -432,7 +432,7 @@ void smokeClearForProp(struct prop *prop) } } -struct smoke *smokeCreateSimple(struct coord *pos, s16 *rooms, s16 type) +struct smoke *smokeCreateSimple(struct coord *pos, RoomNum *rooms, s16 type) { return smokeCreate(pos, rooms, type); } diff --git a/src/game/splat.c b/src/game/splat.c index 41e41146e..15079869a 100644 --- a/src/game/splat.c +++ b/src/game/splat.c @@ -245,9 +245,9 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3 struct prop *objprop; struct hitthing hitthing; struct hitthing besthitthing; - s16 rooms[32]; - s16 gunrooms[8]; - s16 endrooms[8]; + RoomNum rooms[32]; + RoomNum gunrooms[8]; + RoomNum endrooms[8]; struct coord endpos; s32 i; struct coord *sp50c; @@ -422,7 +422,7 @@ void splat0f14986c(struct splatdata *splat) bool sp84 = splat->isskedar & 1; bool translucent = splat->translucent; f32 distance; - s16 smokerooms[2]; + RoomNum smokerooms[2]; texnum = WALLHITTEX_BLOOD1 + (random() % 3); diff --git a/src/game/training.c b/src/game/training.c index edfc1feed..157ff84fb 100644 --- a/src/game/training.c +++ b/src/game/training.c @@ -1248,9 +1248,9 @@ void frEndSession(bool hidetargets) s32 j; s16 propnums[256]; s16 *propnumptr; - s16 rooms[20]; + RoomNum rooms[20]; u32 stack1; - s16 rooms2[10]; + RoomNum rooms2[10]; u32 stack2; if (g_FrDataLoaded) { @@ -1507,8 +1507,8 @@ bool frIsAmmoWasted(void) s32 ammototal[2]; s16 *propnumptr; s16 propnums[258]; - s16 rooms20[22]; - s16 rooms10[12]; + RoomNum rooms20[22]; + RoomNum rooms10[12]; u32 stack[4]; s32 ammotype; struct hand *hand; @@ -3144,7 +3144,7 @@ void htEnd(void) struct prop *prop; s16 *propnum; s16 propnums[256]; - s16 rooms[5] = { 0x0016, 0x0017, 0x0018, 0x0019, -1 }; + RoomNum rooms[5] = { 0x0016, 0x0017, 0x0018, 0x0019, -1 }; struct waypoint *waypoints = g_StageSetup.waypoints; g_HtData.intraining = false; diff --git a/src/game/wallhit.c b/src/game/wallhit.c index c5e244369..393dbb1b1 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -633,7 +633,7 @@ const char var7f1b5c44[] = ""; const char var7f1b5c48[] = ""; void wallhitCreate(struct coord *relpos, struct coord *arg1, struct coord *arg2, s16 arg3[3], - s16 arg4[3], s16 texnum, s16 room, struct prop *objprop, + s16 arg4[3], s16 texnum, RoomNum room, struct prop *objprop, s8 mtxindex, s8 arg9, struct chrdata *chr, bool xlu) { f32 scale = RANDOMFRAC() * 0.1f + 0.6f; @@ -648,7 +648,7 @@ void wallhitCreate(struct coord *relpos, struct coord *arg1, struct coord *arg2, } void wallhitCreateWith20Args(struct coord *relpos, struct coord *arg1, struct coord *arg2, s16 arg3[3], - s16 arg4[3], s16 texnum, s16 room, struct prop *objprop, + s16 arg4[3], s16 texnum, RoomNum room, struct prop *objprop, struct prop *chrprop, s8 mtxindex, s8 arg10, struct chrdata *chr, f32 width, f32 height, u8 minalpha, u8 maxalpha, s32 rotdeg, u32 timermax, u32 timerspeed, bool xlu) diff --git a/src/game/weather.c b/src/game/weather.c index 236c7cc6a..f09a44988 100644 --- a/src/game/weather.c +++ b/src/game/weather.c @@ -856,7 +856,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) u32 stack2; struct coord distcamtobbmax; struct coord distcamtobbmin; - s16 neighbours[20]; + RoomNum neighbours[20]; particledata = weather->particledata[arg2]; numtris = 0; @@ -2872,7 +2872,7 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) s32 i; // 184 struct coord sp178; struct coord sp16c; - s16 sp144[20]; + RoomNum sp144[20]; struct coord sp124; struct coord sp118; f32 f26; diff --git a/src/include/bss.h b/src/include/bss.h index 1791c1c93..67eb234e9 100644 --- a/src/include/bss.h +++ b/src/include/bss.h @@ -232,8 +232,8 @@ extern bool g_FogEnabled; extern bool g_EnvHasTransparency; extern struct distfadesettings *g_EnvDistFadeSettingsPtr; extern u8 *g_RoomMtxAges; -extern s16 *g_RoomMtxLinkedRooms; -extern s16 *g_RoomMtxBaseRooms; +extern RoomNum *g_RoomMtxLinkedRooms; +extern RoomNum *g_RoomMtxBaseRooms; extern f32 *g_RoomMtxScales; extern Mtxf *g_RoomMtxMatrices; extern struct fileinfo g_FileInfo[NUM_FILES]; diff --git a/src/include/game/bg.h b/src/include/game/bg.h index cb3cd068d..0ac8645ca 100644 --- a/src/include/game/bg.h +++ b/src/include/game/bg.h @@ -72,25 +72,25 @@ bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *a s32 bg0f1612e4(struct coord *bbmin, struct coord *bbmax, struct coord *frompos, struct coord *dist, struct coord *arg4, struct coord *arg5); bool bgTestHitInRoom(struct coord *frompos, struct coord *topos, s32 roomnum, struct hitthing *hitthing); bool bgRoomIsLoaded(s32 room); -bool bgRoomContainsCoord(struct coord *pos, s16 roomnum); -bool bgTestPosInRoomCheap(struct coord *pos, s16 roomnum); -bool bgTestPosInRoomExpensive(struct coord *pos, s16 roomnum); -bool bgTestPosInRoom(struct coord *pos, s16 roomnum); -void bgFindRoomsByPos(struct coord *pos, s16 *inrooms, s16 *aboverooms, s32 max, s16 *bestroom); +bool bgRoomContainsCoord(struct coord *pos, RoomNum roomnum); +bool bgTestPosInRoomCheap(struct coord *pos, RoomNum roomnum); +bool bgTestPosInRoomExpensive(struct coord *pos, RoomNum roomnum); +bool bgTestPosInRoom(struct coord *pos, RoomNum roomnum); +void bgFindRoomsByPos(struct coord *pos, RoomNum *inrooms, RoomNum *aboverooms, s32 max, RoomNum *bestroom); bool bgCmdPushValue(bool value); bool bgCmdPopValue(void); bool bgCmdGetNthValueFromEnd(s32 offset); struct bgcmd *bgCmdExecuteBranch(struct bgcmd *cmd, bool s2); struct bgcmd *bgCmdExecute(struct bgcmd *cmd); void bgTickPortalsXray(void); -void bgAddToSnake(s16 fromroomnum, s16 roomnum, s16 draworder, struct screenbox *box); +void bgAddToSnake(RoomNum fromroomnum, RoomNum roomnum, s16 draworder, struct screenbox *box); void bgConsumeSnakeItem(struct bgsnakeitem *arg0); bool bgTryConsumeSnake(void); void bgChooseRoomsToLoad(void); void bgTickPortals(void); Gfx *bgRenderSceneAndLoadCandidate(Gfx *gdl); -s32 bgGetForceOnscreenRooms(s16 *rooms, s32 len); -s32 bgRoomGetNeighbours(s32 room, s16 *rooms, s32 len); +s32 bgGetForceOnscreenRooms(RoomNum *rooms, s32 len); +s32 bgRoomGetNeighbours(s32 room, RoomNum *rooms, s32 len); bool bgRoomsAreNeighbours(s32 roomnum1, s32 roomnum2); void bgCalculateScreenProperties(void); void bgExpandRoomToPortals(s32 roomnum); @@ -101,6 +101,6 @@ void bgSetPortalOpenState(s32 portal, bool open); s32 bgFindPortalBetweenPositions(struct coord *pos1, struct coord *pos2); bool bgIsBboxOverlapping(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *arg3); void bgCalculatePortalBbox(s32 portalnum, struct coord *bbmin, struct coord *bbmax); -void bgFindEnteredRooms(struct coord *bbmin, struct coord *upper, s16 *rooms, s32 maxlen, bool arg4); +void bgFindEnteredRooms(struct coord *bbmin, struct coord *upper, RoomNum *rooms, s32 maxlen, bool arg4); #endif diff --git a/src/include/game/body.h b/src/include/game/body.h index e913574ef..4cc36931c 100644 --- a/src/include/game/body.h +++ b/src/include/game/body.h @@ -16,7 +16,7 @@ struct model *bodyAllocateModel(s32 bodynum, s32 headnum, u32 spawnflags); s32 body0f02d3f8(void); s32 bodyChooseHead(s32 bodynum); void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex); -struct prop *bodyAllocateEyespy(struct pad *pad, s16 room); +struct prop *bodyAllocateEyespy(struct pad *pad, RoomNum room); void bodyCalculateHeadOffset(struct modeldef *headmodeldef, s32 headnum, s32 bodynum); #endif diff --git a/src/include/game/bondeyespy.h b/src/include/game/bondeyespy.h index f3af79691..033893c17 100644 --- a/src/include/game/bondeyespy.h +++ b/src/include/game/bondeyespy.h @@ -4,7 +4,7 @@ #include "data.h" #include "types.h" -f32 eyespyFindGround(s16 *floorroom); +f32 eyespyFindGround(RoomNum *floorroom); s32 eyespyTryMoveUpwards(f32 yvel); s32 eyespyCalculateNewPosition(struct coord *vel); bool eyespyCalculateNewPositionWithPush(struct coord *vel); diff --git a/src/include/game/bondgun.h b/src/include/game/bondgun.h index 1e753a449..e704cdcad 100644 --- a/src/include/game/bondgun.h +++ b/src/include/game/bondgun.h @@ -73,9 +73,9 @@ void bgunTickMasterLoad(void); void bgunTickLoad(void); bool bgunLoadAll(void); struct modeldef *bgunGetCartModeldef(void); -void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, s16 *rooms, Mtxf *matrix1, struct coord *velocity, Mtxf *matrix2, struct prop *prop, struct coord *pos); +void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, RoomNum *rooms, Mtxf *matrix1, struct coord *velocity, Mtxf *matrix2, struct prop *prop, struct coord *pos); void bgun0f09ed2c(struct defaultobj *obj, struct coord *coord, Mtxf *arg2, struct coord *velocity, Mtxf *arg4); -struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *velocity); +struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset *gset, struct coord *pos, RoomNum *rooms, Mtxf *arg4, struct coord *velocity); void bgunCreateThrownProjectile(s32 handnum, struct gset *gset); void bgunUpdateHeldRocket(s32 handnum); void bgunCreateHeldRocket(s32 handnum, struct weaponfunc_shootprojectile *func); @@ -142,8 +142,8 @@ s32 bgunAllocateFireslot(void); void bgunRender(Gfx **gdl); struct sndstate **bgunAllocateAudioHandle(void); void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum); -void bgunPlayGlassHitSound(struct coord *pos, s16 *rooms, s32 texturenum); -void bgunPlayBgHitSound(struct gset *gset, struct coord *hitpos, s32 texturenum, s16 *rooms); +void bgunPlayGlassHitSound(struct coord *pos, RoomNum *rooms, s32 texturenum); +void bgunPlayBgHitSound(struct gset *gset, struct coord *hitpos, s32 texturenum, RoomNum *rooms); void bgunSetTriggerOn(s32 handnum, bool on); s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromactivemenu); void bgun0f0a8c50(void); diff --git a/src/include/game/bondmove.h b/src/include/game/bondmove.h index 378ab167c..7733b613f 100644 --- a/src/include/game/bondmove.h +++ b/src/include/game/bondmove.h @@ -30,8 +30,8 @@ void bmoveUpdateSpeedThetaControl(f32 value); f32 bmoveCalculateLookahead(void); void bmoveResetMoveData(struct movedata *data); void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool ignorec2); -void bmoveFindEnteredRoomsByPos(struct player *player, struct coord *arg1, s16 *rooms); -void bmoveFindEnteredRooms(struct player *player, s16 *rooms); +void bmoveFindEnteredRoomsByPos(struct player *player, struct coord *arg1, RoomNum *rooms); +void bmoveFindEnteredRooms(struct player *player, RoomNum *rooms); void bmoveUpdateRooms(struct player *player); void bmove0f0cb904(struct coord *coord); void bmove0f0cba88(f32 *a, f32 *b, struct coord *c, f32 mult1, f32 mult2); diff --git a/src/include/game/bot.h b/src/include/game/bot.h index 4e188c48e..729822a04 100644 --- a/src/include/game/bot.h +++ b/src/include/game/bot.h @@ -4,7 +4,7 @@ #include "data.h" #include "types.h" -bool botroomFindPos(s16 room, struct coord *pos, f32 *angleptr, s32 *padnumptr, s32 *covernumptr); +bool botroomFindPos(RoomNum room, struct coord *pos, f32 *angleptr, s32 *padnumptr, s32 *covernumptr); bool botIsDizzy(struct chrdata *chr); void botReset(struct chrdata *chr, u8 respawning); @@ -45,8 +45,8 @@ char *botGetCommandName(s32 command); void botApplyAttack(struct chrdata *chr, struct prop *prop); void botApplyFollow(struct chrdata *chr, struct prop *prop); void botApplyProtect(struct chrdata *chr, struct prop *prop); -void botApplyDefend(struct chrdata *chr, struct coord *pos, s16 *room, f32 angle); -void botApplyHold(struct chrdata *chr, struct coord *pos, s16 *room, f32 angle); +void botApplyDefend(struct chrdata *chr, struct coord *pos, RoomNum *room, f32 angle); +void botApplyHold(struct chrdata *chr, struct coord *pos, RoomNum *room, f32 angle); void botApplyScenarioCommand(struct chrdata *chr, u32 arg1); bool botCanFollow(struct chrdata *leader, struct chrdata *follower); s32 botFindTeammateToFollow(struct chrdata *chr, f32 range); diff --git a/src/include/game/botact.h b/src/include/game/botact.h index 801b20c6d..4b91ac0d4 100644 --- a/src/include/game/botact.h +++ b/src/include/game/botact.h @@ -18,7 +18,7 @@ u32 botactGetProjectileThrowInterval(u32 weapon); s32 botactGetWeaponByAmmoType(s32 ammotype); void botactThrow(struct chrdata *chr); s32 botactGetShootInterval60(s32 weaponnum, s32 funcnum); -bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct coord *topos, s16 *fromrooms, s16 *torooms, struct projectile *projectile); +bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct coord *topos, RoomNum *fromrooms, RoomNum *torooms, struct projectile *projectile); void botactGetRocketNextStepPos(u16 padnum, struct coord *pos); void botactCreateSlayerRocket(struct chrdata *chr); diff --git a/src/include/game/camera.h b/src/include/game/camera.h index 725ea06c8..f8dd37acf 100644 --- a/src/include/game/camera.h +++ b/src/include/game/camera.h @@ -43,6 +43,6 @@ f32 camGetPerspAspect(void); void cam0f0b5838(void); bool cam0f0b5b9c(struct coord *arg0, f32 arg1); bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct drawslot *drawslot); -bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2); +bool camIsPosInFovAndVisibleRoom(RoomNum *rooms, struct coord *pos, f32 arg2); #endif diff --git a/src/include/game/chr.h b/src/include/game/chr.h index 41b7654cd..151da2705 100644 --- a/src/include/game/chr.h +++ b/src/include/game/chr.h @@ -6,24 +6,24 @@ void chrSetChrnum(struct chrdata *chr, s16 chrnum); void chrDeregister(s32 chrnum); -void chrCalculatePushPos(struct chrdata *chr, struct coord *pos, s16 *rooms, bool arg3); +void chrCalculatePushPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, bool arg3); #if VERSION >= VERSION_NTSC_1_0 -bool chr0f01f264(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3, bool arg4); +bool chr0f01f264(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 arg3, bool arg4); #else -bool chr0f01f264(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 arg3); +bool chr0f01f264(struct chrdata *chr, struct coord *pos, RoomNum *rooms, f32 arg3); #endif bool chr0f01f378(struct model *model, struct coord *arg1, struct coord *arg2, f32 *mangroundptr); s32 chrsGetNumFree(void); s16 chrsGetNextUnusedChrnum(void); -struct prop *chr0f020b14(struct prop *prop, struct model *model, struct coord *pos, s16 *rooms, f32 arg3, u8 *ailist); +struct prop *chr0f020b14(struct prop *prop, struct model *model, struct coord *pos, RoomNum *rooms, f32 arg3, u8 *ailist); void chrRemove(struct prop *prop, bool free); void chrUpdateAimProperties(struct chrdata *chr); void chrFlinchBody(struct chrdata *chr); void chrFlinchHead(struct chrdata *chr, f32 arg1); f32 chrGetFlinchAmount(struct chrdata *chr); -void chr0f021fa8(struct chrdata *chr, struct coord *pos, s16 *rooms); +void chr0f021fa8(struct chrdata *chr, struct coord *pos, RoomNum *rooms); void chr0f0220ec(struct chrdata *chr, s32 lvupdate240, bool arg2); void chr0f022214(struct chrdata *chr, struct prop *child, bool fulltick); void chrUpdateCloak(struct chrdata *chr); @@ -80,9 +80,9 @@ f32 chrGetMaxDamage(struct chrdata *chr); void chrAddHealth(struct chrdata *chr, f32 health); f32 chrGetArmor(struct chrdata *chr); void chrInit(struct prop *prop, u8 *ailist); -struct prop *chrAllocate(struct model *model, struct coord *pos, s16 *rooms, f32 faceangle, u8 *ailist); +struct prop *chrAllocate(struct model *model, struct coord *pos, RoomNum *rooms, f32 faceangle, u8 *ailist); void chrClearReferences(s32 propnum); -void chr0f022084(struct chrdata *chr, s16 *room); +void chr0f022084(struct chrdata *chr, RoomNum *room); void chr0f0220ac(struct chrdata *chr); void chrCloak(struct chrdata *chr, bool arg1); void chrUncloak(struct chrdata *chr, bool value); diff --git a/src/include/game/chraction.h b/src/include/game/chraction.h index 982103e05..e981d0369 100644 --- a/src/include/game/chraction.h +++ b/src/include/game/chraction.h @@ -66,8 +66,8 @@ void chrDamageByImpact(struct chrdata *chr, f32 damage, struct coord *vector, st void chrDamageByExplosion(struct chrdata *chr, f32 damage, struct coord *vector, struct prop *prop, struct coord *explosionpos); void playerUpdateDamageStats(struct prop *attacker, struct prop *victim, f32 damage); void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gset *gset, struct prop *aprop, s32 hitpart, bool damageshield, struct prop *prop2, struct modelnode *node, struct model *model, s32 side, s16 *arg11, bool explosion, struct coord *explosionpos); -bool func0f03645c(struct chrdata *chr, struct coord *arg1, s16 *arg2, struct coord *arg3, struct coord *arg4, s32 cdtypes); -bool func0f03654c(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, struct coord *vector, f32 arg6, u32 types); +bool func0f03645c(struct chrdata *chr, struct coord *arg1, RoomNum *arg2, struct coord *arg3, struct coord *arg4, s32 cdtypes); +bool func0f03654c(struct chrdata *chr, struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, struct coord *vector, f32 arg6, u32 types); bool propchrHasClearLineToPos(struct prop *prop, struct coord *dstpos, struct coord *vector); bool propchrHasClearLineInVector(struct prop *prop, struct coord *coord, f32 arg2); bool func0f036974(struct prop *prop, struct coord *coord); @@ -75,9 +75,9 @@ void chrGetSideVectorToTarget(struct chrdata *chr, bool side, struct coord *vect bool chrCanRollInDirection(struct chrdata *chr, bool toleft, f32 distance); void chrGetSideVector(struct chrdata *chr, bool side, struct coord *vector); bool chrCanJumpInDirection(struct chrdata *chr, bool side, f32 distance); -bool chrIsRoomOffScreen(struct chrdata *chr, struct coord *waypos, s16 *wayrooms); +bool chrIsRoomOffScreen(struct chrdata *chr, struct coord *waypos, RoomNum *wayrooms); void chrGoPosInitMagic(struct chrdata *chr, struct waydata *waydata, struct coord *arg2, struct coord *prevpos); -void chrGoPosGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, s16 *rooms, u32 *flags); +void chrGoPosGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, RoomNum *rooms, u32 *flags); f32 func0f0370a8(struct chrdata *chr); s32 chrGoPosCalculateBaseTtl(struct chrdata *chr); void chrGoPosConsiderRestart(struct chrdata *chr); @@ -85,20 +85,20 @@ void chrGoPosInitExpensive(struct chrdata *chr); void chrGoPosAdvanceWaypoint(struct chrdata *chr); s32 chrPatrolCalculateStep(struct chrdata *chr, bool *forward, s32 numsteps); s16 chrPatrolCalculatePadNum(struct chrdata *chr, s32 numsteps); -void chrPatrolGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, s16 *rooms, u32 *flags); +void chrPatrolGetCurWaypointInfoWithFlags(struct chrdata *chr, struct coord *pos, RoomNum *rooms, u32 *flags); void func0f037580(struct chrdata *chr); void func0f0375b0(struct chrdata *chr); -void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, struct coord *arg3, s16 *rooms); +void chrNavTickMagic(struct chrdata *chr, struct waydata *waydata, f32 speed, struct coord *arg3, RoomNum *rooms); void chrCalculatePosition(struct chrdata *chr, struct coord *pos); void chrGoPosChooseAnimation(struct chrdata *chr); -bool chrGoToRoomPos(struct chrdata *chr, struct coord *pos, s16 *rooms, u32 goposflags); +bool chrGoToRoomPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, u32 goposflags); void chrPatrolChooseAnimation(struct chrdata *chr); void chrStartPatrol(struct chrdata *chr, struct path *path); -bool chrHasLosToEntity(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, bool allowextraheight, u32 attackflags, u32 entityid); -bool chrHasLosToAttackTarget(struct chrdata *chr, struct coord *pos, s16 *rooms, bool allowextraheight); -bool chrHasLosToChr(struct chrdata *chr, struct chrdata *target, s16 *room); -bool chrHasLosToPos(struct chrdata *viewerchr, struct coord *pos, s16 *rooms); -bool chrHasLosToPosWasteful(struct chrdata *chr, struct coord *pos, s16 *room); +bool chrHasLosToEntity(struct chrdata *chr, struct coord *chrpos, RoomNum *chrrooms, bool allowextraheight, u32 attackflags, u32 entityid); +bool chrHasLosToAttackTarget(struct chrdata *chr, struct coord *pos, RoomNum *rooms, bool allowextraheight); +bool chrHasLosToChr(struct chrdata *chr, struct chrdata *target, RoomNum *room); +bool chrHasLosToPos(struct chrdata *viewerchr, struct coord *pos, RoomNum *rooms); +bool chrHasLosToPosWasteful(struct chrdata *chr, struct coord *pos, RoomNum *room); bool chrHasLosToProp(struct chrdata *chr, struct prop *prop); bool chrIsStopped(struct chrdata *chr); bool chrCheckCanSeeTarget(struct chrdata *chr); @@ -166,8 +166,8 @@ bool posIsArrivingLaterallyAtPos(struct coord *prevpos, struct coord *curpos, st bool posIsArrivingAtPos(struct coord *prevpos, struct coord *curpos, struct coord *targetpos, f32 range); void chrTickRunPos(struct chrdata *chr); void func0f044b68(struct coord *arg0, struct coord *arg1, struct coord *arg2); -bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *pos, s16 *rooms, struct coord *aimpos, struct coord *arg4, struct coord *arg5, f32 negchrradius, f32 chrradius, s32 cdtypes, s32 arg9); -bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, bool hasobstacle); +bool chrNavCanSeeNextPos(struct chrdata *chr, struct coord *pos, RoomNum *rooms, struct coord *aimpos, struct coord *arg4, struct coord *arg5, f32 negchrradius, f32 chrradius, s32 cdtypes, s32 arg9); +bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, RoomNum *chrrooms, struct coord *aimpos, struct coord *leftpos, struct coord *rightpos, f32 negchrradius, f32 chrradius, s32 cdtypes, bool hasobstacle); bool chrNavTryObstacle(struct chrdata *chr, struct coord *arg1, bool arg2, struct coord *arg3, f32 radius, bool arg5, struct coord *nextpos, struct waydata *waydata, f32 arg8, s32 cdtypes, s32 arg10); struct prop *chrOpenDoor(struct chrdata *chr, struct coord *rangepos); void chrNavTickMain(struct chrdata *chr, struct coord *pos, struct waydata *waydata, bool arg3); @@ -181,7 +181,7 @@ void chraTick(struct chrdata *chr); void cutsceneStart(u32 ailistid); void chraTickBg(void); f32 chrGetAngleToPos(struct chrdata *chr, struct coord *pos); -void chrGetAttackEntityPos(struct chrdata *chr, u32 attackflags, s32 entityid, struct coord *pos, s16 *rooms); +void chrGetAttackEntityPos(struct chrdata *chr, u32 attackflags, s32 entityid, struct coord *pos, RoomNum *rooms); f32 chrGetAngleFromTargetsFov(struct chrdata *chr); f32 chrGetVerticalAngleToTarget(struct chrdata *chr); bool chrIsInTargetsFovX(struct chrdata *chr, u8 fov360); @@ -197,23 +197,23 @@ bool chrIsTargetAimingAtMe(struct chrdata *chr); bool chrSawInjury(struct chrdata *chr, u8 arg1); bool chrSawDeath(struct chrdata *chr, u8 arg1); bool waypointIsWithin90DegreesOfPosAngle(struct waypoint *waypoint, struct coord *pos, f32 angle); -s32 chrFindWaypointWithinPosQuadrant(struct coord *pos, s16 *rooms, f32 angle, u8 quadrant); +s32 chrFindWaypointWithinPosQuadrant(struct coord *pos, RoomNum *rooms, f32 angle, u8 quadrant); bool func0f04a4ec(struct chrdata *chr, u8 quadrant); bool chrSetPadPresetToWaypointWithinTargetQuadrant(struct chrdata *chr, u8 arg1); bool chrSetChrPresetToChrNearPad(u32 checktype, struct chrdata *chr, f32 distance, s32 padnum); -bool chrSetChrPresetToChrNearPos(u8 checktype, struct chrdata *chr, f32 distance, struct coord *pos, s16 *room); +bool chrSetChrPresetToChrNearPos(u8 checktype, struct chrdata *chr, f32 distance, struct coord *pos, RoomNum *room); bool chrSetPadPresetToPadOnRouteToTarget(struct chrdata *chr); -bool chrIsPosOffScreen(struct coord *pos, s16 *rooms); +bool chrIsPosOffScreen(struct coord *pos, RoomNum *rooms); #if VERSION >= VERSION_NTSC_1_0 -bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool force, bool onlysurrounding); +bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, RoomNum *rooms, f32 angle, bool allowonscreen, bool force, bool onlysurrounding); #else -bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, s16 *rooms, f32 angle, bool allowonscreen, bool force); +bool chrAdjustPosForSpawn(f32 chrradius, struct coord *pos, RoomNum *rooms, f32 angle, bool allowonscreen, bool force); #endif -struct prop *chrSpawnAtCoord(s32 body, s32 head, struct coord *pos, s16 *room, f32 angle, u8 *ailist, u32 spawnflags); +struct prop *chrSpawnAtCoord(s32 body, s32 head, struct coord *pos, RoomNum *room, f32 angle, u8 *ailist, u32 spawnflags); bool chrIsPropPresetBlockingSightToTarget(struct chrdata *chr); -bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *room, f32 angle, bool ignorebg); +bool chrMoveToPos(struct chrdata *chr, struct coord *pos, RoomNum *room, f32 angle, bool ignorebg); bool chrCheckCoverOutOfSight(struct chrdata *chr, s32 covernum, bool soft); s32 chrAssignCoverByCriteria(struct chrdata *chr, u16 arg1, s32 arg2); s32 chrAssignCoverAwayFromDanger(struct chrdata *chr, s32 mindist, s32 maxdist); @@ -238,9 +238,9 @@ void chrRunToPos(struct chrdata *chr, struct coord *pos); void chrBeginDead(struct chrdata *chr); f32 chrGetShield(struct chrdata *chr); void chrDie(struct chrdata *chr, s32 aplayernum); -void chrGoPosGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, s16 *rooms); +void chrGoPosGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, RoomNum *rooms); void chrGoPosClearRestartTtl(struct chrdata *chr); -void chrPatrolGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, s16 *rooms); +void chrPatrolGetCurWaypointInfo(struct chrdata *chr, struct coord *pos, RoomNum *rooms); struct path *pathFindById(u32 path_id); void chrRecordLastVisibleTargetTime(struct chrdata *chr); bool chrHasLosToTarget(struct chrdata *chr); @@ -340,7 +340,7 @@ s16 *teamGetChrIds(s32 team_id); s16 *squadronGetChrIds(s32 squadron_id); void audioMarkAsRecentlyPlayed(s16 audioid); bool audioWasNotPlayedRecently(s16 audioid); -Gfx *chrsRenderChrStats(Gfx *gdl, s16 *rooms); +Gfx *chrsRenderChrStats(Gfx *gdl, RoomNum *rooms); void chrToggleModelPart(struct chrdata *chr, s32 partnum); bool chrIsAvoiding(struct chrdata *chr); void chrDrCarollEmitSparks(struct chrdata *chr); diff --git a/src/include/game/dlights.h b/src/include/game/dlights.h index 6829cad1b..a52b251ce 100644 --- a/src/include/game/dlights.h +++ b/src/include/game/dlights.h @@ -19,7 +19,7 @@ bool lightIsVulnerable(s32 roomnum, s32 lightnum); bool lightIsOn(s32 roomnum, s32 lightnum); void roomSetFlashBrightness(s32 roomnum, s32 value); void roomSetDefaults(struct room *room); -Gfx *lightsSetForRoom(Gfx *gdl, s16 roomnum); +Gfx *lightsSetForRoom(Gfx *gdl, RoomNum roomnum); Gfx *lightsSetDefault(Gfx *gdl); void roomInitLights(s32 roomnum); bool lightsHandleHit(struct coord *gunpos, struct coord *hitpos, s32 roomnum); diff --git a/src/include/game/dyntex.h b/src/include/game/dyntex.h index 150bb2226..f6c2cd952 100644 --- a/src/include/game/dyntex.h +++ b/src/include/game/dyntex.h @@ -7,7 +7,7 @@ void dyntexTickRoom(s32 roomnum, Vtx *vertices); void dyntexAddVertex(Vtx *vertex); void dyntexSetCurrentType(s16 type); -void dyntexSetCurrentRoom(s16 roomnum); +void dyntexSetCurrentRoom(RoomNum roomnum); void dyntexReset(void); bool dyntexHasRoom(void); diff --git a/src/include/game/explosions.h b/src/include/game/explosions.h index 84ae5cc8b..f6d15e212 100644 --- a/src/include/game/explosions.h +++ b/src/include/game/explosions.h @@ -8,13 +8,13 @@ void explosionsReset(void); void explosionsStop(void); -bool explosionCreateSimple(struct prop *prop, struct coord *pos, s16 *rooms, s16 type, s32 playernum); -bool explosionCreateComplex(struct prop *prop, struct coord *pos, s16 *rooms, s16 type, s32 playernum); +bool explosionCreateSimple(struct prop *prop, struct coord *pos, RoomNum *rooms, s16 type, s32 playernum); +bool explosionCreateComplex(struct prop *prop, struct coord *pos, RoomNum *rooms, s16 type, s32 playernum); f32 explosionGetHorizontalRangeAtFrame(struct explosion *exp, s32 frame); f32 explosionGetVerticalRangeAtFrame(struct explosion *exp, s32 frame); void explosionGetBboxAtFrame(struct coord *lower, struct coord *upper, s32 frame, struct prop *prop); void explosionAlertChrs(f32 *radius, struct coord *noisepos); -bool explosionCreate(struct prop *prop, struct coord *pos, s16 *rooms, s16 type, s32 playernum, bool makescorch, struct coord *arg6, s16 room, struct coord *arg8); +bool explosionCreate(struct prop *prop, struct coord *pos, RoomNum *rooms, s16 type, s32 playernum, bool makescorch, struct coord *arg6, RoomNum room, struct coord *arg8); void explosionsUpdateShake(struct coord *arg0, struct coord *arg1, struct coord *arg2); bool explosionOverlapsProp(struct explosion *exp, struct prop *prop, struct coord *pos1, struct coord *pos2); void explosionInflictDamage(struct prop *prop); diff --git a/src/include/game/mplayer/scenarios.h b/src/include/game/mplayer/scenarios.h index d47594e0f..a04f0d021 100644 --- a/src/include/game/mplayer/scenarios.h +++ b/src/include/game/mplayer/scenarios.h @@ -26,8 +26,8 @@ void scenarioTick(void); void scenarioTickChr(struct chrdata *chr); Gfx *scenarioRadarExtra(Gfx *gdl); bool scenarioRadarChr(Gfx **gdl, struct prop *prop); -f32 scenarioChooseSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop); +f32 scenarioChooseSpawnLocation(f32 chrradius, struct coord *pos, RoomNum *rooms, struct prop *prop); s32 scenarioGetMaxTeams(void); -void scenarioHighlightRoom(s16 room, s32 *arg1, s32 *arg2, s32 *arg3); +void scenarioHighlightRoom(RoomNum room, s32 *arg1, s32 *arg2, s32 *arg3); #endif diff --git a/src/include/game/mplayer/setup.h b/src/include/game/mplayer/setup.h index b8c21972a..00d42360b 100644 --- a/src/include/game/mplayer/setup.h +++ b/src/include/game/mplayer/setup.h @@ -81,11 +81,11 @@ Gfx *htbRenderHud(Gfx *gdl); void ctcInitProps(void); bool ctcHighlightProp(struct prop *prop, s32 *colour); void ctcAddPad(s32 *cmd); -void ctcHighlightRoom(s16 roomnum, s32 *arg1, s32 *arg2, s32 *arg3); +void ctcHighlightRoom(RoomNum roomnum, s32 *arg1, s32 *arg2, s32 *arg3); void kohTick(void); Gfx *kohRenderHud(Gfx *gdl); void kohAddHill(s32 *cmd); -void kohHighlightRoom(s16 roomnum, s32 *arg1, s32 *arg2, s32 *arg3); +void kohHighlightRoom(RoomNum roomnum, s32 *arg1, s32 *arg2, s32 *arg3); void htmAddPad(s16 padnum); void htmReset(void); void htbCreateUplink(void); diff --git a/src/include/game/objectives.h b/src/include/game/objectives.h index 438eb1782..fa13c3834 100644 --- a/src/include/game/objectives.h +++ b/src/include/game/objectives.h @@ -27,7 +27,7 @@ void objectivesDisableChecking(void); void objectivesShowHudmsg(char *buffer, s32 hudmsgtype); void objectivesCheckAll(void); void objectiveCheckRoomEntered(s32 currentroom); -void objectiveCheckThrowInRoom(s32 arg0, s16 *requiredrooms); +void objectiveCheckThrowInRoom(s32 arg0, RoomNum *requiredrooms); void objectiveCheckHolograph(f32 sqdist); struct prop *chopperGetTargetProp(struct chopperobj *heli); struct defaultobj *objFindByTagId(s32 tag_id); diff --git a/src/include/game/padhalllv.h b/src/include/game/padhalllv.h index 924da841d..9d4306c29 100644 --- a/src/include/game/padhalllv.h +++ b/src/include/game/padhalllv.h @@ -5,7 +5,7 @@ #include "types.h" void navSetSeed(u32 upper, u32 lower); -struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms); +struct waypoint *waypointFindClosestToPos(struct coord *pos, RoomNum *rooms); struct waygroup *waygroupChooseNeighbour(s32 *groupnums, s32 step, u32 ignoremask); void waygroupSetStepIfUndiscovered(s32 *groupnums, s32 step, u32 ignoremask); bool waygroupDiscoverOneStep(struct waygroup *group, s32 step, u32 ignoremask); diff --git a/src/include/game/player.h b/src/include/game/player.h index b012a1654..81840b813 100644 --- a/src/include/game/player.h +++ b/src/include/game/player.h @@ -4,8 +4,8 @@ #include "data.h" #include "types.h" -f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms, struct prop *prop, s16 *spawnpads, s32 numspawnpads); -f32 playerChooseGeneralSpawnLocation(f32 chrradius, struct coord *pos, s16 *rooms, struct prop *prop); +f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, RoomNum *dstrooms, struct prop *prop, s16 *spawnpads, s32 numspawnpads); +f32 playerChooseGeneralSpawnLocation(f32 chrradius, struct coord *pos, RoomNum *rooms, struct prop *prop); void playerStartNewLife(void); void playerLoadDefaults(void); bool playerSpawnAnti(struct chrdata *chr, s32 param_2); @@ -63,7 +63,7 @@ void playerDie(bool force); void playerDieByShooter(u32 shooter, bool force); void playerCheckIfShotInBack(s32 attackerplayernum, f32 x, f32 z); f32 playerGetHealthBarHeightFrac(void); -void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, struct coord *pos2, s16 *rooms); +void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, struct coord *pos2, RoomNum *rooms); void player0f0c1ba4(struct coord *pos, struct coord *up, struct coord *look, struct coord *memcampos, s32 memcamroom); void player0f0c1bd8(struct coord *pos, struct coord *up, struct coord *look); void playersClearMemCamRoom(void); diff --git a/src/include/game/prop.h b/src/include/game/prop.h index 5076414a6..b26589518 100644 --- a/src/include/game/prop.h +++ b/src/include/game/prop.h @@ -21,7 +21,7 @@ void propDelist(struct prop *prop); void propReparent(struct prop *mover, struct prop *adopter); void propDetach(struct prop *prop); Gfx *propRender(Gfx *gdl, struct prop *prop, bool xlupass); -Gfx *propsRender(Gfx *gdl, s16 renderroomnum, s32 renderpass, s16 *roomnumsbyprop); +Gfx *propsRender(Gfx *gdl, RoomNum renderroomnum, s32 renderpass, RoomNum *roomnumsbyprop); void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop); void func0f060bac(s32 weaponnum, struct prop *prop); struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struct coord *arg3, struct coord *gunpos, struct coord *dir, u32 arg6, f32 arg7, bool arg8); @@ -46,21 +46,21 @@ void farsightChooseTarget(void); void autoaimTick(void); u32 propDoorGetCdTypes(struct prop *prop); bool propIsOfCdType(struct prop *prop, u32 types); -void roomsCopy(s16 *srcrooms, s16 *dstrooms); -void roomsAppend(s16 *newrooms, s16 *dstrooms, s32 maxlen); -bool arrayIntersects(s16 *a, s16 *b); +void roomsCopy(RoomNum *srcrooms, RoomNum *dstrooms); +void roomsAppend(RoomNum *newrooms, RoomNum *dstrooms, s32 maxlen); +bool arrayIntersects(RoomNum *a, RoomNum *b); bool propTryAddToChunk(s16 propnum, s32 chunkindex); s32 roomAllocatePropListChunk(s32 room, s32 arg1); -void propRegisterRoom(struct prop *prop, s16 room); -void propDeregisterRoom(struct prop *prop, s16 room); +void propRegisterRoom(struct prop *prop, RoomNum room); +void propDeregisterRoom(struct prop *prop, RoomNum room); void propDeregisterRooms(struct prop *prop); void propRegisterRooms(struct prop *prop); -void func0f065d1c(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms, s16 *morerooms, u32 arg5); -void func0f065dd8(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms); -void func0f065dfc(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms, s16 *morerooms, u32 arg5); -void func0f065e74(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newrooms); -void func0f065e98(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2); -void roomGetProps(s16 *room, s16 *propnums, s32 len); +void func0f065d1c(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms, RoomNum *morerooms, u32 arg5); +void func0f065dd8(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms); +void func0f065dfc(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms, RoomNum *morerooms, u32 arg5); +void func0f065e74(struct coord *pos, RoomNum *rooms, struct coord *newpos, RoomNum *newrooms); +void func0f065e98(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2); +void roomGetProps(RoomNum *room, s16 *propnums, s32 len); void propsDefragRoomProps(void); void propGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin); bool propUpdateGeometry(struct prop *prop, u8 **start, u8 **end); diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index ba17e8f0f..304947f69 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -63,7 +63,7 @@ bool modelGetScreenCoords2(struct model *model, f32 *x2, f32 *x1, f32 *y2, f32 * bool modelGetScreenCoords(struct model *model, f32 *x2, f32 *x1, f32 *y2, f32 *y1); void func0f06803c(struct coord *arg0, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4); struct defaultobj *objFindByPadNum(s32 padnum); -struct defaultobj *objFindByPos(struct coord *pos, s16 *rooms); +struct defaultobj *objFindByPos(struct coord *pos, RoomNum *rooms); void projectileFree(struct projectile *projectile); void projectilesUnrefOwner(struct prop *owner); void projectileReset(struct projectile *projectile); @@ -81,7 +81,7 @@ struct modelnode *modelFindBboxNode(struct model *model); struct modelrodata_bbox *modelFindBboxRodata(struct model *model); struct modelnode *objFindBboxNode(struct defaultobj *obj); struct modelrodata_bbox *objFindBboxRodata(struct defaultobj *obj); -s32 objGetAverageBrightnessInRooms(s16 *rooms, s32 arg1); +s32 objGetAverageBrightnessInRooms(RoomNum *rooms, s32 arg1); s32 door0f068c04(struct prop *prop, s32 *arg1, s32 *arg2); s32 func0f068fc8(struct prop *prop, bool arg1); void propCalculateShadeColour(struct prop *prop, u8 *nextcol, u16 floorcol); @@ -98,10 +98,10 @@ void objCreateDebris(struct defaultobj *obj, struct prop *prop); struct prop *objInit(struct defaultobj *obj, struct modeldef *modeldef, struct prop *prop, struct model *model); struct prop *objInitWithModelDef(struct defaultobj *obj, struct modeldef *modeldef); struct prop *objInitWithAutoModel(struct defaultobj *obj); -void func0f06a580(struct defaultobj *obj, struct coord *pos, Mtxf *matrix, s16 *rooms); +void func0f06a580(struct defaultobj *obj, struct coord *pos, Mtxf *matrix, RoomNum *rooms); f32 func0f06a620(struct defaultobj *obj); -void func0f06a730(struct defaultobj *obj, struct coord *arg1, Mtxf *matrix, s16 *rooms, struct coord *arg4); -void func0f06ab60(struct defaultobj *obj, struct coord *arg1, Mtxf *matrix, s16 *rooms, struct coord *arg4); +void func0f06a730(struct defaultobj *obj, struct coord *arg1, Mtxf *matrix, RoomNum *rooms, struct coord *arg4); +void func0f06ab60(struct defaultobj *obj, struct coord *arg1, Mtxf *matrix, RoomNum *rooms, struct coord *arg4); void objFreeProjectile(struct defaultobj *obj); void objFreeEmbedmentOrProjectile(struct prop *prop); void objFree(struct defaultobj *obj, bool freeprop, bool canregen); @@ -112,7 +112,7 @@ bool func0f06b488(struct prop *prop, struct coord *arg1, struct coord *arg2, str bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2, struct coord *arg3, f32 arg4, struct coord *arg5, struct coord *arg6, struct coord *arg7, struct coord *arg8, f32 *arg9); bool func0f06bea0(struct model *model, struct modelnode *arg1, struct modelnode *arg2, struct coord *arg3, struct coord *arg4, void *arg5, f32 *arg6, struct modelnode **arg7, s32 *hitpart, s32 *arg9, struct modelnode **arg10); bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, struct coord *arg3, f32 arg4, struct coord *arg5, struct coord *arg6, struct coord *arg7, struct coord *arg8, f32 *arg9); -bool projectileFindCollidingProp(struct prop *prop, struct coord *pos, struct coord *arg2, u32 cdtypes, struct coord *arg4, struct coord *arg5, s16 *arg6); +bool projectileFindCollidingProp(struct prop *prop, struct coord *pos, struct coord *arg2, u32 cdtypes, struct coord *arg4, struct coord *arg5, RoomNum *rooms); s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2, struct coord *arg3); bool func0f06d37c(struct defaultobj *obj, struct coord *arg1, struct coord *arg2, struct coord *arg3); void applySpeed(f32 *distdone, f32 maxdist, f32 *speed, f32 accel, f32 decel, f32 maxspeed); @@ -142,7 +142,7 @@ f32 liftGetY(struct liftobj *lift); void liftUpdateTiles(struct liftobj *lift, bool stationary); void liftGoToStop(struct liftobj *lift, s32 stopnum); f32 objGetHov04(struct defaultobj *obj); -void hovUpdateGround(struct defaultobj *obj, struct hov *hov, struct coord *pos, s16 *rooms, f32 matrix[3][3]); +void hovUpdateGround(struct defaultobj *obj, struct hov *hov, struct coord *pos, RoomNum *rooms, f32 matrix[3][3]); void hovTick(struct defaultobj *obj, struct hov *hov); s32 objIsHoverpropOrBike(struct defaultobj *obj); f32 hoverpropGetTurnAngle(struct defaultobj *obj); @@ -289,7 +289,7 @@ void weaponDeleteFromChr(struct chrdata *chr, s32 hand); struct prop *weaponCreateForChr(struct chrdata *chr, s32 modelnum, s32 weaponnum, u32 flags, struct weaponobj *obj, struct modeldef *modeldef); struct prop *chrGiveWeapon(struct chrdata *chr, s32 model, s32 weaponnum, u32 flags); s32 weaponTestForPickup(struct prop *prop); -void weaponSetGunfireVisible(struct prop *prop, bool visible, s16 room); +void weaponSetGunfireVisible(struct prop *prop, bool visible, RoomNum room); bool weaponIsGunfireVisible(struct prop *prop); s32 hatGetType(struct prop *prop); bool doorIsUnlocked(struct prop *playerprop, struct prop *doorprop); @@ -306,7 +306,7 @@ void func0f08d3dc(struct doorobj *door); void func0f08d460(struct doorobj *door); void doorActivatePortal(struct doorobj *door); void doorDeactivatePortal(struct doorobj *door); -struct prop *doorInit(struct doorobj *door, struct coord *pos, Mtxf *mtx, s16 *rooms, struct coord *coord, struct coord *centre); +struct prop *doorInit(struct doorobj *door, struct coord *pos, Mtxf *mtx, RoomNum *rooms, struct coord *coord, struct coord *centre); void doorPlayOpeningSound(s32 soundtype, struct prop *prop); void doorPlayClosingSound(s32 soundtype, struct prop *prop); void doorPlayOpenedSound(s32 soundtype, struct prop *prop); @@ -320,7 +320,7 @@ void doorSetMode(struct doorobj *door, s32 newmode); void doorsRequestMode(struct doorobj *door, s32 newmode); s32 doorIsClosed(struct doorobj *door); s32 doorIsOpen(struct doorobj *door); -s32 func0f08e5a8(s16 *rooms, struct screenbox *box); +s32 func0f08e5a8(RoomNum *rooms, struct screenbox *box); f32 objCalculateFadeDistOpacityFrac(struct prop *prop, f32 modelscale); bool posIsInObjFadeDistance(struct coord *coord, f32 modelscale); bool func0f08e8ac(struct prop *prop, struct coord *pos, f32 arg2, bool arg3); diff --git a/src/include/game/propsnd.h b/src/include/game/propsnd.h index f08196bf5..d1b236033 100644 --- a/src/include/game/propsnd.h +++ b/src/include/game/propsnd.h @@ -21,17 +21,17 @@ void psTick(void); void psSetPitch(struct prop *prop, f32 targetpitch, s32 changespeed); void psSetVolume(struct prop *prop, s32 vol); void psStopOneShootChannel(struct prop *prop); -s16 psCreate(struct pschannel *channel, struct prop *prop, s16 soundnum, s16 padnum, s32 vol, u16 flags, u16 flags2, s32 type, struct coord *pos, f32 pitch, s16 *rooms, s32 room, f32 dist1, f32 dist2, f32 dist3); +s16 psCreate(struct pschannel *channel, struct prop *prop, s16 soundnum, s16 padnum, s32 vol, u16 flags, u16 flags2, s32 type, struct coord *pos, f32 pitch, RoomNum *rooms, s32 room, f32 dist1, f32 dist2, f32 dist3); s32 psPlayFromProp(s32 channelnum, s16 soundnum, s32 vol, struct prop *prop, s16 type, u16 flags); void psMuteChannel(s32 channelnum); bool psIsChannelFree(s32 channelnum); void psModify(s32 channelnum, s32 arg1, s16 padnum, struct prop *prop, s32 volchangetimer60, s32 dist2, s32 dist3, u16 flags); -s32 psCalculateVol(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, s16 *rooms, s16 soundnum, s32 arg6, f32 *arg7); +s32 psCalculateVol(struct coord *pos, f32 arg1, f32 arg2, f32 arg3, RoomNum *rooms, s16 soundnum, s32 arg6, f32 *arg7); s32 psCalculatePan3(s32 degrees, f32 arg1, struct pschannel *channel); s32 psCalculatePan2(struct coord *pos, s32 arg1, f32 arg2, struct pschannel *channel); s32 psCalculatePan(struct coord *pos, f32 dist1, f32 dist2, f32 dist3, f32 playerdist, bool arg5, struct pschannel *channel); -void psGetTheoreticalVolPan(struct coord *pos, s16 *rooms, s16 soundnum, s32 *vol, s32 *pan); -void psApplyVolPan(struct sndstate *handle, struct coord *pos, f32 dist1, f32 dist2, f32 dist3, s16 *rooms, s16 soundnum, s32 arg7, f32 *distanceptr); +void psGetTheoreticalVolPan(struct coord *pos, RoomNum *rooms, s16 soundnum, s32 *vol, s32 *pan); +void psApplyVolPan(struct sndstate *handle, struct coord *pos, f32 dist1, f32 dist2, f32 dist3, RoomNum *rooms, s16 soundnum, s32 arg7, f32 *distanceptr); s32 psGetRandomSparkSound(void); s32 psGetDuration60(s32 channelnum); diff --git a/src/include/game/setuputils.h b/src/include/game/setuputils.h index 4d4fcb77a..86cad9dea 100644 --- a/src/include/game/setuputils.h +++ b/src/include/game/setuputils.h @@ -11,7 +11,7 @@ u32 setupGetCmdIndexByProp(struct prop *prop); bool setupLoadModeldef(s32 modelnum); bool setupGetObjBbox(struct defaultobj *obj, struct coord *pos, f32 realrot[3][3], struct coord *arg3, struct coord *arg4); bool setup0f092304(struct defaultobj *obj, struct coord *arg1, struct coord *arg2); -void setup0f09233c(struct defaultobj *obj, struct coord *pos, f32 realrot[3][3], s16 *rooms); +void setup0f09233c(struct defaultobj *obj, struct coord *pos, f32 realrot[3][3], RoomNum *rooms); void setup0f0923d4(struct defaultobj *obj); struct defaultobj *setupGetObjByCmdIndex(u32 cmdindex); struct defaultobj *setupFindObjForReuse(s32 type, struct defaultobj **arg1, struct defaultobj **arg2, bool musthaveprop, bool musthavemodel, struct modeldef *modeldef); diff --git a/src/include/game/smoke.h b/src/include/game/smoke.h index 790c272cf..221ecda59 100644 --- a/src/include/game/smoke.h +++ b/src/include/game/smoke.h @@ -11,13 +11,13 @@ void smokeReset(void); void smokeStop(void); Gfx *smokeRenderPart(struct smoke *smoke, struct smokepart *part, Gfx *gdl, struct coord *coord, f32 size); -struct smoke *smokeCreate(struct coord *pos, s16 *rooms, s16 type); -bool smokeCreateForHand(struct coord *pos, s16 *rooms, s16 type, s32 handnum); -bool smokeCreateWithSource(void *source, struct coord *pos, s16 *rooms, s16 type, bool srcispadeffect); +struct smoke *smokeCreate(struct coord *pos, RoomNum *rooms, s16 type); +bool smokeCreateForHand(struct coord *pos, RoomNum *rooms, s16 type, s32 handnum); +bool smokeCreateWithSource(void *source, struct coord *pos, RoomNum *rooms, s16 type, bool srcispadeffect); void smokeCreateAtProp(struct prop *prop, s16 type); -void smokeCreateAtPadEffect(struct padeffectobj *effect, struct coord *pos, s16 *rooms, s16 type); +void smokeCreateAtPadEffect(struct padeffectobj *effect, struct coord *pos, RoomNum *rooms, s16 type); void smokeClearForProp(struct prop *prop); -struct smoke *smokeCreateSimple(struct coord *pos, s16 *rooms, s16 type); +struct smoke *smokeCreateSimple(struct coord *pos, RoomNum *rooms, s16 type); u32 smokeTick(struct prop *prop); u32 smokeTickPlayer(struct prop *prop); Gfx *smokeRender(struct prop *prop, Gfx *gdl, bool xlupass); diff --git a/src/include/game/wallhit.h b/src/include/game/wallhit.h index 36fe0e25b..9866462ee 100644 --- a/src/include/game/wallhit.h +++ b/src/include/game/wallhit.h @@ -17,11 +17,11 @@ void wallhitRemoveOne(void); void wallhitsTick(void); void wallhitCreate(struct coord *relpos, struct coord *arg1, struct coord *arg2, s16 arg3[3], - s16 arg4[3], s16 texnum, s16 room, struct prop *objprop, + s16 arg4[3], s16 texnum, RoomNum room, struct prop *objprop, s8 mtxindex, s8 arg9, struct chrdata *chr, bool xlu); void wallhitCreateWith20Args(struct coord *relpos, struct coord *arg1, struct coord *arg2, s16 arg3[3], - s16 arg4[3], s16 texnum, s16 room, struct prop *objprop, + s16 arg4[3], s16 texnum, RoomNum room, struct prop *objprop, struct prop *chrprop, s8 mtxindex, s8 arg10, struct chrdata *chr, f32 width, f32 height, u8 minalpha, u8 maxalpha, s32 rotdeg, u32 timermax, u32 timerspeed, bool xlu); diff --git a/src/include/lib/collision.h b/src/include/lib/collision.h index 657659d4a..a227b2331 100644 --- a/src/include/lib/collision.h +++ b/src/include/lib/collision.h @@ -25,47 +25,47 @@ bool cd000266a4(f32 x, f32 z, struct geo *tile); void cdGetPropsOnPlatform(struct prop *platform, s16 *propnums, s32 len); s32 cd000274e0Block(struct geoblock *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collision *collision); bool cd000276c8Cyl(struct geocyl *tile, f32 x, f32 z, f32 width, struct prop *prop, struct collision *collision); -bool cdFindLadder(struct coord *pos, f32 width, f32 ymax, f32 ymin, s16 *rooms, u16 geoflags, struct coord *laddernormal); -bool cd0002a13c(struct coord *pos, f32 radius, f32 arg2, f32 arg3, s16 *rooms, u16 geoflags); -f32 cdFindGroundInfoAtCyl(struct coord *pos, f32 radius, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift); +bool cdFindLadder(struct coord *pos, f32 width, f32 ymax, f32 ymin, RoomNum *rooms, u16 geoflags, struct coord *laddernormal); +bool cd0002a13c(struct coord *pos, f32 radius, f32 arg2, f32 arg3, RoomNum *rooms, u16 geoflags); +f32 cdFindGroundInfoAtCyl(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, RoomNum *floorroom, s32 *inlift, struct prop **lift); f32 cdReturnZero(void); -f32 cdFindGroundAtCyl(struct coord *pos, f32 radius, s16 *rooms, u16 *floorcol, u8 *floortype); -f32 cdFindFloorYColourTypeAtPos(struct coord *pos, s16 *rooms, u16 *floorcol, u8 *floortype); -s32 cdFindFloorRoomAtPos(struct coord *pos, s16 *nearrooms); +f32 cdFindGroundAtCyl(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, u8 *floortype); +f32 cdFindFloorYColourTypeAtPos(struct coord *pos, RoomNum *rooms, u16 *floorcol, u8 *floortype); +s32 cdFindFloorRoomAtPos(struct coord *pos, RoomNum *nearrooms); #if VERSION >= VERSION_NTSC_1_0 -s16 cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr); -s16 cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr); +RoomNum cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr); +RoomNum cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr); #else -s16 cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr); -s16 cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr); +RoomNum cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr); +RoomNum cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr); #endif -s16 cdFindFloorRoomYColourNormalPropAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcol, struct coord *normal, struct prop **propptr); -s16 cdFindCeilingRoomYColourFlagsNormalAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcol, u16 *geoflags, struct coord *normal); -s32 cdTestVolume(struct coord *pos, f32 radius, s16 *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin); -s32 cdExamCylMove01(struct coord *pos, struct coord *pos2, f32 radius, s16 *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin); -s32 cdExamCylMove02(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, bool checkvertical, f32 ymax, f32 ymin); -bool cdTestCylMove01(struct coord *pos, s16 *rooms, struct coord *targetpos, u32 types, u32 arg4, f32 ymax, f32 ymin); -s32 cdTestCylMove02(struct coord *pos, s16 *rooms, struct coord *coord2, s16 *rooms2, u32 types, bool arg5, f32 ymax, f32 ymin); -s32 cdExamCylMove03(struct coord *pos, s16 *rooms, struct coord *arg2, u32 types, u32 arg4, f32 ymax, f32 ymin); -s32 cdTestCylMove04(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin); -s32 cdExamCylMove05(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, s32 types, bool arg5, f32 ymax, f32 ymin); -s32 cdExamCylMove06(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 arg4, s32 types, s32 arg6, f32 ymax, f32 ymin); -s32 cdExamCylMove07(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin); -s32 cdExamCylMove08(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 width, u32 types, s32 arg6, f32 ymax, f32 ymin); -bool cdTestLos03(struct coord *viewpos, s16 *rooms, struct coord *targetpos, u32 types, u16 geoflags); -bool cdTestLos04(struct coord *coord, s16 *rooms, struct coord *coord2, s32 arg3); -bool cdTestLos05(struct coord *coord, s16 *rooms, struct coord *coord2, s16 *rooms2, s32 cdtypes, u16 geoflags); -bool cdTestLos06(struct coord *arg0, s16 *rooms1, struct coord *arg2, s16 *rooms2, u32 types); -bool cdTestLos07(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, s16 *rooms3, u32 types, u16 geoflags); -s32 cdExamLos08(struct coord *pos, s16 *rooms, struct coord *pos2, u32 types, u16 geoflags); -s32 cdExamLos09(struct coord *pos, s16 *rooms, struct coord *pos2, u32 types); -s32 cdTestLos10(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types, u16 geoflags); -s32 cdTestLos11(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types); +RoomNum cdFindFloorRoomYColourNormalPropAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcol, struct coord *normal, struct prop **propptr); +RoomNum cdFindCeilingRoomYColourFlagsNormalAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcol, u16 *geoflags, struct coord *normal); +s32 cdTestVolume(struct coord *pos, f32 radius, RoomNum *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin); +s32 cdExamCylMove01(struct coord *pos, struct coord *pos2, f32 radius, RoomNum *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin); +s32 cdExamCylMove02(struct coord *origpos, struct coord *dstpos, f32 width, RoomNum *dstrooms, s32 types, bool checkvertical, f32 ymax, f32 ymin); +bool cdTestCylMove01(struct coord *pos, RoomNum *rooms, struct coord *targetpos, u32 types, u32 arg4, f32 ymax, f32 ymin); +s32 cdTestCylMove02(struct coord *pos, RoomNum *rooms, struct coord *coord2, RoomNum *rooms2, u32 types, bool arg5, f32 ymax, f32 ymin); +s32 cdExamCylMove03(struct coord *pos, RoomNum *rooms, struct coord *arg2, u32 types, u32 arg4, f32 ymax, f32 ymin); +s32 cdTestCylMove04(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin); +s32 cdExamCylMove05(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, s32 types, bool arg5, f32 ymax, f32 ymin); +s32 cdExamCylMove06(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, f32 arg4, s32 types, s32 arg6, f32 ymax, f32 ymin); +s32 cdExamCylMove07(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin); +s32 cdExamCylMove08(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, f32 width, u32 types, s32 arg6, f32 ymax, f32 ymin); +bool cdTestLos03(struct coord *viewpos, RoomNum *rooms, struct coord *targetpos, u32 types, u16 geoflags); +bool cdTestLos04(struct coord *coord, RoomNum *rooms, struct coord *coord2, s32 arg3); +bool cdTestLos05(struct coord *coord, RoomNum *rooms, struct coord *coord2, RoomNum *rooms2, s32 cdtypes, u16 geoflags); +bool cdTestLos06(struct coord *arg0, RoomNum *rooms1, struct coord *arg2, RoomNum *rooms2, u32 types); +bool cdTestLos07(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, RoomNum *rooms3, u32 types, u16 geoflags); +s32 cdExamLos08(struct coord *pos, RoomNum *rooms, struct coord *pos2, u32 types, u16 geoflags); +s32 cdExamLos09(struct coord *pos, RoomNum *rooms, struct coord *pos2, u32 types); +s32 cdTestLos10(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, u16 geoflags); +s32 cdTestLos11(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types); bool cd0002ded8(struct coord *arg0, struct coord *arg1, struct prop *prop); -s32 cdTestBlockOverlapsAnyProp(struct geoblock *geo, s16 *rooms, u32 types); -s32 cd0002f02c(struct geoblock *block, s16 *rooms, s32 types); -bool cdIsNearlyInSight(struct coord *viewpos, s16 *rooms, struct coord *targetpos, f32 distance, s32 arg4); +s32 cdTestBlockOverlapsAnyProp(struct geoblock *geo, RoomNum *rooms, u32 types); +s32 cd0002f02c(struct geoblock *block, RoomNum *rooms, s32 types); +bool cdIsNearlyInSight(struct coord *viewpos, RoomNum *rooms, struct coord *targetpos, f32 distance, s32 arg4); #endif diff --git a/src/include/lib/lib_17ce0.h b/src/include/lib/lib_17ce0.h index 5fa8ddb14..a6d970059 100644 --- a/src/include/lib/lib_17ce0.h +++ b/src/include/lib/lib_17ce0.h @@ -9,8 +9,8 @@ #define PORTALINTERSECTION_FRONTTOBEHIND 2 void portalGetAvgVertexPos(s32 portalnum, struct coord *avg); -void portal00017dc4(s16 *rooms, s16 roomnum); +void portal00017dc4(RoomNum *rooms, RoomNum roomnum); s32 portalCalculateIntersection(s32 portalnum, struct coord *pos1, struct coord *pos2); -void portal00018148(struct coord *pos, struct coord *pos2, s16 *rooms, s16 *arg3, s16 *arg4, s32 arg5); +void portal00018148(struct coord *pos, struct coord *pos2, RoomNum *rooms, RoomNum *arg3, RoomNum *arg4, s32 arg5); #endif diff --git a/src/include/types.h b/src/include/types.h index b2a522a4c..9d9929c51 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -19,6 +19,7 @@ typedef s32 PakErr1; typedef s32 PakErr2; typedef s32 MenuDialogHandlerResult; typedef intptr_t MenuItemHandlerResult; +typedef s16 RoomNum; // Float version of a graphics matrix, which has higher precision than an Mtx. // Matrices are stored as Mtxfs then converted to an Mtx when passed to the GPU. @@ -292,7 +293,7 @@ struct prop { /*0x1c*/ struct prop *child; /*0x20*/ struct prop *next; /*0x24*/ struct prop *prev; - /*0x28*/ s16 rooms[8]; + /*0x28*/ RoomNum rooms[8]; /*0x38*/ u16 lastupdateframe; /*0x3a*/ u16 propupdate240; /*0x3c*/ u8 propupdate60err; @@ -738,7 +739,7 @@ struct aibot { /*0x076*/ s16 lastkilledbyplayernum; /*0x078*/ u8 forceslowupdates; /*0x079*/ u8 command; - /*0x07a*/ s16 defendholdrooms[1]; + /*0x07a*/ RoomNum defendholdrooms[1]; /*0x07c*/ u32 unk07c; // unused /*0x080*/ u32 unk080; // unused /*0x084*/ u32 unk084; // unused @@ -770,7 +771,7 @@ struct aibot { /*0x0e0*/ s16 reaperspeed[2]; /*0x0e4*/ f32 maulercharge[2]; /*0x0ec*/ struct coord gotopos; - /*0x0f8*/ s16 gotorooms[8]; + /*0x0f8*/ RoomNum gotorooms[8]; /*0x108*/ struct coord shotspeed; // "boost" when aibot is shot /*0x114*/ s32 feudplayernum; /*0x118*/ s32 commandtimer60; @@ -783,7 +784,7 @@ struct aibot { /*0x13c*/ f32 chrdistances[MAX_MPCHRS]; /*0x16c*/ u8 chrsinsight[MAX_MPCHRS]; /*0x178*/ s32 chrslastseen60[MAX_MPCHRS]; - /*0x1a8*/ s16 chrrooms[MAX_MPCHRS]; + /*0x1a8*/ RoomNum chrrooms[MAX_MPCHRS]; /*0x1c0*/ f32 extraangle; /*0x1c4*/ f32 extraanglerate; /*0x1c8*/ f32 extraanglebase; @@ -1040,7 +1041,7 @@ struct act_patrol { struct act_gopos { /*0x02c*/ struct coord endpos; - /*0x038*/ s16 endrooms[8]; + /*0x038*/ RoomNum endrooms[8]; /*0x048*/ struct waypoint *target; // Target/final waypoint // Array of pointers to the next couple of waypoints. Recalculated each time @@ -1243,9 +1244,9 @@ struct chrdata { /*0x2ae*/ u16 unk2ae; /*0x2b0*/ u8 tude; /*0x2b1*/ u8 voicebox; - /*0x2b2*/ s16 floorroom; + /*0x2b2*/ RoomNum floorroom; /*0x2b4*/ u32 unk2b4; - /*0x2b8*/ s16 oldrooms[8]; + /*0x2b8*/ RoomNum oldrooms[8]; /*0x2c8*/ struct coord runfrompos; /*0x2d4*/ struct aibot *aibot; /*0x2d8*/ s16 blurdrugamount; @@ -2463,7 +2464,7 @@ struct player { /*0x0278*/ f32 shieldshowrot; /*0x027c*/ u32 shieldshowrnd; /*0x0280*/ f32 shieldshowtime; - /*0x0284*/ s16 bondprevrooms[8]; + /*0x0284*/ RoomNum bondprevrooms[8]; /*0x0294*/ f32 liftground; /*0x0298*/ struct prop *lift; /*0x029c*/ f32 ladderupdown; @@ -2659,7 +2660,7 @@ struct player { /*0x19a4*/ f32 speedgo; /*0x19a8*/ s32 sighttimer240; /*0x19ac*/ s32 crouchoffsetreal; - /*0x19b0*/ s16 floorroom; + /*0x19b0*/ RoomNum floorroom; /*0x19b2*/ u8 unk19b2; /*0x19b3*/ u8 dostartnewlife; /*0x19b4*/ f32 crouchoffsetsmall; @@ -2805,7 +2806,7 @@ struct coverdefinition { struct cover { /*0x00*/ struct coord *pos; /*0x04*/ struct coord *look; - /*0x08*/ s16 rooms[2]; + /*0x08*/ RoomNum rooms[2]; /*0x0c*/ u16 flags; }; @@ -4423,7 +4424,7 @@ struct scenariodata_koh { /*0x800ac118*/ s16 movehill; /*0x800ac11a*/ s16 hillindex; /*0x800ac11c*/ s16 hillcount; - /*0x800ac11e*/ s16 hillrooms[2]; + /*0x800ac11e*/ RoomNum hillrooms[2]; /*0x800ac122*/ s16 hillpads[9]; /*0x800ac134*/ struct coord hillpos; /*0x800ac140*/ f32 colourfracr; @@ -4440,7 +4441,7 @@ struct ctcspawnpadsperteam { struct scenariodata_ctc { /*0x00*/ s16 playercountsperteam[4]; /*0x08*/ s16 teamindexes[4]; - /*0x10*/ s16 baserooms[4]; + /*0x10*/ RoomNum baserooms[4]; /*0x18*/ struct ctcspawnpadsperteam spawnpadsperteam[4]; /*0x58*/ struct prop *tokens[4]; }; @@ -4589,8 +4590,8 @@ struct explosionpart { struct explosionbb { struct coord bbmin; struct coord bbmax; - s16 room; - s16 room2; + RoomNum room; + RoomNum room2; }; struct explosion { @@ -4598,7 +4599,7 @@ struct explosion { struct prop *source; // Prop of the thing that created the explosion struct explosionpart parts[40]; /*0x3c8*/ s16 age; - /*0x3ca*/ s16 room; + /*0x3ca*/ RoomNum room; /*0x3cc*/ s8 type; /*0x3cd*/ s8 makescorch; /*0x3ce*/ s8 owner; @@ -5134,7 +5135,7 @@ struct bgcmd { }; struct drawslot { - s16 roomnum; + RoomNum roomnum; u8 unk02; u8 draworder; struct screenbox box; @@ -5151,8 +5152,8 @@ struct zrange { }; struct bgsnakeitem { - /*0x00*/ s16 roomnum; - /*0x02*/ s16 fromroomnums[5]; + /*0x00*/ RoomNum roomnum; + /*0x02*/ RoomNum fromroomnums[5]; /*0x0c*/ u8 depth; /*0x0d*/ u8 numportals; /*0x0e*/ s16 roomportallistoffset; @@ -5594,7 +5595,7 @@ struct var80067e6c { }; struct shard { - /*0x00*/ s16 room; + /*0x00*/ RoomNum room; /*0x04*/ s32 age60; /*0x08*/ struct coord pos; /*0x14*/ struct coord rot; @@ -5639,7 +5640,7 @@ struct pschannel { /*0x50*/ struct prop *prop; /*0x54*/ struct coord *posptr; /*0x58*/ struct coord pos; - /*0x64*/ s16 rooms[8]; + /*0x64*/ RoomNum rooms[8]; #if VERSION >= VERSION_NTSC_1_0 /*0x74*/ u32 uuid; #endif @@ -5677,7 +5678,7 @@ struct wallhit { /*0x5c*/ struct prop *chrprop; /*0x60*/ struct prop *objprop; /*0x64*/ Vtx *vertices2; // overridden vertices for when blood is expanding - /*0x68*/ s16 roomnum; + /*0x68*/ RoomNum roomnum; /*0x6a*/ u8 texturenum; /*0x6b*/ u8 unk6b; /*0x6c*/ u8 mtxindex; diff --git a/src/lib/collision.c b/src/lib/collision.c index eb75cb0e0..f9eab66e8 100644 --- a/src/lib/collision.c +++ b/src/lib/collision.c @@ -962,9 +962,9 @@ bool cd00026a04(struct coord *pos, u8 *start, u8 *end, u16 geoflags, s32 room, s return result; } -void cdFindClosestVertical(struct coord *pos, s16 *rooms, u16 geoflags, struct geo **geoptr, s16 *roomptr, f32 *groundptr, struct prop **propptr, bool ceiling) +void cdFindClosestVertical(struct coord *pos, RoomNum *rooms, u16 geoflags, struct geo **geoptr, RoomNum *roomptr, f32 *groundptr, struct prop **propptr, bool ceiling) { - s16 *roomptr2; + RoomNum *roomptr2; s32 roomnum; u8 *start; u8 *end; @@ -1262,9 +1262,9 @@ void cdCollectGeoForCylFromList(struct coord *pos, f32 radius, u8 *start, u8 *en } } -void cdCollectGeoForCyl(struct coord *pos, f32 radius, s16 *rooms, u32 types, u16 geoflags, bool checkvertical, f32 ymax, f32 ymin, struct collision *collisions, s32 maxcollisions) +void cdCollectGeoForCyl(struct coord *pos, f32 radius, RoomNum *rooms, u32 types, u16 geoflags, bool checkvertical, f32 ymax, f32 ymin, struct collision *collisions, s32 maxcollisions) { - s16 *roomptr; + RoomNum *roomptr; s32 roomnum; u8 *start; u8 *end; @@ -1590,9 +1590,9 @@ void cdCollectGeoForCylMoveFromList(u8 *start, u8 *end, struct coord *pos, f32 r } } -void cdCollectGeoForCylMove(struct coord *pos, f32 width, s16 *rooms, u32 types, u16 geoflags, bool checkvertical, f32 ymax, f32 ymin, struct collision *collisions, s32 maxcollisions) +void cdCollectGeoForCylMove(struct coord *pos, f32 width, RoomNum *rooms, u32 types, u16 geoflags, bool checkvertical, f32 ymax, f32 ymin, struct collision *collisions, s32 maxcollisions) { - s16 *roomptr; + RoomNum *roomptr; s32 roomnum; u8 *start; u8 *end; @@ -2139,7 +2139,7 @@ f32 cdFindGroundFromList(struct collision *collisions, struct coord *pos, struct * There is nothing specific to ladders in this function, but it's only used * for finding ladders. */ -bool cdFindLadder(struct coord *pos, f32 width, f32 ymax, f32 ymin, s16 *rooms, u16 geoflags, struct coord *laddernormal) +bool cdFindLadder(struct coord *pos, f32 width, f32 ymax, f32 ymin, RoomNum *rooms, u16 geoflags, struct coord *laddernormal) { struct collision collisions[2]; @@ -2167,7 +2167,7 @@ bool cdFindLadder(struct coord *pos, f32 width, f32 ymax, f32 ymin, s16 *rooms, return false; } -bool cd0002a13c(struct coord *pos, f32 radius, f32 ymax, f32 ymin, s16 *rooms, u16 geoflags) +bool cd0002a13c(struct coord *pos, f32 radius, f32 ymax, f32 ymin, RoomNum *rooms, u16 geoflags) { struct collision collisions[2]; @@ -2180,8 +2180,8 @@ bool cd0002a13c(struct coord *pos, f32 radius, f32 ymax, f32 ymin, s16 *rooms, u return false; } -f32 cdFindGroundInfoAtCyl(struct coord *pos, f32 radius, s16 *rooms, u16 *floorcol, - u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift) +f32 cdFindGroundInfoAtCyl(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, + u8 *floortype, u16 *floorflags, RoomNum *floorroom, s32 *inlift, struct prop **lift) { struct collision collisions[21]; struct collision *sp72 = NULL; @@ -2244,15 +2244,15 @@ f32 cdReturnZero(void) return 0; } -f32 cdFindGroundAtCyl(struct coord *pos, f32 radius, s16 *rooms, u16 *floorcol, u8 *floortype) +f32 cdFindGroundAtCyl(struct coord *pos, f32 radius, RoomNum *rooms, u16 *floorcol, u8 *floortype) { return cdFindGroundInfoAtCyl(pos, radius, rooms, floorcol, floortype, NULL, NULL, NULL, NULL); } -f32 cdFindFloorYColourTypeAtPos(struct coord *pos, s16 *rooms, u16 *floorcol, u8 *floortype) +f32 cdFindFloorYColourTypeAtPos(struct coord *pos, RoomNum *rooms, u16 *floorcol, u8 *floortype) { struct geo *geo; - s16 sp30[2]; + RoomNum sp30[2]; f32 sp2c; f32 result = -4294967296; @@ -2273,10 +2273,10 @@ f32 cdFindFloorYColourTypeAtPos(struct coord *pos, s16 *rooms, u16 *floorcol, u8 return result; } -s32 cdFindFloorRoomAtPos(struct coord *pos, s16 *nearrooms) +s32 cdFindFloorRoomAtPos(struct coord *pos, RoomNum *nearrooms) { struct geo *geo; - s16 room; + RoomNum room; f32 sp2c; cdFindClosestVertical(pos, nearrooms, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2, &geo, &room, &sp2c, 0, SURFACE_FLOOR); @@ -2285,13 +2285,13 @@ s32 cdFindFloorRoomAtPos(struct coord *pos, s16 *nearrooms) } #if VERSION >= VERSION_NTSC_1_0 -s16 cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr) +RoomNum cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr) #else -s16 cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr) +RoomNum cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr) #endif { struct geo *geo; - s16 room; + RoomNum room; f32 sp2c; cdFindClosestVertical(pos, rooms, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2, &geo, &room, &sp2c, NULL, SURFACE_FLOOR); @@ -2314,13 +2314,13 @@ s16 cdFindFloorRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u } #if VERSION >= VERSION_NTSC_1_0 -s16 cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr) +RoomNum cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr, u16 *flagsptr) #else -s16 cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcolptr) +RoomNum cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcolptr) #endif { struct geo *geo; - s16 sp32; + RoomNum sp32; f32 sp2c; cdFindClosestVertical(pos, rooms, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2, &geo, &sp32, &sp2c, NULL, SURFACE_CEILING); @@ -2342,10 +2342,10 @@ s16 cdFindCeilingRoomYColourFlagsAtPos(struct coord *pos, s16 *rooms, f32 *arg2, return sp32; } -s16 cdFindFloorRoomYColourNormalPropAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcol, struct coord *normal, struct prop **propptr) +RoomNum cdFindFloorRoomYColourNormalPropAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcol, struct coord *normal, struct prop **propptr) { struct geo *geo; - s16 room; + RoomNum room; f32 sp2c; cdFindClosestVertical(pos, rooms, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2, &geo, &room, &sp2c, propptr, SURFACE_FLOOR); @@ -2362,10 +2362,10 @@ s16 cdFindFloorRoomYColourNormalPropAtPos(struct coord *pos, s16 *rooms, f32 *ar return room; } -s16 cdFindCeilingRoomYColourFlagsNormalAtPos(struct coord *pos, s16 *rooms, f32 *arg2, u16 *floorcol, u16 *flagsptr, struct coord *normal) +RoomNum cdFindCeilingRoomYColourFlagsNormalAtPos(struct coord *pos, RoomNum *rooms, f32 *arg2, u16 *floorcol, u16 *flagsptr, struct coord *normal) { struct geo *geo; - s16 sp32; + RoomNum sp32; f32 sp2c; cdFindClosestVertical(pos, rooms, GEOFLAG_FLOOR1 | GEOFLAG_FLOOR2, &geo, &sp32, &sp2c, NULL, SURFACE_CEILING); @@ -2389,7 +2389,7 @@ s16 cdFindCeilingRoomYColourFlagsNormalAtPos(struct coord *pos, s16 *rooms, f32 /** * Tests if a cylinder volume fits in the given position. */ -s32 cdTestVolume(struct coord *pos, f32 width, s16 *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin) +s32 cdTestVolume(struct coord *pos, f32 width, RoomNum *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin) { struct collision collisions[2]; bool result = true; @@ -2404,7 +2404,7 @@ s32 cdTestVolume(struct coord *pos, f32 width, s16 *rooms, s32 types, bool check return result; } -s32 cdExamCylMove01(struct coord *pos, struct coord *pos2, f32 radius, s16 *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin) +s32 cdExamCylMove01(struct coord *pos, struct coord *pos2, f32 radius, RoomNum *rooms, s32 types, bool checkvertical, f32 ymax, f32 ymin) { struct collision collisions[2]; s32 cdresult; @@ -2469,7 +2469,7 @@ s32 cdExamCylMove01(struct coord *pos, struct coord *pos2, f32 radius, s16 *room return cdresult; } -s32 cdExamCylMove02(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, bool checkvertical, f32 ymax, f32 ymin) +s32 cdExamCylMove02(struct coord *origpos, struct coord *dstpos, f32 width, RoomNum *dstrooms, s32 types, bool checkvertical, f32 ymax, f32 ymin) { struct collision collisions[21]; struct coord dist; @@ -3337,10 +3337,10 @@ bool cdExamAToBGeolist(u8 *start, u8 *end, struct coord *arg2, struct coord *arg return !result; } -bool cdTestAToB(struct coord *pos, struct coord *coord2, s16 *rooms, u32 types, u16 geoflags, bool checkvertical, s32 arg6, f32 ymax, f32 ymin) +bool cdTestAToB(struct coord *pos, struct coord *coord2, RoomNum *rooms, u32 types, u16 geoflags, bool checkvertical, s32 arg6, f32 ymax, f32 ymin) { s32 roomnum; - s16 *roomptr; + RoomNum *roomptr; u8 *start; u8 *end; struct coord sp27c; @@ -3391,10 +3391,10 @@ bool cdTestAToB(struct coord *pos, struct coord *coord2, s16 *rooms, u32 types, return true; } -s32 cdExamAToB(struct coord *arg0, struct coord *arg1, s16 *rooms, s32 types, u16 geoflags, bool checkvertical, s32 arg6, f32 ymax, f32 ymin) +s32 cdExamAToB(struct coord *arg0, struct coord *arg1, RoomNum *rooms, s32 types, u16 geoflags, bool checkvertical, s32 arg6, f32 ymax, f32 ymin) { s32 roomnum; - s16 *roomptr; + RoomNum *roomptr; u8 *start; u8 *end; struct coord sp2c4; @@ -3451,21 +3451,21 @@ s32 cdExamAToB(struct coord *arg0, struct coord *arg1, s16 *rooms, s32 types, u1 return !sp2c0; } -bool cdTestCylMove01(struct coord *pos, s16 *rooms, struct coord *targetpos, u32 types, u32 arg4, f32 ymax, f32 ymin) +bool cdTestCylMove01(struct coord *pos, RoomNum *rooms, struct coord *targetpos, u32 types, u32 arg4, f32 ymax, f32 ymin) { - s16 sp44[21]; - s16 sp34[8]; + RoomNum sp44[21]; + RoomNum sp34[8]; portal00018148(pos, targetpos, rooms, sp34, sp44, 20); return cdTestAToB(pos, targetpos, sp44, types, GEOFLAG_WALL, CHECKVERTICAL_NO, arg4, ymax, ymin); } -s32 cdTestCylMove02(struct coord *pos, s16 *rooms, struct coord *coord2, s16 *rooms2, u32 types, s32 arg5, f32 ymax, f32 ymin) +s32 cdTestCylMove02(struct coord *pos, RoomNum *rooms, struct coord *coord2, RoomNum *rooms2, u32 types, s32 arg5, f32 ymax, f32 ymin) { s32 result; - s16 sp44[20]; - s16 sp34[8]; + RoomNum sp44[20]; + RoomNum sp34[8]; func0f065d1c(pos, rooms, coord2, sp34, sp44, 20); @@ -3478,29 +3478,29 @@ s32 cdTestCylMove02(struct coord *pos, s16 *rooms, struct coord *coord2, s16 *ro return result; } -s32 cdExamCylMove03(struct coord *pos, s16 *rooms, struct coord *arg2, u32 types, u32 arg4, f32 ymax, f32 ymin) +s32 cdExamCylMove03(struct coord *pos, RoomNum *rooms, struct coord *arg2, u32 types, u32 arg4, f32 ymax, f32 ymin) { - s16 sp44[21]; - s16 sp34[8]; + RoomNum sp44[21]; + RoomNum sp34[8]; portal00018148(pos, arg2, rooms, sp34, sp44, 20); return cdExamAToB(pos, arg2, sp44, types, GEOFLAG_WALL, CHECKVERTICAL_NO, arg4, ymax, ymin); } -s32 cdTestCylMove04(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin) +s32 cdTestCylMove04(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin) { - s16 rooms[21]; + RoomNum rooms[21]; portal00018148(arg0, arg2, arg1, arg3, rooms, 20); return cdTestAToB(arg0, arg2, rooms, types, GEOFLAG_WALL, CHECKVERTICAL_NO, arg5, ymax, ymin); } -s32 cdExamCylMove05(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, s32 types, bool arg5, f32 ymax, f32 ymin) +s32 cdExamCylMove05(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, s32 types, bool arg5, f32 ymax, f32 ymin) { - s16 sp44[21]; - s16 sp34[8]; + RoomNum sp44[21]; + RoomNum sp34[8]; s32 result; func0f065d1c(pos, rooms, pos2, sp34, sp44, 20); @@ -3515,10 +3515,10 @@ s32 cdExamCylMove05(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *room return result; } -s32 cdExamCylMove06(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 width, s32 types, s32 arg6, f32 ymax, f32 ymin) +s32 cdExamCylMove06(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, f32 width, s32 types, s32 arg6, f32 ymax, f32 ymin) { - s16 sp5c[21]; - s16 sp4c[8]; + RoomNum sp5c[21]; + RoomNum sp4c[8]; struct coord sp40; s32 result; @@ -3540,18 +3540,18 @@ s32 cdExamCylMove06(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3 return result; } -s32 cdExamCylMove07(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin) +s32 cdExamCylMove07(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, s32 arg5, f32 ymax, f32 ymin) { - s16 rooms[21]; + RoomNum rooms[21]; portal00018148(arg0, arg2, arg1, arg3, rooms, 20); return cdExamAToB(arg0, arg2, rooms, types, GEOFLAG_WALL, CHECKVERTICAL_NO, arg5, ymax, ymin); } -s32 cdExamCylMove08(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f32 width, u32 types, s32 arg6, f32 ymax, f32 ymin) +s32 cdExamCylMove08(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, f32 width, u32 types, s32 arg6, f32 ymax, f32 ymin) { - s16 rooms[21]; + RoomNum rooms[21]; struct coord sp40; s32 result; @@ -3570,26 +3570,26 @@ s32 cdExamCylMove08(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3 return result; } -bool cdTestLos03(struct coord *viewpos, s16 *rooms, struct coord *targetpos, u32 types, u16 geoflags) +bool cdTestLos03(struct coord *viewpos, RoomNum *rooms, struct coord *targetpos, u32 types, u16 geoflags) { - s16 sp44[21]; - s16 sp34[8]; + RoomNum sp44[21]; + RoomNum sp34[8]; portal00018148(viewpos, targetpos, rooms, sp34, sp44, 20); return cdTestAToB(viewpos, targetpos, sp44, types, geoflags, CHECKVERTICAL_YES, 1, 0, 0); } -bool cdTestLos04(struct coord *frompos, s16 *fromrooms, struct coord *topos, s32 types) +bool cdTestLos04(struct coord *frompos, RoomNum *fromrooms, struct coord *topos, s32 types) { return cdTestLos03(frompos, fromrooms, topos, types, GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT); } -bool cdTestLos05(struct coord *coord, s16 *rooms, struct coord *coord2, s16 *rooms2, s32 types, u16 geoflags) +bool cdTestLos05(struct coord *coord, RoomNum *rooms, struct coord *coord2, RoomNum *rooms2, s32 types, u16 geoflags) { bool result; - s16 sp44[20]; - s16 sp34[8]; + RoomNum sp44[20]; + RoomNum sp34[8]; func0f065d1c(coord, rooms, coord2, sp34, sp44, 20); @@ -3602,15 +3602,15 @@ bool cdTestLos05(struct coord *coord, s16 *rooms, struct coord *coord2, s16 *roo return result; } -bool cdTestLos06(struct coord *arg0, s16 *rooms1, struct coord *arg2, s16 *rooms2, u32 types) +bool cdTestLos06(struct coord *arg0, RoomNum *rooms1, struct coord *arg2, RoomNum *rooms2, u32 types) { return cdTestLos05(arg0, rooms1, arg2, rooms2, types, GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT); } -bool cdTestLos07(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, s16 *rooms3, u32 types, u16 geoflags) +bool cdTestLos07(struct coord *pos, RoomNum *rooms, struct coord *pos2, RoomNum *rooms2, RoomNum *rooms3, u32 types, u16 geoflags) { bool result; - s16 sp34[20]; + RoomNum sp34[20]; func0f065d1c(pos, rooms, pos2, rooms3, sp34, 20); @@ -3623,31 +3623,31 @@ bool cdTestLos07(struct coord *pos, s16 *rooms, struct coord *pos2, s16 *rooms2, return result; } -s32 cdExamLos08(struct coord *pos, s16 *rooms, struct coord *pos2, u32 types, u16 geoflags) +s32 cdExamLos08(struct coord *pos, RoomNum *rooms, struct coord *pos2, u32 types, u16 geoflags) { - s16 sp44[21]; - s16 sp34[8]; + RoomNum sp44[21]; + RoomNum sp34[8]; portal00018148(pos, pos2, rooms, sp34, sp44, 20); return cdExamAToB(pos, pos2, sp44, types, geoflags, CHECKVERTICAL_YES, 1, 0, 0); } -s32 cdExamLos09(struct coord *pos, s16 *rooms, struct coord *pos2, u32 types) +s32 cdExamLos09(struct coord *pos, RoomNum *rooms, struct coord *pos2, u32 types) { return cdExamLos08(pos, rooms, pos2, types, GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT); } -s32 cdTestLos10(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types, u16 geoflags) +s32 cdTestLos10(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types, u16 geoflags) { - s16 rooms[21]; + RoomNum rooms[21]; portal00018148(arg0, arg2, arg1, arg3, rooms, 20); return cdTestAToB(arg0, arg2, rooms, types, geoflags, CHECKVERTICAL_YES, 1, 0, 0); } -s32 cdTestLos11(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, u32 types) +s32 cdTestLos11(struct coord *arg0, RoomNum *arg1, struct coord *arg2, RoomNum *arg3, u32 types) { return cdTestLos10(arg0, arg1, arg2, arg3, types, GEOFLAG_WALL | GEOFLAG_BLOCK_SIGHT | GEOFLAG_BLOCK_SHOOT); } @@ -3811,13 +3811,13 @@ s32 cdTestBlockOverlapsGeolist(u8 *start, u8 *end, struct geoblock *block, u16 g * and is also used in a sanity check to make sure a moved object hasn't moved * into the player's position. */ -s32 cdTestBlockOverlapsAnyProp(struct geoblock *geo, s16 *rooms, u32 types) +s32 cdTestBlockOverlapsAnyProp(struct geoblock *geo, RoomNum *rooms, u32 types) { s32 result = CDRESULT_NOCOLLISION; s32 roomnum; u8 *start; u8 *end; - s16 *roomptr; + RoomNum *roomptr; s16 propnums[256]; s16 *propnumptr; @@ -4065,7 +4065,7 @@ bool cd0002ed30(u8 *start, u8 *end, struct geoblock *block, s32 numvertices, str return true; } -bool cd0002f02c(struct geoblock *block, s16 *rooms, s32 types) +bool cd0002f02c(struct geoblock *block, RoomNum *rooms, s32 types) { s32 numvertices = block->header.numvertices; s32 i; @@ -4093,7 +4093,7 @@ bool cd0002f02c(struct geoblock *block, s16 *rooms, s32 types) } if (types & CDTYPE_BG) { - s16 *roomsptr = rooms; + RoomNum *roomsptr = rooms; s32 roomnum = *roomsptr; while (roomnum != -1) { @@ -4232,7 +4232,7 @@ void cd0002f2fc(u32 arg0, u32 arg1) // empty } -bool cdIsNearlyInSightWithFlags(struct coord *viewpos, s16 *rooms, struct coord *targetpos, f32 distance, s32 types, u16 geoflags) +bool cdIsNearlyInSightWithFlags(struct coord *viewpos, RoomNum *rooms, struct coord *targetpos, f32 distance, s32 types, u16 geoflags) { struct coord diff; f32 x; @@ -4271,7 +4271,7 @@ bool cdIsNearlyInSightWithFlags(struct coord *viewpos, s16 *rooms, struct coord return false; } -bool cdIsNearlyInSight(struct coord *viewpos, s16 *rooms, struct coord *targetpos, f32 distance, s32 types) +bool cdIsNearlyInSight(struct coord *viewpos, RoomNum *rooms, struct coord *targetpos, f32 distance, s32 types) { return cdIsNearlyInSightWithFlags(viewpos, rooms, targetpos, distance, types, GEOFLAG_BLOCK_SIGHT); } diff --git a/src/lib/lib_17ce0.c b/src/lib/lib_17ce0.c index 071dd02d9..e319ec44f 100644 --- a/src/lib/lib_17ce0.c +++ b/src/lib/lib_17ce0.c @@ -59,7 +59,7 @@ void portal00018e74nb(s32 portalnum) * The list is assumed to have 16 slots, with the last being reserved for the * -1 terminator. */ -void portal00017dc4(s16 *rooms, s16 roomnum) +void portal00017dc4(RoomNum *rooms, RoomNum roomnum) { s32 i; @@ -169,16 +169,16 @@ s32 portalCalculateIntersection(s32 portalnum, struct coord *pos1, struct coord : PORTALINTERSECTION_FRONTTOBEHIND; } -void portal00018148(struct coord *pos1, struct coord *pos2, s16 *rooms1, s16 *rooms2, s16 *rooms3, s32 arg5) +void portal00018148(struct coord *pos1, struct coord *pos2, RoomNum *rooms1, RoomNum *rooms2, RoomNum *rooms3, s32 arg5) { s32 i; s32 j; s32 roomnum; s32 numportals; s16 *portalnums; - s16 rooms9c[16]; - s16 rooms7c[16]; - s16 rooms5c[16]; + RoomNum rooms9c[16]; + RoomNum rooms7c[16]; + RoomNum rooms5c[16]; for (i = 0; i < 8; i++) { rooms9c[i] = rooms1[i];