diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 88438a557..a1984431d 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -120,7 +120,7 @@ void propsTick2(void) g_Vars.players[i]->bondextrapos.z = 0; } - func0f02c9b0(); + shieldhitsTick(); func0f048398(); prop = g_Vars.activeprops; @@ -4593,7 +4593,7 @@ void func0f020d44(struct prop *prop, bool removechr) func0f14159c(prop); func0f0926bc(prop, 1, 0xffff); - func0f0292bc(prop); + shieldhitsRemoveByProp(prop); func0f089a94(0, model); propDeregisterRooms(prop); @@ -8622,7 +8622,7 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool withalpha) return gdl; } -struct var80062a8c *var80062a8c = NULL; +struct shieldhit *g_ShieldHits = NULL; void chrEmitSparks(struct chrdata *chr, struct prop *prop, s32 hitpart, struct coord *coord, struct coord *coord2, struct chrdata *chr2) { @@ -11977,10 +11977,10 @@ glabel func0f028e6c //} GLOBAL_ASM( -glabel func0f028f7c +glabel shieldhitCreate /* f028f7c: 27bdffd8 */ addiu $sp,$sp,-40 -/* f028f80: 3c0a8006 */ lui $t2,%hi(var80062a8c) -/* f028f84: 8d4a2a8c */ lw $t2,%lo(var80062a8c)($t2) +/* f028f80: 3c0a8006 */ lui $t2,%hi(g_ShieldHits) +/* f028f84: 8d4a2a8c */ lw $t2,%lo(g_ShieldHits)($t2) /* f028f88: afb00018 */ sw $s0,0x18($sp) /* f028f8c: 00808025 */ or $s0,$a0,$zero /* f028f90: afbf001c */ sw $ra,0x1c($sp) @@ -12071,8 +12071,8 @@ glabel func0f028f7c /* f0290c0: 240a0001 */ addiu $t2,$zero,0x1 /* f0290c4: 00004825 */ or $t1,$zero,$zero /* f0290c8: 11a00024 */ beqz $t5,.L0f02915c -/* f0290cc: 3c088006 */ lui $t0,%hi(var80062a8c) -/* f0290d0: 8d082a8c */ lw $t0,%lo(var80062a8c)($t0) +/* f0290cc: 3c088006 */ lui $t0,%hi(g_ShieldHits) +/* f0290d0: 8d082a8c */ lw $t0,%lo(g_ShieldHits)($t0) /* f0290d4: 24060020 */ addiu $a2,$zero,0x20 /* f0290d8: 2405fffe */ addiu $a1,$zero,-2 .L0f0290dc: @@ -12144,65 +12144,65 @@ glabel func0f028f7c /* f0291b8: 8fbf001c */ lw $ra,0x1c($sp) .L0f0291bc: /* f0291bc: 240d0001 */ addiu $t5,$zero,0x1 -/* f0291c0: 3c018006 */ lui $at,%hi(var80062a90) +/* f0291c0: 3c018006 */ lui $at,%hi(g_ShieldHitActive) /* f0291c4: 8fb00018 */ lw $s0,0x18($sp) -/* f0291c8: ac2d2a90 */ sw $t5,%lo(var80062a90)($at) +/* f0291c8: ac2d2a90 */ sw $t5,%lo(g_ShieldHitActive)($at) /* f0291cc: 03e00008 */ jr $ra /* f0291d0: 27bd0028 */ addiu $sp,$sp,0x28 ); -// Mismatch: Goal uses a temp register for thing and handles the i/j loop +// Mismatch: Goal uses a temp register for shieldhit and handles the i/j loop // differently. -//void func0f028f7c(struct prop *prop, f32 shield, struct prop *arg2, struct modelnode *node, struct model *model, s32 side, s16 *arg6) +//void shieldhitCreate(struct prop *prop, f32 shield, struct prop *arg2, struct modelnode *node, struct model *model, s32 side, s16 *arg6) //{ -// struct var80062a8c *thing = NULL; +// struct shieldhit *shieldhit = NULL; // s32 i; // s32 j; // // for (i = 0; i < 20; i++) { -// if (var80062a8c[i].prop == NULL) { -// thing = &var80062a8c[i]; +// if (g_ShieldHits[i].prop == NULL) { +// shieldhit = &g_ShieldHits[i]; // break; // } // } // -// if (thing == NULL) { +// if (shieldhit == NULL) { // for (i = 0; i < 20; i++) { -// if (var80062a8c[i].lvframe60 < g_Vars.lvframe60) { -// thing = &var80062a8c[i]; +// if (g_ShieldHits[i].lvframe60 < g_Vars.lvframe60) { +// shieldhit = &g_ShieldHits[i]; // } // } // } // -// if (thing) { -// thing->prop = prop; -// thing->node = node; -// thing->model = model; -// thing->side = side; -// thing->lvframe60 = g_Vars.lvframe60; +// if (shieldhit) { +// shieldhit->prop = prop; +// shieldhit->node = node; +// shieldhit->model = model; +// shieldhit->side = side; +// shieldhit->lvframe60 = g_Vars.lvframe60; // // for (i = 0; i < 32; i++) { -// thing->unk018[i] = -1; +// shieldhit->unk018[i] = -1; // } // -// thing->unk011 = 2 + (random() % 6); -// thing->shield = shield; +// shieldhit->unk011 = 2 + (random() % 6); +// shieldhit->shield = shield; // // if (arg6) { -// thing->unk012 = arg6[0]; -// thing->unk014 = arg6[1]; -// thing->unk016 = arg6[2]; +// shieldhit->unk012 = arg6[0]; +// shieldhit->unk014 = arg6[1]; +// shieldhit->unk016 = arg6[2]; // } else { -// thing->unk012 = 0x7fff; +// shieldhit->unk012 = 0x7fff; // } // // if (node) { // bool pass = true; // // for (i = 0; i < 20; i++) { -// if (var80062a8c[i].prop == prop) { +// if (g_ShieldHits[i].prop == prop) { // for (j = 0; j < 32; j++) { -// if (var80062a8c[i].unk018[j] != -1 && var80062a8c[i].unk018[j] != -2) { +// if (g_ShieldHits[i].unk018[j] != -1 && g_ShieldHits[i].unk018[j] != -2) { // pass = false; // break; // } @@ -12218,67 +12218,68 @@ glabel func0f028f7c // s32 index = func0f028e18(arg2, node, model, prop); // // if (index < 32) { -// thing->unk018[index] = 0; -// thing->unk038[index] = 0; +// shieldhit->unk018[index] = 0; +// shieldhit->unk038[index] = 0; // } // } // } // // if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) { -// prop->chr->hidden2 |= CHRH2FLAG_0002; +// prop->chr->hidden2 |= CHRH2FLAG_SHIELDHIT; // } else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) { -// prop->obj->flags3 |= OBJFLAG3_00020000; +// prop->obj->flags3 |= OBJFLAG3_SHIELDHIT; // } // } // -// var80062a90 = true; +// g_ShieldHitActive = true; //} -void func0f0291d4(struct var80062a8c *thing) +void shieldhitRemove(struct shieldhit *shieldhit) { s32 exists = false; s32 i; - struct prop *prop = thing->prop; - thing->prop = NULL; + struct prop *prop = shieldhit->prop; + shieldhit->prop = NULL; - // Check if the var80062a8c array has any props in it - var80062a90 = false; + // Check if there are other shield hits active + g_ShieldHitActive = false; for (i = 0; i < 20; i++) { - if (var80062a8c[i].prop) { - var80062a90 = true; + if (g_ShieldHits[i].prop) { + g_ShieldHitActive = true; break; } } - // Check if the passed prop exists in the array + // Check if the prop being removed has other shield hits too for (i = 0; i < 20; i++) { - if (prop == var80062a8c[i].prop) { + if (prop == g_ShieldHits[i].prop) { exists = true; break; } } if (!exists) { + // Mark prop as shield no longer visible if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) { struct chrdata *chr = prop->chr; - chr->hidden2 &= ~CHRH2FLAG_0002; + chr->hidden2 &= ~CHRH2FLAG_SHIELDHIT; } else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) { struct defaultobj *obj = prop->obj; - obj->flags3 &= ~OBJFLAG3_00020000; + obj->flags3 &= ~OBJFLAG3_SHIELDHIT; } } } -void func0f0292bc(struct prop *prop) +void shieldhitsRemoveByProp(struct prop *prop) { s32 i; for (i = 0; i < 20; i++) { - if (prop == var80062a8c[i].prop) { - func0f0291d4(&var80062a8c[i]); + if (prop == g_ShieldHits[i].prop) { + shieldhitRemove(&g_ShieldHits[i]); } } } @@ -16865,9 +16866,9 @@ glabel func0f02b7d4 /* f02b8a8: 02e03025 */ or $a2,$s7,$zero /* f02b8ac: 0fc0a386 */ jal func0f028e18 /* f02b8b0: 02a03825 */ or $a3,$s5,$zero -/* f02b8b4: 3c058006 */ lui $a1,%hi(var80062a8c) +/* f02b8b4: 3c058006 */ lui $a1,%hi(g_ShieldHits) /* f02b8b8: 00404025 */ or $t0,$v0,$zero -/* f02b8bc: 8ca52a8c */ lw $a1,%lo(var80062a8c)($a1) +/* f02b8bc: 8ca52a8c */ lw $a1,%lo(g_ShieldHits)($a1) /* f02b8c0: 00002025 */ or $a0,$zero,$zero .L0f02b8c4: /* f02b8c4: 8cb80000 */ lw $t8,0x0($a1) @@ -17840,7 +17841,7 @@ Gfx *chrRenderShield(Gfx *gdl, struct chrdata *chr, u32 alpha) } } - if ((chr->hidden2 & CHRH2FLAG_0002) + if ((chr->hidden2 & CHRH2FLAG_SHIELDHIT) || (chrGetShield(chr) > 0 && chr->cmcount < 10) || (chr->cloakfadefrac > 0 && !chr->cloakfadefinished)) { if (chrGetShield(chr) > 0 && g_Vars.lvupdate240 > 0) { @@ -17917,10 +17918,9 @@ Gfx *chrRenderShield(Gfx *gdl, struct chrdata *chr, u32 alpha) } /** - * This appears to tick the shield damage effect when you shoot a shielded chr. - * It handles showing the shield on the body parts that were *not* hit. + * This ticks the shield damage effect when you shoot a shielded chr. */ -void func0f02c9b0(void) +void shieldhitsTick(void) { s32 index; bool changed = false; @@ -17928,59 +17928,59 @@ void func0f02c9b0(void) s32 i; s32 j; - if (var80062a90 != 0) { + if (g_ShieldHitActive) { for (i = 0; i < 20; i++) { - if (var80062a8c[i].prop) { - if (var80062a8c[i].lvframe60 >= g_Vars.lvframe60 - PALDOWN(80)) { + if (g_ShieldHits[i].prop) { + if (g_ShieldHits[i].lvframe60 >= g_Vars.lvframe60 - PALDOWN(80)) { changed = true; - var80062a8c[i].shield += (propGetShieldThing(&var80062a8c[i].prop) - var80062a8c[i].shield) * g_Vars.lvupdate240f * (PAL ? 0.0151515156f : 0.0125f); + g_ShieldHits[i].shield += (propGetShieldThing(&g_ShieldHits[i].prop) - g_ShieldHits[i].shield) * g_Vars.lvupdate240f * (PAL ? 0.0151515156f : 0.0125f); } for (j = 0; j < 32; j++) { - if (var80062a8c[i].unk018[j] >= 0) { + if (g_ShieldHits[i].unk018[j] >= 0) { changed = true; - time60 = var80062a8c[i].unk018[j] + g_Vars.lvupdate240_60; + time60 = g_ShieldHits[i].unk018[j] + g_Vars.lvupdate240_60; - if (var80062a8c[i].unk018[j] < 1 && time60 > 0) { - index = func0f02932c(var80062a8c[i].prop, j); + if (g_ShieldHits[i].unk018[j] < 1 && time60 > 0) { + index = func0f02932c(g_ShieldHits[i].prop, j); if (index >= 0 && index < 32) { - if (var80062a8c[i].unk018[index] == -1) { - var80062a8c[i].unk018[index] = -3; - var80062a8c[i].unk038[index] = var80062a8c[i].unk038[j] + 1; + if (g_ShieldHits[i].unk018[index] == -1) { + g_ShieldHits[i].unk018[index] = -3; + g_ShieldHits[i].unk038[index] = g_ShieldHits[i].unk038[j] + 1; } } - index = func0f0293ec(var80062a8c[i].prop, j); + index = func0f0293ec(g_ShieldHits[i].prop, j); while (index >= 0) { if (index < 32) { - if (var80062a8c[i].unk018[index] == -1) { - var80062a8c[i].unk018[index] = -3; - var80062a8c[i].unk038[index] = var80062a8c[i].unk038[j] + 1; + if (g_ShieldHits[i].unk018[index] == -1) { + g_ShieldHits[i].unk018[index] = -3; + g_ShieldHits[i].unk038[index] = g_ShieldHits[i].unk038[j] + 1; } } - index = func0f0294cc(var80062a8c[i].prop, index); + index = func0f0294cc(g_ShieldHits[i].prop, index); } } if (time60 < PALDOWN(30)) { - var80062a8c[i].unk018[j] = time60; + g_ShieldHits[i].unk018[j] = time60; } else { - var80062a8c[i].unk018[j] = -2; + g_ShieldHits[i].unk018[j] = -2; } } } for (j = 0; j < 32; j++) { - if (var80062a8c[i].unk018[j] == -3) { - var80062a8c[i].unk018[j] = 0; + if (g_ShieldHits[i].unk018[j] == -3) { + g_ShieldHits[i].unk018[j] = 0; } } if (!changed) { - func0f0291d4(&var80062a8c[i]); + shieldhitRemove(&g_ShieldHits[i]); } } } @@ -18019,7 +18019,7 @@ void chrSetDrCarollImages(struct chrdata *drcaroll, s32 imageleft, s32 imagerigh } } -s32 var80062a90 = false; +s32 g_ShieldHitActive = false; u32 var80062a94 = 0x00000000; u32 var80062a98 = 0x00000000; u32 var80062a9c = 0x00000000; diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index b0c003b22..f1f909c97 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -4130,7 +4130,7 @@ bool func0f034080(struct chrdata *chr, struct modelnode *node, struct prop *prop { if (chrGetShield(chr) > 0) { if (node && (node->type & 0xff) == MODELNODETYPE_BBOX) { - func0f028f7c(chr->prop, chrGetShield(chr), prop, node, model, side, arg5); + shieldhitCreate(chr->prop, chrGetShield(chr), prop, node, model, side, arg5); } return true; @@ -4591,7 +4591,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse if (prop2 && node && chr->model) { func0f034080(chr, node, prop2, model, side, arg11); } else { - func0f028f7c(chr->prop, chrGetShield(chr), NULL, NULL, NULL, 0, 0); + shieldhitCreate(chr->prop, chrGetShield(chr), NULL, NULL, NULL, 0, 0); } if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_ONEHITKILLS)) { diff --git a/src/game/game_00b480.c b/src/game/game_00b480.c index def38db96..20264b9c7 100644 --- a/src/game/game_00b480.c +++ b/src/game/game_00b480.c @@ -41,13 +41,13 @@ void func0f00b510(void) g_ChrSlots = NULL; g_NumChrSlots = 0; - var80062a8c = mempAlloc(sizeof(struct var80062a8c) * 20, MEMPOOL_STAGE); + g_ShieldHits = mempAlloc(sizeof(struct shieldhit) * 20, MEMPOOL_STAGE); for (i = 0; i < 20; i++) { - var80062a8c[i].prop = NULL; + g_ShieldHits[i].prop = NULL; } - var80062a90 = 0; + g_ShieldHitActive = 0; g_NumChrs = 0; g_Chrnums = NULL; g_ChrIndexes = NULL; diff --git a/src/game/propobj.c b/src/game/propobj.c index b2e933751..d4cfa9aa0 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -6054,7 +6054,7 @@ void objFree(struct defaultobj *obj, bool freeprop, bool canregen) } func0f0926bc(obj->prop, 1, 0xffff); - func0f0292bc(obj->prop); + shieldhitsRemoveByProp(obj->prop); propClearReferences(obj->prop - g_Vars.props); projectilesUnrefOwner(obj->prop); @@ -24820,7 +24820,7 @@ glabel var7f1ab6dcpf /* f075c3c: afad0018 */ sw $t5,0x18($sp) /* f075c40: 8ce7d3d4 */ lw $a3,-0x2c2c($a3) /* f075c44: afa90014 */ sw $t1,0x14($sp) -/* f075c48: 0fc0a428 */ jal func0f028f7c +/* f075c48: 0fc0a428 */ jal shieldhitCreate /* f075c4c: afb80010 */ sw $t8,0x10($sp) .PF0f075c50: /* f075c50: 8faa0180 */ lw $t2,0x180($sp) @@ -24942,7 +24942,7 @@ glabel var7f1ab6dcpf /* f075dfc: afac0018 */ sw $t4,0x18($sp) /* f075e00: 8ce7d3d4 */ lw $a3,-0x2c2c($a3) /* f075e04: afaa0014 */ sw $t2,0x14($sp) -/* f075e08: 0fc0a428 */ jal func0f028f7c +/* f075e08: 0fc0a428 */ jal shieldhitCreate /* f075e0c: afaf0010 */ sw $t7,0x10($sp) /* f075e10: 3c0e8007 */ lui $t6,0x8007 /* f075e14: 8dce9610 */ lw $t6,-0x69f0($t6) @@ -25027,7 +25027,7 @@ glabel var7f1ab6dcpf /* f075f28: afab0018 */ sw $t3,0x18($sp) /* f075f2c: 8ce7d3d4 */ lw $a3,-0x2c2c($a3) /* f075f30: afb80010 */ sw $t8,0x10($sp) -/* f075f34: 0fc0a428 */ jal func0f028f7c +/* f075f34: 0fc0a428 */ jal shieldhitCreate /* f075f38: afad0014 */ sw $t5,0x14($sp) .PF0f075f3c: /* f075f3c: 8faf034c */ lw $t7,0x34c($sp) @@ -28358,7 +28358,7 @@ glabel var7f1aa438 /* f0759b8: afad0018 */ sw $t5,0x18($sp) /* f0759bc: 8ce7ce74 */ lw $a3,%lo(var8009ce74)($a3) /* f0759c0: afa90014 */ sw $t1,0x14($sp) -/* f0759c4: 0fc0a3df */ jal func0f028f7c +/* f0759c4: 0fc0a3df */ jal shieldhitCreate /* f0759c8: afb80010 */ sw $t8,0x10($sp) .L0f0759cc: /* f0759cc: 8faa0180 */ lw $t2,0x180($sp) @@ -28480,7 +28480,7 @@ glabel var7f1aa438 /* f075b78: afac0018 */ sw $t4,0x18($sp) /* f075b7c: 8ce7ce74 */ lw $a3,%lo(var8009ce74)($a3) /* f075b80: afaa0014 */ sw $t2,0x14($sp) -/* f075b84: 0fc0a3df */ jal func0f028f7c +/* f075b84: 0fc0a3df */ jal shieldhitCreate /* f075b88: afaf0010 */ sw $t7,0x10($sp) /* f075b8c: 3c0e8007 */ lui $t6,%hi(var80069930) /* f075b90: 8dce9930 */ lw $t6,%lo(var80069930)($t6) @@ -28565,7 +28565,7 @@ glabel var7f1aa438 /* f075ca4: afab0018 */ sw $t3,0x18($sp) /* f075ca8: 8ce7ce74 */ lw $a3,%lo(var8009ce74)($a3) /* f075cac: afb80010 */ sw $t8,0x10($sp) -/* f075cb0: 0fc0a3df */ jal func0f028f7c +/* f075cb0: 0fc0a3df */ jal shieldhitCreate /* f075cb4: afad0014 */ sw $t5,0x14($sp) .L0f075cb8: /* f075cb8: 8faf034c */ lw $t7,0x34c($sp) @@ -31860,7 +31860,7 @@ glabel var7f1aa438 /* f0746e4: afb90018 */ sw $t9,0x18($sp) /* f0746e8: 8ce715a4 */ lw $a3,0x15a4($a3) /* f0746ec: afaf0014 */ sw $t7,0x14($sp) -/* f0746f0: 0fc0a24a */ jal func0f028f7c +/* f0746f0: 0fc0a24a */ jal shieldhitCreate /* f0746f4: afb80010 */ sw $t8,0x10($sp) .NB0f0746f8: /* f0746f8: 8fac0184 */ lw $t4,0x184($sp) @@ -31983,7 +31983,7 @@ glabel var7f1aa438 /* f0748a8: 8ce715a4 */ lw $a3,0x15a4($a3) /* f0748ac: afa80180 */ sw $t0,0x180($sp) /* f0748b0: afab0014 */ sw $t3,0x14($sp) -/* f0748b4: 0fc0a24a */ jal func0f028f7c +/* f0748b4: 0fc0a24a */ jal shieldhitCreate /* f0748b8: afa90010 */ sw $t1,0x10($sp) /* f0748bc: 3c0a8007 */ lui $t2,0x8007 /* f0748c0: 8d4ac030 */ lw $t2,-0x3fd0($t2) @@ -32068,7 +32068,7 @@ glabel var7f1aa438 /* f0749d4: afaf0018 */ sw $t7,0x18($sp) /* f0749d8: 8ce715a4 */ lw $a3,0x15a4($a3) /* f0749dc: afb80010 */ sw $t8,0x10($sp) -/* f0749e0: 0fc0a24a */ jal func0f028f7c +/* f0749e0: 0fc0a24a */ jal shieldhitCreate /* f0749e4: afad0014 */ sw $t5,0x14($sp) .NB0f0749e8: /* f0749e8: 8fb9034c */ lw $t9,0x34c($sp) @@ -52086,7 +52086,7 @@ void objRenderProp(struct prop *prop, struct modelrenderdata *renderdata, bool w func0f0c33f0(model->matrices, model->filedata->nummatrices); } - if ((obj->flags3 & (OBJFLAG3_SHOWSHIELD | OBJFLAG3_00020000)) && objIsHealthy(obj)) { + if ((obj->flags3 & (OBJFLAG3_SHOWSHIELD | OBJFLAG3_SHIELDHIT)) && objIsHealthy(obj)) { gSPSetGeometryMode(renderdata->gdl++, G_CULL_BACK); renderdata->gdl = func0f02b7d4(renderdata->gdl, prop, prop, 0xff, 0, 0, 1, 2, 3); @@ -59536,7 +59536,7 @@ glabel func0f085eac /* f086204: 25a10001 */ addiu $at,$t5,0x1 /* f086208: 00017043 */ sra $t6,$at,0x1 .L0f08620c: -/* f08620c: 0fc0a3df */ jal func0f028f7c +/* f08620c: 0fc0a3df */ jal shieldhitCreate /* f086210: afae0014 */ sw $t6,0x14($sp) .L0f086214: /* f086214: 0fc21a6a */ jal objIsHealthy @@ -60265,7 +60265,7 @@ glabel func0f085eac /* f084a60: 25a10001 */ addiu $at,$t5,0x1 /* f084a64: 0001c043 */ sra $t8,$at,0x1 .NB0f084a68: -/* f084a68: 0fc0a24a */ jal func0f028f7c +/* f084a68: 0fc0a24a */ jal shieldhitCreate /* f084a6c: afb80014 */ sw $t8,0x14($sp) .NB0f084a70: /* f084a70: 0fc21481 */ jal objIsHealthy diff --git a/src/include/constants.h b/src/include/constants.h index 1d82ab856..ddc820a77 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -471,7 +471,7 @@ // chr->hidden2 #define CHRH2FLAG_0001 0x0001 -#define CHRH2FLAG_0002 0x0002 // Equivalent to OBJFLAG3_00020000 +#define CHRH2FLAG_SHIELDHIT 0x0002 // Turns off when shield no longer visible #define CHRH2FLAG_0004 0x0004 #define CHRH2FLAG_BLUESIGHT 0x0008 #define CHRH2FLAG_TICKDURINGAUTOCUT 0x0010 @@ -2917,7 +2917,7 @@ #define OBJFLAG3_ISFETCHTARGET 0x00004000 // AI bot is fetching this obj #define OBJFLAG3_REACTTOSIGHT 0x00008000 // Turn sight blue or red when targeted with R #define OBJFLAG3_INTERACTABLE 0x00010000 -#define OBJFLAG3_00020000 0x00020000 // Equivalent to CHRH2FLAG_0002 +#define OBJFLAG3_SHIELDHIT 0x00020000 // Turns off when shield no longer visible #define OBJFLAG3_00040000 0x00040000 // Not used in scripts #define OBJFLAG3_00080000 0x00080000 // Not used in scripts #define OBJFLAG3_HOVERBEDSHIELD 0x00100000 diff --git a/src/include/data.h b/src/include/data.h index ab74150f2..dd68f7f1f 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -144,8 +144,8 @@ extern u32 var8006297c; extern s32 g_NextChrnum; extern struct chrdata *g_ChrSlots; extern s32 g_NumChrSlots; -extern struct var80062a8c *var80062a8c; -extern s32 var80062a90; +extern struct shieldhit *g_ShieldHits; +extern s32 g_ShieldHitActive; extern s32 g_NumBondBodies; extern s32 g_NumMaleGuardHeads; extern s32 g_NumFemaleGuardHeads; diff --git a/src/include/game/chr/chr.h b/src/include/game/chr/chr.h index 42dc04690..4b25f010d 100644 --- a/src/include/game/chr/chr.h +++ b/src/include/game/chr/chr.h @@ -48,9 +48,9 @@ void chrsCheckForNoise(f32 noiseradius); bool func0f028a50(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *arg3); s32 func0f028e18(struct prop *arg0, struct modelnode *node, struct model *model, struct prop *arg3); bool func0f028e6c(s32 arg0, struct prop *prop, struct prop **propptr, struct modelnode **nodeptr, struct model **modelptr); -void func0f028f7c(struct prop *prop, f32 shield, struct prop *arg2, struct modelnode *node, struct model *model, s32 side, s16 *arg6); -void func0f0291d4(struct var80062a8c *thing); -void func0f0292bc(struct prop *prop); +void shieldhitCreate(struct prop *prop, f32 shield, struct prop *arg2, struct modelnode *node, struct model *model, s32 side, s16 *arg6); +void shieldhitRemove(struct shieldhit *shieldhit); +void shieldhitsRemoveByProp(struct prop *prop); s32 func0f02932c(struct prop *prop, s32 arg1); s32 func0f0293ec(struct prop *prop, s32 arg1); s32 func0f0294cc(struct prop *prop, s32 arg1); @@ -60,7 +60,7 @@ u32 func0f02983c(void); Gfx *func0f02b7d4(Gfx *gdl, struct prop *arg1, struct prop *arg2, s32 alpha, bool arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8); Gfx *func0f02bdf8(Gfx *gdl, struct prop *chr1, struct prop *chr2); Gfx *chrRenderShield(Gfx *gdl, struct chrdata *chr, u32 alpha); -void func0f02c9b0(void); +void shieldhitsTick(void); void chrSetDrCarollImages(struct chrdata *drcaroll, s32 imageleft, s32 imageright); s32 getNumChrSlots(void); void chrRegister(s32 chrnum, s32 chrindex); diff --git a/src/include/types.h b/src/include/types.h index 2a88a7056..68d582fbd 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -6087,7 +6087,7 @@ struct rend_vidat { /*0x28*/ u8 *fb; }; -struct var80062a8c { +struct shieldhit { /*0x00*/ struct prop *prop; /*0x04*/ struct modelnode *node; /*0x08*/ struct model *model;