Set names for a heap of shotdata symbols

This commit is contained in:
Ryan Dwyer 2023-08-26 22:28:40 +10:00
parent 79a94b29ce
commit 0b1aabf345
15 changed files with 454 additions and 436 deletions

View File

@ -3790,9 +3790,9 @@ bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2,
lowestsqdist = sqdist;
hitthing->unk00.x = sp8c.x;
hitthing->unk00.y = sp8c.y;
hitthing->unk00.z = sp8c.z;
hitthing->pos.x = sp8c.x;
hitthing->pos.y = sp8c.y;
hitthing->pos.z = sp8c.z;
hitthing->unk0c.x = sp80.x;
hitthing->unk0c.y = sp80.y;
hitthing->unk0c.z = sp80.z;
@ -4068,9 +4068,9 @@ bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2,
*sqdistptr = sqdist;
hitthing->unk00.x = sp84.x;
hitthing->unk00.y = sp84.y;
hitthing->unk00.z = sp84.z;
hitthing->pos.x = sp84.x;
hitthing->pos.y = sp84.y;
hitthing->pos.z = sp84.z;
hitthing->unk0c.x = sp78.x;
hitthing->unk0c.y = sp78.y;
hitthing->unk0c.z = sp78.z;
@ -4292,9 +4292,9 @@ bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *a
if (hit) {
lowestsqdist = sqdist;
hitthing->unk00.x = spb0.x;
hitthing->unk00.y = spb0.y;
hitthing->unk00.z = spb0.z;
hitthing->pos.x = spb0.x;
hitthing->pos.y = spb0.y;
hitthing->pos.z = spb0.z;
hitthing->unk0c.x = spa4.x;
hitthing->unk0c.y = spa4.y;
hitthing->unk0c.z = spa4.z;
@ -4469,20 +4469,20 @@ bool bgTestHitInRoom(struct coord *frompos, struct coord *topos, s32 roomnum, st
numbatches = g_Rooms[roomnum].numvtxbatches;
for (i = 0; i < numbatches; batch++, i++) {
j = bg0f1612e4(&batch->bbmin, &batch->bbmax, &from, &dist, &sp94, &hitthing->unk00);
j = bg0f1612e4(&batch->bbmin, &batch->bbmax, &from, &dist, &sp94, &hitthing->pos);
if (j == 0) {
continue;
}
if (j == 1) {
f0 = from.x - hitthing->unk00.x;
f0 = from.x - hitthing->pos.x;
f20 = f0 * f0;
f0 = from.y - hitthing->unk00.y;
f0 = from.y - hitthing->pos.y;
f20 += f0 * f0;
f0 = from.z - hitthing->unk00.z;
f0 = from.z - hitthing->pos.z;
f20 += f0 * f0;
} else {
f20 = -1.0f;
@ -4512,13 +4512,13 @@ bool bgTestHitInRoom(struct coord *frompos, struct coord *topos, s32 roomnum, st
for (j = 0; j < ARRAYCOUNT(var800a6538); j++) {
if (bgTestHitInVtxBatch(&from, &to, &dist, &g_Rooms[roomnum].vtxbatches[var800a6538[j].vtxbatchindex], roomnum, hitthing)) {
f0 = from.x - hitthing->unk00.x;
f0 = from.x - hitthing->pos.x;
f2 = f0 * f0;
f0 = from.y - hitthing->unk00.y;
f0 = from.y - hitthing->pos.y;
f2 += f0 * f0;
f0 = from.z - hitthing->unk00.z;
f0 = from.z - hitthing->pos.z;
f2 += f0 * f0;
if (count == 0) {
@ -4564,31 +4564,31 @@ bool bgTestHitInRoom(struct coord *frompos, struct coord *topos, s32 roomnum, st
i++;
if (i < count) {
f0 = from.x - hitthing->unk00.x;
f0 = from.x - hitthing->pos.x;
spc8 = f0 * f0;
f0 = from.y - hitthing->unk00.y;
f0 = from.y - hitthing->pos.y;
spc8 += f0 * f0;
f0 = from.z - hitthing->unk00.z;
f0 = from.z - hitthing->pos.z;
spc8 += f0 * f0;
for (; i < count; i++) {
if (var800a6538[i].unk04 <= spc8) {
if (bgTestHitInVtxBatch(&from, &to, &dist, &batch[var800a6538[i].vtxbatchindex], roomnum, &sp60)) {
f0 = from.f[0] - sp60.unk00.f[0];
f0 = from.f[0] - sp60.pos.f[0];
f20 = f0 * f0;
f0 = from.f[1] - sp60.unk00.f[1];
f0 = from.f[1] - sp60.pos.f[1];
f20 += f0 * f0;
f0 = from.f[2] - sp60.unk00.f[2];
f0 = from.f[2] - sp60.pos.f[2];
f20 += f0 * f0;
if (f20 < spc8) {
hitthing->unk00.x = sp60.unk00.x;
hitthing->unk00.y = sp60.unk00.y;
hitthing->unk00.z = sp60.unk00.z;
hitthing->pos.x = sp60.pos.x;
hitthing->pos.y = sp60.pos.y;
hitthing->pos.z = sp60.pos.z;
hitthing->unk0c.x = sp60.unk0c.x;
hitthing->unk0c.y = sp60.unk0c.y;
hitthing->unk0c.z = sp60.unk0c.z;

View File

@ -4447,8 +4447,8 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
{
struct coord velocity = {0, 0, 0};
Mtxf sp1f4;
struct coord sp1e8;
struct coord sp1dc;
struct coord gunpos;
struct coord gundir;
struct prop *playerprop = g_Vars.currentplayer->prop;
struct coord *prevpos = &g_Vars.currentplayer->bondprevpos;
struct coord *extrapos = &g_Vars.currentplayer->bondextrapos;
@ -4520,17 +4520,17 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
playerSetPerimEnabled(playerprop, true);
bgunCalculatePlayerShotSpread(&sp1e8, &sp1dc, handnum, true);
mtx4RotateVecInPlace(camGetProjectionMtxF(), &sp1dc);
bgunCalculatePlayerShotSpread(&gunpos, &gundir, handnum, true);
mtx4RotateVecInPlace(camGetProjectionMtxF(), &gundir);
if (droppinggrenade) {
// Dropping a grenade because player is in an nbomb storm
velocity.x = sp1dc.x * 1.6666666f;
velocity.y = sp1dc.y * 1.6666666f;
velocity.z = sp1dc.z * 1.6666666f;
velocity.x = gundir.x * 1.6666666f;
velocity.y = gundir.y * 1.6666666f;
velocity.z = gundir.z * 1.6666666f;
} else if (gsetHasFunctionFlags(&hand->gset, FUNCFLAG_CALCULATETRAJECTORY)) {
// Calculate the velocity based on the trajectory to the aimpos
func0f061d54(0, 0, 0);
propFindAimingAt(HAND_RIGHT, false, FINDPROPCONTEXT_QUERY);
if (hand->hasdotinfo) {
aimpos.x = hand->dotpos.x;
@ -4539,11 +4539,11 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
chrCalculateTrajectory(&spawnpos, 21.666666f, &aimpos, &sp140);
radians = acosf(sp1dc.f[0] * sp140.f[0] + sp1dc.f[1] * sp140.f[1] + sp1dc.f[2] * sp140.f[2]);
radians = acosf(gundir.f[0] * sp140.f[0] + gundir.f[1] * sp140.f[1] + gundir.f[2] * sp140.f[2]);
// Check within 20 degrees
if (radians > 0.34901026f || radians < -0.34901026f) {
mtx00016b58(&spf8, 0, 0, 0, sp1dc.x, sp1dc.y, sp1dc.z, 0, 1, 0);
mtx00016b58(&spf8, 0, 0, 0, gundir.x, gundir.y, gundir.z, 0, 1, 0);
mtx00016b58(&spb8, 0, 0, 0, sp140.x, sp140.y, sp140.z, 0, 1, 0);
quaternion0f097044(&spf8, sp68);
@ -4559,24 +4559,24 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset)
quaternionSlerp(sp68, sp58, frac, sp48);
quaternionToMtx(sp48, &sp78);
sp1dc.x = -sp78.m[2][0];
sp1dc.y = -sp78.m[2][1];
sp1dc.z = -sp78.m[2][2];
gundir.x = -sp78.m[2][0];
gundir.y = -sp78.m[2][1];
gundir.z = -sp78.m[2][2];
} else {
sp1dc.x = sp140.x;
sp1dc.y = sp140.y;
sp1dc.z = sp140.z;
gundir.x = sp140.x;
gundir.y = sp140.y;
gundir.z = sp140.z;
}
}
velocity.x = sp1dc.x * 21.666666f;
velocity.y = sp1dc.y * 21.666666f;
velocity.z = sp1dc.z * 21.666666f;
velocity.x = gundir.x * 21.666666f;
velocity.y = gundir.y * 21.666666f;
velocity.z = gundir.z * 21.666666f;
} else {
// Simple velocity
velocity.x = sp1dc.x * 16.666666f;
velocity.y = sp1dc.y * 16.666666f;
velocity.z = sp1dc.z * 16.666666f;
velocity.x = gundir.x * 16.666666f;
velocity.y = gundir.y * 16.666666f;
velocity.z = gundir.z * 16.666666f;
if (gset->weaponnum == WEAPON_GRENADE || gset->weaponnum == WEAPON_NBOMB) {
velocity.y += 1.6666666f;
@ -4722,8 +4722,8 @@ void bgunCreateFiredProjectile(s32 handnum)
f32 sp25c;
struct coord sp250;
Mtxf sp210;
struct coord sp204;
struct coord sp1f8;
struct coord gunpos;
struct coord gundir;
struct prop *playerprop;
struct coord *prevpos;
struct coord *extrapos;
@ -4757,24 +4757,24 @@ void bgunCreateFiredProjectile(s32 handnum)
funcdef = (struct weaponfunc_shootprojectile *)tmp;
mtx4LoadIdentity(&sp270);
bgunCalculatePlayerShotSpread(&sp204, &sp1f8, handnum, true);
mtx4RotateVecInPlace(camGetProjectionMtxF(), &sp1f8);
bgunCalculatePlayerShotSpread(&gunpos, &gundir, handnum, true);
mtx4RotateVecInPlace(camGetProjectionMtxF(), &gundir);
spawnpos.x = hand->muzzlepos.x;
spawnpos.y = hand->muzzlepos.y;
spawnpos.z = hand->muzzlepos.z;
if (hand->gset.weaponnum == WEAPON_SLAYER && hand->gset.weaponfunc == FUNC_SECONDARY) {
spawnpos.x += 50.0f * sp1f8.x;
spawnpos.y += 50.0f * sp1f8.y;
spawnpos.z += 50.0f * sp1f8.z;
spawnpos.x += 50.0f * gundir.x;
spawnpos.y += 50.0f * gundir.y;
spawnpos.z += 50.0f * gundir.z;
}
sp260 = funcdef->speed * 1.6666666f / 60.0f;
sp25c = funcdef->traveldist * 1.6666666f;
if (gsetHasFunctionFlags(&hand->gset, FUNCFLAG_CALCULATETRAJECTORY)) {
func0f061d54(0, 0, 0);
propFindAimingAt(HAND_RIGHT, false, FINDPROPCONTEXT_QUERY);
if (hand->hasdotinfo) {
aimpos.x = hand->dotpos.x;
@ -4783,10 +4783,10 @@ void bgunCreateFiredProjectile(s32 handnum)
chrCalculateTrajectory(&spawnpos, sp25c, &aimpos, &sp1bc);
radians = acosf(sp1f8.f[0] * sp1bc.f[0] + sp1f8.f[1] * sp1bc.f[1] + sp1f8.f[2] * sp1bc.f[2]);
radians = acosf(gundir.f[0] * sp1bc.f[0] + gundir.f[1] * sp1bc.f[1] + gundir.f[2] * sp1bc.f[2]);
if (radians > 0.17450513f || radians < -0.17450513f) {
mtx00016b58(&sp174, 0.0f, 0.0f, 0.0f, sp1f8.x, sp1f8.y, sp1f8.z, 0.0f, 1.0f, 0.0f);
mtx00016b58(&sp174, 0.0f, 0.0f, 0.0f, gundir.x, gundir.y, gundir.z, 0.0f, 1.0f, 0.0f);
mtx00016b58(&sp134, 0.0f, 0.0f, 0.0f, sp1bc.x, sp1bc.y, sp1bc.z, 0.0f, 1.0f, 0.0f);
quaternion0f097044(&sp174, spe4);
@ -4802,24 +4802,24 @@ void bgunCreateFiredProjectile(s32 handnum)
quaternionSlerp(spe4, spd4, frac, spc4);
quaternionToMtx(spc4, &spf4);
sp1f8.x = -spf4.m[2][0];
sp1f8.y = -spf4.m[2][1];
sp1f8.z = -spf4.m[2][2];
gundir.x = -spf4.m[2][0];
gundir.y = -spf4.m[2][1];
gundir.z = -spf4.m[2][2];
} else {
sp1f8.x = sp1bc.x;
sp1f8.y = sp1bc.y;
sp1f8.z = sp1bc.z;
gundir.x = sp1bc.x;
gundir.y = sp1bc.y;
gundir.z = sp1bc.z;
}
}
}
sp250.x = sp1f8.x * sp260;
sp250.y = sp1f8.y * sp260;
sp250.z = sp1f8.z * sp260;
sp250.x = gundir.x * sp260;
sp250.y = gundir.y * sp260;
sp250.z = gundir.z * sp260;
sp264.x = sp250.f[0] * g_Vars.lvupdate60freal + sp1f8.f[0] * sp25c;
sp264.y = sp250.f[1] * g_Vars.lvupdate60freal + sp1f8.f[1] * sp25c;
sp264.z = sp250.f[2] * g_Vars.lvupdate60freal + sp1f8.f[2] * sp25c;
sp264.x = sp250.f[0] * g_Vars.lvupdate60freal + gundir.f[0] * sp25c;
sp264.y = sp250.f[1] * g_Vars.lvupdate60freal + gundir.f[1] * sp25c;
sp264.z = sp250.f[2] * g_Vars.lvupdate60freal + gundir.f[2] * sp25c;
if ((funcdef->base.base.flags & FUNCFLAG_FLYBYWIRE) == 0 && g_Vars.lvupdate240 > 0) {
sp264.x += (playerprop->pos.x - prevpos->x + extrapos->x) / g_Vars.lvupdate60freal;
@ -5236,7 +5236,7 @@ void bgun0f0a0c44(s32 handnum, struct coord *arg1, struct coord *arg2)
cam0f0b4c3c(g_Vars.currentplayer->hands[handnum].crosspos, arg2, 1);
}
void bgunCalculatePlayerShotSpread(struct coord *arg0, struct coord *arg1, s32 handnum, bool dorandom)
void bgunCalculatePlayerShotSpread(struct coord *gunpos2d, struct coord *gundir2d, s32 handnum, bool dorandom)
{
f32 crosspos[2];
f32 spread = 0;
@ -5250,7 +5250,6 @@ void bgunCalculatePlayerShotSpread(struct coord *arg0, struct coord *arg1, s32 h
spread = shootfunc->spread;
}
// Unsure what this is
if (weaponHasAimFlag(bgunGetWeaponNum2(handnum), INVAIMFLAG_ACCURATESINGLESHOT)
&& player->hands[handnum].burstbullets == 1) {
spread *= 0.25f;
@ -5286,11 +5285,11 @@ void bgunCalculatePlayerShotSpread(struct coord *arg0, struct coord *arg1, s32 h
crosspos[1] = player->crosspos[1] + (randfactor * scaledspread * camGetScreenHeight())
/ viGetHeight();
arg0->x = 0;
arg0->y = 0;
arg0->z = 0;
gunpos2d->x = 0;
gunpos2d->y = 0;
gunpos2d->z = 0;
cam0f0b4c3c(crosspos, arg1, 1);
cam0f0b4c3c(crosspos, gundir2d, 1);
}
void bgunCalculateBotShotSpread(struct coord *arg0, s32 weaponnum, s32 funcnum, bool arg3, s32 crouchpos, bool dual)

View File

@ -259,7 +259,7 @@ bool botactShootFarsight(struct chrdata *chr, s32 arg1, struct coord *vector, st
// chance of passing.
if (oppchr != chr
&& value > rand
&& func0f06b39c(arg3, vector, &oppprop->pos, chr0f0278a4(oppchr))) {
&& func0f06b39c(arg3, vector, &oppprop->pos, chrGetHitRadius(oppchr))) {
bgunPlayPropHitSound(&gset, oppprop, -1);
if (oppchr->model && chrGetShield(oppchr) > 0) {

View File

@ -105,7 +105,7 @@ void camSetScale(void)
player->c_cameraleftnorm.z = -fVar5 * fVar4;
}
void cam0f0b4c3c(f32 *crosspos, struct coord *dst, f32 arg2)
void cam0f0b4c3c(f32 pos2d[2], struct coord *dir2d, f32 arg2)
{
struct player *player = g_Vars.currentplayer;
f32 sp20;
@ -113,14 +113,14 @@ void cam0f0b4c3c(f32 *crosspos, struct coord *dst, f32 arg2)
f32 sp18 = -1.0f;
f32 f2;
sp1c = (player->c_halfheight - (crosspos[1] - player->c_screentop)) * player->c_scaley;
sp20 = (crosspos[0] - player->c_screenleft - player->c_halfwidth) * player->c_scalex;
sp1c = (player->c_halfheight - (pos2d[1] - player->c_screentop)) * player->c_scaley;
sp20 = (pos2d[0] - player->c_screenleft - player->c_halfwidth) * player->c_scalex;
f2 = arg2 / sqrtf(sp20 * sp20 + sp1c * sp1c + sp18 * sp18);
dst->x = sp20 * f2;
dst->y = sp1c * f2;
dst->z = sp18 * f2;
dir2d->x = sp20 * f2;
dir2d->y = sp1c * f2;
dir2d->z = sp18 * f2;
}
void cam0f0b4d04(struct coord *in, f32 *out)
@ -128,11 +128,8 @@ void cam0f0b4d04(struct coord *in, f32 *out)
struct player *player = g_Vars.currentplayer;
f32 value = 1.0f / in->z;
out[1] = in->y * value * player->c_recipscaley
+ (player->c_screentop + player->c_halfheight);
out[0] = (player->c_screenleft + player->c_halfwidth)
- in->x * value * player->c_recipscalex;
out[1] = in->y * value * player->c_recipscaley + (player->c_screentop + player->c_halfheight);
out[0] = (player->c_screenleft + player->c_halfwidth) - in->x * value * player->c_recipscalex;
}
void cam0f0b4d68(struct coord *in, f32 out[2])

View File

@ -4449,7 +4449,7 @@ void chrDisfigure(struct chrdata *chr, struct coord *exppos, f32 damageradius)
}
}
f32 chr0f0278a4(struct chrdata *chr)
f32 chrGetHitRadius(struct chrdata *chr)
{
s32 i;
f32 result;
@ -4481,16 +4481,16 @@ f32 chr0f0278a4(struct chrdata *chr)
return result;
}
void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool arg3)
void chrTestHit(struct prop *prop, struct shotdata *shotdata, bool isshooting, bool cheap)
{
struct coord spdc;
struct coord spd0;
struct chrdata *chr = prop->chr;
if ((chr->chrflags & CHRCFLAG_HIDDEN) == 0 && (prop->flags & PROPFLAG_ONTHISSCREENTHISTICK)) {
f32 fStack32 = chr0f0278a4(chr);
f32 radius = chrGetHitRadius(chr);
if (prop->z - fStack32 < shotdata->unk34) {
if (prop->z - radius < shotdata->distance) {
struct model *model = chr->model;
s32 hitpart = 0;
struct modelnode *node = NULL;
@ -4498,14 +4498,14 @@ void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool a
struct hitthing sp88;
s32 sp84 = 0;
struct modelnode *sp80 = NULL;
Mtxf *iVar5 = modelGetRootMtx(model);
Mtxf *rootmtx = modelGetRootMtx(model);
struct prop *next;
struct prop *child;
f32 sp70;
Mtxf *mtx;
f32 sp68;
if (func0f06b39c(&shotdata->unk00, &shotdata->unk0c, (struct coord *)iVar5->m[3], fStack32)) {
if (func0f06b39c(&shotdata->gunpos2d, &shotdata->gundir2d, (struct coord *)rootmtx->m[3], radius)) {
spb8 = 1;
hitpart = 1;
}
@ -4523,27 +4523,27 @@ void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool a
child = next;
}
if (arg3 || var8005efc0 > 0.0f) {
hitpart = modelTestForHit(model, &shotdata->unk00, &shotdata->unk0c, &node);
if (cheap || var8005efc0 > 0.0f) {
hitpart = modelTestForHit(model, &shotdata->gunpos2d, &shotdata->gundir2d, &node);
while (hitpart > 0) {
if (func0f084594(model, node, &shotdata->unk00, &shotdata->unk0c, &sp88, &sp84, &sp80)) {
mtx4TransformVec(&model->matrices[sp84], &sp88.unk00, &spdc);
if (func0f084594(model, node, &shotdata->gunpos2d, &shotdata->gundir2d, &sp88, &sp84, &sp80)) {
mtx4TransformVec(&model->matrices[sp84], &sp88.pos, &spdc);
mtx4TransformVecInPlace(camGetProjectionMtxF(), &spdc);
mtx4RotateVec(&model->matrices[sp84], &sp88.unk0c, &spd0);
mtx4RotateVecInPlace(camGetProjectionMtxF(), &spd0);
break;
}
hitpart = modelTestForHit(model, &shotdata->unk00, &shotdata->unk0c, &node);
hitpart = modelTestForHit(model, &shotdata->gunpos2d, &shotdata->gundir2d, &node);
}
} else {
hitpart = modelTestForHit(model, &shotdata->unk00, &shotdata->unk0c, &node);
hitpart = modelTestForHit(model, &shotdata->gunpos2d, &shotdata->gundir2d, &node);
if (hitpart > 0) {
if (func0f06bea0(model, model->definition->rootnode, model->definition->rootnode, &shotdata->unk00,
&shotdata->unk0c, &sp88.unk00, &sp70, &node, &hitpart, &sp84, &sp80)) {
mtx4TransformVec(camGetProjectionMtxF(), &sp88.unk00, &spdc);
if (func0f06bea0(model, model->definition->rootnode, model->definition->rootnode, &shotdata->gunpos2d,
&shotdata->gundir2d, &sp88.pos, &sp70, &node, &hitpart, &sp84, &sp80)) {
mtx4TransformVec(camGetProjectionMtxF(), &sp88.pos, &spdc);
mtx4RotateVec(camGetProjectionMtxF(), &sp88.unk0c, &spd0);
} else {
hitpart = 0;
@ -4561,12 +4561,12 @@ void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool a
sp68 = spdc.x * mtx->m[0][2] + spdc.y * mtx->m[1][2] + spdc.z * mtx->m[2][2] + mtx->m[3][2];
sp68 = -sp68;
if (sp68 < shotdata->unk34) {
func0f061fa8(shotdata, prop, sp68, hitpart, node, &sp88, sp84, sp80, model, 1, chrGetShield(chr) > 0.0f, &spdc, &spd0);
if (sp68 < shotdata->distance) {
hitCreate(shotdata, prop, sp68, hitpart, node, &sp88, sp84, sp80, model, true, chrGetShield(chr) > 0.0f, &spdc, &spd0);
}
}
if (spb8 && hitpart <= 0 && prop->z <= shotdata->unk34 && arg2) {
if (spb8 && hitpart <= 0 && prop->z <= shotdata->distance && isshooting) {
if (chrGetTargetProp(chr) == g_Vars.currentplayer->prop) {
chr->chrflags |= CHRCFLAG_NEAR_MISS;
}
@ -4607,24 +4607,24 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
chr = prop->chr;
if ((chr->chrflags & CHRCFLAG_HIDDEN) == 0) {
sp98.x = shotdata->unk00.x - (hit->distance * shotdata->unk0c.x) / shotdata->unk0c.z;
sp98.y = shotdata->unk00.y - (hit->distance * shotdata->unk0c.y) / shotdata->unk0c.z;
sp98.z = shotdata->unk00.z - hit->distance;
sp98.x = shotdata->gunpos2d.x - (hit->distance * shotdata->gundir2d.x) / shotdata->gundir2d.z;
sp98.y = shotdata->gunpos2d.y - (hit->distance * shotdata->gundir2d.y) / shotdata->gundir2d.z;
sp98.z = shotdata->gunpos2d.z - hit->distance;
mtx4TransformVec(camGetProjectionMtxF(), &sp98, &hitpos);
bgunSetHitPos(&hitpos);
bgunPlayPropHitSound(&shotdata->gset, hit->prop, -1);
chrEmitSparks(chr, hit->prop, hit->hitpart, &hitpos, &shotdata->dir, g_Vars.currentplayer->prop->chr);
chrEmitSparks(chr, hit->prop, hit->hitpart, &hitpos, &shotdata->gundir3d, g_Vars.currentplayer->prop->chr);
sp90[0] = hit->hitthing.unk00.x;
sp90[1] = hit->hitthing.unk00.y;
sp90[2] = hit->hitthing.unk00.z;
sp90[0] = hit->hitthing.pos.x;
sp90[1] = hit->hitthing.pos.y;
sp90[2] = hit->hitthing.pos.z;
shield = chrGetShield(chr);
func0f0341dc(chr, gsetGetDamage(&shotdata->gset), &shotdata->dir, &shotdata->gset,
g_Vars.currentplayer->prop, hit->hitpart, hit->prop, hit->node,
func0f0341dc(chr, gsetGetDamage(&shotdata->gset), &shotdata->gundir3d, &shotdata->gset,
g_Vars.currentplayer->prop, hit->hitpart, hit->prop, hit->bboxnode,
hit->model, hit->hitthing.unk28 / 2, sp90);
if (g_Vars.antiplayernum >= 0
@ -4679,9 +4679,9 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
index = random() % type->numwallhittexes;
wallhitCreate(
&hit->hitthing.unk00,
&hit->hitthing.pos,
&hit->hitthing.unk0c,
&shotdata->gunpos,
&shotdata->gunpos3d,
0,
0,
type->wallhittexes[index],
@ -4715,9 +4715,9 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
index = random() % type->numwallhittexes;
wallhitCreate(
&hit->hitthing.unk00,
&hit->hitthing.pos,
&hit->hitthing.unk0c,
&shotdata->gunpos,
&shotdata->gunpos3d,
0,
0,
type->wallhittexes[index],
@ -4731,7 +4731,7 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
// Shot a chr in the flesh
s32 race = CHRRACE(chr);
struct coord sp5c;
Mtxf *sp58 = modelFindNodeMtx(hit->model, hit->node, 0);
Mtxf *sp58 = modelFindNodeMtx(hit->model, hit->bboxnode, 0);
// Create blood
mtx0001719c(sp58->m, spb0.m);
@ -4753,7 +4753,7 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
}
if (!chrIsUsingPaintball(g_Vars.currentplayer->prop->chr)) {
chrBruise(hit->model, hit->hitpart, hit->node, &sp5c);
chrBruise(hit->model, hit->hitpart, hit->bboxnode, &sp5c);
}
splatsCreateForChrHit(prop, shotdata, &sp98, &hitpos, darker, 0, g_Vars.currentplayer->prop->chr);
@ -4776,7 +4776,7 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
darker = false;
}
chrBruise(hit->model, hit->hitpart, hit->node, &sp5c);
chrBruise(hit->model, hit->hitpart, hit->bboxnode, &sp5c);
splatsCreateForChrHit(prop, shotdata, &sp98, &hitpos, darker, 0, g_Vars.currentplayer->prop->chr);
}

View File

@ -1199,7 +1199,7 @@ Gfx *lvRender(Gfx *gdl)
|| g_Vars.coopplayernum >= 0
|| g_Vars.antiplayernum >= 0
|| (weaponHasFlag(bgunGetWeaponNum(HAND_RIGHT), WEAPONFLAG_AIMTRACK) && bmoveIsInSightAimMode())) {
g_Vars.currentplayer->lookingatprop.prop = func0f061d54(HAND_RIGHT, 0, 0);
g_Vars.currentplayer->lookingatprop.prop = propFindAimingAt(HAND_RIGHT, false, FINDPROPCONTEXT_QUERY);
if (g_Vars.currentplayer->lookingatprop.prop) {
if (g_Vars.currentplayer->lookingatprop.prop->type == PROPTYPE_CHR

View File

@ -564,13 +564,13 @@ void func0f060bac(s32 weaponnum, struct prop *prop)
*
* The return value is the final prop that was hit.
*/
struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struct coord *arg3, struct coord *gunpos, struct coord *dir, u32 arg6, f32 arg7, bool arg8)
struct prop *shotCalculateHits(s32 handnum, bool isshooting, struct coord *gunpos2d, struct coord *gundir2d, struct coord *gunpos3d, struct coord *gundir3d, u32 arg6, f32 distance, bool cheap)
{
u32 index;
struct prop **propptr;
struct prop *root;
bool explosiveshells = false;
bool sp6cc = false;
bool blockedbyprop = false;
bool hitbg = false;
s32 room = 0;
struct hitthing sp694;
@ -583,7 +583,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
s32 s1 = 0;
struct weaponfunc *func;
bool laserstream = false;
bool shortrange = false;
bool ismelee = false;
f32 range = 200;
struct prop *result = NULL;
s32 hitindex;
@ -599,46 +599,46 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
RoomNum spc8[8];
RoomNum spb8[8];
s32 uVar6;
s32 texnum;
RoomNum *roomsptr;
struct prop *prop;
struct coord spa0;
struct defaultobj *obj;
bool doexplosiveshells;
struct coord sp8c;
RoomNum sp7c[8];
RoomNum sp6c[8];
struct coord exppos;
RoomNum exprooms[8];
RoomNum rooms2[8];
struct prop *hitprop;
bgun0f0a9494(arg6);
shotdata.gunpos.x = gunpos->x;
shotdata.gunpos.y = gunpos->y;
shotdata.gunpos.z = gunpos->z;
shotdata.gunpos3d.x = gunpos3d->x;
shotdata.gunpos3d.y = gunpos3d->y;
shotdata.gunpos3d.z = gunpos3d->z;
shotdata.unk00.x = arg2->x;
shotdata.unk00.y = arg2->y;
shotdata.unk00.z = arg2->z;
shotdata.gunpos2d.x = gunpos2d->x;
shotdata.gunpos2d.y = gunpos2d->y;
shotdata.gunpos2d.z = gunpos2d->z;
shotdata.dir.x = dir->x;
shotdata.dir.y = dir->y;
shotdata.dir.z = dir->z;
shotdata.gundir3d.x = gundir3d->x;
shotdata.gundir3d.y = gundir3d->y;
shotdata.gundir3d.z = gundir3d->z;
shotdata.unk0c.x = arg3->x;
shotdata.unk0c.y = arg3->y;
shotdata.unk0c.z = arg3->z;
shotdata.gundir2d.x = gundir2d->x;
shotdata.gundir2d.y = gundir2d->y;
shotdata.gundir2d.z = gundir2d->z;
gsetPopulateFromCurrentPlayer(handnum, &shotdata.gset);
func = gsetGetWeaponFunction(&shotdata.gset);
if (func) {
if (arg1 && (func->flags & FUNCFLAG_EXPLOSIVESHELLS)) {
if (isshooting && (func->flags & FUNCFLAG_EXPLOSIVESHELLS)) {
explosiveshells = true;
}
if ((func->type & 0xff) == INVENTORYFUNCTYPE_MELEE && arg1) {
shortrange = true;
arg1 = false;
if ((func->type & 0xff) == INVENTORYFUNCTYPE_MELEE && isshooting) {
ismelee = true;
isshooting = false;
}
}
@ -646,41 +646,41 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
laserstream = true;
}
if (arg1) {
if (isshooting) {
shotdata.penetration = gsetGetSinglePenetration(&shotdata.gset);
} else {
shotdata.penetration = 1;
}
shotdata.unk34 = arg7;
shotdata.distance = distance;
for (i = 0; i < ARRAYCOUNT(shotdata.hits); i++) {
shotdata.hits[i].prop = NULL;
shotdata.hits[i].hitpart = 0;
shotdata.hits[i].node = NULL;
shotdata.hits[i].bboxnode = NULL;
}
if (laserstream) {
hitpos.x = shotdata.gunpos.x + shotdata.dir.x * 300;
hitpos.y = shotdata.gunpos.y + shotdata.dir.y * 300;
hitpos.z = shotdata.gunpos.z + shotdata.dir.z * 300;
} else if (shortrange) {
hitpos.x = shotdata.gunpos3d.x + shotdata.gundir3d.x * 300;
hitpos.y = shotdata.gunpos3d.y + shotdata.gundir3d.y * 300;
hitpos.z = shotdata.gunpos3d.z + shotdata.gundir3d.z * 300;
} else if (ismelee) {
if ((func->type & 0xff) == INVENTORYFUNCTYPE_MELEE) {
struct weaponfunc_melee *meleefunc = (struct weaponfunc_melee *) func;
range = meleefunc->range;
}
hitpos.x = shotdata.gunpos.x + shotdata.dir.x * range;
hitpos.y = shotdata.gunpos.y + shotdata.dir.y * range;
hitpos.z = shotdata.gunpos.z + shotdata.dir.z * range;
hitpos.x = shotdata.gunpos3d.x + shotdata.gundir3d.x * range;
hitpos.y = shotdata.gunpos3d.y + shotdata.gundir3d.y * range;
hitpos.z = shotdata.gunpos3d.z + shotdata.gundir3d.z * range;
} else {
hitpos.x = shotdata.gunpos.x + shotdata.dir.x * 65536;
hitpos.y = shotdata.gunpos.y + shotdata.dir.y * 65536;
hitpos.z = shotdata.gunpos.z + shotdata.dir.z * 65536;
hitpos.x = shotdata.gunpos3d.x + shotdata.gundir3d.x * 65536;
hitpos.y = shotdata.gunpos3d.y + shotdata.gundir3d.y * 65536;
hitpos.z = shotdata.gunpos3d.z + shotdata.gundir3d.z * 65536;
}
portal00018148(&playerprop->pos, &shotdata.gunpos, playerprop->rooms, spc8, 0, 0);
portal00018148(&shotdata.gunpos, &hitpos, spc8, spb8, rooms, 30);
portal00018148(&playerprop->pos, &shotdata.gunpos3d, playerprop->rooms, spc8, 0, 0);
portal00018148(&shotdata.gunpos3d, &hitpos, spc8, spb8, rooms, 30);
if (shotdata.gset.weaponnum != WEAPON_FARSIGHT || g_Vars.currentplayer->visionmode != VISIONMODE_XRAY) {
roomsptr = rooms;
@ -693,36 +693,36 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
bgGetForceOnscreenRooms(roomsptr, 100);
for (i = 0; rooms[i] != -1; i++) {
if (bgTestHitInRoom(&shotdata.gunpos, &hitpos, rooms[i], &sp664)) {
sp664.unk00.x *= 1;
sp664.unk00.y *= 1;
sp664.unk00.z *= 1;
if (bgTestHitInRoom(&shotdata.gunpos3d, &hitpos, rooms[i], &sp664)) {
sp664.pos.x *= 1;
sp664.pos.y *= 1;
sp664.pos.z *= 1;
if (((hitpos.x >= shotdata.gunpos.x && hitpos.x >= sp664.unk00.x && sp664.unk00.x >= shotdata.gunpos.x)
|| (hitpos.x <= shotdata.gunpos.x && hitpos.x <= sp664.unk00.x && sp664.unk00.x <= shotdata.gunpos.x))
&& ((hitpos.y >= shotdata.gunpos.y && hitpos.y >= sp664.unk00.y && sp664.unk00.y >= shotdata.gunpos.y)
|| (hitpos.y <= shotdata.gunpos.y && hitpos.y <= sp664.unk00.y && sp664.unk00.y <= shotdata.gunpos.y))
&& ((shotdata.gunpos.z <= hitpos.z && sp664.unk00.z <= hitpos.z && shotdata.gunpos.z <= sp664.unk00.z)
|| (hitpos.z <= shotdata.gunpos.z && hitpos.z <= sp664.unk00.z && sp664.unk00.z <= shotdata.gunpos.z))
&& (shotdata.gunpos.x != sp664.unk00.x || shotdata.gunpos.y != sp664.unk00.y || shotdata.gunpos.z != sp664.unk00.z)) {
if (((hitpos.x >= shotdata.gunpos3d.x && hitpos.x >= sp664.pos.x && sp664.pos.x >= shotdata.gunpos3d.x)
|| (hitpos.x <= shotdata.gunpos3d.x && hitpos.x <= sp664.pos.x && sp664.pos.x <= shotdata.gunpos3d.x))
&& ((hitpos.y >= shotdata.gunpos3d.y && hitpos.y >= sp664.pos.y && sp664.pos.y >= shotdata.gunpos3d.y)
|| (hitpos.y <= shotdata.gunpos3d.y && hitpos.y <= sp664.pos.y && sp664.pos.y <= shotdata.gunpos3d.y))
&& ((shotdata.gunpos3d.z <= hitpos.z && sp664.pos.z <= hitpos.z && shotdata.gunpos3d.z <= sp664.pos.z)
|| (hitpos.z <= shotdata.gunpos3d.z && hitpos.z <= sp664.pos.z && sp664.pos.z <= shotdata.gunpos3d.z))
&& (shotdata.gunpos3d.x != sp664.pos.x || shotdata.gunpos3d.y != sp664.pos.y || shotdata.gunpos3d.z != sp664.pos.z)) {
hitbg = true;
room = rooms[i];
sp694 = sp664;
hitpos.x = sp664.unk00.x;
hitpos.y = sp664.unk00.y;
hitpos.z = sp664.unk00.z;
hitpos.x = sp664.pos.x;
hitpos.y = sp664.pos.y;
hitpos.z = sp664.pos.z;
}
}
}
}
if (hitbg && shotdata.gset.weaponnum != WEAPON_FARSIGHT) {
mtx4TransformVec(camGetWorldToScreenMtxf(), &sp694.unk00, &sp658);
mtx4TransformVec(camGetWorldToScreenMtxf(), &sp694.pos, &sp658);
if (shotdata.unk34 > -sp658.z) {
shotdata.unk34 = -sp658.z;
if (shotdata.distance > -sp658.z) {
shotdata.distance = -sp658.z;
}
}
@ -734,11 +734,11 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
if (prop) {
if (prop->type == PROPTYPE_CHR
|| (prop->type == PROPTYPE_PLAYER && prop->chr && playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum)) {
if (!shortrange) {
chr0f027994(prop, &shotdata, arg1, arg8);
if (!ismelee) {
chrTestHit(prop, &shotdata, isshooting, cheap);
}
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
func0f085e00(prop, &shotdata);
objTestHit(prop, &shotdata);
}
}
@ -759,10 +759,10 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
if (hitindex != -1) {
bgun0f0a94d0(arg6, &shotdata.hits[hitindex].pos, &shotdata.hits[hitindex].dir);
} else if (hitbg) {
bgun0f0a94d0(arg6, &sp694.unk00, &sp694.unk0c);
bgun0f0a94d0(arg6, &sp694.pos, &sp694.unk0c);
}
if (arg1) {
if (isshooting) {
for (i = 0; i < ARRAYCOUNT(shotdata.hits); i++) {
hitprop = shotdata.hits[i].prop;
@ -781,18 +781,18 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
objHit(&shotdata, &shotdata.hits[i]);
}
if (shotdata.hits[i].unk4d) {
sp6cc = true;
if (shotdata.hits[i].bulletproof) {
blockedbyprop = true;
doexplosiveshells = explosiveshells;
hitpos.x = shotdata.hits[i].pos.x;
hitpos.y = shotdata.hits[i].pos.y;
hitpos.z = shotdata.hits[i].pos.z;
} else if (shotdata.hits[i].unk4c
} else if (shotdata.hits[i].slowsbullet
|| (explosiveshells && (obj->type == OBJTYPE_GLASS || obj->type == OBJTYPE_TINTEDGLASS))) {
s1++;
if (s1 >= shotdata.penetration) {
sp6cc = true;
blockedbyprop = true;
doexplosiveshells = explosiveshells;
hitpos.x = shotdata.hits[i].pos.x;
hitpos.y = shotdata.hits[i].pos.y;
@ -801,21 +801,21 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
}
if (doexplosiveshells) {
sp8c.x = shotdata.hits[i].pos.x;
sp8c.y = shotdata.hits[i].pos.y;
sp8c.z = shotdata.hits[i].pos.z;
exppos.x = shotdata.hits[i].pos.x;
exppos.y = shotdata.hits[i].pos.y;
exppos.z = shotdata.hits[i].pos.z;
func0f065e74(&root->pos, root->rooms, &sp8c, sp7c);
explosionCreateSimple(0, &sp8c, sp7c, EXPLOSIONTYPE_PHOENIX, g_Vars.currentplayernum);
func0f065e74(&root->pos, root->rooms, &exppos, exprooms);
explosionCreateSimple(0, &exppos, exprooms, EXPLOSIONTYPE_PHOENIX, g_Vars.currentplayernum);
}
}
}
if (hitbg && !sp6cc) {
sp6c[0] = room;
sp6c[1] = -1;
if (hitbg && !blockedbyprop) {
rooms2[0] = room;
rooms2[1] = -1;
uVar6 = lightsHandleHit(&shotdata.gunpos, &hitpos, room);
texnum = lightsHandleHit(&shotdata.gunpos3d, &hitpos, room);
if (sp694.texturenum < 0 || sp694.texturenum >= NUM_TEXTURES) {
surfacetype = g_SurfaceTypes[SURFACETYPE_DEFAULT];
@ -829,47 +829,47 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
}
}
bgunSetHitPos(&sp694.unk00);
bgunSetHitPos(&sp694.pos);
if (surfacetype->numwallhittexes > 0 && (!func || (func->type & 0xff) != INVENTORYFUNCTYPE_MELEE)) {
if (shotdata.gset.weaponnum != WEAPON_UNARMED
&& shotdata.gset.weaponnum != WEAPON_LASER
&& shotdata.gset.weaponnum != WEAPON_TRANQUILIZER
&& shotdata.gset.weaponnum != WEAPON_FARSIGHT) {
uVar6 = random() % surfacetype->numwallhittexes;
uVar6 = surfacetype->wallhittexes[uVar6];
texnum = random() % surfacetype->numwallhittexes;
texnum = surfacetype->wallhittexes[texnum];
if (uVar6 >= WALLHITTEX_GLASS1 && uVar6 <= WALLHITTEX_GLASS3) {
if (texnum >= WALLHITTEX_GLASS1 && texnum <= WALLHITTEX_GLASS3) {
// Use bulletproof glass hit textures instead
uVar6 += 10;
texnum += 10;
}
if (uVar6) {
wallhitCreate(&sp694.unk00, &sp694.unk0c, &shotdata.gunpos, 0, 0, uVar6, room, 0, -1, 0, g_Vars.currentplayer->prop->chr, sp694.unk2c == 2);
if (texnum) {
wallhitCreate(&sp694.pos, &sp694.unk0c, &shotdata.gunpos3d, 0, 0, texnum, room, 0, -1, 0, g_Vars.currentplayer->prop->chr, sp694.unk2c == 2);
}
}
bgunPlayBgHitSound(&shotdata.gset, &sp694.unk00, sp694.texturenum, sp6c);
bgunPlayBgHitSound(&shotdata.gset, &sp694.pos, sp694.texturenum, rooms2);
if (explosiveshells) {
explosionCreateSimple(NULL, &sp694.unk00, sp6c, EXPLOSIONTYPE_PHOENIX, g_Vars.currentplayernum);
explosionCreateSimple(NULL, &sp694.pos, rooms2, EXPLOSIONTYPE_PHOENIX, g_Vars.currentplayernum);
} else {
if (!chrIsUsingPaintball(g_Vars.currentplayer->prop->chr)) {
if (PLAYERCOUNT() >= 2) {
if ((random() % 8) == 0) {
smokeCreateSimple(&sp694.unk00, sp6c, SMOKETYPE_BULLETIMPACT);
smokeCreateSimple(&sp694.pos, rooms2, SMOKETYPE_BULLETIMPACT);
}
} else {
if (uVar6) {
explosionCreateSimple(NULL, &sp694.unk00, sp6c, EXPLOSIONTYPE_BULLETHOLE, g_Vars.currentplayernum);
if (texnum) {
explosionCreateSimple(NULL, &sp694.pos, rooms2, EXPLOSIONTYPE_BULLETHOLE, g_Vars.currentplayernum);
}
}
}
if (PLAYERCOUNT() <= 2 || g_Vars.lvupdate240 <= 8 || (random() % 4) == 0) {
if (sp694.unk00.x > -32000 && sp694.unk00.x < 32000
&& sp694.unk00.y > -32000 && sp694.unk00.y < 32000
&& sp694.unk00.z > -32000 && sp694.unk00.z < 32000) {
if (sp694.pos.x > -32000 && sp694.pos.x < 32000
&& sp694.pos.y > -32000 && sp694.pos.y < 32000
&& sp694.pos.z > -32000 && sp694.pos.z < 32000) {
sparktype = SPARKTYPE_DEFAULT;
if (chrIsUsingPaintball(g_Vars.currentplayer->prop->chr)) {
@ -893,14 +893,14 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
break;
}
uVar6 = g_Textures[sp694.texturenum].surfacetype;
texnum = g_Textures[sp694.texturenum].surfacetype;
if (uVar6 == SURFACETYPE_SHALLOWWATER || uVar6 == SURFACETYPE_DEEPWATER) {
if (texnum == SURFACETYPE_SHALLOWWATER || texnum == SURFACETYPE_DEEPWATER) {
sparktype = SPARKTYPE_SHALLOWWATER;
}
}
sparksCreate(room, NULL, &sp694.unk00, &shotdata.dir, &sp694.unk0c, sparktype);
sparksCreate(room, NULL, &sp694.pos, &shotdata.gundir3d, &sp694.unk0c, sparktype);
}
}
}
@ -908,7 +908,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
} else {
bgunSetHitPos(&hitpos);
}
} else if (shortrange) {
} else if (ismelee) {
s32 hitindex;
bool hitaprop = false;
@ -927,18 +927,17 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
if (shotdata.gset.weaponnum != WEAPON_UNARMED && shotdata.gset.weaponnum != WEAPON_TRANQUILIZER) {
if (hitaprop) {
sparksCreate(shotdata.hits[hitindex].prop->rooms[0], NULL, &shotdata.hits[hitindex].pos, &shotdata.dir, &shotdata.hits[hitindex].dir, SPARKTYPE_DEFAULT);
sparksCreate(shotdata.hits[hitindex].prop->rooms[0], NULL, &shotdata.hits[hitindex].pos, &shotdata.gundir3d, &shotdata.hits[hitindex].dir, SPARKTYPE_DEFAULT);
} else {
sparksCreate(room, NULL, &sp694.unk00, &shotdata.dir, &sp694.unk0c, SPARKTYPE_DEFAULT);
sparksCreate(room, NULL, &sp694.pos, &shotdata.gundir3d, &sp694.unk0c, SPARKTYPE_DEFAULT);
}
}
} else {
weaponPlayWhooshSound(shotdata.gset.weaponnum, g_Vars.currentplayer->prop);
}
} else {
// Figure out what prop was hit so it can be returned,
// by iterating the props in order of distance.
// For laser stream, bail early once the laser's range is reached.
// The caller is querying which prop is being aimed at rather than taking a shot.
// Find the closest object and return it.
done = false;
for (i = 0; i < ARRAYCOUNT(shotdata.hits); i++) {
@ -959,10 +958,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
done = true;
}
// This seems like it handles penetration (bullets going
// through multiple props), but the loop is effectively
// stopped when any prop is hit so this seems unlikely.
if (shotdata.hits[i].unk4c) {
if (shotdata.hits[i].slowsbullet) {
s1++;
if (s1 >= shotdata.penetration) {
@ -977,59 +973,73 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
return result;
}
struct prop *func0f061d54(s32 handnum, u32 arg1, u32 arg2)
struct prop *propFindAimingAt(s32 handnum, bool isshooting, u32 context)
{
struct coord sp64;
struct coord sp58;
struct coord sp4c;
struct coord sp40;
struct coord gundir2d;
struct coord gunpos2d;
struct coord gundir3d;
struct coord gunpos3d;
bgunCalculatePlayerShotSpread(&sp58, &sp64, handnum, arg2);
bgunCalculatePlayerShotSpread(&gunpos2d, &gundir2d, handnum, context);
if (arg2 == 2 && bgunGetWeaponNum(HAND_RIGHT) == WEAPON_REAPER) {
sp58.y -= 15 * RANDOMFRAC();
if (context == FINDPROPCONTEXT_SHOOT && bgunGetWeaponNum(HAND_RIGHT) == WEAPON_REAPER) {
gunpos2d.y -= 15 * RANDOMFRAC();
}
mtx4TransformVec(camGetProjectionMtxF(), &sp58, &sp40);
mtx4RotateVec(camGetProjectionMtxF(), &sp64, &sp4c);
mtx4TransformVec(camGetProjectionMtxF(), &gunpos2d, &gunpos3d);
mtx4RotateVec(camGetProjectionMtxF(), &gundir2d, &gundir3d);
return shotCalculateHits(handnum, arg1, &sp58, &sp64, &sp40, &sp4c, 0, 4294836224, PLAYERCOUNT() >= 2);
return shotCalculateHits(handnum, isshooting, &gunpos2d, &gundir2d, &gunpos3d, &gundir3d, 0, 4294836224, PLAYERCOUNT() >= 2);
}
void shotCreate(s32 handnum, bool arg1, bool dorandom, s32 arg3, bool arg4)
void shotCreate(s32 handnum, bool isshooting, bool dorandom, s32 numshots, bool cheap)
{
struct coord shootdir;
struct coord shootpos;
struct coord sp44;
struct coord sp38;
struct coord gundir3d;
struct coord gunpos3d;
struct coord gundir2d;
struct coord gunpos2d;
bgunCalculatePlayerShotSpread(&sp38, &sp44, handnum, dorandom);
bgunCalculatePlayerShotSpread(&gunpos2d, &gundir2d, handnum, dorandom);
if (arg3 > 0) {
mtx4TransformVec(camGetProjectionMtxF(), &sp38, &shootpos);
mtx4RotateVec(camGetProjectionMtxF(), &sp44, &shootdir);
if (numshots > 0) {
mtx4TransformVec(camGetProjectionMtxF(), &gunpos2d, &gunpos3d);
mtx4RotateVec(camGetProjectionMtxF(), &gundir2d, &gundir3d);
shotCalculateHits(handnum, arg1, &sp38, &sp44, &shootpos, &shootdir, 0, 4294836224, arg4);
shotCalculateHits(handnum, isshooting, &gunpos2d, &gundir2d, &gunpos3d, &gundir3d, 0, 4294836224, cheap);
if (arg3 < 2) {
bgunSetLastShootInfo(&shootpos, &shootdir, handnum);
if (numshots <= 1) {
bgunSetLastShootInfo(&gunpos3d, &gundir3d, handnum);
}
}
}
void func0f061fa8(struct shotdata *shotdata, struct prop *prop, f32 arg2, s32 hitpart, struct modelnode *node, struct hitthing *hitthing, s32 arg6, struct modelnode *arg7, struct model *model, bool arg9, s32 arg10, struct coord *arg11, struct coord *arg12)
/**
* Add a prop to the shot's hit list.
*
* Possible @bug: This function assumes the prop that's being added to the list
* is closer than the previous furtherest. This is okay if it's guaranteed that
* hits are added in the order of furtherest to closest. I'm unsure if this is
* true though.
*/
void hitCreate(struct shotdata *shotdata, struct prop *prop, f32 hitdistance, s32 hitpart,
struct modelnode *bboxnode, struct hitthing *hitthing, s32 mtxindex, struct modelnode *dlnode,
struct model *model, bool slowsbullet, bool bulletproof, struct coord *arg11, struct coord *arg12)
{
s32 i;
f32 fVar8;
if (arg9) {
// If this prop "slows" the bullet, it means it contributes to the bullet's
// penetration total. Most props slow the bullet. Glass does not.
if (slowsbullet) {
s32 bestindex = 0;
s32 count = 0;
f32 mostdist = 0;
f32 prevmostdist = 0;
// Count the number of existing hits that slow the bullet,
// and note which hit of these is the furtherest.
for (i = 0; i < ARRAYCOUNT(shotdata->hits); i++) {
if (shotdata->hits[i].prop && shotdata->hits[i].unk4c) {
if (shotdata->hits[i].prop && shotdata->hits[i].slowsbullet) {
count++;
if (shotdata->hits[i].distance > mostdist) {
@ -1041,49 +1051,58 @@ void func0f061fa8(struct shotdata *shotdata, struct prop *prop, f32 arg2, s32 hi
}
if (count >= shotdata->penetration) {
// There are too many props for the bullet to penetrate all of them.
// Remove the furtherest from the hit list, as well as any glass
// which is be beyond the now-reduced shot distance.
shotdata->hits[bestindex].prop = NULL;
shotdata->unk34 = prevmostdist;
shotdata->distance = prevmostdist;
if (shotdata->unk34 < arg2) {
shotdata->unk34 = arg2;
if (shotdata->distance < hitdistance) {
shotdata->distance = hitdistance;
}
for (i = 0; i < ARRAYCOUNT(shotdata->hits); i++) {
if (shotdata->hits[i].prop && !shotdata->hits[i].unk4c && shotdata->hits[i].distance > prevmostdist) {
if (shotdata->hits[i].prop && !shotdata->hits[i].slowsbullet && shotdata->hits[i].distance > prevmostdist) {
shotdata->hits[i].prop = NULL;
}
}
} else if (count + 1 == shotdata->penetration) {
if (shotdata->unk34 > arg2) {
shotdata->unk34 = arg2;
} else {
// If this hit will be stopping the bullet, adjust the shot distance.
if (count + 1 == shotdata->penetration) {
if (shotdata->distance > hitdistance) {
shotdata->distance = hitdistance;
}
}
}
}
if (arg10) {
// If this prop must stop the bullet (eg. because it's bulletproof),
// remove any hits that are beyond it.
if (bulletproof) {
for (i = 0; i < ARRAYCOUNT(shotdata->hits); i++) {
if (shotdata->hits[i].prop && shotdata->hits[i].distance > arg2) {
if (shotdata->hits[i].prop && shotdata->hits[i].distance > hitdistance) {
shotdata->hits[i].prop = NULL;
}
}
shotdata->unk34 = arg2;
shotdata->distance = hitdistance;
}
// Record the new hit
for (i = 0; i < ARRAYCOUNT(shotdata->hits); i++) {
if (shotdata->hits[i].prop == NULL) {
struct hit *hit = &shotdata->hits[i];
hit->distance = arg2;
hit->distance = hitdistance;
hit->prop = prop;
hit->hitpart = hitpart;
hit->node = node;
hit->bboxnode = bboxnode;
hit->hitthing = *hitthing;
hit->mtxindex = arg6;
hit->unk44 = arg7;
hit->mtxindex = mtxindex;
hit->dlnode = dlnode;
hit->model = model;
hit->unk4c = arg9;
hit->unk4d = arg10;
hit->slowsbullet = slowsbullet;
hit->bulletproof = bulletproof;
hit->pos.x = arg11->x;
hit->pos.y = arg11->y;
hit->pos.z = arg11->z;
@ -1202,13 +1221,13 @@ void handInflictMeleeDamage(s32 handnum, struct gset *gset, bool arg2)
if (cdTestLos04(&playerprop->pos, playerprop->rooms, &prop->pos, cdtypes)) {
if (isglass) {
struct model *model = obj->model;
struct coord spd8;
struct coord spcc;
struct coord gunpos2d;
struct coord gundir2d;
struct modelnode *node = NULL;
bgunCalculatePlayerShotSpread(&spd8, &spcc, handnum, true);
bgunCalculatePlayerShotSpread(&gunpos2d, &gundir2d, handnum, true);
if (modelTestForHit(model, &spd8, &spcc, &node) > 0) {
if (modelTestForHit(model, &gunpos2d, &gundir2d, &node) > 0) {
f32 damage = gsetGetDamage(gset) * 2.5f;
skipthething = true;
bgunPlayGlassHitSound(&playerprop->pos, playerprop->rooms, -1);
@ -1218,21 +1237,21 @@ void handInflictMeleeDamage(s32 handnum, struct gset *gset, bool arg2)
} else if (arg2) {
chr->chrflags |= CHRCFLAG_AVOIDING;
} else {
struct coord spb8;
struct coord vector;
struct coord gunpos2d;
struct coord gundir2d;
struct modelnode *node = NULL;
struct model *model = NULL;
s32 side = -1;
s32 hitpart = HITPART_TORSO;
if (!chrIsAvoiding(chr)) {
bgunCalculatePlayerShotSpread(&spb8, &vector, handnum, true);
bgunCalculatePlayerShotSpread(&gunpos2d, &gundir2d, handnum, true);
skipthething = true;
mtx4RotateVecInPlace(camGetProjectionMtxF(), &vector);
mtx4RotateVecInPlace(camGetProjectionMtxF(), &gundir2d);
bgunPlayPropHitSound(gset, prop, -1);
if (chr->model && chrGetShield(chr) > 0) {
chrCalculateShieldHit(chr, &playerprop->pos, &vector, &node, &hitpart, &model, &side);
chrCalculateShieldHit(chr, &playerprop->pos, &gundir2d, &node, &hitpart, &model, &side);
}
if (bmoveGetCrouchPos() == CROUCHPOS_DUCK) {
@ -1243,7 +1262,7 @@ void handInflictMeleeDamage(s32 handnum, struct gset *gset, bool arg2)
hitpart = HITPART_TORSO;
}
func0f0341dc(chr, gsetGetDamage(gset), &vector, gset,
func0f0341dc(chr, gsetGetDamage(gset), &gundir2d, gset,
g_Vars.currentplayer->prop, hitpart, chr->prop, node, model, side, 0);
}
}
@ -1271,7 +1290,7 @@ void handTickAttack(s32 handnum)
}
if (doit) {
func0f061d54(handnum, 1, 2);
propFindAimingAt(handnum, true, FINDPROPCONTEXT_SHOOT);
}
g_Vars.currentplayer->hands[handnum].unk0d0f_02 = false;

View File

@ -2689,7 +2689,7 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
while (hitpart > 0) {
if (func0f084594(model, spe4, arg5, arg6, &thing1, &mtxindex1, &node1)) {
mtx4TransformVec(&model->matrices[mtxindex1], &thing1.unk00, &spfc);
mtx4TransformVec(&model->matrices[mtxindex1], &thing1.pos, &spfc);
sum2 = (spfc.f[0] - arg5->f[0]) * arg6->f[0]
+ (spfc.f[1] - arg5->f[1]) * arg6->f[1]
@ -2715,9 +2715,9 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
g_EmbedNode = spe4;
g_EmbedSide = thing1.unk28 / 2;
var8006993c[0] = thing1.unk00.x;
var8006993c[1] = thing1.unk00.y;
var8006993c[2] = thing1.unk00.z;
var8006993c[0] = thing1.pos.x;
var8006993c[1] = thing1.pos.y;
var8006993c[2] = thing1.pos.z;
result = 1;
}
@ -2741,13 +2741,13 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
if (node && func0f084594(model, node, arg5, arg6, &thing2, &mtxindex2, &node2)) {
if (hitpart <= 0 ||
+ model->matrices[mtxindex2].m[0][2] * thing2.unk00.f[0]
+ model->matrices[mtxindex2].m[1][2] * thing2.unk00.f[1]
+ model->matrices[mtxindex2].m[2][2] * thing2.unk00.f[2]
+ model->matrices[mtxindex2].m[0][2] * thing2.pos.f[0]
+ model->matrices[mtxindex2].m[1][2] * thing2.pos.f[1]
+ model->matrices[mtxindex2].m[2][2] * thing2.pos.f[2]
>
+ model->matrices[mtxindex1].m[0][2] * thing1.unk00.f[0]
+ model->matrices[mtxindex1].m[1][2] * thing1.unk00.f[1]
+ model->matrices[mtxindex1].m[2][2] * thing1.unk00.f[2]
+ model->matrices[mtxindex1].m[0][2] * thing1.pos.f[0]
+ model->matrices[mtxindex1].m[1][2] * thing1.pos.f[1]
+ model->matrices[mtxindex1].m[2][2] * thing1.pos.f[2]
) {
hitpart = 1;
@ -2760,7 +2760,7 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
}
if (hitpart > 0) {
mtx4TransformVec(&model->matrices[mtxindex1], &thing1.unk00, &spfc);
mtx4TransformVec(&model->matrices[mtxindex1], &thing1.pos, &spfc);
sum3 = (spfc.f[0] - arg5->f[0]) * arg6->f[0]
+ (spfc.f[1] - arg5->f[1]) * arg6->f[1]
@ -2798,9 +2798,9 @@ bool func0f06b610(struct defaultobj *obj, struct coord *arg1, struct coord *arg2
if (thing1.texturenum == 10000) {
g_EmbedSide = thing1.unk28 / 2;
var8006993c[0] = thing1.unk00.x;
var8006993c[1] = thing1.unk00.y;
var8006993c[2] = thing1.unk00.z;
var8006993c[0] = thing1.pos.x;
var8006993c[1] = thing1.pos.y;
var8006993c[2] = thing1.pos.z;
}
}
}
@ -2994,7 +2994,7 @@ bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, s
{
f32 spec;
struct prop *prop = chr->prop;
f32 spe4 = chr0f0278a4(chr);
f32 spe4 = chrGetHitRadius(chr);
f32 x = (prop->pos.f[0] - arg1->f[0]);
f32 y = (prop->pos.f[1] - arg1->f[1]);
f32 z = (prop->pos.f[2] - arg1->f[2]);
@ -3021,7 +3021,7 @@ bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, s
while (hitpart > 0) {
if (func0f084594(model, spcc, arg5, arg6, &sp7c, &sp78, &sp74)) {
mtx4TransformVec(&model->matrices[sp78], &sp7c.unk00, &spb8);
mtx4TransformVec(&model->matrices[sp78], &sp7c.pos, &spb8);
spec = (spb8.f[0] - arg5->f[0]) * arg6->f[0]
+ (spb8.f[1] - arg5->f[1]) * arg6->f[1]
@ -3047,9 +3047,9 @@ bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, s
g_EmbedNode = spcc;
g_EmbedSide = sp7c.unk28 / 2;
var8006993c[0] = sp7c.unk00.x;
var8006993c[1] = sp7c.unk00.y;
var8006993c[2] = sp7c.unk00.z;
var8006993c[0] = sp7c.pos.x;
var8006993c[1] = sp7c.pos.y;
var8006993c[2] = sp7c.pos.z;
result = true;
}
@ -3061,10 +3061,10 @@ bool func0f06c28c(struct chrdata *chr, struct coord *arg1, struct coord *arg2, s
hitpart = modelTestForHit(model, arg5, arg6, &spcc);
if (hitpart > 0
&& func0f06bea0(model, model->definition->rootnode, model->definition->rootnode, arg5, arg6, &sp7c.unk00, &spec, &spcc, &hitpart, &sp78, &sp74)
&& func0f06bea0(model, model->definition->rootnode, model->definition->rootnode, arg5, arg6, &sp7c.pos, &spec, &spcc, &hitpart, &sp78, &sp74)
&& spec < *arg9) {
*arg9 = spec;
mtx4TransformVec(camGetProjectionMtxF(), &sp7c.unk00, arg7);
mtx4TransformVec(camGetProjectionMtxF(), &sp7c.pos, arg7);
mtx4RotateVec(camGetProjectionMtxF(), &sp7c.unk0c, arg8);
if (arg8->x != 0.0f || arg8->y != 0.0f || arg8->z != 0.0f) {
@ -3270,9 +3270,9 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
if (bgRoomIsLoaded(spcc[i])) {
if (bgTestHitInRoom(&prop->pos, &sp1c4, spcc[i], &hitthing)) {
hitthing.unk00.x *= scale;
hitthing.unk00.y *= scale;
hitthing.unk00.z *= scale;
hitthing.pos.x *= scale;
hitthing.pos.y *= scale;
hitthing.pos.z *= scale;
var80069944 = hitthing.texturenum;
@ -3281,7 +3281,7 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
if (g_Textures[hitthing.texturenum].surfacetype == SURFACETYPE_DEEPWATER) {
struct coord spa4 = {0, 0, 0};
s0 = false;
sparksCreate(prop->rooms[0], prop, &hitthing.unk00, &spa4, &hitthing.unk0c, SPARKTYPE_DEEPWATER);
sparksCreate(prop->rooms[0], prop, &hitthing.pos, &spa4, &hitthing.unk0c, SPARKTYPE_DEEPWATER);
psCreate(0, prop, SFX_HIT_WATER, -1, -1, PSFLAG_0400, 0, PSTYPE_NONE, 0, -1.0f, 0, -1, -1.0f, -1.0f, -1.0f);
obj->hidden |= OBJHFLAG_DELETING;
}
@ -3294,28 +3294,28 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
if (cdExamLos09(&prop->pos, spa0, &sp1c4, CDTYPE_BG) == CDRESULT_COLLISION) {
s0 = true;
#if VERSION >= VERSION_PAL_FINAL
cdGetPos(&hitthing.unk00, 4258, "prop/propobj.c");
cdGetPos(&hitthing.pos, 4258, "prop/propobj.c");
#elif VERSION >= VERSION_PAL_BETA
cdGetPos(&hitthing.unk00, 4258, "propobj.c");
cdGetPos(&hitthing.pos, 4258, "propobj.c");
#elif VERSION >= VERSION_NTSC_1_0
cdGetPos(&hitthing.unk00, 4257, "propobj.c");
cdGetPos(&hitthing.pos, 4257, "propobj.c");
#else
cdGetPos(&hitthing.unk00, 4246, "propobj.c");
cdGetPos(&hitthing.pos, 4246, "propobj.c");
#endif
cdGetObstacleNormal(&hitthing.unk0c);
}
}
if (s0
&& ((prop->pos.x <= sp1c4.x && hitthing.unk00.x <= sp1c4.x && prop->pos.x <= hitthing.unk00.x) || (sp1c4.x <= prop->pos.x && sp1c4.x <= hitthing.unk00.x && hitthing.unk00.x <= prop->pos.x))
&& ((prop->pos.y <= sp1c4.y && hitthing.unk00.y <= sp1c4.y && prop->pos.y <= hitthing.unk00.y) || (sp1c4.y <= prop->pos.y && sp1c4.y <= hitthing.unk00.y && hitthing.unk00.y <= prop->pos.y))
&& ((prop->pos.z <= sp1c4.z && hitthing.unk00.z <= sp1c4.z && prop->pos.z <= hitthing.unk00.z) || (sp1c4.z <= prop->pos.z && sp1c4.z <= hitthing.unk00.z && hitthing.unk00.z <= prop->pos.z))
&& (prop->pos.f[0] != hitthing.unk00.f[0] || prop->pos.f[1] != hitthing.unk00.f[1] || prop->pos.f[2] != hitthing.unk00.f[2])) {
&& ((prop->pos.x <= sp1c4.x && hitthing.pos.x <= sp1c4.x && prop->pos.x <= hitthing.pos.x) || (sp1c4.x <= prop->pos.x && sp1c4.x <= hitthing.pos.x && hitthing.pos.x <= prop->pos.x))
&& ((prop->pos.y <= sp1c4.y && hitthing.pos.y <= sp1c4.y && prop->pos.y <= hitthing.pos.y) || (sp1c4.y <= prop->pos.y && sp1c4.y <= hitthing.pos.y && hitthing.pos.y <= prop->pos.y))
&& ((prop->pos.z <= sp1c4.z && hitthing.pos.z <= sp1c4.z && prop->pos.z <= hitthing.pos.z) || (sp1c4.z <= prop->pos.z && sp1c4.z <= hitthing.pos.z && hitthing.pos.z <= prop->pos.z))
&& (prop->pos.f[0] != hitthing.pos.f[0] || prop->pos.f[1] != hitthing.pos.f[1] || prop->pos.f[2] != hitthing.pos.f[2])) {
cdresult = CDRESULT_COLLISION;
sp1c4.x = hitthing.unk00.x;
sp1c4.y = hitthing.unk00.y;
sp1c4.z = hitthing.unk00.z;
sp1c4.x = hitthing.pos.x;
sp1c4.y = hitthing.pos.y;
sp1c4.z = hitthing.pos.z;
arg3->x = hitthing.unk0c.x;
arg3->y = hitthing.unk0c.y;
@ -14102,7 +14102,7 @@ void objDeform(struct defaultobj *obj, s32 level)
/**
* Bounce an object, such as a hoverbot when it's destroyed.
*/
void objBounce(struct defaultobj *obj, struct coord *arg1)
void objBounce(struct defaultobj *obj, struct coord *gundir2d)
{
struct coord dir;
struct coord rot = {0, 0, 0};
@ -14135,9 +14135,9 @@ void objBounce(struct defaultobj *obj, struct coord *arg1)
projectile->flags |= PROJECTILEFLAG_AIRBORNE;
dir.x = arg1->x;
dir.y = arg1->y;
dir.z = arg1->z;
dir.x = gundir2d->x;
dir.y = gundir2d->y;
dir.z = gundir2d->z;
mtx4RotateVecInPlace(camGetProjectionMtxF(), &dir);
@ -14740,8 +14740,8 @@ void objCheckDestroyed(struct defaultobj *obj, struct coord *pos, s32 playernum)
obj->flags &= ~OBJFLAG_CHOPPER_INACTIVE;
} else if (obj->type == OBJTYPE_HOVERCAR) {
struct hovercarobj *hovercar = (struct hovercarobj *)obj;
struct coord sp40;
struct coord sp34;
struct coord gunpos2d;
struct coord gundir2d;
if (obj->flags & OBJFLAG_HOVERCAR_ISHOVERBOT) {
// Hoverbots bounce and spark when dead
@ -14749,8 +14749,8 @@ void objCheckDestroyed(struct defaultobj *obj, struct coord *pos, s32 playernum)
hovercar->deadtimer60 = TICKS(250);
hovercar->sparkstimer60 = TICKS(50);
bgunCalculatePlayerShotSpread(&sp40, &sp34, HAND_RIGHT, false);
objBounce(obj, &sp34);
bgunCalculatePlayerShotSpread(&gunpos2d, &gundir2d, HAND_RIGHT, false);
objBounce(obj, &gundir2d);
} else if (obj->modelnum == MODEL_TAXICAB || obj->modelnum == MODEL_POLICECAR) {
// Taxi and police car (limo) fall to the ground and retain collision
objDeform(obj, 10);
@ -14888,7 +14888,7 @@ bool func0f084594(struct model *model, struct modelnode *node, struct coord *arg
if (reset) {
for (i = 0; i < 3; i++) {
hitthing->unk00.f[i] = spb8.f[i];
hitthing->pos.f[i] = spb8.f[i];
}
hitthing->unk0c.x = 0.0f;
@ -14917,13 +14917,13 @@ bool func0f084594(struct model *model, struct modelnode *node, struct coord *arg
} else {
for (i = 0; i < 3; i++) {
if (maxindex != i) {
hitthing->unk00.f[i] = spb8.f[i] + sp7c.f[maxindex] * spac.f[i];
hitthing->pos.f[i] = spb8.f[i] + sp7c.f[maxindex] * spac.f[i];
if (hitthing->unk00.f[i] < min.f[i] || hitthing->unk00.f[i] > max.f[i]) {
if (hitthing->pos.f[i] < min.f[i] || hitthing->pos.f[i] > max.f[i]) {
ok = false;
}
} else {
hitthing->unk00.f[i] = sp88.f[i];
hitthing->pos.f[i] = sp88.f[i];
}
}
@ -15570,20 +15570,20 @@ void func0f0859a0(struct prop *prop, struct shotdata *shotdata)
}
if (var8005efc0 > 0.0f) {
hitpart = modelTestForHit(model, &shotdata->unk00, &shotdata->unk0c, &node1);
hitpart = modelTestForHit(model, &shotdata->gunpos2d, &shotdata->gundir2d, &node1);
while (hitpart > 0) {
if (func0f084594(model, node1, &shotdata->unk00, &shotdata->unk0c, &hitthing1, &spe4, &node2)) {
if (func0f084594(model, node1, &shotdata->gunpos2d, &shotdata->gundir2d, &hitthing1, &spe4, &node2)) {
break;
}
hitpart = modelTestForHit(model, &shotdata->unk00, &shotdata->unk0c, &node1);
hitpart = modelTestForHit(model, &shotdata->gunpos2d, &shotdata->gundir2d, &node1);
}
} else {
do {
hitpart = modelTestForHit(model, &shotdata->unk00, &shotdata->unk0c, &node1);
hitpart = modelTestForHit(model, &shotdata->gunpos2d, &shotdata->gundir2d, &node1);
if (hitpart > 0 && func0f0849dc(model, node1, &shotdata->unk00, &shotdata->unk0c, &hitthing1, &spe4, &node2)) {
if (hitpart > 0 && func0f0849dc(model, node1, &shotdata->gunpos2d, &shotdata->gundir2d, &hitthing1, &spe4, &node2)) {
break;
}
} while (hitpart > 0);
@ -15592,10 +15592,10 @@ void func0f0859a0(struct prop *prop, struct shotdata *shotdata)
if (obj->flags3 & OBJFLAG3_HOVERBEDSHIELD) {
node3 = modelGetPart(model->definition, MODELPART_0067);
if (node3 && func0f084594(model, node3, &shotdata->unk00, &shotdata->unk0c, &hitthing2, &sp90, &node4)) {
if (node3 && func0f084594(model, node3, &shotdata->gunpos2d, &shotdata->gundir2d, &hitthing2, &sp90, &node4)) {
if (hitpart <= 0 ||
model->matrices[sp90].m[0][2] * hitthing2.unk00.f[0] + model->matrices[sp90].m[1][2] * hitthing2.unk00.f[1] + model->matrices[sp90].m[2][2] * hitthing2.unk00.f[2] >
model->matrices[spe4].m[0][2] * hitthing1.unk00.f[0] + model->matrices[spe4].m[1][2] * hitthing1.unk00.f[1] + model->matrices[spe4].m[2][2] * hitthing1.unk00.f[2]) {
model->matrices[sp90].m[0][2] * hitthing2.pos.f[0] + model->matrices[sp90].m[1][2] * hitthing2.pos.f[1] + model->matrices[sp90].m[2][2] * hitthing2.pos.f[2] >
model->matrices[spe4].m[0][2] * hitthing1.pos.f[0] + model->matrices[spe4].m[1][2] * hitthing1.pos.f[1] + model->matrices[spe4].m[2][2] * hitthing1.pos.f[2]) {
hitpart = HITPART_LFOOT;
hitthing1 = hitthing2;
node1 = node3;
@ -15607,10 +15607,10 @@ void func0f0859a0(struct prop *prop, struct shotdata *shotdata)
}
if (hitpart > 0) {
mtx4TransformVec(&model->matrices[spe4], &hitthing1.unk00, &spd8);
mtx4TransformVec(&model->matrices[spe4], &hitthing1.pos, &spd8);
spd4 = -spd8.f[2];
if (spd4 <= shotdata->unk34) {
if (spd4 <= shotdata->distance) {
isnotglass = true;
if ((obj->flags & OBJFLAG_INVINCIBLE) == 0) {
@ -15626,7 +15626,7 @@ void func0f0859a0(struct prop *prop, struct shotdata *shotdata)
mtx4RotateVec(&model->matrices[spe4], &hitthing1.unk0c, &sp70);
mtx4RotateVecInPlace(camGetProjectionMtxF(), &sp70);
func0f061fa8(shotdata, prop, spd4, hitpart,
hitCreate(shotdata, prop, spd4, hitpart,
node1, &hitthing1, spe4, node2,
model, isnotglass && shotdata->gset.weaponnum != WEAPON_FARSIGHT,
(obj->flags2 & OBJFLAG2_BULLETPROOF)
@ -15637,7 +15637,7 @@ void func0f0859a0(struct prop *prop, struct shotdata *shotdata)
}
}
void func0f085e00(struct prop *prop, struct shotdata *shotdata)
void objTestHit(struct prop *prop, struct shotdata *shotdata)
{
f32 tmp;
struct defaultobj *obj = prop->obj;
@ -15649,7 +15649,7 @@ void func0f085e00(struct prop *prop, struct shotdata *shotdata)
&& (obj->flags2 & OBJFLAG2_SHOOTTHROUGH) == 0) {
tmp = -(model->matrices[0].m[3][2] + objGetRotatedLocalZMaxByMtx4(bbox, model->matrices));
if (tmp <= shotdata->unk34) {
if (tmp <= shotdata->distance) {
func0f0859a0(prop, shotdata);
}
}
@ -15663,7 +15663,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
u8 ismeleefunc = false;
s32 i;
bool explosiveshells = false;
bool spfc = hit->unk4c;
bool slowsbullet = hit->slowsbullet;
struct weaponfunc *func = gsetGetWeaponFunction(&shotdata->gset);
struct coord spec;
f32 tmp;
@ -15689,17 +15689,17 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
obj = hit->prop->obj;
sp110.x = shotdata->unk00.x - hit->distance * shotdata->unk0c.x / shotdata->unk0c.z;
sp110.y = shotdata->unk00.y - hit->distance * shotdata->unk0c.y / shotdata->unk0c.z;
sp110.z = shotdata->unk00.z - hit->distance;
sp110.x = shotdata->gunpos2d.x - hit->distance * shotdata->gundir2d.x / shotdata->gundir2d.z;
sp110.y = shotdata->gunpos2d.y - hit->distance * shotdata->gundir2d.y / shotdata->gundir2d.z;
sp110.z = shotdata->gunpos2d.z - hit->distance;
mtx4TransformVecInPlace(camGetProjectionMtxF(), &sp110);
if (!spfc && chrIsUsingPaintball(g_Vars.currentplayer->prop->chr)) {
spfc = true;
if (!slowsbullet && chrIsUsingPaintball(g_Vars.currentplayer->prop->chr)) {
slowsbullet = true;
}
if (hit->unk4c) {
if (hit->slowsbullet) {
bgunSetHitPos(&sp110);
}
@ -15711,7 +15711,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
&& shotdata->gset.weaponnum != WEAPON_FARSIGHT
#endif
) {
// For some penetrating weapons, unset hits beyond the shot distance?
// For some penetrating weapons, unset hits beyond the shot distance
spe4 = hit->prop;
mtx4TransformVec(obj->model->matrices, &sp110, &spec);
tmp = -spec.z;
@ -15722,7 +15722,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
}
}
shotdata->unk34 = tmp;
shotdata->distance = tmp;
}
}
@ -15737,20 +15737,20 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
// Create shield hit if object is shielded
if (hit->hitthing.texturenum == 10000) {
spdc[0] = hit->hitthing.unk00.x;
spdc[1] = hit->hitthing.unk00.y;
spdc[2] = hit->hitthing.unk00.z;
spdc[0] = hit->hitthing.pos.x;
spdc[1] = hit->hitthing.pos.y;
spdc[2] = hit->hitthing.pos.z;
shieldhitCreate(prop, (obj->flags3 & OBJFLAG3_SHOWSHIELD) ? 4.0f : 8.0f, hit->prop, hit->node, hit->model, hit->hitthing.unk28 / 2, spdc);
shieldhitCreate(prop, (obj->flags3 & OBJFLAG3_SHOWSHIELD) ? 4.0f : 8.0f, hit->prop, hit->bboxnode, hit->model, hit->hitthing.unk28 / 2, spdc);
}
// Increment object hit count
if (objIsHealthy(obj) && objIsMortal(obj) && hit->unk4c) {
if (objIsHealthy(obj) && objIsMortal(obj) && hit->slowsbullet) {
mpstatsIncrementPlayerShotCount2(&shotdata->gset, SHOTREGION_OBJECT);
}
// Play hit sound
if (!spfc) {
if (!slowsbullet) {
bgunPlayGlassHitSound(&hit->prop->pos, hit->prop->rooms, hit->hitthing.texturenum);
} else if (!ismeleefunc) {
bgunPlayPropHitSound(&shotdata->gset, hit->prop, hit->hitthing.texturenum);
@ -15763,7 +15763,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
&& shotdata->gset.weaponnum != WEAPON_LASER
&& shotdata->gset.weaponnum != WEAPON_TRANQUILIZER
&& shotdata->gset.weaponnum != WEAPON_FARSIGHT) {
if (hit->unk4c == 0) {
if (!hit->slowsbullet) {
struct prop *hitprop = hit->prop;
s8 iswindoweddoor = obj->model->definition->skel == &g_SkelWindowedDoor ? true : false;
@ -15776,7 +15776,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
textureindex += 10;
}
wallhitCreate(&hit->hitthing.unk00, &hit->hitthing.unk0c, &shotdata->gunpos, 0,
wallhitCreate(&hit->hitthing.pos, &hit->hitthing.unk0c, &shotdata->gunpos3d, 0,
0, textureindex, 1, hitprop, hit->mtxindex, iswindoweddoor, g_Vars.currentplayer->prop->chr, true);
} else {
s16 textureindex;
@ -15797,8 +15797,8 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
spc4 = false;
spcc = random() % surfacetype->numwallhittexes;
if ((obj->model->definition->skel == &g_SkelWindowedDoor && hit->unk44 == modelGetPart(obj->model->definition, MODELPART_WINDOWEDDOOR_0003))
|| (obj->model->definition->skel == &g_SkelCctv && hit->unk44 == modelGetPart(obj->model->definition, MODELPART_CCTV_LENS))) {
if ((obj->model->definition->skel == &g_SkelWindowedDoor && hit->dlnode == modelGetPart(obj->model->definition, MODELPART_WINDOWEDDOOR_0003))
|| (obj->model->definition->skel == &g_SkelCctv && hit->dlnode == modelGetPart(obj->model->definition, MODELPART_CCTV_LENS))) {
spcb = true;
}
@ -15815,7 +15815,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
spc4 = true;
}
wallhitCreate(&hit->hitthing.unk00, &hit->hitthing.unk0c, &shotdata->gunpos, 0,
wallhitCreate(&hit->hitthing.pos, &hit->hitthing.unk0c, &shotdata->gunpos3d, 0,
0, textureindex, 1, hit->prop, hit->mtxindex, spcb, g_Vars.currentplayer->prop->chr, spc4);
}
}
@ -15830,7 +15830,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
} else if (obj->type == OBJTYPE_CCTV) {
// Leftover from GE: shots to a CCTV's lens is a one hit kill
if (obj->model->definition->skel == &g_SkelCctv) {
if (modelGetPart(obj->model->definition, MODELPART_CCTV_LENS) == hit->unk44) {
if (modelGetPart(obj->model->definition, MODELPART_CCTV_LENS) == hit->dlnode) {
damage *= 100.0f;
cctvHandleLensShot(obj);
}
@ -15847,7 +15847,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
objTakeGunfire(obj, damage, &sp110, shotdata->gset.weaponnum, g_Vars.currentplayernum);
if (obj->model->definition->skel == &g_SkelWindowedDoor && !hit->unk4c) {
if (obj->model->definition->skel == &g_SkelWindowedDoor && !hit->slowsbullet) {
struct doorobj *door = (struct doorobj *)obj;
door->glasshits++;
@ -15867,16 +15867,16 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
struct coord pushdir;
Mtxf sp58;
spb0.x = shotdata->dir.x * 3.0f;
spb0.y = shotdata->dir.y * 3.0f;
spb0.z = shotdata->dir.z * 3.0f;
spb0.x = shotdata->gundir3d.x * 3.0f;
spb0.y = shotdata->gundir3d.y * 3.0f;
spb0.z = shotdata->gundir3d.z * 3.0f;
mtx4MultMtx4(camGetProjectionMtxF(), &obj->model->matrices[hit->mtxindex], &sp58);
mtx4TransformVec(&sp58, &hit->hitthing.unk00, &spa4);
mtx4TransformVec(&sp58, &hit->hitthing.pos, &spa4);
pushdir.x = shotdata->dir.x;
pushdir.y = shotdata->dir.y;
pushdir.z = shotdata->dir.z;
pushdir.x = shotdata->gundir3d.x;
pushdir.y = shotdata->gundir3d.y;
pushdir.z = shotdata->gundir3d.z;
func0f082e84(obj, &spa4, &pushdir, &spb0, true);
} else {
@ -15901,7 +15901,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
}
if (bounce) {
objBounce(obj, &shotdata->unk0c);
objBounce(obj, &shotdata->gundir2d);
}
}
}

View File

@ -162,13 +162,13 @@ s32 splatsCreate(s32 qty, f32 arg1, struct prop *prop, struct shotdata *shotdata
s32 j;
if (splattype == 0) {
dist = coordsGetDistance(&shotdata->gunpos, arg5);
dist = coordsGetDistance(&shotdata->gunpos3d, arg5);
for (i = 0; i < 3; i++) {
spfc.f[i] = shotdata->dir.f[i];
spf0.f[i] = shotdata->unk0c.f[i];
shotdata->gunpos.f[i] = arg5->f[i];
shotdata->unk00.f[i] = arg4->f[i];
spfc.f[i] = shotdata->gundir3d.f[i];
spf0.f[i] = shotdata->gundir2d.f[i];
shotdata->gunpos3d.f[i] = arg5->f[i];
shotdata->gunpos2d.f[i] = arg4->f[i];
}
} else {
f32 extraheight;
@ -181,21 +181,21 @@ s32 splatsCreate(s32 qty, f32 arg1, struct prop *prop, struct shotdata *shotdata
dist = 0.7f;
spfc.x = shotdata->dir.x = 0;
spfc.y = shotdata->dir.y = -1;
spfc.z = shotdata->dir.z = 0;
spfc.x = shotdata->gundir3d.x = 0;
spfc.y = shotdata->gundir3d.y = -1;
spfc.z = shotdata->gundir3d.z = 0;
spf0.x = shotdata->unk0c.x = 0;
spf0.y = shotdata->unk0c.y = -1;
spf0.z = shotdata->unk0c.z = 0;
spf0.x = shotdata->gundir2d.x = 0;
spf0.y = shotdata->gundir2d.y = -1;
spf0.z = shotdata->gundir2d.z = 0;
shotdata->gunpos.x = prop->pos.x;
shotdata->gunpos.y = prop->pos.y + extraheight;
shotdata->gunpos.z = prop->pos.z;
shotdata->gunpos3d.x = prop->pos.x;
shotdata->gunpos3d.y = prop->pos.y + extraheight;
shotdata->gunpos3d.z = prop->pos.z;
shotdata->unk00.x = prop->pos.x;
shotdata->unk00.y = prop->pos.y + extraheight;
shotdata->unk00.z = prop->pos.z;
shotdata->gunpos2d.x = prop->pos.x;
shotdata->gunpos2d.y = prop->pos.y + extraheight;
shotdata->gunpos2d.z = prop->pos.z;
}
for (i = 0; i < qty; i++) {
@ -204,15 +204,15 @@ s32 splatsCreate(s32 qty, f32 arg1, struct prop *prop, struct shotdata *shotdata
}
mtx4LoadRotation(&spe4, &spa4);
mtx4RotateVec(&spa4, &spfc, &shotdata->dir);
mtx4RotateVec(&spa4, &spf0, &shotdata->unk0c);
mtx4RotateVec(&spa4, &spfc, &shotdata->gundir3d);
mtx4RotateVec(&spa4, &spf0, &shotdata->gundir2d);
#if VERSION >= VERSION_NTSC_1_0
func0f177164(&shotdata->dir, &shotdata->dir, 403, "splat.c");
func0f177164(&shotdata->unk0c, &shotdata->unk0c, 404, "splat.c");
func0f177164(&shotdata->gundir3d, &shotdata->gundir3d, 403, "splat.c");
func0f177164(&shotdata->gundir2d, &shotdata->gundir2d, 404, "splat.c");
#else
func0f177164(&shotdata->dir, &shotdata->dir, 405, "splat.c");
func0f177164(&shotdata->unk0c, &shotdata->unk0c, 406, "splat.c");
func0f177164(&shotdata->gundir3d, &shotdata->gundir3d, 405, "splat.c");
func0f177164(&shotdata->gundir2d, &shotdata->gundir2d, 406, "splat.c");
#endif
if (splat0f149274(arg1, prop, shotdata, /*reused var*/ dist, isskedar, splattype, timermax, chr, timerspeed)) {
@ -262,33 +262,33 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
struct shotdata stackshotdata;
for (i = 0; i < 3; i++) {
stackshotdata.unk00.f[i] = shotdata->unk00.f[i];
stackshotdata.unk0c.f[i] = shotdata->unk0c.f[i];
stackshotdata.gunpos.f[i] = shotdata->gunpos.f[i];
stackshotdata.dir.f[i] = shotdata->dir.f[i];
stackshotdata.gunpos2d.f[i] = shotdata->gunpos2d.f[i];
stackshotdata.gundir2d.f[i] = shotdata->gundir2d.f[i];
stackshotdata.gunpos3d.f[i] = shotdata->gunpos3d.f[i];
stackshotdata.gundir3d.f[i] = shotdata->gundir3d.f[i];
}
stackshotdata.penetration = 1;
for (i = 0; i < 3; i++) {
endpos.f[i] = stackshotdata.gunpos.f[i] + stackshotdata.dir.f[i] * g_SplatMaxDistance;
endpos.f[i] = stackshotdata.gunpos3d.f[i] + stackshotdata.gundir3d.f[i] * g_SplatMaxDistance;
}
portal00018148(&chrprop->pos, &stackshotdata.gunpos, chrprop->rooms, gunrooms, NULL, 0);
portal00018148(&stackshotdata.gunpos, &endpos, gunrooms, endrooms, rooms, ARRAYCOUNT(rooms) - 1);
portal00018148(&chrprop->pos, &stackshotdata.gunpos3d, chrprop->rooms, gunrooms, NULL, 0);
portal00018148(&stackshotdata.gunpos3d, &endpos, gunrooms, endrooms, rooms, ARRAYCOUNT(rooms) - 1);
for (i = 0; rooms[i] != -1; i++) {
if (bgTestHitInRoom(&stackshotdata.gunpos, &endpos, rooms[i], &hitthing)
&& ((stackshotdata.gunpos.x <= endpos.x && hitthing.unk00.x <= endpos.x && stackshotdata.gunpos.x <= hitthing.unk00.x) || (endpos.x <= stackshotdata.gunpos.x && endpos.x <= hitthing.unk00.x && hitthing.unk00.x <= stackshotdata.gunpos.x))
&& ((stackshotdata.gunpos.y <= endpos.y && hitthing.unk00.y <= endpos.y && stackshotdata.gunpos.y <= hitthing.unk00.y) || (endpos.y <= stackshotdata.gunpos.y && endpos.y <= hitthing.unk00.y && hitthing.unk00.y <= stackshotdata.gunpos.y))
&& ((stackshotdata.gunpos.z <= endpos.z && hitthing.unk00.z <= endpos.z && stackshotdata.gunpos.z <= hitthing.unk00.z) || (endpos.z <= stackshotdata.gunpos.z && endpos.z <= hitthing.unk00.z && hitthing.unk00.z <= stackshotdata.gunpos.z))) {
if (stackshotdata.gunpos.x != hitthing.unk00.x || stackshotdata.gunpos.y != hitthing.unk00.y || stackshotdata.gunpos.z != hitthing.unk00.z) {
if (bgTestHitInRoom(&stackshotdata.gunpos3d, &endpos, rooms[i], &hitthing)
&& ((stackshotdata.gunpos3d.x <= endpos.x && hitthing.pos.x <= endpos.x && stackshotdata.gunpos3d.x <= hitthing.pos.x) || (endpos.x <= stackshotdata.gunpos3d.x && endpos.x <= hitthing.pos.x && hitthing.pos.x <= stackshotdata.gunpos3d.x))
&& ((stackshotdata.gunpos3d.y <= endpos.y && hitthing.pos.y <= endpos.y && stackshotdata.gunpos3d.y <= hitthing.pos.y) || (endpos.y <= stackshotdata.gunpos3d.y && endpos.y <= hitthing.pos.y && hitthing.pos.y <= stackshotdata.gunpos3d.y))
&& ((stackshotdata.gunpos3d.z <= endpos.z && hitthing.pos.z <= endpos.z && stackshotdata.gunpos3d.z <= hitthing.pos.z) || (endpos.z <= stackshotdata.gunpos3d.z && endpos.z <= hitthing.pos.z && hitthing.pos.z <= stackshotdata.gunpos3d.z))) {
if (stackshotdata.gunpos3d.x != hitthing.pos.x || stackshotdata.gunpos3d.y != hitthing.pos.y || stackshotdata.gunpos3d.z != hitthing.pos.z) {
bestroom = rooms[i];
besthitthing = hitthing;
endpos.x = hitthing.unk00.x;
endpos.y = hitthing.unk00.y;
endpos.z = hitthing.unk00.z;
endpos.x = hitthing.pos.x;
endpos.y = hitthing.pos.y;
endpos.z = hitthing.pos.z;
hasresult = true;
break;
@ -297,11 +297,11 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
}
if (hasresult) {
spraydistance = coordsGetDistance(&stackshotdata.gunpos, &besthitthing.unk00);
spraydistance = coordsGetDistance(&stackshotdata.gunpos3d, &besthitthing.pos);
if (spraydistance < g_SplatMaxDistance) {
sp50c = &hitthing.unk00;
hitpos = &hitthing.unk00;
sp50c = &hitthing.pos;
hitpos = &hitthing.pos;
sp504 = &hitthing.unk0c;
objprop = NULL;
mtxindex = 0;
@ -316,13 +316,13 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
}
if (splattype == 0) {
stackshotdata.unk34 = (spraydistance < g_SplatMaxDistance ? spraydistance : g_SplatMaxDistance);
stackshotdata.unk34 += arg3;
stackshotdata.distance = (spraydistance < g_SplatMaxDistance ? spraydistance : g_SplatMaxDistance);
stackshotdata.distance += arg3;
for (i = 0; i < ARRAYCOUNT(stackshotdata.hits); i++) {
stackshotdata.hits[i].prop = NULL;
stackshotdata.hits[i].hitpart = 0;
stackshotdata.hits[i].node = NULL;
stackshotdata.hits[i].bboxnode = NULL;
}
propptr = g_Vars.endonscreenprops - 1;
@ -332,7 +332,7 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
if (prop) {
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR || prop->type == PROPTYPE_WEAPON) {
func0f085e00(prop, &stackshotdata);
objTestHit(prop, &stackshotdata);
if (1);
}
}
@ -346,7 +346,7 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
if (hit->prop && (hit->hitthing.texturenum < 0
|| hit->hitthing.texturenum >= NUM_TEXTURES
|| g_SurfaceTypes[g_Textures[hit->hitthing.texturenum].surfacetype]->numwallhittexes != 0)) {
sp50c = &hit->hitthing.unk00;
sp50c = &hit->hitthing.pos;
hitpos = &hit->pos;
sp504 = &hit->hitthing.unk0c;
objprop = hit->prop;
@ -366,7 +366,7 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
for (i = 0; i < 3; i++) {
splatdata.relpos.f[i] = sp50c->f[i];
splatdata.unk0c.f[i] = hitpos->f[i];
splatdata.gunpos.f[i] = stackshotdata.gunpos.f[i];
splatdata.gunpos.f[i] = stackshotdata.gunpos3d.f[i];
splatdata.unk18.f[i] = sp504->f[i];
}
@ -387,9 +387,9 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
return true;
}
if (hitthing.unk00.x);
if (hitthing.unk00.y);
if (hitthing.unk00.z);
if (hitthing.pos.x);
if (hitthing.pos.y);
if (hitthing.pos.z);
return false;
}

View File

@ -947,6 +947,9 @@
#define FILETYPE_MPPLAYER 2
#define FILETYPE_CAMERA 3
#define FINDPROPCONTEXT_QUERY 0
#define FINDPROPCONTEXT_SHOOT 2
#define FLOORTYPE_DEFAULT 0
#define FLOORTYPE_WOOD 1
#define FLOORTYPE_STONE 2

View File

@ -9,7 +9,7 @@ void camSetScreenPosition(f32 left, f32 top);
void camSetPerspective(f32 near, f32 fovy, f32 aspect);
f32 cam0f0b49b8(f32 arg0);
void camSetScale(void);
void cam0f0b4c3c(f32 *crosspos, struct coord *dst, f32 arg2);
void cam0f0b4c3c(f32 pos2d[2], struct coord *dir2d, f32 arg2);
void cam0f0b4d04(struct coord *in, f32 *out);
void cam0f0b4d68(struct coord *in, f32 out[2]);
void cam0f0b4dec(struct coord *in, f32 out[2]);

View File

@ -45,8 +45,8 @@ void chrEmitSparks(struct chrdata *chr, struct prop *prop, s32 hitpart, struct c
void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struct coord *arg3);
void chrBruise(struct model *model, s32 hitpart, struct modelnode *node, struct coord *arg3);
void chrDisfigure(struct chrdata *chr, struct coord *exppos, f32 damageradius);
f32 chr0f0278a4(struct chrdata *chr);
void chr0f027994(struct prop *prop, struct shotdata *shotdata, bool arg2, bool arg3);
f32 chrGetHitRadius(struct chrdata *chr);
void chrTestHit(struct prop *prop, struct shotdata *shotdata, bool isshooting, bool cheap);
void chrHit(struct shotdata *shotdata, struct hit *hit);
void chr0f028498(bool value);
void chrsCheckForNoise(f32 noiseradius);

View File

@ -24,10 +24,10 @@ Gfx *propRender(Gfx *gdl, struct prop *prop, bool xlupass);
Gfx *propsRender(Gfx *gdl, RoomNum renderroomnum, s32 renderpass, RoomNum *roomnumsbyprop);
void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop);
void func0f060bac(s32 weaponnum, struct prop *prop);
struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struct coord *arg3, struct coord *gunpos, struct coord *dir, u32 arg6, f32 arg7, bool arg8);
struct prop *func0f061d54(s32 handnum, u32 arg1, u32 arg2);
void shotCreate(s32 handnum, bool arg1, bool dorandom, s32 arg3, bool arg4);
void func0f061fa8(struct shotdata *shotdata, struct prop *prop, f32 arg2, s32 hitpart, struct modelnode *node, struct hitthing *hitthing, s32 arg6, struct modelnode *arg7, struct model *model, bool arg9, s32 arg10, struct coord *arg11, struct coord *arg12);
struct prop *shotCalculateHits(s32 handnum, bool isshooting, struct coord *gunpos2d, struct coord *gundir2d, struct coord *gunpos3d, struct coord *gundir3d, u32 arg6, f32 distance, bool arg8);
struct prop *propFindAimingAt(s32 handnum, bool isshooting, u32 context);
void shotCreate(s32 handnum, bool arg1, bool dorandom, s32 numshots, bool arg4);
void hitCreate(struct shotdata *shotdata, struct prop *prop, f32 hitdistance, s32 hitpart, struct modelnode *bboxnode, struct hitthing *hitthing, s32 arg6, struct modelnode *dlnode, struct model *model, bool slowsbullet, bool bulletproof, struct coord *arg11, struct coord *arg12);
void handInflictMeleeDamage(s32 handnum, struct gset *gset, bool arg2);
void handTickAttack(s32 handnum);
void handsTickAttack(void);

View File

@ -211,7 +211,7 @@ Gfx *objRenderShadow(struct defaultobj *obj, Gfx *gdl);
Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass);
bool modelIsNodeNotTvscreen(struct modeldef *modeldef, struct modelnode *node);
void objDeform(struct defaultobj *obj, s32 level);
void objBounce(struct defaultobj *obj, struct coord *arg1);
void objBounce(struct defaultobj *obj, struct coord *gundir2d);
void objSetDropped(struct prop *prop, u32 droptype);
void objApplyMomentum(struct defaultobj *obj, struct coord *speed, f32 rotation, bool addspeed, bool addrotation);
void piracyRestore(void);
@ -233,7 +233,7 @@ bool objIsMortal(struct defaultobj *obj);
void objTakeGunfire(struct defaultobj *obj, f32 damage, struct coord *pos, s32 weaponnum, s32 playernum);
void objDamage(struct defaultobj *obj, f32 damage, struct coord *pos, s32 weaponnum, s32 playernum);
void func0f0859a0(struct prop *prop, struct shotdata *shotdata);
void func0f085e00(struct prop *prop, struct shotdata *shotdata);
void objTestHit(struct prop *prop, struct shotdata *shotdata);
void objHit(struct shotdata *shotdata, struct hit *hit);
u32 propobjGetCiTagId(struct prop *prop);
bool objIsHealthy(struct defaultobj *obj);

View File

@ -5662,7 +5662,7 @@ struct warpparams {
};
struct hitthing {
struct coord unk00;
struct coord pos; // world pos
struct coord unk0c;
Vtx *unk18;
Vtx *unk1c;
@ -5677,24 +5677,24 @@ struct hit {
/*0x00*/ f32 distance;
/*0x04*/ struct prop *prop;
/*0x08*/ s32 hitpart;
/*0x0c*/ struct modelnode *node;
/*0x0c*/ struct modelnode *bboxnode;
/*0x10*/ struct hitthing hitthing;
/*0x40*/ s32 mtxindex;
/*0x44*/ struct modelnode *unk44;
/*0x44*/ struct modelnode *dlnode;
/*0x48*/ struct model *model;
/*0x4c*/ s8 unk4c;
/*0x4d*/ s8 unk4d;
/*0x4c*/ s8 slowsbullet;
/*0x4d*/ s8 bulletproof;
/*0x50*/ struct coord pos;
/*0x5c*/ struct coord dir;
};
struct shotdata {
/*0x00*/ struct coord unk00;
/*0x0c*/ struct coord unk0c;
/*0x00*/ struct coord gunpos2d;
/*0x0c*/ struct coord gundir2d;
/*0x18*/ struct gset gset;
/*0x1c*/ struct coord gunpos;
/*0x28*/ struct coord dir;
/*0x34*/ f32 unk34;
/*0x1c*/ struct coord gunpos3d;
/*0x28*/ struct coord gundir3d;
/*0x34*/ f32 distance;
/*0x38*/ s32 penetration;
/*0x3c*/ struct hit hits[10];
};