diff --git a/ld/gamefiles.jpn-final.inc b/ld/gamefiles.jpn-final.inc index c32c8c1e7..a962b0d64 100644 --- a/ld/gamefiles.jpn-final.inc +++ b/ld/gamefiles.jpn-final.inc @@ -33,6 +33,7 @@ build/ROMID/game/objectivesreset.o (section); \ build/ROMID/game/casingreset.o (section); \ build/ROMID/game/bondgunreset.o (section); \ + build/ROMID/game/modelmgrreset.o (section); \ build/ROMID/game/playerreset.o (section); \ build/ROMID/game/invreset.o (section); \ build/ROMID/game/bondheadreset.o (section); \ @@ -82,6 +83,7 @@ build/ROMID/game/casingtick.o (section); \ build/ROMID/game/shardstick.o (section); \ build/ROMID/game/sparkstick.o (section); \ + build/ROMID/game/proptick.o (section); \ build/ROMID/game/chr.o (section); \ build/ROMID/game/body.o (section); \ build/ROMID/game/chraction.o (section); \ @@ -110,7 +112,7 @@ build/ROMID/game/mpstats.o (section); \ build/ROMID/game/game_0b0fd0.o (section); \ build/ROMID/game/game_0b2150.o (section); \ - build/ROMID/game/game_0b28d0.o (section); \ + build/ROMID/game/modelmgr.o (section); \ build/ROMID/game/texselect.o (section); \ build/ROMID/game/camera.o (section); \ build/ROMID/game/portal.o (section); \ diff --git a/ld/gamefiles.ntsc-beta.inc b/ld/gamefiles.ntsc-beta.inc index 2a72f841c..5dd195310 100644 --- a/ld/gamefiles.ntsc-beta.inc +++ b/ld/gamefiles.ntsc-beta.inc @@ -33,6 +33,7 @@ build/ROMID/game/objectivesreset.o (section); \ build/ROMID/game/casingreset.o (section); \ build/ROMID/game/bondgunreset.o (section); \ + build/ROMID/game/modelmgrreset.o (section); \ build/ROMID/game/playerreset.o (section); \ build/ROMID/game/invreset.o (section); \ build/ROMID/game/bondheadreset.o (section); \ @@ -82,6 +83,7 @@ build/ROMID/game/casingtick.o (section); \ build/ROMID/game/shardstick.o (section); \ build/ROMID/game/sparkstick.o (section); \ + build/ROMID/game/proptick.o (section); \ build/ROMID/game/chr.o (section); \ build/ROMID/game/body.o (section); \ build/ROMID/game/chraction.o (section); \ @@ -110,7 +112,7 @@ build/ROMID/game/mpstats.o (section); \ build/ROMID/game/game_0b0fd0.o (section); \ build/ROMID/game/game_0b2150.o (section); \ - build/ROMID/game/game_0b28d0.o (section); \ + build/ROMID/game/modelmgr.o (section); \ build/ROMID/game/texselect.o (section); \ build/ROMID/game/camera.o (section); \ build/ROMID/game/portal.o (section); \ diff --git a/ld/gamefiles.ntsc-final.inc b/ld/gamefiles.ntsc-final.inc index c32c8c1e7..a962b0d64 100644 --- a/ld/gamefiles.ntsc-final.inc +++ b/ld/gamefiles.ntsc-final.inc @@ -33,6 +33,7 @@ build/ROMID/game/objectivesreset.o (section); \ build/ROMID/game/casingreset.o (section); \ build/ROMID/game/bondgunreset.o (section); \ + build/ROMID/game/modelmgrreset.o (section); \ build/ROMID/game/playerreset.o (section); \ build/ROMID/game/invreset.o (section); \ build/ROMID/game/bondheadreset.o (section); \ @@ -82,6 +83,7 @@ build/ROMID/game/casingtick.o (section); \ build/ROMID/game/shardstick.o (section); \ build/ROMID/game/sparkstick.o (section); \ + build/ROMID/game/proptick.o (section); \ build/ROMID/game/chr.o (section); \ build/ROMID/game/body.o (section); \ build/ROMID/game/chraction.o (section); \ @@ -110,7 +112,7 @@ build/ROMID/game/mpstats.o (section); \ build/ROMID/game/game_0b0fd0.o (section); \ build/ROMID/game/game_0b2150.o (section); \ - build/ROMID/game/game_0b28d0.o (section); \ + build/ROMID/game/modelmgr.o (section); \ build/ROMID/game/texselect.o (section); \ build/ROMID/game/camera.o (section); \ build/ROMID/game/portal.o (section); \ diff --git a/ld/gamefiles.pal-beta.inc b/ld/gamefiles.pal-beta.inc index 2a5535517..5af17c9e9 100644 --- a/ld/gamefiles.pal-beta.inc +++ b/ld/gamefiles.pal-beta.inc @@ -33,6 +33,7 @@ build/ROMID/game/objectivesreset.o (section); \ build/ROMID/game/casingreset.o (section); \ build/ROMID/game/bondgunreset.o (section); \ + build/ROMID/game/modelmgrreset.o (section); \ build/ROMID/game/playerreset.o (section); \ build/ROMID/game/invreset.o (section); \ build/ROMID/game/bondheadreset.o (section); \ @@ -82,6 +83,7 @@ build/ROMID/game/casingtick.o (section); \ build/ROMID/game/shardstick.o (section); \ build/ROMID/game/sparkstick.o (section); \ + build/ROMID/game/proptick.o (section); \ build/ROMID/game/chr.o (section); \ build/ROMID/game/body.o (section); \ build/ROMID/game/chraction.o (section); \ @@ -110,7 +112,7 @@ build/ROMID/game/mpstats.o (section); \ build/ROMID/game/game_0b0fd0.o (section); \ build/ROMID/game/game_0b2150.o (section); \ - build/ROMID/game/game_0b28d0.o (section); \ + build/ROMID/game/modelmgr.o (section); \ build/ROMID/game/texselect.o (section); \ build/ROMID/game/camera.o (section); \ build/ROMID/game/portal.o (section); \ diff --git a/ld/gamefiles.pal-final.inc b/ld/gamefiles.pal-final.inc index c32c8c1e7..a962b0d64 100644 --- a/ld/gamefiles.pal-final.inc +++ b/ld/gamefiles.pal-final.inc @@ -33,6 +33,7 @@ build/ROMID/game/objectivesreset.o (section); \ build/ROMID/game/casingreset.o (section); \ build/ROMID/game/bondgunreset.o (section); \ + build/ROMID/game/modelmgrreset.o (section); \ build/ROMID/game/playerreset.o (section); \ build/ROMID/game/invreset.o (section); \ build/ROMID/game/bondheadreset.o (section); \ @@ -82,6 +83,7 @@ build/ROMID/game/casingtick.o (section); \ build/ROMID/game/shardstick.o (section); \ build/ROMID/game/sparkstick.o (section); \ + build/ROMID/game/proptick.o (section); \ build/ROMID/game/chr.o (section); \ build/ROMID/game/body.o (section); \ build/ROMID/game/chraction.o (section); \ @@ -110,7 +112,7 @@ build/ROMID/game/mpstats.o (section); \ build/ROMID/game/game_0b0fd0.o (section); \ build/ROMID/game/game_0b2150.o (section); \ - build/ROMID/game/game_0b28d0.o (section); \ + build/ROMID/game/modelmgr.o (section); \ build/ROMID/game/texselect.o (section); \ build/ROMID/game/camera.o (section); \ build/ROMID/game/portal.o (section); \ diff --git a/src/game/body.c b/src/game/body.c index 196766623..6c0ff6ecb 100644 --- a/src/game/body.c +++ b/src/game/body.c @@ -6,7 +6,7 @@ #include "game/body.h" #include "game/prop.h" #include "game/atan2f.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/lv.h" #include "game/modeldef.h" #include "game/mplayer/mplayer.h" diff --git a/src/game/bondgun.c b/src/game/bondgun.c index fa9e50596..5ab7c247c 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -16,7 +16,7 @@ #include "game/bondgun.h" #include "game/gunfx.h" #include "game/game_0b0fd0.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/tex.h" #include "game/camera.h" #include "game/player.h" diff --git a/src/game/chr.c b/src/game/chr.c index 88d4f0ff9..01e9e9b04 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -13,7 +13,7 @@ #include "game/bondgun.h" #include "game/gunfx.h" #include "game/game_0b0fd0.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/tex.h" #include "game/camera.h" #include "game/player.h" @@ -67,66 +67,6 @@ struct chrdata *g_ChrSlots = NULL; s32 g_NumChrSlots = 0; -void propsTick(void) -{ - s32 i; - struct prop *prop; - struct prop *next; - struct prop *next2; - s32 done; - s32 tickop; - - for (i = 0; i < PLAYERCOUNT(); i++) { - g_Vars.players[i]->bondextrapos.x = 0; - g_Vars.players[i]->bondextrapos.y = 0; - g_Vars.players[i]->bondextrapos.z = 0; - } - - shieldhitsTick(); - chraTickBg(); - - prop = g_Vars.activeprops; - - do { - next = prop->next; - done = next == g_Vars.pausedprops; - tickop = TICKOP_NONE; - - if (prop->type == PROPTYPE_CHR) { - tickop = chrTickBeams(prop); - } else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) { - tickop = objTick(prop); - } else if (prop->type == PROPTYPE_EXPLOSION) { - tickop = explosionTick(prop); - } else if (prop->type == PROPTYPE_SMOKE) { - tickop = smokeTick(prop); - } else if (prop->type == PROPTYPE_PLAYER) { - tickop = playerTickBeams(prop); - } - - if (tickop == TICKOP_5) { - next2 = next; - } else { - next2 = prop->next; - done = next2 == g_Vars.pausedprops; - - if (tickop == TICKOP_RETICK) { - propDelist(prop); - propActivateThisFrame(prop); - - if (done) { - next2 = prop; - done = false; - } - } else { - propExecuteTickOperation(prop, tickop); - } - } - - prop = next2; - } while (!done); -} - s32 chrsGetNumSlots(void) { return g_NumChrSlots; diff --git a/src/game/chraction.c b/src/game/chraction.c index 015df37f9..3aa1a3984 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -17,7 +17,7 @@ #include "game/bondgun.h" #include "game/gunfx.h" #include "game/game_0b0fd0.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/tex.h" #include "game/camera.h" #include "game/player.h" diff --git a/src/game/chraicommands.c b/src/game/chraicommands.c index 9b5c1cf7b..8fbb32f96 100644 --- a/src/game/chraicommands.c +++ b/src/game/chraicommands.c @@ -18,7 +18,7 @@ #include "game/atan2f.h" #include "game/bondgun.h" #include "game/game_0b0fd0.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/player.h" #include "game/hudmsg.h" #include "game/inv.h" diff --git a/src/game/lv.c b/src/game/lv.c index 120bda57e..11d442b7a 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -23,7 +23,7 @@ #include "game/game_00b820.h" #include "game/gunfx.h" #include "game/game_0b0fd0.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/portal.h" #include "game/fmb.h" #include "game/sky.h" diff --git a/src/game/game_0b28d0.c b/src/game/modelmgr.c similarity index 99% rename from src/game/game_0b28d0.c rename to src/game/modelmgr.c index b90a59acd..d701ff3ee 100644 --- a/src/game/game_0b28d0.c +++ b/src/game/modelmgr.c @@ -1,6 +1,6 @@ #include #include "constants.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "bss.h" #include "lib/memp.h" #include "lib/model.h" diff --git a/src/game/modelmgrreset.c b/src/game/modelmgrreset.c new file mode 100644 index 000000000..b35585dcf --- /dev/null +++ b/src/game/modelmgrreset.c @@ -0,0 +1,186 @@ +#include +#include "constants.h" +#include "constants.h" +#include "game/bondmove.h" +#include "game/cheats.h" +#include "game/inv.h" +#include "game/playerreset.h" +#include "game/chr.h" +#include "game/body.h" +#include "game/prop.h" +#include "game/setuputils.h" +#include "game/bondgun.h" +#include "game/player.h" +#include "game/inv.h" +#include "game/stagetable.h" +#include "game/mplayer/scenarios.h" +#include "game/mplayer/mplayer.h" +#include "game/pad.h" +#include "bss.h" +#include "lib/collision.h" +#include "lib/memp.h" +#include "lib/mtx.h" +#include "lib/anim.h" +#include "data.h" +#include "types.h" + +#define NUMTYPE1() (IS4MB() ? 0 : 35) +#define NUMTYPE2() (IS4MB() ? 24 : 25) +#define NUMTYPE3() (IS4MB() ? 0 : 20) +#define NUMSPARE() (IS4MB() ? 40 : 60) + +void modelmgrReset(void) +{ + g_MaxAnims = 0; + g_MaxModels = 0; +} + +void modelmgrSetLvResetting(bool value) +{ + g_ModelIsLvResetting = value; +} + +/** + * Allocate slots for model instances and animations. + * + * Each model instance can require rwdata: a block of bytes where it can save + * information specific to its own instance. + * + * The rwdata slots are split into 3 types. Types 1 and 2 use different slot + * sizes, while type 3 has no allocated slots at all. When models are + * instantiated they require a certain amount of rwdata, and are bound to type 1 + * if possible, otherwise type 2 if possible. If neither of those are possible + * then it allocates rwdata on the fly and puts it in type 3. + * + * The function allocates more than what is specified in the arguments. + * If the expansion pak is being used, 60 spare model slots are allocated + * (eg. for thrown weapons), and a further 20 model and 20 anim slots are + * allocated for animated objects. + */ +void modelmgrAllocateSlots(s32 numobjs, s32 numchrs) +{ + s32 rwdata2sizetotal; + s32 rwdata1sizetotal; + s32 rwdata3sizetotal; + s32 bindingssize; + u8 *ptr; + s32 i; + s32 totalsize; + s32 modelssize; + s32 animssize; + s32 rwdata1sizeeach = 0x10; + s32 rwdata2sizeeach = 0xd0; + s32 rwdata3sizeeach = 0; + s32 maxanimatedobjs = 20; + s32 numspare; + + g_ModelNumObjs = numobjs; + g_ModelNumChrs = numchrs; + + numspare = NUMSPARE(); + g_MaxModels = numobjs + numspare + numchrs + maxanimatedobjs; + g_MaxAnims = numchrs + maxanimatedobjs; + + i = NUMTYPE2(); + bindingssize = (NUMTYPE1() + i + NUMTYPE3()) * sizeof(struct modelrwdatabinding); + + rwdata1sizetotal = NUMTYPE1() * rwdata1sizeeach; + rwdata2sizetotal = NUMTYPE2() * rwdata2sizeeach; + rwdata3sizetotal = NUMTYPE3() * rwdata3sizeeach; + + modelssize = ALIGN16(g_MaxModels * sizeof(struct model)); + animssize = ALIGN16(g_MaxAnims * sizeof(struct anim)); + + totalsize = ALIGN16(bindingssize + rwdata1sizetotal + rwdata2sizetotal + rwdata3sizetotal + modelssize + animssize); + + g_ModelRwdataBindings[0] = NULL; + g_ModelRwdataBindings[1] = NULL; + g_ModelRwdataBindings[2] = NULL; + + ptr = mempAlloc(totalsize, MEMPOOL_STAGE); + + if (NUMTYPE1()) { + g_ModelRwdataBindings[0] = (struct modelrwdatabinding *) ptr; + ptr += NUMTYPE1() * 8; + } + + if (NUMTYPE2()) { + g_ModelRwdataBindings[1] = (struct modelrwdatabinding *) ptr; + ptr += NUMTYPE2() * 8; + } + + if (NUMTYPE3()) { + g_ModelRwdataBindings[2] = (struct modelrwdatabinding *) ptr; + ptr += NUMTYPE3() * 8; + } + + g_ModelSlots = (struct model *) ptr; + ptr += modelssize; + g_AnimSlots = (struct anim *) ptr; + ptr += animssize; + + for (i = 0; i < NUMTYPE1(); i++) { + g_ModelRwdataBindings[0][i].rwdata = ptr; + g_ModelRwdataBindings[0][i].model = NULL; + + ptr += rwdata1sizeeach; + } + + for (i = 0; i < NUMTYPE2(); i++) { + g_ModelRwdataBindings[1][i].rwdata = ptr; + g_ModelRwdataBindings[1][i].model = NULL; + + ptr += rwdata2sizeeach; + } + + for (i = 0; i < NUMTYPE3(); i++) { + g_ModelRwdataBindings[2][i].rwdata = NULL; + g_ModelRwdataBindings[2][i].model = NULL; + + ptr += rwdata3sizeeach; + } + + for (i = 0; i < g_MaxModels; i++) { + g_ModelSlots[i].filedata = NULL; + g_ModelSlots[i].rwdatas = NULL; + } + + for (i = 0; i < g_MaxAnims; i++) { + g_AnimSlots[i].animnum = -1; + } + + g_ModelMostType1 = 0; + g_ModelMostType2 = 0; + g_ModelMostType3 = 0; + g_ModelMostModels = 0; + g_ModelMostAnims = 0; +} + +bool modelmgrLoadProjectileModeldefs(s32 weaponnum) +{ + bool result = false; + struct weapon *weapon = g_Weapons[weaponnum]; + s32 i; + + for (i = 0; i != 2; i++) { + if (weapon->functions[i]) { + struct weaponfunc *genericfunc = weapon->functions[i]; + + if (genericfunc->type == INVENTORYFUNCTYPE_SHOOT_PROJECTILE) { + struct weaponfunc_shootprojectile *func = (struct weaponfunc_shootprojectile *)genericfunc; + + if (func->projectilemodelnum >= 0) { + result |= setupLoadModeldef(func->projectilemodelnum); + } + } else if (genericfunc->type == INVENTORYFUNCTYPE_THROW) { + struct weaponfunc_throw *func = (struct weaponfunc_throw *)genericfunc; + + if (func->projectilemodelnum >= 0) { + result |= setupLoadModeldef(func->projectilemodelnum); + } + } + } + } + + return result; +} diff --git a/src/game/playerreset.c b/src/game/playerreset.c index dba7a22ff..07470e57d 100644 --- a/src/game/playerreset.c +++ b/src/game/playerreset.c @@ -24,167 +24,6 @@ #include "data.h" #include "types.h" -#define NUMTYPE1() (IS4MB() ? 0 : 35) -#define NUMTYPE2() (IS4MB() ? 24 : 25) -#define NUMTYPE3() (IS4MB() ? 0 : 20) -#define NUMSPARE() (IS4MB() ? 40 : 60) - -void modelmgrReset(void) -{ - g_MaxAnims = 0; - g_MaxModels = 0; -} - -void modelmgrSetLvResetting(bool value) -{ - g_ModelIsLvResetting = value; -} - -/** - * Allocate slots for model instances and animations. - * - * Each model instance can require rwdata: a block of bytes where it can save - * information specific to its own instance. - * - * The rwdata slots are split into 3 types. Types 1 and 2 use different slot - * sizes, while type 3 has no allocated slots at all. When models are - * instantiated they require a certain amount of rwdata, and are bound to type 1 - * if possible, otherwise type 2 if possible. If neither of those are possible - * then it allocates rwdata on the fly and puts it in type 3. - * - * The function allocates more than what is specified in the arguments. - * If the expansion pak is being used, 60 spare model slots are allocated - * (eg. for thrown weapons), and a further 20 model and 20 anim slots are - * allocated for animated objects. - */ -void modelmgrAllocateSlots(s32 numobjs, s32 numchrs) -{ - s32 rwdata2sizetotal; - s32 rwdata1sizetotal; - s32 rwdata3sizetotal; - s32 bindingssize; - u8 *ptr; - s32 i; - s32 totalsize; - s32 modelssize; - s32 animssize; - s32 rwdata1sizeeach = 0x10; - s32 rwdata2sizeeach = 0xd0; - s32 rwdata3sizeeach = 0; - s32 maxanimatedobjs = 20; - s32 numspare; - - g_ModelNumObjs = numobjs; - g_ModelNumChrs = numchrs; - - numspare = NUMSPARE(); - g_MaxModels = numobjs + numspare + numchrs + maxanimatedobjs; - g_MaxAnims = numchrs + maxanimatedobjs; - - i = NUMTYPE2(); - bindingssize = (NUMTYPE1() + i + NUMTYPE3()) * sizeof(struct modelrwdatabinding); - - rwdata1sizetotal = NUMTYPE1() * rwdata1sizeeach; - rwdata2sizetotal = NUMTYPE2() * rwdata2sizeeach; - rwdata3sizetotal = NUMTYPE3() * rwdata3sizeeach; - - modelssize = ALIGN16(g_MaxModels * sizeof(struct model)); - animssize = ALIGN16(g_MaxAnims * sizeof(struct anim)); - - totalsize = ALIGN16(bindingssize + rwdata1sizetotal + rwdata2sizetotal + rwdata3sizetotal + modelssize + animssize); - - g_ModelRwdataBindings[0] = NULL; - g_ModelRwdataBindings[1] = NULL; - g_ModelRwdataBindings[2] = NULL; - - ptr = mempAlloc(totalsize, MEMPOOL_STAGE); - - if (NUMTYPE1()) { - g_ModelRwdataBindings[0] = (struct modelrwdatabinding *) ptr; - ptr += NUMTYPE1() * 8; - } - - if (NUMTYPE2()) { - g_ModelRwdataBindings[1] = (struct modelrwdatabinding *) ptr; - ptr += NUMTYPE2() * 8; - } - - if (NUMTYPE3()) { - g_ModelRwdataBindings[2] = (struct modelrwdatabinding *) ptr; - ptr += NUMTYPE3() * 8; - } - - g_ModelSlots = (struct model *) ptr; - ptr += modelssize; - g_AnimSlots = (struct anim *) ptr; - ptr += animssize; - - for (i = 0; i < NUMTYPE1(); i++) { - g_ModelRwdataBindings[0][i].rwdata = ptr; - g_ModelRwdataBindings[0][i].model = NULL; - - ptr += rwdata1sizeeach; - } - - for (i = 0; i < NUMTYPE2(); i++) { - g_ModelRwdataBindings[1][i].rwdata = ptr; - g_ModelRwdataBindings[1][i].model = NULL; - - ptr += rwdata2sizeeach; - } - - for (i = 0; i < NUMTYPE3(); i++) { - g_ModelRwdataBindings[2][i].rwdata = NULL; - g_ModelRwdataBindings[2][i].model = NULL; - - ptr += rwdata3sizeeach; - } - - for (i = 0; i < g_MaxModels; i++) { - g_ModelSlots[i].filedata = NULL; - g_ModelSlots[i].rwdatas = NULL; - } - - for (i = 0; i < g_MaxAnims; i++) { - g_AnimSlots[i].animnum = -1; - } - - g_ModelMostType1 = 0; - g_ModelMostType2 = 0; - g_ModelMostType3 = 0; - g_ModelMostModels = 0; - g_ModelMostAnims = 0; -} - -bool modelmgrLoadProjectileModeldefs(s32 weaponnum) -{ - bool result = false; - struct weapon *weapon = g_Weapons[weaponnum]; - s32 i; - - for (i = 0; i != 2; i++) { - if (weapon->functions[i]) { - struct weaponfunc *genericfunc = weapon->functions[i]; - - if (genericfunc->type == INVENTORYFUNCTYPE_SHOOT_PROJECTILE) { - struct weaponfunc_shootprojectile *func = (struct weaponfunc_shootprojectile *)genericfunc; - - if (func->projectilemodelnum >= 0) { - result |= setupLoadModeldef(func->projectilemodelnum); - } - } else if (genericfunc->type == INVENTORYFUNCTYPE_THROW) { - struct weaponfunc_throw *func = (struct weaponfunc_throw *)genericfunc; - - if (func->projectilemodelnum >= 0) { - result |= setupLoadModeldef(func->projectilemodelnum); - } - } - } - } - - return result; -} - void playerInitEyespy(void) { struct prop *prop; diff --git a/src/game/propobj.c b/src/game/propobj.c index b56450285..8b5246fea 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -23,7 +23,7 @@ #include "game/bondgun.h" #include "game/gunfx.h" #include "game/game_0b0fd0.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/tex.h" #include "game/camera.h" #include "game/portal.h" diff --git a/src/game/proptick.c b/src/game/proptick.c new file mode 100644 index 000000000..701efc2e3 --- /dev/null +++ b/src/game/proptick.c @@ -0,0 +1,107 @@ +#include +#include "lib/sched.h" +#include "constants.h" +#include "game/bondmove.h" +#include "game/cheats.h" +#include "game/chraction.h" +#include "game/debug.h" +#include "game/chr.h" +#include "game/prop.h" +#include "game/propsnd.h" +#include "game/objectives.h" +#include "game/game_096360.h" +#include "game/bondgun.h" +#include "game/gunfx.h" +#include "game/game_0b0fd0.h" +#include "game/modelmgr.h" +#include "game/tex.h" +#include "game/camera.h" +#include "game/player.h" +#include "game/game_0c33f0.h" +#include "game/playermgr.h" +#include "game/game_1291b0.h" +#include "game/vtxstore.h" +#include "game/gfxmemory.h" +#include "game/explosions.h" +#include "game/smoke.h" +#include "game/sparks.h" +#include "game/bg.h" +#include "game/file.h" +#include "game/mplayer/setup.h" +#include "game/bot.h" +#include "game/botact.h" +#include "game/mplayer/mplayer.h" +#include "game/pad.h" +#include "game/propobj.h" +#include "game/splat.h" +#include "game/wallhit.h" +#include "bss.h" +#include "lib/vi.h" +#include "lib/main.h" +#include "lib/model.h" +#include "lib/rng.h" +#include "lib/mtx.h" +#include "lib/anim.h" +#include "lib/collision.h" +#include "data.h" +#include "types.h" + +void propsTick(void) +{ + s32 i; + struct prop *prop; + struct prop *next; + struct prop *next2; + s32 done; + s32 tickop; + + for (i = 0; i < PLAYERCOUNT(); i++) { + g_Vars.players[i]->bondextrapos.x = 0; + g_Vars.players[i]->bondextrapos.y = 0; + g_Vars.players[i]->bondextrapos.z = 0; + } + + shieldhitsTick(); + chraTickBg(); + + prop = g_Vars.activeprops; + + do { + next = prop->next; + done = next == g_Vars.pausedprops; + tickop = TICKOP_NONE; + + if (prop->type == PROPTYPE_CHR) { + tickop = chrTickBeams(prop); + } else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) { + tickop = objTick(prop); + } else if (prop->type == PROPTYPE_EXPLOSION) { + tickop = explosionTick(prop); + } else if (prop->type == PROPTYPE_SMOKE) { + tickop = smokeTick(prop); + } else if (prop->type == PROPTYPE_PLAYER) { + tickop = playerTickBeams(prop); + } + + if (tickop == TICKOP_5) { + next2 = next; + } else { + next2 = prop->next; + done = next2 == g_Vars.pausedprops; + + if (tickop == TICKOP_RETICK) { + propDelist(prop); + propActivateThisFrame(prop); + + if (done) { + next2 = prop; + done = false; + } + } else { + propExecuteTickOperation(prop, tickop); + } + } + + prop = next2; + } while (!done); +} diff --git a/src/game/setuputils.c b/src/game/setuputils.c index e2e36e7f9..f24b269d6 100644 --- a/src/game/setuputils.c +++ b/src/game/setuputils.c @@ -2,7 +2,7 @@ #include "constants.h" #include "game/prop.h" #include "game/setuputils.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/bg.h" #include "game/modeldef.h" #include "game/propobj.h" diff --git a/src/game/title.c b/src/game/title.c index 3183033bc..1e8669c05 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -2,7 +2,7 @@ #include "constants.h" #include "game/title.h" #include "game/bondgun.h" -#include "game/game_0b28d0.h" +#include "game/modelmgr.h" #include "game/tex.h" #include "game/inv.h" #include "game/playermgr.h" diff --git a/src/include/game/chr.h b/src/include/game/chr.h index 94c5e0c90..ae9d8d1d4 100644 --- a/src/include/game/chr.h +++ b/src/include/game/chr.h @@ -4,7 +4,6 @@ #include "data.h" #include "types.h" -void propsTick(void); void chrSetChrnum(struct chrdata *chr, s16 chrnum); void chrDeregister(s32 chrnum); void chrCalculatePushPos(struct chrdata *chr, struct coord *pos, s16 *rooms, bool arg3); diff --git a/src/include/game/game_0b28d0.h b/src/include/game/modelmgr.h similarity index 91% rename from src/include/game/game_0b28d0.h rename to src/include/game/modelmgr.h index 0cf8f0a92..44496b4d2 100644 --- a/src/include/game/game_0b28d0.h +++ b/src/include/game/modelmgr.h @@ -1,5 +1,5 @@ -#ifndef IN_GAME_GAME_0B28D0_H -#define IN_GAME_GAME_0B28D0_H +#ifndef IN_GAME_MODELMGR_H +#define IN_GAME_MODELMGR_H #include #include "data.h" #include "types.h" diff --git a/src/include/game/prop.h b/src/include/game/prop.h index eafd468b2..fdd440492 100644 --- a/src/include/game/prop.h +++ b/src/include/game/prop.h @@ -6,6 +6,8 @@ extern f32 g_AutoAimScale; +void propsTick(void); + void propsSort(void); void propEnable(struct prop *prop); void propDisable(struct prop *prop);