From c456b9442b3a380be5db2093e645a4dd8fe9fb61 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 6 Mar 2020 19:09:44 +1000 Subject: [PATCH] Decompile currentPlayerDie and discover playerstats struct --- src/game/bondbike.c | 4 +- src/game/bondgrab.c | 2 +- src/game/bondwalk.c | 10 +- src/game/chr/chraction.c | 2 +- src/game/game_011110.c | 2 +- src/game/game_0b63b0.c | 199 +++++++++------------------------ src/game/game_0c79f0.c | 30 ++--- src/game/game_0fd660.c | 8 +- src/game/game_102240.c | 22 ++-- src/game/game_127910.c | 6 +- src/game/game_179060.c | 10 +- src/game/game_187770.c | 2 +- src/game/game_19aa80.c | 2 +- src/include/game/game_066310.h | 2 +- src/include/game/game_097ba0.h | 2 +- src/include/game/game_0b0420.h | 2 +- src/include/game/game_0b63b0.h | 2 +- src/include/game/game_0dcdb0.h | 2 +- src/include/game/game_0f09f0.h | 2 +- src/include/gvars/gvars.h | 4 +- src/include/types.h | 87 ++++++-------- 21 files changed, 148 insertions(+), 254 deletions(-) diff --git a/src/game/bondbike.c b/src/game/bondbike.c index 21c144350..699854fc2 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -84,8 +84,8 @@ void currentPlayerBikeInit(void) func00015b68(matrix, &g_Vars.currentplayer->unk1a70, &g_Vars.currentplayer->unk1adc); func00016b58(g_Vars.currentplayer->bondentermtx, 0, 0, 0, - -g_Vars.currentplayer->unk0388.x, -g_Vars.currentplayer->unk0388.y, -g_Vars.currentplayer->unk0388.z, - g_Vars.currentplayer->unk0394.x, g_Vars.currentplayer->unk0394.y, g_Vars.currentplayer->unk0394.z); + -g_Vars.currentplayer->bond2.unk1c.x, -g_Vars.currentplayer->bond2.unk1c.y, -g_Vars.currentplayer->bond2.unk1c.z, + g_Vars.currentplayer->bond2.unk28.x, g_Vars.currentplayer->bond2.unk28.y, g_Vars.currentplayer->bond2.unk28.z); g_Vars.currentplayer->speedtheta = 0; g_Vars.currentplayer->speedthetacontrol = 0; diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index 043fc6d63..bbe0d6cf3 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -1628,7 +1628,7 @@ void func0f0ce1ac(void) f32 f0; f14 = func0002a1b0(&g_Vars.currentplayer->prop->pos, - g_Vars.currentplayer->width, + g_Vars.currentplayer->bond2.width, g_Vars.currentplayer->prop->rooms, &g_Vars.currentplayer->floorcol, &g_Vars.currentplayer->floortype, diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index a5528a408..aea10f465 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -95,8 +95,8 @@ void currentPlayerWalkInit(void) struct coord delta; func00016b58(g_Vars.currentplayer->walkinitmtx, 0, 0, 0, - -g_Vars.currentplayer->unk0388.x, -g_Vars.currentplayer->unk0388.y, -g_Vars.currentplayer->unk0388.z, - g_Vars.currentplayer->unk0394.x, g_Vars.currentplayer->unk0394.y, g_Vars.currentplayer->unk0394.z); + -g_Vars.currentplayer->bond2.unk1c.x, -g_Vars.currentplayer->bond2.unk1c.y, -g_Vars.currentplayer->bond2.unk1c.z, + g_Vars.currentplayer->bond2.unk28.x, g_Vars.currentplayer->bond2.unk28.y, g_Vars.currentplayer->bond2.unk28.z); g_Vars.currentplayer->walkinitt = 0; g_Vars.currentplayer->walkinitt2 = 0; g_Vars.currentplayer->walkinitstart.x = g_Vars.currentplayer->prop->pos.x; @@ -1293,7 +1293,7 @@ void func0f0c4d98(void) void currentPlayerUpdateSpeedSidewaysWalk(f32 targetspeed, f32 accelspeed, s32 mult) { if (g_Vars.normmplayerisrunning) { - targetspeed = (g_MpPlayers[g_Vars.unk000288->mpchrnum].base.unk1c + 25.0f) / 100 * targetspeed; + targetspeed = (g_MpPlayers[g_Vars.currentplayerstats->mpindex].base.unk1c + 25.0f) / 100 * targetspeed; } if (g_Vars.currentplayer->speedstrafe > targetspeed) { @@ -1316,7 +1316,7 @@ void currentPlayerUpdateSpeedSidewaysWalk(f32 targetspeed, f32 accelspeed, s32 m void currentPlayerUpdateSpeedForwardsWalk(f32 targetspeed, f32 accelspeed) { if (g_Vars.normmplayerisrunning) { - targetspeed = (g_MpPlayers[g_Vars.unk000288->mpchrnum].base.unk1c + 25.0f) / 100 * targetspeed; + targetspeed = (g_MpPlayers[g_Vars.currentplayerstats->mpindex].base.unk1c + 25.0f) / 100 * targetspeed; } if (g_Vars.currentplayer->speedgo < targetspeed) { @@ -2043,7 +2043,7 @@ glabel var7f1ad7d0 /* f0c59b8: 24050001 */ addiu $a1,$zero,0x1 /* f0c59bc: 51e00005 */ beqzl $t7,.L0f0c59d4 /* f0c59c0: 8fa4007c */ lw $a0,0x7c($sp) -/* f0c59c4: 0fc30501 */ jal func0f0c1404 +/* f0c59c4: 0fc30501 */ jal currentPlayerDie /* f0c59c8: afa30104 */ sw $v1,0x104($sp) /* f0c59cc: 8fa30104 */ lw $v1,0x104($sp) /* f0c59d0: 8fa4007c */ lw $a0,0x7c($sp) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index d66cd2d03..8bcb33a13 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -8493,7 +8493,7 @@ glabel func0f034524 /* f0359e4: 00000000 */ sll $zero,$zero,0x0 /* f0359e8: 45000006 */ bc1f .L0f035a04 /* f0359ec: 00000000 */ sll $zero,$zero,0x0 -/* f0359f0: 0fc30501 */ jal func0f0c1404 +/* f0359f0: 0fc30501 */ jal currentPlayerDie /* f0359f4: 00002825 */ or $a1,$zero,$zero /* f0359f8: 920f02ff */ lbu $t7,0x2ff($s0) /* f0359fc: 25f80001 */ addiu $t8,$t7,0x1 diff --git a/src/game/game_011110.c b/src/game/game_011110.c index 14b75d594..f7b1f752d 100644 --- a/src/game/game_011110.c +++ b/src/game/game_011110.c @@ -1522,7 +1522,7 @@ glabel currentPlayerInit // } // } else { // if (g_Vars.mplayerisrunning) { -// g_Vars.currentplayer->prop->chr->team = 1 << g_MpPlayers[g_Vars.unk000288->mpchrnum].base.team; +// g_Vars.currentplayer->prop->chr->team = 1 << g_MpPlayers[g_Vars.currentplayerstats->mpindex].base.team; // } else { // g_Vars.currentplayer->prop->chr->team = TEAM_ALLY; // } diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 8015c3bbd..089bbbcf9 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -8248,7 +8248,7 @@ glabel func0f0bd904 /* f0bdce8: 11a00004 */ beqz $t5,.L0f0bdcfc /* f0bdcec: 00000000 */ sll $zero,$zero,0x0 /* f0bdcf0: 8e64028c */ lw $a0,0x28c($s3) -/* f0bdcf4: 0fc30501 */ jal func0f0c1404 +/* f0bdcf4: 0fc30501 */ jal currentPlayerDie /* f0bdcf8: 24050001 */ addiu $a1,$zero,0x1 .L0f0bdcfc: /* f0bdcfc: 0fc2ee05 */ jal func0f0bb814 @@ -11986,7 +11986,7 @@ glabel func0f0c13a8 /* f0c13e4: 00602025 */ or $a0,$v1,$zero /* f0c13e8: 8cc4028c */ lw $a0,0x28c($a2) .L0f0c13ec: -/* f0c13ec: 0fc30501 */ jal func0f0c1404 +/* f0c13ec: 0fc30501 */ jal currentPlayerDie /* f0c13f0: 00000000 */ sll $zero,$zero,0x0 /* f0c13f4: 8fbf0014 */ lw $ra,0x14($sp) /* f0c13f8: 27bd0018 */ addiu $sp,$sp,0x18 @@ -11994,149 +11994,56 @@ glabel func0f0c13a8 /* f0c1400: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f0c1404 -/* f0c1404: 27bdffd8 */ addiu $sp,$sp,-40 -/* f0c1408: afb00018 */ sw $s0,0x18($sp) -/* f0c140c: 3c10800a */ lui $s0,%hi(g_Vars) -/* f0c1410: 26109fc0 */ addiu $s0,$s0,%lo(g_Vars) -/* f0c1414: 8e020284 */ lw $v0,0x284($s0) -/* f0c1418: afbf001c */ sw $ra,0x1c($sp) -/* f0c141c: afa40028 */ sw $a0,0x28($sp) -/* f0c1420: 8c4e00d8 */ lw $t6,0xd8($v0) -/* f0c1424: 55c00075 */ bnezl $t6,.L0f0c15fc -/* f0c1428: 8fbf001c */ lw $ra,0x1c($sp) -/* f0c142c: 14a00003 */ bnez $a1,.L0f0c143c -/* f0c1430: 00000000 */ sll $zero,$zero,0x0 -/* f0c1434: 904f1922 */ lbu $t7,0x1922($v0) -/* f0c1438: 15e0006f */ bnez $t7,.L0f0c15f8 -.L0f0c143c: -/* f0c143c: 3c028007 */ lui $v0,%hi(g_MpPlayerNum) -/* f0c1440: 24421448 */ addiu $v0,$v0,%lo(g_MpPlayerNum) -/* f0c1444: 8c580000 */ lw $t8,0x0($v0) -/* f0c1448: 8e190288 */ lw $t9,0x288($s0) -/* f0c144c: afb80024 */ sw $t8,0x24($sp) -/* f0c1450: 8f280070 */ lw $t0,0x70($t9) -/* f0c1454: 0fc3e048 */ jal func0f0f8120 -/* f0c1458: ac480000 */ sw $t0,0x0($v0) -/* f0c145c: 8fa90024 */ lw $t1,0x24($sp) -/* f0c1460: 3c018007 */ lui $at,0x8007 -/* f0c1464: ac291448 */ sw $t1,0x1448($at) -/* f0c1468: 0fc37e94 */ jal func0f0dfa50 -/* f0c146c: 8e04028c */ lw $a0,0x28c($s0) -/* f0c1470: 8e0a0314 */ lw $t2,0x314($s0) -/* f0c1474: 8fa40028 */ lw $a0,0x28($sp) -/* f0c1478: 51400004 */ beqzl $t2,.L0f0c148c -/* f0c147c: 8e0b0284 */ lw $t3,0x284($s0) -/* f0c1480: 0fc2c27d */ jal func0f0b09f4 -/* f0c1484: 8e05028c */ lw $a1,0x28c($s0) -/* f0c1488: 8e0b0284 */ lw $t3,0x284($s0) -.L0f0c148c: -/* f0c148c: 24050001 */ addiu $a1,$zero,0x1 -/* f0c1490: 8d6c00bc */ lw $t4,0xbc($t3) -/* f0c1494: 0fc08946 */ jal chrUncloak -/* f0c1498: 8d840004 */ lw $a0,0x4($t4) -/* f0c149c: 8e0d0314 */ lw $t5,0x314($s0) -/* f0c14a0: 51a0000d */ beqzl $t5,.L0f0c14d8 -/* f0c14a4: 8e180284 */ lw $t8,0x284($s0) -/* f0c14a8: 8e02029c */ lw $v0,0x29c($s0) -/* f0c14ac: 04400007 */ bltz $v0,.L0f0c14cc -/* f0c14b0: 00000000 */ sll $zero,$zero,0x0 -/* f0c14b4: 8e0e028c */ lw $t6,0x28c($s0) -/* f0c14b8: 8faf0028 */ lw $t7,0x28($sp) -/* f0c14bc: 144e0003 */ bne $v0,$t6,.L0f0c14cc -/* f0c14c0: 00000000 */ sll $zero,$zero,0x0 -/* f0c14c4: 51e20004 */ beql $t7,$v0,.L0f0c14d8 -/* f0c14c8: 8e180284 */ lw $t8,0x284($s0) -.L0f0c14cc: -/* f0c14cc: 0fc2442b */ jal func0f0910ac -/* f0c14d0: 00000000 */ sll $zero,$zero,0x0 -/* f0c14d4: 8e180284 */ lw $t8,0x284($s0) -.L0f0c14d8: -/* f0c14d8: 24040001 */ addiu $a0,$zero,0x1 -/* f0c14dc: af0400d8 */ sw $a0,0xd8($t8) -/* f0c14e0: 8e0a0284 */ lw $t2,0x284($s0) -/* f0c14e4: 01404825 */ or $t1,$t2,$zero -/* f0c14e8: 25480030 */ addiu $t0,$t2,0x30 -.L0f0c14ec: -/* f0c14ec: 8d21036c */ lw $at,0x36c($t1) -/* f0c14f0: 2529000c */ addiu $t1,$t1,0xc -/* f0c14f4: 254a000c */ addiu $t2,$t2,0xc -/* f0c14f8: ad41032c */ sw $at,0x32c($t2) -/* f0c14fc: 8d210364 */ lw $at,0x364($t1) -/* f0c1500: ad410330 */ sw $at,0x330($t2) -/* f0c1504: 8d210368 */ lw $at,0x368($t1) -/* f0c1508: 1528fff8 */ bne $t1,$t0,.L0f0c14ec -/* f0c150c: ad410334 */ sw $at,0x334($t2) -/* f0c1510: 8d21036c */ lw $at,0x36c($t1) -/* f0c1514: ad410338 */ sw $at,0x338($t2) -/* f0c1518: 8e020284 */ lw $v0,0x284($s0) -/* f0c151c: 24010003 */ addiu $at,$zero,0x3 -/* f0c1520: c4440144 */ lwc1 $f4,0x144($v0) -/* f0c1524: e444031c */ swc1 $f4,0x31c($v0) -/* f0c1528: 8e020284 */ lw $v0,0x284($s0) -/* f0c152c: c4460154 */ lwc1 $f6,0x154($v0) -/* f0c1530: e4460320 */ swc1 $f6,0x320($v0) -/* f0c1534: 8e020284 */ lw $v0,0x284($s0) -/* f0c1538: 8c4b00bc */ lw $t3,0xbc($v0) -/* f0c153c: c5680008 */ lwc1 $f8,0x8($t3) -/* f0c1540: e44802b4 */ swc1 $f8,0x2b4($v0) -/* f0c1544: 8e020284 */ lw $v0,0x284($s0) -/* f0c1548: 8c4c00bc */ lw $t4,0xbc($v0) -/* f0c154c: c58a000c */ lwc1 $f10,0xc($t4) -/* f0c1550: e44a02b8 */ swc1 $f10,0x2b8($v0) -/* f0c1554: 8e020284 */ lw $v0,0x284($s0) -/* f0c1558: 8c4d00bc */ lw $t5,0xbc($v0) -/* f0c155c: c5b00010 */ lwc1 $f16,0x10($t5) -/* f0c1560: e45002bc */ swc1 $f16,0x2bc($v0) -/* f0c1564: 8e020284 */ lw $v0,0x284($s0) -/* f0c1568: 8c4301b0 */ lw $v1,0x1b0($v0) -/* f0c156c: 14600006 */ bnez $v1,.L0f0c1588 -/* f0c1570: 00000000 */ sll $zero,$zero,0x0 -/* f0c1574: 8c4e1af0 */ lw $t6,0x1af0($v0) -/* f0c1578: 11c00006 */ beqz $t6,.L0f0c1594 -/* f0c157c: 00000000 */ sll $zero,$zero,0x0 -/* f0c1580: 10000004 */ beqz $zero,.L0f0c1594 -/* f0c1584: ac441b78 */ sw $a0,0x1b78($v0) -.L0f0c1588: -/* f0c1588: 14610002 */ bne $v1,$at,.L0f0c1594 -/* f0c158c: 00000000 */ sll $zero,$zero,0x0 -/* f0c1590: ac441b78 */ sw $a0,0x1b78($v0) -.L0f0c1594: -/* f0c1594: 0fc31f4c */ jal currentPlayerSetMoveMode -/* f0c1598: 00002025 */ or $a0,$zero,$zero -/* f0c159c: 0fc28a72 */ jal func0f0a29c8 -/* f0c15a0: 00000000 */ sll $zero,$zero,0x0 -/* f0c15a4: 0fc3089f */ jal getMissionTime -/* f0c15a8: 00000000 */ sll $zero,$zero,0x0 -/* f0c15ac: 8e0f0284 */ lw $t7,0x284($s0) -/* f0c15b0: 8e080288 */ lw $t0,0x288($s0) -/* f0c15b4: 8df8195c */ lw $t8,0x195c($t7) -/* f0c15b8: 8d090050 */ lw $t1,0x50($t0) -/* f0c15bc: 0058c823 */ subu $t9,$v0,$t8 -/* f0c15c0: 0329082a */ slt $at,$t9,$t1 -/* f0c15c4: 10200008 */ beqz $at,.L0f0c15e8 -/* f0c15c8: 00000000 */ sll $zero,$zero,0x0 -/* f0c15cc: 0fc3089f */ jal getMissionTime -/* f0c15d0: 00000000 */ sll $zero,$zero,0x0 -/* f0c15d4: 8e0a0284 */ lw $t2,0x284($s0) -/* f0c15d8: 8e0d0288 */ lw $t5,0x288($s0) -/* f0c15dc: 8d4b195c */ lw $t3,0x195c($t2) -/* f0c15e0: 004b6023 */ subu $t4,$v0,$t3 -/* f0c15e4: adac0050 */ sw $t4,0x50($t5) -.L0f0c15e8: -/* f0c15e8: 0fc3089f */ jal getMissionTime -/* f0c15ec: 00000000 */ sll $zero,$zero,0x0 -/* f0c15f0: 8e0e0284 */ lw $t6,0x284($s0) -/* f0c15f4: adc2195c */ sw $v0,0x195c($t6) -.L0f0c15f8: -/* f0c15f8: 8fbf001c */ lw $ra,0x1c($sp) -.L0f0c15fc: -/* f0c15fc: 8fb00018 */ lw $s0,0x18($sp) -/* f0c1600: 27bd0028 */ addiu $sp,$sp,0x28 -/* f0c1604: 03e00008 */ jr $ra -/* f0c1608: 00000000 */ sll $zero,$zero,0x0 -); +void currentPlayerDie(u32 playernum, bool force) +{ + if (!g_Vars.currentplayer->isdead && + (force || !g_Vars.currentplayer->invincible)) { + u32 prevplayernum = g_MpPlayerNum; + g_MpPlayerNum = g_Vars.currentplayerstats->mpindex; + func0f0f8120(); + g_MpPlayerNum = prevplayernum; + + func0f0dfa50(g_Vars.currentplayernum); + + if (g_Vars.mplayerisrunning) { + func0f0b09f4(playernum, g_Vars.currentplayernum); + } + + chrUncloak(g_Vars.currentplayer->prop->chr, true); + + if (g_Vars.mplayerisrunning && + (g_Vars.antiplayernum < 0 + || g_Vars.currentplayernum != g_Vars.antiplayernum + || playernum != g_Vars.antiplayernum)) { + func0f0910ac(); + } + + g_Vars.currentplayer->isdead = true; + g_Vars.currentplayer->bonddie = g_Vars.currentplayer->bond2; + g_Vars.currentplayer->thetadie = g_Vars.currentplayer->vv_theta; + g_Vars.currentplayer->vertadie = g_Vars.currentplayer->vv_verta; + g_Vars.currentplayer->posdie.x = g_Vars.currentplayer->prop->pos.x; + g_Vars.currentplayer->posdie.y = g_Vars.currentplayer->prop->pos.y; + g_Vars.currentplayer->posdie.z = g_Vars.currentplayer->prop->pos.z; + + if (g_Vars.currentplayer->bondmovemode == MOVEMODE_WALK) { + if (g_Vars.currentplayer->unk1af0) { + g_Vars.currentplayer->bondtankexplode = true; + } + } else if (g_Vars.currentplayer->bondmovemode == MOVEMODE_BIKE) { + g_Vars.currentplayer->bondtankexplode = true; + } + + currentPlayerSetMoveMode(MOVEMODE_WALK); + func0f0a29c8(); + + if (getMissionTime() - g_Vars.currentplayer->lifestarttime60 < g_Vars.currentplayerstats->shortestlife) { + g_Vars.currentplayerstats->shortestlife = getMissionTime() - g_Vars.currentplayer->lifestarttime60; + } + + g_Vars.currentplayer->lifestarttime60 = getMissionTime(); + } +} GLOBAL_ASM( glabel func0f0c160c @@ -12853,7 +12760,7 @@ void propPlayerGetBbox(struct prop *prop, f32 *width, f32 *ymax, f32 *ymin) { u32 playernum = propGetPlayerNum(prop); - *width = g_Vars.players[playernum]->width; + *width = g_Vars.players[playernum]->bond2.width; *ymin = g_Vars.currentplayer->vv_manground + 30; *ymax = g_Vars.currentplayer->vv_manground + g_Vars.players[playernum]->vv_headheight; diff --git a/src/game/game_0c79f0.c b/src/game/game_0c79f0.c index 58d65c205..c0b66fbb5 100644 --- a/src/game/game_0c79f0.c +++ b/src/game/game_0c79f0.c @@ -79,7 +79,7 @@ bool currentPlayerIsAutoAimYEnabled(void) return false; } - return optionsGetAutoAim(g_Vars.unk000288->mpchrnum); + return optionsGetAutoAim(g_Vars.currentplayerstats->mpindex); } GLOBAL_ASM( @@ -152,7 +152,7 @@ bool currentPlayerIsAutoAimXEnabled(void) return false; } - return optionsGetAutoAim(g_Vars.unk000288->mpchrnum); + return optionsGetAutoAim(g_Vars.currentplayerstats->mpindex); } GLOBAL_ASM( @@ -4245,9 +4245,9 @@ void func0f0cbf50(void) g_Vars.currentplayer->vv_cosverta = fcos(g_Vars.currentplayer->vv_verta360 * 0.017450513318181f); g_Vars.currentplayer->vv_sinverta = fsin(g_Vars.currentplayer->vv_verta360 * 0.017450513318181f); - g_Vars.currentplayer->unk036c = -g_Vars.currentplayer->vv_sintheta; - g_Vars.currentplayer->unk0370 = 0; - g_Vars.currentplayer->unk0374 = g_Vars.currentplayer->vv_costheta; + g_Vars.currentplayer->bond2.unk00.x = -g_Vars.currentplayer->vv_sintheta; + g_Vars.currentplayer->bond2.unk00.y = 0; + g_Vars.currentplayer->bond2.unk00.z = g_Vars.currentplayer->vv_costheta; if (g_Vars.currentplayer->prop) { struct chrdata *chr = g_Vars.currentplayer->prop->chr; @@ -4263,9 +4263,9 @@ void func0f0cc19c(struct coord *arg) f32 min; f32 mult; - g_Vars.currentplayer->unk037c.x = arg->x; - g_Vars.currentplayer->unk037c.y = arg->y; - g_Vars.currentplayer->unk037c.z = arg->z; + g_Vars.currentplayer->bond2.unk10.x = arg->x; + g_Vars.currentplayer->bond2.unk10.y = arg->y; + g_Vars.currentplayer->bond2.unk10.z = arg->z; if (g_Vars.currentplayer->isdead && g_Vars.currentplayer->bondleandown > 0) { g_Vars.currentplayer->bondleandown -= 0.25f; @@ -4276,7 +4276,7 @@ void func0f0cc19c(struct coord *arg) } if (g_Vars.currentplayer->vv_verta < 0) { - g_Vars.currentplayer->unk037c.y += -(1.0f - g_Vars.currentplayer->vv_cosverta) * g_Vars.currentplayer->bondleandown; + g_Vars.currentplayer->bond2.unk10.y += -(1.0f - g_Vars.currentplayer->vv_cosverta) * g_Vars.currentplayer->bondleandown; } if (cheatIsActive(CHEAT_SMALLJO)) { @@ -4284,22 +4284,22 @@ void func0f0cc19c(struct coord *arg) mult = g_Vars.currentplayer->unk1a80 * 0.6f + 0.4f; } else if (g_Vars.currentplayer->bondmovemode == MOVEMODE_WALK && g_Vars.currentplayer->walkinitmove) { mult = (1.0f - g_Vars.currentplayer->walkinitt) * 0.6f + 0.4f; - g_Vars.currentplayer->unk037c.y += (g_Vars.currentplayer->crouchoffsetreal - g_Vars.currentplayer->crouchoffsetrealsmall) * g_Vars.currentplayer->walkinitt; + g_Vars.currentplayer->bond2.unk10.y += (g_Vars.currentplayer->crouchoffsetreal - g_Vars.currentplayer->crouchoffsetrealsmall) * g_Vars.currentplayer->walkinitt; } else if (g_Vars.currentplayer->bondmovemode == MOVEMODE_WALK) { mult = 0.4f; - g_Vars.currentplayer->unk037c.y += (g_Vars.currentplayer->crouchoffsetreal - g_Vars.currentplayer->crouchoffsetrealsmall); + g_Vars.currentplayer->bond2.unk10.y += (g_Vars.currentplayer->crouchoffsetreal - g_Vars.currentplayer->crouchoffsetrealsmall); } else { mult = 0.4f; } - g_Vars.currentplayer->unk037c.y = (g_Vars.currentplayer->unk037c.y - g_Vars.currentplayer->vv_manground) * mult; - g_Vars.currentplayer->unk037c.y += g_Vars.currentplayer->vv_manground; + g_Vars.currentplayer->bond2.unk10.y = (g_Vars.currentplayer->bond2.unk10.y - g_Vars.currentplayer->vv_manground) * mult; + g_Vars.currentplayer->bond2.unk10.y += g_Vars.currentplayer->vv_manground; } min = g_Vars.currentplayer->vv_ground + 10; - if (g_Vars.currentplayer->unk037c.y < min) { - g_Vars.currentplayer->unk037c.y = min; + if (g_Vars.currentplayer->bond2.unk10.y < min) { + g_Vars.currentplayer->bond2.unk10.y = min; } } diff --git a/src/game/game_0fd660.c b/src/game/game_0fd660.c index d27dd010d..d023d3c10 100644 --- a/src/game/game_0fd660.c +++ b/src/game/game_0fd660.c @@ -41,7 +41,7 @@ void mpOpenPickTarget(void) if (!mpIsPaused()) { g_ActiveMenuThings[g_ActiveMenuIndex].unk33 = g_ActiveMenuThings[g_ActiveMenuIndex].allbots; g_Vars.currentplayer->activemenumode = 0; - g_MpPlayerNum = g_Vars.unk000288[0].mpchrnum; + g_MpPlayerNum = g_Vars.currentplayerstats->mpindex; func0f0f8330(&menudialog_picktarget, 8); g_MpPlayerNum = prevplayernum; } @@ -630,7 +630,7 @@ void activemenuApply(s32 slot) case 1: // Function - 0c8 if (g_Vars.currentplayer->unk1580 >= WEAPON_UNARMED && g_Vars.currentplayer->unk1580 <= WEAPON_COMBATBOOST - && g_MpPlayers[g_Vars.unk000288->mpchrnum].gunfuncs[(g_Vars.currentplayer->unk1580 - 1) >> 3] & (1 << (g_Vars.currentplayer->unk1580 - 1 & 7))) { + && g_MpPlayers[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->unk1580 - 1) >> 3] & (1 << (g_Vars.currentplayer->unk1580 - 1 & 7))) { if (slot == 1) { g_ActiveMenuThings[g_ActiveMenuIndex].unk30 = 1; } @@ -726,7 +726,7 @@ void activemenuGetSlotDetails(s32 slot, u32 *flags, char *label) if (!secfunc || g_Vars.currentplayer->unk1580 < WEAPON_UNARMED || g_Vars.currentplayer->unk1580 > WEAPON_COMBATBOOST - || (g_MpPlayers[g_Vars.unk000288->mpchrnum].gunfuncs[(g_Vars.currentplayer->unk1580 - 1) >> 3] & (1 << (g_Vars.currentplayer->unk1580 - 1 & 7))) == 0) { + || (g_MpPlayers[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->unk1580 - 1) >> 3] & (1 << (g_Vars.currentplayer->unk1580 - 1 & 7))) == 0) { *flags |= AMSLOTFLAG_CURRENT; } @@ -737,7 +737,7 @@ void activemenuGetSlotDetails(s32 slot, u32 *flags, char *label) if (!prifunc || ( g_Vars.currentplayer->unk1580 >= WEAPON_UNARMED && g_Vars.currentplayer->unk1580 <= WEAPON_COMBATBOOST - && g_MpPlayers[g_Vars.unk000288->mpchrnum].gunfuncs[(g_Vars.currentplayer->unk1580 - 1) >> 3] & (1 << (g_Vars.currentplayer->unk1580 - 1 & 7)))) { + && g_MpPlayers[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->unk1580 - 1) >> 3] & (1 << (g_Vars.currentplayer->unk1580 - 1 & 7)))) { *flags |= AMSLOTFLAG_CURRENT; } diff --git a/src/game/game_102240.c b/src/game/game_102240.c index 7338bb89a..36513b31e 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -315,7 +315,7 @@ s32 menuhandlerReversePitch(u32 operation, struct menu_item *item, bool *enable) u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -688,7 +688,7 @@ s32 menuhandlerLookAhead(u32 operation, struct menu_item *item, bool *enable) u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -709,7 +709,7 @@ s32 menuhandlerHeadRoll(u32 operation, struct menu_item *item, bool *enable) u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -797,7 +797,7 @@ s32 menuhandlerAmmoOnScreen(u32 operation, struct menu_item *item, bool *enable) u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -818,7 +818,7 @@ s32 menuhandlerShowGunFunction(u32 operation, struct menu_item *item, bool *enab u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -844,7 +844,7 @@ s32 menuhandlerShowMissionTime(u32 operation, struct menu_item *item, bool *enab u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -865,7 +865,7 @@ s32 menuhandlerAlwaysShowTarget(u32 operation, struct menu_item *item, bool *ena u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -891,7 +891,7 @@ s32 menuhandlerShowZoomRange(u32 operation, struct menu_item *item, bool *enable u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -917,7 +917,7 @@ s32 menuhandlerPaintball(u32 operation, struct menu_item *item, bool *enable) u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -938,7 +938,7 @@ s32 menuhandlerSightOnScreen(u32 operation, struct menu_item *item, bool *enable u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } @@ -959,7 +959,7 @@ s32 menuhandlerAutoAim(u32 operation, struct menu_item *item, bool *enable) u32 mpchrnum; if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { - mpchrnum = g_Vars.unk000288->mpchrnum; + mpchrnum = g_Vars.currentplayerstats->mpindex; } else { mpchrnum = item->param3; } diff --git a/src/game/game_127910.c b/src/game/game_127910.c index ab2693b42..888c81e38 100644 --- a/src/game/game_127910.c +++ b/src/game/game_127910.c @@ -80,7 +80,7 @@ void func0f127910(void) s32 i; for (i = 0; i < 4; i++) { - g_Vars.unk000074[i].unk5c = 1; + g_Vars.playerstats[i].damagescale = 1; } g_Vars.bondplayernum = 0; @@ -96,7 +96,7 @@ void playersUnrefAll(void) g_Vars.players[3] = NULL; g_Vars.currentplayer = NULL; g_Vars.currentplayerindex = 0; - g_Vars.unk000288 = NULL; + g_Vars.currentplayerstats = NULL; g_Vars.currentplayernum = 0; g_Vars.playerorder[0] = 0; g_Vars.playerorder[1] = 1; @@ -1091,7 +1091,7 @@ void setCurrentPlayerNum(u32 playernum) { g_Vars.currentplayernum = playernum; g_Vars.currentplayer = g_Vars.players[playernum]; - g_Vars.unk000288 = &g_Vars.unk000074[playernum]; + g_Vars.currentplayerstats = &g_Vars.playerstats[playernum]; g_Vars.currentplayerindex = calculatePlayerIndex(playernum); } diff --git a/src/game/game_179060.c b/src/game/game_179060.c index 0077e8558..7acba01e3 100644 --- a/src/game/game_179060.c +++ b/src/game/game_179060.c @@ -7049,16 +7049,16 @@ void scenarioHtbCallback14(struct chrdata *chr) } } else { if (currentPlayerHasBriefcase()) { - g_Vars.unk000288->unk60 += g_Vars.lvupdate240; + g_Vars.currentplayerstats->tokenheldtime += g_Vars.lvupdate240; - if (g_Vars.unk000288->unk60 >= SECSTOFRAMES240(30)) { + if (g_Vars.currentplayerstats->tokenheldtime >= SECSTOFRAMES240(30)) { func00010904(var80095200, 0x5b8, 0, -1, -1, -1, -1, -1); var800ac500[g_Vars.currentplayernum]->unk3e++; - func0f0ddfa4(langGet(0x5418), 9, 1); - g_Vars.unk000288->unk60 = 0; + func0f0ddfa4(langGet(0x5418), 9, 1); // "1 Point!" + g_Vars.currentplayerstats->tokenheldtime = 0; } } else { - g_Vars.unk000288->unk60 = 0; + g_Vars.currentplayerstats->tokenheldtime = 0; } } } diff --git a/src/game/game_187770.c b/src/game/game_187770.c index 9c12e9173..dd4ffee28 100644 --- a/src/game/game_187770.c +++ b/src/game/game_187770.c @@ -2519,7 +2519,7 @@ glabel func0f18961c bool mpIsPaused(void) { - if (PLAYERCOUNT() == 1 && g_Vars.mplayerisrunning && g_MenuStack[g_Vars.unk000288->mpchrnum].unk00) { + if (PLAYERCOUNT() == 1 && g_Vars.mplayerisrunning && g_MenuStack[g_Vars.currentplayerstats->mpindex].unk00) { return true; } diff --git a/src/game/game_19aa80.c b/src/game/game_19aa80.c index dc2be7500..17391ff91 100644 --- a/src/game/game_19aa80.c +++ b/src/game/game_19aa80.c @@ -1900,7 +1900,7 @@ void mpConsiderMarkingCurrentChallengeComplete(void) for (i = 0; i < PLAYERCOUNT(); i++) { setCurrentPlayerNum(i); - mpSetChallengeCompletedByChrWithNumPlayers(g_Vars.unk000288->mpchrnum, g_MpChallengeIndex, PLAYERCOUNT(), true); + mpSetChallengeCompletedByChrWithNumPlayers(g_Vars.currentplayerstats->mpindex, g_MpChallengeIndex, PLAYERCOUNT(), true); } setCurrentPlayerNum(prevplayernum); diff --git a/src/include/game/game_066310.h b/src/include/game/game_066310.h index ed8a75aae..158025d3b 100644 --- a/src/include/game/game_066310.h +++ b/src/include/game/game_066310.h @@ -335,7 +335,7 @@ u32 func0f0908b8(void); u32 func0f090d34(void); u32 func0f090db4(void); u32 func0f091030(void); -u32 func0f0910ac(void); +void func0f0910ac(void); u32 func0f091250(void); u32 func0f0912dc(void); u32 objSetPartVisible(struct defaultobj *obj, u32 arg1, u32 arg2); diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index 3acfc5b64..6523a5305 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -110,7 +110,7 @@ u32 func0f0a233c(void); u32 func0f0a2498(void); u32 func0f0a24f0(void); u32 func0f0a27c8(void); -u32 func0f0a29c8(void); +void func0f0a29c8(void); u32 func0f0a2ab0(void); u32 func0f0a2ae4(void); u32 func0f0a2da8(void); diff --git a/src/include/game/game_0b0420.h b/src/include/game/game_0b0420.h index 3c35cf828..9ea43e196 100644 --- a/src/include/game/game_0b0420.h +++ b/src/include/game/game_0b0420.h @@ -16,7 +16,7 @@ u32 func0f0b05a4(void); u32 func0f0b073c(void); u32 func0f0b0764(void); u32 func0f0b0818(void); -s32 func0f0b09f4(s32 arg0, s32 arg1); +s32 func0f0b09f4(s32 arg0, s32 playernum); struct weapon *weaponFindById(s32 itemid); struct weaponfunc *weaponGetFunctionById(s32 weapon_id, s32 which); u32 func0f0b103c(void); diff --git a/src/include/game/game_0b63b0.h b/src/include/game/game_0b63b0.h index d2b56756a..4896230d3 100644 --- a/src/include/game/game_0b63b0.h +++ b/src/include/game/game_0b63b0.h @@ -66,7 +66,7 @@ u32 func0f0c00cc(void); u32 func0f0c0190(void); u32 func0f0c07c8(void); void func0f0c13a8(s32 arg0); -void func0f0c1404(s32 shooter, s32 arg1); +void currentPlayerDie(u32 playernum, bool force); u32 func0f0c160c(void); u32 func0f0c16f4(void); u32 func0f0c1840(void); diff --git a/src/include/game/game_0dcdb0.h b/src/include/game/game_0dcdb0.h index a06fb058f..55626c148 100644 --- a/src/include/game/game_0dcdb0.h +++ b/src/include/game/game_0dcdb0.h @@ -23,7 +23,7 @@ u32 func0f0deebc(void); u32 func0f0df364(void); void currentPlayerUnsetFlag(u32 flag); void currentPlayerSetFlag(u32 flag); -u32 func0f0dfa50(void); +void func0f0dfa50(u32 playernum); u32 func0f0dfad0(void); u32 func0f0e0724(void); u32 func0f0e0770(void); diff --git a/src/include/game/game_0f09f0.h b/src/include/game/game_0f09f0.h index f9c7fc623..555b4c368 100644 --- a/src/include/game/game_0f09f0.h +++ b/src/include/game/game_0f09f0.h @@ -50,7 +50,7 @@ u32 func0f0f7594(void); u32 func0f0f7728(void); u32 func0f0f7e98(void); u32 func0f0f8040(void); -u32 func0f0f8120(void); +void func0f0f8120(void); void func0f0f820c(struct menu_dialog *dialog, s32 arg1); u32 func0f0f82a8(void); void func0f0f8300(void); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 953a07e29..7c9739ef5 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -40,10 +40,10 @@ struct g_vars { /*00005c*/ f32 diffframe240freal; /*000060*/ u32 unk000060; /*000064*/ struct player *players[4]; - /*000074*/ struct gvars74 unk000074[4]; + /*000074*/ struct playerstats playerstats[4]; /*000274*/ u32 playerorder[4]; /*000284*/ struct player *currentplayer; - /*000288*/ struct gvars74 *unk000288; + /*000288*/ struct playerstats *currentplayerstats; /*00028c*/ s32 currentplayernum; // 0-3 - controller numbers I think /*000290*/ u32 currentplayerindex; // 0-3 - but 2 or 3 probably only used in combat simulator /*000294*/ s32 bondplayernum; diff --git a/src/include/types.h b/src/include/types.h index dab4bf0b3..3a6f53a04 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1105,6 +1105,14 @@ struct gunheld { s32 totaltime240_60; }; +struct playerbond { + /*0x0338 0x036c*/ struct coord unk00; + /*0x0344 0x0378*/ f32 width; + /*0x0348 0x037c*/ struct coord unk10; + /*0x0354 0x0388*/ struct coord unk1c; + /*0x0360 0x0394*/ struct coord unk28; +}; + struct player1630 { struct prop *prop; u32 unk04; @@ -1291,33 +1299,15 @@ struct player { /*0x0308*/ f32 colourfadefracold; /*0x030c*/ f32 colourfadefracnew; /*0x0310*/ struct coord bondprevpos; - /*0x031c*/ u32 unk031c; - /*0x0320*/ u32 unk0320; + /*0x031c*/ f32 thetadie; + /*0x0320*/ f32 vertadie; /*0x0324*/ u32 bondtype; /*0x0328*/ u32 unk0328; /*0x032c*/ u32 unk032c; /*0x0330*/ u32 unk0330; /*0x0334*/ u32 unk0334; - /*0x0338*/ u32 unk0338; - /*0x033c*/ u32 unk033c; - /*0x0340*/ u32 unk0340; - /*0x0344*/ u32 unk0344; - /*0x0348*/ u32 unk0348; - /*0x034c*/ u32 unk034c; - /*0x0350*/ u32 unk0350; - /*0x0354*/ u32 unk0354; - /*0x0358*/ u32 unk0358; - /*0x035c*/ u32 unk035c; - /*0x0360*/ u32 unk0360; - /*0x0364*/ u32 unk0364; - /*0x0368*/ u32 unk0368; - /*0x036c*/ f32 unk036c; // probably a coord - /*0x0370*/ f32 unk0370; - /*0x0374*/ f32 unk0374; - /*0x0378*/ f32 width; - /*0x037c*/ struct coord unk037c; - /*0x0388*/ struct coord unk0388; - /*0x0394*/ struct coord unk0394; + /*0x0338*/ struct playerbond bonddie; + /*0x036c*/ struct playerbond bond2; /*0x03a0*/ bool resetheadpos; /*0x03a4*/ bool resetheadrot; /*0x03a8*/ u32 unk03a8; @@ -2639,7 +2629,7 @@ struct player { /*0x1950*/ u32 lastkilltime60_2; /*0x1954*/ u32 lastkilltime60_3; /*0x1958*/ u32 lastkilltime60_4; - /*0x195c*/ u32 lifestarttime60; + /*0x195c*/ s32 lifestarttime60; /*0x1960*/ u32 killsthislife; /*0x1964*/ u32 healthdisplaytime60; /*0x1968*/ f32 guncloseroffset; @@ -2728,7 +2718,7 @@ struct player { /*0x1b64*/ s32 grabstarttime; /*0x1b68*/ u32 unk1b68; /*0x1b6c*/ struct coord bondforcespeed; - /*0x1b78*/ u32 unk1b78; + /*0x1b78*/ bool bondtankexplode; /*0x1b7c*/ s32 bondviewlevtime60; /*0x1b80*/ f32 bondwatchtime60; /*0x1b84*/ bool tickdiefinished; @@ -3230,39 +3220,36 @@ struct bootbufferthing { u8 unk00[2400]; }; -struct gvars74 { - /*0x00*/ u32 unk00; +struct playerstats { + /*0x00*/ u32 shotcount; /*0x04*/ u32 unk04; /*0x08*/ u32 unk08; /*0x0c*/ u32 unk0c; /*0x10*/ u32 unk10; /*0x14*/ u32 unk14; /*0x18*/ u32 unk18; - /*0x1c*/ u32 unk1c; - /*0x20*/ u32 unk20; - /*0x24*/ u32 unk24; - /*0x28*/ u32 unk28; - /*0x2c*/ u32 unk2c; - /*0x30*/ u32 unk30; - /*0x34*/ u32 unk34; - /*0x38*/ u32 unk38; - /*0x3c*/ u32 unk3c; - /*0x40*/ u32 unk40; - /*0x44*/ u32 unk44; - /*0x48*/ u32 unk48; - /*0x4c*/ u32 unk4c; - /*0x50*/ u32 unk50; - /*0x54*/ u32 unk54; - /*0x58*/ u32 unk58; - /*0x5c*/ f32 unk5c; - /*0x60*/ s32 unk60; + /*0x1c*/ u32 killcount; + /*0x20*/ u32 ggkillcount; + /*0x24*/ u8 kills[16]; + /*0x34*/ u32 drawplayercount; + /*0x38*/ f32 distance; + /*0x3c*/ u32 backshotcount; + /*0x40*/ u32 armourcount; + /*0x44*/ s32 fastest2kills; + /*0x48*/ s32 slowest2kills; + /*0x4c*/ s32 longestlife; + /*0x50*/ s32 shortestlife; + /*0x54*/ u32 maxkills; + /*0x58*/ u32 maxsimulkills; + /*0x5c*/ f32 damagescale; + /*0x60*/ s32 tokenheldtime; /*0x64*/ u32 unk64; - /*0x68*/ u32 unk68; - /*0x6c*/ u32 unk6c; - /*0x70*/ u32 mpchrnum; - /*0x74*/ u32 unk74; - /*0x78*/ u32 unk78; - /*0x7c*/ u32 unk7c; + /*0x68*/ u32 cloaktime; + /*0x6c*/ u32 speedpillcount; + /*0x70*/ u32 mpindex; + /*0x74*/ u32 scale_bg2gfx; + /*0x78*/ u32 damreceived; + /*0x7c*/ u32 damtransmitted; }; struct credit {