Decompile currentPlayerGetAmmoCountWithCheck
This commit is contained in:
parent
a830bcd0a0
commit
7e6be182c2
|
|
@ -734,7 +734,7 @@ void amGetSlotDetails(s32 slot, u32 *flags, char *label)
|
|||
} else {
|
||||
if (invGetWeaponNumByIndex(g_AmMenus[g_AmIndex].invindexes[slot]) == WEAPON_CLOAKINGDEVICE) {
|
||||
// Special case: "Cloak %d"
|
||||
qty = ammoGetQuantity(AMMOTYPE_CLOAK);
|
||||
qty = currentPlayerGetAmmoCountWithCheck(AMMOTYPE_CLOAK);
|
||||
secs = qty / 60;
|
||||
modulo = (qty - (secs * 60)) * 100 / 60;
|
||||
sprintf(label, langGet(L_OPTIONS(491)), secs + (modulo > 0 ? 1 : 0)); // "cloak %d"
|
||||
|
|
|
|||
|
|
@ -4061,7 +4061,7 @@ void chrUpdateCloak(struct chrdata *chr)
|
|||
|
||||
if (g_Vars.currentplayer->devicesactive & DEVICE_CLOAKDEVICE) {
|
||||
// Cloak is active - but may or may not be in effect due to recent shooting
|
||||
s32 qty = ammoGetQuantity(AMMOTYPE_CLOAK);
|
||||
s32 qty = currentPlayerGetAmmoCountWithCheck(AMMOTYPE_CLOAK);
|
||||
|
||||
if (qty > 0) {
|
||||
if (chr->hidden & CHRHFLAG_CLOAKED) {
|
||||
|
|
|
|||
|
|
@ -20303,76 +20303,25 @@ glabel currentPlayerSetAmmoQuantity
|
|||
/* f0a976c: 27bd0038 */ addiu $sp,$sp,0x38
|
||||
);
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel ammoGetQuantity
|
||||
/* f0a9770: 27bdffc8 */ addiu $sp,$sp,-56
|
||||
/* f0a9774: afb50028 */ sw $s5,0x28($sp)
|
||||
/* f0a9778: 3c02800a */ lui $v0,%hi(g_Vars+0x284)
|
||||
/* f0a977c: 8c55a244 */ lw $s5,%lo(g_Vars+0x284)($v0)
|
||||
/* f0a9780: afb70030 */ sw $s7,0x30($sp)
|
||||
/* f0a9784: afb6002c */ sw $s6,0x2c($sp)
|
||||
/* f0a9788: afb40024 */ sw $s4,0x24($sp)
|
||||
/* f0a978c: afb30020 */ sw $s3,0x20($sp)
|
||||
/* f0a9790: 00047080 */ sll $t6,$a0,0x2
|
||||
/* f0a9794: afbf0034 */ sw $ra,0x34($sp)
|
||||
/* f0a9798: afb2001c */ sw $s2,0x1c($sp)
|
||||
/* f0a979c: afb10018 */ sw $s1,0x18($sp)
|
||||
/* f0a97a0: afb00014 */ sw $s0,0x14($sp)
|
||||
/* f0a97a4: 02ae7821 */ addu $t7,$s5,$t6
|
||||
/* f0a97a8: 0080b825 */ or $s7,$a0,$zero
|
||||
/* f0a97ac: 8df217a8 */ lw $s2,0x17a8($t7)
|
||||
/* f0a97b0: 24130002 */ addiu $s3,$zero,0x2
|
||||
/* f0a97b4: 0000a025 */ or $s4,$zero,$zero
|
||||
/* f0a97b8: 02a0b025 */ or $s6,$s5,$zero
|
||||
.L0f0a97bc:
|
||||
/* f0a97bc: 82b80640 */ lb $t8,0x640($s5)
|
||||
/* f0a97c0: 00008025 */ or $s0,$zero,$zero
|
||||
/* f0a97c4: 02c08825 */ or $s1,$s6,$zero
|
||||
/* f0a97c8: 53000019 */ beqzl $t8,.L0f0a9830
|
||||
/* f0a97cc: 26940001 */ addiu $s4,$s4,0x1
|
||||
.L0f0a97d0:
|
||||
/* f0a97d0: 823915e4 */ lb $t9,0x15e4($s1)
|
||||
/* f0a97d4: 02002825 */ or $a1,$s0,$zero
|
||||
/* f0a97d8: 24060001 */ addiu $a2,$zero,0x1
|
||||
/* f0a97dc: 56f90011 */ bnel $s7,$t9,.L0f0a9824
|
||||
/* f0a97e0: 26100001 */ addiu $s0,$s0,0x1
|
||||
/* f0a97e4: 0fc2c613 */ jal func0f0b184c
|
||||
/* f0a97e8: 92a40638 */ lbu $a0,0x638($s5)
|
||||
/* f0a97ec: 1040000c */ beqz $v0,.L0f0a9820
|
||||
/* f0a97f0: 00144100 */ sll $t0,$s4,0x4
|
||||
/* f0a97f4: 01144023 */ subu $t0,$t0,$s4
|
||||
/* f0a97f8: 00084080 */ sll $t0,$t0,0x2
|
||||
/* f0a97fc: 01144021 */ addu $t0,$t0,$s4
|
||||
/* f0a9800: 000840c0 */ sll $t0,$t0,0x3
|
||||
/* f0a9804: 01144021 */ addu $t0,$t0,$s4
|
||||
/* f0a9808: 00084080 */ sll $t0,$t0,0x2
|
||||
/* f0a980c: 02c84821 */ addu $t1,$s6,$t0
|
||||
/* f0a9810: 00105080 */ sll $t2,$s0,0x2
|
||||
/* f0a9814: 012a5821 */ addu $t3,$t1,$t2
|
||||
/* f0a9818: 8d6c0858 */ lw $t4,0x858($t3)
|
||||
/* f0a981c: 01929021 */ addu $s2,$t4,$s2
|
||||
.L0f0a9820:
|
||||
/* f0a9820: 26100001 */ addiu $s0,$s0,0x1
|
||||
.L0f0a9824:
|
||||
/* f0a9824: 1613ffea */ bne $s0,$s3,.L0f0a97d0
|
||||
/* f0a9828: 26310001 */ addiu $s1,$s1,0x1
|
||||
/* f0a982c: 26940001 */ addiu $s4,$s4,0x1
|
||||
.L0f0a9830:
|
||||
/* f0a9830: 1693ffe2 */ bne $s4,$s3,.L0f0a97bc
|
||||
/* f0a9834: 26b507a4 */ addiu $s5,$s5,0x7a4
|
||||
/* f0a9838: 8fbf0034 */ lw $ra,0x34($sp)
|
||||
/* f0a983c: 02401025 */ or $v0,$s2,$zero
|
||||
/* f0a9840: 8fb2001c */ lw $s2,0x1c($sp)
|
||||
/* f0a9844: 8fb00014 */ lw $s0,0x14($sp)
|
||||
/* f0a9848: 8fb10018 */ lw $s1,0x18($sp)
|
||||
/* f0a984c: 8fb30020 */ lw $s3,0x20($sp)
|
||||
/* f0a9850: 8fb40024 */ lw $s4,0x24($sp)
|
||||
/* f0a9854: 8fb50028 */ lw $s5,0x28($sp)
|
||||
/* f0a9858: 8fb6002c */ lw $s6,0x2c($sp)
|
||||
/* f0a985c: 8fb70030 */ lw $s7,0x30($sp)
|
||||
/* f0a9860: 03e00008 */ jr $ra
|
||||
/* f0a9864: 27bd0038 */ addiu $sp,$sp,0x38
|
||||
);
|
||||
s32 currentPlayerGetAmmoCountWithCheck(s32 ammotype)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 total = g_Vars.currentplayer->ammoheldarr[ammotype];
|
||||
struct player *player = g_Vars.currentplayer;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (player->hands[i].inuse) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
if (player->gunctrl.ammotypes[j] == ammotype && func0f0b184c(player->hands[i].base.weaponnum, j, 0x00000001)) {
|
||||
total = total + player->hands[i].loadedammo[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
s32 currentPlayerGetAmmoCount(s32 ammotype)
|
||||
{
|
||||
|
|
@ -20385,7 +20334,7 @@ s32 currentPlayerGetAmmoCount(s32 ammotype)
|
|||
if (player->hands[i].inuse) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
if (player->gunctrl.ammotypes[j] == ammotype) {
|
||||
total = player->hands[i].loadedammo[j] + total;
|
||||
total = total + player->hands[i].loadedammo[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20469,7 +20418,7 @@ s32 currentPlayerGetAmmoQuantityForWeapon(u32 weaponnum, u32 func)
|
|||
struct inventory_ammo *ammo = weapon->ammos[func];
|
||||
|
||||
if (ammo) {
|
||||
return ammoGetQuantity(ammo->type);
|
||||
return currentPlayerGetAmmoCountWithCheck(ammo->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37627,7 +37627,7 @@ glabel func0f088028
|
|||
/* f08803c: afa60030 */ sw $a2,0x30($sp)
|
||||
/* f088040: 18a00051 */ blez $a1,.L0f088188
|
||||
/* f088044: afa70034 */ sw $a3,0x34($sp)
|
||||
/* f088048: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f088048: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f08804c: 00000000 */ nop
|
||||
/* f088050: afa20020 */ sw $v0,0x20($sp)
|
||||
/* f088054: 0fc2a63d */ jal ammotypeGetMaxCapacity
|
||||
|
|
@ -37636,7 +37636,7 @@ glabel func0f088028
|
|||
/* f088060: 01e2082a */ slt $at,$t7,$v0
|
||||
/* f088064: 5020000e */ beqzl $at,.L0f0880a0
|
||||
/* f088068: 8fa80030 */ lw $t0,0x30($sp)
|
||||
/* f08806c: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f08806c: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f088070: 02002025 */ or $a0,$s0,$zero
|
||||
/* f088074: 8fb8002c */ lw $t8,0x2c($sp)
|
||||
/* f088078: 02002025 */ or $a0,$s0,$zero
|
||||
|
|
@ -38321,10 +38321,10 @@ glabel var7f1aae70
|
|||
/* f088cb4: 8fa40074 */ lw $a0,0x74($sp)
|
||||
/* f088cb8: 18400019 */ blez $v0,.L0f088d20
|
||||
/* f088cbc: afa20058 */ sw $v0,0x58($sp)
|
||||
/* f088cc0: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f088cc0: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f088cc4: 8fa4006c */ lw $a0,0x6c($sp)
|
||||
/* f088cc8: 8fa4006c */ lw $a0,0x6c($sp)
|
||||
/* f088ccc: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f088ccc: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f088cd0: afa20054 */ sw $v0,0x54($sp)
|
||||
/* f088cd4: 8fa4006c */ lw $a0,0x6c($sp)
|
||||
/* f088cd8: 0fc2a63d */ jal ammotypeGetMaxCapacity
|
||||
|
|
@ -38355,7 +38355,7 @@ glabel var7f1aae70
|
|||
/* f088d34: 0fc22095 */ jal weaponGetPickupAmmoQty
|
||||
/* f088d38: 01802025 */ or $a0,$t4,$zero
|
||||
/* f088d3c: afa20050 */ sw $v0,0x50($sp)
|
||||
/* f088d40: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f088d40: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f088d44: 2404000b */ addiu $a0,$zero,0xb
|
||||
/* f088d48: 2404000b */ addiu $a0,$zero,0xb
|
||||
/* f088d4c: 0fc2a63d */ jal ammotypeGetMaxCapacity
|
||||
|
|
@ -38364,7 +38364,7 @@ glabel var7f1aae70
|
|||
/* f088d58: 00c2082a */ slt $at,$a2,$v0
|
||||
/* f088d5c: 5020000f */ beqzl $at,.L0f088d9c
|
||||
/* f088d60: 8fb80074 */ lw $t8,0x74($sp)
|
||||
/* f088d64: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f088d64: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f088d68: 2404000b */ addiu $a0,$zero,0xb
|
||||
/* f088d6c: 2404000b */ addiu $a0,$zero,0xb
|
||||
/* f088d70: 0fc2a58a */ jal currentPlayerSetAmmoQuantity
|
||||
|
|
@ -38726,9 +38726,9 @@ glabel var7f1aae70
|
|||
// s32 pickupqty = weaponGetPickupAmmoQty(weapon);
|
||||
//
|
||||
// if (pickupqty > 0) {
|
||||
// s32 heldqty = ammoGetQuantity(ammotype);
|
||||
// s32 heldqty = currentPlayerGetAmmoCountWithCheck(ammotype);
|
||||
//
|
||||
// if (ammoGetQuantity(ammotype) < ammotypeGetMaxCapacity(ammotype)) {
|
||||
// if (currentPlayerGetAmmoCountWithCheck(ammotype) < ammotypeGetMaxCapacity(ammotype)) {
|
||||
// currentPlayerSetAmmoQuantity(ammotype, heldqty + pickupqty);
|
||||
//
|
||||
// if (sp112 == false && showhudmsg) {
|
||||
|
|
@ -38742,8 +38742,8 @@ glabel var7f1aae70
|
|||
// if (weapon->weaponnum == WEAPON_SUPERDRAGON) {
|
||||
// s32 pickupqty = weaponGetPickupAmmoQty(weapon);
|
||||
//
|
||||
// if (ammoGetQuantity(AMMOTYPE_DEVASTATOR) < ammoGetQuantity(AMMOTYPE_DEVASTATOR)) {
|
||||
// s32 heldqty = ammoGetQuantity(AMMOTYPE_DEVASTATOR);
|
||||
// if (currentPlayerGetAmmoCountWithCheck(AMMOTYPE_DEVASTATOR) < currentPlayerGetAmmoCountWithCheck(AMMOTYPE_DEVASTATOR)) {
|
||||
// s32 heldqty = currentPlayerGetAmmoCountWithCheck(AMMOTYPE_DEVASTATOR);
|
||||
//
|
||||
// currentPlayerSetAmmoQuantity(AMMOTYPE_DEVASTATOR, heldqty + 5);
|
||||
//
|
||||
|
|
@ -39165,7 +39165,7 @@ glabel var7f1aae84
|
|||
/* f089400: 1441004d */ bne $v0,$at,.L0f089538
|
||||
/* f089404: 8fb90088 */ lw $t9,0x88($sp)
|
||||
/* f089408: 8f300004 */ lw $s0,0x4($t9)
|
||||
/* f08940c: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f08940c: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f089410: 8e04005c */ lw $a0,0x5c($s0)
|
||||
/* f089414: 8e04005c */ lw $a0,0x5c($s0)
|
||||
/* f089418: 0fc2a63d */ jal ammotypeGetMaxCapacity
|
||||
|
|
@ -39272,7 +39272,7 @@ glabel var7f1aae84
|
|||
/* f089580: 59600041 */ blezl $t3,.L0f089688
|
||||
/* f089584: 8fa20060 */ lw $v0,0x60($sp)
|
||||
/* f089588: afa20060 */ sw $v0,0x60($sp)
|
||||
/* f08958c: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f08958c: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f089590: afa30028 */ sw $v1,0x28($sp)
|
||||
/* f089594: 02002025 */ or $a0,$s0,$zero
|
||||
/* f089598: 0fc2a63d */ jal ammotypeGetMaxCapacity
|
||||
|
|
|
|||
|
|
@ -2153,8 +2153,8 @@ bool frIsAmmoWasted(void)
|
|||
// Check if player has ammo
|
||||
ammoloaded[0] = hand0->loadedammo[0] + hand1->loadedammo[0];
|
||||
ammoloaded[1] = hand0->loadedammo[1] + hand1->loadedammo[1];
|
||||
ammototal[0] = ammoGetQuantity(priammotype) + ammoloaded[0];
|
||||
ammototal[1] = ammoGetQuantity(secammotype) + ammoloaded[1];
|
||||
ammototal[0] = currentPlayerGetAmmoCountWithCheck(priammotype) + ammoloaded[0];
|
||||
ammototal[1] = currentPlayerGetAmmoCountWithCheck(secammotype) + ammoloaded[1];
|
||||
|
||||
if (ammototal[0] <= 0 && ammototal[1] <= 0) {
|
||||
// Don't do any further checks if this is the first frame where we've
|
||||
|
|
@ -2231,7 +2231,7 @@ bool frIsAmmoWasted(void)
|
|||
ammotype = weaponGetAmmoType(weaponnum, 0);
|
||||
hand = &g_Vars.currentplayer->hands[HAND_RIGHT];
|
||||
|
||||
if (ammoGetQuantity(ammotype) + hand->loadedammo[0] == 0) {
|
||||
if (currentPlayerGetAmmoCountWithCheck(ammotype) + hand->loadedammo[0] == 0) {
|
||||
g_FrData.proxyendtimer = 300;
|
||||
}
|
||||
|
||||
|
|
@ -2566,7 +2566,7 @@ glabel var7f1b94e4
|
|||
/* f19fd88: 2401ffff */ addiu $at,$zero,-1
|
||||
/* f19fd8c: 18400011 */ blez $v0,.L0f19fdd4
|
||||
/* f19fd90: 00000000 */ nop
|
||||
/* f19fd94: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f19fd94: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f19fd98: 02202025 */ or $a0,$s1,$zero
|
||||
/* f19fd9c: 92a3045a */ lbu $v1,0x45a($s5)
|
||||
/* f19fda0: 86ae0476 */ lh $t6,0x476($s5)
|
||||
|
|
@ -2600,7 +2600,7 @@ glabel var7f1b94e4
|
|||
/* f19fe00: 2401ffff */ addiu $at,$zero,-1
|
||||
/* f19fe04: 18600011 */ blez $v1,.L0f19fe4c
|
||||
/* f19fe08: 00000000 */ nop
|
||||
/* f19fe0c: 0fc2a5dc */ jal ammoGetQuantity
|
||||
/* f19fe0c: 0fc2a5dc */ jal currentPlayerGetAmmoCountWithCheck
|
||||
/* f19fe10: 2404000b */ addiu $a0,$zero,0xb
|
||||
/* f19fe14: 92a3045a */ lbu $v1,0x45a($s5)
|
||||
/* f19fe18: 86b90478 */ lh $t9,0x478($s5)
|
||||
|
|
@ -3519,7 +3519,7 @@ glabel var7f1b94e4
|
|||
//
|
||||
// // d8c
|
||||
// if (g_FrData.ammoextra > 0) {
|
||||
// tmp = ammoGetQuantity(ammotype);
|
||||
// tmp = currentPlayerGetAmmoCountWithCheck(ammotype);
|
||||
// g_FrData.ammoextra -= g_FrData.numshotssincetopup;
|
||||
//
|
||||
// if (g_FrData.ammoextra < 0) {
|
||||
|
|
@ -3538,7 +3538,7 @@ glabel var7f1b94e4
|
|||
//
|
||||
// // e04
|
||||
// if (g_FrData.sdgrenadeextra > 0) {
|
||||
// tmp = ammoGetQuantity(AMMOTYPE_DEVASTATOR);
|
||||
// tmp = currentPlayerGetAmmoCountWithCheck(AMMOTYPE_DEVASTATOR);
|
||||
// g_FrData.sdgrenadeextra -= g_FrData.numshotssincetopup;
|
||||
//
|
||||
// if (g_FrData.sdgrenadeextra < 0) {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ void func0f0a9494(u32 operation);
|
|||
void func0f0a94d0(u32 operation, struct coord *pos, struct coord *rot);
|
||||
void func0f0a95ec(u32 arg0, bool enable);
|
||||
void currentPlayerSetAmmoQuantity(s32 ammotype, s32 quantity);
|
||||
s32 ammoGetQuantity(s32 type);
|
||||
s32 currentPlayerGetAmmoCountWithCheck(s32 type);
|
||||
s32 currentPlayerGetAmmoCount(s32 ammotype);
|
||||
s32 ammotypeGetMaxCapacity(u32 ammotype);
|
||||
bool ammotypeAllowsUnlimitedAmmo(u32 ammotype);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ void currentPlayerZoomOut(f32 fovpersec);
|
|||
void currentPlayerZoomIn(f32 fovpersec);
|
||||
bool weaponHasFlag(s32 itemid, u32 flag);
|
||||
bool weaponHasInvEFlag(s32 weaponnum, u32 flag);
|
||||
u32 func0f0b184c(void);
|
||||
bool func0f0b184c(s32 weaponnum, s32 funcnum, bool arg2);
|
||||
s32 currentPlayerGetDeviceState(s32 weaponnum);
|
||||
void currentPlayerSetDeviceActive(s32 weaponum, bool active);
|
||||
u16 weaponGetModelNum(s32 weaponnum);
|
||||
|
|
|
|||
Loading…
Reference in New Issue