From ae3cf01dd2701988ffdb22bbb3275f04f675f8c8 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 2 Jan 2021 19:11:36 +1000 Subject: [PATCH] Rename inventory files and functions --- ld/gamefiles.inc | 6 +- src/game/activemenu/activemenu.c | 36 ++-- src/game/activemenu/tick.c | 4 +- src/game/bondeyespy.c | 4 +- src/game/bondmove.c | 49 ++--- src/game/bondwalk.c | 4 +- src/game/cheats.c | 6 +- src/game/chr/chraction.c | 4 +- src/game/chr/chraicommands.c | 31 ++- src/game/core.c | 8 +- src/game/game_00c490.c | 8 +- src/game/game_0109d0.c | 2 +- src/game/game_011110.c | 96 ++++----- src/game/game_01b0a0.c | 2 +- src/game/game_0601b0.c | 12 +- src/game/game_095320.c | 6 +- src/game/game_097ba0.c | 70 +++---- src/game/game_0abe70.c | 4 +- src/game/game_0b0420.c | 6 +- src/game/game_0b63b0.c | 44 ++-- src/game/game_0d7070.c | 2 +- src/game/game_102240.c | 18 +- src/game/game_127910.c | 14 +- src/game/game_157db0.c | 2 +- src/game/game_1a7560.c | 2 +- src/game/{game_012450.c => inventory/init.c} | 12 +- .../{game_111600.c => inventory/inventory.c} | 192 +++++++++--------- .../{data/inventory.c => inventory/items.c} | 2 +- src/game/mplayer/options.c | 12 +- src/game/mplayer/scenarios.c | 16 +- src/game/propobj.c | 98 ++++----- src/game/title.c | 4 +- src/game/training/menus.c | 12 +- src/game/training/training.c | 10 +- src/include/game/game_012450.h | 9 - src/include/game/game_097ba0.h | 2 +- src/include/game/game_111600.h | 51 ----- src/include/game/game_127910.h | 4 +- src/include/game/inventory/init.h | 9 + src/include/game/inventory/inventory.h | 51 +++++ .../{data/inventory.h => inventory/items.h} | 4 +- src/include/game/propobj.h | 2 +- src/include/types.h | 4 +- 43 files changed, 467 insertions(+), 467 deletions(-) rename src/game/{game_012450.c => inventory/init.c} (80%) rename src/game/{game_111600.c => inventory/inventory.c} (89%) rename src/game/{data/inventory.c => inventory/items.c} (99%) delete mode 100644 src/include/game/game_012450.h delete mode 100644 src/include/game/game_111600.h create mode 100644 src/include/game/inventory/init.h create mode 100644 src/include/game/inventory/inventory.h rename src/include/game/{data/inventory.h => inventory/items.h} (73%) diff --git a/ld/gamefiles.inc b/ld/gamefiles.inc index a6a1e137d..b4056c208 100644 --- a/ld/gamefiles.inc +++ b/ld/gamefiles.inc @@ -27,7 +27,7 @@ build/ROMID/game/game_0109d0.o (section); \ build/ROMID/game/game_010b20.o (section); \ build/ROMID/game/game_011110.o (section); \ - build/ROMID/game/game_012450.o (section); \ + build/ROMID/game/inventory/init.o (section); \ build/ROMID/game/game_0125a0.o (section); \ build/ROMID/game/game_012d50.o (section); \ build/ROMID/game/explosions/init.o (section); \ @@ -73,7 +73,7 @@ build/ROMID/game/game_0601b0.o (section); \ build/ROMID/game/propobj.o (section); \ build/ROMID/game/data/data_00e460.o (section); \ - build/ROMID/game/data/inventory.o (section); \ + build/ROMID/game/inventory/items.o (section); \ build/ROMID/game/game_091e10.o (section); \ build/ROMID/game/game_092610.o (section); \ build/ROMID/game/game_095320.o (section); \ @@ -119,7 +119,7 @@ build/ROMID/game/data/data_01a3a0.o (section); \ build/ROMID/game/endscreen.o (section); \ build/ROMID/game/gamefile.o (section); \ - build/ROMID/game/game_111600.o (section); \ + build/ROMID/game/inventory/inventory.o (section); \ build/ROMID/game/bondhead.o (section); \ build/ROMID/game/padhalllv.o (section); \ build/ROMID/game/pad.o (section); \ diff --git a/src/game/activemenu/activemenu.c b/src/game/activemenu/activemenu.c index b5fa474f0..e1341a23b 100644 --- a/src/game/activemenu/activemenu.c +++ b/src/game/activemenu/activemenu.c @@ -16,7 +16,7 @@ #include "game/game_0b3350.h" #include "game/game_0d4690.h" #include "game/game_0f09f0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_1531a0.h" #include "game/game_166e40.h" #include "game/game_190260.h" @@ -616,10 +616,10 @@ void amApply(s32 slot) } invindex = g_AmMenus[g_AmIndex].invindexes[slot]; - numinvitems = currentPlayerGetNumInvItems(); + numinvitems = invGetCount(); if (invindex < numinvitems) { - weaponnum = currentPlayerGetWeaponNumByInvIndex(invindex); + weaponnum = invGetWeaponNumByIndex(invindex); pass = true; if (weaponnum) { @@ -648,22 +648,22 @@ void amApply(s32 slot) } if (pass) { - currentPlayerSetEquipCurItem(invindex); + invSetCurrentIndex(invindex); - if (func0f111cf8(weaponnum, weaponnum)) { - if (getCurrentPlayerWeaponId(HAND_RIGHT) != weaponnum) { + if (invHasDoubleWeaponIncAllGuns(weaponnum, weaponnum)) { + if (handGetWeaponNum(HAND_RIGHT) != weaponnum) { currentPlayerEquipWeaponWrapper(HAND_RIGHT, weaponnum); } - if (getCurrentPlayerWeaponId(HAND_LEFT) != weaponnum) { + if (handGetWeaponNum(HAND_LEFT) != weaponnum) { currentPlayerEquipWeaponWrapper(HAND_LEFT, weaponnum); } } else { - if (getCurrentPlayerWeaponId(HAND_RIGHT) != weaponnum) { + if (handGetWeaponNum(HAND_RIGHT) != weaponnum) { currentPlayerEquipWeaponWrapper(HAND_RIGHT, weaponnum); } - if (getCurrentPlayerWeaponId(HAND_LEFT) != WEAPON_NONE) { + if (handGetWeaponNum(HAND_LEFT) != WEAPON_NONE) { currentPlayerEquipWeaponWrapper(HAND_LEFT, WEAPON_NONE); } } @@ -727,31 +727,31 @@ void amGetSlotDetails(s32 slot, u32 *flags, char *label) slot--; } - if (currentPlayerGetEquipCurItem() == g_AmMenus[g_AmIndex].invindexes[slot]) { + if (invGetCurrentIndex() == g_AmMenus[g_AmIndex].invindexes[slot]) { *flags |= AMSLOTFLAG_CURRENT; } - if (g_AmMenus[g_AmIndex].invindexes[slot] >= currentPlayerGetNumInvItems()) { + if (g_AmMenus[g_AmIndex].invindexes[slot] >= invGetCount()) { strcpy(label, ""); } else { - if (currentPlayerGetWeaponNumByInvIndex(g_AmMenus[g_AmIndex].invindexes[slot]) == WEAPON_CLOAKINGDEVICE) { + if (invGetWeaponNumByIndex(g_AmMenus[g_AmIndex].invindexes[slot]) == WEAPON_CLOAKINGDEVICE) { // Special case: "Cloak %d" qty = ammoGetQuantity(AMMOTYPE_CLOAK); secs = qty / 60; modulo = (qty - (secs * 60)) * 100 / 60; sprintf(label, langGet(L_OPTIONS(491)), secs + (modulo > 0 ? 1 : 0)); // "cloak %d" } else { - strcpy(label, currentPlayerGetInvShortNameByIndex(g_AmMenus[g_AmIndex].invindexes[slot])); + strcpy(label, invGetShortNameByIndex(g_AmMenus[g_AmIndex].invindexes[slot])); } } - weaponnum = currentPlayerGetWeaponNumByInvIndex(g_AmMenus[g_AmIndex].invindexes[slot]); + weaponnum = invGetWeaponNumByIndex(g_AmMenus[g_AmIndex].invindexes[slot]); if (currentPlayerGetDeviceState(weaponnum) == DEVICESTATE_ACTIVE) { *flags |= AMSLOTFLAG_ACTIVE; } - weaponnum = currentPlayerGetWeaponNumByInvIndex(g_AmMenus[g_AmIndex].invindexes[slot]); + weaponnum = invGetWeaponNumByIndex(g_AmMenus[g_AmIndex].invindexes[slot]); if (func0f0a1d14(weaponnum) == false) { *flags |= AMSLOTFLAG_NOAMMO; @@ -944,7 +944,7 @@ void amChangeScreen(s32 step) void amAssignWeaponSlots(void) { - s32 numitems = currentPlayerGetNumInvItems(); + s32 numitems = invGetCount(); u8 weaponnum; s32 i; s32 j; @@ -959,7 +959,7 @@ void amAssignWeaponSlots(void) // Assign favourites for (i = 0; i < numitems; i++) { - weaponnum = currentPlayerGetWeaponNumByInvIndex(i); + weaponnum = invGetWeaponNumByIndex(i); if ((weaponnum >= WEAPON_UNARMED && weaponnum <= WEAPON_DISGUISE41) || weaponnum == WEAPON_SUICIDEPILL @@ -990,7 +990,7 @@ void amAssignWeaponSlots(void) } if (!isfavourited) { - weaponnum = currentPlayerGetWeaponNumByInvIndex(i); + weaponnum = invGetWeaponNumByIndex(i); if ((weaponnum >= WEAPON_UNARMED && weaponnum <= WEAPON_DISGUISE41) || weaponnum == WEAPON_SUICIDEPILL diff --git a/src/game/activemenu/tick.c b/src/game/activemenu/tick.c index fe76fb47f..a00e3eb0c 100644 --- a/src/game/activemenu/tick.c +++ b/src/game/activemenu/tick.c @@ -11,7 +11,7 @@ #include "game/game_01b0a0.h" #include "game/game_097ba0.h" #include "game/game_0b0420.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/pdoptions.h" #include "gvars/gvars.h" @@ -37,7 +37,7 @@ void amTick(void) } if (g_Vars.normmplayerisrunning == false - && currentPlayerGetNumInvItems() != g_AmMenus[g_AmIndex].numitems) { + && invGetCount() != g_AmMenus[g_AmIndex].numitems) { amAssignWeaponSlots(); } diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index b3f97707c..df151fccb 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -15,7 +15,7 @@ #include "game/game_097ba0.h" #include "game/game_0b63b0.h" #include "game/game_0dcdb0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/game_1655c0.h" #include "game/lang.h" @@ -2231,7 +2231,7 @@ glabel var7f1adb00 /* f0d1040: e7ae00e0 */ swc1 $f14,0xe0($sp) /* f0d1044: 0fc195e9 */ jal roomsCopy /* f0d1048: 24840028 */ addiu $a0,$a0,0x28 -/* f0d104c: 0fc44727 */ jal currentPlayerCanHaveWeapon +/* f0d104c: 0fc44727 */ jal invHasSingleWeaponIncAllGuns /* f0d1050: 2404002e */ addiu $a0,$zero,0x2e /* f0d1054: 3c09800a */ lui $t1,%hi(g_Vars) /* f0d1058: 44808000 */ mtc1 $zero,$f16 diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 1275f83ab..ace621d8b 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -824,7 +824,7 @@ glabel var7f1ad8e4 /* f0c8bd4: 0fc549c4 */ jal optionsGetControlMode /* f0c8bd8: 8dc40070 */ lw $a0,0x70($t6) /* f0c8bdc: afa201b0 */ sw $v0,0x1b0($sp) -/* f0c8be0: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0c8be0: 0fc2866a */ jal handGetWeaponNum /* f0c8be4: 00002025 */ or $a0,$zero,$zero /* f0c8be8: afa201ac */ sw $v0,0x1ac($sp) /* f0c8bec: 00402025 */ or $a0,$v0,$zero @@ -1299,7 +1299,7 @@ glabel var7f1ad8e4 /* f0c9290: 1616ffe7 */ bne $s0,$s6,.L0f0c9230 /* f0c9294: ac69fffc */ sw $t1,-0x4($v1) .L0f0c9298: -/* f0c9298: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0c9298: 0fc2866a */ jal handGetWeaponNum /* f0c929c: 00002025 */ or $a0,$zero,$zero /* f0c92a0: 24010032 */ addiu $at,$zero,0x32 /* f0c92a4: 54410005 */ bnel $v0,$at,.L0f0c92bc @@ -1838,7 +1838,7 @@ glabel var7f1ad8e4 .L0f0c9a20: /* f0c9a20: afa40234 */ sw $a0,0x234($sp) .L0f0c9a24: -/* f0c9a24: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0c9a24: 0fc2866a */ jal handGetWeaponNum /* f0c9a28: 00002025 */ or $a0,$zero,$zero /* f0c9a2c: 24010016 */ addiu $at,$zero,0x16 /* f0c9a30: 54410011 */ bnel $v0,$at,.L0f0c9a78 @@ -1925,7 +1925,7 @@ glabel var7f1ad8e4 /* f0c9b48: 8e4b0284 */ lw $t3,0x284($s2) /* f0c9b4c: ad600274 */ sw $zero,0x274($t3) .L0f0c9b50: -/* f0c9b50: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0c9b50: 0fc2866a */ jal handGetWeaponNum /* f0c9b54: 00002025 */ or $a0,$zero,$zero /* f0c9b58: 00402025 */ or $a0,$v0,$zero /* f0c9b5c: 0fc2c5f0 */ jal weaponHasFlag @@ -2087,7 +2087,7 @@ glabel var7f1ad8e4 /* f0c9d90: 1616ffe5 */ bne $s0,$s6,.L0f0c9d28 /* f0c9d94: ac6ffffc */ sw $t7,-0x4($v1) .L0f0c9d98: -/* f0c9d98: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0c9d98: 0fc2866a */ jal handGetWeaponNum /* f0c9d9c: 00002025 */ or $a0,$zero,$zero /* f0c9da0: 24010032 */ addiu $at,$zero,0x32 /* f0c9da4: 54410005 */ bnel $v0,$at,.L0f0c9dbc @@ -2599,7 +2599,7 @@ glabel var7f1ad8e4 /* f0ca4e0: 0010682b */ sltu $t5,$zero,$s0 /* f0ca4e4: 01a08025 */ or $s0,$t5,$zero /* f0ca4e8: 01808825 */ or $s1,$t4,$zero -/* f0ca4ec: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0ca4ec: 0fc2866a */ jal handGetWeaponNum /* f0ca4f0: e7a000bc */ swc1 $f0,0xbc($sp) /* f0ca4f4: 24010016 */ addiu $at,$zero,0x16 /* f0ca4f8: 14410004 */ bne $v0,$at,.L0f0ca50c @@ -2747,7 +2747,7 @@ glabel var7f1ad8e4 .L0f0ca6f0: /* f0ca6f0: afa40234 */ sw $a0,0x234($sp) .L0f0ca6f4: -/* f0ca6f4: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0ca6f4: 0fc2866a */ jal handGetWeaponNum /* f0ca6f8: 00002025 */ or $a0,$zero,$zero /* f0ca6fc: 24010016 */ addiu $at,$zero,0x16 /* f0ca700: 5441000c */ bnel $v0,$at,.L0f0ca734 @@ -2830,7 +2830,7 @@ glabel var7f1ad8e4 /* f0ca810: 00000000 */ nop /* f0ca814: aca00274 */ sw $zero,0x274($a1) .L0f0ca818: -/* f0ca818: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0ca818: 0fc2866a */ jal handGetWeaponNum /* f0ca81c: 00002025 */ or $a0,$zero,$zero /* f0ca820: 00402025 */ or $a0,$v0,$zero /* f0ca824: 0fc2c5f0 */ jal weaponHasFlag @@ -2995,7 +2995,7 @@ glabel var7f1ad8e4 /* f0caa64: 00000000 */ nop /* f0caa68: 44812000 */ mtc1 $at,$f4 /* f0caa6c: 00002025 */ or $a0,$zero,$zero -/* f0caa70: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0caa70: 0fc2866a */ jal handGetWeaponNum /* f0caa74: e7a400b0 */ swc1 $f4,0xb0($sp) /* f0caa78: 24010016 */ addiu $at,$zero,0x16 /* f0caa7c: 5441008b */ bnel $v0,$at,.L0f0cacac @@ -3152,7 +3152,7 @@ glabel var7f1ad8e4 /* f0cacb8: 00000000 */ nop /* f0cacbc: e7a000b0 */ swc1 $f0,0xb0($sp) .L0f0cacc0: -/* f0cacc0: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0cacc0: 0fc2866a */ jal handGetWeaponNum /* f0cacc4: 00002025 */ or $a0,$zero,$zero /* f0cacc8: 24010011 */ addiu $at,$zero,0x11 /* f0caccc: 5441000a */ bnel $v0,$at,.L0f0cacf8 @@ -3783,7 +3783,7 @@ glabel var7f1ad8e4 /* f0cb58c: 5440000b */ bnezl $v0,.L0f0cb5bc /* f0cb590: 00008025 */ or $s0,$zero,$zero .L0f0cb594: -/* f0cb594: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0cb594: 0fc2866a */ jal handGetWeaponNum /* f0cb598: 00002025 */ or $a0,$zero,$zero /* f0cb59c: 2401000a */ addiu $at,$zero,0xa /* f0cb5a0: 54410037 */ bnel $v0,$at,.L0f0cb680 @@ -3794,7 +3794,7 @@ glabel var7f1ad8e4 /* f0cb5b4: 15c10031 */ bne $t6,$at,.L0f0cb67c /* f0cb5b8: 00008025 */ or $s0,$zero,$zero .L0f0cb5bc: -/* f0cb5bc: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0cb5bc: 0fc2866a */ jal handGetWeaponNum /* f0cb5c0: 00002025 */ or $a0,$zero,$zero /* f0cb5c4: 2401000a */ addiu $at,$zero,0xa /* f0cb5c8: 54410008 */ bnel $v0,$at,.L0f0cb5ec @@ -3991,7 +3991,7 @@ glabel var7f1ad8e4 // s32 i; // // controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex); -// weaponnum = getCurrentPlayerWeaponId(0); +// weaponnum = handGetWeaponNum(HAND_RIGHT); // sp1a8 = weaponHasInvEFlag(weaponnum, 0x00000001); // contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex); // @@ -4195,7 +4195,7 @@ glabel var7f1ad8e4 // } // // // 9298 -// if (getCurrentPlayerWeaponId(0) == WEAPON_HORIZONSCANNER) { +// if (handGetWeaponNum(HAND_RIGHT) == WEAPON_HORIZONSCANNER) { // g_Vars.currentplayer->insightaimmode = true; // } // @@ -4420,7 +4420,7 @@ glabel var7f1ad8e4 // } // // // 9a24 -// if (getCurrentPlayerWeaponId(0) == WEAPON_FARSIGHTXR20) { +// if (handGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHTXR20) { // if (g_Vars.currentplayer->insightaimmode) { // movedata.unk14 = 0; // } @@ -4458,7 +4458,7 @@ glabel var7f1ad8e4 // g_Vars.currentplayer->waitforzrelease = false; // } // -// if (weaponHasFlag(getCurrentPlayerWeaponId(0), WEAPONFLAG_80000000)) { +// if (weaponHasFlag(handGetWeaponNum(HAND_RIGHT), WEAPONFLAG_80000000)) { // if (arg2 // && contGetButtonsPressedThisFrame(shootpad, shootallowedbuttons & Z_TRIG) // && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED) { @@ -4516,7 +4516,7 @@ glabel var7f1ad8e4 // } // // // 9d98 -// if (getCurrentPlayerWeaponId(0) == WEAPON_HORIZONSCANNER) { +// if (handGetWeaponNum(HAND_RIGHT) == WEAPON_HORIZONSCANNER) { // g_Vars.currentplayer->insightaimmode = true; // } // @@ -4726,7 +4726,8 @@ glabel var7f1ad8e4 // f32 increment = 1; // spbc = 1; // -// if (getCurrentPlayerWeaponId(1) == WEAPON_FARSIGHTXR20) { +// // @bug? Should this be HAND_RIGHT? +// if (handGetWeaponNum(HAND_LEFT) == WEAPON_FARSIGHTXR20) { // increment = 0.5f; // } // @@ -4798,7 +4799,7 @@ glabel var7f1ad8e4 // && contGetButtons(contpad1, c1allowedbuttons & (D_JPAD | D_CBUTTONS)); // } // -// if (getCurrentPlayerWeaponId(0) == WEAPON_FARSIGHTXR20) { +// if (handGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHTXR20) { // movedata.farsighttempautoseek = g_Vars.currentplayer->insightaimmode && (sp1a2 & (L_TRIG | R_TRIG | L_CBUTTONS | R_CBUTTONS)); // } else { // movedata.rleanleft = g_Vars.currentplayer->insightaimmode && (sp1a2 & (L_JPAD | L_CBUTTONS)); @@ -4827,7 +4828,7 @@ glabel var7f1ad8e4 // g_Vars.currentplayer->waitforzrelease = false; // } // -// if (weaponHasFlag(getCurrentPlayerWeaponId(0), WEAPONFLAG_80000000)) { +// if (weaponHasFlag(handGetWeaponNum(HAND_RIGHT), WEAPONFLAG_80000000)) { // if ((sp1a0 & shootbuttons) // && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED) { // movedata.btapcount++; @@ -4899,7 +4900,7 @@ glabel var7f1ad8e4 // spb0 = 60; // // // FarSight in secondary function -// if (getCurrentPlayerWeaponId(0) == WEAPON_FARSIGHTXR20 +// if (handGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHTXR20 // && g_Vars.currentplayer->insightaimmode // && movedata.farsighttempautoseek == false // && g_Vars.currentplayer->hands[HAND_RIGHT].weaponfunc == FUNC_SECONDARY @@ -4937,7 +4938,7 @@ glabel var7f1ad8e4 // spb0 = currentPlayerGetGunZoomFov(); // } // -// if (getCurrentPlayerWeaponId(0) == WEAPON_AR34 +// if (handGetWeaponNum(HAND_RIGHT) == WEAPON_AR34 // && g_Vars.currentplayer->hands[HAND_RIGHT].weaponfunc == FUNC_SECONDARY) { // spb0 = currentPlayerGetGunZoomFov(); // } @@ -5175,11 +5176,11 @@ glabel var7f1ad8e4 // && g_Vars.currentplayer->autoyaimprop // && weaponHasInvEFlag(weaponnum, 0x00000002) // ) -// || (getCurrentPlayerWeaponId(0) == WEAPON_CMP150 && g_Vars.currentplayer->hands[HAND_RIGHT].weaponfunc == FUNC_SECONDARY)) { +// || (handGetWeaponNum(HAND_RIGHT) == WEAPON_CMP150 && g_Vars.currentplayer->hands[HAND_RIGHT].weaponfunc == FUNC_SECONDARY)) { // // Auto aim - move crosshair towards target // s32 followlockon = false; // -// if (getCurrentPlayerWeaponId(0) == WEAPON_CMP150 +// if (handGetWeaponNum(HAND_RIGHT) == WEAPON_CMP150 // && g_Vars.currentplayer->hands[HAND_RIGHT].weaponfunc == FUNC_SECONDARY) { // followlockon = true; // } diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index 60a152143..80f67c8c0 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -19,7 +19,7 @@ #include "game/game_095320.h" #include "game/game_097ba0.h" #include "game/game_0b63b0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/bondhead.h" #include "game/game_127910.h" #include "game/propobj.h" @@ -2059,7 +2059,7 @@ glabel var7f1ad854 /* f0c69f8: 44813000 */ mtc1 $at,$f6 /* f0c69fc: c54419c4 */ lwc1 $f4,0x19c4($t2) /* f0c6a00: 46062201 */ sub.s $f8,$f4,$f6 -/* f0c6a04: 0fc44a11 */ jal currentPlayerHasBriefcase +/* f0c6a04: 0fc44a11 */ jal invHasBriefcase /* f0c6a08: e7a800c0 */ swc1 $f8,0xc0($sp) /* f0c6a0c: 3c08800a */ lui $t0,%hi(g_Vars) /* f0c6a10: 1040000a */ beqz $v0,.L0f0c6a3c diff --git a/src/game/cheats.c b/src/game/cheats.c index 3e7ade65c..d2ece8035 100644 --- a/src/game/cheats.c +++ b/src/game/cheats.c @@ -9,7 +9,7 @@ #include "game/data/data_01a3a0.h" #include "game/data/data_020df0.h" #include "game/data/data_02da90.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/training/training.h" #include "game/gamefile.h" @@ -130,7 +130,7 @@ void cheatActivate(s32 cheat_id) for (playernum = 0; playernum < PLAYERCOUNT(); playernum++) { setCurrentPlayerNum(playernum); - currentPlayerSetAllGuns(true); + invSetAllGuns(true); } setCurrentPlayerNum(prevplayernum); @@ -167,7 +167,7 @@ void cheatDeactivate(s32 cheat_id) for (playernum = 0; playernum < PLAYERCOUNT(); playernum++) { setCurrentPlayerNum(playernum); - currentPlayerSetAllGuns(false); + invSetAllGuns(false); } setCurrentPlayerNum(prevplayernum); diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index f5fc54cda..6d37b05cd 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -26,7 +26,7 @@ #include "game/game_0b28d0.h" #include "game/game_0b3350.h" #include "game/game_0b63b0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/explosions/explosions.h" #include "game/sparks/sparks.h" @@ -2844,7 +2844,7 @@ glabel var7f1a8d44 /* f031bfc: 24850008 */ addiu $a1,$a0,0x8 /* f031c00: 0fc4a640 */ jal explosionCreateSimple /* f031c04: 24860028 */ addiu $a2,$a0,0x28 -/* f031c08: 0fc447a9 */ jal currentPlayerRemoveWeapon +/* f031c08: 0fc447a9 */ jal invRemoveItemByNum /* f031c0c: 2404002e */ addiu $a0,$zero,0x2e /* f031c10: 3c0e800a */ lui $t6,%hi(g_Vars+0x284) /* f031c14: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 6502a198e..31f8d11aa 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -29,7 +29,7 @@ #include "game/game_0b28d0.h" #include "game/game_0b63b0.h" #include "game/game_0dcdb0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/explosions/explosions.h" #include "game/smoke/smoke.h" @@ -2020,17 +2020,16 @@ bool aiIfChrHasObject(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; struct defaultobj *obj = objFindByTagId(cmd[3]); struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - s32 playernum = 0; + s32 hasprop = false; if (obj && obj->prop && chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { s32 prevplayernum = g_Vars.currentplayernum; - playernum = propGetPlayerNum(chr->prop); - setCurrentPlayerNum(playernum); - playernum = currentPlayerHasProp(obj->prop); + setCurrentPlayerNum(propGetPlayerNum(chr->prop)); + hasprop = invHasProp(obj->prop); setCurrentPlayerNum(prevplayernum); } - if (playernum != 0) { + if (hasprop) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]); } else { g_Vars.aioffset += 5; @@ -2103,7 +2102,7 @@ bool aiIfChrHasWeaponEquipped(void) u32 playernum = propGetPlayerNum(chr->prop); setCurrentPlayerNum(playernum); - if (getCurrentPlayerWeaponId(0) == cmd[3]) { + if (handGetWeaponNum(HAND_RIGHT) == cmd[3]) { passes = true; } @@ -2301,8 +2300,8 @@ bool aiChrDropWeapon(void) u32 playernum = propGetPlayerNum(chr->prop); u32 weaponnum; setCurrentPlayerNum(playernum); - weaponnum = getCurrentPlayerWeaponId(0); - currentPlayerRemoveWeapon(weaponnum); + weaponnum = handGetWeaponNum(HAND_RIGHT); + invRemoveItemByNum(weaponnum); func0f0a1c2c(); setCurrentPlayerNum(prevplayernum); } else if (chr && chr->prop) { @@ -6340,7 +6339,7 @@ glabel var7f1a9d4c /* f05935c: 24090004 */ addiu $t1,$zero,0x4 /* f059360: a3a9002b */ sb $t1,0x2b($sp) .L0f059364: -/* f059364: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f059364: 0fc2866a */ jal handGetWeaponNum /* f059368: 00002025 */ or $a0,$zero,$zero /* f05936c: 244afffe */ addiu $t2,$v0,-2 /* f059370: 2d41001a */ sltiu $at,$t2,0x1a @@ -6477,7 +6476,7 @@ glabel var7f1a9d4c // score -= 2; // } // -// switch (getCurrentPlayerWeaponId(0)) { +// switch (handGetWeaponNum(HAND_RIGHT)) { // case WEAPON_CMP150: // case WEAPON_CYCLONE: // case WEAPON_CALLISTONTG: @@ -6636,10 +6635,10 @@ bool aiCheckCoverOutOfSight(void) */ bool aiIfPlayerUsingCmpOrAr34(void) { - u32 arg = 0; + u32 hand = HAND_RIGHT; u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - switch (getCurrentPlayerWeaponId(arg)) { + switch (handGetWeaponNum(hand)) { case WEAPON_CMP150: case WEAPON_AR34: g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); @@ -10152,9 +10151,9 @@ bool aiClearInventory(void) setCurrentPlayerNum(playernum); if (g_Vars.currentplayer == g_Vars.bond || g_Vars.currentplayer == g_Vars.coop) { - currentPlayerClearInventory(); + invClear(); g_Vars.currentplayer->devicesactive = 0; - currentPlayerGiveWeapon(WEAPON_UNARMED); + invGiveSingleWeapon(WEAPON_UNARMED); currentPlayerEquipWeapon(WEAPON_UNARMED); } } @@ -11106,7 +11105,7 @@ bool aiChrKill(void) bool aiRemoveWeaponFromInventory(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - currentPlayerRemoveWeapon(cmd[2]); + invRemoveItemByNum(cmd[2]); g_Vars.aioffset += 3; return false; diff --git a/src/game/core.c b/src/game/core.c index 2a339d747..00ec3244e 100644 --- a/src/game/core.c +++ b/src/game/core.c @@ -26,7 +26,7 @@ #include "game/game_0109d0.h" #include "game/game_010b20.h" #include "game/game_011110.h" -#include "game/game_012450.h" +#include "game/inventory/init.h" #include "game/game_0125a0.h" #include "game/explosions/init.h" #include "game/smoke/init.h" @@ -414,7 +414,7 @@ void coreLoadStage(s32 stagenum) menuInit(); amInit(); - currentPlayerInitGunsHeld(); + invInitGunsHeld(); func0f010bb0(); func0f0b77cc(); currentPlayerInit(); @@ -1606,7 +1606,7 @@ Gfx *coreRender(Gfx *gdl) if (PLAYERCOUNT() == 1 || g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0 - || (weaponHasFlag(getCurrentPlayerWeaponId(0), WEAPONFLAG_AIMTRACK) && currentPlayerIsInSightAimMode())) { + || (weaponHasFlag(handGetWeaponNum(HAND_RIGHT), WEAPONFLAG_AIMTRACK) && currentPlayerIsInSightAimMode())) { g_Vars.currentplayer->lookingatprop.prop = func0f061d54(0, 0, 0); if (g_Vars.currentplayer->lookingatprop.prop) { @@ -1645,7 +1645,7 @@ Gfx *coreRender(Gfx *gdl) if (handHasFunctionFlags(g_Vars.currentplayer->hands, FUNCFLAG_00080000)) { coreFindThreats(); - } else if (weaponHasFlag(getCurrentPlayerWeaponId(0), WEAPONFLAG_AIMTRACK)) { + } else if (weaponHasFlag(handGetWeaponNum(HAND_RIGHT), WEAPONFLAG_AIMTRACK)) { s32 j; if (frIsInTraining() diff --git a/src/game/game_00c490.c b/src/game/game_00c490.c index c4adc5e8a..6f972f1aa 100644 --- a/src/game/game_00c490.c +++ b/src/game/game_00c490.c @@ -15,7 +15,7 @@ #include "game/game_00c490.h" #include "game/game_0109d0.h" #include "game/game_011110.h" -#include "game/game_012450.h" +#include "game/inventory/init.h" #include "game/game_0125a0.h" #include "game/game_012d50.h" #include "game/game_0147d0.h" @@ -24,7 +24,7 @@ #include "game/game_0601b0.h" #include "game/game_091e10.h" #include "game/game_096750.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/game_157db0.h" #include "game/game_1655c0.h" @@ -2847,7 +2847,7 @@ void setupParseObjects(s32 stagenum) for (j = 0; j < PLAYERCOUNT(); j++) { setCurrentPlayerNum(j); - func0f012530(setupCountCommandType(OBJTYPE_LINKGUNS)); + invInit(setupCountCommandType(OBJTYPE_LINKGUNS)); } if (g_StageSetup.props) { @@ -3299,7 +3299,7 @@ void setupParseObjects(s32 stagenum) targetobj->hidden |= OBJHFLAG_HASTEXTOVERRIDE; } - textoverrideInsert(override); + invInsertTextOverride(override); } break; case OBJTYPE_BRIEFING: diff --git a/src/game/game_0109d0.c b/src/game/game_0109d0.c index 6f184ec90..2ce42189d 100644 --- a/src/game/game_0109d0.c +++ b/src/game/game_0109d0.c @@ -7,7 +7,7 @@ #include "game/data/data_01a3a0.h" #include "game/data/data_020df0.h" #include "game/data/data_02da90.h" -#include "game/data/inventory.h" +#include "game/inventory/items.h" #include "gvars/gvars.h" #include "lib/main.h" #include "types.h" diff --git a/src/game/game_011110.c b/src/game/game_011110.c index e2f778310..580eb20fe 100644 --- a/src/game/game_011110.c +++ b/src/game/game_011110.c @@ -10,7 +10,7 @@ #include "game/data/data_01a3a0.h" #include "game/data/data_020df0.h" #include "game/data/data_02da90.h" -#include "game/data/inventory.h" +#include "game/inventory/items.h" #include "game/game_011110.h" #include "game/chr/chr.h" #include "game/game_02cde0.h" @@ -18,7 +18,7 @@ #include "game/game_091e10.h" #include "game/game_097ba0.h" #include "game/game_0b63b0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_1655c0.h" #include "game/mplayer/scenarios.h" #include "game/mplayer/mplayer.h" @@ -620,12 +620,12 @@ glabel var7f1a827c /* f011ac0: 0fc04558 */ jal weaponLoadProjectileModels /* f011ac4: 00000000 */ nop /* f011ac8: 8e040004 */ lw $a0,0x4($s0) -/* f011acc: 0fc4478a */ jal currentPlayerGiveWeaponWithArgument +/* f011acc: 0fc4478a */ jal invGiveDoubleWeapon /* f011ad0: 8e050008 */ lw $a1,0x8($s0) /* f011ad4: 10000004 */ b .L0f011ae8 /* f011ad8: 8fb80080 */ lw $t8,0x80($sp) .L0f011adc: -/* f011adc: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011adc: 0fc44762 */ jal invGiveSingleWeapon /* f011ae0: 8e040004 */ lw $a0,0x4($s0) /* f011ae4: 8fb80080 */ lw $t8,0x80($sp) .L0f011ae8: @@ -747,13 +747,13 @@ glabel var7f1a827c /* f011c90: 5441ff65 */ bnel $v0,$at,.L0f011a28 /* f011c94: 2c41000c */ sltiu $at,$v0,0xc .L0f011c98: -/* f011c98: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011c98: 0fc44762 */ jal invGiveSingleWeapon /* f011c9c: 24040001 */ addiu $a0,$zero,0x1 /* f011ca0: 0fc41b99 */ jal cheatIsActive /* f011ca4: 24040008 */ addiu $a0,$zero,0x8 /* f011ca8: 10400006 */ beqz $v0,.L0f011cc4 /* f011cac: 00000000 */ nop -/* f011cb0: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011cb0: 0fc44762 */ jal invGiveSingleWeapon /* f011cb4: 24040009 */ addiu $a0,$zero,0x9 /* f011cb8: 2404000a */ addiu $a0,$zero,0xa /* f011cbc: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -763,7 +763,7 @@ glabel var7f1a827c /* f011cc8: 24040009 */ addiu $a0,$zero,0x9 /* f011ccc: 10400006 */ beqz $v0,.L0f011ce8 /* f011cd0: 00000000 */ nop -/* f011cd4: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011cd4: 0fc44762 */ jal invGiveSingleWeapon /* f011cd8: 24040016 */ addiu $a0,$zero,0x16 /* f011cdc: 24040006 */ addiu $a0,$zero,0x6 /* f011ce0: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -773,7 +773,7 @@ glabel var7f1a827c /* f011cec: 24040001 */ addiu $a0,$zero,0x1 /* f011cf0: 10400006 */ beqz $v0,.L0f011d0c /* f011cf4: 00000000 */ nop -/* f011cf8: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011cf8: 0fc44762 */ jal invGiveSingleWeapon /* f011cfc: 24040031 */ addiu $a0,$zero,0x31 /* f011d00: 24040014 */ addiu $a0,$zero,0x14 /* f011d04: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -783,21 +783,21 @@ glabel var7f1a827c /* f011d10: 24040015 */ addiu $a0,$zero,0x15 /* f011d14: 10400003 */ beqz $v0,.L0f011d24 /* f011d18: 00000000 */ nop -/* f011d1c: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011d1c: 0fc44762 */ jal invGiveSingleWeapon /* f011d20: 2404002d */ addiu $a0,$zero,0x2d .L0f011d24: /* f011d24: 0fc41b99 */ jal cheatIsActive /* f011d28: 2404001a */ addiu $a0,$zero,0x1a /* f011d2c: 10400003 */ beqz $v0,.L0f011d3c /* f011d30: 00000000 */ nop -/* f011d34: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011d34: 0fc44762 */ jal invGiveSingleWeapon /* f011d38: 24040037 */ addiu $a0,$zero,0x37 .L0f011d3c: /* f011d3c: 0fc41b99 */ jal cheatIsActive /* f011d40: 2404001b */ addiu $a0,$zero,0x1b /* f011d44: 10400006 */ beqz $v0,.L0f011d60 /* f011d48: 00000000 */ nop -/* f011d4c: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011d4c: 0fc44762 */ jal invGiveSingleWeapon /* f011d50: 24040018 */ addiu $a0,$zero,0x18 /* f011d54: 24040008 */ addiu $a0,$zero,0x8 /* f011d58: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -807,7 +807,7 @@ glabel var7f1a827c /* f011d64: 2404001c */ addiu $a0,$zero,0x1c /* f011d68: 10400006 */ beqz $v0,.L0f011d84 /* f011d6c: 00000000 */ nop -/* f011d70: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011d70: 0fc44762 */ jal invGiveSingleWeapon /* f011d74: 24040015 */ addiu $a0,$zero,0x15 /* f011d78: 24040004 */ addiu $a0,$zero,0x4 /* f011d7c: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -817,14 +817,14 @@ glabel var7f1a827c /* f011d88: 2404001d */ addiu $a0,$zero,0x1d /* f011d8c: 10400003 */ beqz $v0,.L0f011d9c /* f011d90: 00000000 */ nop -/* f011d94: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011d94: 0fc44762 */ jal invGiveSingleWeapon /* f011d98: 2404002f */ addiu $a0,$zero,0x2f .L0f011d9c: /* f011d9c: 0fc41b99 */ jal cheatIsActive /* f011da0: 2404001e */ addiu $a0,$zero,0x1e /* f011da4: 10400009 */ beqz $v0,.L0f011dcc /* f011da8: 00000000 */ nop -/* f011dac: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011dac: 0fc44762 */ jal invGiveSingleWeapon /* f011db0: 24040012 */ addiu $a0,$zero,0x12 /* f011db4: 24040004 */ addiu $a0,$zero,0x4 /* f011db8: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -837,7 +837,7 @@ glabel var7f1a827c /* f011dd0: 2404001f */ addiu $a0,$zero,0x1f /* f011dd4: 10400006 */ beqz $v0,.L0f011df0 /* f011dd8: 00000000 */ nop -/* f011ddc: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011ddc: 0fc44762 */ jal invGiveSingleWeapon /* f011de0: 2404000e */ addiu $a0,$zero,0xe /* f011de4: 24040002 */ addiu $a0,$zero,0x2 /* f011de8: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -847,7 +847,7 @@ glabel var7f1a827c /* f011df4: 24040020 */ addiu $a0,$zero,0x20 /* f011df8: 10400006 */ beqz $v0,.L0f011e14 /* f011dfc: 00000000 */ nop -/* f011e00: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011e00: 0fc44762 */ jal invGiveSingleWeapon /* f011e04: 24040007 */ addiu $a0,$zero,0x7 /* f011e08: 24040001 */ addiu $a0,$zero,0x1 /* f011e0c: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -868,14 +868,14 @@ glabel var7f1a827c /* f011e40: 24040021 */ addiu $a0,$zero,0x21 /* f011e44: 10400003 */ beqz $v0,.L0f011e54 /* f011e48: 00000000 */ nop -/* f011e4c: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011e4c: 0fc44762 */ jal invGiveSingleWeapon /* f011e50: 2404002c */ addiu $a0,$zero,0x2c .L0f011e54: /* f011e54: 0fc41b99 */ jal cheatIsActive /* f011e58: 24040022 */ addiu $a0,$zero,0x22 /* f011e5c: 10400006 */ beqz $v0,.L0f011e78 /* f011e60: 00000000 */ nop -/* f011e64: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011e64: 0fc44762 */ jal invGiveSingleWeapon /* f011e68: 24040024 */ addiu $a0,$zero,0x24 /* f011e6c: 24040001 */ addiu $a0,$zero,0x1 /* f011e70: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -885,7 +885,7 @@ glabel var7f1a827c /* f011e7c: 24040023 */ addiu $a0,$zero,0x23 /* f011e80: 10400006 */ beqz $v0,.L0f011e9c /* f011e84: 00000000 */ nop -/* f011e88: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011e88: 0fc44762 */ jal invGiveSingleWeapon /* f011e8c: 24040025 */ addiu $a0,$zero,0x25 /* f011e90: 24040004 */ addiu $a0,$zero,0x4 /* f011e94: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -895,7 +895,7 @@ glabel var7f1a827c /* f011ea0: 24040024 */ addiu $a0,$zero,0x24 /* f011ea4: 10400006 */ beqz $v0,.L0f011ec0 /* f011ea8: 00000000 */ nop -/* f011eac: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011eac: 0fc44762 */ jal invGiveSingleWeapon /* f011eb0: 24040026 */ addiu $a0,$zero,0x26 /* f011eb4: 24040002 */ addiu $a0,$zero,0x2 /* f011eb8: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -905,7 +905,7 @@ glabel var7f1a827c /* f011ec4: 24040025 */ addiu $a0,$zero,0x25 /* f011ec8: 10400006 */ beqz $v0,.L0f011ee4 /* f011ecc: 00000000 */ nop -/* f011ed0: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011ed0: 0fc44762 */ jal invGiveSingleWeapon /* f011ed4: 24040027 */ addiu $a0,$zero,0x27 /* f011ed8: 24040004 */ addiu $a0,$zero,0x4 /* f011edc: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -915,7 +915,7 @@ glabel var7f1a827c /* f011ee8: 24040026 */ addiu $a0,$zero,0x26 /* f011eec: 10400006 */ beqz $v0,.L0f011f08 /* f011ef0: 00000000 */ nop -/* f011ef4: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011ef4: 0fc44762 */ jal invGiveSingleWeapon /* f011ef8: 24040028 */ addiu $a0,$zero,0x28 /* f011efc: 24040002 */ addiu $a0,$zero,0x2 /* f011f00: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -925,7 +925,7 @@ glabel var7f1a827c /* f011f0c: 24040027 */ addiu $a0,$zero,0x27 /* f011f10: 10400006 */ beqz $v0,.L0f011f2c /* f011f14: 00000000 */ nop -/* f011f18: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011f18: 0fc44762 */ jal invGiveSingleWeapon /* f011f1c: 24040029 */ addiu $a0,$zero,0x29 /* f011f20: 24040002 */ addiu $a0,$zero,0x2 /* f011f24: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -935,7 +935,7 @@ glabel var7f1a827c /* f011f30: 24040028 */ addiu $a0,$zero,0x28 /* f011f34: 10400006 */ beqz $v0,.L0f011f50 /* f011f38: 00000000 */ nop -/* f011f3c: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011f3c: 0fc44762 */ jal invGiveSingleWeapon /* f011f40: 2404002a */ addiu $a0,$zero,0x2a /* f011f44: 24040004 */ addiu $a0,$zero,0x4 /* f011f48: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -945,7 +945,7 @@ glabel var7f1a827c /* f011f54: 24040029 */ addiu $a0,$zero,0x29 /* f011f58: 50400007 */ beqzl $v0,.L0f011f78 /* f011f5c: 8fa90080 */ lw $t1,0x80($sp) -/* f011f60: 0fc44762 */ jal currentPlayerGiveWeapon +/* f011f60: 0fc44762 */ jal invGiveSingleWeapon /* f011f64: 2404002b */ addiu $a0,$zero,0x2b /* f011f68: 24040002 */ addiu $a0,$zero,0x2 /* f011f6c: 0fc2a58a */ jal currentPlayerSetAmmoQuantity @@ -1353,9 +1353,9 @@ glabel var7f1a827c // // if (cmd[2] >= 0) { // weaponLoadProjectileModels(cmd[2]); -// currentPlayerGiveWeaponWithArgument(cmd[1], cmd[2]); +// invGiveDoubleWeapon(cmd[1], cmd[2]); // } else { -// currentPlayerGiveWeapon(cmd[1]); +// invGiveSingleWeapon(cmd[1]); // } // // if (!hasdefaultweapon) { @@ -1417,58 +1417,58 @@ glabel var7f1a827c // } // } // -// currentPlayerGiveWeapon(WEAPON_UNARMED); +// invGiveSingleWeapon(WEAPON_UNARMED); // // if (cheatIsActive(CHEAT_TRENTSMAGNUM)) { -// currentPlayerGiveWeapon(WEAPON_DY357LX); +// invGiveSingleWeapon(WEAPON_DY357LX); // currentPlayerSetAmmoQuantity(AMMOTYPE_MAGNUM, 80); // } // // if (cheatIsActive(CHEAT_FARSIGHT)) { -// currentPlayerGiveWeapon(WEAPON_FARSIGHTXR20); +// invGiveSingleWeapon(WEAPON_FARSIGHTXR20); // currentPlayerSetAmmoQuantity(AMMOTYPE_FARSIGHT, 80); // } // // if (cheatIsActive(CHEAT_CLOAKINGDEVICE)) { -// currentPlayerGiveWeapon(WEAPON_CLOAKINGDEVICE); +// invGiveSingleWeapon(WEAPON_CLOAKINGDEVICE); // currentPlayerSetAmmoQuantity(AMMOTYPE_CLOAK, 7200); // } // // if (cheatIsActive(CHEAT_PERFECTDARKNESS)) { -// currentPlayerGiveWeapon(WEAPON_NIGHTVISION); +// invGiveSingleWeapon(WEAPON_NIGHTVISION); // } // // if (cheatIsActive(CHEAT_RTRACKER)) { -// currentPlayerGiveWeapon(WEAPON_RTRACKER); +// invGiveSingleWeapon(WEAPON_RTRACKER); // } // // if (cheatIsActive(CHEAT_ROCKETLAUNCHER)) { -// currentPlayerGiveWeapon(WEAPON_ROCKETLAUNCHER); +// invGiveSingleWeapon(WEAPON_ROCKETLAUNCHER); // currentPlayerSetAmmoQuantity(AMMOTYPE_ROCKET, 10); // } // // if (cheatIsActive(CHEAT_SNIPERRIFLE)) { -// currentPlayerGiveWeapon(WEAPON_SNIPERRIFLE); +// invGiveSingleWeapon(WEAPON_SNIPERRIFLE); // currentPlayerSetAmmoQuantity(AMMOTYPE_RIFLE, 200); // } // // if (cheatIsActive(CHEAT_XRAYSCANNER)) { -// currentPlayerGiveWeapon(WEAPON_XRAYSCANNER); +// invGiveSingleWeapon(WEAPON_XRAYSCANNER); // } // // if (cheatIsActive(CHEAT_SUPERDRAGON)) { -// currentPlayerGiveWeapon(WEAPON_SUPERDRAGON); +// invGiveSingleWeapon(WEAPON_SUPERDRAGON); // currentPlayerSetAmmoQuantity(AMMOTYPE_RIFLE, 200); // currentPlayerSetAmmoQuantity(AMMOTYPE_DEVASTATOR, 20); // } // // if (cheatIsActive(CHEAT_LAPTOPGUN)) { -// currentPlayerGiveWeapon(WEAPON_LAPTOPGUN); +// invGiveSingleWeapon(WEAPON_LAPTOPGUN); // currentPlayerSetAmmoQuantity(AMMOTYPE_SMG, 200); // } // // if (cheatIsActive(CHEAT_PHOENIX)) { -// currentPlayerGiveWeapon(WEAPON_PHOENIX); +// invGiveSingleWeapon(WEAPON_PHOENIX); // currentPlayerSetAmmoQuantity(AMMOTYPE_PISTOL, 200); // } // @@ -1476,47 +1476,47 @@ glabel var7f1a827c // currentPlayerSetAmmoQuantity(AMMOTYPE_PSYCHOSIS, 4); // // if (cheatIsActive(CHEAT_PSYCHOSISGUN)) { -// currentPlayerGiveWeapon(WEAPON_PSYCHOSISGUN); +// invGiveSingleWeapon(WEAPON_PSYCHOSISGUN); // } // } // // if (cheatIsActive(CHEAT_PP9I)) { -// currentPlayerGiveWeapon(WEAPON_PP9I); +// invGiveSingleWeapon(WEAPON_PP9I); // currentPlayerSetAmmoQuantity(AMMOTYPE_PISTOL, 200); // } // // if (cheatIsActive(CHEAT_CC13)) { -// currentPlayerGiveWeapon(WEAPON_CC13); +// invGiveSingleWeapon(WEAPON_CC13); // currentPlayerSetAmmoQuantity(AMMOTYPE_RIFLE, 200); // } // // if (cheatIsActive(CHEAT_KL01313)) { -// currentPlayerGiveWeapon(WEAPON_KL01313); +// invGiveSingleWeapon(WEAPON_KL01313); // currentPlayerSetAmmoQuantity(AMMOTYPE_SMG, 200); // } // // if (cheatIsActive(CHEAT_KF7SPECIAL)) { -// currentPlayerGiveWeapon(WEAPON_KF7SPECIAL); +// invGiveSingleWeapon(WEAPON_KF7SPECIAL); // currentPlayerSetAmmoQuantity(AMMOTYPE_RIFLE, 200); // } // // if (cheatIsActive(CHEAT_ZZT)) { -// currentPlayerGiveWeapon(WEAPON_ZZT); +// invGiveSingleWeapon(WEAPON_ZZT); // currentPlayerSetAmmoQuantity(AMMOTYPE_SMG, 200); // } // // if (cheatIsActive(CHEAT_DMC)) { -// currentPlayerGiveWeapon(WEAPON_DMC); +// invGiveSingleWeapon(WEAPON_DMC); // currentPlayerSetAmmoQuantity(AMMOTYPE_SMG, 200); // } // // if (cheatIsActive(CHEAT_AR53)) { -// currentPlayerGiveWeapon(WEAPON_AR53); +// invGiveSingleWeapon(WEAPON_AR53); // currentPlayerSetAmmoQuantity(AMMOTYPE_RIFLE, 200); // } // // if (cheatIsActive(CHEAT_RCP45)) { -// currentPlayerGiveWeapon(WEAPON_RCP45); +// invGiveSingleWeapon(WEAPON_RCP45); // currentPlayerSetAmmoQuantity(AMMOTYPE_SMG, 200); // } // diff --git a/src/game/game_01b0a0.c b/src/game/game_01b0a0.c index e882d7760..eb8e369a1 100644 --- a/src/game/game_01b0a0.c +++ b/src/game/game_01b0a0.c @@ -10,7 +10,7 @@ #include "game/game_01b0a0.h" #include "game/game_097ba0.h" #include "game/game_0b0420.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/pdoptions.h" #include "gvars/gvars.h" diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index 1e1bbb678..ce2b4e45d 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -1914,7 +1914,7 @@ glabel var7f1a9ebc /* f061d80: 24010002 */ addiu $at,$zero,0x2 /* f061d84: 15c10018 */ bne $t6,$at,.L0f061de8 /* f061d88: 00000000 */ nop -/* f061d8c: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f061d8c: 0fc2866a */ jal handGetWeaponNum /* f061d90: 00002025 */ or $a0,$zero,$zero /* f061d94: 24010014 */ addiu $at,$zero,0x14 /* f061d98: 14410013 */ bne $v0,$at,.L0f061de8 @@ -2672,7 +2672,7 @@ glabel var7f1a9ef4 /* f0627d8: 00085680 */ sll $t2,$t0,0x1a /* f0627dc: 0541001e */ bgez $t2,.L0f062858 /* f0627e0: 00000000 */ nop -/* f0627e4: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0627e4: 0fc2866a */ jal handGetWeaponNum /* f0627e8: afa30044 */ sw $v1,0x44($sp) /* f0627ec: 24010014 */ addiu $at,$zero,0x14 /* f0627f0: 1441000d */ bne $v0,$at,.L0f062828 @@ -2711,7 +2711,7 @@ glabel var7f1a9ef4 /* f062868: 0fc2884b */ jal func0f0a212c /* f06286c: 02002025 */ or $a0,$s0,$zero /* f062870: afa20040 */ sw $v0,0x40($sp) -/* f062874: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f062874: 0fc2866a */ jal handGetWeaponNum /* f062878: 02002025 */ or $a0,$s0,$zero /* f06287c: 3c0a800a */ lui $t2,%hi(g_Vars+0x284) /* f062880: 8d4aa244 */ lw $t2,%lo(g_Vars+0x284)($t2) @@ -5095,7 +5095,7 @@ glabel func0f064a24 /* f064a70: f7b60020 */ sdc1 $f22,0x20($sp) /* f064a74: f7b40018 */ sdc1 $f20,0x18($sp) /* f064a78: afa00074 */ sw $zero,0x74($sp) -/* f064a7c: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f064a7c: 0fc2866a */ jal handGetWeaponNum /* f064a80: 00002025 */ or $a0,$zero,$zero /* f064a84: 24010016 */ addiu $at,$zero,0x16 /* f064a88: 1441007e */ bne $v0,$at,.L0f064c84 @@ -5279,7 +5279,7 @@ glabel func0f064ce8 /* f064d24: 00008025 */ or $s0,$zero,$zero /* f064d28: 00002025 */ or $a0,$zero,$zero /* f064d2c: adc10000 */ sw $at,0x0($t6) -/* f064d30: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f064d30: 0fc2866a */ jal handGetWeaponNum /* f064d34: adc80004 */ sw $t0,0x4($t6) /* f064d38: 00402025 */ or $a0,$v0,$zero /* f064d3c: 0fc2c5f0 */ jal weaponHasFlag @@ -5313,7 +5313,7 @@ glabel func0f064ce8 /* f064da4: 0fc19289 */ jal func0f064a24 /* f064da8: 00000000 */ nop .L0f064dac: -/* f064dac: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f064dac: 0fc2866a */ jal handGetWeaponNum /* f064db0: 00002025 */ or $a0,$zero,$zero /* f064db4: 2401000a */ addiu $at,$zero,0xa /* f064db8: 14410009 */ bne $v0,$at,.L0f064de0 diff --git a/src/game/game_095320.c b/src/game/game_095320.c index 88ea9389b..50ccbae53 100644 --- a/src/game/game_095320.c +++ b/src/game/game_095320.c @@ -14,7 +14,7 @@ #include "game/game_095320.h" #include "game/game_0b3350.h" #include "game/game_0dcdb0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/core.h" #include "game/training/training.h" @@ -240,7 +240,7 @@ s32 objectiveCheck(s32 index) if (g_Vars.players[i] == g_Vars.bond || g_Vars.players[i] == g_Vars.coop) { setCurrentPlayerNum(i); - if (currentPlayerHasProp(obj->prop)) { + if (invHasProp(obj->prop)) { collected = true; break; } @@ -267,7 +267,7 @@ s32 objectiveCheck(s32 index) if (g_Vars.players[i] == g_Vars.bond || g_Vars.players[i] == g_Vars.coop) { setCurrentPlayerNum(i); - if (currentPlayerHasProp(obj->prop)) { + if (invHasProp(obj->prop)) { reqstatus = OBJECTIVE_INCOMPLETE; break; } diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 77c9634c4..2bdf41b78 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -10,7 +10,7 @@ #include "game/data/data_01a3a0.h" #include "game/data/data_020df0.h" #include "game/data/data_02da90.h" -#include "game/data/inventory.h" +#include "game/inventory/items.h" #include "game/game_005fd0.h" #include "game/chr/chr.h" #include "game/game_0601b0.h" @@ -28,7 +28,7 @@ #include "game/game_0b63b0.h" #include "game/game_0c33f0.h" #include "game/game_0d7070.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/smoke/smoke.h" #include "game/game_1531a0.h" @@ -4368,7 +4368,7 @@ glabel func0f09b260 /* f09b2a8: 000fc340 */ sll $t8,$t7,0xd /* f09b2ac: 0703000d */ bgezl $t8,.L0f09b2e4 /* f09b2b0: 8c4a000c */ lw $t2,0xc($v0) -/* f09b2b4: 0fc447a9 */ jal currentPlayerRemoveWeapon +/* f09b2b4: 0fc447a9 */ jal invRemoveItemByNum /* f09b2b8: 92040000 */ lbu $a0,0x0($s0) /* f09b2bc: 3c02800a */ lui $v0,%hi(g_Vars+0x284) /* f09b2c0: 8c42a244 */ lw $v0,%lo(g_Vars+0x284)($v0) @@ -6945,7 +6945,7 @@ glabel var7f1ac620 /* f09d154: afb00024 */ sw $s0,0x24($sp) /* f09d158: f7b60018 */ sdc1 $f22,0x18($sp) /* f09d15c: f7b40010 */ sdc1 $f20,0x10($sp) -/* f09d160: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f09d160: 0fc2866a */ jal handGetWeaponNum /* f09d164: afa40068 */ sw $a0,0x68($sp) /* f09d168: 0fc2c3f4 */ jal weaponFindById /* f09d16c: 00402025 */ or $a0,$v0,$zero @@ -11165,7 +11165,7 @@ glabel var7f1ac764 void currentPlayerSwivelGunTowards(f32 screenx, f32 screeny, f32 damp) { - struct weapon *weapon = weaponFindById(getCurrentPlayerWeaponId(0)); + struct weapon *weapon = weaponFindById(handGetWeaponNum(HAND_RIGHT)); f32 value = weapon->eptr->unk14; if (value < damp) { @@ -11177,7 +11177,7 @@ void currentPlayerSwivelGunTowards(f32 screenx, f32 screeny, f32 damp) void func0f0a0b98(f32 screenx, f32 screeny) { - struct weapon *weapon = weaponFindById(getCurrentPlayerWeaponId(0)); + struct weapon *weapon = weaponFindById(handGetWeaponNum(HAND_RIGHT)); f32 value = weapon->eptr->unk14; func0f0a0394(screenx, screeny, 0.945f, value); @@ -11844,7 +11844,7 @@ glabel func0f0a1528 /* f0a15ac: 07010009 */ bgez $t8,.L0f0a15d4 /* f0a15b0: 00000000 */ nop /* f0a15b4: 82840002 */ lb $a0,0x2($s4) -/* f0a15b8: 0fc4473e */ jal func0f111cf8 +/* f0a15b8: 0fc4473e */ jal invHasDoubleWeaponIncAllGuns /* f0a15bc: 00802825 */ or $a1,$a0,$zero /* f0a15c0: 14400004 */ bnez $v0,.L0f0a15d4 /* f0a15c4: 00000000 */ nop @@ -12011,7 +12011,7 @@ glabel func0f0a1528 /* f0a1810: 26520004 */ addiu $s2,$s2,0x4 /* f0a1814: 1621ffd3 */ bne $s1,$at,.L0f0a1764 /* f0a1818: 267307a4 */ addiu $s3,$s3,0x7a4 -/* f0a181c: 0fc44bdc */ jal currentPlayerCalculateEquipCurItem +/* f0a181c: 0fc44bdc */ jal invCalculateCurrentIndex /* f0a1820: 00000000 */ nop /* f0a1824: 82820000 */ lb $v0,0x0($s4) /* f0a1828: 240effff */ addiu $t6,$zero,-1 @@ -12057,7 +12057,7 @@ glabel func0f0a1528 /* f0a18c4: 00000000 */ nop /* f0a18c8: ae180014 */ sw $t8,0x14($s0) .L0f0a18cc: -/* f0a18cc: 0fc447a9 */ jal currentPlayerRemoveWeapon +/* f0a18cc: 0fc447a9 */ jal invRemoveItemByNum /* f0a18d0: 82840000 */ lb $a0,0x0($s4) /* f0a18d4: 0fc2870b */ jal func0f0a1c2c /* f0a18d8: 00000000 */ nop @@ -12117,7 +12117,7 @@ void currentPlayerEquipWeapon(s32 weaponnum) player->unk1583_05 = 0; } -s32 getCurrentPlayerWeaponId(s32 handnum) +s32 handGetWeaponNum(s32 handnum) { if (!g_Vars.currentplayer->hands[handnum].unk0640) { return WEAPON_NONE; @@ -12128,7 +12128,7 @@ s32 getCurrentPlayerWeaponId(s32 handnum) s32 getCurrentPlayerWeaponIdWrapper(s32 handnum) { - return getCurrentPlayerWeaponId(handnum); + return handGetWeaponNum(handnum); } bool func0f0a1a10(s32 weaponnum) @@ -12164,10 +12164,10 @@ void func0f0a1ab0(void) struct player *player = g_Vars.currentplayer; s32 dualweaponnum; - if (currentPlayerCanHaveWeapon(player->prevweaponnum)) { + if (invHasSingleWeaponIncAllGuns(player->prevweaponnum)) { currentPlayerEquipWeaponWrapper(HAND_RIGHT, player->prevweaponnum); - dualweaponnum = func0f111cf8(player->prevweaponnum, player->prevweaponnum) * player->prevweaponnum * player->unk1583_01; + dualweaponnum = invHasDoubleWeaponIncAllGuns(player->prevweaponnum, player->prevweaponnum) * player->prevweaponnum * player->unk1583_01; currentPlayerEquipWeaponWrapper(HAND_LEFT, dualweaponnum); } else { func0f0a1df4(); @@ -12408,7 +12408,7 @@ glabel func0f0a1df4 /* f0a1e64: 2416ffff */ addiu $s6,$zero,-1 /* f0a1e68: 0000a025 */ or $s4,$zero,$zero .L0f0a1e6c: -/* f0a1e6c: 0fc44727 */ jal currentPlayerCanHaveWeapon +/* f0a1e6c: 0fc44727 */ jal invHasSingleWeaponIncAllGuns /* f0a1e70: 92640000 */ lbu $a0,0x0($s3) /* f0a1e74: 10400031 */ beqz $v0,.L0f0a1f3c /* f0a1e78: 00000000 */ nop @@ -12495,7 +12495,7 @@ glabel func0f0a1df4 /* f0a1f98: 267301eb */ addiu $s3,$s3,%lo(var800701e8+0x3) /* f0a1f9c: 92110000 */ lbu $s1,0x0($s0) .L0f0a1fa0: -/* f0a1fa0: 0fc44727 */ jal currentPlayerCanHaveWeapon +/* f0a1fa0: 0fc44727 */ jal invHasSingleWeaponIncAllGuns /* f0a1fa4: 02202025 */ or $a0,$s1,$zero /* f0a1fa8: 10400008 */ beqz $v0,.L0f0a1fcc /* f0a1fac: 26100001 */ addiu $s0,$s0,0x1 @@ -12524,7 +12524,7 @@ glabel func0f0a1df4 /* f0a1ff4: 8faa0044 */ lw $t2,0x44($sp) /* f0a1ff8: 13ca0019 */ beq $s8,$t2,.L0f0a2060 /* f0a1ffc: 03c02025 */ or $a0,$s8,$zero -/* f0a2000: 0fc4473e */ jal func0f111cf8 +/* f0a2000: 0fc4473e */ jal invHasDoubleWeaponIncAllGuns /* f0a2004: 03c02825 */ or $a1,$s8,$zero /* f0a2008: 10400006 */ beqz $v0,.L0f0a2024 /* f0a200c: 3c02800a */ lui $v0,%hi(g_Vars+0x284) @@ -12635,7 +12635,7 @@ void currentPlayerReloadHandIfPossible(s32 handnum) { struct player *player = g_Vars.currentplayer; - if (weaponGetAmmoType(getCurrentPlayerWeaponId(handnum), 0) + if (weaponGetAmmoType(handGetWeaponNum(handnum), 0) && player->hands[handnum].unk065c == 0) { player->hands[handnum].unk065c = 9; } @@ -13264,7 +13264,7 @@ void currentPlayerLoseGunInNbombStorm(struct prop *prop) } } - currentPlayerRemoveWeapon(weaponnum); + invRemoveItemByNum(weaponnum); player->hands[1].unk0c3c = 0; player->hands[1].unk0d0e_00 = 1; @@ -18081,7 +18081,7 @@ glabel var7f1aca88 .L0f0a6cd0: /* f0a6cd0: 1300001f */ beqz $t8,.L0f0a6d50 /* f0a6cd4: 00002025 */ or $a0,$zero,$zero -/* f0a6cd8: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0a6cd8: 0fc2866a */ jal handGetWeaponNum /* f0a6cdc: afa3004c */ sw $v1,0x4c($sp) /* f0a6ce0: 24010016 */ addiu $at,$zero,0x16 /* f0a6ce4: 14410004 */ bne $v0,$at,.L0f0a6cf8 @@ -20133,7 +20133,7 @@ glabel var7f1acb14 /* f0a8964: afa40018 */ sw $a0,0x18($sp) /* f0a8968: afa60020 */ sw $a2,0x20($sp) /* f0a896c: 00002025 */ or $a0,$zero,$zero -/* f0a8970: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0a8970: 0fc2866a */ jal handGetWeaponNum /* f0a8974: afa5001c */ sw $a1,0x1c($sp) /* f0a8978: 244efffa */ addiu $t6,$v0,-6 /* f0a897c: 2dc1001d */ sltiu $at,$t6,0x1d @@ -20338,7 +20338,7 @@ glabel var7f1acb14 // Goal loads 1 into $t5 while the below uses $at. //u32 currentPlayerConsiderToggleGunFunction(s32 usedowntime, bool firing, s32 arg2) //{ -// switch (getCurrentPlayerWeaponId(0)) { +// switch (handGetWeaponNum(HAND_RIGHT)) { // case WEAPON_SNIPERRIFLE: // f0a89a0 // // Setting this allows the sniper rifle to behave somewhat similarly to // // a temporary function, meaning that it reverts to primary when B is @@ -20520,9 +20520,9 @@ void currentPlayerTickInventory(bool triggeron) struct chrdata *chr = g_Vars.currentplayer->prop->chr; triggeron = false; - if (currentPlayerGetNumInvItems() > 1) { - currentPlayerClearInventory(); - currentPlayerGiveWeapon(WEAPON_UNARMED); + if (invGetCount() > 1) { + invClear(); + invGiveSingleWeapon(WEAPON_UNARMED); } if (g_Vars.currentplayer->weaponnum != WEAPON_UNARMED @@ -20539,9 +20539,9 @@ void currentPlayerTickInventory(bool triggeron) } // Remove throwable items from inventory if there's no more left - for (i = 0; i < currentPlayerGetNumInvItems(); i++) { + for (i = 0; i < invGetCount(); i++) { struct weapon *weapon; - s32 weaponnum = currentPlayerGetWeaponNumByInvIndex(i); + s32 weaponnum = invGetWeaponNumByIndex(i); s32 equippedweaponnum; switch (weaponnum) { @@ -20558,12 +20558,12 @@ void currentPlayerTickInventory(bool triggeron) if (weapon && weapon->ammos[0] && currentPlayerGetAmmoCount(weapon->ammos[0]->type) == 0) { - equippedweaponnum = getCurrentPlayerWeaponId(0); - currentPlayerRemoveWeapon(weaponnum); + equippedweaponnum = handGetWeaponNum(HAND_RIGHT); + invRemoveItemByNum(weaponnum); - if (weaponnum == equippedweaponnum && !currentPlayerCanHaveWeapon(weaponnum)) { - currentPlayerCalculateEquipCurItem(); - currentPlayerEquipWeapon(currentPlayerGetWeaponNumByInvIndex(g_Vars.currentplayer->equipcuritem)); + if (weaponnum == equippedweaponnum && !invHasSingleWeaponIncAllGuns(weaponnum)) { + invCalculateCurrentIndex(); + currentPlayerEquipWeapon(invGetWeaponNumByIndex(g_Vars.currentplayer->equipcuritem)); } } } @@ -20665,7 +20665,7 @@ void currentPlayerTickInventory(bool triggeron) func0f069710(player->gunshadecol, shadecol); } - currentPlayerIncrementGunHeldTime(getCurrentPlayerWeaponId(0), getCurrentPlayerWeaponId(1)); + invIncrementHeldTime(handGetWeaponNum(HAND_RIGHT), handGetWeaponNum(HAND_LEFT)); } void playersSetPassiveMode(bool enable) @@ -20799,7 +20799,7 @@ glabel currentPlayerSetAmmoQuantity /* f0a9640: afb00018 */ sw $s0,0x18($sp) /* f0a9644: afa5003c */ sw $a1,0x3c($sp) /* f0a9648: 8e31a244 */ lw $s1,%lo(g_Vars+0x284)($s1) -/* f0a964c: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0a964c: 0fc2866a */ jal handGetWeaponNum /* f0a9650: 00002025 */ or $a0,$zero,$zero /* f0a9654: afa20030 */ sw $v0,0x30($sp) /* f0a9658: 2410ffff */ addiu $s0,$zero,-1 @@ -22347,9 +22347,9 @@ glabel hudRenderAmmo /* f0aad30: 93040000 */ lbu $a0,0x0($t8) /* f0aad34: 0fc2c401 */ jal weaponGetFunctionById /* f0aad38: afaa0058 */ sw $t2,0x58($sp) -/* f0aad3c: 0fc44bd4 */ jal currentPlayerGetEquipCurItem +/* f0aad3c: 0fc44bd4 */ jal invGetCurrentIndex /* f0aad40: afa200bc */ sw $v0,0xbc($sp) -/* f0aad44: 0fc44b3e */ jal currentPlayerGetInvNameIdByIndex +/* f0aad44: 0fc44b3e */ jal invGetNameIdByIndex /* f0aad48: 00402025 */ or $a0,$v0,$zero /* f0aad4c: 00402025 */ or $a0,$v0,$zero /* f0aad50: 0fc5b9f1 */ jal langGet diff --git a/src/game/game_0abe70.c b/src/game/game_0abe70.c index 074fdd3ec..4a28f6b8d 100644 --- a/src/game/game_0abe70.c +++ b/src/game/game_0abe70.c @@ -286,7 +286,7 @@ glabel func0f0ac138 /* f0ac1c4: 450300b9 */ bc1tl .L0f0ac4ac /* f0ac1c8: 8fbf0014 */ lw $ra,0x14($sp) /* f0ac1cc: afa30028 */ sw $v1,0x28($sp) -/* f0ac1d0: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0ac1d0: 0fc2866a */ jal handGetWeaponNum /* f0ac1d4: afa5002c */ sw $a1,0x2c($sp) /* f0ac1d8: 8fa30028 */ lw $v1,0x28($sp) /* f0ac1dc: 2401001d */ addiu $at,$zero,0x1d @@ -2269,7 +2269,7 @@ glabel var7f1acd60 /* f0ade18: afa50144 */ sw $a1,0x144($sp) /* f0ade1c: afa60148 */ sw $a2,0x148($sp) /* f0ade20: 00008025 */ or $s0,$zero,$zero -/* f0ade24: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0ade24: 0fc2866a */ jal handGetWeaponNum /* f0ade28: afae0134 */ sw $t6,0x134($sp) /* f0ade2c: 8fb90140 */ lw $t9,0x140($sp) /* f0ade30: 8fb80134 */ lw $t8,0x134($sp) diff --git a/src/game/game_0b0420.c b/src/game/game_0b0420.c index daf697c75..1fc32271f 100644 --- a/src/game/game_0b0420.c +++ b/src/game/game_0b0420.c @@ -8,7 +8,7 @@ #include "game/data/data_01a3a0.h" #include "game/data/data_020df0.h" #include "game/data/data_02da90.h" -#include "game/data/inventory.h" +#include "game/inventory/items.h" #include "game/game_097ba0.h" #include "game/game_0b0420.h" #include "game/game_0b63b0.h" @@ -954,7 +954,7 @@ struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum) void currentPlayerGetWeaponSway(struct coord *sway) { - struct weapon *weapon = weaponFindById(getCurrentPlayerWeaponId(0)); + struct weapon *weapon = weaponFindById(handGetWeaponNum(HAND_RIGHT)); if (weapon) { sway->x = weapon->leftright; @@ -965,7 +965,7 @@ void currentPlayerGetWeaponSway(struct coord *sway) void currentPlayerSetWeaponSway(struct coord *sway) { - struct weapon *weapon = weaponFindById(getCurrentPlayerWeaponId(0)); + struct weapon *weapon = weaponFindById(handGetWeaponNum(HAND_RIGHT)); if (weapon) { weapon->leftright = sway->x; diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 4cb8693c2..d1e52fc6f 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -11,7 +11,7 @@ #include "game/data/data_01a3a0.h" #include "game/data/data_020df0.h" #include "game/data/data_02da90.h" -#include "game/data/inventory.h" +#include "game/inventory/items.h" #include "game/game_006bd0.h" #include "game/title.h" #include "game/chr/chr.h" @@ -32,7 +32,7 @@ #include "game/game_0f09f0.h" #include "game/game_102240.h" #include "game/game_107fb0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/explosions/explosions.h" #include "game/bondview.h" @@ -1301,7 +1301,7 @@ glabel var7f1ad568 /* f0b7550: ac40fffc */ sw $zero,-0x4($v0) /* f0b7554: 24100001 */ addiu $s0,$zero,0x1 .L0f0b7558: -/* f0b7558: 0fc446b5 */ jal func0f111ad4 +/* f0b7558: 0fc446b5 */ jal invHasSingleWeaponOrProp /* f0b755c: 02002025 */ or $a0,$s0,$zero /* f0b7560: 1040000a */ beqz $v0,.L0f0b758c /* f0b7564: 02002025 */ or $a0,$s0,$zero @@ -1336,7 +1336,7 @@ glabel var7f1ad568 /* f0b75cc: 1000000a */ b .L0f0b75f8 /* f0b75d0: 00000000 */ nop .L0f0b75d4: -/* f0b75d4: 0fc44580 */ jal currentPlayerClearInventory +/* f0b75d4: 0fc44580 */ jal invClear /* f0b75d8: 00000000 */ nop /* f0b75dc: 00001825 */ or $v1,$zero,$zero /* f0b75e0: 24020084 */ addiu $v0,$zero,0x84 @@ -1347,7 +1347,7 @@ glabel var7f1ad568 /* f0b75f0: 1462fffc */ bne $v1,$v0,.L0f0b75e4 /* f0b75f4: af0017a8 */ sw $zero,0x17a8($t8) .L0f0b75f8: -/* f0b75f8: 0fc44762 */ jal currentPlayerGiveWeapon +/* f0b75f8: 0fc44762 */ jal invGiveSingleWeapon /* f0b75fc: 24040001 */ addiu $a0,$zero,0x1 /* f0b7600: 5220003c */ beqzl $s1,.L0f0b76f4 /* f0b7604: 8e4c0298 */ lw $t4,0x298($s2) @@ -1383,12 +1383,12 @@ glabel var7f1ad568 /* f0b7674: 8e250008 */ lw $a1,0x8($s1) /* f0b7678: 04a00005 */ bltz $a1,.L0f0b7690 /* f0b767c: 00000000 */ nop -/* f0b7680: 0fc4478a */ jal currentPlayerGiveWeaponWithArgument +/* f0b7680: 0fc4478a */ jal invGiveDoubleWeapon /* f0b7684: 8e240004 */ lw $a0,0x4($s1) /* f0b7688: 10000016 */ b .L0f0b76e4 /* f0b768c: 26310010 */ addiu $s1,$s1,0x10 .L0f0b7690: -/* f0b7690: 0fc44762 */ jal currentPlayerGiveWeapon +/* f0b7690: 0fc44762 */ jal invGiveSingleWeapon /* f0b7694: 8e240004 */ lw $a0,0x4($s1) .L0f0b7698: /* f0b7698: 10000012 */ b .L0f0b76e4 @@ -1562,7 +1562,7 @@ glabel var7f1ad568 // } // // for (i = 1; i != ARRAYCOUNT(g_Weapons); i++) { -// if (func0f111ad4(i)) { +// if (invHasSingleWeaponOrProp(i)) { // s32 ammotype = weaponGetAmmoType(i, 0); // // if (ammotype >= 0 && ammotype <= AMMOTYPE_ECM_MINE) { @@ -1577,14 +1577,14 @@ glabel var7f1ad568 // } // } // } else { -// currentPlayerClearInventory(); +// invClear(); // // for (i = 0; i < ARRAYCOUNT(g_Vars.currentplayer->ammoheldarr); i++) { // g_Vars.currentplayer->ammoheldarr[i] = 0; // } // } // -// currentPlayerGiveWeapon(WEAPON_UNARMED); +// invGiveSingleWeapon(WEAPON_UNARMED); // // if (cmd) { // if (g_Vars.antiplayernum < 0 || g_Vars.currentplayer != g_Vars.anti) { @@ -1603,9 +1603,9 @@ glabel var7f1ad568 // case INTROCMD_WEAPON: // if (cmd[3] == 0) { // if (cmd[2] >= 0) { -// currentPlayerGiveWeaponWithArgument(cmd[1], cmd[2]); +// invGiveDoubleWeapon(cmd[1], cmd[2]); // } else { -// currentPlayerGiveWeapon(cmd[1]); +// invGiveSingleWeapon(cmd[1]); // } // } // cmd += 4; @@ -1986,8 +1986,8 @@ bool currentPlayerAssumeChrForAnti(struct chrdata *hostchr, bool force) struct weaponobj *weapon = hostchr->weapons_held[0]->weapon; u32 stack; - currentPlayerGiveWeapon(weapon->weaponnum); - currentPlayerGiveWeaponWithArgument(weapon->weaponnum, weapon->weaponnum); + invGiveSingleWeapon(weapon->weaponnum); + invGiveDoubleWeapon(weapon->weaponnum, weapon->weaponnum); currentPlayerEquipWeaponWrapper(HAND_RIGHT, weapon->weaponnum); currentPlayerEquipWeaponWrapper(HAND_LEFT, weapon->weaponnum); } else if (hostchr->weapons_held[0]) { @@ -1995,10 +1995,10 @@ bool currentPlayerAssumeChrForAnti(struct chrdata *hostchr, bool force) struct weaponobj *weapon = hostchr->weapons_held[0]->weapon; if (weapon->weaponnum == WEAPON_SUPERDRAGON) { - currentPlayerGiveWeapon(WEAPON_DRAGON); + invGiveSingleWeapon(WEAPON_DRAGON); currentPlayerEquipWeaponWrapper(HAND_RIGHT, WEAPON_DRAGON); } else { - currentPlayerGiveWeapon(weapon->weaponnum); + invGiveSingleWeapon(weapon->weaponnum); currentPlayerEquipWeaponWrapper(HAND_RIGHT, weapon->weaponnum); } } else if (hostchr->weapons_held[1]) { @@ -2006,15 +2006,15 @@ bool currentPlayerAssumeChrForAnti(struct chrdata *hostchr, bool force) struct weaponobj *weapon = hostchr->weapons_held[1]->weapon; if (weapon->weaponnum == WEAPON_SUPERDRAGON) { - currentPlayerGiveWeapon(WEAPON_DRAGON); + invGiveSingleWeapon(WEAPON_DRAGON); currentPlayerEquipWeaponWrapper(HAND_RIGHT, WEAPON_DRAGON); } else { - currentPlayerGiveWeapon(weapon->weaponnum); + invGiveSingleWeapon(weapon->weaponnum); currentPlayerEquipWeaponWrapper(HAND_RIGHT, weapon->weaponnum); } } else { // Unarmed - currentPlayerGiveWeapon(WEAPON_UNARMED); + invGiveSingleWeapon(WEAPON_UNARMED); currentPlayerEquipWeaponWrapper(HAND_RIGHT, WEAPON_UNARMED); } @@ -2105,7 +2105,7 @@ void currentPlayerSpawn(void) g_Vars.currentplayer->lifestarttime60 = getMissionTime(); g_Vars.currentplayer->healthdisplaytime60 = 0; - currentPlayerGiveWeapon(WEAPON_UNARMED); + invGiveSingleWeapon(WEAPON_UNARMED); currentPlayerSetShieldFrac(0); if (cheatIsActive(CHEAT_JOSHIELD)) { @@ -2122,7 +2122,7 @@ void currentPlayerSpawn(void) numsqdists = 0; force = false; - currentPlayerGiveWeapon(WEAPON_SUICIDEPILL); + invGiveSingleWeapon(WEAPON_SUICIDEPILL); currentPlayerEquipWeaponWrapper(HAND_LEFT, WEAPON_NONE); currentPlayerEquipWeaponWrapper(HAND_RIGHT, WEAPON_UNARMED); @@ -10148,7 +10148,7 @@ Gfx *func0f0c07c8(Gfx *gdl) if (g_Vars.currentplayer->cameramode != CAMERAMODE_EYESPY) { gdl = func0f0abcb0(gdl); - if (getCurrentPlayerWeaponId(0) == WEAPON_HORIZONSCANNER) { + if (handGetWeaponNum(HAND_RIGHT) == WEAPON_HORIZONSCANNER) { gdl = bviewRenderHorizonScanner(gdl); } diff --git a/src/game/game_0d7070.c b/src/game/game_0d7070.c index 517e3c71a..c2c3afabb 100644 --- a/src/game/game_0d7070.c +++ b/src/game/game_0d7070.c @@ -163,7 +163,7 @@ glabel func0f0d716c /* f0d7208: 10000009 */ b .L0f0d7230 /* f0d720c: 24020001 */ addiu $v0,$zero,0x1 .L0f0d7210: -/* f0d7210: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f0d7210: 0fc2866a */ jal handGetWeaponNum /* f0d7214: 00002025 */ or $a0,$zero,$zero /* f0d7218: 24010018 */ addiu $at,$zero,0x18 /* f0d721c: 54410004 */ bnel $v0,$at,.L0f0d7230 diff --git a/src/game/game_102240.c b/src/game/game_102240.c index 25cb4dd11..12f7e49f8 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -22,7 +22,7 @@ #include "game/game_0f09f0.h" #include "game/game_102240.h" #include "game/game_107fb0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_1531a0.h" #include "game/core.h" #include "game/mplayer/ingame.h" @@ -3660,18 +3660,18 @@ glabel var7f1b2e84 /* f1061a0: 8c2e2e48 */ lw $t6,%lo(var7f1b2e48)($at) /* f1061a4: 01c00008 */ jr $t6 /* f1061a8: 00000000 */ nop -/* f1061ac: 0fc44a54 */ jal currentPlayerGetNumInvItems +/* f1061ac: 0fc44a54 */ jal invGetCount /* f1061b0: 00000000 */ nop /* f1061b4: 8faf0028 */ lw $t7,0x28($sp) /* f1061b8: 10000071 */ b .L0f106380 /* f1061bc: ade20000 */ sw $v0,0x0($t7) /* f1061c0: 8fb80028 */ lw $t8,0x28($sp) -/* f1061c4: 0fc44b7f */ jal currentPlayerGetInvNameByIndex +/* f1061c4: 0fc44b7f */ jal invGetNameByIndex /* f1061c8: 8f040000 */ lw $a0,0x0($t8) /* f1061cc: 1000006e */ b .L0f106388 /* f1061d0: 8fbf0014 */ lw $ra,0x14($sp) /* f1061d4: 8fb90028 */ lw $t9,0x28($sp) -/* f1061d8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex +/* f1061d8: 0fc44b11 */ jal invGetWeaponNumByIndex /* f1061dc: 8f240000 */ lw $a0,0x0($t9) /* f1061e0: 24080001 */ addiu $t0,$zero,0x1 /* f1061e4: afa2001c */ sw $v0,0x1c($sp) @@ -3703,10 +3703,10 @@ glabel var7f1b2e84 /* f106240: 8fac0028 */ lw $t4,0x28($sp) /* f106244: 51600016 */ beqzl $t3,.L0f1062a0 /* f106248: 8fad0028 */ lw $t5,0x28($sp) -/* f10624c: 0fc44bd8 */ jal currentPlayerSetEquipCurItem +/* f10624c: 0fc44bd8 */ jal invSetCurrentIndex /* f106250: 8d840000 */ lw $a0,0x0($t4) /* f106254: 8fa4001c */ lw $a0,0x1c($sp) -/* f106258: 0fc4473e */ jal func0f111cf8 +/* f106258: 0fc4473e */ jal invHasDoubleWeaponIncAllGuns /* f10625c: 00802825 */ or $a1,$a0,$zero /* f106260: 10400009 */ beqz $v0,.L0f106288 /* f106264: 00002025 */ or $a0,$zero,$zero @@ -3730,13 +3730,13 @@ glabel var7f1b2e84 /* f1062a4: 8dae0000 */ lw $t6,0x0($t5) /* f1062a8: 10000035 */ b .L0f106380 /* f1062ac: ac2e11f0 */ sw $t6,%lo(var800711f0)($at) -/* f1062b0: 0fc44bd4 */ jal currentPlayerGetEquipCurItem +/* f1062b0: 0fc44bd4 */ jal invGetCurrentIndex /* f1062b4: 00000000 */ nop /* f1062b8: 8faf0028 */ lw $t7,0x28($sp) /* f1062bc: 10000030 */ b .L0f106380 /* f1062c0: ade20000 */ sw $v0,0x0($t7) /* f1062c4: 8fb80028 */ lw $t8,0x28($sp) -/* f1062c8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex +/* f1062c8: 0fc44b11 */ jal invGetWeaponNumByIndex /* f1062cc: 8f040000 */ lw $a0,0x0($t8) /* f1062d0: 1040002b */ beqz $v0,.L0f106380 /* f1062d4: 00402025 */ or $a0,$v0,$zero @@ -3748,7 +3748,7 @@ glabel var7f1b2e84 /* f1062ec: 10000024 */ b .L0f106380 /* f1062f0: af220004 */ sw $v0,0x4($t9) /* f1062f4: 8fa80028 */ lw $t0,0x28($sp) -/* f1062f8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex +/* f1062f8: 0fc44b11 */ jal invGetWeaponNumByIndex /* f1062fc: 8d040000 */ lw $a0,0x0($t0) /* f106300: 3c03800a */ lui $v1,%hi(g_InventoryWeapon) /* f106304: 246321c0 */ addiu $v1,$v1,%lo(g_InventoryWeapon) diff --git a/src/game/game_127910.c b/src/game/game_127910.c index 1633bada1..9418307a2 100644 --- a/src/game/game_127910.c +++ b/src/game/game_127910.c @@ -1457,27 +1457,27 @@ glabel weaponGetModel // return -1; //} -void currentPlayerSetWeaponFlag4(s32 weaponslot) +void currentPlayerSetWeaponFlag4(s32 hand) { - chrSetObjHiddenFlag4OnWeapon(g_Vars.currentplayer->prop->chr, weaponslot); + chrSetObjHiddenFlag4OnWeapon(g_Vars.currentplayer->prop->chr, hand); } -void func0f128d20(s32 slot) +void func0f128d20(s32 hand) { struct chrdata *chr = g_Vars.currentplayer->prop->chr; - if (chr->weapons_held[slot] == NULL) { - s32 weaponnum = getCurrentPlayerWeaponId(slot); + if (chr->weapons_held[hand] == NULL) { + s32 weaponnum = handGetWeaponNum(hand); s32 modelnum = weaponGetModel(weaponnum); - if (slot == 1 && weaponnum == WEAPON_REMOTEMINE) { + if (hand == HAND_LEFT && weaponnum == WEAPON_REMOTEMINE) { modelnum = -1; } if (modelnum >= 0) { u32 flags; - if (slot == 0) { + if (hand == HAND_RIGHT) { flags = 0; } else { flags = 0x10000000; diff --git a/src/game/game_157db0.c b/src/game/game_157db0.c index 8a5c42511..7a8df5da9 100644 --- a/src/game/game_157db0.c +++ b/src/game/game_157db0.c @@ -13525,7 +13525,7 @@ glabel func0f162d9c /* f162e40: c6c417a0 */ lwc1 $f4,0x17a0($s6) /* f162e44: 4600218d */ trunc.w.s $f6,$f4 /* f162e48: 440c3000 */ mfc1 $t4,$f6 -/* f162e4c: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f162e4c: 0fc2866a */ jal handGetWeaponNum /* f162e50: a7ac0082 */ sh $t4,0x82($sp) /* f162e54: 24010016 */ addiu $at,$zero,0x16 /* f162e58: 5441000d */ bnel $v0,$at,.L0f162e90 diff --git a/src/game/game_1a7560.c b/src/game/game_1a7560.c index 74194a4d0..98c52c5a9 100644 --- a/src/game/game_1a7560.c +++ b/src/game/game_1a7560.c @@ -16,7 +16,7 @@ #include "game/game_0e0770.h" #include "game/game_0f09f0.h" #include "game/game_102240.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_1531a0.h" #include "game/game_166e40.h" #include "game/game_16e810.h" diff --git a/src/game/game_012450.c b/src/game/inventory/init.c similarity index 80% rename from src/game/game_012450.c rename to src/game/inventory/init.c index b7552f2ce..ef0c2520a 100644 --- a/src/game/game_012450.c +++ b/src/game/inventory/init.c @@ -9,13 +9,13 @@ #include "game/data/data_01a3a0.h" #include "game/data/data_020df0.h" #include "game/data/data_02da90.h" -#include "game/game_012450.h" -#include "game/game_111600.h" +#include "game/inventory/init.h" +#include "game/inventory/inventory.h" #include "gvars/gvars.h" #include "lib/lib_121e0.h" #include "types.h" -void currentPlayerInitGunsHeld(void) +void invInitGunsHeld(void) { s32 i; @@ -30,9 +30,9 @@ void currentPlayerInitGunsHeld(void) } } -void func0f012530(s32 arg0) +void invInit(s32 numdoubles) { - g_Vars.currentplayer->equipmaxitems = arg0 + 30; + g_Vars.currentplayer->equipmaxitems = numdoubles + 30; g_Vars.currentplayer->equipment = malloc(ALIGN16(g_Vars.currentplayer->equipmaxitems * sizeof(struct invitem)), 4); - currentPlayerClearInventory(); + invClear(); } diff --git a/src/game/game_111600.c b/src/game/inventory/inventory.c similarity index 89% rename from src/game/game_111600.c rename to src/game/inventory/inventory.c index d4ceff001..032bb25a7 100644 --- a/src/game/game_111600.c +++ b/src/game/inventory/inventory.c @@ -10,14 +10,14 @@ #include "game/data/data_02da90.h" #include "game/game_097ba0.h" #include "game/game_0b0420.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/training/training.h" #include "game/lang.h" #include "gvars/gvars.h" #include "lib/main.h" #include "types.h" -void currentPlayerClearInventory(void) +void invClear(void) { s32 i; @@ -35,7 +35,7 @@ void currentPlayerClearInventory(void) * Subject is expected to initially be at the head of the list. It works by * swapping the subject with the item to its right as many times as needed. */ -void currentPlayerSortInvItem(struct invitem *subject) +void invSortItem(struct invitem *subject) { struct invitem *candidate; s32 subjweapon1 = -1; @@ -99,13 +99,13 @@ void currentPlayerSortInvItem(struct invitem *subject) } } -void currentPlayerInsertInvItem(struct invitem *item) +void invInsertItem(struct invitem *item) { if (item->type == INVITEMTYPE_PROP) { struct prop *prop = item->type_prop.prop; if (prop && prop->obj) { - struct textoverride *override = objGetTextOverride(prop->obj); + struct textoverride *override = invGetTextOverrideForObj(prop->obj); bool setflag = true; if (override) { @@ -143,11 +143,11 @@ void currentPlayerInsertInvItem(struct invitem *item) g_Vars.currentplayer->weapons = item; - currentPlayerSortInvItem(item); - currentPlayerCalculateEquipCurItem(); + invSortItem(item); + invCalculateCurrentIndex(); } -void currentPlayerRemoveInvItem(struct invitem *item) +void invRemoveItem(struct invitem *item) { struct invitem *next = item->next; struct invitem *prev = item->prev; @@ -164,10 +164,10 @@ void currentPlayerRemoveInvItem(struct invitem *item) prev->next = next; item->type = -1; - currentPlayerCalculateEquipCurItem(); + invCalculateCurrentIndex(); } -struct invitem *currentPlayerGetUnusedInvItem(void) +struct invitem *invFindUnusedSlot(void) { s32 i; @@ -180,22 +180,22 @@ struct invitem *currentPlayerGetUnusedInvItem(void) return NULL; } -void currentPlayerSetAllGuns(bool enable) +void invSetAllGuns(bool enable) { s32 weaponnum; g_Vars.currentplayer->equipallguns = enable; - currentPlayerCalculateEquipCurItem(); - weaponnum = currentPlayerGetWeaponNumByInvIndex(g_Vars.currentplayer->equipcuritem); + invCalculateCurrentIndex(); + weaponnum = invGetWeaponNumByIndex(g_Vars.currentplayer->equipcuritem); currentPlayerEquipWeapon(weaponnum); } -bool currentPlayerHasAllGuns(void) +bool invHasAllGuns(void) { return g_Vars.currentplayer->equipallguns; } -struct invitem *currentPlayerGetWeaponInvItem(s32 weaponnum) +struct invitem *invFindSingleWeapon(s32 weaponnum) { struct invitem *first = g_Vars.currentplayer->weapons; struct invitem *item = first; @@ -215,12 +215,12 @@ struct invitem *currentPlayerGetWeaponInvItem(s32 weaponnum) return NULL; } -bool currentPlayerHasWeapon(s32 weaponnum) +bool invHasSingleWeaponExcAllGuns(s32 weaponnum) { - return currentPlayerGetWeaponInvItem(weaponnum) != NULL; + return invFindSingleWeapon(weaponnum) != NULL; } -struct invitem *func0f111a4c(s32 weapon1, s32 weapon2) +struct invitem *invFindDoubleWeapon(s32 weapon1, s32 weapon2) { struct invitem *first = g_Vars.currentplayer->weapons; struct invitem *item = first; @@ -242,13 +242,13 @@ struct invitem *func0f111a4c(s32 weapon1, s32 weapon2) return NULL; } -bool func0f111ab0(s32 weapon1, s32 weapon2) +bool invHasDoubleWeaponExcAllGuns(s32 weapon1, s32 weapon2) { - return func0f111a4c(weapon1, weapon2) != NULL; + return invFindDoubleWeapon(weapon1, weapon2) != NULL; } GLOBAL_ASM( -glabel func0f111ad4 +glabel invHasSingleWeaponOrProp /* f111ad4: 3c0e800a */ lui $t6,%hi(g_Vars+0x284) /* f111ad8: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6) /* f111adc: 00802825 */ or $a1,$a0,$zero @@ -302,7 +302,7 @@ glabel func0f111ad4 ); // regalloc -//bool func0f111ad4(s32 weaponnum) +//bool invHasSingleWeaponOrProp(s32 weaponnum) //{ // struct invitem *item = g_Vars.currentplayer->weapons; // @@ -378,7 +378,7 @@ s32 currentStageForbidsSlayer(void) return forbids; } -bool currentPlayerCanHaveAllGunsWeapon(s32 weaponnum) +bool invCanHaveAllGunsWeapon(s32 weaponnum) { bool canhave = true; @@ -395,18 +395,18 @@ bool currentPlayerCanHaveAllGunsWeapon(s32 weaponnum) return canhave; } -bool currentPlayerCanHaveWeapon(s32 weaponnum) +bool invHasSingleWeaponIncAllGuns(s32 weaponnum) { if (g_Vars.currentplayer->equipallguns && weaponnum && weaponnum <= WEAPON_PSYCHOSISGUN && - currentPlayerCanHaveAllGunsWeapon(weaponnum)) { + invCanHaveAllGunsWeapon(weaponnum)) { return true; } - return currentPlayerHasWeapon(weaponnum); + return invHasSingleWeaponExcAllGuns(weaponnum); } -bool func0f111cf8(s32 weapon1, s32 weapon2) +bool invHasDoubleWeaponIncAllGuns(s32 weapon1, s32 weapon2) { if (weapon2 == WEAPON_NONE) { return true; @@ -416,33 +416,33 @@ bool func0f111cf8(s32 weapon1, s32 weapon2) weapon1 <= WEAPON_PSYCHOSISGUN && weapon1 == weapon2 && weaponHasFlag(weapon1, WEAPONFLAG_DUALWIELD) && - currentPlayerCanHaveAllGunsWeapon(weapon1)) { + invCanHaveAllGunsWeapon(weapon1)) { return true; } - return func0f111ab0(weapon1, weapon2); + return invHasDoubleWeaponExcAllGuns(weapon1, weapon2); } -bool currentPlayerGiveWeapon(s32 weaponnum) +bool invGiveSingleWeapon(s32 weaponnum) { frSetWeaponFound(weaponnum); - if (currentPlayerHasWeapon(weaponnum) == 0) { + if (invHasSingleWeaponExcAllGuns(weaponnum) == 0) { struct invitem *item; if (g_Vars.currentplayer->equipallguns && weaponnum <= WEAPON_PSYCHOSISGUN && - currentPlayerCanHaveAllGunsWeapon(weaponnum)) { + invCanHaveAllGunsWeapon(weaponnum)) { return false; } - item = currentPlayerGetUnusedInvItem(); + item = invFindUnusedSlot(); if (item) { item->type = INVITEMTYPE_WEAP; item->type_weap.weapon1 = weaponnum; item->type_weap.pickuppad = -1; - currentPlayerInsertInvItem(item); + invInsertItem(item); } return true; @@ -451,17 +451,17 @@ bool currentPlayerGiveWeapon(s32 weaponnum) return false; } -bool currentPlayerGiveWeaponWithArgument(s32 weapon1, s32 weapon2) +bool invGiveDoubleWeapon(s32 weapon1, s32 weapon2) { - if (func0f111ab0(weapon1, weapon2) == 0) { + if (invHasDoubleWeaponExcAllGuns(weapon1, weapon2) == 0) { if (weaponHasFlag(weapon1, WEAPONFLAG_DUALWIELD)) { - struct invitem *item = currentPlayerGetUnusedInvItem(); + struct invitem *item = invFindUnusedSlot(); if (item) { item->type = INVITEMTYPE_DUAL; item->type_dual.weapon1 = weapon1; item->type_dual.weapon2 = weapon2; - currentPlayerInsertInvItem(item); + invInsertItem(item); } return true; @@ -475,7 +475,7 @@ bool currentPlayerGiveWeaponWithArgument(s32 weapon1, s32 weapon2) return false; } -void currentPlayerRemoveWeapon(s32 weaponnum) +void invRemoveItemByNum(s32 weaponnum) { if (g_Vars.currentplayer->weapons) { // Begin iterating from the second item in the list. This is required @@ -485,23 +485,23 @@ void currentPlayerRemoveWeapon(s32 weaponnum) while (true) { // Have to preload this because item->next shouldn't be trusted - // after calling currentPlayerRemoveInvItem() + // after calling invRemoveItem() struct invitem *next = item->next; if (item->type == INVITEMTYPE_PROP) { struct prop *prop = item->type_prop.prop; - struct textoverride *override = objGetTextOverride(prop->obj); + struct textoverride *override = invGetTextOverrideForObj(prop->obj); if (override && override->weapon == weaponnum) { - currentPlayerRemoveInvItem(item); + invRemoveItem(item); } } else if (item->type == INVITEMTYPE_WEAP) { if (item->type_weap.weapon1 == weaponnum) { - currentPlayerRemoveInvItem(item); + invRemoveItem(item); } } else if (item->type == INVITEMTYPE_DUAL) { if (item->type_dual.weapon1 == weaponnum || item->type_dual.weapon2 == weaponnum) { - currentPlayerRemoveInvItem(item); + invRemoveItem(item); } } @@ -514,7 +514,7 @@ void currentPlayerRemoveWeapon(s32 weaponnum) } } -bool currentPlayerGiveProp(struct prop *prop) +bool invGiveProp(struct prop *prop) { struct invitem *item; @@ -529,18 +529,18 @@ bool currentPlayerGiveProp(struct prop *prop) return true; } - item = currentPlayerGetUnusedInvItem(); + item = invFindUnusedSlot(); if (item) { item->type = INVITEMTYPE_PROP; item->type_prop.prop = prop; - currentPlayerInsertInvItem(item); + invInsertItem(item); } return true; } -void currentPlayerRemoveProp(struct prop *prop) +void invRemoveProp(struct prop *prop) { if (g_Vars.currentplayer->weapons) { struct invitem *item = g_Vars.currentplayer->weapons->next; @@ -549,7 +549,7 @@ void currentPlayerRemoveProp(struct prop *prop) struct invitem *next = item->next; if (item->type == INVITEMTYPE_PROP && item->type_prop.prop == prop) { - currentPlayerRemoveInvItem(item); + invRemoveItem(item); } if (item == g_Vars.currentplayer->weapons || !g_Vars.currentplayer->weapons) { @@ -592,7 +592,7 @@ glabel func0f1120f0 .L0f112158: /* f112158: 02002025 */ or $a0,$s0,$zero .L0f11215c: -/* f11215c: 0fc44762 */ jal currentPlayerGiveWeapon +/* f11215c: 0fc44762 */ jal invGiveSingleWeapon /* f112160: afa7002c */ sw $a3,0x2c($sp) /* f112164: 10400002 */ beqz $v0,.L0f112170 /* f112168: 8fa7002c */ lw $a3,0x2c($sp) @@ -610,12 +610,12 @@ glabel func0f1120f0 /* f112194: 8fa7002c */ lw $a3,0x2c($sp) /* f112198: 02002025 */ or $a0,$s0,$zero /* f11219c: 02002825 */ or $a1,$s0,$zero -/* f1121a0: 0fc446ac */ jal func0f111ab0 +/* f1121a0: 0fc446ac */ jal invHasDoubleWeaponExcAllGuns /* f1121a4: afa7002c */ sw $a3,0x2c($sp) /* f1121a8: 1440001b */ bnez $v0,.L0f112218 /* f1121ac: 8fa7002c */ lw $a3,0x2c($sp) /* f1121b0: 02002025 */ or $a0,$s0,$zero -/* f1121b4: 0fc44674 */ jal currentPlayerGetWeaponInvItem +/* f1121b4: 0fc44674 */ jal invFindSingleWeapon /* f1121b8: afa7002c */ sw $a3,0x2c($sp) /* f1121bc: 10400016 */ beqz $v0,.L0f112218 /* f1121c0: 8fa7002c */ lw $a3,0x2c($sp) @@ -635,7 +635,7 @@ glabel func0f1120f0 /* f1121f4: 8fa30024 */ lw $v1,0x24($sp) /* f1121f8: 10640007 */ beq $v1,$a0,.L0f112218 /* f1121fc: 02002825 */ or $a1,$s0,$zero -/* f112200: 0fc4478a */ jal currentPlayerGiveWeaponWithArgument +/* f112200: 0fc4478a */ jal invGiveDoubleWeapon /* f112204: 02002025 */ or $a0,$s0,$zero /* f112208: 10400003 */ beqz $v0,.L0f112218 /* f11220c: 00003825 */ or $a3,$zero,$zero @@ -653,12 +653,12 @@ glabel func0f1120f0 /* f112234: 000950c0 */ sll $t2,$t1,0x3 /* f112238: 05410005 */ bgez $t2,.L0f112250 /* f11223c: 00000000 */ nop -/* f112240: 0fc446ac */ jal func0f111ab0 +/* f112240: 0fc446ac */ jal invHasDoubleWeaponExcAllGuns /* f112244: 9044005c */ lbu $a0,0x5c($v0) /* f112248: 10000004 */ b .L0f11225c /* f11224c: 2c470001 */ sltiu $a3,$v0,0x1 .L0f112250: -/* f112250: 0fc446ac */ jal func0f111ab0 +/* f112250: 0fc446ac */ jal invHasDoubleWeaponExcAllGuns /* f112254: 9045005c */ lbu $a1,0x5c($v0) /* f112258: 2c470001 */ sltiu $a3,$v0,0x1 .L0f11225c: @@ -679,7 +679,7 @@ glabel func0f1120f0 /* f112290: 000e78c0 */ sll $t7,$t6,0x3 /* f112294: 05e10009 */ bgez $t7,.L0f1122bc /* f112298: 00000000 */ nop -/* f11229c: 0fc4478a */ jal currentPlayerGiveWeaponWithArgument +/* f11229c: 0fc4478a */ jal invGiveDoubleWeapon /* f1122a0: 00c02025 */ or $a0,$a2,$zero /* f1122a4: 10400003 */ beqz $v0,.L0f1122b4 /* f1122a8: 00000000 */ nop @@ -689,7 +689,7 @@ glabel func0f1120f0 /* f1122b4: 10000007 */ b .L0f1122d4 /* f1122b8: 00003825 */ or $a3,$zero,$zero .L0f1122bc: -/* f1122bc: 0fc4478a */ jal currentPlayerGiveWeaponWithArgument +/* f1122bc: 0fc4478a */ jal invGiveDoubleWeapon /* f1122c0: 00c02825 */ or $a1,$a2,$zero /* f1122c4: 10400003 */ beqz $v0,.L0f1122d4 /* f1122c8: 00003825 */ or $a3,$zero,$zero @@ -778,7 +778,7 @@ glabel func0f1122ec /* f1123e4: 10400008 */ beqz $v0,.L0f112408 /* f1123e8: 00000000 */ nop .L0f1123ec: -/* f1123ec: 0fc4470c */ jal currentPlayerCanHaveAllGunsWeapon +/* f1123ec: 0fc4470c */ jal invCanHaveAllGunsWeapon /* f1123f0: 02002025 */ or $a0,$s0,$zero /* f1123f4: 10400004 */ beqz $v0,.L0f112408 /* f1123f8: 00000000 */ nop @@ -944,7 +944,7 @@ glabel func0f11253c /* f112620: 5040ffe2 */ beqzl $v0,.L0f1125ac /* f112624: 2619002c */ addiu $t9,$s0,0x2c .L0f112628: -/* f112628: 0fc4470c */ jal currentPlayerCanHaveAllGunsWeapon +/* f112628: 0fc4470c */ jal invCanHaveAllGunsWeapon /* f11262c: 02002025 */ or $a0,$s0,$zero /* f112630: 5040ffde */ beqzl $v0,.L0f1125ac /* f112634: 2619002c */ addiu $t9,$s0,0x2c @@ -1049,7 +1049,7 @@ glabel func0f11253c ); GLOBAL_ASM( -glabel currentPlayerHasKeyFlags +glabel invHasKeyFlags /* f112790: 3c0e800a */ lui $t6,%hi(g_Vars+0x284) /* f112794: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6) /* f112798: 27bdfff8 */ addiu $sp,$sp,-8 @@ -1099,7 +1099,7 @@ glabel currentPlayerHasKeyFlags /* f112838: 27bd0008 */ addiu $sp,$sp,0x8 ); -//bool currentPlayerHasKeyFlags(u32 wantkeyflags) +//bool invHasKeyFlags(u32 wantkeyflags) //{ // struct invitem *item = g_Vars.currentplayer->weapons; // u32 heldkeyflags = 0; @@ -1140,19 +1140,19 @@ bool func0f11283c(void) return false; } -bool currentPlayerHasBriefcase(void) +bool invHasBriefcase(void) { if (g_Vars.currentplayer->isdead == false) { - return currentPlayerHasWeapon(WEAPON_BRIEFCASE2); + return invHasSingleWeaponExcAllGuns(WEAPON_BRIEFCASE2); } return false; } -bool currentPlayerHasDataUplink(void) +bool invHasDataUplink(void) { if (g_Vars.currentplayer->isdead == false) { - return currentPlayerHasWeapon(WEAPON_DATAUPLINK); + return invHasSingleWeaponExcAllGuns(WEAPON_DATAUPLINK); } return false; @@ -1163,7 +1163,7 @@ bool func0f1128c4(void) return false; } -bool currentPlayerHasProp(struct prop *prop) +bool invHasProp(struct prop *prop) { struct invitem *item = g_Vars.currentplayer->weapons; struct prop *child; @@ -1193,7 +1193,7 @@ bool currentPlayerHasProp(struct prop *prop) return false; } -s32 currentPlayerGetNumInvItems(void) +s32 invGetCount(void) { s32 numitems = 0; struct invitem *item; @@ -1240,7 +1240,7 @@ s32 currentPlayerGetNumInvItems(void) return numitems; } -struct invitem *currentPlayerGetInvItemByIndex(s32 index) +struct invitem *invGetItemByIndex(s32 index) { struct invitem *item; @@ -1299,7 +1299,7 @@ struct invitem *currentPlayerGetInvItemByIndex(s32 index) return NULL; } -struct textoverride *objGetTextOverride(struct defaultobj *obj) +struct textoverride *invGetTextOverrideForObj(struct defaultobj *obj) { struct textoverride *override = g_Vars.textoverrides; @@ -1314,7 +1314,7 @@ struct textoverride *objGetTextOverride(struct defaultobj *obj) return NULL; } -struct textoverride *weaponGetTextOverride(s32 weaponnum) +struct textoverride *invGetTextOverrideForWeapon(s32 weaponnum) { struct textoverride *override = g_Vars.textoverrides; @@ -1329,14 +1329,14 @@ struct textoverride *weaponGetTextOverride(s32 weaponnum) return NULL; } -s32 currentPlayerGetWeaponNumByInvIndex(s32 index) +s32 invGetWeaponNumByIndex(s32 index) { - struct invitem *item = currentPlayerGetInvItemByIndex(index); + struct invitem *item = invGetItemByIndex(index); if (item) { if (item->type == INVITEMTYPE_PROP) { struct prop *prop = item->type_prop.prop; - struct textoverride *override = objGetTextOverride(prop->obj); + struct textoverride *override = invGetTextOverrideForObj(prop->obj); if (override) { return override->weapon; @@ -1354,16 +1354,16 @@ s32 currentPlayerGetWeaponNumByInvIndex(s32 index) return 0; } -u16 currentPlayerGetInvNameIdByIndex(s32 index) +u16 invGetNameIdByIndex(s32 index) { - struct invitem *item = currentPlayerGetInvItemByIndex(index); + struct invitem *item = invGetItemByIndex(index); s32 weaponnum = 0; struct textoverride *override; if (item) { if (item->type == INVITEMTYPE_PROP) { struct prop *prop = item->type_prop.prop; - override = objGetTextOverride(prop->obj); + override = invGetTextOverrideForObj(prop->obj); if (override) { if (override->unk14) { @@ -1374,7 +1374,7 @@ u16 currentPlayerGetInvNameIdByIndex(s32 index) } } else if (item->type == INVITEMTYPE_WEAP) { weaponnum = item->type_weap.weapon1; - override = weaponGetTextOverride(weaponnum); + override = invGetTextOverrideForWeapon(weaponnum); if (override && override->unk14) { return override->unk14; @@ -1392,21 +1392,21 @@ u16 currentPlayerGetInvNameIdByIndex(s32 index) return weaponGetNameId(weaponnum); } -char *currentPlayerGetInvNameByIndex(s32 index) +char *invGetNameByIndex(s32 index) { - return langGet(currentPlayerGetInvNameIdByIndex(index)); + return langGet(invGetNameIdByIndex(index)); } -char *currentPlayerGetInvShortNameByIndex(s32 index) +char *invGetShortNameByIndex(s32 index) { - struct invitem *item = currentPlayerGetInvItemByIndex(index); + struct invitem *item = invGetItemByIndex(index); s32 weaponnum = 0; struct textoverride *override; if (item) { if (item->type == INVITEMTYPE_PROP) { struct prop *prop = item->type_prop.prop; - override = objGetTextOverride(prop->obj); + override = invGetTextOverrideForObj(prop->obj); if (override) { if (override->unk14) { @@ -1417,7 +1417,7 @@ char *currentPlayerGetInvShortNameByIndex(s32 index) } } else if (item->type == INVITEMTYPE_WEAP) { weaponnum = item->type_weap.weapon1; - override = weaponGetTextOverride(weaponnum); + override = invGetTextOverrideForWeapon(weaponnum); if (override && override->unk14) { return langGet(override->unk14); @@ -1433,40 +1433,40 @@ char *currentPlayerGetInvShortNameByIndex(s32 index) return weaponGetShortName(weaponnum); } -void textoverrideInsert(struct textoverride *override) +void invInsertTextOverride(struct textoverride *override) { override->next = g_Vars.textoverrides; g_Vars.textoverrides = override; } -u32 currentPlayerGetEquipCurItem(void) +u32 invGetCurrentIndex(void) { return g_Vars.currentplayer->equipcuritem; } -void currentPlayerSetEquipCurItem(u32 item) +void invSetCurrentIndex(u32 item) { g_Vars.currentplayer->equipcuritem = item; } -void currentPlayerCalculateEquipCurItem(void) +void invCalculateCurrentIndex(void) { - s32 curweaponnum = getCurrentPlayerWeaponId(0); + s32 curweaponnum = handGetWeaponNum(HAND_RIGHT); s32 i; g_Vars.currentplayer->equipcuritem = 0; - for (i = 0; i < currentPlayerGetNumInvItems(); i++) { - if (currentPlayerGetWeaponNumByInvIndex(i) == curweaponnum) { + for (i = 0; i < invGetCount(); i++) { + if (invGetWeaponNumByIndex(i) == curweaponnum) { g_Vars.currentplayer->equipcuritem = i; break; } } } -char *objGetActivatedText(struct defaultobj *obj) +char *invGetActivatedTextByObj(struct defaultobj *obj) { - struct textoverride *override = objGetTextOverride(obj); + struct textoverride *override = invGetTextOverrideForObj(obj); if (override && override->activatetextid) { return langGet(override->activatetextid); @@ -1475,9 +1475,9 @@ char *objGetActivatedText(struct defaultobj *obj) return NULL; } -char *weaponGetActivatedText(s32 weaponnum) +char *invGetActivatedTextByWeaponNum(s32 weaponnum) { - struct textoverride *override = weaponGetTextOverride(weaponnum); + struct textoverride *override = invGetTextOverrideForWeapon(weaponnum); if (override && override->activatetextid) { return langGet(override->activatetextid); @@ -1486,7 +1486,7 @@ char *weaponGetActivatedText(s32 weaponnum) return NULL; } -void currentPlayerIncrementGunHeldTime(s32 weapon1, s32 weapon2) +void invIncrementHeldTime(s32 weapon1, s32 weapon2) { s32 leastusedtime; s32 leastusedindex; @@ -1531,7 +1531,7 @@ void currentPlayerIncrementGunHeldTime(s32 weapon1, s32 weapon2) } } -void currentPlayerGetWeaponOfChoice(s32 *weapon1, s32 *weapon2) +void invGetWeaponOfChoice(s32 *weapon1, s32 *weapon2) { s32 mosttime = -1; s32 i; diff --git a/src/game/data/inventory.c b/src/game/inventory/items.c similarity index 99% rename from src/game/data/inventory.c rename to src/game/inventory/items.c index e838d0e7c..af8551a58 100644 --- a/src/game/data/inventory.c +++ b/src/game/inventory/items.c @@ -2,7 +2,7 @@ #include "game/chr/chraicommands.h" #include "game/game_000000.h" #include "game/game_0601b0.h" -#include "game/data/inventory.h" +#include "game/inventory/items.h" #include "stagesetup.h" #include "types.h" diff --git a/src/game/mplayer/options.c b/src/game/mplayer/options.c index 774ad5d06..0730ff0e5 100644 --- a/src/game/mplayer/options.c +++ b/src/game/mplayer/options.c @@ -20,7 +20,7 @@ #include "game/game_0d4690.h" #include "game/game_0dcdb0.h" #include "game/game_0f09f0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/game_1531a0.h" #include "game/mplayer/setup.h" @@ -1442,7 +1442,7 @@ glabel chrGiveBriefcase /* f186998: 03197821 */ addu $t7,$t8,$t9 /* f18699c: afaf0050 */ sw $t7,0x50($sp) .L0f1869a0: -/* f1869a0: 0fc44762 */ jal currentPlayerGiveWeapon +/* f1869a0: 0fc44762 */ jal invGiveSingleWeapon /* f1869a4: 24040057 */ addiu $a0,$zero,0x57 /* f1869a8: 24040057 */ addiu $a0,$zero,0x57 /* f1869ac: 0fc221f2 */ jal currentPlayerQueuePickupWeaponHudmsg @@ -1633,7 +1633,7 @@ glabel chrGiveBriefcase .L0f186c40: /* f186c40: 546000b9 */ bnezl $v1,.L0f186f28 /* f186c44: 8fad0128 */ lw $t5,0x128($sp) -/* f186c48: 0fc44a11 */ jal currentPlayerHasBriefcase +/* f186c48: 0fc44a11 */ jal invHasBriefcase /* f186c4c: 00000000 */ nop /* f186c50: 504000b5 */ beqzl $v0,.L0f186f28 /* f186c54: 8fad0128 */ lw $t5,0x128($sp) @@ -1686,7 +1686,7 @@ glabel chrGiveBriefcase /* f186d00: e7a40014 */ swc1 $f4,0x14($sp) /* f186d04: 0fc24494 */ jal func0f091250 /* f186d08: 24040057 */ addiu $a0,$zero,0x57 -/* f186d0c: 0fc447a9 */ jal currentPlayerRemoveWeapon +/* f186d0c: 0fc447a9 */ jal invRemoveItemByNum /* f186d10: 24040057 */ addiu $a0,$zero,0x57 .L0f186d14: /* f186d14: 0fc5b9f1 */ jal langGet @@ -1855,7 +1855,7 @@ glabel chrGiveBriefcase .L0f186f5c: /* f186f5c: 546000b8 */ bnezl $v1,.L0f187240 /* f186f60: 8fac0128 */ lw $t4,0x128($sp) -/* f186f64: 0fc44a11 */ jal currentPlayerHasBriefcase +/* f186f64: 0fc44a11 */ jal invHasBriefcase /* f186f68: 00000000 */ nop /* f186f6c: 144000b3 */ bnez $v0,.L0f18723c /* f186f70: 8faf0128 */ lw $t7,0x128($sp) @@ -2231,7 +2231,7 @@ bool chrGiveUplink(struct chrdata *chr, struct prop *prop) obj->hidden |= 4; return false; } else { - currentPlayerGiveWeapon(WEAPON_DATAUPLINK); + invGiveSingleWeapon(WEAPON_DATAUPLINK); currentPlayerQueuePickupWeaponHudmsg(WEAPON_DATAUPLINK, false); func0f087d10(WEAPON_DATAUPLINK); func0f06ad2c(obj, 0, obj->hidden2 & OBJH2FLAG_04); diff --git a/src/game/mplayer/scenarios.c b/src/game/mplayer/scenarios.c index e1dd183f4..51ae1b57b 100644 --- a/src/game/mplayer/scenarios.c +++ b/src/game/mplayer/scenarios.c @@ -20,7 +20,7 @@ #include "game/game_0d4690.h" #include "game/game_0dcdb0.h" #include "game/game_0f09f0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/game_1531a0.h" #include "game/mplayer/setup.h" @@ -545,7 +545,7 @@ void scenarioHtbCallback10(void) for (i = 0; i < PLAYERCOUNT(); i++) { setCurrentPlayerNum(i); - if (currentPlayerHasBriefcase()) { + if (invHasBriefcase()) { g_ScenarioData.htb.token = g_Vars.currentplayer->prop; break; } @@ -596,7 +596,7 @@ void scenarioHtbCallback14(struct chrdata *chr) chr->aibot->unk0a0 = 0; } } else { - if (currentPlayerHasBriefcase()) { + if (invHasBriefcase()) { g_Vars.currentplayerstats->tokenheldtime += g_Vars.lvupdate240; if (g_Vars.currentplayerstats->tokenheldtime >= SECSTOTIME240(30)) { @@ -617,7 +617,7 @@ glabel scenarioHtbCallback18 /* f18079c: 27bdff58 */ addiu $sp,$sp,-168 /* f1807a0: afbf003c */ sw $ra,0x3c($sp) /* f1807a4: afb00038 */ sw $s0,0x38($sp) -/* f1807a8: 0fc44a11 */ jal currentPlayerHasBriefcase +/* f1807a8: 0fc44a11 */ jal invHasBriefcase /* f1807ac: 00808025 */ or $s0,$a0,$zero /* f1807b0: 50400067 */ beqzl $v0,.L0f180950 /* f1807b4: 8fbf003c */ lw $ra,0x3c($sp) @@ -3027,7 +3027,7 @@ void scenarioHtmCallback10(void) for (i = 0; i < PLAYERCOUNT(); i++) { setCurrentPlayerNum(i); - if (currentPlayerHasDataUplink()) { + if (invHasDataUplink()) { g_ScenarioData.htm.uplink = g_Vars.currentplayer->prop; break; } @@ -3080,12 +3080,12 @@ glabel var7f1b8960 /* f1833c0: 1000000d */ b .L0f1833f8 /* f1833c4: 00409025 */ or $s2,$v0,$zero .L0f1833c8: -/* f1833c8: 0fc44a21 */ jal currentPlayerHasDataUplink +/* f1833c8: 0fc44a21 */ jal invHasDataUplink /* f1833cc: 00000000 */ nop /* f1833d0: 0002202b */ sltu $a0,$zero,$v0 /* f1833d4: 10800005 */ beqz $a0,.L0f1833ec /* f1833d8: 00000000 */ nop -/* f1833dc: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f1833dc: 0fc2866a */ jal handGetWeaponNum /* f1833e0: 00002025 */ or $a0,$zero,$zero /* f1833e4: 38440036 */ xori $a0,$v0,0x36 /* f1833e8: 2c840001 */ sltiu $a0,$a0,0x1 @@ -3252,7 +3252,7 @@ glabel var7f1b8960 /* f183648: 8c5000bc */ lw $s0,0xbc($v0) /* f18364c: c4460144 */ lwc1 $f6,0x144($v0) /* f183650: 26100008 */ addiu $s0,$s0,0x8 -/* f183654: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f183654: 0fc2866a */ jal handGetWeaponNum /* f183658: e7a60098 */ swc1 $f6,0x98($sp) /* f18365c: 38430036 */ xori $v1,$v0,0x36 /* f183660: 2c630001 */ sltiu $v1,$v1,0x1 diff --git a/src/game/propobj.c b/src/game/propobj.c index 68dd82563..8932d0d26 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -38,7 +38,7 @@ #include "game/game_0c33f0.h" #include "game/game_0dcdb0.h" #include "game/game_0f09f0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/game_128f30.h" #include "game/game_129210.h" @@ -5783,7 +5783,7 @@ glabel func0f06ad2c /* f06b038: 00002025 */ or $a0,$zero,$zero /* f06b03c: 8e240014 */ lw $a0,0x14($s1) .L0f06b040: -/* f06b040: 0fc44815 */ jal currentPlayerRemoveProp +/* f06b040: 0fc44815 */ jal invRemoveProp /* f06b044: 00000000 */ nop /* f06b048: 8e4c006c */ lw $t4,0x6c($s2) /* f06b04c: 26100001 */ addiu $s0,$s0,0x1 @@ -37260,7 +37260,7 @@ bool propobjInteract(struct prop *prop) if (playernum >= 0 && laptop == &g_ThrownLaptops[playernum]) { obj->hidden |= OBJHFLAG_00000004; - currentPlayerGiveWeapon(WEAPON_LAPTOPGUN); + invGiveSingleWeapon(WEAPON_LAPTOPGUN); currentPlayerQueuePickupWeaponHudmsg(WEAPON_LAPTOPGUN, false); func0f087d10(WEAPON_LAPTOPGUN); @@ -38000,7 +38000,7 @@ glabel func0f088028 .L0f088178: /* f088178: 04820004 */ bltzl $a0,.L0f08818c /* f08817c: 8fbf001c */ lw $ra,0x1c($sp) -/* f088180: 0fc44762 */ jal currentPlayerGiveWeapon +/* f088180: 0fc44762 */ jal invGiveSingleWeapon /* f088184: 00000000 */ nop .L0f088188: /* f088188: 8fbf001c */ lw $ra,0x1c($sp) @@ -38342,7 +38342,7 @@ glabel var7f1aae70 /* f0888f8: 8faf00a4 */ lw $t7,0xa4($sp) /* f0888fc: 11e0000b */ beqz $t7,.L0f08892c /* f088900: 00000000 */ nop -/* f088904: 0fc44bfb */ jal objGetActivatedText +/* f088904: 0fc44bfb */ jal invGetActivatedTextByObj /* f088908: 8fa4009c */ lw $a0,0x9c($sp) /* f08890c: 14400004 */ bnez $v0,.L0f088920 /* f088910: 00402025 */ or $a0,$v0,$zero @@ -38495,7 +38495,7 @@ glabel var7f1aae70 .L0f088b30: /* f088b30: 51800013 */ beqzl $t4,.L0f088b80 /* f088b34: 24180004 */ addiu $t8,$zero,0x4 -/* f088b38: 0fc44bfb */ jal objGetActivatedText +/* f088b38: 0fc44bfb */ jal invGetActivatedTextByObj /* f088b3c: 8fa4009c */ lw $a0,0x9c($sp) /* f088b40: 10400006 */ beqz $v0,.L0f088b5c /* f088b44: 00402025 */ or $a0,$v0,$zero @@ -38550,7 +38550,7 @@ glabel var7f1aae70 /* f088bf0: afae0094 */ sw $t6,0x94($sp) /* f088bf4: 11e00014 */ beqz $t7,.L0f088c48 /* f088bf8: 8fb80074 */ lw $t8,0x74($sp) -/* f088bfc: 0fc44c0d */ jal weaponGetActivatedText +/* f088bfc: 0fc44c0d */ jal invGetActivatedTextByWeaponNum /* f088c00: 9304005c */ lbu $a0,0x5c($t8) /* f088c04: 10400008 */ beqz $v0,.L0f088c28 /* f088c08: 00402025 */ or $a0,$v0,$zero @@ -38579,13 +38579,13 @@ glabel var7f1aae70 /* f088c54: 24010002 */ addiu $at,$zero,0x2 /* f088c58: 55a10010 */ bnel $t5,$at,.L0f088c9c /* f088c5c: 8fb90074 */ lw $t9,0x74($sp) -/* f088c60: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f088c60: 0fc2866a */ jal handGetWeaponNum /* f088c64: 00002025 */ or $a0,$zero,$zero /* f088c68: 8fae0074 */ lw $t6,0x74($sp) /* f088c6c: 91cf005c */ lbu $t7,0x5c($t6) /* f088c70: 544f000a */ bnel $v0,$t7,.L0f088c9c /* f088c74: 8fb90074 */ lw $t9,0x74($sp) -/* f088c78: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f088c78: 0fc2866a */ jal handGetWeaponNum /* f088c7c: 24040001 */ addiu $a0,$zero,0x1 /* f088c80: 8fb80074 */ lw $t8,0x74($sp) /* f088c84: 9305005c */ lbu $a1,0x5c($t8) @@ -38701,7 +38701,7 @@ glabel var7f1aae70 /* f088e20: 8faf00a4 */ lw $t7,0xa4($sp) /* f088e24: 51e0003b */ beqzl $t7,.L0f088f14 /* f088e28: 240e0001 */ addiu $t6,$zero,0x1 -/* f088e2c: 0fc44bfb */ jal objGetActivatedText +/* f088e2c: 0fc44bfb */ jal invGetActivatedTextByObj /* f088e30: 8fa4009c */ lw $a0,0x9c($sp) /* f088e34: 14400033 */ bnez $v0,.L0f088f04 /* f088e38: 00402025 */ or $a0,$v0,$zero @@ -38793,7 +38793,7 @@ glabel var7f1aae70 /* f088f64: 8faa00a4 */ lw $t2,0xa4($sp) /* f088f68: 5140000c */ beqzl $t2,.L0f088f9c /* f088f6c: 240b0004 */ addiu $t3,$zero,0x4 -/* f088f70: 0fc44bfb */ jal objGetActivatedText +/* f088f70: 0fc44bfb */ jal invGetActivatedTextByObj /* f088f74: 8fa4009c */ lw $a0,0x9c($sp) /* f088f78: 14400004 */ bnez $v0,.L0f088f8c /* f088f7c: 00402025 */ or $a0,$v0,$zero @@ -38829,7 +38829,7 @@ glabel var7f1aae70 /* f088fe4: 8fb80094 */ lw $t8,0x94($sp) /* f088fe8: 17000003 */ bnez $t8,.L0f088ff8 /* f088fec: 00000000 */ nop -/* f088ff0: 0fc447f3 */ jal currentPlayerGiveProp +/* f088ff0: 0fc447f3 */ jal invGiveProp /* f088ff4: 8fa400a0 */ lw $a0,0xa0($sp) .L0f088ff8: /* f088ff8: 10000002 */ b .L0f089004 @@ -38863,7 +38863,7 @@ glabel var7f1aae70 // } // // if (showhudmsg) { -// char *text = objGetActivatedText(obj); +// char *text = invGetActivatedTextByObj(obj); // // if (text == NULL) { // text = langGet(L_PROPOBJ(40)); // "Picked up a key." @@ -38947,7 +38947,7 @@ glabel var7f1aae70 // } // // if (showhudmsg) { -// char *text = objGetActivatedText(obj); +// char *text = invGetActivatedTextByObj(obj); // // if (text) { // func0f0ddfa4(text, HUDMSGTYPE_DEFAULT, 9); @@ -38979,7 +38979,7 @@ glabel var7f1aae70 // sp148[0] = 1; // // if (showhudmsg) { -// char *text = weaponGetActivatedText(weapon->weaponnum); +// char *text = invGetActivatedTextByWeaponNum(weapon->weaponnum); // // if (text) { // sp112 = true; @@ -38997,9 +38997,9 @@ glabel var7f1aae70 // // // c50 // if (count == 2 -// && getCurrentPlayerWeaponId(0) == weapon->weaponnum -// && getCurrentPlayerWeaponId(1) != weapon->weaponnum) { -// currentPlayerEquipWeaponWrapper(1, weapon->weaponnum); +// && handGetWeaponNum(HAND_RIGHT) == weapon->weaponnum +// && handGetWeaponNum(HAND_LEFT) != weapon->weaponnum) { +// currentPlayerEquipWeaponWrapper(HAND_LEFT, weapon->weaponnum); // } // // // c9c @@ -39053,7 +39053,7 @@ glabel var7f1aae70 // } // // if (showhudmsg) { -// char *text = objGetActivatedText(obj); +// char *text = invGetActivatedTextByObj(obj); // // if (text == NULL) { // s32 playercount = PLAYERCOUNT(); @@ -39119,7 +39119,7 @@ glabel var7f1aae70 // } // // if (showhudmsg) { -// char *text = objGetActivatedText(obj); +// char *text = invGetActivatedTextByObj(obj); // // if (text == NULL) { // text = langGet(L_PROPOBJ(43)); // "Picked up something." @@ -39141,7 +39141,7 @@ glabel var7f1aae70 // // fe0 // if (v0) { // if (sp148[0] == 0) { -// currentPlayerGiveProp(prop); +// invGiveProp(prop); // } // // return 4; @@ -39318,7 +39318,7 @@ glabel var7f1aae84 /* f089230: 100001e5 */ b .L0f0899c8 /* f089234: 00001025 */ or $v0,$zero,$zero .L0f089238: -/* f089238: 0fc4468a */ jal currentPlayerHasWeapon +/* f089238: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f08923c: afa70080 */ sw $a3,0x80($sp) /* f089240: 1040013c */ beqz $v0,.L0f089734 /* f089244: 8fa70080 */ lw $a3,0x80($sp) @@ -39402,7 +39402,7 @@ glabel var7f1aae84 /* f089360: 00802825 */ or $a1,$a0,$zero /* f089364: 00803025 */ or $a2,$a0,$zero .L0f089368: -/* f089368: 0fc446ac */ jal func0f111ab0 +/* f089368: 0fc446ac */ jal invHasDoubleWeaponExcAllGuns /* f08936c: 00c02025 */ or $a0,$a2,$zero /* f089370: 104000f0 */ beqz $v0,.L0f089734 /* f089374: 00000000 */ nop @@ -39420,12 +39420,12 @@ glabel var7f1aae84 /* f0893a0: 8fa70080 */ lw $a3,0x80($sp) /* f0893a4: 90e4005c */ lbu $a0,0x5c($a3) /* f0893a8: afa70080 */ sw $a3,0x80($sp) -/* f0893ac: 0fc446ac */ jal func0f111ab0 +/* f0893ac: 0fc446ac */ jal invHasDoubleWeaponExcAllGuns /* f0893b0: 00802825 */ or $a1,$a0,$zero /* f0893b4: 1440000f */ bnez $v0,.L0f0893f4 /* f0893b8: 8fa70080 */ lw $a3,0x80($sp) /* f0893bc: 90e4005c */ lbu $a0,0x5c($a3) -/* f0893c0: 0fc44674 */ jal currentPlayerGetWeaponInvItem +/* f0893c0: 0fc44674 */ jal invFindSingleWeapon /* f0893c4: afa70080 */ sw $a3,0x80($sp) /* f0893c8: 10400005 */ beqz $v0,.L0f0893e0 /* f0893cc: 8fa70080 */ lw $a3,0x80($sp) @@ -39461,7 +39461,7 @@ glabel var7f1aae84 /* f089434: 24010007 */ addiu $at,$zero,0x7 /* f089438: 54410007 */ bnel $v0,$at,.L0f089458 /* f08943c: 24010014 */ addiu $at,$zero,0x14 -/* f089440: 0fc4468a */ jal currentPlayerHasWeapon +/* f089440: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089444: 2404001e */ addiu $a0,$zero,0x1e /* f089448: 104000ba */ beqz $v0,.L0f089734 /* f08944c: 00000000 */ nop @@ -39470,7 +39470,7 @@ glabel var7f1aae84 .L0f089458: /* f089458: 54410007 */ bnel $v0,$at,.L0f089478 /* f08945c: 24010015 */ addiu $at,$zero,0x15 -/* f089460: 0fc4468a */ jal currentPlayerHasWeapon +/* f089460: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089464: 24040031 */ addiu $a0,$zero,0x31 /* f089468: 104000b2 */ beqz $v0,.L0f089734 /* f08946c: 00000000 */ nop @@ -39479,7 +39479,7 @@ glabel var7f1aae84 .L0f089478: /* f089478: 54410007 */ bnel $v0,$at,.L0f089498 /* f08947c: 24010012 */ addiu $at,$zero,0x12 -/* f089480: 0fc4468a */ jal currentPlayerHasWeapon +/* f089480: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089484: 24040023 */ addiu $a0,$zero,0x23 /* f089488: 104000aa */ beqz $v0,.L0f089734 /* f08948c: 00000000 */ nop @@ -39488,7 +39488,7 @@ glabel var7f1aae84 .L0f089498: /* f089498: 54410007 */ bnel $v0,$at,.L0f0894b8 /* f08949c: 2401000c */ addiu $at,$zero,0xc -/* f0894a0: 0fc4468a */ jal currentPlayerHasWeapon +/* f0894a0: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f0894a4: 2404001f */ addiu $a0,$zero,0x1f /* f0894a8: 104000a2 */ beqz $v0,.L0f089734 /* f0894ac: 00000000 */ nop @@ -39497,7 +39497,7 @@ glabel var7f1aae84 .L0f0894b8: /* f0894b8: 54410007 */ bnel $v0,$at,.L0f0894d8 /* f0894bc: 2401000d */ addiu $at,$zero,0xd -/* f0894c0: 0fc4468a */ jal currentPlayerHasWeapon +/* f0894c0: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f0894c4: 24040022 */ addiu $a0,$zero,0x22 /* f0894c8: 1040009a */ beqz $v0,.L0f089734 /* f0894cc: 00000000 */ nop @@ -39506,7 +39506,7 @@ glabel var7f1aae84 .L0f0894d8: /* f0894d8: 54410007 */ bnel $v0,$at,.L0f0894f8 /* f0894dc: 2401000e */ addiu $at,$zero,0xe -/* f0894e0: 0fc4468a */ jal currentPlayerHasWeapon +/* f0894e0: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f0894e4: 24040021 */ addiu $a0,$zero,0x21 /* f0894e8: 10400092 */ beqz $v0,.L0f089734 /* f0894ec: 00000000 */ nop @@ -39515,7 +39515,7 @@ glabel var7f1aae84 .L0f0894f8: /* f0894f8: 54410007 */ bnel $v0,$at,.L0f089518 /* f0894fc: 24010009 */ addiu $at,$zero,0x9 -/* f089500: 0fc4468a */ jal currentPlayerHasWeapon +/* f089500: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089504: 24040020 */ addiu $a0,$zero,0x20 /* f089508: 1040008a */ beqz $v0,.L0f089734 /* f08950c: 00000000 */ nop @@ -39524,7 +39524,7 @@ glabel var7f1aae84 .L0f089518: /* f089518: 14410005 */ bne $v0,$at,.L0f089530 /* f08951c: 00000000 */ nop -/* f089520: 0fc4468a */ jal currentPlayerHasWeapon +/* f089520: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089524: 2404001a */ addiu $a0,$zero,0x1a /* f089528: 10400082 */ beqz $v0,.L0f089734 /* f08952c: 00000000 */ nop @@ -39570,56 +39570,56 @@ glabel var7f1aae84 .L0f0895bc: /* f0895bc: 56010005 */ bnel $s0,$at,.L0f0895d4 /* f0895c0: 24010014 */ addiu $at,$zero,0x14 -/* f0895c4: 0fc4468a */ jal currentPlayerHasWeapon +/* f0895c4: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f0895c8: 2404001e */ addiu $a0,$zero,0x1e /* f0895cc: 1040002b */ beqz $v0,.L0f08967c /* f0895d0: 24010014 */ addiu $at,$zero,0x14 .L0f0895d4: /* f0895d4: 56010005 */ bnel $s0,$at,.L0f0895ec /* f0895d8: 24010015 */ addiu $at,$zero,0x15 -/* f0895dc: 0fc4468a */ jal currentPlayerHasWeapon +/* f0895dc: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f0895e0: 24040031 */ addiu $a0,$zero,0x31 /* f0895e4: 10400025 */ beqz $v0,.L0f08967c /* f0895e8: 24010015 */ addiu $at,$zero,0x15 .L0f0895ec: /* f0895ec: 56010005 */ bnel $s0,$at,.L0f089604 /* f0895f0: 24010012 */ addiu $at,$zero,0x12 -/* f0895f4: 0fc4468a */ jal currentPlayerHasWeapon +/* f0895f4: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f0895f8: 24040023 */ addiu $a0,$zero,0x23 /* f0895fc: 1040001f */ beqz $v0,.L0f08967c /* f089600: 24010012 */ addiu $at,$zero,0x12 .L0f089604: /* f089604: 56010005 */ bnel $s0,$at,.L0f08961c /* f089608: 2401000c */ addiu $at,$zero,0xc -/* f08960c: 0fc4468a */ jal currentPlayerHasWeapon +/* f08960c: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089610: 2404001f */ addiu $a0,$zero,0x1f /* f089614: 10400019 */ beqz $v0,.L0f08967c /* f089618: 2401000c */ addiu $at,$zero,0xc .L0f08961c: /* f08961c: 56010005 */ bnel $s0,$at,.L0f089634 /* f089620: 2401000d */ addiu $at,$zero,0xd -/* f089624: 0fc4468a */ jal currentPlayerHasWeapon +/* f089624: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089628: 24040022 */ addiu $a0,$zero,0x22 /* f08962c: 10400013 */ beqz $v0,.L0f08967c /* f089630: 2401000d */ addiu $at,$zero,0xd .L0f089634: /* f089634: 56010005 */ bnel $s0,$at,.L0f08964c /* f089638: 2401000e */ addiu $at,$zero,0xe -/* f08963c: 0fc4468a */ jal currentPlayerHasWeapon +/* f08963c: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089640: 24040021 */ addiu $a0,$zero,0x21 /* f089644: 1040000d */ beqz $v0,.L0f08967c /* f089648: 2401000e */ addiu $at,$zero,0xe .L0f08964c: /* f08964c: 56010005 */ bnel $s0,$at,.L0f089664 /* f089650: 24010009 */ addiu $at,$zero,0x9 -/* f089654: 0fc4468a */ jal currentPlayerHasWeapon +/* f089654: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089658: 24040020 */ addiu $a0,$zero,0x20 /* f08965c: 10400007 */ beqz $v0,.L0f08967c /* f089660: 24010009 */ addiu $at,$zero,0x9 .L0f089664: /* f089664: 56010008 */ bnel $s0,$at,.L0f089688 /* f089668: 8fa20060 */ lw $v0,0x60($sp) -/* f08966c: 0fc4468a */ jal currentPlayerHasWeapon +/* f08966c: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f089670: 2404001a */ addiu $a0,$zero,0x1a /* f089674: 54400004 */ bnezl $v0,.L0f089688 /* f089678: 8fa20060 */ lw $v0,0x60($sp) @@ -39665,7 +39665,7 @@ glabel var7f1aae84 /* f089704: 24010001 */ addiu $at,$zero,0x1 /* f089708: 17210006 */ bne $t9,$at,.L0f089724 /* f08970c: 00000000 */ nop -/* f089710: 0fc44a11 */ jal currentPlayerHasBriefcase +/* f089710: 0fc44a11 */ jal invHasBriefcase /* f089714: 00000000 */ nop /* f089718: 10400002 */ beqz $v0,.L0f089724 /* f08971c: 00000000 */ nop @@ -42115,10 +42115,10 @@ glabel func0f08b880 /* f08b8b4: 00000000 */ nop ); -void chrSetObjHiddenFlag4OnWeapon(struct chrdata *chr, s32 slot) +void chrSetObjHiddenFlag4OnWeapon(struct chrdata *chr, s32 hand) { - if (chr && chr->weapons_held[slot]) { - struct defaultobj *obj = chr->weapons_held[slot]->obj; + if (chr && chr->weapons_held[hand]) { + struct defaultobj *obj = chr->weapons_held[hand]->obj; obj->hidden |= OBJHFLAG_00000004; } } @@ -42422,7 +42422,7 @@ glabel func0f08bd00 /* f08bd24: 24030001 */ addiu $v1,$zero,0x1 .L0f08bd28: /* f08bd28: afa30018 */ sw $v1,0x18($sp) -/* f08bd2c: 0fc449e4 */ jal currentPlayerHasKeyFlags +/* f08bd2c: 0fc449e4 */ jal invHasKeyFlags /* f08bd30: afa7001c */ sw $a3,0x1c($sp) /* f08bd34: 8fa30018 */ lw $v1,0x18($sp) /* f08bd38: 10400003 */ beqz $v0,.L0f08bd48 @@ -46750,7 +46750,7 @@ bool propdoorInteract(struct prop *doorprop) doorActivateWrapper(doorprop, 1); } else if (door->mode == DOORMODE_IDLE && door->frac < 0.5f * door->maxfrac) { if ((door->base.flags2 & OBJFLAG2_00000004) == 0) { - struct textoverride *override = objGetTextOverride(&door->base); + struct textoverride *override = invGetTextOverrideForObj(&door->base); u8 intraining = false; if (g_Vars.stagenum == STAGE_CITRAINING) { @@ -47588,7 +47588,7 @@ glabel func0f0910ac /* f09112c: 02002025 */ or $a0,$s0,$zero /* f091130: 04420039 */ bltzl $v0,.L0f091218 /* f091134: 26100001 */ addiu $s0,$s0,0x1 -/* f091138: 0fc4468a */ jal currentPlayerHasWeapon +/* f091138: 0fc4468a */ jal invHasSingleWeaponExcAllGuns /* f09113c: 02002025 */ or $a0,$s0,$zero /* f091140: 10400034 */ beqz $v0,.L0f091214 /* f091144: 02002025 */ or $a0,$s0,$zero @@ -47635,7 +47635,7 @@ glabel func0f0910ac .L0f0911dc: /* f0911dc: 10c00003 */ beqz $a2,.L0f0911ec /* f0911e0: 00000000 */ nop -/* f0911e4: 0fc447a9 */ jal currentPlayerRemoveWeapon +/* f0911e4: 0fc447a9 */ jal invRemoveItemByNum /* f0911e8: 02002025 */ or $a0,$s0,$zero .L0f0911ec: /* f0911ec: 0fc28aac */ jal weaponIsMissionCritical diff --git a/src/game/title.c b/src/game/title.c index b1e334ca1..1d69b8eea 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -12,7 +12,7 @@ #include "game/game_097ba0.h" #include "game/game_0b28d0.h" #include "game/game_0b3350.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_127910.h" #include "game/credits.h" #include "game/bondview.h" @@ -215,7 +215,7 @@ char *mpPlayerGetWeaponOfChoiceName(u32 playernum, u32 slot) setCurrentPlayerNum(playernum); - currentPlayerGetWeaponOfChoice(&weapon1, &weapon2); + invGetWeaponOfChoice(&weapon1, &weapon2); weapon = slot == 1 ? weapon2 : weapon1; diff --git a/src/game/training/menus.c b/src/game/training/menus.c index 01989a97f..a23d823dd 100644 --- a/src/game/training/menus.c +++ b/src/game/training/menus.c @@ -16,7 +16,7 @@ #include "game/game_0e0770.h" #include "game/game_0f09f0.h" #include "game/game_102240.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/game_1531a0.h" #include "game/game_166e40.h" #include "game/game_16e810.h" @@ -45,17 +45,17 @@ s32 frDetailsOkMenuHandler(u32 operation, struct menuitem *item, union handlerda s32 weapon = frGetWeaponBySlot(frGetSlot()); if (g_FrWeaponNum != WEAPON_UNARMED) { - currentPlayerRemoveWeapon(g_FrWeaponNum); + invRemoveItemByNum(g_FrWeaponNum); } if (weapon != WEAPON_UNARMED) { - currentPlayerGiveWeapon(weapon); + invGiveSingleWeapon(weapon); } - currentPlayerSetEquipCurItem(1); + invSetCurrentIndex(1); - if (getCurrentPlayerWeaponId(0) != weapon) { - currentPlayerEquipWeaponWrapper(0, weapon); + if (handGetWeaponNum(HAND_RIGHT) != weapon) { + currentPlayerEquipWeaponWrapper(HAND_RIGHT, weapon); } g_FrWeaponNum = weapon; diff --git a/src/game/training/training.c b/src/game/training/training.c index c3da6c104..4c822a409 100644 --- a/src/game/training/training.c +++ b/src/game/training/training.c @@ -20,7 +20,7 @@ #include "game/game_0dcdb0.h" #include "game/game_0f09f0.h" #include "game/game_107fb0.h" -#include "game/game_111600.h" +#include "game/inventory/inventory.h" #include "game/explosions/explosions.h" #include "game/game_150820.h" #include "game/game_1531a0.h" @@ -2438,7 +2438,7 @@ glabel var7f1b94e4 /* f19f9f0: 00000000 */ nop /* f19f9f4: 0fc6749a */ jal frGetWeaponBySlot /* f19f9f8: 96a40456 */ lhu $a0,0x456($s5) -/* f19f9fc: 0fc44727 */ jal currentPlayerCanHaveWeapon +/* f19f9fc: 0fc44727 */ jal invHasSingleWeaponIncAllGuns /* f19fa00: 00402025 */ or $a0,$v0,$zero /* f19fa04: 10400005 */ beqz $v0,.L0f19fa1c /* f19fa08: 00000000 */ nop @@ -3531,7 +3531,7 @@ glabel var7f1b94e4 // // 9c8 // if (g_FrIsValidWeapon // && g_Vars.currentplayer->unk1583_04 == 0 -// && currentPlayerCanHaveWeapon(frGetWeaponBySlot(g_FrData.slot))) { +// && invHasSingleWeaponIncAllGuns(frGetWeaponBySlot(g_FrData.slot))) { // // a0c // currentPlayerEquipWeapon(frGetWeaponBySlot(g_FrData.slot)); // } @@ -4083,7 +4083,7 @@ glabel frChooseFarsightTarget /* f1a0ab4: f7b40010 */ sdc1 $f20,0x10($sp) /* f1a0ab8: 0000a025 */ or $s4,$zero,$zero /* f1a0abc: 0000a825 */ or $s5,$zero,$zero -/* f1a0ac0: 0fc2866a */ jal getCurrentPlayerWeaponId +/* f1a0ac0: 0fc2866a */ jal handGetWeaponNum /* f1a0ac4: 00002025 */ or $a0,$zero,$zero /* f1a0ac8: 24010016 */ addiu $at,$zero,0x16 /* f1a0acc: 14410042 */ bne $v0,$at,.L0f1a0bd8 @@ -4192,7 +4192,7 @@ glabel frChooseFarsightTarget // bool found = false; // s32 i; // -// if (getCurrentPlayerWeaponId(0) == WEAPON_FARSIGHTXR20) { +// if (handGetWeaponNum(0) == WEAPON_FARSIGHTXR20) { // for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { // if (g_FrData.targets[i].inuse // && g_FrData.targets[i].destroyed == false diff --git a/src/include/game/game_012450.h b/src/include/game/game_012450.h deleted file mode 100644 index dc4bd379b..000000000 --- a/src/include/game/game_012450.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef IN_GAME_GAME_012450_H -#define IN_GAME_GAME_012450_H -#include -#include "types.h" - -void currentPlayerInitGunsHeld(void); -void func0f012530(s32 arg0); - -#endif diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index e3ff165c0..9a41c9b17 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -89,7 +89,7 @@ u32 func0f0a1318(void); u32 func0f0a134c(void); u32 func0f0a1528(void); void currentPlayerEquipWeapon(s32 weaponnum); -s32 getCurrentPlayerWeaponId(s32 handnum); +s32 handGetWeaponNum(s32 handnum); bool func0f0a1a10(s32 weaponnum); s32 func0f0a1a68(s32 arg0); void func0f0a1ab0(void); diff --git a/src/include/game/game_111600.h b/src/include/game/game_111600.h deleted file mode 100644 index 070b39a33..000000000 --- a/src/include/game/game_111600.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef IN_GAME_GAME_111600_H -#define IN_GAME_GAME_111600_H -#include -#include "types.h" - -void currentPlayerClearInventory(void); -void currentPlayerSortInvItem(struct invitem *item); -void currentPlayerInsertInvItem(struct invitem *item); -void currentPlayerRemoveInvItem(struct invitem *item); -struct invitem *currentPlayerGetUnusedInvItem(void); -void currentPlayerSetAllGuns(bool enable); -struct invitem *currentPlayerGetWeaponInvItem(s32 weaponnum); -bool currentPlayerHasWeapon(s32 weaponnum); -struct invitem *func0f111a4c(s32 weapon1, s32 weapon2); -bool func0f111ab0(s32 weapon1, s32 weapon2); -bool func0f111ad4(s32 weaponnum); -s32 func0f111b88(s32 arg0); -s32 currentStageForbidsSlayer(void); -bool currentPlayerCanHaveAllGunsWeapon(s32 weaponnum); -bool currentPlayerCanHaveWeapon(s32 weaponnum); -bool func0f111cf8(s32 weapon1, s32 weapon2); -bool currentPlayerGiveWeapon(s32 weaponnum); -bool currentPlayerGiveWeaponWithArgument(s32 weapon1, s32 weapon2); -void currentPlayerRemoveWeapon(s32 weaponnum); -bool currentPlayerGiveProp(struct prop *prop); -void currentPlayerRemoveProp(struct prop *prop); -u32 func0f1120f0(struct prop *prop); -u32 func0f1122ec(void); -u32 func0f11253c(void); -bool currentPlayerHasKeyFlags(u32 wantkeyflags); -bool currentPlayerHasBriefcase(void); -bool currentPlayerHasDataUplink(void); -bool currentPlayerHasProp(struct prop *prop); -s32 currentPlayerGetNumInvItems(void); -struct invitem *currentPlayerGetInvItemByIndex(s32 index); -struct textoverride *objGetTextOverride(struct defaultobj *obj); -struct textoverride *weaponGetTextOverride(s32 weaponnum); -s32 currentPlayerGetWeaponNumByInvIndex(s32 index); -u16 currentPlayerGetInvNameIdByIndex(s32 index); -char *currentPlayerGetInvNameByIndex(s32 index); -char *currentPlayerGetInvShortNameByIndex(s32 index); -void textoverrideInsert(struct textoverride *override); -u32 currentPlayerGetEquipCurItem(void); -void currentPlayerSetEquipCurItem(u32 item); -void currentPlayerCalculateEquipCurItem(void); -char *objGetActivatedText(struct defaultobj *obj); -char *weaponGetActivatedText(s32 weaponnum); -void currentPlayerIncrementGunHeldTime(s32 param_1, s32 param_2); -void currentPlayerGetWeaponOfChoice(s32 *weapon1, s32 *weapon2); - -#endif diff --git a/src/include/game/game_127910.h b/src/include/game/game_127910.h index 423a50156..d51546c06 100644 --- a/src/include/game/game_127910.h +++ b/src/include/game/game_127910.h @@ -14,8 +14,8 @@ void currentPlayerSetViewPosition(s32 viewleft, s32 viewtop); void currentPlayerSetFovY(f32 fovy); void currentPlayerSetAspectRatio(f32 aspect); s32 weaponGetModel(s32 weapon); -void currentPlayerSetWeaponFlag4(s32 weaponslot); -void func0f128d20(s32 slot); +void currentPlayerSetWeaponFlag4(s32 hand); +void func0f128d20(s32 hand); void randomisePlayerOrder(void); s32 getPlayerByOrderNum(s32 arg0); void setCurrentPlayerNum(s32 playernum); diff --git a/src/include/game/inventory/init.h b/src/include/game/inventory/init.h new file mode 100644 index 000000000..efc45a14e --- /dev/null +++ b/src/include/game/inventory/init.h @@ -0,0 +1,9 @@ +#ifndef IN_GAME_INVENTORY_INIT_H +#define IN_GAME_INVENTORY_INIT_H +#include +#include "types.h" + +void invInitGunsHeld(void); +void invInit(s32 numdoubles); + +#endif diff --git a/src/include/game/inventory/inventory.h b/src/include/game/inventory/inventory.h new file mode 100644 index 000000000..6b5dfe968 --- /dev/null +++ b/src/include/game/inventory/inventory.h @@ -0,0 +1,51 @@ +#ifndef IN_GAME_INVENTORY_INVENTORY_H +#define IN_GAME_INVENTORY_INVENTORY_H +#include +#include "types.h" + +void invClear(void); +void invSortItem(struct invitem *item); +void invInsertItem(struct invitem *item); +void invRemoveItem(struct invitem *item); +struct invitem *invFindUnusedSlot(void); +void invSetAllGuns(bool enable); +struct invitem *invFindSingleWeapon(s32 weaponnum); +bool invHasSingleWeaponExcAllGuns(s32 weaponnum); +struct invitem *invFindDoubleWeapon(s32 weapon1, s32 weapon2); +bool invHasDoubleWeaponExcAllGuns(s32 weapon1, s32 weapon2); +bool invHasSingleWeaponOrProp(s32 weaponnum); +s32 func0f111b88(s32 arg0); +s32 currentStageForbidsSlayer(void); +bool invCanHaveAllGunsWeapon(s32 weaponnum); +bool invHasSingleWeaponIncAllGuns(s32 weaponnum); +bool invHasDoubleWeaponIncAllGuns(s32 weapon1, s32 weapon2); +bool invGiveSingleWeapon(s32 weaponnum); +bool invGiveDoubleWeapon(s32 weapon1, s32 weapon2); +void invRemoveItemByNum(s32 weaponnum); +bool invGiveProp(struct prop *prop); +void invRemoveProp(struct prop *prop); +u32 func0f1120f0(struct prop *prop); +u32 func0f1122ec(void); +u32 func0f11253c(void); +bool invHasKeyFlags(u32 wantkeyflags); +bool invHasBriefcase(void); +bool invHasDataUplink(void); +bool invHasProp(struct prop *prop); +s32 invGetCount(void); +struct invitem *invGetItemByIndex(s32 index); +struct textoverride *invGetTextOverrideForObj(struct defaultobj *obj); +struct textoverride *invGetTextOverrideForWeapon(s32 weaponnum); +s32 invGetWeaponNumByIndex(s32 index); +u16 invGetNameIdByIndex(s32 index); +char *invGetNameByIndex(s32 index); +char *invGetShortNameByIndex(s32 index); +void invInsertTextOverride(struct textoverride *override); +u32 invGetCurrentIndex(void); +void invSetCurrentIndex(u32 item); +void invCalculateCurrentIndex(void); +char *invGetActivatedTextByObj(struct defaultobj *obj); +char *invGetActivatedTextByWeaponNum(s32 weaponnum); +void invIncrementHeldTime(s32 param_1, s32 param_2); +void invGetWeaponOfChoice(s32 *weapon1, s32 *weapon2); + +#endif diff --git a/src/include/game/data/inventory.h b/src/include/game/inventory/items.h similarity index 73% rename from src/include/game/data/inventory.h rename to src/include/game/inventory/items.h index 25d900a72..21c502460 100644 --- a/src/include/game/data/inventory.h +++ b/src/include/game/inventory/items.h @@ -1,5 +1,5 @@ -#ifndef IN_GAME_DATA_INVENTORY_H -#define IN_GAME_DATA_INVENTORY_H +#ifndef IN_GAME_INVENTORY_ITEMS_H +#define IN_GAME_INVENTORY_ITEMS_H #include extern struct inventory_menupos invmenupos_00010fd0; diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index b93b74336..cb6040db4 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -281,7 +281,7 @@ void func0f08b25c(struct weaponobj *weapon, struct chrdata *chr); u32 func0f08b27c(void); u32 func0f08b658(void); struct weaponobj *func0f08b880(u32 model, u32 weaponnum, struct chrdata *chr); -void chrSetObjHiddenFlag4OnWeapon(struct chrdata *chr, s32 slot); +void chrSetObjHiddenFlag4OnWeapon(struct chrdata *chr, s32 hand); struct prop *func0f08b8e8(struct chrdata *chr, s32 weaponnum, s32 arg2, u32 flags, s32 arg4, s32 arg5); struct prop *chrGiveWeapon(struct chrdata *chr, s32 model, s32 weaponnum, u32 flags); u32 func0f08bb3c(void); diff --git a/src/include/types.h b/src/include/types.h index 054e15d5a..98daf5206 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2642,8 +2642,8 @@ struct player { /*0x1858*/ f32 aspect; /*0x185c*/ u32 flags; /*0x1860*/ u32 unk1860; - /*0x1864*/ struct invitem *weapons; // circular linked list - /*0x1868*/ struct invitem *equipment; + /*0x1864*/ struct invitem *weapons; // circular linked list, sorted + /*0x1868*/ struct invitem *equipment; // slots, allocated, unsorted /*0x186c*/ s32 equipmaxitems; /*0x1870*/ u32 equipallguns; /*0x1874*/ u32 equipcuritem;