Decompile rocketTickFbw

This commit is contained in:
Ryan Dwyer 2022-04-13 23:26:45 +10:00
parent b9f0c86dd2
commit 0d38d52b6c
7 changed files with 235 additions and 1422 deletions

View File

@ -12142,9 +12142,9 @@ void bgun0f09ed2c(struct defaultobj *obj, struct coord *newpos, Mtxf *arg2, stru
if (obj->hidden & OBJHFLAG_AIRBORNE) {
obj->projectile->flags |= PROJECTILEFLAG_00000080;
obj->projectile->pos.x = newpos->x;
obj->projectile->pos.y = newpos->y;
obj->projectile->pos.z = newpos->z;
obj->projectile->nextsteppos.x = newpos->x;
obj->projectile->nextsteppos.y = newpos->y;
obj->projectile->nextsteppos.z = newpos->z;
}
}
}
@ -12422,9 +12422,9 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
if (obj->hidden & OBJHFLAG_AIRBORNE) {
obj->projectile->flags |= PROJECTILEFLAG_00000080;
obj->projectile->pos.x = muzzlepos.x;
obj->projectile->pos.y = muzzlepos.y;
obj->projectile->pos.z = muzzlepos.z;
obj->projectile->nextsteppos.x = muzzlepos.x;
obj->projectile->nextsteppos.y = muzzlepos.y;
obj->projectile->nextsteppos.z = muzzlepos.z;
if (gset->weaponnum == WEAPON_GRENADE && gset->weaponfunc == FUNC_SECONDARY) {
obj->projectile->unk08c = 1.0f;
@ -12717,8 +12717,8 @@ void bgunCreateFiredProjectile(s32 handnum)
weapon->base.projectile->unk0a8 = weapon->base.prop->pos.y;
weapon->base.projectile->unk0ac = weapon->base.projectile->speed.y;
weapon->base.projectile->unk010 = sp250.x;
weapon->base.projectile->unk014 = sp250.y;
weapon->base.projectile->unk018 = sp250.z;
weapon->base.projectile->xrot = sp250.y;
weapon->base.projectile->yrot = sp250.z;
weapon->base.projectile->unk0b4 = TICKS(240);
weapon->base.projectile->unk08c = funcdef->unk5c;
weapon->base.projectile->unk098 = funcdef->unk50 * 1.6666666f;
@ -12793,8 +12793,8 @@ void bgunCreateFiredProjectile(s32 handnum)
weapon->base.projectile->unk0a8 = weapon->base.prop->pos.y;
weapon->base.projectile->unk0ac = weapon->base.projectile->speed.y;
weapon->base.projectile->unk010 = sp250.x;
weapon->base.projectile->unk014 = sp250.y;
weapon->base.projectile->unk018 = sp250.z;
weapon->base.projectile->xrot = sp250.y;
weapon->base.projectile->yrot = sp250.z;
weapon->base.projectile->unk0b4 = TICKS(240);
weapon->base.projectile->unk08c = funcdef->unk5c;
weapon->base.projectile->unk098 = funcdef->unk50 * 1.6666666f;

View File

@ -462,7 +462,7 @@ bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct co
i++;
}
projectile->unk105 = 0;
projectile->step = 0;
projectile->numwaypads = i;
return true;
@ -473,11 +473,12 @@ bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct co
}
/**
* Determine where to spawn a Slayer rocket in fly-by-wire mode.
* Populate pos with the position of the given pad
* for a Slayer rocket in fly-by-wire mode.
*
* It's the ground position of the pad plus 1.5 metres.
*/
void botactGetRocketSpawnPos(u16 padnum, struct coord *pos)
void botactGetRocketNextStepPos(u16 padnum, struct coord *pos)
{
struct pad pad;
s16 rooms[2];
@ -504,19 +505,19 @@ void botactCreateSlayerRocket(struct chrdata *chr)
Mtxf sp196;
Mtxf sp132;
struct coord sp120 = {0, 0, 0};
f32 a;
f32 b;
f32 yrot;
f32 xrot;
struct coord sp100;
a = chrGetAimAngle(chr);
b = func0f03e754(chr);
yrot = chrGetAimAngle(chr);
xrot = func0f03e754(chr);
sp100.x = cosf(b) * sinf(a);
sp100.y = sinf(b);
sp100.z = cosf(b) * cosf(a);
sp100.x = cosf(xrot) * sinf(yrot);
sp100.y = sinf(xrot);
sp100.z = cosf(xrot) * cosf(yrot);
mtx4LoadXRotation(b, &sp196);
mtx4LoadYRotation(a, &sp132);
mtx4LoadXRotation(xrot, &sp196);
mtx4LoadYRotation(yrot, &sp132);
mtx00015be0(&sp132, &sp196);
mtx4LoadIdentity(&sp260);
@ -526,9 +527,9 @@ void botactCreateSlayerRocket(struct chrdata *chr)
struct prop *target = chrGetTargetProp(chr);
rocket->timer240 = -1;
rocket->base.projectile->unk010 = 7.5;
rocket->base.projectile->unk014 = b;
rocket->base.projectile->unk018 = a;
rocket->base.projectile->unk0f4 = 0;
rocket->base.projectile->xrot = xrot;
rocket->base.projectile->yrot = yrot;
rocket->base.projectile->smoketimer240 = 0;
rocket->base.projectile->unk0b4 = 0x20000000;
// Fire rocket sound
@ -538,7 +539,7 @@ void botactCreateSlayerRocket(struct chrdata *chr)
if (!botactFindRocketRoute(chr, &chr->prop->pos, &target->pos, chr->prop->rooms, target->rooms, rocket->base.projectile)) {
rocket->timer240 = 0; // blow up rocket
} else {
botactGetRocketSpawnPos(rocket->base.projectile->waypads[0], &rocket->base.projectile->pos);
botactGetRocketNextStepPos(rocket->base.projectile->waypads[0], &rocket->base.projectile->nextsteppos);
chr->aibot->skrocket = rocket->base.prop;
}
}

View File

@ -4115,8 +4115,8 @@ void playerTick(bool arg0)
projectile->unk0b2 = 0xffff;
projectile->flags |= PROJECTILEFLAG_00004000;
projectile->unk018 = 0;
projectile->unk014 = 0;
projectile->yrot = 0;
projectile->xrot = 0;
projectile->unk010 = 0;
if ((projectile->flags & PROJECTILEFLAG_00000080) == 0) {

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@ s32 botactGetWeaponByAmmoType(s32 ammotype);
void botact0f19a37c(struct chrdata *chr);
s32 botactGetShootInterval60(s32 weaponnum, s32 funcnum);
bool botactFindRocketRoute(struct chrdata *chr, struct coord *frompos, struct coord *topos, s16 *fromrooms, s16 *torooms, struct projectile *projectile);
void botactGetRocketSpawnPos(u16 padnum, struct coord *pos);
void botactGetRocketNextStepPos(u16 padnum, struct coord *pos);
void botactCreateSlayerRocket(struct chrdata *chr);
#endif

View File

@ -155,7 +155,7 @@ void hovercarIncrementStep(struct hovercarobj *hovercar);
f32 objCollide(struct defaultobj *obj, struct coord *arg1, f32 arg2);
void hoverbikeUpdateMovement(struct hoverbikeobj *hoverbike, f32 arg1, f32 arg2, f32 arg3);
void platformDisplaceProps2(struct prop *platform, Mtxf *arg1);
u32 func0f073478(void);
bool rocketTickFbw(struct weaponobj *rocket);
s32 func0f073ae8(struct defaultobj *obj, struct projectile *projectile, struct coord *arg2, struct coord *arg3);
s32 func0f073c6c(struct defaultobj *obj, bool *arg1);
void doorTick(struct prop *doorprop);

View File

@ -1466,8 +1466,8 @@ struct projectile {
/*0x000*/ u32 flags;
/*0x004*/ struct coord speed; // distance moved in last tick
/*0x010*/ f32 unk010;
/*0x014*/ f32 unk014;
/*0x018*/ f32 unk018;
/*0x014*/ f32 xrot;
/*0x018*/ f32 yrot;
/*0x01c*/ f32 unk01c;
/*0x020*/ Mtxf unk020;
/*0x060*/ f32 unk060;
@ -1496,8 +1496,8 @@ struct projectile {
/*0x0b8*/ f32 unk0b8;
/*0x0bc*/ f32 unk0bc;
/*0x0c0*/ f32 unk0c0;
/*0x0c4*/ struct coord pos;
/*0x0d0*/ u32 unk0d0;
/*0x0c4*/ struct coord nextsteppos;
/*0x0d0*/ s32 losttimer240;
/*0x0d4*/ struct defaultobj *obj;
/*0x0d8*/ s32 unk0d8;
/*0x0dc*/ f32 unk0dc;
@ -1506,10 +1506,10 @@ struct projectile {
/*0x0e8*/ struct prop *targetprop; // for homing rockets
/*0x0ec*/ f32 unk0ec;
/*0x0f0*/ f32 unk0f0;
/*0x0f4*/ u32 unk0f4;
/*0x0f4*/ s32 smoketimer240;
/*0x0f8*/ s16 waypads[6];
/*0x104*/ u8 numwaypads;
/*0x105*/ u8 unk105;
/*0x105*/ u8 step;
/*0x108*/ struct prop *unk108;
};