Decompile bgunCreateThrownProjectile

This commit is contained in:
Ryan Dwyer 2022-04-03 12:06:52 +10:00
parent cfbc5f2e6c
commit bf9aa0911e
8 changed files with 315 additions and 1148 deletions

File diff suppressed because it is too large Load Diff

View File

@ -367,7 +367,7 @@ void botact0f19a37c(struct chrdata *chr)
}
}
func0f04031c(&prop->pos, 16.666666f, &sp56, &sp152);
chrCalculateTrajectory(&prop->pos, 16.666666f, &sp56, &sp152);
} else {
// These numbers are about 2 billionths away from BADDEG2RAD(20),
// but tweaking the multiplier in BADDEG2RAD doesn't make this match
@ -396,7 +396,7 @@ void botact0f19a37c(struct chrdata *chr)
mtx4LoadYRotation(sp80, &sp84);
mtx00015be0(&sp84, &sp164);
bgun0f09ee18(chr, &gset, &prop->pos, prop->rooms, &sp164, &sp228);
bgunCreateThrownProjectile2(chr, &gset, &prop->pos, prop->rooms, &sp164, &sp228);
if (gset.weaponnum == WEAPON_REMOTEMINE) {
chr->aibot->unk064 |= 0x1000;

View File

@ -10514,10 +10514,9 @@ void chrCalculateShieldHit(struct chrdata *chr, struct coord *pos, struct coord
}
/**
* Sets the speed and trajectory for some thrown items. Specifically, for bots
* throwing grenades, and maybe other things.
* Calculates the trajectory for thrown items.
*/
void func0f04031c(struct coord *frompos, f32 arg1, struct coord *aimpos, struct coord *arg3)
void chrCalculateTrajectory(struct coord *frompos, f32 arg1, struct coord *aimpos, struct coord *arg3)
{
f32 xvel;
f32 yvel;
@ -11323,7 +11322,7 @@ glabel var7f1a90e0
/* f040ef0: c57200b4 */ lwc1 $f18,0xb4($t3)
/* f040ef4: e7b200bc */ swc1 $f18,0xbc($sp)
/* f040ef8: c5440010 */ lwc1 $f4,0x10($t2)
/* f040efc: 0fc100c7 */ jal func0f04031c
/* f040efc: 0fc100c7 */ jal chrCalculateTrajectory
/* f040f00: e7a400c0 */ swc1 $f4,0xc0($sp)
/* f040f04: 1000001c */ b .L0f040f78
/* f040f08: 24030001 */ addiu $v1,$zero,0x1
@ -11355,7 +11354,7 @@ glabel var7f1a90e0
/* f040f64: 46085481 */ sub.s $f18,$f10,$f8
/* f040f68: e7b200bc */ swc1 $f18,0xbc($sp)
.L0f040f6c:
/* f040f6c: 0fc100c7 */ jal func0f04031c
/* f040f6c: 0fc100c7 */ jal chrCalculateTrajectory
/* f040f70: 8fa500cc */ lw $a1,0xcc($sp)
/* f040f74: 24030001 */ addiu $v1,$zero,0x1
.L0f040f78:
@ -12913,7 +12912,7 @@ glabel var7f1a9184
/* f041074: c57200b4 */ lwc1 $f18,0xb4($t3)
/* f041078: e7b200bc */ swc1 $f18,0xbc($sp)
/* f04107c: c5440010 */ lwc1 $f4,0x10($t2)
/* f041080: 0fc10128 */ jal func0f04031c
/* f041080: 0fc10128 */ jal chrCalculateTrajectory
/* f041084: e7a400c0 */ swc1 $f4,0xc0($sp)
/* f041088: 1000001c */ b .PF0f0410fc
/* f04108c: 24030001 */ li $v1,0x1
@ -12945,7 +12944,7 @@ glabel var7f1a9184
/* f0410e8: 46085481 */ sub.s $f18,$f10,$f8
/* f0410ec: e7b200bc */ swc1 $f18,0xbc($sp)
.PF0f0410f0:
/* f0410f0: 0fc10128 */ jal func0f04031c
/* f0410f0: 0fc10128 */ jal chrCalculateTrajectory
/* f0410f4: 8fa500cc */ lw $a1,0xcc($sp)
/* f0410f8: 24030001 */ li $v1,0x1
.PF0f0410fc:
@ -14511,7 +14510,7 @@ glabel var7f1a9184
/* f041000: c57200b4 */ lwc1 $f18,0xb4($t3)
/* f041004: e7b200bc */ swc1 $f18,0xbc($sp)
/* f041008: c5440010 */ lwc1 $f4,0x10($t2)
/* f04100c: 0fc1010b */ jal func0f04031c
/* f04100c: 0fc1010b */ jal chrCalculateTrajectory
/* f041010: e7a400c0 */ swc1 $f4,0xc0($sp)
/* f041014: 1000001c */ b .PB0f041088
/* f041018: 24030001 */ li $v1,0x1
@ -14543,7 +14542,7 @@ glabel var7f1a9184
/* f041074: 46085481 */ sub.s $f18,$f10,$f8
/* f041078: e7b200bc */ swc1 $f18,0xbc($sp)
.PB0f04107c:
/* f04107c: 0fc1010b */ jal func0f04031c
/* f04107c: 0fc1010b */ jal chrCalculateTrajectory
/* f041080: 8fa500cc */ lw $a1,0xcc($sp)
/* f041084: 24030001 */ li $v1,0x1
.PB0f041088:
@ -16109,7 +16108,7 @@ glabel var7f1a9184
/* f040ef0: c57200b4 */ lwc1 $f18,0xb4($t3)
/* f040ef4: e7b200bc */ swc1 $f18,0xbc($sp)
/* f040ef8: c5440010 */ lwc1 $f4,0x10($t2)
/* f040efc: 0fc100c7 */ jal func0f04031c
/* f040efc: 0fc100c7 */ jal chrCalculateTrajectory
/* f040f00: e7a400c0 */ swc1 $f4,0xc0($sp)
/* f040f04: 1000001c */ b .L0f040f78
/* f040f08: 24030001 */ addiu $v1,$zero,0x1
@ -16141,7 +16140,7 @@ glabel var7f1a9184
/* f040f64: 46085481 */ sub.s $f18,$f10,$f8
/* f040f68: e7b200bc */ swc1 $f18,0xbc($sp)
.L0f040f6c:
/* f040f6c: 0fc100c7 */ jal func0f04031c
/* f040f6c: 0fc100c7 */ jal chrCalculateTrajectory
/* f040f70: 8fa500cc */ lw $a1,0xcc($sp)
/* f040f74: 24030001 */ addiu $v1,$zero,0x1
.L0f040f78:
@ -17699,7 +17698,7 @@ glabel var7f1a9184
/* f0406d0: c57200b4 */ lwc1 $f18,0xb4($t3)
/* f0406d4: e7b200bc */ swc1 $f18,0xbc($sp)
/* f0406d8: c5440010 */ lwc1 $f4,0x10($t2)
/* f0406dc: 0fc0febf */ jal func0f04031c
/* f0406dc: 0fc0febf */ jal chrCalculateTrajectory
/* f0406e0: e7a400c0 */ swc1 $f4,0xc0($sp)
/* f0406e4: 1000001c */ beqz $zero,.NB0f040758
/* f0406e8: 24030001 */ addiu $v1,$zero,0x1
@ -17731,7 +17730,7 @@ glabel var7f1a9184
/* f040744: 46085481 */ sub.s $f18,$f10,$f8
/* f040748: e7b200bc */ swc1 $f18,0xbc($sp)
.NB0f04074c:
/* f04074c: 0fc0febf */ jal func0f04031c
/* f04074c: 0fc0febf */ jal chrCalculateTrajectory
/* f040750: 8fa500cc */ lw $a1,0xcc($sp)
/* f040754: 24030001 */ addiu $v1,$zero,0x1
.NB0f040758:
@ -18800,7 +18799,7 @@ glabel var7f1a9184
// aimpos.y = targetprop->chr->manground;
// aimpos.z = targetprop->pos.z;
//
// func0f04031c(&gunpos, spcc, &aimpos, &vector);
// chrCalculateTrajectory(&gunpos, spcc, &aimpos, &vector);
// hasaimpos = true;
// }
// } else if ((gset.weaponnum == WEAPON_DEVASTATOR && gset.weaponfunc == FUNC_SECONDARY)
@ -18814,7 +18813,7 @@ glabel var7f1a9184
// aimpos.y -= 25;
// }
//
// func0f04031c(&gunpos, spcc, &aimpos, &vector);
// chrCalculateTrajectory(&gunpos, spcc, &aimpos, &vector);
// hasaimpos = true;
// }
//

View File

@ -2367,7 +2367,7 @@ struct weaponfunc_throw invfunc_laptopgun_deploy = {
-1, // unk07
&invnoisesettings_00010fd0,
NULL, // fire animation
FUNCFLAG_NOAUTOAIM | FUNCFLAG_STICKTOWALL | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_DISCARDWEAPON | FUNCFLAG_00800000,
FUNCFLAG_NOAUTOAIM | FUNCFLAG_STICKTOWALL | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_DISCARDWEAPON | FUNCFLAG_CALCULATETRAJECTORY,
0x00000157,
240, // activatetime60
60, // recoverytime60
@ -3062,7 +3062,7 @@ struct weaponfunc_throw invfunc_timedmine_throw = {
0, // unk07
&invnoisesettings_00010fd0,
invanim_mine_throw, // fire animation
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
0x00000113,
240, // activatetime60
0, // recoverytime60
@ -3138,7 +3138,7 @@ struct weaponfunc_throw invfunc_remotemine_throw = {
0, // unk07
&invnoisesettings_00010fd0,
invanim_remotemine_throw, // fire animation
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
0x00000115,
240, // activatetime60
0, // recoverytime60
@ -3207,7 +3207,7 @@ struct weaponfunc_throw invfunc_proxymine_throw = {
0, // unk07
&invnoisesettings_00010fd0,
invanim_mine_throw, // fire animation
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
0x00000114,
240, // activatetime60
0, // recoverytime60
@ -3270,7 +3270,7 @@ struct weaponfunc_throw invfunc_ecmmine_throw = {
0, // unk07
&invnoisesettings_00010fd0,
invanim_ecmmine_throw, // fire animation
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
0x00000116,
240, // activatetime60
60, // recoverytime60
@ -3643,7 +3643,7 @@ struct weaponfunc_shootprojectile invfunc_crossbow_lethal = {
0, // unk07
&invnoisesettings_00010fe4,
invanim_crossbow_shoot, // fire animation
FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
NULL,
0,
100, // damage
@ -3674,7 +3674,7 @@ struct weaponfunc_shootprojectile invfunc_crossbow_shoot = {
0, // unk07
&invnoisesettings_00010fe4,
invanim_crossbow_shoot, // fire animation
FUNCFLAG_MAKEDIZZY | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_MAKEDIZZY | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
NULL,
0,
1, // damage
@ -4861,7 +4861,7 @@ struct weaponfunc_throw invfunc_combatknife_throw = {
0, // unk07
&invnoisesettings_00010fd0,
invanim_combatknife_throw, // fire animation
FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
0x0000010f,
240, // activatetime60
60, // recoverytime60
@ -4908,7 +4908,7 @@ struct weaponfunc_throw invfunc_bug_throw = {
0, // unk07
&invnoisesettings_00010fd0,
NULL, // fire animation
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
0x00000012,
240, // activatetime60
60, // recoverytime60
@ -4922,7 +4922,7 @@ struct weaponfunc_throw invfunc_targetamplifier_throw = {
0, // unk07
&invnoisesettings_00010fd0,
NULL, // fire animation
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_00800000,
FUNCFLAG_NOAUTOAIM | FUNCFLAG_NOMUZZLEFLASH | FUNCFLAG_CALCULATETRAJECTORY,
0x000001b1,
240, // activatetime60
60, // recoverytime60

View File

@ -969,7 +969,7 @@
#define FUNCFLAG_AUTOSWITCHUNSELECTABLE 0x00100000
#define FUNCFLAG_PSYCHOSIS 0x00200000
#define FUNCFLAG_00400000 0x00400000 // punch, disarm and pistol whip
#define FUNCFLAG_00800000 0x00800000 // mostly throwables but some projectiles too
#define FUNCFLAG_CALCULATETRAJECTORY 0x00800000 // throwables will land on crosshair
#define FUNCFLAG_08000000 0x08000000 // rockets
#define FUNCFLAG_10000000 0x10000000 // grenade launchers
#define FUNCFLAG_20000000 0x20000000 // explosives related
@ -3042,6 +3042,7 @@
#define OBJHFLAG_REAPABLE 0x00000004
#define OBJHFLAG_ISRETICK 0x00000008
#define OBJHFLAG_TAGGED 0x00000010
#define OBJHFLAG_00000020 0x00000020 // thrown knife
#define OBJHFLAG_00000040 0x00000040
#define OBJHFLAG_AIRBORNE 0x00000080
#define OBJHFLAG_00000100 0x00000100

View File

@ -73,9 +73,9 @@ void bgunTickIncLoad(void);
void bgunTickLoad(void);
bool bgun0f09eae4(void);
struct modelfiledata *bgun0f09ebbc(void);
void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, s16 *rooms, Mtxf *matrix1, struct coord *arg4, Mtxf *matrix2, struct prop *prop, struct coord *pos);
void bgun0f09ed2c(struct defaultobj *obj, struct coord *coord, Mtxf *arg2, struct coord *arg3, Mtxf *arg4);
struct defaultobj *bgun0f09ee18(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *arg5);
void bgun0f09ebcc(struct defaultobj *obj, struct coord *coord, s16 *rooms, Mtxf *matrix1, struct coord *velocity, Mtxf *matrix2, struct prop *prop, struct coord *pos);
void bgun0f09ed2c(struct defaultobj *obj, struct coord *coord, Mtxf *arg2, struct coord *velocity, Mtxf *arg4);
struct defaultobj *bgunCreateThrownProjectile2(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *velocity);
void bgunCreateThrownProjectile(s32 handnum, struct gset *gset);
void bgunUpdateHeldRocket(s32 handnum);
void bgunCreateHeldRocket(s32 handnum, struct weaponfunc_shootprojectile *func);

View File

@ -145,7 +145,7 @@ f32 chrGetAimLimitAngle(f32 sqdist);
void chrCalculateHit(struct chrdata *chr, bool *angleokptr, bool *hit, struct gset *gset);
bool chrGetGunPos(struct chrdata *chr, s32 handnum, struct coord *gunpos);
void chrCalculateShieldHit(struct chrdata *chr, struct coord *pos, struct coord *vector, struct modelnode **node, s32 *hitpart, struct model **model, s32 *side);
void func0f04031c(struct coord *frompos, f32 arg1, struct coord *aimpos, struct coord *arg3);
void chrCalculateTrajectory(struct coord *frompos, f32 arg1, struct coord *aimpos, struct coord *arg3);
void chrShoot(struct chrdata *chr, s32 handnum);
void func0f041a74(struct chrdata *chr);
bool func0f041c44(struct chrdata *chr);

View File

@ -2392,7 +2392,7 @@ struct hand {
/*0x0cf0*/ struct coord dotpos;
/*0x0cfc*/ struct coord dotrot;
/*0x0d08*/ f32 gangstarot; // frac
/*0x0d0c*/ s16 primetimer;
/*0x0d0c*/ s16 primetimer60;
/*0x0d0e*/ u8 unk0d0e_00 : 4;
/*0x0d0e*/ u8 unk0d0e_04 : 3;
/*0x0d0e*/ u8 unk0d0e_07 : 1;