Decompile currentPlayerGetWeaponFunction

This commit is contained in:
Ryan Dwyer 2020-05-05 22:01:40 +10:00
parent 2ad21542f5
commit 098e18f62f
8 changed files with 31 additions and 51 deletions

View File

@ -4845,7 +4845,7 @@ glabel var7f1ad8e4
// if (getCurrentPlayerWeaponId(0) == WEAPON_FARSIGHTXR20
// && g_Vars.currentplayer->insightaimmode
// && uStack48
// && g_Vars.currentplayer->unk0638[0].unk063b == 1
// && g_Vars.currentplayer->unk0638[0].weaponfunc == FUNC_SECONDARY
// && g_Vars.currentplayer->autoeraserdist > 0) {
// fVar25 = func0f0b49b8(500.0f / g_Vars.currentplayer->autoeraserdist);
// fStack436 = 2;
@ -4885,7 +4885,7 @@ glabel var7f1ad8e4
// }
//
// if (getCurrentPlayerWeaponId(0) == WEAPON_AR34
// && g_Vars.currentplayer->unk0638[0].unk063b == 1) {
// && g_Vars.currentplayer->unk0638[0].weaponfunc == FUNC_SECONDARY) {
// fStack432 = func0f0b14d8();
// }
//
@ -5132,7 +5132,7 @@ glabel var7f1ad8e4
// || g_Vars.currentplayer->autoyaimprop == NULL
// || func0f0b1804(iStack180, 2) == 0
// )
// && (getCurrentPlayerWeaponId(0) != WEAPON_CMP150 || g_Vars.currentplayer->unk0638[0].unk063b != 1)) {
// && (getCurrentPlayerWeaponId(0) != WEAPON_CMP150 || g_Vars.currentplayer->unk0638[0].weaponfunc != FUNC_SECONDARY)) {
//
// if (g_Vars.currentplayer->unk1b68 < 0.979f) {
// g_Vars.currentplayer->unk1b68 += g_Vars.lvupdate240freal * 0.00032f;
@ -5149,7 +5149,7 @@ glabel var7f1ad8e4
// bool followlockon = false;
//
// if (getCurrentPlayerWeaponId(0) == WEAPON_CMP150
// && g_Vars.currentplayer->unk0638[0].unk063b == 1) {
// && g_Vars.currentplayer->unk0638[0].weaponfunc == FUNC_SECONDARY) {
// followlockon = true;
// }
//

View File

@ -9146,7 +9146,7 @@ void func0f036358(struct chrdata *chr, s32 arg1)
chr->aioffset = 0;
func0f0b09f4(arg1, mpPlayerGetIndex(chr));
func0f199964(chr, chr->aibot->unk020);
func0f199964(chr, chr->aibot->weaponnum);
chr->aibot->unk09c_00 = 0;
chr->aibot->unk09c_01 = 0;

View File

@ -923,40 +923,19 @@ struct weaponfunc *weaponGetFunction(u8 *arg0, s32 which)
return NULL;
}
struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand)
{
struct weapon *weapon = weaponFindById(g_Vars.currentplayer->unk0638[hand].weaponnum);
if (weapon) {
return weapon->functions[g_Vars.currentplayer->unk0638[hand].weaponfunc];
}
return NULL;
}
GLOBAL_ASM(
glabel currentPlayerGetWeaponFunction
/* f0b10ec: 00041900 */ sll $v1,$a0,0x4
/* f0b10f0: 00641823 */ subu $v1,$v1,$a0
/* f0b10f4: 00031880 */ sll $v1,$v1,0x2
/* f0b10f8: 00641821 */ addu $v1,$v1,$a0
/* f0b10fc: 3c0e800a */ lui $t6,%hi(g_Vars+0x284)
/* f0b1100: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6)
/* f0b1104: 000318c0 */ sll $v1,$v1,0x3
/* f0b1108: 00641821 */ addu $v1,$v1,$a0
/* f0b110c: 27bdffe0 */ addiu $sp,$sp,-32
/* f0b1110: 00031880 */ sll $v1,$v1,0x2
/* f0b1114: afbf0014 */ sw $ra,0x14($sp)
/* f0b1118: 01c37821 */ addu $t7,$t6,$v1
/* f0b111c: 91e40638 */ lbu $a0,0x638($t7)
/* f0b1120: 0fc2c3f4 */ jal weaponFindById
/* f0b1124: afa30018 */ sw $v1,0x18($sp)
/* f0b1128: 10400009 */ beqz $v0,.L0f0b1150
/* f0b112c: 8fa30018 */ lw $v1,0x18($sp)
/* f0b1130: 3c18800a */ lui $t8,%hi(g_Vars+0x284)
/* f0b1134: 8f18a244 */ lw $t8,%lo(g_Vars+0x284)($t8)
/* f0b1138: 0303c821 */ addu $t9,$t8,$v1
/* f0b113c: 9328063b */ lbu $t0,0x63b($t9)
/* f0b1140: 00084880 */ sll $t1,$t0,0x2
/* f0b1144: 00495021 */ addu $t2,$v0,$t1
/* f0b1148: 10000002 */ beqz $zero,.L0f0b1154
/* f0b114c: 8d420014 */ lw $v0,0x14($t2)
.L0f0b1150:
/* f0b1150: 00001025 */ or $v0,$zero,$zero
.L0f0b1154:
/* f0b1154: 8fbf0014 */ lw $ra,0x14($sp)
/* f0b1158: 27bd0020 */ addiu $sp,$sp,0x20
/* f0b115c: 03e00008 */ jr $ra
/* f0b1160: 00000000 */ sll $zero,$zero,0x0
glabel func0f0b1164
/* f0b1164: 27bdffe8 */ addiu $sp,$sp,-24
/* f0b1168: afbf0014 */ sw $ra,0x14($sp)
/* f0b116c: 0fc2c3f4 */ jal weaponFindById
@ -1951,7 +1930,7 @@ s8 weaponGetMaxFireRatePerTick(u32 weaponnum, u32 funcindex)
u32 currentPlayerGetSight(void)
{
struct weaponfunc *func = weaponGetFunctionById(g_Vars.currentplayer->unk0638[0].unk0638, g_Vars.currentplayer->unk0638[0].unk063b);
struct weaponfunc *func = weaponGetFunctionById(g_Vars.currentplayer->unk0638[0].weaponnum, g_Vars.currentplayer->unk0638[0].weaponfunc);
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_CLOSE) {
return SIGHT_NONE;
@ -1961,7 +1940,7 @@ u32 currentPlayerGetSight(void)
return SIGHT_CLASSIC;
}
switch (g_Vars.currentplayer->unk0638[0].unk0638) {
switch (g_Vars.currentplayer->unk0638[0].weaponnum) {
case WEAPON_HORIZONSCANNER:
return SIGHT_NONE;
case WEAPON_NONE:

View File

@ -626,7 +626,7 @@ void activemenuApply(s32 slot)
if (var80088804 != 0) {
uVar6 = frGetWeaponBySlot(frGetSlot());
if (uVar6 == g_Vars.currentplayer->unk0638[0].unk0638) {
if (g_Vars.currentplayer->unk0638[0].weaponnum == uVar6) {
pass = false;
}
}
@ -747,8 +747,8 @@ void activemenuGetSlotDetails(s32 slot, u32 *flags, char *label)
if (slot == 4) {
strcpy(label, langGet(L_MISC(171))); // "Function"
} else if (slot == 1 || slot == 7) {
prifunc = weaponGetFunction(&g_Vars.currentplayer->unk0638[0].unk0638, 0);
secfunc = weaponGetFunction(&g_Vars.currentplayer->unk0638[0].unk0638, 1);
prifunc = weaponGetFunction(&g_Vars.currentplayer->unk0638[0].weaponnum, FUNC_PRIMARY);
secfunc = weaponGetFunction(&g_Vars.currentplayer->unk0638[0].weaponnum, FUNC_SECONDARY);
if (slot == 1) {
if (!secfunc

View File

@ -325,7 +325,7 @@ glabel mpChrReset
// aibot->unk04c_03 = 0;
// aibot->unk09c_01 = 0;
// aibot->unk04c_05 = 0;
// aibot->unk020 = 1;
// aibot->weaponnum = WEAPON_UNARMED;
// aibot->unk024 = 0;
// aibot->unk028 = 0;
// aibot->prop = NULL;
@ -1332,10 +1332,10 @@ glabel var7f1b8eb4
u32 func0f1915b4(struct chrdata *chr)
{
if (chr->aibot) {
return chr->aibot->unk020;
return chr->aibot->weaponnum;
}
return g_Vars.players[propGetPlayerNum(chr->prop)]->unk0638[0].unk0638;
return g_Vars.players[propGetPlayerNum(chr->prop)]->unk0638[0].weaponnum;
}
u8 func0f191600(struct chrdata *chr)

View File

@ -22,7 +22,7 @@ struct weaponfunc *weaponGetFunctionById(s32 weapon_id, s32 which);
u32 func0f0b103c(void);
u32 func0f0b107c(void);
struct weaponfunc *weaponGetFunction(u8 *arg0, s32 which);
struct weaponfunc *currentPlayerGetWeaponFunction(u32 arg0);
struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand);
u32 func0f0b11bc(void);
u32 func0f0b11ec(void);
f32 func0f0b12ec(u32 arg0);

View File

@ -25,7 +25,7 @@ u32 func0f198e78(void);
u32 func0f198eec(void);
u32 func0f1994b0(void);
u32 func0f19978c(void);
void func0f199964(struct chrdata *chr, u32 arg1);
void func0f199964(struct chrdata *chr, u32 weaponnum);
u32 func0f199984(void);
#endif

View File

@ -151,7 +151,7 @@ struct aibot {
/*0x014*/ u32 unk014;
/*0x018*/ u32 unk018;
/*0x01c*/ struct aibotammotype *ammotypes;
/*0x020*/ u32 unk020;
/*0x020*/ u32 weaponnum;
/*0x024*/ u32 unk024;
/*0x028*/ u32 unk028;
/*0x02c*/ u16 unk02c;
@ -1161,11 +1161,12 @@ struct player1630 {
s16 unk0a;
};
// Suspected weapon data per hand
struct player638 {
/*0x0638*/ u8 unk0638; // weapon num
/*0x0638*/ u8 weaponnum;
/*0x0639*/ u8 unk0639;
/*0x063a*/ u8 unk063a;
/*0x063b*/ u8 unk063b; // 1 if using second function
/*0x063b*/ u8 weaponfunc; // 0 or 1
/*0x063c*/ u8 unk063c;
/*0x0640*/ u32 unk0640;
/*0x0644*/ u32 unk0644;