Decompile chrCreateFireslot

This commit is contained in:
Ryan Dwyer 2021-06-23 23:10:39 +10:00
parent e816d1492c
commit 26adadd06f
14 changed files with 133 additions and 310 deletions

View File

@ -5954,7 +5954,7 @@ glabel var7f1ac320
.L0f09a920:
/* f09a920: 1040009b */ beqz $v0,.L0f09ab90
/* f09a924: 02002025 */ or $a0,$s0,$zero
/* f09a928: 0fc2c78a */ jal gsetGetSingleUnk38
/* f09a928: 0fc2c78a */ jal gsetGetFireslotDuration
/* f09a92c: afa00044 */ sw $zero,0x44($sp)
/* f09a930: 1840001e */ blez $v0,.L0f09a9ac
/* f09a934: 8fa30044 */ lw $v1,0x44($sp)
@ -5979,7 +5979,7 @@ glabel var7f1ac320
/* f09a980: 01e2082a */ slt $at,$t7,$v0
/* f09a984: 1020000d */ beqz $at,.L0f09a9bc
/* f09a988: 00000000 */ nop
/* f09a98c: 0fc2c78a */ jal gsetGetSingleUnk38
/* f09a98c: 0fc2c78a */ jal gsetGetFireslotDuration
/* f09a990: 02002025 */ or $a0,$s0,$zero
/* f09a994: 3c18800a */ lui $t8,%hi(g_Vars+0x8)
/* f09a998: 8f189fc8 */ lw $t8,%lo(g_Vars+0x8)($t8)
@ -6284,7 +6284,7 @@ glabel var7f1ac320
.L0f09a920:
/* f09a920: 1040009b */ beqz $v0,.L0f09ab90
/* f09a924: 02002025 */ or $a0,$s0,$zero
/* f09a928: 0fc2c78a */ jal gsetGetSingleUnk38
/* f09a928: 0fc2c78a */ jal gsetGetFireslotDuration
/* f09a92c: afa00044 */ sw $zero,0x44($sp)
/* f09a930: 1840001e */ blez $v0,.L0f09a9ac
/* f09a934: 8fa30044 */ lw $v1,0x44($sp)
@ -6309,7 +6309,7 @@ glabel var7f1ac320
/* f09a980: 01e2082a */ slt $at,$t7,$v0
/* f09a984: 1020000d */ beqz $at,.L0f09a9bc
/* f09a988: 00000000 */ nop
/* f09a98c: 0fc2c78a */ jal gsetGetSingleUnk38
/* f09a98c: 0fc2c78a */ jal gsetGetFireslotDuration
/* f09a990: 02002025 */ or $a0,$s0,$zero
/* f09a994: 3c18800a */ lui $t8,%hi(g_Vars+0x8)
/* f09a998: 8f189fc8 */ lw $t8,%lo(g_Vars+0x8)($t8)
@ -6614,7 +6614,7 @@ glabel var7f1ac320
.NB0f09895c:
/* f09895c: 1040008f */ beqz $v0,.NB0f098b9c
/* f098960: 02002025 */ or $a0,$s0,$zero
/* f098964: 0fc2bee2 */ jal gsetGetSingleUnk38
/* f098964: 0fc2bee2 */ jal gsetGetFireslotDuration
/* f098968: afa0003c */ sw $zero,0x3c($sp)
/* f09896c: 1840001e */ blez $v0,.NB0f0989e8
/* f098970: 8fa3003c */ lw $v1,0x3c($sp)
@ -6639,7 +6639,7 @@ glabel var7f1ac320
/* f0989bc: 01e2082a */ slt $at,$t7,$v0
/* f0989c0: 1020000d */ beqz $at,.NB0f0989f8
/* f0989c4: 00000000 */ sll $zero,$zero,0x0
/* f0989c8: 0fc2bee2 */ jal gsetGetSingleUnk38
/* f0989c8: 0fc2bee2 */ jal gsetGetFireslotDuration
/* f0989cc: 02002025 */ or $a0,$s0,$zero
/* f0989d0: 3c18800a */ lui $t8,0x800a
/* f0989d4: 8f18e6c8 */ lw $t8,-0x1938($t8)
@ -6861,10 +6861,10 @@ const char var7f1ab898[] = "rofftime";
// if (hand->firing) {
// bool playsound = false;
//
// if (gsetGetSingleUnk38(&hand->gset) > 0) {
// if (gsetGetFireslotDuration(&hand->gset) > 0) {
// if (g_Vars.lvframe60 != g_Vars.currentplayer->hands[1 - handnum].lastshootframe60
// && g_Vars.lvframe60 > hand->allowshootframe) {
// hand->allowshootframe = g_Vars.lvframe60 + gsetGetSingleUnk38(&hand->gset);
// hand->allowshootframe = g_Vars.lvframe60 + gsetGetFireslotDuration(&hand->gset);
// playsound = true;
// }
// } else {
@ -24583,25 +24583,25 @@ s8 bgunFreeFireslot(s32 fireslot_id)
{
#if VERSION >= VERSION_NTSC_1_0
if (fireslot_id >= 0 && fireslot_id < NUM_FIRESLOTS) {
g_Fireslots[fireslot_id].unk00 = -1;
g_Fireslots[fireslot_id].endlvframe = -1;
}
#else
if (fireslot_id >= 0) {
g_Fireslots[fireslot_id].unk00 = -1;
g_Fireslots[fireslot_id].endlvframe = -1;
}
#endif
return -1;
}
s32 bgun0f0a70f8(void)
s32 bgunAllocateFireslot(void)
{
s32 index = -1;
s32 i;
for (i = 0; i < ARRAYCOUNT(g_Fireslots); i++) {
if (g_Fireslots[i].unk00 < 0) {
g_Fireslots[i].unk00 = 0;
if (g_Fireslots[i].endlvframe < 0) {
g_Fireslots[i].endlvframe = 0;
#if VERSION < VERSION_NTSC_1_0
g_Fireslots[i].unk04nb = 0;
@ -27136,7 +27136,7 @@ glabel var7f1aca90
/**
* Find and return an available audio handle out of a pool of four.
*/
struct audiohandle **bgunNewAudioHandle(void)
struct audiohandle **bgunAllocateAudioHandle(void)
{
s32 i;
@ -27176,7 +27176,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
return;
}
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle) {
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
@ -27279,7 +27279,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
if (texturenum >= 0 && texturenum < 0xdaf && g_SurfaceTypes[g_Textures[texturenum].soundsurfacetype]) {
s16 soundnum = -1;
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle) {
if (g_SurfaceTypes[g_Textures[texturenum].soundsurfacetype]->numsounds > 0) {
@ -27321,7 +27321,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
return;
}
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle) {
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
@ -27412,7 +27412,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
if (texturenum >= 0 && texturenum < 0xdaf && g_SurfaceTypes[g_Textures[texturenum].soundsurfacetype]) {
s16 soundnum = -1;
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle) {
if (g_SurfaceTypes[g_Textures[texturenum].soundsurfacetype]->numsounds > 0) {
@ -27433,7 +27433,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
void bgun0f0a8404(struct coord *pos, s16 *rooms, s32 arg2)
{
if (g_Vars.lvupdate240 > 0) {
struct audiohandle **handle = bgunNewAudioHandle();
struct audiohandle **handle = bgunAllocateAudioHandle();
if (handle) {
sndStart(var80095200, SFX_HIT_GLASS, handle, -1, -1, -1, -1, -1);
@ -27464,7 +27464,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s
}
playdefault = true;
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle) {
soundnum = -1;
@ -27525,7 +27525,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s
}
if (playdefault) {
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle != NULL && texturenum >= 0 && texturenum < 0xdaf) {
s16 soundnum;
@ -27561,7 +27561,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s
return;
}
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle) {
overridden = false;
@ -27618,7 +27618,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s
}
// Play default surface hit sound
handle = bgunNewAudioHandle();
handle = bgunAllocateAudioHandle();
if (handle != NULL && texturenum >= 0 && texturenum < 0xdaf) {
s16 soundnum;

View File

@ -4394,8 +4394,8 @@ void chrInit(struct prop *prop, u8 *ailist)
chr->weapons_held[1] = NULL;
chr->weapons_held[2] = NULL;
chr->gunprop = NULL;
chr->fireslot[0] = -1;
chr->fireslot[1] = -1;
chr->fireslots[0] = -1;
chr->fireslots[1] = -1;
chr->aimuplshoulder = 0;
chr->aimuprshoulder = 0;
@ -4584,8 +4584,8 @@ void func0f020d44(struct prop *prop, bool removechr)
struct prop *child;
u32 stack[2];
bgunFreeFireslotWrapper(chr->fireslot[0]);
bgunFreeFireslotWrapper(chr->fireslot[1]);
bgunFreeFireslotWrapper(chr->fireslots[0]);
bgunFreeFireslotWrapper(chr->fireslots[1]);
if (chr->proppreset1 >= 0) {
struct prop *proppreset = &g_Vars.props[chr->proppreset1];
@ -6944,12 +6944,12 @@ bool chrTickBeams(struct prop *prop)
{
struct chrdata *chr = prop->chr;
if (chr->fireslot[0] >= 0) {
beamTick(&g_Fireslots[chr->fireslot[0]].beam);
if (chr->fireslots[0] >= 0) {
beamTick(&g_Fireslots[chr->fireslots[0]].beam);
}
if (chr->fireslot[1] >= 0) {
beamTick(&g_Fireslots[chr->fireslot[1]].beam);
if (chr->fireslots[1] >= 0) {
beamTick(&g_Fireslots[chr->fireslots[1]].beam);
}
if (chr->aibot && chr->aibot->unk058 > 0) {

View File

@ -10205,249 +10205,71 @@ void chrTickSurprised(struct chrdata *chr)
}
}
void chrCreateFireslot(struct chrdata *chr, s32 handnum, bool withsound, bool withbeam, struct coord *from, struct coord *to)
{
struct prop *weaponprop;
struct weaponobj *weapon;
s32 weaponnum;
bool playsound = false;
u8 duration;
u16 soundnum;
weaponprop = chrGetEquippedWeaponProp(chr, handnum);
if (weaponprop) {
weapon = weaponprop->weapon;
weaponnum = weapon->weaponnum;
duration = gsetGetFireslotDuration((struct gset *) &weapon->weaponnum);
soundnum = gsetGetSingleShootSound((struct gset *) &weapon->weaponnum);
if (chr->fireslots[handnum] < 0) {
chr->fireslots[handnum] = bgunAllocateFireslot();
}
if (chr->fireslots[handnum] >= 0) {
struct fireslot *fireslot = &g_Fireslots[chr->fireslots[handnum]];
if (withsound) {
if (duration > 0) {
#if VERSION >= VERSION_NTSC_1_0
GLOBAL_ASM(
glabel func0f03e29c
/* f03e29c: 27bdff98 */ addiu $sp,$sp,-104
/* f03e2a0: afbf0044 */ sw $ra,0x44($sp)
/* f03e2a4: afa40068 */ sw $a0,0x68($sp)
/* f03e2a8: afa5006c */ sw $a1,0x6c($sp)
/* f03e2ac: afa60070 */ sw $a2,0x70($sp)
/* f03e2b0: afa70074 */ sw $a3,0x74($sp)
/* f03e2b4: 0fc0a209 */ jal chrGetEquippedWeaponProp
/* f03e2b8: afa00058 */ sw $zero,0x58($sp)
/* f03e2bc: 50400064 */ beqzl $v0,.L0f03e450
/* f03e2c0: 8fbf0044 */ lw $ra,0x44($sp)
/* f03e2c4: 8c420004 */ lw $v0,0x4($v0)
/* f03e2c8: 904e005c */ lbu $t6,0x5c($v0)
/* f03e2cc: 2444005c */ addiu $a0,$v0,0x5c
/* f03e2d0: afa4004c */ sw $a0,0x4c($sp)
/* f03e2d4: 0fc2c78a */ jal gsetGetSingleUnk38
/* f03e2d8: afae005c */ sw $t6,0x5c($sp)
/* f03e2dc: 8fa4004c */ lw $a0,0x4c($sp)
/* f03e2e0: 0fc2c79a */ jal gsetGetSingleShootSound
/* f03e2e4: a3a20057 */ sb $v0,0x57($sp)
/* f03e2e8: 8faa0068 */ lw $t2,0x68($sp)
/* f03e2ec: 8faf006c */ lw $t7,0x6c($sp)
/* f03e2f0: 3049ffff */ andi $t1,$v0,0xffff
/* f03e2f4: 014f2021 */ addu $a0,$t2,$t7
/* f03e2f8: 8083017c */ lb $v1,0x17c($a0)
/* f03e2fc: 04610009 */ bgez $v1,.L0f03e324
/* f03e300: 00000000 */ nop
/* f03e304: afa4004c */ sw $a0,0x4c($sp)
/* f03e308: 0fc29c3e */ jal bgun0f0a70f8
/* f03e30c: a7a90054 */ sh $t1,0x54($sp)
/* f03e310: 8fa4004c */ lw $a0,0x4c($sp)
/* f03e314: 97a90054 */ lhu $t1,0x54($sp)
/* f03e318: a082017c */ sb $v0,0x17c($a0)
/* f03e31c: 8faa0068 */ lw $t2,0x68($sp)
/* f03e320: 8083017c */ lb $v1,0x17c($a0)
.L0f03e324:
/* f03e324: 04600049 */ bltz $v1,.L0f03e44c
/* f03e328: 0003c080 */ sll $t8,$v1,0x2
/* f03e32c: 8fab0070 */ lw $t3,0x70($sp)
/* f03e330: 0303c023 */ subu $t8,$t8,$v1
/* f03e334: 3c19800a */ lui $t9,%hi(g_Fireslots)
/* f03e338: 2739d150 */ addiu $t9,$t9,%lo(g_Fireslots)
/* f03e33c: 0018c100 */ sll $t8,$t8,0x4
/* f03e340: 11600013 */ beqz $t3,.L0f03e390
/* f03e344: 03194021 */ addu $t0,$t8,$t9
/* f03e348: 93ac0057 */ lbu $t4,0x57($sp)
/* f03e34c: 240b0001 */ addiu $t3,$zero,0x1
/* f03e350: 5980000f */ blezl $t4,.L0f03e390
/* f03e354: afab0058 */ sw $t3,0x58($sp)
/* f03e358: 954d0192 */ lhu $t5,0x192($t2)
/* f03e35c: 3c18800a */ lui $t8,%hi(g_Vars+0x8)
/* f03e360: 31ae0020 */ andi $t6,$t5,0x20
/* f03e364: 55c0000b */ bnezl $t6,.L0f03e394
/* f03e368: 8fac0058 */ lw $t4,0x58($sp)
/* f03e36c: 8d0f0000 */ lw $t7,0x0($t0)
/* f03e370: 8f189fc8 */ lw $t8,%lo(g_Vars+0x8)($t8)
/* f03e374: 24190001 */ addiu $t9,$zero,0x1
/* f03e378: 01f8082a */ slt $at,$t7,$t8
/* f03e37c: 50200005 */ beqzl $at,.L0f03e394
/* f03e380: 8fac0058 */ lw $t4,0x58($sp)
/* f03e384: 10000002 */ b .L0f03e390
/* f03e388: afb90058 */ sw $t9,0x58($sp)
/* f03e38c: afab0058 */ sw $t3,0x58($sp)
.L0f03e390:
/* f03e390: 8fac0058 */ lw $t4,0x58($sp)
.L0f03e394:
/* f03e394: 3c01bf80 */ lui $at,0xbf80
/* f03e398: 00002025 */ or $a0,$zero,$zero
/* f03e39c: 11800024 */ beqz $t4,.L0f03e430
/* f03e3a0: 00093400 */ sll $a2,$t1,0x10
/* f03e3a4: 8d45001c */ lw $a1,0x1c($t2)
/* f03e3a8: 44810000 */ mtc1 $at,$f0
/* f03e3ac: 93ac0057 */ lbu $t4,0x57($sp)
/* f03e3b0: 00066c03 */ sra $t5,$a2,0x10
/* f03e3b4: 240effff */ addiu $t6,$zero,-1
/* f03e3b8: 240f0400 */ addiu $t7,$zero,0x400
/* f03e3bc: 24180004 */ addiu $t8,$zero,0x4
/* f03e3c0: 24190011 */ addiu $t9,$zero,0x11
/* f03e3c4: 240bffff */ addiu $t3,$zero,-1
/* f03e3c8: afab002c */ sw $t3,0x2c($sp)
/* f03e3cc: afb9001c */ sw $t9,0x1c($sp)
/* f03e3d0: afb80018 */ sw $t8,0x18($sp)
/* f03e3d4: afaf0014 */ sw $t7,0x14($sp)
/* f03e3d8: afae0010 */ sw $t6,0x10($sp)
/* f03e3dc: 01a03025 */ or $a2,$t5,$zero
/* f03e3e0: afa80050 */ sw $t0,0x50($sp)
/* f03e3e4: afa00028 */ sw $zero,0x28($sp)
/* f03e3e8: afa00020 */ sw $zero,0x20($sp)
/* f03e3ec: 2407ffff */ addiu $a3,$zero,-1
/* f03e3f0: afac004c */ sw $t4,0x4c($sp)
/* f03e3f4: e7a00024 */ swc1 $f0,0x24($sp)
/* f03e3f8: e7a00030 */ swc1 $f0,0x30($sp)
/* f03e3fc: e7a00034 */ swc1 $f0,0x34($sp)
/* f03e400: 0fc24e7e */ jal func0f0939f8
/* f03e404: e7a00038 */ swc1 $f0,0x38($sp)
/* f03e408: 3c0d800a */ lui $t5,%hi(g_Vars+0x8)
/* f03e40c: 8dad9fc8 */ lw $t5,%lo(g_Vars+0x8)($t5)
/* f03e410: 8fae004c */ lw $t6,0x4c($sp)
/* f03e414: 8fa80050 */ lw $t0,0x50($sp)
/* f03e418: 01ae7821 */ addu $t7,$t5,$t6
/* f03e41c: ad0f0000 */ sw $t7,0x0($t0)
/* f03e420: 8fb80068 */ lw $t8,0x68($sp)
/* f03e424: 97190192 */ lhu $t9,0x192($t8)
/* f03e428: 372b0020 */ ori $t3,$t9,0x20
/* f03e42c: a70b0192 */ sh $t3,0x192($t8)
.L0f03e430:
/* f03e430: 8fac0074 */ lw $t4,0x74($sp)
/* f03e434: 25040004 */ addiu $a0,$t0,0x4
/* f03e438: 8fa5005c */ lw $a1,0x5c($sp)
/* f03e43c: 11800003 */ beqz $t4,.L0f03e44c
/* f03e440: 8fa60078 */ lw $a2,0x78($sp)
/* f03e444: 0fc2af9c */ jal func0f0abe70
/* f03e448: 8fa7007c */ lw $a3,0x7c($sp)
.L0f03e44c:
/* f03e44c: 8fbf0044 */ lw $ra,0x44($sp)
.L0f03e450:
/* f03e450: 27bd0068 */ addiu $sp,$sp,0x68
/* f03e454: 03e00008 */ jr $ra
/* f03e458: 00000000 */ nop
);
if (chr->hidden2 & CHRH2FLAG_0020)
#else
GLOBAL_ASM(
glabel func0f03e29c
/* f03da98: 27bdff90 */ addiu $sp,$sp,-112
/* f03da9c: afbf004c */ sw $ra,0x4c($sp)
/* f03daa0: afb00048 */ sw $s0,0x48($sp)
/* f03daa4: 00808025 */ or $s0,$a0,$zero
/* f03daa8: afa50074 */ sw $a1,0x74($sp)
/* f03daac: afa60078 */ sw $a2,0x78($sp)
/* f03dab0: afa7007c */ sw $a3,0x7c($sp)
/* f03dab4: 0fc0a074 */ jal chrGetEquippedWeaponProp
/* f03dab8: afa00060 */ sw $zero,0x60($sp)
/* f03dabc: 50400060 */ beqzl $v0,.NB0f03dc40
/* f03dac0: 8fbf004c */ lw $ra,0x4c($sp)
/* f03dac4: 8c420004 */ lw $v0,0x4($v0)
/* f03dac8: 904e005c */ lbu $t6,0x5c($v0)
/* f03dacc: 2444005c */ addiu $a0,$v0,0x5c
/* f03dad0: afa40054 */ sw $a0,0x54($sp)
/* f03dad4: 0fc2bee2 */ jal gsetGetSingleUnk38
/* f03dad8: afae0064 */ sw $t6,0x64($sp)
/* f03dadc: 8fa40054 */ lw $a0,0x54($sp)
/* f03dae0: 0fc2bef2 */ jal gsetGetSingleShootSound
/* f03dae4: a3a2005f */ sb $v0,0x5f($sp)
/* f03dae8: 8faf0074 */ lw $t7,0x74($sp)
/* f03daec: 3049ffff */ andi $t1,$v0,0xffff
/* f03daf0: 020f2021 */ addu $a0,$s0,$t7
/* f03daf4: 8083017c */ lb $v1,0x17c($a0)
/* f03daf8: 04610008 */ bgez $v1,.NB0f03db1c
/* f03dafc: 00000000 */ sll $zero,$zero,0x0
/* f03db00: afa40054 */ sw $a0,0x54($sp)
/* f03db04: 0fc2938f */ jal bgun0f0a70f8
/* f03db08: a7a9005c */ sh $t1,0x5c($sp)
/* f03db0c: 8fa40054 */ lw $a0,0x54($sp)
/* f03db10: 97a9005c */ lhu $t1,0x5c($sp)
/* f03db14: a082017c */ sb $v0,0x17c($a0)
/* f03db18: 8083017c */ lb $v1,0x17c($a0)
.NB0f03db1c:
/* f03db1c: 04600047 */ bltz $v1,.NB0f03dc3c
/* f03db20: 0003c0c0 */ sll $t8,$v1,0x3
/* f03db24: 8faa0078 */ lw $t2,0x78($sp)
/* f03db28: 0303c023 */ subu $t8,$t8,$v1
/* f03db2c: 3c19800a */ lui $t9,0x800a
/* f03db30: 27391888 */ addiu $t9,$t9,0x1888
/* f03db34: 0018c0c0 */ sll $t8,$t8,0x3
/* f03db38: 11400013 */ beqz $t2,.NB0f03db88
/* f03db3c: 03194021 */ addu $t0,$t8,$t9
/* f03db40: 93ab005f */ lbu $t3,0x5f($sp)
/* f03db44: 24190001 */ addiu $t9,$zero,0x1
/* f03db48: 5960000f */ blezl $t3,.NB0f03db88
/* f03db4c: afb90060 */ sw $t9,0x60($sp)
/* f03db50: 8e0c0014 */ lw $t4,0x14($s0)
/* f03db54: 3c0f800a */ lui $t7,0x800a
/* f03db58: 318d0080 */ andi $t5,$t4,0x80
/* f03db5c: 55a0000b */ bnezl $t5,.NB0f03db8c
/* f03db60: 8faa0060 */ lw $t2,0x60($sp)
/* f03db64: 8d0e0000 */ lw $t6,0x0($t0)
/* f03db68: 8defe6c8 */ lw $t7,-0x1938($t7)
/* f03db6c: 24180001 */ addiu $t8,$zero,0x1
/* f03db70: 01cf082a */ slt $at,$t6,$t7
/* f03db74: 50200005 */ beqzl $at,.NB0f03db8c
/* f03db78: 8faa0060 */ lw $t2,0x60($sp)
/* f03db7c: 10000002 */ beqz $zero,.NB0f03db88
/* f03db80: afb80060 */ sw $t8,0x60($sp)
/* f03db84: afb90060 */ sw $t9,0x60($sp)
.NB0f03db88:
/* f03db88: 8faa0060 */ lw $t2,0x60($sp)
.NB0f03db8c:
/* f03db8c: 3c01bf80 */ lui $at,0xbf80
/* f03db90: 00002025 */ or $a0,$zero,$zero
/* f03db94: 11400022 */ beqz $t2,.NB0f03dc20
/* f03db98: 00093400 */ sll $a2,$t1,0x10
/* f03db9c: 8e05001c */ lw $a1,0x1c($s0)
/* f03dba0: 44810000 */ mtc1 $at,$f0
/* f03dba4: 93b8005f */ lbu $t8,0x5f($sp)
/* f03dba8: 00065c03 */ sra $t3,$a2,0x10
/* f03dbac: 240cffff */ addiu $t4,$zero,-1
/* f03dbb0: 240d0400 */ addiu $t5,$zero,0x400
/* f03dbb4: 240e0004 */ addiu $t6,$zero,0x4
/* f03dbb8: 240fffff */ addiu $t7,$zero,-1
/* f03dbbc: afaf002c */ sw $t7,0x2c($sp)
/* f03dbc0: afae0018 */ sw $t6,0x18($sp)
/* f03dbc4: afad0014 */ sw $t5,0x14($sp)
/* f03dbc8: afac0010 */ sw $t4,0x10($sp)
/* f03dbcc: 01603025 */ or $a2,$t3,$zero
/* f03dbd0: afa80058 */ sw $t0,0x58($sp)
/* f03dbd4: afa00028 */ sw $zero,0x28($sp)
/* f03dbd8: afa00020 */ sw $zero,0x20($sp)
/* f03dbdc: afa0001c */ sw $zero,0x1c($sp)
/* f03dbe0: 2407ffff */ addiu $a3,$zero,-1
/* f03dbe4: afb80054 */ sw $t8,0x54($sp)
/* f03dbe8: e7a00024 */ swc1 $f0,0x24($sp)
/* f03dbec: e7a00030 */ swc1 $f0,0x30($sp)
/* f03dbf0: e7a00034 */ swc1 $f0,0x34($sp)
/* f03dbf4: 0fc24762 */ jal func0f0939f8
/* f03dbf8: e7a00038 */ swc1 $f0,0x38($sp)
/* f03dbfc: 3c19800a */ lui $t9,0x800a
/* f03dc00: 8f39e6c8 */ lw $t9,-0x1938($t9)
/* f03dc04: 8faa0054 */ lw $t2,0x54($sp)
/* f03dc08: 8fa80058 */ lw $t0,0x58($sp)
/* f03dc0c: 032a5821 */ addu $t3,$t9,$t2
/* f03dc10: ad0b0000 */ sw $t3,0x0($t0)
/* f03dc14: 8e0c0014 */ lw $t4,0x14($s0)
/* f03dc18: 358d0080 */ ori $t5,$t4,0x80
/* f03dc1c: ae0d0014 */ sw $t5,0x14($s0)
.NB0f03dc20:
/* f03dc20: 8fae007c */ lw $t6,0x7c($sp)
/* f03dc24: 2504000c */ addiu $a0,$t0,0xc
/* f03dc28: 8fa50064 */ lw $a1,0x64($sp)
/* f03dc2c: 11c00003 */ beqz $t6,.NB0f03dc3c
/* f03dc30: 8fa60080 */ lw $a2,0x80($sp)
/* f03dc34: 0fc2a6f4 */ jal func0f0abe70
/* f03dc38: 8fa70084 */ lw $a3,0x84($sp)
.NB0f03dc3c:
/* f03dc3c: 8fbf004c */ lw $ra,0x4c($sp)
.NB0f03dc40:
/* f03dc40: 8fb00048 */ lw $s0,0x48($sp)
/* f03dc44: 27bd0070 */ addiu $sp,$sp,0x70
/* f03dc48: 03e00008 */ jr $ra
/* f03dc4c: 00000000 */ sll $zero,$zero,0x0
);
if (chr->hidden & CHRHFLAG_00000080)
#endif
{
playsound = false;
} else {
if (g_Vars.lvframe60 > fireslot->endlvframe) {
playsound = true;
} else {
playsound = false;
}
}
} else {
playsound = true;
}
}
if (playsound) {
#if VERSION >= VERSION_NTSC_1_0
func0f0939f8(NULL, chr->prop, soundnum, -1, -1, 0x400, 4, 0x11, NULL, -1, NULL, -1, -1, -1, -1);
fireslot->endlvframe = (u32)g_Vars.lvframe60 + duration;
chr->hidden2 |= CHRH2FLAG_0020;
#else
func0f0939f8(NULL, chr->prop, soundnum, -1, -1, 0x400, 4, 0, NULL, -1, NULL, -1, -1, -1, -1);
fireslot->endlvframe = (u32)g_Vars.lvframe60 + duration;
chr->hidden |= CHRHFLAG_00000080;
if (chr);
#endif
}
if (withbeam) {
beamCreate(&fireslot->beam, weaponnum, from, to);
}
}
}
}
/**
* Returns the chr's turn angle difference to 360 degrees, in radians.
@ -11809,8 +11631,8 @@ void chrStopFiring(struct chrdata *chr)
chrResetAimEndProperties(chr);
chr->fireslot[0] = bgunFreeFireslot(chr->fireslot[0]);
chr->fireslot[1] = bgunFreeFireslot(chr->fireslot[1]);
chr->fireslots[0] = bgunFreeFireslot(chr->fireslots[0]);
chr->fireslots[1] = bgunFreeFireslot(chr->fireslots[1]);
}
}
@ -13920,7 +13742,7 @@ glabel var7f1a9184
/* f041b88: 8fa40278 */ lw $a0,0x278($sp)
/* f041b8c: 8fa5027c */ lw $a1,0x27c($sp)
/* f041b90: 8fa60268 */ lw $a2,0x268($sp)
/* f041b94: 0fc0f908 */ jal func0f03e29c
/* f041b94: 0fc0f908 */ jal chrCreateFireslot
/* f041b98: afa80054 */ sw $t0,0x54($sp)
/* f041b9c: 93b8026f */ lbu $t8,0x26f($sp)
/* f041ba0: 8fa80054 */ lw $t0,0x54($sp)
@ -15510,7 +15332,7 @@ glabel var7f1a9184
/* f0419e4: 8fa40278 */ lw $a0,0x278($sp)
/* f0419e8: 8fa5027c */ lw $a1,0x27c($sp)
/* f0419ec: 8fa60268 */ lw $a2,0x268($sp)
/* f0419f0: 0fc0f8a7 */ jal func0f03e29c
/* f0419f0: 0fc0f8a7 */ jal chrCreateFireslot
/* f0419f4: afa80054 */ sw $t0,0x54($sp)
/* f0419f8: 93af026f */ lbu $t7,0x26f($sp)
/* f0419fc: 8fa80054 */ lw $t0,0x54($sp)
@ -17094,7 +16916,7 @@ glabel var7f1a9184
/* f0411ac: 8fa40278 */ lw $a0,0x278($sp)
/* f0411b0: 8fa5027c */ lw $a1,0x27c($sp)
/* f0411b4: 8fa60268 */ lw $a2,0x268($sp)
/* f0411b8: 0fc0f6a6 */ jal func0f03e29c
/* f0411b8: 0fc0f6a6 */ jal chrCreateFireslot
/* f0411bc: afa80054 */ sw $t0,0x54($sp)
/* f0411c0: 93aa026f */ lbu $t2,0x26f($sp)
/* f0411c4: 8fa80054 */ lw $t0,0x54($sp)

View File

@ -12259,15 +12259,15 @@ bool aiChrSetFiringInCutscene(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]);
struct coord sp2c = {0, 0, 0};
struct coord sp20 = {0, 0, 0};
struct coord from = {0, 0, 0};
struct coord to = {0, 0, 0};
if (chr && chr->weapons_held[0]) {
if (chr && chr->weapons_held[HAND_RIGHT]) {
if (cmd[3]) {
chrSetFiring(chr, 0, true);
func0f03e29c(chr, 0, 1, 0, &sp2c, &sp20);
chrSetFiring(chr, HAND_RIGHT, true);
chrCreateFireslot(chr, HAND_RIGHT, true, false, &from, &to);
} else {
chrSetFiring(chr, 0, false);
chrSetFiring(chr, HAND_RIGHT, false);
}
}

View File

@ -83,7 +83,7 @@ u32 var80070588 = 0x00000000;
u32 var8007058c = 0x00000000;
GLOBAL_ASM(
glabel func0f0abe70
glabel beamCreate
/* f0abe70: 27bdffe0 */ addiu $sp,$sp,-32
/* f0abe74: afbf0014 */ sw $ra,0x14($sp)
/* f0abe78: c4c40000 */ lwc1 $f4,0x0($a2)
@ -339,7 +339,7 @@ glabel func0f0ac138
.L0f0ac210:
/* f0ac210: afa40024 */ sw $a0,0x24($sp)
/* f0ac214: afa50060 */ sw $a1,0x60($sp)
/* f0ac218: 0fc2af9c */ jal func0f0abe70
/* f0ac218: 0fc2af9c */ jal beamCreate
/* f0ac21c: afa70018 */ sw $a3,0x18($sp)
/* f0ac220: 8fa40024 */ lw $a0,0x24($sp)
/* f0ac224: 3c08800a */ lui $t0,%hi(g_Vars)
@ -403,7 +403,7 @@ glabel func0f0ac138
/* f0ac2f8: 2401ffff */ addiu $at,$zero,-1
/* f0ac2fc: 54810008 */ bnel $a0,$at,.L0f0ac320
/* f0ac300: 2401ffff */ addiu $at,$zero,-1
/* f0ac304: 0fc29c3e */ jal bgun0f0a70f8
/* f0ac304: 0fc29c3e */ jal bgunAllocateFireslot
/* f0ac308: afa30028 */ sw $v1,0x28($sp)
/* f0ac30c: 8fa50020 */ lw $a1,0x20($sp)
/* f0ac310: 8fa30028 */ lw $v1,0x28($sp)
@ -486,7 +486,7 @@ glabel func0f0ac138
/* f0ac43c: 0019c900 */ sll $t9,$t9,0x4
/* f0ac440: 27290004 */ addiu $t1,$t9,0x4
/* f0ac444: 012a2021 */ addu $a0,$t1,$t2
/* f0ac448: 0fc2af9c */ jal func0f0abe70
/* f0ac448: 0fc2af9c */ jal beamCreate
/* f0ac44c: 8fa70018 */ lw $a3,0x18($sp)
/* f0ac450: 8fac0020 */ lw $t4,0x20($sp)
/* f0ac454: 3c0f800a */ lui $t7,%hi(g_Fireslots)

View File

@ -602,7 +602,7 @@ f32 gsetGetDamage(struct gset *gset)
return damage;
}
u8 gsetGetSingleUnk38(struct gset *gset)
u8 gsetGetFireslotDuration(struct gset *gset)
{
#if VERSION >= VERSION_PAL_FINAL
struct weaponfunc *func = gsetGetWeaponFunction(gset);

View File

@ -2270,7 +2270,7 @@ glabel var7f1ad5b4
/* f0b9498: 0fc22e3a */ jal weaponCreateForChr
/* f0b949c: afa90014 */ sw $t1,0x14($sp)
.L0f0b94a0:
/* f0b94a0: 0fc29c3e */ jal bgun0f0a70f8
/* f0b94a0: 0fc29c3e */ jal bgunAllocateFireslot
/* f0b94a4: 00000000 */ nop
/* f0b94a8: 8fa40110 */ lw $a0,0x110($sp)
/* f0b94ac: 24050000 */ addiu $a1,$zero,0x0
@ -2912,7 +2912,7 @@ glabel var7f1ad5b4
/* f0b7174: 0fc22844 */ jal weaponCreateForChr
/* f0b7178: afb80014 */ sw $t8,0x14($sp)
.NB0f0b717c:
/* f0b717c: 0fc2938f */ jal bgun0f0a70f8
/* f0b717c: 0fc2938f */ jal bgunAllocateFireslot
/* f0b7180: 00000000 */ sll $zero,$zero,0x0
/* f0b7184: 8fa40110 */ lw $a0,0x110($sp)
/* f0b7188: 24050000 */ addiu $a1,$zero,0x0
@ -14832,12 +14832,12 @@ s32 playerTickBeams(struct prop *prop)
if (prop->chr && g_Vars.mplayerisrunning) {
struct chrdata *chr = prop->chr;
if (chr->fireslot[0] >= 0) {
beamTick(&g_Fireslots[chr->fireslot[0]].beam);
if (chr->fireslots[0] >= 0) {
beamTick(&g_Fireslots[chr->fireslots[0]].beam);
}
if (chr->fireslot[1] >= 0) {
beamTick(&g_Fireslots[chr->fireslot[1]].beam);
if (chr->fireslots[1] >= 0) {
beamTick(&g_Fireslots[chr->fireslots[1]].beam);
}
}

View File

@ -46683,12 +46683,12 @@ Gfx *propsRenderBeams(Gfx *gdl)
gdl = func0f0acb90(gdl, chr->unk348[0]->beam, true, true);
gdl = func0f0acb90(gdl, chr->unk348[1]->beam, true, true);
} else {
if (chr->fireslot[0] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslot[0]].beam, true, false);
if (chr->fireslots[0] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslots[0]].beam, true, false);
}
if (chr->fireslot[1] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslot[1]].beam, true, false);
if (chr->fireslots[1] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslots[1]].beam, true, false);
}
}
} else if (prop->type == PROPTYPE_OBJ) {
@ -46705,12 +46705,12 @@ Gfx *propsRenderBeams(Gfx *gdl)
if (prop->chr && propGetPlayerNum(prop) != g_Vars.currentplayernum) {
struct chrdata *chr = prop->chr;
if (chr->fireslot[0] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslot[0]].beam, true, false);
if (chr->fireslots[0] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslots[0]].beam, true, false);
}
if (chr->fireslot[1] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslot[1]].beam, true, false);
if (chr->fireslots[1] >= 0) {
gdl = func0f0acb90(gdl, &g_Fireslots[chr->fireslots[1]].beam, true, false);
}
}
}
@ -69789,7 +69789,7 @@ glabel var7f1ab214
/* f091d64: 10000001 */ b .L0f091d6c
/* f091d68: 24050002 */ addiu $a1,$zero,0x2
.L0f091d6c:
/* f091d6c: 0fc2af9c */ jal func0f0abe70
/* f091d6c: 0fc2af9c */ jal beamCreate
/* f091d70: 27a701f0 */ addiu $a3,$sp,0x1f0
.L0f091d74:
/* f091d74: 8fbf0044 */ lw $ra,0x44($sp)
@ -70518,7 +70518,7 @@ glabel var7f1ab214
/* f091d64: 10000001 */ b .L0f091d6c
/* f091d68: 24050002 */ addiu $a1,$zero,0x2
.L0f091d6c:
/* f091d6c: 0fc2af9c */ jal func0f0abe70
/* f091d6c: 0fc2af9c */ jal beamCreate
/* f091d70: 27a701f0 */ addiu $a3,$sp,0x1f0
.L0f091d74:
/* f091d74: 8fbf0044 */ lw $ra,0x44($sp)

View File

@ -459,6 +459,7 @@
#define CHRH2FLAG_0004 0x0004
#define CHRH2FLAG_BLUESIGHT 0x0008
#define CHRH2FLAG_TICKDURINGAUTOCUT 0x0010
#define CHRH2FLAG_0020 0x0020
#define CHRH2FLAG_0040 0x0040
#define CHRH2FLAG_0080 0x0080
#define CHRH2FLAG_HEADSHOTTED 0x1000

View File

@ -134,9 +134,9 @@ u32 bgun0f0a5300(void);
void bgun0f0a5550(s32 handnum);
void bgunTickMaulerCharge(void);
void bgun0f0a6c30(void);
s32 bgun0f0a70f8(void);
s32 bgunAllocateFireslot(void);
void bgun0f0a7138(Gfx **gdl);
struct audiohandle **bgunNewAudioHandle(void);
struct audiohandle **bgunAllocateAudioHandle(void);
void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum);
void bgun0f0a8404(struct coord *pos, s16 *rooms, s32 arg2);
void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s16 *arg3);

View File

@ -134,7 +134,7 @@ void chrTickSidestep(struct chrdata *chr);
void chrTickJumpOut(struct chrdata *chr);
void chrTickStartAlarm(struct chrdata *chr);
void chrTickSurprised(struct chrdata *chr);
void func0f03e29c(struct chrdata *chr, s32 arg1, s32 arg2, s32 arg3, struct coord *arg4, struct coord *arg5);
void chrCreateFireslot(struct chrdata *chr, s32 handnum, bool withsound, bool withbeam, struct coord *from, struct coord *to);
f32 chrGetInverseTheta(struct chrdata *chr);
f32 chrGetAimAngle(struct chrdata *chr);
f32 func0f03e754(struct chrdata *chr);

View File

@ -4,7 +4,7 @@
#include "data.h"
#include "types.h"
u32 func0f0abe70(void);
void beamCreate(struct beam *beam, s32 weaponnum, struct coord *arg4, struct coord *arg5);
u32 func0f0ac138(void);
Gfx *func0f0ac4b8(Gfx *gdl, struct textureconfig *arg1, f32 arg2, struct coord *arg3, u32 colour1, f32 arg5, struct coord *arg6, u32 colour2);
Gfx *func0f0acb90(Gfx *gdl, struct beam *beam, bool arg2, u32 arg3);

View File

@ -29,7 +29,7 @@ struct inventory_ammo *gsetGetAmmoDefinition(struct gset *gset);
u8 gsetGetSingleUnk3c(struct gset *gset);
f32 gsetGetStrength(struct gset *gset);
f32 gsetGetDamage(struct gset *gset);
u8 gsetGetSingleUnk38(struct gset *gset);
u8 gsetGetFireslotDuration(struct gset *gset);
u16 gsetGetSingleShootSound(struct gset *gset);
bool gsetHasFunctionFlags(struct gset *gset, u32 flags);
s8 weaponGetNumTicksPerShot(u32 weaponnum, u32 funcindex);

View File

@ -1330,7 +1330,7 @@ struct chrdata {
/*0x168*/ f32 aimendback;
/*0x16c*/ f32 aimendsideback;
/*0x170*/ struct prop *weapons_held[3]; // gun 1, gun 2, hat
/*0x17c*/ s8 fireslot[2];
/*0x17c*/ s8 fireslots[2];
/*0x17e*/ s16 target; // index into g_Vars.props
/*0x180*/ f32 cshield;
@ -3722,7 +3722,7 @@ struct fireslotthing {
};
struct fireslot {
/*0x00*/ s32 unk00;
/*0x00*/ s32 endlvframe;
#if VERSION < VERSION_NTSC_1_0
struct audiohandle *unk04nb;
struct audiohandle *unk08nb;