diff --git a/ld/gamefiles.ntsc-beta.inc b/ld/gamefiles.ntsc-beta.inc index 1f236c5e2..b969527b0 100644 --- a/ld/gamefiles.ntsc-beta.inc +++ b/ld/gamefiles.ntsc-beta.inc @@ -157,7 +157,7 @@ build/ROMID/game/modeldata/skedar.o (section); \ build/ROMID/game/modeldata/robot.o (section); \ build/ROMID/game/game_11f000.o (section); \ - build/ROMID/game/game_127910.o (section); \ + build/ROMID/game/playermgr.o (section); \ build/ROMID/game/crc.o (section); \ build/ROMID/game/rng2.o (section); \ build/ROMID/game/game_129210.o (section); \ diff --git a/ld/gamefiles.ntsc-final.inc b/ld/gamefiles.ntsc-final.inc index e9f7cc28a..af28f9b0f 100644 --- a/ld/gamefiles.ntsc-final.inc +++ b/ld/gamefiles.ntsc-final.inc @@ -156,7 +156,7 @@ build/ROMID/game/modeldata/skedar.o (section); \ build/ROMID/game/modeldata/robot.o (section); \ build/ROMID/game/game_11f000.o (section); \ - build/ROMID/game/game_127910.o (section); \ + build/ROMID/game/playermgr.o (section); \ build/ROMID/game/crc.o (section); \ build/ROMID/game/rng2.o (section); \ build/ROMID/game/game_129210.o (section); \ diff --git a/ld/gamefiles.pal-final.inc b/ld/gamefiles.pal-final.inc index e9f7cc28a..af28f9b0f 100644 --- a/ld/gamefiles.pal-final.inc +++ b/ld/gamefiles.pal-final.inc @@ -156,7 +156,7 @@ build/ROMID/game/modeldata/skedar.o (section); \ build/ROMID/game/modeldata/robot.o (section); \ build/ROMID/game/game_11f000.o (section); \ - build/ROMID/game/game_127910.o (section); \ + build/ROMID/game/playermgr.o (section); \ build/ROMID/game/crc.o (section); \ build/ROMID/game/rng2.o (section); \ build/ROMID/game/game_129210.o (section); \ diff --git a/src/game/activemenu/tick.c b/src/game/activemenu/tick.c index 9373cfa04..91d61ea36 100644 --- a/src/game/activemenu/tick.c +++ b/src/game/activemenu/tick.c @@ -5,7 +5,7 @@ #include "game/bondgun.h" #include "game/game_0b0fd0.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/options.h" #include "bss.h" #include "lib/joy.h" diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index dc17232f8..2b797491f 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -10,7 +10,7 @@ #include "game/hudmsg.h" #include "game/inventory/inventory.h" #include "game/mplayer/ingame.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1655c0.h" #include "game/lang.h" #include "game/options.h" @@ -191,7 +191,7 @@ s32 eyespyCalculateNewPosition(struct coord *vel) if (prop && prop->type == PROPTYPE_PLAYER) { playernum = g_Vars.currentplayernum; - if (playernum == propGetPlayerNum(prop)) { + if (playernum == playermgrGetPlayerNumByProp(prop)) { g_EyespyPickup = true; } } diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 2ee8d779e..bd43be460 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -24,7 +24,7 @@ #include "game/gfxmemory.h" #include "game/sight.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/smoke/smoke.h" #include "game/game_1531a0.h" #include "game/file.h" @@ -3392,7 +3392,7 @@ s32 bgunTickIncAutoSwitch(struct handweaponinfo *info, s32 handnum, struct hand if (bgunIsReadyToSwitch(handnum) && bgunSetState(handnum, HANDSTATE_CHANGEGUN)) { if (g_Vars.mplayerisrunning && (IS8MB() || PLAYERCOUNT() != 1)) { - currentPlayerSetWeaponReapable(handnum); + playermgrDeleteWeapon(handnum); } bgun0f09fa20(handnum); @@ -8045,7 +8045,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand * if (hand->stateframes >= delay) { if (!somebool) { if (g_Vars.mplayerisrunning && (IS8MB() || PLAYERCOUNT() != 1)) { - currentPlayerSetWeaponReapable(handnum); + playermgrDeleteWeapon(handnum); } bgun0f09fa20(handnum); @@ -8114,7 +8114,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand * if (hand->count == 0) { if (g_Vars.mplayerisrunning && (IS8MB() || PLAYERCOUNT() != 1)) { - func0f128d20(handnum); + playermgrCreateWeapon(handnum); } bgun0f098f8c(info, hand); @@ -10860,7 +10860,7 @@ struct defaultobj *bgun0f09ee18(struct chrdata *chr, struct gset *gset, struct c if (g_Vars.normmplayerisrunning) { playernum = mpPlayerGetIndex(chr); } else { - playernum = propGetPlayerNum(chr->prop); + playernum = playermgrGetPlayerNumByProp(chr->prop); } obj->hidden |= playernum << 28; @@ -15271,7 +15271,7 @@ void bgun0f0a134c(s32 handnum) } if (g_Vars.mplayerisrunning && (IS8MB() || PLAYERCOUNT() != 1)) { - currentPlayerSetWeaponReapable(handnum); + playermgrDeleteWeapon(handnum); } bgun0f09fa20(handnum); @@ -16639,11 +16639,11 @@ void bgunLoseGun(struct prop *attackerprop) } } - chrSetWeaponReapable(chr, HAND_RIGHT); - chrSetWeaponReapable(chr, HAND_LEFT); + weaponDeleteFromChr(chr, HAND_RIGHT); + weaponDeleteFromChr(chr, HAND_LEFT); // Actually drop the weapon - modelnum = weaponGetModel(weaponnum); + modelnum = playermgrGetModelOfWeapon(weaponnum); if (modelnum >= 0 && drop) { struct prop *prop2 = weaponCreateForChr(chr, modelnum, weaponnum, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL); diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 1a6ef03f0..e2c658b64 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -18,7 +18,7 @@ #include "game/player.h" #include "game/bondcutscene.h" #include "game/bondhead.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/bg.h" #include "game/lv.h" #include "game/mplayer/ingame.h" @@ -1807,8 +1807,8 @@ void bmove0f0cb79c(struct player *player, struct coord *mid, s16 *rooms) { struct coord lower; struct coord upper; - f32 eyeheight = g_Vars.players[propGetPlayerNum(player->prop)]->vv_eyeheight; - f32 headheight = g_Vars.players[propGetPlayerNum(player->prop)]->vv_headheight; + f32 eyeheight = g_Vars.players[playermgrGetPlayerNumByProp(player->prop)]->vv_eyeheight; + f32 headheight = g_Vars.players[playermgrGetPlayerNumByProp(player->prop)]->vv_headheight; lower.x = mid->x - 50; lower.y = mid->y - player->crouchheight - eyeheight - 10; diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 7114fa214..8bbd87df1 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -14,7 +14,7 @@ #include "game/player.h" #include "game/inventory/inventory.h" #include "game/bondhead.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/propobj.h" #include "bss.h" #include "lib/snd.h" @@ -2495,7 +2495,7 @@ void bwalkUpdateVertical(void) } else if (prop->type == PROPTYPE_PLAYER) { // Landed on top of a player u32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(prop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(prop)); if (g_Vars.currentplayer->inlift) { playerDieByShooter(prevplayernum, true); diff --git a/src/game/bot.c b/src/game/bot.c index 4b917a522..b665a9263 100644 --- a/src/game/bot.c +++ b/src/game/bot.c @@ -9,7 +9,7 @@ #include "game/bondgun.h" #include "game/game_0b0fd0.h" #include "game/player.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/bg.h" #include "game/mplayer/setup.h" #include "game/mplayer/scenarios.h" @@ -2615,7 +2615,7 @@ s32 botGetWeaponNum(struct chrdata *chr) return chr->aibot->weaponnum; } - return g_Vars.players[propGetPlayerNum(chr->prop)]->hands[HAND_RIGHT].gset.weaponnum; + return g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)]->hands[HAND_RIGHT].gset.weaponnum; } u8 botGetTargetsWeaponNum(struct chrdata *chr) @@ -4130,7 +4130,7 @@ void botLoseGun(struct chrdata *chr, struct prop *attackerprop) weaponSetGunfireVisible(prop, false, -1); chr->weapons_held[HAND_RIGHT] = NULL; } else { - s32 modelnum = weaponGetModel(chr->aibot->weaponnum); + s32 modelnum = playermgrGetModelOfWeapon(chr->aibot->weaponnum); if (modelnum >= 0) { prop = weaponCreateForChr(chr, modelnum, chr->aibot->weaponnum, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL); @@ -7550,7 +7550,7 @@ glabel var7f1b8fc8 /* f195de0: 0fc6637c */ jal botinvGetItem /* f195de4: 8e450020 */ lw $a1,0x20($s2) /* f195de8: 00408025 */ move $s0,$v0 -/* f195dec: 0fc4a571 */ jal weaponGetModel +/* f195dec: 0fc4a571 */ jal playermgrGetModelOfWeapon /* f195df0: 8e440020 */ lw $a0,0x20($s2) /* f195df4: 12000019 */ beqz $s0,.PF0f195e5c /* f195df8: 00408825 */ move $s1,$v0 @@ -9058,7 +9058,7 @@ glabel var7f1b8fc8 /* f197380: 1000000b */ b .PF0f1973b0 /* f197384: 46049001 */ sub.s $f0,$f18,$f4 .PF0f197388: -/* f197388: 0fc4a513 */ jal propGetPlayerNum +/* f197388: 0fc4a513 */ jal playermgrGetPlayerNumByProp /* f19738c: 8ca4001c */ lw $a0,0x1c($a1) /* f197390: 00027080 */ sll $t6,$v0,0x2 /* f197394: 02ce6021 */ addu $t4,$s6,$t6 @@ -10431,7 +10431,7 @@ void botTickUnpaused(struct chrdata *chr) if (aibot->changeguntimer60 <= 0) { struct invitem *item = botinvGetItem(chr, aibot->weaponnum); - s32 modelnum = weaponGetModel(aibot->weaponnum); + s32 modelnum = playermgrGetModelOfWeapon(aibot->weaponnum); s32 i; if (item && modelnum >= 0) { @@ -11038,7 +11038,7 @@ void botTickUnpaused(struct chrdata *chr) if (otherchr->aibot) { health = otherchr->maxdamage - otherchr->damage; } else { - health = g_Vars.players[propGetPlayerNum(otherchr->prop)]->bondhealth * 8; + health = g_Vars.players[playermgrGetPlayerNumByProp(otherchr->prop)]->bondhealth * 8; } if (weakestplayernum < 0 || health < minhealth) { diff --git a/src/game/botact.c b/src/game/botact.c index 01621866e..e57ad8b7e 100644 --- a/src/game/botact.c +++ b/src/game/botact.c @@ -6,7 +6,7 @@ #include "game/game_092610.h" #include "game/bondgun.h" #include "game/game_0b0fd0.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/botact.h" #include "game/pad.h" #include "game/padhalllv.h" @@ -241,7 +241,7 @@ bool botactShootFarsight(struct chrdata *chr, s32 arg1, struct coord *vector, st oppprop = g_MpAllChrPtrs[i]->prop; if (oppprop->type == PROPTYPE_PLAYER) { - struct player *player = g_Vars.players[propGetPlayerNum(oppprop)]; + struct player *player = g_Vars.players[playermgrGetPlayerNumByProp(oppprop)]; speed = player->speedforwards * player->speedforwards + player->speedsideways * player->speedsideways; @@ -282,7 +282,7 @@ bool botactShootFarsight(struct chrdata *chr, s32 arg1, struct coord *vector, st s32 botactGetWeaponModel(s32 weapon) { - return weaponGetModel(weapon); + return playermgrGetModelOfWeapon(weapon); } bool botactIsWeaponThrowable(s32 weaponnum, bool is_secondary) diff --git a/src/game/botcmd.c b/src/game/botcmd.c index ba2a679cc..768e093e0 100644 --- a/src/game/botcmd.c +++ b/src/game/botcmd.c @@ -5,7 +5,7 @@ #include "game/chr/chr.h" #include "game/ceil.h" #include "game/game_0b0fd0.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/mplayer/setup.h" #include "game/bot.h" #include "game/botcmd.h" diff --git a/src/game/botinv.c b/src/game/botinv.c index 8cd6d8caa..573682f76 100644 --- a/src/game/botinv.c +++ b/src/game/botinv.c @@ -5,7 +5,7 @@ #include "game/chr/chr.h" #include "game/ceil.h" #include "game/game_0b0fd0.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/mplayer/setup.h" #include "game/bot.h" #include "game/botact.h" @@ -1082,10 +1082,10 @@ bool botinvSwitchToWeapon(struct chrdata *chr, s32 weaponnum, s32 funcnum) } if (!changinggun) { - modelnum = weaponGetModel(weaponnum); + modelnum = playermgrGetModelOfWeapon(weaponnum); // @dangerous: item is uninitialised if weaponnum is WEAPON_UNARMED. - // This function assumes weaponGetModel returns a negative value for + // This function assumes playermgrGetModelOfWeapon returns a negative value for // WEAPON_UNARMED which is a dangerous assumption to make, but correct. if (modelnum >= 0 && item && item->type == INVITEMTYPE_DUAL && chr->weapons_held[HAND_LEFT] == NULL) { chrGiveWeapon(chr, modelnum, weaponnum, OBJFLAG_WEAPON_LEFTHANDED); @@ -1133,7 +1133,7 @@ void botinvDrop(struct chrdata *chr, s32 weaponnum, u8 dropall) || (g_Vars.normmplayerisrunning && g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL && item->type_weap.weapon1 == WEAPON_DATAUPLINK)) { - s32 modelnum = weaponGetModel(item->type_weap.weapon1); + s32 modelnum = playermgrGetModelOfWeapon(item->type_weap.weapon1); if (modelnum > 0) { struct prop *prop = weaponCreateForChr(chr, modelnum, item->type_weap.weapon1, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL); diff --git a/src/game/cheats.c b/src/game/cheats.c index 80df61f4d..b014c4d14 100644 --- a/src/game/cheats.c +++ b/src/game/cheats.c @@ -4,7 +4,7 @@ #include "game/camdraw.h" #include "game/cheats.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/training/training.h" #include "game/gamefile.h" #include "game/lang.h" diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 3f15439a4..9cce830af 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -18,7 +18,7 @@ #include "game/game_0b4950.h" #include "game/player.h" #include "game/game_0c33f0.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1291b0.h" #include "game/game_129210.h" #include "game/gfxmemory.h" @@ -1371,7 +1371,7 @@ glabel var7f1a992cpf /* f01ff74: c7aa00f8 */ lwc1 $f10,0xf8($sp) /* f01ff78: 55810010 */ bnel $t4,$at,.PF0f01ffbc /* f01ff7c: c6240004 */ lwc1 $f4,0x4($s1) -/* f01ff80: 0fc4a513 */ jal propGetPlayerNum +/* f01ff80: 0fc4a513 */ jal playermgrGetPlayerNumByProp /* f01ff84: 01c02025 */ move $a0,$t6 /* f01ff88: 3c08800a */ lui $t0,0x800a /* f01ff8c: 2508a510 */ addiu $t0,$t0,-23280 @@ -2643,7 +2643,7 @@ glabel var7f1a8720 /* f01fe58: c7a400f8 */ lwc1 $f4,0xf8($sp) /* f01fe5c: 55810012 */ bnel $t4,$at,.L0f01fea8 /* f01fe60: c6280004 */ lwc1 $f8,0x4($s1) -/* f01fe64: 0fc4a25f */ jal propGetPlayerNum +/* f01fe64: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f01fe68: 01c02025 */ or $a0,$t6,$zero /* f01fe6c: 3c08800a */ lui $t0,%hi(g_Vars) /* f01fe70: 25089fc0 */ addiu $t0,$t0,%lo(g_Vars) @@ -3860,7 +3860,7 @@ glabel var7f1a8720 /* f01fb5c: c7a400c8 */ lwc1 $f4,0xc8($sp) /* f01fb60: 55e10012 */ bnel $t7,$at,.NB0f01fbac /* f01fb64: c6260004 */ lwc1 $f6,0x4($s1) -/* f01fb68: 0fc48d6f */ jal propGetPlayerNum +/* f01fb68: 0fc48d6f */ jal playermgrGetPlayerNumByProp /* f01fb6c: 01a02025 */ or $a0,$t5,$zero /* f01fb70: 3c08800a */ lui $t0,0x800a /* f01fb74: 2508e6c0 */ addiu $t0,$t0,-6464 @@ -5077,7 +5077,7 @@ glabel var7f1a879c /* f0218ec: afa90144 */ sw $t1,0x144($sp) /* f0218f0: afaa0148 */ sw $t2,0x148($sp) /* f0218f4: e7ac00a0 */ swc1 $f12,0xa0($sp) -/* f0218f8: 0fc4a25f */ jal propGetPlayerNum +/* f0218f8: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f0218fc: e7ae00a4 */ swc1 $f14,0xa4($sp) /* f021900: 00027880 */ sll $t7,$v0,0x2 /* f021904: 3c18800a */ lui $t8,%hi(g_Vars+0x64) @@ -5871,7 +5871,7 @@ glabel var7f1a879c /* f0218ec: afa90144 */ sw $t1,0x144($sp) /* f0218f0: afaa0148 */ sw $t2,0x148($sp) /* f0218f4: e7ac00a0 */ swc1 $f12,0xa0($sp) -/* f0218f8: 0fc4a25f */ jal propGetPlayerNum +/* f0218f8: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f0218fc: e7ae00a4 */ swc1 $f14,0xa4($sp) /* f021900: 00027880 */ sll $t7,$v0,0x2 /* f021904: 3c18800a */ lui $t8,%hi(g_Vars+0x64) @@ -6819,7 +6819,7 @@ void chrUpdateCloak(struct chrdata *chr) } } else if (chr->prop->type == PROPTYPE_PLAYER) { prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(chr->prop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(chr->prop)); if (g_Vars.currentplayer->devicesactive & DEVICE_CLOAKDEVICE) { // Cloak is active - but may or may not be in effect due to recent shooting @@ -6920,7 +6920,7 @@ void chrSetPoisoned(struct chrdata *chr, struct prop *poisonprop) && chr->actiontype != ACT_DIE && chr->prop->type == PROPTYPE_PLAYER) { // This was probably used in a debug print - propGetPlayerNum(chr->prop); + playermgrGetPlayerNumByProp(chr->prop); } if (g_Vars.normmplayerisrunning) { @@ -6953,7 +6953,7 @@ void chrTickPoisoned(struct chrdata *chr) } } } else if (chr->prop->type == PROPTYPE_PLAYER - && g_Vars.players[propGetPlayerNum(chr->prop)]->bondhealth < 0.001f) { + && g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)]->bondhealth < 0.001f) { // Player who's alive but on almost zero health if (g_Vars.normmplayerisrunning) { if (chr->poisoncounter > PALDOWN(3600)) { @@ -7151,7 +7151,7 @@ s32 chrTick(struct prop *prop) onscreen = false; } else if ((chr->chrflags & CHRCFLAG_UNPLAYABLE) || (prop->type == PROPTYPE_PLAYER - && g_Vars.currentplayer == (player = g_Vars.players[propGetPlayerNum(prop)]) + && g_Vars.currentplayer == (player = g_Vars.players[playermgrGetPlayerNumByProp(prop)]) && player->cameramode == CAMERAMODE_THIRDPERSON && player->visionmode != VISIONMODE_SLAYERROCKET)) { // Cutscene chr? @@ -7255,7 +7255,7 @@ s32 chrTick(struct prop *prop) onscreen = func0f08e8ac(prop, &prop->pos, model0001af80(model), true); } else if (prop->type == PROPTYPE_PLAYER && (g_Vars.mplayerisrunning - || (player = g_Vars.players[propGetPlayerNum(prop)], player->cameramode == CAMERAMODE_EYESPY) + || (player = g_Vars.players[playermgrGetPlayerNumByProp(prop)], player->cameramode == CAMERAMODE_EYESPY) || (player->cameramode == CAMERAMODE_THIRDPERSON && player->visionmode == VISIONMODE_SLAYERROCKET))) { model->anim->average = false; chr0f0220ec(chr, lvupdate240, 1); @@ -7351,7 +7351,7 @@ s32 chrTick(struct prop *prop) } else if (prop->type == PROPTYPE_PLAYER) { u8 stack[0x14]; f32 sp130; - player = g_Vars.players[propGetPlayerNum(prop)]; + player = g_Vars.players[playermgrGetPlayerNumByProp(prop)]; if (player->bondmovemode == MOVEMODE_BIKE) { sp178 = chrGetInverseTheta(chr); @@ -10499,7 +10499,7 @@ bool chrCalculateAutoAim(struct prop *prop, struct coord *arg1, f32 *arg2, f32 * && chr->actiontype != ACT_DEAD && (chr->chrflags & CHRCFLAG_NOAUTOAIM) == 0 && ((chr->hidden & CHRHFLAG_CLOAKED) == 0 || USINGDEVICE(DEVICE_IRSCANNER)) - && !(prop->type == PROPTYPE_PLAYER && g_Vars.players[propGetPlayerNum(prop)]->isdead) + && !(prop->type == PROPTYPE_PLAYER && g_Vars.players[playermgrGetPlayerNumByProp(prop)]->isdead) && !(g_Vars.coopplayernum >= 0 && (prop == g_Vars.bond->prop || prop == g_Vars.coop->prop))) { struct model *model = chr->model; Mtxf *mtx1; diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 3effe222c..361ffb791 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -21,7 +21,7 @@ #include "game/game_0b4950.h" #include "game/player.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/explosions/explosions.h" #include "game/sparks/sparks.h" #include "game/bg.h" @@ -3821,7 +3821,7 @@ void chrChoke(struct chrdata *chr, s32 choketype) } if (chr->prop->type == PROPTYPE_PLAYER) { - playernum = propGetPlayerNum(chr->prop); + playernum = playermgrGetPlayerNumByProp(chr->prop); if (g_Vars.players[playernum]->isdead) { return; @@ -4069,7 +4069,7 @@ void chrSetShield(struct chrdata *chr, f32 amount) } if (chr->prop->type == PROPTYPE_PLAYER) { - s32 playernum = propGetPlayerNum(chr->prop); + s32 playernum = playermgrGetPlayerNumByProp(chr->prop); if (playernum >= 0) { s32 prevplayernum = g_Vars.currentplayernum; @@ -4205,7 +4205,7 @@ void playerUpdateDamageStats(struct prop *attacker, struct prop *victim, f32 dam s32 playernum; if (attacker && attacker->type == PROPTYPE_PLAYER) { - playernum = propGetPlayerNum(attacker); + playernum = playermgrGetPlayerNumByProp(attacker); if (playernum >= 0) { g_Vars.playerstats[playernum].damtransmitted += damage; @@ -4213,7 +4213,7 @@ void playerUpdateDamageStats(struct prop *attacker, struct prop *victim, f32 dam } if (victim && victim->type == PROPTYPE_PLAYER) { - playernum = propGetPlayerNum(victim); + playernum = playermgrGetPlayerNumByProp(victim); if (playernum >= 0) { g_Vars.playerstats[playernum].damreceived += damage; @@ -4394,8 +4394,8 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse } if (vprop->type == PROPTYPE_PLAYER) { - healthscale = g_Vars.players[propGetPlayerNum(vprop)]->healthscale; - armourscale = g_Vars.players[propGetPlayerNum(vprop)]->armourscale; + healthscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->healthscale; + armourscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->armourscale; } } else if (g_Vars.coopplayernum >= 0) { // Co-op @@ -4415,8 +4415,8 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse } if (vprop->type == PROPTYPE_PLAYER) { - healthscale = g_Vars.players[propGetPlayerNum(vprop)]->healthscale; - armourscale = g_Vars.players[propGetPlayerNum(vprop)]->armourscale; + healthscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->healthscale; + armourscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->armourscale; } } else if (g_Vars.antiplayernum >= 0) { // Anti @@ -4436,8 +4436,8 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse } if (vprop == g_Vars.bond->prop) { - healthscale = g_Vars.players[propGetPlayerNum(vprop)]->healthscale; - armourscale = g_Vars.players[propGetPlayerNum(vprop)]->armourscale; + healthscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->healthscale; + armourscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->armourscale; } // Anti shooting other enemies is lethal @@ -4448,7 +4448,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse // Normal multiplayer if (vprop->type == PROPTYPE_PLAYER) { s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(vprop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(vprop)); damage *= g_Vars.currentplayerstats->damagescale; setCurrentPlayerNum(prevplayernum); } @@ -4462,7 +4462,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse s32 contpad1; s32 contpad2; - setCurrentPlayerNum(propGetPlayerNum(vprop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(vprop)); joyGetContpadNumsForPlayer(g_Vars.currentplayernum, &contpad1, &contpad2); @@ -4474,7 +4474,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse pakRumble(contpad2, 0.25f, -1, -1); } #else - setCurrentPlayerNum(propGetPlayerNum(vprop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(vprop)); pakRumble((s8)g_Vars.currentplayernum, 0.25f, -1, -1); @@ -4494,7 +4494,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse } } else { if (aprop && aprop->type == PROPTYPE_PLAYER) { - aplayernum = propGetPlayerNum(aprop); + aplayernum = playermgrGetPlayerNumByProp(aprop); } } @@ -4594,7 +4594,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse if (aprop && aprop->type == PROPTYPE_PLAYER && !explosion) { bool alreadydead = false; s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(aprop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(aprop)); // ACT_DIE is not checked here, so it would appear that shooting // a chr as they're dying will increment the shots hit count @@ -4602,7 +4602,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse alreadydead = true; } - if (vprop->type == PROPTYPE_PLAYER && g_Vars.players[propGetPlayerNum(vprop)]->isdead) { + if (vprop->type == PROPTYPE_PLAYER && g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->isdead) { alreadydead = true; } @@ -4739,7 +4739,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse // Handle situations where the player is the one being shot, then return if (vprop->type == PROPTYPE_PLAYER) { s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(vprop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(vprop)); if (g_Vars.normmplayerisrunning) { damage /= mpHandicapToDamageScale(g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].handicap); @@ -4990,7 +4990,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse mpstatsRecordDeath(aplayernum, mpPlayerGetIndex(chr)); } else if (aprop && aprop->type == PROPTYPE_PLAYER) { s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(aprop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(aprop)); mpstatsRecordPlayerKill(); setCurrentPlayerNum(prevplayernum); } @@ -6973,7 +6973,7 @@ bool chrIsDead(struct chrdata *chr) } if (chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); if (g_Vars.players[playernum]->isdead) { return true; @@ -9068,7 +9068,7 @@ f32 chrGetInverseTheta(struct chrdata *chr) } if (chr->model == NULL && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - struct player *player = g_Vars.players[propGetPlayerNum(chr->prop)]; + struct player *player = g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)]; f32 angle = (360.0f - player->vv_theta) * 0.017450513318181f; if (angle >= M_BADTAU) { @@ -9132,7 +9132,7 @@ f32 chrGetAimAngle(struct chrdata *chr) || chr->actiontype == ACT_BOT_ATTACKSTRAFE) { offset = chr->act_attack.animcfg->unk0c; } else if (chr->prop->type == PROPTYPE_PLAYER) { - offset += g_Vars.players[propGetPlayerNum(chr->prop)]->angleoffset; + offset += g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)]->angleoffset; } if (offset) { @@ -9423,7 +9423,7 @@ glabel var7f1a8fc8 /* f03eb90: 55410167 */ bnel $t2,$at,.L0f03f130 /* f03eb94: 8cc40020 */ lw $a0,0x20($a2) /* f03eb98: e7a00024 */ swc1 $f0,0x24($sp) -/* f03eb9c: 0fc4a25f */ jal propGetPlayerNum +/* f03eb9c: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f03eba0: e7b00188 */ swc1 $f16,0x188($sp) /* f03eba4: 8fa40168 */ lw $a0,0x168($sp) /* f03eba8: 00025880 */ sll $t3,$v0,0x2 @@ -21496,7 +21496,7 @@ f32 chrGetAngleToPos(struct chrdata *chr, struct coord *pos) struct prop *prop; if (chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); fVar3 = (360 - g_Vars.players[playernum]->vv_theta) * (M_BADTAU / 360); } else { fVar3 = chrGetInverseTheta(chr); @@ -21689,7 +21689,7 @@ f32 chrGetAngleFromTargetsFov(struct chrdata *chr) angletotarget = atan2f(xdiff, zdiff); if (target->type == PROPTYPE_PLAYER) { - s32 playernum = propGetPlayerNum(target); + s32 playernum = playermgrGetPlayerNumByProp(target); targetfacingangle = (360.0f - g_Vars.players[playernum]->vv_theta) * M_BADTAU / 360.0f; } else if (target->type == PROPTYPE_CHR) { targetfacingangle = chrGetInverseTheta(target->chr); @@ -22568,7 +22568,7 @@ bool chrSetPadPresetToWaypointWithinTargetQuadrant(struct chrdata *chr, u8 quadr prop = chrGetTargetProp(chr); if (prop->type == PROPTYPE_PLAYER) { - angle = (360.0f - g_Vars.players[propGetPlayerNum(prop)]->vv_theta) * M_BADTAU / 360.0f; + angle = (360.0f - g_Vars.players[playermgrGetPlayerNumByProp(prop)]->vv_theta) * M_BADTAU / 360.0f; } else if (prop->type == PROPTYPE_CHR) { angle = chrGetInverseTheta(prop->chr); } @@ -23182,7 +23182,7 @@ bool chrMoveToPos(struct chrdata *chr, struct coord *pos, s16 *rooms, f32 angle, chrSetLookAngle(chr, angle); if (chr->prop->type == PROPTYPE_PLAYER) { - player = g_Vars.players[propGetPlayerNum(chr->prop)]; + player = g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)]; player->vv_manground = ground; player->vv_ground = ground; player->vv_theta = ((M_BADTAU - angle) * 360.0f) / M_BADTAU; @@ -24186,7 +24186,7 @@ f32 func0f04c784(struct chrdata *chr) if (target->type == PROPTYPE_CHR) { targetfacingangle = chrGetInverseTheta(target->chr); } else if (target->type == PROPTYPE_PLAYER) { - s32 playernum = propGetPlayerNum(target); + s32 playernum = playermgrGetPlayerNumByProp(target); targetfacingangle = g_Vars.players[playernum]->vv_theta; } diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 7b1d88d65..02be8c6f1 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -22,7 +22,7 @@ #include "game/player.h" #include "game/hudmsg.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/explosions/explosions.h" #include "game/smoke/smoke.h" #include "game/weather/weather.h" @@ -437,7 +437,7 @@ bool aiChrDoAnimation(void) chr0f0220ec(chr, 1, 1); if (chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); struct player *player = g_Vars.players[playernum]; player->vv_ground = chr->ground; player->vv_manground = chr->ground; @@ -537,7 +537,7 @@ bool aiIfChrDeathAnimationFinished(void) pass = true; } else { if (chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); pass = g_Vars.players[playernum]->isdead; } else { pass = (chr->actiontype == ACT_DEAD); @@ -2048,7 +2048,7 @@ bool aiIfChrHasObject(void) if (obj && obj->prop && chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(chr->prop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(chr->prop)); hasprop = invHasProp(obj->prop); setCurrentPlayerNum(prevplayernum); } @@ -2123,7 +2123,7 @@ bool aiIfChrHasWeaponEquipped(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); if (bgunGetWeaponNum(HAND_RIGHT) == cmd[3]) { @@ -2321,7 +2321,7 @@ bool aiChrDropWeapon(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); u32 weaponnum; setCurrentPlayerNum(playernum); weaponnum = bgunGetWeaponNum(HAND_RIGHT); @@ -2359,7 +2359,7 @@ bool aiGiveObjectToChr(void) u32 something; u32 prevplayernum = g_Vars.currentplayernum; struct defaultobj *obj2 = obj->prop->obj; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); #if VERSION >= VERSION_NTSC_1_0 @@ -2372,7 +2372,7 @@ bool aiGiveObjectToChr(void) something = propPickupByPlayer(obj->prop, 0); propExecuteTickOperation(obj->prop, something); - playernum = propGetPlayerNum(chr->prop); + playernum = playermgrGetPlayerNumByProp(chr->prop); obj2->hidden = (playernum << 28) | (obj2->hidden & 0x0fffffff); setCurrentPlayerNum(prevplayernum); } else { @@ -2727,7 +2727,7 @@ bool aiIfChrHealthGreaterThan(void) if (chr && chr->prop) { if (chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); pass = (value > g_Vars.players[playernum]->bondhealth * 8.0f); } else { @@ -2756,7 +2756,7 @@ bool aiIfChrHealthLessThan(void) if (chr && chr->prop) { if (chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); pass = (value < g_Vars.players[playernum]->bondhealth * 8.0f); } else { @@ -4397,7 +4397,7 @@ bool aiShowHudmsg(void) u32 playernum = g_Vars.currentplayernum; if (chr && chr->prop && (chr->prop->type & 0xff) == PROPTYPE_PLAYER) { - playernum = propGetPlayerNum(chr->prop); + playernum = playermgrGetPlayerNumByProp(chr->prop); } setCurrentPlayerNum(playernum); @@ -4446,7 +4446,7 @@ bool aiShowHudmsgTopMiddle(void) u32 playernum = g_Vars.currentplayernum; if (chr && chr->prop && (chr->prop->type & 0xff) == PROPTYPE_PLAYER) { - playernum = propGetPlayerNum(chr->prop); + playernum = playermgrGetPlayerNumByProp(chr->prop); } setCurrentPlayerNum(playernum); @@ -4510,7 +4510,7 @@ glabel aiSpeak /* f0560e8: 24010006 */ addiu $at,$zero,0x6 /* f0560ec: 15e10004 */ bne $t7,$at,.L0f056100 /* f0560f0: 00000000 */ nop -/* f0560f4: 0fc4a25f */ jal propGetPlayerNum +/* f0560f4: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f0560f8: 00000000 */ nop /* f0560fc: 00403025 */ or $a2,$v0,$zero .L0f056100: @@ -4595,7 +4595,7 @@ glabel aiSpeak // char *text = text_id >= 0 ? langGet(text_id) : NULL; // // if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { -// playernum = propGetPlayerNum(chr->prop); +// playernum = playermgrGetPlayerNumByProp(chr->prop); // } // // setCurrentPlayerNum(playernum); @@ -5288,7 +5288,7 @@ bool aiRevokeControl(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); bgunSetSightVisible(GUNSIGHTREASON_NOCONTROL, false); bgunSetGunAmmoVisible(GUNAMMOREASON_NOCONTROL, false); @@ -5320,7 +5320,7 @@ bool aiGrantControl(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(chr->prop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(chr->prop)); bgunSetSightVisible(GUNSIGHTREASON_NOCONTROL, true); bgunSetGunAmmoVisible(GUNAMMOREASON_NOCONTROL, true); currentPlayerSetHudmsgsOn(HUDMSGREASON_NOCONTROL); @@ -5403,7 +5403,7 @@ bool ai00e3(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); if (var8007074c != 2) { @@ -5452,7 +5452,7 @@ bool aiIfColourFadeComplete(void) struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); if (g_Vars.players[playernum]->colourfadetimemax60 < 0) { pass = true; @@ -5501,7 +5501,7 @@ bool ai00e9(void) struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); if (chr) { - chrSetWeaponReapable(chr, cmd[3]); + weaponDeleteFromChr(chr, cmd[3]); } g_Vars.aioffset += 4; @@ -5536,7 +5536,7 @@ bool aiIfChrAmmoQuantityLessThan(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); if (bgunGetAmmoCount((s8)cmd[3]) < (s8)cmd[4]) { @@ -5565,7 +5565,7 @@ bool aiChrDrawWeapon(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); bgunEquipWeapon2(0, (s8)cmd[3]); bgunEquipWeapon2(1, 0); @@ -5587,7 +5587,7 @@ bool aiChrDrawWeaponInCutscene(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); bgunEquipWeapon((s8)cmd[3]); setCurrentPlayerNum(prevplayernum); @@ -5608,7 +5608,7 @@ bool ai00ee(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); g_Vars.currentplayer->bondforcespeed.x = (s8)cmd[3]; @@ -5663,7 +5663,7 @@ bool aiChrSetInvincible(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); g_PlayerInvincible = true; setCurrentPlayerNum(prevplayernum); @@ -5749,7 +5749,7 @@ bool aiIfPlayerIsInvincible(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); pass = g_PlayerInvincible; setCurrentPlayerNum(prevplayernum); @@ -5875,7 +5875,7 @@ bool aiChrExplosions(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); playerSurroundWithExplosions(0); setCurrentPlayerNum(prevplayernum); @@ -7371,7 +7371,7 @@ glabel var7f1a9d64 /* f05a634: 24010006 */ li $at,0x6 /* f05a638: 55610015 */ bnel $t3,$at,.PF0f05a690 /* f05a63c: 90e20126 */ lbu $v0,0x126($a3) -/* f05a640: 0fc4a513 */ jal propGetPlayerNum +/* f05a640: 0fc4a513 */ jal playermgrGetPlayerNumByProp /* f05a644: 00000000 */ nop /* f05a648: 8e030298 */ lw $v1,0x298($s0) /* f05a64c: 00026080 */ sll $t4,$v0,0x2 @@ -8034,7 +8034,7 @@ glabel var7f1a9d64 /* f05a438: 24010006 */ addiu $at,$zero,0x6 /* f05a43c: 55610015 */ bnel $t3,$at,.L0f05a494 /* f05a440: 90e20126 */ lbu $v0,0x126($a3) -/* f05a444: 0fc4a25f */ jal propGetPlayerNum +/* f05a444: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f05a448: 00000000 */ nop /* f05a44c: 8e030298 */ lw $v1,0x298($s0) /* f05a450: 00026080 */ sll $t4,$v0,0x2 @@ -8695,7 +8695,7 @@ glabel var7f1a9d64 /* f0598a0: 24010006 */ addiu $at,$zero,0x6 /* f0598a4: 55610015 */ bnel $t3,$at,.NB0f0598fc /* f0598a8: 90e20126 */ lbu $v0,0x126($a3) -/* f0598ac: 0fc48d6f */ jal propGetPlayerNum +/* f0598ac: 0fc48d6f */ jal playermgrGetPlayerNumByProp /* f0598b0: 00000000 */ sll $zero,$zero,0x0 /* f0598b4: 8e030298 */ lw $v1,0x298($s0) /* f0598b8: 00026080 */ sll $t4,$v0,0x2 @@ -9284,7 +9284,7 @@ glabel var7f1a9d64 // // 420 // if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { // // 444 -// playernum = propGetPlayerNum(chr->prop); +// playernum = playermgrGetPlayerNumByProp(chr->prop); // // if (g_Vars.coopplayernum >= 0 && g_Vars.players[playernum]->isdead) { // // 470 @@ -10568,7 +10568,7 @@ bool aiPlayerAutoWalk(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); playerAutoWalk(pad_id, cmd[5], cmd[6], cmd[7], cmd[8]); setCurrentPlayerNum(prevplayernum); @@ -10590,7 +10590,7 @@ bool aiIfPlayerAutoWalkFinished(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); if (g_Vars.tickmode == TICKMODE_AUTOWALK) { @@ -10621,7 +10621,7 @@ bool aiIfPlayerLookingAtObject(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); if (g_Vars.currentplayer->lookingatprop.prop == obj->prop) { @@ -11295,7 +11295,7 @@ bool aiChrGrabObject(void) if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER && obj && obj->prop) { u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); if (g_Vars.currentplayer->bondmovemode == MOVEMODE_WALK @@ -11430,7 +11430,7 @@ bool aiChrSetP1P2(void) struct chrdata *chr2 = chrFindById(g_Vars.chrdata, cmd[3]); if (chr1 && chr2 && chr2->prop && chr2->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr2->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr2->prop); if (!g_Vars.players[playernum]->isdead) { if (chr2->prop == g_Vars.coop->prop) { @@ -11580,7 +11580,7 @@ bool aiIfPlayerUsingDevice(void) u8 active = false; if (prop && prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(prop); + u32 playernum = playermgrGetPlayerNumByProp(prop); u32 prevplayernum = g_Vars.currentplayernum; setCurrentPlayerNum(playernum); @@ -11623,7 +11623,7 @@ bool aiChrBeginOrEndTeleport(void) prevplayernum = g_Vars.currentplayernum; if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - playernum = propGetPlayerNum(chr->prop); + playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); } @@ -11678,7 +11678,7 @@ bool aiIfChrTeleportFullWhite(void) struct sndstate *handle; if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = propGetPlayerNum(chr->prop); + u32 playernum = playermgrGetPlayerNumByProp(chr->prop); setCurrentPlayerNum(playernum); } @@ -11759,8 +11759,8 @@ bool aiChrSetCutsceneWeapon(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - s32 model_id = weaponGetModel(cmd[3]); - s32 fallback_model_id = weaponGetModel(cmd[4]); + s32 model_id = playermgrGetModelOfWeapon(cmd[3]); + s32 fallback_model_id = playermgrGetModelOfWeapon(cmd[4]); if (chr) { if (cmd[3] == 0xff) { @@ -11783,8 +11783,8 @@ bool aiChrSetCutsceneWeapon(void) } if (valid) { - chrSetWeaponReapable(chr, HAND_LEFT); - chrSetWeaponReapable(chr, HAND_RIGHT); + weaponDeleteFromChr(chr, HAND_LEFT); + weaponDeleteFromChr(chr, HAND_RIGHT); } } } else { @@ -11793,8 +11793,8 @@ bool aiChrSetCutsceneWeapon(void) } } } else { - chrSetWeaponReapable(chr, HAND_LEFT); - chrSetWeaponReapable(chr, HAND_RIGHT); + weaponDeleteFromChr(chr, HAND_LEFT); + weaponDeleteFromChr(chr, HAND_RIGHT); if (model_id >= 0) { weaponCreateForChr(chr, model_id, cmd[3], 0, NULL, NULL); diff --git a/src/game/game_00c490.c b/src/game/game_00c490.c index f94a43cc9..14e23fee5 100644 --- a/src/game/game_00c490.c +++ b/src/game/game_00c490.c @@ -16,7 +16,7 @@ #include "game/game_091e10.h" #include "game/atan2f.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/bg.h" #include "game/game_1655c0.h" #include "game/file.h" diff --git a/src/game/game_01b0a0.c b/src/game/game_01b0a0.c index fbb2b0485..b367ba68f 100644 --- a/src/game/game_01b0a0.c +++ b/src/game/game_01b0a0.c @@ -4,7 +4,7 @@ #include "game/bondgun.h" #include "game/game_0b0fd0.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/options.h" #include "bss.h" #include "data.h" diff --git a/src/game/game_01bea0.c b/src/game/game_01bea0.c index a6b76b944..0e8ce0711 100644 --- a/src/game/game_01bea0.c +++ b/src/game/game_01bea0.c @@ -11,7 +11,7 @@ #include "game/filelist.h" #include "game/mainmenu.h" #include "game/endscreen.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/lv.h" #include "game/music.h" #include "game/mplayer/ingame.h" diff --git a/src/game/game_0b0fd0.c b/src/game/game_0b0fd0.c index 2b999b5cb..c4d0419fe 100644 --- a/src/game/game_0b0fd0.c +++ b/src/game/game_0b0fd0.c @@ -6,7 +6,7 @@ #include "game/game_0b0fd0.h" #include "game/player.h" #include "game/hudmsg.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/mplayer/setup.h" #include "game/botcmd.h" #include "game/lang.h" diff --git a/src/game/game_0b3350.c b/src/game/game_0b3350.c index 3a5dde8b6..db18d0da3 100644 --- a/src/game/game_0b3350.c +++ b/src/game/game_0b3350.c @@ -2,7 +2,7 @@ #include "constants.h" #include "game/atan2f.h" #include "game/game_0b3350.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/bg.h" #include "game/texdecompress.h" #include "game/game_173a00.h" diff --git a/src/game/game_0b4950.c b/src/game/game_0b4950.c index c04154485..72f69ed04 100644 --- a/src/game/game_0b4950.c +++ b/src/game/game_0b4950.c @@ -2,7 +2,7 @@ #include "constants.h" #include "game/atan2f.h" #include "game/game_0b3350.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/bg.h" #include "game/texdecompress.h" #include "game/game_173a00.h" @@ -401,7 +401,7 @@ glabel func0f0b5050 /* f0b5128: 5b000096 */ blezl $t8,.L0f0b5384 /* f0b512c: 8fbf002c */ lw $ra,0x2c($sp) .L0f0b5130: -/* f0b5130: 0fc4a39e */ jal calculatePlayerIndex +/* f0b5130: 0fc4a39e */ jal playermgrGetOrderOfPlayer /* f0b5134: 02202025 */ or $a0,$s1,$zero /* f0b5138: 8e190290 */ lw $t9,0x290($s0) /* f0b513c: 00114080 */ sll $t0,$s1,0x2 @@ -497,7 +497,7 @@ glabel func0f0b5050 /* f0b5278: 19e00041 */ blez $t7,.L0f0b5380 /* f0b527c: 02202025 */ or $a0,$s1,$zero .L0f0b5280: -/* f0b5280: 0fc4a39e */ jal calculatePlayerIndex +/* f0b5280: 0fc4a39e */ jal playermgrGetOrderOfPlayer /* f0b5284: afa50034 */ sw $a1,0x34($sp) /* f0b5288: 8e190290 */ lw $t9,0x290($s0) /* f0b528c: 00003025 */ or $a2,$zero,$zero @@ -644,7 +644,7 @@ glabel func0f0b53a4 /* f0b547c: 5b000096 */ blezl $t8,.L0f0b56d8 /* f0b5480: 8fbf002c */ lw $ra,0x2c($sp) .L0f0b5484: -/* f0b5484: 0fc4a39e */ jal calculatePlayerIndex +/* f0b5484: 0fc4a39e */ jal playermgrGetOrderOfPlayer /* f0b5488: 02202025 */ or $a0,$s1,$zero /* f0b548c: 8e190290 */ lw $t9,0x290($s0) /* f0b5490: 00114080 */ sll $t0,$s1,0x2 @@ -740,7 +740,7 @@ glabel func0f0b53a4 /* f0b55cc: 19e00041 */ blez $t7,.L0f0b56d4 /* f0b55d0: 02202025 */ or $a0,$s1,$zero .L0f0b55d4: -/* f0b55d4: 0fc4a39e */ jal calculatePlayerIndex +/* f0b55d4: 0fc4a39e */ jal playermgrGetOrderOfPlayer /* f0b55d8: afa50034 */ sw $a1,0x34($sp) /* f0b55dc: 8e190290 */ lw $t9,0x290($s0) /* f0b55e0: 00003025 */ or $a2,$zero,$zero diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 61ae341dd..40bd8ba14 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -26,7 +26,7 @@ #include "game/mainmenu.h" #include "game/filemgr.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/explosions/explosions.h" #include "game/bondview.h" #include "game/game_1531a0.h" diff --git a/src/game/game_19aa80.c b/src/game/game_19aa80.c index e1052c7be..ab57a1633 100644 --- a/src/game/game_19aa80.c +++ b/src/game/game_19aa80.c @@ -4,7 +4,7 @@ #include "game/chr/chraicommands.h" #include "game/prop.h" #include "game/atan2f.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/mplayer/setup.h" #include "game/bot.h" #include "game/game_19aa80.h" diff --git a/src/game/hudmsg.c b/src/game/hudmsg.c index b50fd3ee8..b72689f8e 100644 --- a/src/game/hudmsg.c +++ b/src/game/hudmsg.c @@ -7,7 +7,7 @@ #include "game/savebuffer.h" #include "game/hudmsg.h" #include "game/menugfx.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1531a0.h" #include "game/lv.h" #include "game/mplayer/mplayer.h" diff --git a/src/game/lv.c b/src/game/lv.c index 8733e76b3..38bf8c84f 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -64,7 +64,7 @@ #include "game/filemgr.h" #include "game/game_10c9c0.h" #include "game/game_11f000.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_129210.h" #include "game/explosions/explosions.h" #include "game/sparks/sparks.h" @@ -441,7 +441,7 @@ void lvInit(s32 stagenum) currentPlayerInitAnimation(); if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_TEAMSENABLED)) { - currentPlayerCalculateAiBuddyNums(); + playermgrCalculateAiBuddyNums(); } } @@ -597,7 +597,7 @@ bool lvCheckCmpFollowThreat(struct threat *threat, s32 index) if (threat->prop && prop->chr) { switch (threat->prop->type) { case PROPTYPE_PLAYER: - if (propGetPlayerNum(prop) == g_Vars.currentplayernum) { + if (playermgrGetPlayerNumByProp(prop) == g_Vars.currentplayernum) { return false; } // fall through @@ -881,7 +881,7 @@ void func0f168f24(struct prop *prop, bool inchild, struct coord *playerpos, s32 } else { if (prop->type == PROPTYPE_CHR || (prop->type == PROPTYPE_PLAYER - && propGetPlayerNum(prop) != g_Vars.currentplayernum)) { + && playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum)) { model = g_Vars.currentplayer->cmpfollowprops[i].prop->chr->model; } } @@ -1109,7 +1109,7 @@ Gfx *lvRender(Gfx *gdl) islastplayer = true; } else { s32 nextplayernum = i + 1; - setCurrentPlayerNum(getPlayerByOrderNum(i)); + setCurrentPlayerNum(playermgrGetPlayerAtOrder(i)); islastplayer = playercount == nextplayernum; } diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index 63af07879..c32291c61 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -8,7 +8,7 @@ #include "game/player.h" #include "game/savebuffer.h" #include "game/menu.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1531a0.h" #include "game/lv.h" #include "game/music.h" diff --git a/src/game/mplayer/scenarios.c b/src/game/mplayer/scenarios.c index 65ee95e7a..913dd77ce 100644 --- a/src/game/mplayer/scenarios.c +++ b/src/game/mplayer/scenarios.c @@ -13,7 +13,7 @@ #include "game/hudmsg.h" #include "game/menu.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1531a0.h" #include "game/mplayer/setup.h" #include "game/mplayer/scenarios.h" diff --git a/src/game/mpstats.c b/src/game/mpstats.c index 3ffeca039..64063242d 100644 --- a/src/game/mpstats.c +++ b/src/game/mpstats.c @@ -6,7 +6,7 @@ #include "game/game_0b0fd0.h" #include "game/player.h" #include "game/hudmsg.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/mplayer/setup.h" #include "game/botcmd.h" #include "game/lang.h" diff --git a/src/game/objectives/objectives.c b/src/game/objectives/objectives.c index 094322f82..af711deb0 100644 --- a/src/game/objectives/objectives.c +++ b/src/game/objectives/objectives.c @@ -9,7 +9,7 @@ #include "game/game_0b4950.h" #include "game/hudmsg.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/lv.h" #include "game/training/training.h" #include "game/lang.h" diff --git a/src/game/player.c b/src/game/player.c index 19f6c2f62..3ba23a5cc 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -29,7 +29,7 @@ #include "game/mainmenu.h" #include "game/filemgr.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/explosions/explosions.h" #include "game/bondview.h" #include "game/game_1531a0.h" @@ -1329,7 +1329,7 @@ void playerTickChrBody(void) weaponnum = g_DefaultWeapons[0]; } - weaponmodelnum = weaponGetModel(weaponnum); + weaponmodelnum = playermgrGetModelOfWeapon(weaponnum); if (IS4MB()) { bodynum = BODY_DARK_COMBAT; @@ -2229,7 +2229,7 @@ void playerTickCutscene(bool arg0) playerSetCameraMode(CAMERAMODE_THIRDPERSON); player0f0c1bd8(&pos, &up, &look); - currentPlayerSetFovY(fovy); + playermgrSetFovY(fovy); viSetFovY(fovy); if (g_Vars.currentplayerindex == 0) { @@ -2338,12 +2338,12 @@ void playerUpdateZoom(void) g_Vars.currentplayer->zoominfovy = g_Vars.currentplayer->zoominfovynew; } - currentPlayerSetFovY(g_Vars.currentplayer->zoominfovy); + playermgrSetFovY(g_Vars.currentplayer->zoominfovy); viSetFovY(g_Vars.currentplayer->zoominfovy); if (g_Vars.currentplayer->teleportstate != TELEPORTSTATE_INACTIVE) { fovy = playerGetTeleportFovY(); - currentPlayerSetFovY(fovy); + playermgrSetFovY(fovy); viSetFovY(fovy); } @@ -3661,7 +3661,7 @@ void playerTickTeleport(f32 *aspectratio) if (g_Vars.currentplayer->teleportstate != TELEPORTSTATE_INACTIVE) { f32 fovy = playerGetTeleportFovY(); - currentPlayerSetFovY(fovy); + playermgrSetFovY(fovy); viSetFovY(fovy); } } @@ -3673,10 +3673,10 @@ void playerConfigureVi(void) func0f1531dc(false); - currentPlayerSetFovY(60); - currentPlayerSetAspectRatio(ratio); - currentPlayerSetViewSize(playerGetViewportWidth(), playerGetViewportHeight()); - currentPlayerSetViewPosition(playerGetViewportLeft(), playerGetViewportTop()); + playermgrSetFovY(60); + playermgrSetAspectRatio(ratio); + playermgrSetViewSize(playerGetViewportWidth(), playerGetViewportHeight()); + playermgrSetViewPosition(playerGetViewportLeft(), playerGetViewportTop()); viSetMode(g_ViModes[g_ViRes].xscale); @@ -3735,10 +3735,10 @@ void playerTick(bool arg0) return; } - currentPlayerSetFovY(60); - currentPlayerSetAspectRatio(aspectratio); - currentPlayerSetViewSize(playerGetViewportWidth(), playerGetViewportHeight()); - currentPlayerSetViewPosition(playerGetViewportLeft(), playerGetViewportTop()); + playermgrSetFovY(60); + playermgrSetAspectRatio(aspectratio); + playermgrSetViewSize(playerGetViewportWidth(), playerGetViewportHeight()); + playermgrSetViewPosition(playerGetViewportLeft(), playerGetViewportTop()); viSetMode(g_ViModes[g_ViRes].xscale); viSetFovAspectAndSize(60, aspectratio, playerGetViewportWidth(), playerGetViewportHeight()); @@ -3881,7 +3881,7 @@ void playerTick(bool arg0) && g_Vars.currentplayer->eyespy->active) { // Controlling an eyespy struct coord sp308; - currentPlayerSetFovY(120); + playermgrSetFovY(120); viSetFovY(120); sp308.x = g_Vars.currentplayer->eyespy->prop->pos.x; sp308.y = g_Vars.currentplayer->eyespy->prop->pos.y; @@ -5875,7 +5875,7 @@ void playersClearMemCamRoom(void) void playerSetPerimEnabled(struct prop *prop, bool enable) { - u32 playernum = propGetPlayerNum(prop); + u32 playernum = playermgrGetPlayerNumByProp(prop); if (g_Vars.players[playernum]->haschrbody) { chrSetPerimEnabled(prop->chr, enable); @@ -5894,7 +5894,7 @@ void playerSetPerimEnabled(struct prop *prop, bool enable) bool playerUpdateGeometry(struct prop *prop, u8 **start, u8 **end) { - s32 playernum = propGetPlayerNum(prop); + s32 playernum = playermgrGetPlayerNumByProp(prop); if (g_Vars.players[playernum]->bondperimenabled && (!g_Vars.mplayerisrunning || !g_Vars.players[playernum]->isdead)) { @@ -5953,7 +5953,7 @@ void playerUpdatePerimInfo(void) */ void playerGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin) { - s32 playernum = propGetPlayerNum(prop); + s32 playernum = playermgrGetPlayerNumByProp(prop); *width = g_Vars.players[playernum]->bond2.width; *ymin = g_Vars.currentplayer->vv_manground + 30; @@ -6015,8 +6015,8 @@ s32 playerGetMissionTime(void) s32 playerTickBeams(struct prop *prop) { - beamTick(&g_Vars.players[propGetPlayerNum(prop)]->hands[0].beam); - beamTick(&g_Vars.players[propGetPlayerNum(prop)]->hands[1].beam); + beamTick(&g_Vars.players[playermgrGetPlayerNumByProp(prop)]->hands[0].beam); + beamTick(&g_Vars.players[playermgrGetPlayerNumByProp(prop)]->hands[1].beam); if (prop->chr && g_Vars.mplayerisrunning) { struct chrdata *chr = prop->chr; @@ -6035,7 +6035,7 @@ s32 playerTickBeams(struct prop *prop) s32 playerTickThirdPerson(struct prop *prop) { - s32 playernum = propGetPlayerNum(prop); + s32 playernum = playermgrGetPlayerNumByProp(prop); struct player *player = g_Vars.players[playernum]; struct chrdata *chr = prop->chr; s32 i; @@ -6285,7 +6285,7 @@ void playerChooseThirdPersonAnimation(struct chrdata *chr, s32 crouchpos, f32 sp struct prop *chrprop = chr->prop; if (chrprop->type == PROPTYPE_PLAYER - && g_Vars.players[propGetPlayerNum(chrprop)]->bondmovemode == MOVEMODE_BIKE) { + && g_Vars.players[playermgrGetPlayerNumByProp(chrprop)]->bondmovemode == MOVEMODE_BIKE) { // Player on a hoverbike if (leftprop && rightprop) { wieldmode = WIELDMODE_DUALGUNS; @@ -6374,7 +6374,7 @@ void playerChooseThirdPersonAnimation(struct chrdata *chr, s32 crouchpos, f32 sp } } else if (turnspeed < 0.4f || (chr->prop->type == PROPTYPE_PLAYER - && g_Vars.players[propGetPlayerNum(chr->prop)]->headanim == 0)) { + && g_Vars.players[playermgrGetPlayerNumByProp(chr->prop)]->headanim == 0)) { turnmode = TURNMODE_STAND_SOFTTURN; speed = 2.0f * turnspeed; @@ -6468,7 +6468,7 @@ void playerChooseThirdPersonAnimation(struct chrdata *chr, s32 crouchpos, f32 sp Gfx *playerRender(struct prop *prop, Gfx *gdl, bool withalpha) { - if (g_Vars.players[propGetPlayerNum(prop)]->haschrbody) { + if (g_Vars.players[playermgrGetPlayerNumByProp(prop)]->haschrbody) { gdl = chrRender(prop, gdl, withalpha); } diff --git a/src/game/game_127910.c b/src/game/playermgr.c similarity index 85% rename from src/game/game_127910.c rename to src/game/playermgr.c index 19aadde5a..a49efdad3 100644 --- a/src/game/game_127910.c +++ b/src/game/playermgr.c @@ -3,7 +3,7 @@ #include "game/cheats.h" #include "game/bondgun.h" #include "game/player.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/propobj.h" #include "bss.h" #include "lib/memp.h" @@ -11,7 +11,7 @@ #include "data.h" #include "types.h" -void func0f127910(void) +void playermgrInit(void) { s32 i; @@ -24,7 +24,7 @@ void func0f127910(void) g_Vars.antiplayernum = -1; } -void playersUnrefAll(void) +void playermgrReset(void) { g_Vars.players[0] = NULL; g_Vars.players[1] = NULL; @@ -43,7 +43,7 @@ void playersUnrefAll(void) g_Vars.anti = NULL; } -void playersAllocate(s32 count) +void playermgrAllocatePlayers(s32 count) { g_Vars.players[0] = NULL; g_Vars.players[1] = NULL; @@ -54,7 +54,7 @@ void playersAllocate(s32 count) s32 i; for (i = 0; i < count; i++) { - playerAllocate(i); + playermgrAllocatePlayer(i); } setCurrentPlayerNum(0); @@ -68,17 +68,13 @@ void playersAllocate(s32 count) g_Vars.anti = g_Vars.players[g_Vars.antiplayernum]; } } else { - playerAllocate(0); + playermgrAllocatePlayer(0); setCurrentPlayerNum(0); if (g_Vars.fourmeg2player) { - s16 a = playerGetFbWidth(); - s16 b = playerGetFbHeight(); - currentPlayerSetViewSize(a, b << 1); + playermgrSetViewSize(playerGetFbWidth(), playerGetFbHeight() * 2); } else { - s16 a = playerGetFbWidth(); - s16 b = playerGetFbHeight(); - currentPlayerSetViewSize(a, b); + playermgrSetViewSize(playerGetFbWidth(), playerGetFbHeight()); } g_Vars.coop = NULL; @@ -87,7 +83,7 @@ void playersAllocate(s32 count) } } -void playerAllocate(s32 index) +void playermgrAllocatePlayer(s32 index) { struct hand hand = { {0}, @@ -644,7 +640,7 @@ void playerAllocate(s32 index) g_Vars.bondcollisions = true; } -void currentPlayerCalculateAiBuddyNums(void) +void playermgrCalculateAiBuddyNums(void) { s32 i; s32 playernum = g_Vars.currentplayernum; @@ -663,10 +659,10 @@ void setCurrentPlayerNum(s32 playernum) g_Vars.currentplayernum = playernum; g_Vars.currentplayer = g_Vars.players[playernum]; g_Vars.currentplayerstats = &g_Vars.playerstats[playernum]; - g_Vars.currentplayerindex = calculatePlayerIndex(playernum); + g_Vars.currentplayerindex = playermgrGetOrderOfPlayer(playernum); } -s32 propGetPlayerNum(struct prop *prop) +s32 playermgrGetPlayerNumByProp(struct prop *prop) { s32 i; @@ -679,132 +675,132 @@ s32 propGetPlayerNum(struct prop *prop) return -1; } -void currentPlayerSetViewSize(s32 width, s32 height) +void playermgrSetViewSize(s32 width, s32 height) { g_Vars.currentplayer->viewwidth = width; g_Vars.currentplayer->viewheight = height; } -void currentPlayerSetViewPosition(s32 viewleft, s32 viewtop) +void playermgrSetViewPosition(s32 viewleft, s32 viewtop) { g_Vars.currentplayer->viewleft = viewleft; g_Vars.currentplayer->viewtop = viewtop; } -void currentPlayerSetFovY(f32 fovy) +void playermgrSetFovY(f32 fovy) { g_Vars.currentplayer->fovy = fovy; } -void currentPlayerSetAspectRatio(f32 aspect) +void playermgrSetAspectRatio(f32 aspect) { g_Vars.currentplayer->aspect = aspect; } #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( -glabel weaponGetModel +glabel playermgrGetModelOfWeapon .late_rodata glabel var7f1b5168 -.word weaponGetModel+0x60 # f128b54 +.word playermgrGetModelOfWeapon+0x60 # f128b54 glabel var7f1b516c -.word weaponGetModel+0x60 # f128b54 +.word playermgrGetModelOfWeapon+0x60 # f128b54 glabel var7f1b5170 -.word weaponGetModel+0x68 # f128b5c +.word playermgrGetModelOfWeapon+0x68 # f128b5c glabel var7f1b5174 -.word weaponGetModel+0x98 # f128b8c +.word playermgrGetModelOfWeapon+0x98 # f128b8c glabel var7f1b5178 -.word weaponGetModel+0xa0 # f128b94 +.word playermgrGetModelOfWeapon+0xa0 # f128b94 glabel var7f1b517c -.word weaponGetModel+0x70 # f128b64 +.word playermgrGetModelOfWeapon+0x70 # f128b64 glabel var7f1b5180 -.word weaponGetModel+0x78 # f128b6c +.word playermgrGetModelOfWeapon+0x78 # f128b6c glabel var7f1b5184 -.word weaponGetModel+0x90 # f128b84 +.word playermgrGetModelOfWeapon+0x90 # f128b84 glabel var7f1b5188 -.word weaponGetModel+0x80 # f128b74 +.word playermgrGetModelOfWeapon+0x80 # f128b74 glabel var7f1b518c -.word weaponGetModel+0x88 # f128b7c +.word playermgrGetModelOfWeapon+0x88 # f128b7c glabel var7f1b5190 -.word weaponGetModel+0xa8 # f128b9c +.word playermgrGetModelOfWeapon+0xa8 # f128b9c glabel var7f1b5194 -.word weaponGetModel+0xd0 # f128bc4 +.word playermgrGetModelOfWeapon+0xd0 # f128bc4 glabel var7f1b5198 -.word weaponGetModel+0xd8 # f128bcc +.word playermgrGetModelOfWeapon+0xd8 # f128bcc glabel var7f1b519c -.word weaponGetModel+0xe0 # f128bd4 +.word playermgrGetModelOfWeapon+0xe0 # f128bd4 glabel var7f1b51a0 -.word weaponGetModel+0xe8 # f128bdc +.word playermgrGetModelOfWeapon+0xe8 # f128bdc glabel var7f1b51a4 -.word weaponGetModel+0xb8 # f128bac +.word playermgrGetModelOfWeapon+0xb8 # f128bac glabel var7f1b51a8 -.word weaponGetModel+0xc8 # f128bbc +.word playermgrGetModelOfWeapon+0xc8 # f128bbc glabel var7f1b51ac -.word weaponGetModel+0xb0 # f128ba4 +.word playermgrGetModelOfWeapon+0xb0 # f128ba4 glabel var7f1b51b0 -.word weaponGetModel+0xc0 # f128bb4 +.word playermgrGetModelOfWeapon+0xc0 # f128bb4 glabel var7f1b51b4 -.word weaponGetModel+0xf0 # f128be4 +.word playermgrGetModelOfWeapon+0xf0 # f128be4 glabel var7f1b51b8 -.word weaponGetModel+0xf8 # f128bec +.word playermgrGetModelOfWeapon+0xf8 # f128bec glabel var7f1b51bc -.word weaponGetModel+0x120 # f128c14 +.word playermgrGetModelOfWeapon+0x120 # f128c14 glabel var7f1b51c0 -.word weaponGetModel+0x118 # f128c0c +.word playermgrGetModelOfWeapon+0x118 # f128c0c glabel var7f1b51c4 -.word weaponGetModel+0x108 # f128bfc +.word playermgrGetModelOfWeapon+0x108 # f128bfc glabel var7f1b51c8 -.word weaponGetModel+0x100 # f128bf4 +.word playermgrGetModelOfWeapon+0x100 # f128bf4 glabel var7f1b51cc -.word weaponGetModel+0x110 # f128c04 +.word playermgrGetModelOfWeapon+0x110 # f128c04 glabel var7f1b51d0 -.word weaponGetModel+0x138 # f128c2c +.word playermgrGetModelOfWeapon+0x138 # f128c2c glabel var7f1b51d4 -.word weaponGetModel+0x128 # f128c1c +.word playermgrGetModelOfWeapon+0x128 # f128c1c glabel var7f1b51d8 -.word weaponGetModel+0x140 # f128c34 +.word playermgrGetModelOfWeapon+0x140 # f128c34 glabel var7f1b51dc -.word weaponGetModel+0x130 # f128c24 +.word playermgrGetModelOfWeapon+0x130 # f128c24 glabel var7f1b51e0 -.word weaponGetModel+0x158 # f128c4c +.word playermgrGetModelOfWeapon+0x158 # f128c4c glabel var7f1b51e4 -.word weaponGetModel+0x150 # f128c44 +.word playermgrGetModelOfWeapon+0x150 # f128c44 glabel var7f1b51e8 -.word weaponGetModel+0x170 # f128c64 +.word playermgrGetModelOfWeapon+0x170 # f128c64 glabel var7f1b51ec -.word weaponGetModel+0x168 # f128c5c +.word playermgrGetModelOfWeapon+0x168 # f128c5c glabel var7f1b51f0 -.word weaponGetModel+0x160 # f128c54 +.word playermgrGetModelOfWeapon+0x160 # f128c54 glabel var7f1b51f4 -.word weaponGetModel+0x1c8 # f128cbc +.word playermgrGetModelOfWeapon+0x1c8 # f128cbc glabel var7f1b51f8 -.word weaponGetModel+0x188 # f128c7c +.word playermgrGetModelOfWeapon+0x188 # f128c7c glabel var7f1b51fc -.word weaponGetModel+0x190 # f128c84 +.word playermgrGetModelOfWeapon+0x190 # f128c84 glabel var7f1b5200 -.word weaponGetModel+0x198 # f128c8c +.word playermgrGetModelOfWeapon+0x198 # f128c8c glabel var7f1b5204 -.word weaponGetModel+0x1a0 # f128c94 +.word playermgrGetModelOfWeapon+0x1a0 # f128c94 glabel var7f1b5208 -.word weaponGetModel+0x1a8 # f128c9c +.word playermgrGetModelOfWeapon+0x1a8 # f128c9c glabel var7f1b520c -.word weaponGetModel+0x1b0 # f128ca4 +.word playermgrGetModelOfWeapon+0x1b0 # f128ca4 glabel var7f1b5210 -.word weaponGetModel+0x1b8 # f128cac +.word playermgrGetModelOfWeapon+0x1b8 # f128cac glabel var7f1b5214 -.word weaponGetModel+0x1c0 # f128cb4 +.word playermgrGetModelOfWeapon+0x1c0 # f128cb4 glabel var7f1b5218 -.word weaponGetModel+0x148 # f128c3c +.word playermgrGetModelOfWeapon+0x148 # f128c3c glabel var7f1b521c -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b5220 -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b5224 -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b5228 -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b522c -.word weaponGetModel+0x180 # f128c74 +.word playermgrGetModelOfWeapon+0x180 # f128c74 .text /* f128af4: 28810052 */ slti $at,$a0,0x52 /* f128af8: 14200007 */ bnez $at,.L0f128b18 @@ -944,108 +940,108 @@ glabel var7f1b522c ); #else GLOBAL_ASM( -glabel weaponGetModel +glabel playermgrGetModelOfWeapon .late_rodata glabel var7f1b5168 -.word weaponGetModel+0x60 # f128b54 +.word playermgrGetModelOfWeapon+0x60 # f128b54 glabel var7f1b516c -.word weaponGetModel+0x60 # f128b54 +.word playermgrGetModelOfWeapon+0x60 # f128b54 glabel var7f1b5170 -.word weaponGetModel+0x68 # f128b5c +.word playermgrGetModelOfWeapon+0x68 # f128b5c glabel var7f1b5174 -.word weaponGetModel+0x98 # f128b8c +.word playermgrGetModelOfWeapon+0x98 # f128b8c glabel var7f1b5178 -.word weaponGetModel+0xa0 # f128b94 +.word playermgrGetModelOfWeapon+0xa0 # f128b94 glabel var7f1b517c -.word weaponGetModel+0x70 # f128b64 +.word playermgrGetModelOfWeapon+0x70 # f128b64 glabel var7f1b5180 -.word weaponGetModel+0x78 # f128b6c +.word playermgrGetModelOfWeapon+0x78 # f128b6c glabel var7f1b5184 -.word weaponGetModel+0x90 # f128b84 +.word playermgrGetModelOfWeapon+0x90 # f128b84 glabel var7f1b5188 -.word weaponGetModel+0x80 # f128b74 +.word playermgrGetModelOfWeapon+0x80 # f128b74 glabel var7f1b518c -.word weaponGetModel+0x88 # f128b7c +.word playermgrGetModelOfWeapon+0x88 # f128b7c glabel var7f1b5190 -.word weaponGetModel+0xa8 # f128b9c +.word playermgrGetModelOfWeapon+0xa8 # f128b9c glabel var7f1b5194 -.word weaponGetModel+0xd0 # f128bc4 +.word playermgrGetModelOfWeapon+0xd0 # f128bc4 glabel var7f1b5198 -.word weaponGetModel+0xd8 # f128bcc +.word playermgrGetModelOfWeapon+0xd8 # f128bcc glabel var7f1b519c -.word weaponGetModel+0xe0 # f128bd4 +.word playermgrGetModelOfWeapon+0xe0 # f128bd4 glabel var7f1b51a0 -.word weaponGetModel+0xe8 # f128bdc +.word playermgrGetModelOfWeapon+0xe8 # f128bdc glabel var7f1b51a4 -.word weaponGetModel+0xb8 # f128bac +.word playermgrGetModelOfWeapon+0xb8 # f128bac glabel var7f1b51a8 -.word weaponGetModel+0xc8 # f128bbc +.word playermgrGetModelOfWeapon+0xc8 # f128bbc glabel var7f1b51ac -.word weaponGetModel+0xb0 # f128ba4 +.word playermgrGetModelOfWeapon+0xb0 # f128ba4 glabel var7f1b51b0 -.word weaponGetModel+0xc0 # f128bb4 +.word playermgrGetModelOfWeapon+0xc0 # f128bb4 glabel var7f1b51b4 -.word weaponGetModel+0xf0 # f128be4 +.word playermgrGetModelOfWeapon+0xf0 # f128be4 glabel var7f1b51b8 -.word weaponGetModel+0xf8 # f128bec +.word playermgrGetModelOfWeapon+0xf8 # f128bec glabel var7f1b51bc -.word weaponGetModel+0x120 # f128c14 +.word playermgrGetModelOfWeapon+0x120 # f128c14 glabel var7f1b51c0 -.word weaponGetModel+0x118 # f128c0c +.word playermgrGetModelOfWeapon+0x118 # f128c0c glabel var7f1b51c4 -.word weaponGetModel+0x108 # f128bfc +.word playermgrGetModelOfWeapon+0x108 # f128bfc glabel var7f1b51c8 -.word weaponGetModel+0x100 # f128bf4 +.word playermgrGetModelOfWeapon+0x100 # f128bf4 glabel var7f1b51cc -.word weaponGetModel+0x110 # f128c04 +.word playermgrGetModelOfWeapon+0x110 # f128c04 glabel var7f1b51d0 -.word weaponGetModel+0x138 # f128c2c +.word playermgrGetModelOfWeapon+0x138 # f128c2c glabel var7f1b51d4 -.word weaponGetModel+0x128 # f128c1c +.word playermgrGetModelOfWeapon+0x128 # f128c1c glabel var7f1b51d8 -.word weaponGetModel+0x140 # f128c34 +.word playermgrGetModelOfWeapon+0x140 # f128c34 glabel var7f1b51dc -.word weaponGetModel+0x130 # f128c24 +.word playermgrGetModelOfWeapon+0x130 # f128c24 glabel var7f1b51e0 -.word weaponGetModel+0x158 # f128c4c +.word playermgrGetModelOfWeapon+0x158 # f128c4c glabel var7f1b51e4 -.word weaponGetModel+0x150 # f128c44 +.word playermgrGetModelOfWeapon+0x150 # f128c44 glabel var7f1b51e8 -.word weaponGetModel+0x170 # f128c64 +.word playermgrGetModelOfWeapon+0x170 # f128c64 glabel var7f1b51ec -.word weaponGetModel+0x168 # f128c5c +.word playermgrGetModelOfWeapon+0x168 # f128c5c glabel var7f1b51f0 -.word weaponGetModel+0x160 # f128c54 +.word playermgrGetModelOfWeapon+0x160 # f128c54 glabel var7f1b51f4 -.word weaponGetModel+0x1c8 # f128cbc +.word playermgrGetModelOfWeapon+0x1c8 # f128cbc glabel var7f1b51f8 -.word weaponGetModel+0x188 # f128c7c +.word playermgrGetModelOfWeapon+0x188 # f128c7c glabel var7f1b51fc -.word weaponGetModel+0x190 # f128c84 +.word playermgrGetModelOfWeapon+0x190 # f128c84 glabel var7f1b5200 -.word weaponGetModel+0x198 # f128c8c +.word playermgrGetModelOfWeapon+0x198 # f128c8c glabel var7f1b5204 -.word weaponGetModel+0x1a0 # f128c94 +.word playermgrGetModelOfWeapon+0x1a0 # f128c94 glabel var7f1b5208 -.word weaponGetModel+0x1a8 # f128c9c +.word playermgrGetModelOfWeapon+0x1a8 # f128c9c glabel var7f1b520c -.word weaponGetModel+0x1b0 # f128ca4 +.word playermgrGetModelOfWeapon+0x1b0 # f128ca4 glabel var7f1b5210 -.word weaponGetModel+0x1b8 # f128cac +.word playermgrGetModelOfWeapon+0x1b8 # f128cac glabel var7f1b5214 -.word weaponGetModel+0x1c0 # f128cb4 +.word playermgrGetModelOfWeapon+0x1c0 # f128cb4 glabel var7f1b5218 -.word weaponGetModel+0x148 # f128c3c +.word playermgrGetModelOfWeapon+0x148 # f128c3c glabel var7f1b521c -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b5220 -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b5224 -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b5228 -.word weaponGetModel+0x1e0 # f128cd4 +.word playermgrGetModelOfWeapon+0x1e0 # f128cd4 glabel var7f1b522c -.word weaponGetModel+0x180 # f128c74 +.word playermgrGetModelOfWeapon+0x180 # f128c74 .text /* f128af4: 28810052 */ slti $at,$a0,0x51 /* f128af8: 14200007 */ bnez $at,.L0f128b18 @@ -1185,7 +1181,7 @@ glabel var7f1b522c ); #endif -//s32 weaponGetModel(s32 weapon) +//s32 playermgrGetModelOfWeapon(s32 weapon) //{ // switch (weapon) { // case WEAPON_NONE: @@ -1246,18 +1242,18 @@ glabel var7f1b522c // return -1; //} -void currentPlayerSetWeaponReapable(s32 hand) +void playermgrDeleteWeapon(s32 hand) { - chrSetWeaponReapable(g_Vars.currentplayer->prop->chr, hand); + weaponDeleteFromChr(g_Vars.currentplayer->prop->chr, hand); } -void func0f128d20(s32 hand) +void playermgrCreateWeapon(s32 hand) { struct chrdata *chr = g_Vars.currentplayer->prop->chr; if (chr->weapons_held[hand] == NULL) { s32 weaponnum = bgunGetWeaponNum(hand); - s32 modelnum = weaponGetModel(weaponnum); + s32 modelnum = playermgrGetModelOfWeapon(weaponnum); if (hand == HAND_LEFT && weaponnum == WEAPON_REMOTEMINE) { modelnum = -1; @@ -1269,7 +1265,7 @@ void func0f128d20(s32 hand) if (hand == HAND_RIGHT) { flags = 0; } else { - flags = 0x10000000; + flags = OBJFLAG_WEAPON_LEFTHANDED; } weaponCreateForChr(chr, modelnum, weaponnum, flags, NULL, NULL); @@ -1277,7 +1273,7 @@ void func0f128d20(s32 hand) } } -void randomisePlayerOrder(void) +void playermgrShuffle(void) { s32 i; @@ -1296,37 +1292,37 @@ void randomisePlayerOrder(void) } } -u32 calculatePlayerIndex(u32 playernum) +s32 playermgrGetOrderOfPlayer(s32 playernum) { - u32 count = 0; - u32 i; + s32 index = 0; + s32 i; for (i = 0; i < 4; i++) { - u32 thisnum = g_Vars.playerorder[i]; + s32 thisnum = g_Vars.playerorder[i]; if (playernum == thisnum) { break; } if (g_Vars.players[thisnum]) { - count++; + index++; } } - return count; + return index; } -s32 getPlayerByOrderNum(s32 arg0) +s32 playermgrGetPlayerAtOrder(s32 ordernum) { s32 i; for (i = 0; i < 4; i++) { if (g_Vars.players[g_Vars.playerorder[i]]) { - if (arg0 == 0) { + if (ordernum == 0) { return g_Vars.playerorder[i]; } - arg0--; + ordernum--; } } diff --git a/src/game/prop.c b/src/game/prop.c index fd3b72a61..df1a9aacd 100644 --- a/src/game/prop.c +++ b/src/game/prop.c @@ -15,7 +15,7 @@ #include "game/game_0b3350.h" #include "game/game_0b4950.h" #include "game/player.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/explosions/explosions.h" #include "game/smoke/smoke.h" #include "game/sparks/sparks.h" @@ -730,7 +730,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc if (prop) { if (prop->type == PROPTYPE_CHR - || (prop->type == PROPTYPE_PLAYER && prop->chr && propGetPlayerNum(prop) != g_Vars.currentplayernum)) { + || (prop->type == PROPTYPE_PLAYER && prop->chr && playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum)) { if (!shortrange) { chr0f027994(prop, &shotdata, arg1, arg8); } @@ -1155,7 +1155,7 @@ void handInflictCloseRangeDamage(s32 handnum, struct gset *gset, bool arg2) } if (prop->type == PROPTYPE_CHR - || (prop->type == PROPTYPE_PLAYER && prop->chr && propGetPlayerNum(prop) != g_Vars.currentplayernum) + || (prop->type == PROPTYPE_PLAYER && prop->chr && playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum) || isbreakableobj) { f32 rangelimit = 60; f32 distance; @@ -5431,7 +5431,7 @@ void farsightChooseTarget(void) if (prop && prop->chr) { if (prop->type == PROPTYPE_CHR && (prop->flags & PROPFLAG_ENABLED) - || (prop->type == PROPTYPE_PLAYER && propGetPlayerNum(prop) != g_Vars.currentplayernum)) { + || (prop->type == PROPTYPE_PLAYER && playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum)) { struct chrdata *chr = prop->chr; if ((chr->chrflags & CHRCFLAG_UNEXPLODABLE) == 0 @@ -5441,7 +5441,7 @@ void farsightChooseTarget(void) && chr->actiontype != ACT_DRUGGEDKO && chr->actiontype != ACT_DEAD && (chr->hidden & CHRHFLAG_CLOAKED) == 0 - && (prop->type != PROPTYPE_PLAYER || !g_Vars.players[propGetPlayerNum(prop)]->isdead)) { + && (prop->type != PROPTYPE_PLAYER || !g_Vars.players[playermgrGetPlayerNumByProp(prop)]->isdead)) { f32 xdist = g_Vars.currentplayer->bond2.unk10.x - prop->pos.x; f32 ydist = g_Vars.currentplayer->bond2.unk10.y - prop->pos.y; f32 zdist = g_Vars.currentplayer->bond2.unk10.z - prop->pos.z; @@ -5603,7 +5603,7 @@ void autoaimTick(void) if (prop && prop->chr) { if (prop->type == PROPTYPE_CHR - || (prop->type == PROPTYPE_PLAYER && propGetPlayerNum(prop) != g_Vars.currentplayernum)) { + || (prop->type == PROPTYPE_PLAYER && playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum)) { chr = prop->chr; if (!chrCompareTeams(g_Vars.currentplayer->prop->chr, chr, COMPARE_FRIENDS) @@ -5714,7 +5714,7 @@ bool propIsOfCdType(struct prop *prop, u32 types) if ((types & CDTYPE_PLAYERS) == 0) { result = false; } else { - struct player *player = g_Vars.players[propGetPlayerNum(prop)]; + struct player *player = g_Vars.players[playermgrGetPlayerNumByProp(prop)]; if (!player->bondperimenabled || (g_Vars.mplayerisrunning && player->isdead)) { result = false; diff --git a/src/game/propobj.c b/src/game/propobj.c index c4f1da423..24ff0be0d 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -32,7 +32,7 @@ #include "game/hudmsg.h" #include "game/menu.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1291b0.h" #include "game/game_129210.h" #include "game/explosions/explosions.h" @@ -7813,7 +7813,7 @@ glabel func0f06c8ac /* f06cb20: 24010006 */ addiu $at,$zero,0x6 /* f06cb24: 5441003a */ bnel $v0,$at,.L0f06cc10 /* f06cb28: 92080000 */ lbu $t0,0x0($s0) -/* f06cb2c: 0fc4a25f */ jal propGetPlayerNum +/* f06cb2c: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f06cb30: 02002025 */ or $a0,$s0,$zero /* f06cb34: 00025080 */ sll $t2,$v0,0x2 /* f06cb38: 026a5821 */ addu $t3,$s3,$t2 @@ -7826,7 +7826,7 @@ glabel func0f06c8ac /* f06cb50: 24010006 */ addiu $at,$zero,0x6 /* f06cb54: 1441000e */ bne $v0,$at,.L0f06cb90 /* f06cb58: 8e110004 */ lw $s1,0x4($s0) -/* f06cb5c: 0fc4a25f */ jal propGetPlayerNum +/* f06cb5c: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f06cb60: 02002025 */ or $a0,$s0,$zero /* f06cb64: 00027080 */ sll $t6,$v0,0x2 /* f06cb68: 026e7821 */ addu $t7,$s3,$t6 @@ -7877,7 +7877,7 @@ glabel func0f06c8ac /* f06cc10: 24010006 */ addiu $at,$zero,0x6 /* f06cc14: 55010015 */ bnel $t0,$at,.L0f06cc6c /* f06cc18: 86a20002 */ lh $v0,0x2($s5) -/* f06cc1c: 0fc4a25f */ jal propGetPlayerNum +/* f06cc1c: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f06cc20: 02002025 */ or $a0,$s0,$zero /* f06cc24: 00024880 */ sll $t1,$v0,0x2 /* f06cc28: 02695021 */ addu $t2,$s3,$t1 @@ -13206,7 +13206,7 @@ glabel var7f1aa2c4 /* f06fd30: 8c4400bc */ lw $a0,0xbc($v0) /* f06fd34: 5080000a */ beqzl $a0,.L0f06fd60 /* f06fd38: 8da202a0 */ lw $v0,0x2a0($t5) -/* f06fd3c: 0fc4a25f */ jal propGetPlayerNum +/* f06fd3c: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f06fd40: 00000000 */ nop /* f06fd44: 3c058007 */ lui $a1,%hi(g_PlayersDetonatingMines) /* f06fd48: 3c0d800a */ lui $t5,%hi(g_Vars) @@ -13221,7 +13221,7 @@ glabel var7f1aa2c4 /* f06fd68: 8c4400bc */ lw $a0,0xbc($v0) /* f06fd6c: 5080000a */ beqzl $a0,.L0f06fd98 /* f06fd70: 8cb90000 */ lw $t9,0x0($a1) -/* f06fd74: 0fc4a25f */ jal propGetPlayerNum +/* f06fd74: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f06fd78: afa30170 */ sw $v1,0x170($sp) /* f06fd7c: 8fa30170 */ lw $v1,0x170($sp) /* f06fd80: 24180001 */ addiu $t8,$zero,0x1 @@ -14415,7 +14415,7 @@ glabel var7f1aa2c4 /* f06fd30: 8c4400bc */ lw $a0,0xbc($v0) /* f06fd34: 5080000a */ beqzl $a0,.L0f06fd60 /* f06fd38: 8da202a0 */ lw $v0,0x2a0($t5) -/* f06fd3c: 0fc4a25f */ jal propGetPlayerNum +/* f06fd3c: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f06fd40: 00000000 */ nop /* f06fd44: 3c058007 */ lui $a1,%hi(g_PlayersDetonatingMines) /* f06fd48: 3c0d800a */ lui $t5,%hi(g_Vars) @@ -14430,7 +14430,7 @@ glabel var7f1aa2c4 /* f06fd68: 8c4400bc */ lw $a0,0xbc($v0) /* f06fd6c: 5080000a */ beqzl $a0,.L0f06fd98 /* f06fd70: 8cb90000 */ lw $t9,0x0($a1) -/* f06fd74: 0fc4a25f */ jal propGetPlayerNum +/* f06fd74: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f06fd78: afa30170 */ sw $v1,0x170($sp) /* f06fd7c: 8fa30170 */ lw $v1,0x170($sp) /* f06fd80: 24180001 */ addiu $t8,$zero,0x1 @@ -15410,7 +15410,7 @@ glabel var7f1aa2c4 /* f06ecc4: 8c4400bc */ lw $a0,0xbc($v0) /* f06ecc8: 10800008 */ beqz $a0,.NB0f06ecec /* f06eccc: 00000000 */ sll $zero,$zero,0x0 -/* f06ecd0: 0fc48d6f */ jal propGetPlayerNum +/* f06ecd0: 0fc48d6f */ jal playermgrGetPlayerNumByProp /* f06ecd4: afa70170 */ sw $a3,0x170($sp) /* f06ecd8: 3c058007 */ lui $a1,0x8007 /* f06ecdc: 240e0001 */ addiu $t6,$zero,0x1 @@ -15426,7 +15426,7 @@ glabel var7f1aa2c4 /* f06ed00: 5080000c */ beqzl $a0,.NB0f06ed34 /* f06ed04: 8cad0000 */ lw $t5,0x0($a1) /* f06ed08: afa30144 */ sw $v1,0x144($sp) -/* f06ed0c: 0fc48d6f */ jal propGetPlayerNum +/* f06ed0c: 0fc48d6f */ jal playermgrGetPlayerNumByProp /* f06ed10: afa70170 */ sw $a3,0x170($sp) /* f06ed14: 8fa30144 */ lw $v1,0x144($sp) /* f06ed18: 240a0001 */ addiu $t2,$zero,0x1 @@ -16093,11 +16093,11 @@ glabel var7f1aa2c4 // u32 mask = 0; // // if (g_Vars.coop && g_Vars.coop->prop) { -// mask |= 1 << propGetPlayerNum(g_Vars.coop->prop); +// mask |= 1 << playermgrGetPlayerNumByProp(g_Vars.coop->prop); // } // // if (g_Vars.bond && g_Vars.bond->prop) { -// mask |= 1 << propGetPlayerNum(g_Vars.bond->prop); +// mask |= 1 << playermgrGetPlayerNumByProp(g_Vars.bond->prop); // } // // g_PlayersDetonatingMines &= mask; @@ -24928,7 +24928,7 @@ glabel var7f1ab6dcpf /* f075fb0: 2627005c */ addiu $a3,$s1,0x5c /* f075fb4: 8f18a79c */ lw $t8,-0x5864($t8) /* f075fb8: afa70070 */ sw $a3,0x70($sp) -/* f075fbc: 0fc4a513 */ jal propGetPlayerNum +/* f075fbc: 0fc4a513 */ jal playermgrGetPlayerNumByProp /* f075fc0: afb80164 */ sw $t8,0x164($sp) /* f075fc4: 0fc4a4ff */ jal setCurrentPlayerNum /* f075fc8: 00402025 */ move $a0,$v0 @@ -24976,7 +24976,7 @@ glabel var7f1ab6dcpf /* f076064: 1441000e */ bne $v0,$at,.PF0f0760a0 /* f076068: 00000000 */ nop /* f07606c: afa6015c */ sw $a2,0x15c($sp) -/* f076070: 0fc4a513 */ jal propGetPlayerNum +/* f076070: 0fc4a513 */ jal playermgrGetPlayerNumByProp /* f076074: afa70070 */ sw $a3,0x70($sp) /* f076078: 00025880 */ sll $t3,$v0,0x2 /* f07607c: 3c0f800a */ lui $t7,0x800a @@ -28466,7 +28466,7 @@ glabel var7f1aa438 /* f075d2c: 2627005c */ addiu $a3,$s1,0x5c /* f075d30: 8f18a24c */ lw $t8,%lo(g_Vars+0x28c)($t8) /* f075d34: afa70070 */ sw $a3,0x70($sp) -/* f075d38: 0fc4a25f */ jal propGetPlayerNum +/* f075d38: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f075d3c: afb80164 */ sw $t8,0x164($sp) /* f075d40: 0fc4a24b */ jal setCurrentPlayerNum /* f075d44: 00402025 */ or $a0,$v0,$zero @@ -28514,7 +28514,7 @@ glabel var7f1aa438 /* f075de0: 1441000e */ bne $v0,$at,.L0f075e1c /* f075de4: 00000000 */ nop /* f075de8: afa6015c */ sw $a2,0x15c($sp) -/* f075dec: 0fc4a25f */ jal propGetPlayerNum +/* f075dec: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f075df0: afa70070 */ sw $a3,0x70($sp) /* f075df4: 00025880 */ sll $t3,$v0,0x2 /* f075df8: 3c0f800a */ lui $t7,%hi(g_Vars+0x64) @@ -31969,7 +31969,7 @@ glabel var7f1aa438 /* f074a5c: 2627005c */ addiu $a3,$s1,0x5c /* f074a60: 8f18e94c */ lw $t8,-0x16b4($t8) /* f074a64: afa70060 */ sw $a3,0x60($sp) -/* f074a68: 0fc48d6f */ jal propGetPlayerNum +/* f074a68: 0fc48d6f */ jal playermgrGetPlayerNumByProp /* f074a6c: afb80164 */ sw $t8,0x164($sp) /* f074a70: 0fc48d5b */ jal setCurrentPlayerNum /* f074a74: 00402025 */ or $a0,$v0,$zero @@ -32017,7 +32017,7 @@ glabel var7f1aa438 /* f074b10: 1441000e */ bne $v0,$at,.NB0f074b4c /* f074b14: 00000000 */ sll $zero,$zero,0x0 /* f074b18: afa6015c */ sw $a2,0x15c($sp) -/* f074b1c: 0fc48d6f */ jal propGetPlayerNum +/* f074b1c: 0fc48d6f */ jal playermgrGetPlayerNumByProp /* f074b20: afa70060 */ sw $a3,0x60($sp) /* f074b24: 00027880 */ sll $t7,$v0,0x2 /* f074b28: 3c19800a */ lui $t9,0x800a @@ -33730,7 +33730,7 @@ glabel var7f1aa454 .L0f077940: /* f077940: 1441009e */ bne $v0,$at,.L0f077bbc /* f077944: 02202025 */ or $a0,$s1,$zero -/* f077948: 0fc4a25f */ jal propGetPlayerNum +/* f077948: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f07794c: 8fd40004 */ lw $s4,0x4($s8) /* f077950: 928e0003 */ lbu $t6,0x3($s4) /* f077954: 24010030 */ addiu $at,$zero,0x30 @@ -34116,7 +34116,7 @@ glabel var7f1aa454 .L0f077940: /* f077940: 1441009e */ bne $v0,$at,.L0f077bbc /* f077944: 02202025 */ or $a0,$s1,$zero -/* f077948: 0fc4a25f */ jal propGetPlayerNum +/* f077948: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f07794c: 8fd40004 */ lw $s4,0x4($s8) /* f077950: 928e0003 */ lbu $t6,0x3($s4) /* f077954: 24010030 */ addiu $at,$zero,0x30 @@ -34499,7 +34499,7 @@ glabel var7f1aa454 .NB0f076538: /* f076538: 1441005a */ bne $v0,$at,.NB0f0766a4 /* f07653c: 02202025 */ or $a0,$s1,$zero -/* f076540: 0fc48d6f */ jal propGetPlayerNum +/* f076540: 0fc48d6f */ jal playermgrGetPlayerNumByProp /* f076544: 8ef00004 */ lw $s0,0x4($s7) /* f076548: 920e0003 */ lbu $t6,0x3($s0) /* f07654c: 24010030 */ addiu $at,$zero,0x30 @@ -35824,7 +35824,7 @@ glabel var7f1aa580 /* f079554: afa30044 */ sw $v1,0x44($sp) /* f079558: afa800ac */ sw $t0,0xac($sp) /* f07955c: e7a00048 */ swc1 $f0,0x48($sp) -/* f079560: 0fc4a25f */ jal propGetPlayerNum +/* f079560: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f079564: e7b200a4 */ swc1 $f18,0xa4($sp) /* f079568: 3c09800a */ lui $t1,%hi(g_Vars) /* f07956c: 25299fc0 */ addiu $t1,$t1,%lo(g_Vars) @@ -37046,7 +37046,7 @@ glabel var7f1aa580 /* f079554: afa30044 */ sw $v1,0x44($sp) /* f079558: afa800ac */ sw $t0,0xac($sp) /* f07955c: e7a00048 */ swc1 $f0,0x48($sp) -/* f079560: 0fc4a25f */ jal propGetPlayerNum +/* f079560: 0fc4a25f */ jal playermgrGetPlayerNumByProp /* f079564: e7b200a4 */ swc1 $f18,0xa4($sp) /* f079568: 3c09800a */ lui $t1,%hi(g_Vars) /* f07956c: 25299fc0 */ addiu $t1,$t1,%lo(g_Vars) @@ -49523,7 +49523,7 @@ s32 objTick(struct prop *prop) if (obj->hidden & OBJHFLAG_AIRBORNE) { struct projectile *projectile = obj->projectile; - if (projectile->ownerprop && propGetPlayerNum(projectile->ownerprop) >= 0) { + if (projectile->ownerprop && playermgrGetPlayerNumByProp(projectile->ownerprop) >= 0) { fulltick = (projectile->ownerprop == g_Vars.currentplayer->prop); } } @@ -49885,7 +49885,7 @@ Gfx *propsRenderBeams(Gfx *gdl) gdl = func0f0acb90(gdl, chopper->fireslotthing->beam, true, true); } } else if (prop->type == PROPTYPE_PLAYER) { - if (prop->chr && propGetPlayerNum(prop) != g_Vars.currentplayernum) { + if (prop->chr && playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum) { struct chrdata *chr = prop->chr; if (chr->fireslots[0] >= 0) { @@ -65721,7 +65721,7 @@ struct autogunobj *laptopDeploy(s32 modelnum, struct gset *gset, struct chrdata if (g_Vars.normmplayerisrunning) { index = mpPlayerGetIndex(chr); } else { - index = propGetPlayerNum(chr->prop); + index = playermgrGetPlayerNumByProp(chr->prop); } if (index >= 0 && index < g_MaxThrownLaptops) { @@ -65802,7 +65802,7 @@ struct autogunobj *laptopDeploy(s32 modelnum, struct gset *gset, struct chrdata s32 qty; s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(propGetPlayerNum(chr->prop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(chr->prop)); qty = bgunGetAmmoQtyForWeapon(WEAPON_LAPTOPGUN, FUNC_PRIMARY); if (qty >= 200) { @@ -66336,7 +66336,7 @@ struct weaponobj *func0f08b880(s32 modelnum, s32 weaponnum, struct chrdata *chr) return func0f08b658(modelnum, &gset, chr); } -void chrSetWeaponReapable(struct chrdata *chr, s32 hand) +void weaponDeleteFromChr(struct chrdata *chr, s32 hand) { if (chr && chr->weapons_held[hand]) { struct defaultobj *obj = chr->weapons_held[hand]->obj; @@ -66440,7 +66440,7 @@ struct prop *chrGiveWeapon(struct chrdata *chr, s32 model, s32 weaponnum, u32 fl struct prop *chrGiveWeaponWithAutoModel(struct chrdata *chr, s32 weaponnum, u32 flags) { - return weaponCreateForChr(chr, weaponGetModel(weaponnum), weaponnum, flags, NULL, NULL); + return weaponCreateForChr(chr, playermgrGetModelOfWeapon(weaponnum), weaponnum, flags, NULL, NULL); } s32 weaponTestForPickup(struct prop *prop) @@ -69664,11 +69664,11 @@ void currentPlayerDropAllItems(void) struct chrdata *chr = g_Vars.currentplayer->prop->chr; s32 i; - chrSetWeaponReapable(chr, HAND_RIGHT); - chrSetWeaponReapable(chr, HAND_LEFT); + weaponDeleteFromChr(chr, HAND_RIGHT); + weaponDeleteFromChr(chr, HAND_LEFT); for (i = WEAPON_UNARMED; i <= WEAPON_SUICIDEPILL; i++) { - if (weaponGetModel(i) >= 0 && invHasSingleWeaponExcAllGuns(i)) { + if (playermgrGetModelOfWeapon(i) >= 0 && invHasSingleWeaponExcAllGuns(i)) { if (!weaponHasFlag(i, WEAPONFLAG_08000000) || (g_Vars.normmplayerisrunning && g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL @@ -69743,7 +69743,7 @@ void weaponCreateForPlayerDrop(s32 weaponnum) u32 stack2; chr = g_Vars.currentplayer->prop->chr; - prop = weaponCreateForChr(chr, weaponGetModel(weaponnum), weaponnum, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL); + prop = weaponCreateForChr(chr, playermgrGetModelOfWeapon(weaponnum), weaponnum, OBJFLAG_WEAPON_AICANNOTUSE, NULL, NULL); if (prop) { objSetDropped(prop, DROPTYPE_DEFAULT); diff --git a/src/game/title.c b/src/game/title.c index e49bcd4e7..a670ab0be 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -6,7 +6,7 @@ #include "game/game_0b28d0.h" #include "game/game_0b3350.h" #include "game/inventory/inventory.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/gfxmemory.h" #include "game/credits.h" #include "game/bondview.h" @@ -5242,7 +5242,7 @@ void titleInitSkip(void) viSetAspect(PAL ? 1.7316017150879f : 1.4545454978943f); viSetSize(320, 220); viSetBufSize(320, 220); - currentPlayerSetViewSize(320, 220); + playermgrSetViewSize(320, 220); viSetViewSize(320, 220); } @@ -5547,9 +5547,9 @@ void titleTick(void) #endif viSetSize(576, g_TitleViewHeight); viSetBufSize(576, g_TitleViewHeight); - currentPlayerSetViewSize(576, g_TitleViewHeight); + playermgrSetViewSize(576, g_TitleViewHeight); viSetViewSize(576, g_TitleViewHeight); - currentPlayerSetViewPosition(0, 0); + playermgrSetViewPosition(0, 0); viSetViewPosition(0, 0); // If there's a new mode to transition to, schedule it to apply in 3 ticks @@ -5761,9 +5761,9 @@ void func0f01adb8(void) viSetMode(VIMODE_HI); viSetSize(576, g_TitleViewHeight); viSetBufSize(576, g_TitleViewHeight); - currentPlayerSetViewSize(576, g_TitleViewHeight); + playermgrSetViewSize(576, g_TitleViewHeight); viSetViewSize(576, g_TitleViewHeight); - currentPlayerSetViewPosition(0, 0); + playermgrSetViewPosition(0, 0); viSetViewPosition(0, 0); } diff --git a/src/game/wallhit.c b/src/game/wallhit.c index 3d201f651..97ffd5cee 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -4,7 +4,7 @@ #include "game/chr/chr.h" #include "game/game_0b0fd0.h" #include "game/game_0b3350.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1668e0.h" #include "game/gfxmemory.h" #include "game/file.h" @@ -325,7 +325,7 @@ bool chrIsUsingPaintball(struct chrdata *chr) bool paintball; if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - setCurrentPlayerNum(propGetPlayerNum(chr->prop)); + setCurrentPlayerNum(playermgrGetPlayerNumByProp(chr->prop)); } else { setCurrentPlayerNum(random() % PLAYERCOUNT()); } diff --git a/src/include/game/game_127910.h b/src/include/game/game_127910.h deleted file mode 100644 index 201e1f2f7..000000000 --- a/src/include/game/game_127910.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _IN_GAME_GAME_127910_H -#define _IN_GAME_GAME_127910_H -#include -#include "data.h" -#include "types.h" - -void func0f127910(void); -void playersUnrefAll(void); -void playersAllocate(s32 count); -void playerAllocate(s32 index); -void currentPlayerCalculateAiBuddyNums(void); -s32 propGetPlayerNum(struct prop *prop); -void currentPlayerSetViewSize(s32 viewx, s32 viewy); -void currentPlayerSetViewPosition(s32 viewleft, s32 viewtop); -void currentPlayerSetFovY(f32 fovy); -void currentPlayerSetAspectRatio(f32 aspect); -s32 weaponGetModel(s32 weapon); -void currentPlayerSetWeaponReapable(s32 hand); -void func0f128d20(s32 hand); -void randomisePlayerOrder(void); -s32 getPlayerByOrderNum(s32 arg0); -void setCurrentPlayerNum(s32 playernum); -u32 calculatePlayerIndex(u32 playernum); - -#endif diff --git a/src/include/game/playermgr.h b/src/include/game/playermgr.h new file mode 100644 index 000000000..1981597b8 --- /dev/null +++ b/src/include/game/playermgr.h @@ -0,0 +1,25 @@ +#ifndef _IN_GAME_PLAYERMGR_H +#define _IN_GAME_PLAYERMGR_H +#include +#include "data.h" +#include "types.h" + +void playermgrInit(void); +void playermgrReset(void); +void playermgrAllocatePlayers(s32 count); +void playermgrAllocatePlayer(s32 index); +void playermgrCalculateAiBuddyNums(void); +void setCurrentPlayerNum(s32 playernum); +s32 playermgrGetPlayerNumByProp(struct prop *prop); +void playermgrSetViewSize(s32 viewx, s32 viewy); +void playermgrSetViewPosition(s32 viewleft, s32 viewtop); +void playermgrSetFovY(f32 fovy); +void playermgrSetAspectRatio(f32 aspect); +s32 playermgrGetModelOfWeapon(s32 weapon); +void playermgrDeleteWeapon(s32 hand); +void playermgrCreateWeapon(s32 hand); +void playermgrShuffle(void); +s32 playermgrGetOrderOfPlayer(s32 playernum); +s32 playermgrGetPlayerAtOrder(s32 ordernum); + +#endif diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index e39835f58..7f6397126 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -287,7 +287,7 @@ void func0f08b25c(struct weaponobj *weapon, struct chrdata *chr); struct autogunobj *laptopDeploy(s32 modelnum, struct gset *gset, struct chrdata *chr); struct weaponobj *func0f08b658(s32 modelnum, struct gset *gset, struct chrdata *chr); struct weaponobj *func0f08b880(s32 modelnum, s32 weaponnum, struct chrdata *chr); -void chrSetWeaponReapable(struct chrdata *chr, s32 hand); +void weaponDeleteFromChr(struct chrdata *chr, s32 hand); struct prop *weaponCreateForChr(struct chrdata *chr, s32 modelnum, s32 weaponnum, u32 flags, struct weaponobj *obj, struct modelfiledata *filedata); struct prop *chrGiveWeapon(struct chrdata *chr, s32 model, s32 weaponnum, u32 flags); s32 weaponTestForPickup(struct prop *prop); diff --git a/src/lib/main.c b/src/lib/main.c index 31dbedc98..ef40d25b5 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -26,7 +26,7 @@ #include "game/game_01b0a0.h" #include "game/objectives.h" #include "game/endscreen.h" -#include "game/game_127910.h" +#include "game/playermgr.h" #include "game/game_1531a0.h" #include "game/gfxmemory.h" #include "game/lv.h" @@ -632,7 +632,7 @@ glabel mainInit /* d740: 00000000 */ nop /* d744: 0c004d48 */ jal dhudInit /* d748: 00000000 */ nop -/* d74c: 0fc4a0f8 */ jal func0f127910 +/* d74c: 0fc4a0f8 */ jal playermgrInit /* d750: 00000000 */ nop /* d754: 0fc5b718 */ jal frametimeInit /* d758: 00000000 */ nop @@ -1035,7 +1035,7 @@ glabel mainInit /* da04: 00000000 */ nop /* da08: 0c004de4 */ jal dhudInit /* da0c: 00000000 */ nop -/* da10: 0fc49e44 */ jal func0f127910 +/* da10: 0fc49e44 */ jal playermgrInit /* da14: 00000000 */ nop /* da18: 0fc5b384 */ jal frametimeInit /* da1c: 00000000 */ nop @@ -1408,7 +1408,7 @@ glabel mainInit /* df14: 00000000 */ sll $zero,$zero,0x0 /* df18: 0c005002 */ jal dhudInit /* df1c: 00000000 */ sll $zero,$zero,0x0 -/* df20: 0fc48954 */ jal func0f127910 +/* df20: 0fc48954 */ jal playermgrInit /* df24: 00000000 */ sll $zero,$zero,0x0 /* df28: 0fc59ef0 */ jal frametimeInit /* df2c: 00000000 */ sll $zero,$zero,0x0 @@ -1651,7 +1651,7 @@ const char var70053aa0[] = " -ml0 -me0 -mgfx100 -mvtx50 -mt700 -ma400"; // func0000e9c0(); // func0f1531a0(); // dhudInit(); -// func0f127910(); +// playermgrInit(); // frametimeInit(); // stub0f00b200(); // profileInit(); @@ -1876,7 +1876,7 @@ void mainLoop(void) memaHeapInit(mempAlloc(g_MainMemaHeapSize, MEMPOOL_STAGE), g_MainMemaHeapSize); stageLoadCommonLang(g_StageNum); - playersUnrefAll(); + playermgrReset(); if (g_StageNum >= STAGE_TITLE) { numplayers = 0; @@ -1906,7 +1906,7 @@ void mainLoop(void) g_Vars.antiplayernum = 1; } - playersAllocate(numplayers); + playermgrAllocatePlayers(numplayers); if (argFindByPrefix(1, "-mpbots")) { g_Vars.lvmpbotlevel = 1; @@ -2329,7 +2329,7 @@ glabel mainLoop /* e500: 3c048006 */ lui $a0,0x8006 /* e504: 0fc02bf4 */ jal stageLoadCommonLang /* e508: 8c84f2d4 */ lw $a0,-0xd2c($a0) -/* e50c: 0fc48964 */ jal playersUnrefAll +/* e50c: 0fc48964 */ jal playermgrReset /* e510: 00000000 */ sll $zero,$zero,0x0 /* e514: 3c098006 */ lui $t1,0x8006 /* e518: 8d29f2d4 */ lw $t1,-0xd2c($t1) @@ -2393,7 +2393,7 @@ glabel mainLoop /* e5e8: ae560298 */ sw $s6,0x298($s2) /* e5ec: ae57029c */ sw $s7,0x29c($s2) .NB0000e5f0: -/* e5f0: 0fc48979 */ jal playersAllocate +/* e5f0: 0fc48979 */ jal playermgrAllocatePlayers /* e5f4: 02202025 */ or $a0,$s1,$zero /* e5f8: 3c057005 */ lui $a1,0x7005 /* e5fc: 24a5515c */ addiu $a1,$a1,0x515c @@ -2630,11 +2630,11 @@ void mainTick(void) gDPSetTile(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_4b, 0, 0x0100, 6, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); lvTick(); - randomisePlayerOrder(); + playermgrShuffle(); if (g_StageNum < STAGE_TITLE) { for (i = 0; i < PLAYERCOUNT(); i++) { - setCurrentPlayerNum(getPlayerByOrderNum(i)); + setCurrentPlayerNum(playermgrGetPlayerAtOrder(i)); if (g_StageNum != STAGE_TEST_OLD || !titleIsKeepingMode()) { viSetViewPosition(g_Vars.currentplayer->viewleft, g_Vars.currentplayer->viewtop); @@ -2812,7 +2812,7 @@ glabel mainTick .NB0000eb00: /* eb00: 0fc599c9 */ jal lvTick /* eb04: 00000000 */ sll $zero,$zero,0x0 -/* eb08: 0fc48e7f */ jal randomisePlayerOrder +/* eb08: 0fc48e7f */ jal playermgrShuffle /* eb0c: 00000000 */ sll $zero,$zero,0x0 /* eb10: 3c198006 */ lui $t9,0x8006 /* eb14: 8f39f2d4 */ lw $t9,-0xd2c($t9) @@ -2855,7 +2855,7 @@ glabel mainTick /* eb98: 19600038 */ blez $t3,.NB0000ec7c /* eb9c: 00000000 */ sll $zero,$zero,0x0 .NB0000eba0: -/* eba0: 0fc48ec2 */ jal getPlayerByOrderNum +/* eba0: 0fc48ec2 */ jal playermgrGetPlayerAtOrder /* eba4: 02202025 */ or $a0,$s1,$zero /* eba8: 0fc48d5b */ jal setCurrentPlayerNum /* ebac: 00402025 */ or $a0,$v0,$zero @@ -3109,11 +3109,11 @@ u32 var8005f690nb[] = { // } // // lvTick(); -// randomisePlayerOrder(); +// playermgrShuffle(); // // if (g_StageNum < STAGE_TITLE) { // for (i = 0; i < PLAYERCOUNT(); i++) { -// setCurrentPlayerNum(getPlayerByOrderNum(i)); +// setCurrentPlayerNum(playermgrGetPlayerAtOrder(i)); // // if (g_StageNum != STAGE_TEST_OLD || !titleIsKeepingMode()) { // viSetViewPosition(g_Vars.currentplayer->viewleft, g_Vars.currentplayer->viewtop);