diff --git a/src/game/bondbike.c b/src/game/bondbike.c index 5c9690928..c14d758ed 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -74,9 +74,9 @@ void currentPlayerBikeInit(void) if (hoverbike->base.hidden & OBJHFLAG_00000080) { struct obj48 *obj48 = hoverbike->base.unk48; - hoverbike->speed[0] = obj48->unk04.x; - hoverbike->speed[1] = obj48->unk04.z; - hoverbike->w = obj48->unkdc; + hoverbike->speed[0] = obj48->unk004.x; + hoverbike->speed[1] = obj48->unk004.z; + hoverbike->w = obj48->unk0dc; } func0f06ac90(g_Vars.currentplayer->hoverbike); diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index 214cb86ca..1ef4032af 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -89,8 +89,8 @@ void currentPlayerGrabInit(void) if (obj->hidden & OBJHFLAG_00000080) { struct obj48 *obj48 = obj->unk48; - g_Vars.currentplayer->bondshotspeed[0] += obj48->unk04.x * 0.2f; - g_Vars.currentplayer->bondshotspeed[2] += obj48->unk04.z * 0.2f; + g_Vars.currentplayer->bondshotspeed[0] += obj48->unk004.x * 0.2f; + g_Vars.currentplayer->bondshotspeed[2] += obj48->unk004.z * 0.2f; func0f06ac40(obj); } diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index f0cde27f5..795549569 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -3084,7 +3084,7 @@ void chrDoFlinchcntThing(struct chrdata *chr, f32 arg1) } chr->hidden2 &= 0x0fff; - chr->hidden2 |= CHRH2FLAG_1000; + chr->hidden2 |= CHRH2FLAG_HEADSHOTTED; value = (arg1 + 0.3926365673542f) * 8.0f / M_BADTAU; if (value < 0) { diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index ec6d8af07..aebe1cb07 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -8304,7 +8304,7 @@ glabel aiSayQuip // s32 distance; // 116 - not referenced // s32 row = cmd[3]; // 112 // u32 playernum; // 108 - not referenced -// u8 flag = g_Vars.chrdata->hidden2 & CHRH2FLAG_1000; // 107 +// u8 headshotted = g_Vars.chrdata->hidden2 & CHRH2FLAG_HEADSHOTTED; // 107 // struct chrdata *loopchr; // 100 // // // Choose bank @@ -8423,7 +8423,8 @@ glabel aiSayQuip // audioMarkAsRecentlyPlayed(audioid); // // // 6e8 -// if (audioid == 0x34e && flag == 0) { +// // Replace gurgle with "why me" +// if (audioid == 0x34e && !headshotted) { // audioid = 0x34d; // } // @@ -8439,6 +8440,7 @@ glabel aiSayQuip // func0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, // -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); // } else { +// // Audio is "Stop moving", "Stop dodging" or "Stand still" // distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); // // if (ABS(distance) > 50) { @@ -8489,7 +8491,8 @@ glabel aiSayQuip // if (audioid) { // audioMarkAsRecentlyPlayed(audioid); // -// if (audioid == 0x34e && flag == 0) { +// // Replace gurgle with "why me" +// if (audioid == 0x34e && !headshotted) { // audioid = 0x34d; // } // @@ -8504,6 +8507,7 @@ glabel aiSayQuip // func0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, // -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); // } else { +// // Audio is "Stop moving", "Stop dodging" or "Stand still" // // a90 // distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); // diff --git a/src/game/game_1999b0.c b/src/game/game_1999b0.c index b0a0980be..1d4de8ca0 100644 --- a/src/game/game_1999b0.c +++ b/src/game/game_1999b0.c @@ -793,77 +793,37 @@ s32 func0f19a60c(s32 weaponnum, s32 funcnum) return iVar4; } -GLOBAL_ASM( -glabel func0f19a6d0 -/* f19a6d0: 27bdffb0 */ addiu $sp,$sp,-80 -/* f19a6d4: afa40050 */ sw $a0,0x50($sp) -/* f19a6d8: afbf0014 */ sw $ra,0x14($sp) -/* f19a6dc: afa50054 */ sw $a1,0x54($sp) -/* f19a6e0: 00a02025 */ or $a0,$a1,$zero -/* f19a6e4: afa60058 */ sw $a2,0x58($sp) -/* f19a6e8: 0fc45095 */ jal waypointFindClosestToPos -/* f19a6ec: 00e02825 */ or $a1,$a3,$zero -/* f19a6f0: afa2004c */ sw $v0,0x4c($sp) -/* f19a6f4: 8fa40058 */ lw $a0,0x58($sp) -/* f19a6f8: 0fc45095 */ jal waypointFindClosestToPos -/* f19a6fc: 8fa50060 */ lw $a1,0x60($sp) -/* f19a700: 8fae004c */ lw $t6,0x4c($sp) -/* f19a704: afa20048 */ sw $v0,0x48($sp) -/* f19a708: 51c0002d */ beqzl $t6,.L0f19a7c0 -/* f19a70c: 00001025 */ or $v0,$zero,$zero -/* f19a710: 1040002a */ beqz $v0,.L0f19a7bc -/* f19a714: 3c0f800a */ lui $t7,%hi(g_Vars+0x8) -/* f19a718: 8fa80050 */ lw $t0,0x50($sp) -/* f19a71c: 8def9fc8 */ lw $t7,%lo(g_Vars+0x8)($t7) -/* f19a720: 85090000 */ lh $t1,0x0($t0) -/* f19a724: 000fc243 */ sra $t8,$t7,0x9 -/* f19a728: 0018c9c0 */ sll $t9,$t8,0x7 -/* f19a72c: 000950c0 */ sll $t2,$t1,0x3 -/* f19a730: 032a2021 */ addu $a0,$t9,$t2 -/* f19a734: 0fc45090 */ jal waypointSetHashThing -/* f19a738: 00802825 */ or $a1,$a0,$zero -/* f19a73c: 8fa4004c */ lw $a0,0x4c($sp) -/* f19a740: 8fa50048 */ lw $a1,0x48($sp) -/* f19a744: 27a60030 */ addiu $a2,$sp,0x30 -/* f19a748: 0fc4547b */ jal waypointFindRoute -/* f19a74c: 24070006 */ addiu $a3,$zero,0x6 -/* f19a750: afa2002c */ sw $v0,0x2c($sp) -/* f19a754: 00002025 */ or $a0,$zero,$zero -/* f19a758: 0fc45090 */ jal waypointSetHashThing -/* f19a75c: 00002825 */ or $a1,$zero,$zero -/* f19a760: 8fab002c */ lw $t3,0x2c($sp) -/* f19a764: 8fac0030 */ lw $t4,0x30($sp) -/* f19a768: 29610002 */ slti $at,$t3,0x2 -/* f19a76c: 54200014 */ bnezl $at,.L0f19a7c0 -/* f19a770: 00001025 */ or $v0,$zero,$zero -/* f19a774: 1180000c */ beqz $t4,.L0f19a7a8 -/* f19a778: 00002825 */ or $a1,$zero,$zero -/* f19a77c: 27a30030 */ addiu $v1,$sp,0x30 -/* f19a780: 8c640000 */ lw $a0,0x0($v1) -/* f19a784: 8fa20064 */ lw $v0,0x64($sp) -/* f19a788: 8c8e0000 */ lw $t6,0x0($a0) -.L0f19a78c: -/* f19a78c: 24a50001 */ addiu $a1,$a1,0x1 -/* f19a790: 24420002 */ addiu $v0,$v0,0x2 -/* f19a794: a44e00f6 */ sh $t6,0xf6($v0) -/* f19a798: 8c640004 */ lw $a0,0x4($v1) -/* f19a79c: 24630004 */ addiu $v1,$v1,0x4 -/* f19a7a0: 5480fffa */ bnezl $a0,.L0f19a78c -/* f19a7a4: 8c8e0000 */ lw $t6,0x0($a0) -.L0f19a7a8: -/* f19a7a8: 8fa60064 */ lw $a2,0x64($sp) -/* f19a7ac: 24020001 */ addiu $v0,$zero,0x1 -/* f19a7b0: a0c00105 */ sb $zero,0x105($a2) -/* f19a7b4: 10000002 */ beqz $zero,.L0f19a7c0 -/* f19a7b8: a0c50104 */ sb $a1,0x104($a2) -.L0f19a7bc: -/* f19a7bc: 00001025 */ or $v0,$zero,$zero -.L0f19a7c0: -/* f19a7c0: 8fbf0014 */ lw $ra,0x14($sp) -/* f19a7c4: 27bd0050 */ addiu $sp,$sp,0x50 -/* f19a7c8: 03e00008 */ jr $ra -/* f19a7cc: 00000000 */ sll $zero,$zero,0x0 -); +bool func0f19a6d0(struct chrdata *chr, struct coord *frompos, struct coord *topos, s16 *fromrooms, s16 *torooms, struct obj48 *obj48) +{ + s32 *fromwaypoint = waypointFindClosestToPos(frompos, fromrooms); + s32 *towaypoint = waypointFindClosestToPos(topos, torooms); + s32 *waypoints[6]; + s32 numwaypoints; + + if (fromwaypoint && towaypoint) { + s32 hash = (g_Vars.lvframe60 >> 9) * 128 + chr->chrnum * 8; + waypointSetHashThing(hash, hash); + + numwaypoints = waypointFindRoute(fromwaypoint, towaypoint, waypoints, 6); + waypointSetHashThing(0, 0); + + if (numwaypoints > 1) { + s32 i = 0; + + while (waypoints[i]) { + obj48->waypoints[i] = *waypoints[i]; + i++; + } + + obj48->unk105 = 0; + obj48->unk104 = i; + + return true; + } + } + + return false; +} void func0f19a7d0(u16 padnum, struct coord *pos) { @@ -910,11 +870,11 @@ void aibotCreateSlayerRocket(struct chrdata *chr) if (rocket->base.hidden & OBJHFLAG_00000080) { struct prop *target = chrGetTargetProp(chr); rocket->unk62 = -1; - rocket->base.unk48->unk10 = 7.5; - rocket->base.unk48->unk14 = b; - rocket->base.unk48->unk18 = a; - rocket->base.unk48->unkf4 = 0; - rocket->base.unk48->unkb4 = 0x20000000; + rocket->base.unk48->unk010 = 7.5; + rocket->base.unk48->unk014 = b; + rocket->base.unk48->unk018 = a; + rocket->base.unk48->unk0f4 = 0; + rocket->base.unk48->unk0b4 = 0x20000000; // Fire rocket sound func0f0939f8(NULL, rocket->base.prop, 0x8053, -1, @@ -923,7 +883,7 @@ void aibotCreateSlayerRocket(struct chrdata *chr) if (!func0f19a6d0(chr, &chr->prop->pos, &target->pos, chr->prop->rooms, target->rooms, rocket->base.unk48)) { rocket->unk62 = 0; } else { - func0f19a7d0(rocket->base.unk48->padnum, &rocket->base.unk48->pos); + func0f19a7d0(rocket->base.unk48->waypoints[0], &rocket->base.unk48->pos); chr->aibot->unk044 = rocket->base.prop; } } diff --git a/src/game/propobj.c b/src/game/propobj.c index 77107400d..c880ffa0c 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -32741,8 +32741,8 @@ void propobjSetDropped(struct prop *prop, u32 reason) func0f0685e4(prop); - if ((obj->hidden & OBJHFLAG_00000040) && obj->unk48->unk44) { - obj->unk48->unk44->dropreason = reason; + if ((obj->hidden & OBJHFLAG_00000040) && obj->unk48->unk044) { + obj->unk48->unk044->dropreason = reason; } else if (obj->hidden & OBJHFLAG_00000080) { obj->unk48->dropreason = reason; } @@ -45803,7 +45803,7 @@ void func0f08e224(struct doorobj *door) if (door->base.hidden & OBJHFLAG_00000080) { door->base.unk48->flags |= 1; - func000159b0(&door->base.unk48->unk20); + func000159b0(&door->base.unk48->unk020); } } diff --git a/src/include/constants.h b/src/include/constants.h index 2160f10e1..c60e63a20 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -387,9 +387,9 @@ #define CHRHFLAG_PSYCHOSISED 0x80000000 // chr->hidden2 -#define CHRH2FLAG_0001 0x0001 -#define CHRH2FLAG_0040 0x0040 -#define CHRH2FLAG_1000 0x1000 +#define CHRH2FLAG_0001 0x0001 +#define CHRH2FLAG_0040 0x0040 +#define CHRH2FLAG_HEADSHOTTED 0x1000 // chr->chrflags #define CHRCFLAG_00000001 0x00000001 // Villa takers, Attack Ship Cass and skedar - both set at end of intros diff --git a/src/include/game/game_1999b0.h b/src/include/game/game_1999b0.h index 038080eb0..ab3217000 100644 --- a/src/include/game/game_1999b0.h +++ b/src/include/game/game_1999b0.h @@ -17,7 +17,7 @@ u32 func0f19a2dc(u32 value); u32 ammotypeGetWeapon(u32 ammotype); u32 func0f19a37c(void); s32 func0f19a60c(s32 weaponnum, s32 funcnum); -u32 func0f19a6d0(struct chrdata *chr, struct coord *frompos, struct coord *topos, s16 *fromrooms, s16 *torooms, struct obj48 *obj48); +bool func0f19a6d0(struct chrdata *chr, struct coord *frompos, struct coord *topos, s16 *fromrooms, s16 *torooms, struct obj48 *obj48); void func0f19a7d0(u16 padnum, struct coord *pos); void aibotCreateSlayerRocket(struct chrdata *chr); diff --git a/src/include/types.h b/src/include/types.h index 3ebfde543..914c70bb7 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -768,66 +768,68 @@ struct chrdata { }; struct obj48 { - /*0x00*/ u32 flags; - /*0x04*/ struct coord unk04; // distance moved in last tick - /*0x10*/ f32 unk10; - /*0x14*/ f32 unk14; - /*0x18*/ f32 unk18; - /*0x1c*/ u32 unk1c; - /*0x20*/ f32 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*/ struct obj48 *unk44; - /*0x48*/ u32 unk48; - /*0x4c*/ u32 unk4c; - /*0x50*/ u32 unk50; - /*0x54*/ u32 unk54; - /*0x58*/ u32 unk58; - /*0x5c*/ u32 unk5c; - /*0x60*/ u32 unk60; - /*0x64*/ u32 unk64; - /*0x68*/ u32 unk68; - /*0x6c*/ u32 unk6c; - /*0x70*/ u32 unk70; - /*0x74*/ u32 unk74; - /*0x78*/ u32 unk78; - /*0x7c*/ u32 unk7c; - /*0x80*/ u32 unk80; - /*0x84*/ u32 unk84; - /*0x88*/ u32 unk88; - /*0x8c*/ u32 unk8c; - /*0x90*/ u32 unk90; - /*0x94*/ u32 unk94; - /*0x98*/ u32 unk98; - /*0x9c*/ u32 unk9c; - /*0xa0*/ u32 unka0; - /*0xa4*/ u32 unka4; - /*0xa8*/ u32 unka8; - /*0xac*/ u32 unkac; - /*0xb0*/ u16 dropreason; - /*0xb2*/ u16 unkb2; - /*0xb4*/ u32 unkb4; - /*0xb8*/ u32 unkb8; - /*0xbc*/ u32 unkbc; - /*0xc0*/ u32 unkc0; - /*0xc4*/ struct coord pos; - /*0xd0*/ u32 unkd0; - /*0xd4*/ u32 unkd4; - /*0xd8*/ u32 unkd8; - /*0xdc*/ f32 unkdc; - /*0xe0*/ u32 unke0; - /*0xe4*/ u32 unke4; - /*0xe8*/ u32 unke8; - /*0xec*/ u32 unkec; - /*0xf0*/ u32 unkf0; - /*0xf4*/ u32 unkf4; - /*0xf8*/ u16 padnum; + /*0x000*/ u32 flags; + /*0x004*/ struct coord unk004; // distance moved in last tick + /*0x010*/ f32 unk010; + /*0x014*/ f32 unk014; + /*0x018*/ f32 unk018; + /*0x01c*/ u32 unk01c; + /*0x020*/ f32 unk020; + /*0x024*/ u32 unk024; + /*0x028*/ u32 unk028; + /*0x02c*/ u32 unk02c; + /*0x030*/ u32 unk030; + /*0x034*/ u32 unk034; + /*0x038*/ u32 unk038; + /*0x03c*/ u32 unk03c; + /*0x040*/ u32 unk040; + /*0x044*/ struct obj48 *unk044; + /*0x048*/ u32 unk048; + /*0x04c*/ u32 unk04c; + /*0x050*/ u32 unk050; + /*0x054*/ u32 unk054; + /*0x058*/ u32 unk058; + /*0x05c*/ u32 unk05c; + /*0x060*/ u32 unk060; + /*0x064*/ u32 unk064; + /*0x068*/ u32 unk068; + /*0x06c*/ u32 unk06c; + /*0x070*/ u32 unk070; + /*0x074*/ u32 unk074; + /*0x078*/ u32 unk078; + /*0x07c*/ u32 unk07c; + /*0x080*/ u32 unk080; + /*0x084*/ u32 unk084; + /*0x088*/ u32 unk088; + /*0x08c*/ u32 unk08c; + /*0x090*/ u32 unk090; + /*0x094*/ u32 unk094; + /*0x098*/ u32 unk098; + /*0x09c*/ u32 unk09c; + /*0x0a0*/ u32 unk0a0; + /*0x0a4*/ u32 unk0a4; + /*0x0a8*/ u32 unk0a8; + /*0x0ac*/ u32 unk0ac; + /*0x0b0*/ u16 dropreason; + /*0x0b2*/ u16 unk0b2; + /*0x0b4*/ u32 unk0b4; + /*0x0b8*/ u32 unk0b8; + /*0x0bc*/ u32 unk0bc; + /*0x0c0*/ u32 unk0c0; + /*0x0c4*/ struct coord pos; + /*0x0d0*/ u32 unk0d0; + /*0x0d4*/ u32 unk0d4; + /*0x0d8*/ u32 unk0d8; + /*0x0dc*/ f32 unk0dc; + /*0x0e0*/ u32 unk0e0; + /*0x0e4*/ u32 unk0e4; + /*0x0e8*/ u32 unk0e8; + /*0x0ec*/ u32 unk0ec; + /*0x0f0*/ u32 unk0f0; + /*0x0f4*/ u32 unk0f4; + /*0x0f8*/ s16 waypoints[6]; + /*0x104*/ u8 unk104; + /*0x105*/ u8 unk105; }; struct hov {