diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 8ffca65e2..8e31c8673 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -8370,7 +8370,7 @@ bool aiShowObj(void) func0f0604bc(obj->pos); func0f0602f0(obj->pos); - if (g_Vars.unk000284->unk480 == 0 && obj->type == OBJTYPE_WEAPON) { + if (g_Vars.currentplayer->unk480 == 0 && obj->type == OBJTYPE_WEAPON) { struct weaponobj *weapon = (struct weaponobj *) obj; if (weapon->weapon_id == WEAPON_CAMSPY) { @@ -15266,7 +15266,7 @@ bool aiChrGrabObject(void) u32 playernum = posGetPlayerNum(chr->pos); setCurrentPlayerNum(playernum); - if (g_Vars.unk000284->unk1b0 == 0 && func0f0cc680() == 2 && g_Vars.unk000284->unk0b4 == 0) { + if (g_Vars.currentplayer->unk1b0 == 0 && func0f0cc680() == 2 && g_Vars.currentplayer->unk0b4 == 0) { func0f0c7cf0(obj->pos); } diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index 552e16733..5ff47d02a 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -30312,7 +30312,7 @@ glabel func0f07accc struct targetsomething *heliGetTargetSomething(struct heliobj *heli) { if (heli->target == -1) { - return g_Vars.unk000284->targetsomething; + return g_Vars.currentplayer->targetsomething; } return g_Vars.targets + heli->target; @@ -226323,29 +226323,13 @@ glabel func0f128834 /* f128928: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel setCurrentPlayerNum -/* f12892c: 3c03800a */ lui $v1,0x800a -/* f128930: 24639fc0 */ addiu $v1,$v1,-24640 -/* f128934: 00047080 */ sll $t6,$a0,0x2 -/* f128938: ac64028c */ sw $a0,0x28c($v1) -/* f12893c: 006e7821 */ addu $t7,$v1,$t6 -/* f128940: 0004c9c0 */ sll $t9,$a0,0x7 -/* f128944: 8df80064 */ lw $t8,0x64($t7) -/* f128948: 27bdffe8 */ addiu $sp,$sp,-24 -/* f12894c: 00794021 */ addu $t0,$v1,$t9 -/* f128950: afbf0014 */ sw $ra,0x14($sp) -/* f128954: 25090074 */ addiu $t1,$t0,0x74 -/* f128958: ac690288 */ sw $t1,0x288($v1) -/* f12895c: 0fc4a39e */ jal func0f128e78 -/* f128960: ac780284 */ sw $t8,0x284($v1) -/* f128964: 8fbf0014 */ lw $ra,0x14($sp) -/* f128968: 3c03800a */ lui $v1,0x800a -/* f12896c: 24639fc0 */ addiu $v1,$v1,-24640 -/* f128970: ac620290 */ sw $v0,0x290($v1) -/* f128974: 03e00008 */ jr $ra -/* f128978: 27bd0018 */ addiu $sp,$sp,0x18 -); +void setCurrentPlayerNum(u32 playernum) +{ + g_Vars.currentplayernum = playernum; + g_Vars.currentplayer = g_Vars.players[playernum]; + g_Vars.unk000288 = &g_Vars.unk000074[playernum]; + g_Vars.unk000290 = func0f128e78(playernum); +} GLOBAL_ASM( glabel posGetPlayerNum diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 1ed845c19..651c45851 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -40,149 +40,20 @@ struct g_vars { /*000058*/ u32 unk000058; /*00005c*/ u32 unk00005c; /*000060*/ u32 unk000060; - /*000064*/ struct player *players[2]; - /*00006c*/ u32 unk00006c; - /*000070*/ u32 unk000070; - /*000074*/ u32 unk000074; - /*000078*/ u32 unk000078; - /*00007c*/ u32 unk00007c; - /*000080*/ u32 unk000080; - /*000084*/ u32 unk000084; - /*000088*/ u32 unk000088; - /*00008c*/ u32 unk00008c; - /*000090*/ u32 unk000090; - /*000094*/ u32 unk000094; - /*000098*/ u32 unk000098; - /*00009c*/ u32 unk00009c; - /*0000a0*/ u32 unk0000a0; - /*0000a4*/ u32 unk0000a4; - /*0000a8*/ u32 unk0000a8; - /*0000ac*/ u32 unk0000ac; - /*0000b0*/ u32 unk0000b0; - /*0000b4*/ u32 unk0000b4; - /*0000b8*/ u32 unk0000b8; - /*0000bc*/ u32 unk0000bc; - /*0000c0*/ u32 unk0000c0; - /*0000c4*/ u32 unk0000c4; - /*0000c8*/ u32 unk0000c8; - /*0000cc*/ u32 unk0000cc; - /*0000d0*/ u32 unk0000d0; - /*0000d4*/ u32 unk0000d4; - /*0000d8*/ u32 unk0000d8; - /*0000dc*/ u32 unk0000dc; - /*0000e0*/ u32 unk0000e0; - /*0000e4*/ u32 unk0000e4; - /*0000e8*/ u32 unk0000e8; - /*0000ec*/ u32 unk0000ec; - /*0000f0*/ u32 unk0000f0; - /*0000f4*/ u32 unk0000f4; - /*0000f8*/ u32 unk0000f8; - /*0000fc*/ u32 unk0000fc; - /*000100*/ u32 unk000100; - /*000104*/ u32 unk000104; - /*000108*/ u32 unk000108; - /*00010c*/ u32 unk00010c; - /*000110*/ u32 unk000110; - /*000114*/ u32 unk000114; - /*000118*/ u32 unk000118; - /*00011c*/ u32 unk00011c; - /*000120*/ u32 unk000120; - /*000124*/ u32 unk000124; - /*000128*/ u32 unk000128; - /*00012c*/ u32 unk00012c; - /*000130*/ u32 unk000130; - /*000134*/ u32 unk000134; - /*000138*/ u32 unk000138; - /*00013c*/ u32 unk00013c; - /*000140*/ u32 unk000140; - /*000144*/ u32 unk000144; - /*000148*/ u32 unk000148; - /*00014c*/ u32 unk00014c; - /*000150*/ u32 unk000150; - /*000154*/ u32 unk000154; - /*000158*/ u32 unk000158; - /*00015c*/ u32 unk00015c; - /*000160*/ u32 unk000160; - /*000164*/ u32 unk000164; - /*000168*/ u32 unk000168; - /*00016c*/ u32 unk00016c; - /*000170*/ u32 unk000170; - /*000174*/ u32 unk000174; - /*000178*/ u32 unk000178; - /*00017c*/ u32 unk00017c; - /*000180*/ u32 unk000180; - /*000184*/ u32 unk000184; - /*000188*/ u32 unk000188; - /*00018c*/ u32 unk00018c; - /*000190*/ u32 unk000190; - /*000194*/ u32 unk000194; - /*000198*/ u32 unk000198; - /*00019c*/ u32 unk00019c; - /*0001a0*/ u32 unk0001a0; - /*0001a4*/ u32 unk0001a4; - /*0001a8*/ u32 unk0001a8; - /*0001ac*/ u32 unk0001ac; - /*0001b0*/ u32 unk0001b0; - /*0001b4*/ u32 unk0001b4; - /*0001b8*/ u32 unk0001b8; - /*0001bc*/ u32 unk0001bc; - /*0001c0*/ u32 unk0001c0; - /*0001c4*/ u32 unk0001c4; - /*0001c8*/ u32 unk0001c8; - /*0001cc*/ u32 unk0001cc; - /*0001d0*/ u32 unk0001d0; - /*0001d4*/ u32 unk0001d4; - /*0001d8*/ u32 unk0001d8; - /*0001dc*/ u32 unk0001dc; - /*0001e0*/ u32 unk0001e0; - /*0001e4*/ u32 unk0001e4; - /*0001e8*/ u32 unk0001e8; - /*0001ec*/ u32 unk0001ec; - /*0001f0*/ u32 unk0001f0; - /*0001f4*/ u32 unk0001f4; - /*0001f8*/ u32 unk0001f8; - /*0001fc*/ u32 unk0001fc; - /*000200*/ u32 unk000200; - /*000204*/ u32 unk000204; - /*000208*/ u32 unk000208; - /*00020c*/ u32 unk00020c; - /*000210*/ u32 unk000210; - /*000214*/ u32 unk000214; - /*000218*/ u32 unk000218; - /*00021c*/ u32 unk00021c; - /*000220*/ u32 unk000220; - /*000224*/ u32 unk000224; - /*000228*/ u32 unk000228; - /*00022c*/ u32 unk00022c; - /*000230*/ u32 unk000230; - /*000234*/ u32 unk000234; - /*000238*/ u32 unk000238; - /*00023c*/ u32 unk00023c; - /*000240*/ u32 unk000240; - /*000244*/ u32 unk000244; - /*000248*/ u32 unk000248; - /*00024c*/ u32 unk00024c; - /*000250*/ u32 unk000250; - /*000254*/ u32 unk000254; - /*000258*/ u32 unk000258; - /*00025c*/ u32 unk00025c; - /*000260*/ u32 unk000260; - /*000264*/ u32 unk000264; - /*000268*/ u32 unk000268; - /*00026c*/ u32 unk00026c; - /*000270*/ u32 unk000270; + /*000064*/ struct player *players[4]; + /*000074*/ struct gvars74 unk000074[4]; /*000274*/ u32 unk000274; /*000278*/ u32 unk000278; /*00027c*/ u32 unk00027c; /*000280*/ u32 unk000280; - /*000284*/ struct player *unk000284; - /*000288*/ u32 unk000288; - /*00028c*/ u32 currentplayernum; + /*000284*/ struct player *currentplayer; + /*000288*/ struct gvars74 *unk000288; + /*00028c*/ u32 currentplayernum; // 0-3 /*000290*/ u32 unk000290; - /*000294*/ s32 bondplayernum; // suspected 0-3 to indicate bond controller number + /*000294*/ s32 bondplayernum; /*000298*/ s32 coopplayernum; /*00029c*/ s32 antiplayernum; - /*0002a0*/ struct player *bond; + /*0002a0*/ struct player *bond; // Joanna /*0002a4*/ struct player *coop; // Co-op buddy when controlled by human /*0002a8*/ struct player *anti; // Counter-op /*0002ac*/ u32 unk0002ac; diff --git a/src/include/types.h b/src/include/types.h index 1f5280419..a10b9e49d 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1136,4 +1136,8 @@ struct bootbufferthing { u8 unk00[2400]; }; +struct gvars74 { + u8 unk00[0x80]; +}; + #endif