Improve naming and documentation of inventory data

This commit is contained in:
Ryan Dwyer
2022-10-22 18:42:45 +10:00
parent 4d04f1f282
commit b159e01edc
18 changed files with 2200 additions and 2100 deletions
+82 -84
View File
@@ -453,22 +453,22 @@ void bgunTickUnequippedReload(void)
}
}
bool bgun0f097df0(struct inventory_typef *arg0, struct hand *hand)
bool bgunTestGunVisCommand(struct gunviscmd *cmd, struct hand *hand)
{
bool result = true;
switch (arg0->unk00) {
case 4:
if (((hand->gset.unk0639 >> arg0->unk02) & 1) == 0) {
switch (cmd->type) {
case GUNVISCMD_CHECKUPGRADE:
if (((hand->gset.unk0639 >> cmd->param) & 1) == 0) {
result = false;
}
break;
case 5:
case GUNVISCMD_CHECKINLEFTHAND:
if (hand != &g_Vars.currentplayer->hands[HAND_LEFT]) {
result = false;
}
break;
case 6:
case GUNVISCMD_CHECKINRIGHTHAND:
if (hand != &g_Vars.currentplayer->hands[HAND_RIGHT]) {
result = false;
}
@@ -503,37 +503,37 @@ void bgunSetPartVisible(s16 partnum, bool visible, struct hand *hand, struct mod
}
}
void bgun0f097f28(struct hand *hand, struct modelfiledata *filedata, struct inventory_typef *arg2)
void bgunExecuteGunVisCommands(struct hand *hand, struct modelfiledata *filedata, struct gunviscmd *commands)
{
struct inventory_typef *thing = arg2;
struct gunviscmd *cmd = commands;
bool done = false;
if (thing == NULL) {
if (cmd == NULL) {
return;
}
while (!done) {
if (bgun0f097df0(thing, hand)) {
if (thing->unk04 == 0) {
bgunSetPartVisible(thing->partnum, true, hand, filedata);
if (bgunTestGunVisCommand(cmd, hand)) {
if (cmd->op == GUNVISOP_IFTRUE_SETVISIBLE) {
bgunSetPartVisible(cmd->partnum, true, hand, filedata);
}
if (thing->unk04 == 1) {
bgunSetPartVisible(thing->partnum, false, hand, filedata);
if (cmd->op == GUNVISOP_IFTRUE_SETHIDDEN) {
bgunSetPartVisible(cmd->partnum, false, hand, filedata);
}
if (thing->unk04 == 3) {
bgunSetPartVisible(thing->partnum, true, hand, filedata);
if (cmd->op == GUNVISOP_SETVISIBILITY) {
bgunSetPartVisible(cmd->partnum, true, hand, filedata);
}
} else {
if (thing->unk04 == 3) {
bgunSetPartVisible(thing->partnum, false, hand, filedata);
if (cmd->op == GUNVISOP_SETVISIBILITY) {
bgunSetPartVisible(cmd->partnum, false, hand, filedata);
}
}
thing++;
cmd++;
if (thing->unk00 == 0) {
if (cmd->type == GUNVISCMD_END) {
done = true;
}
}
@@ -545,7 +545,7 @@ void bgun0f098030(struct hand *hand, struct modelfiledata *filedata)
s32 i;
s32 j;
bgun0f097f28(hand, filedata, weapon->fptr);
bgunExecuteGunVisCommands(hand, filedata, weapon->gunviscmds);
bgunSetPartVisible(MODELPART_0042, false, hand, filedata);
for (i = 0; i < 2; i++) {
@@ -1216,7 +1216,7 @@ s32 bgunTickIncIdle(struct handweaponinfo *info, s32 handnum, struct hand *hand,
// Attempted to shoot with no ammo
// Consider switching to another weapon
if (weaponHasFlag(info->weaponnum, WEAPONFLAG_00000001)
if (weaponHasFlag(info->weaponnum, WEAPONFLAG_THROWABLE)
&& (info->weaponnum != WEAPON_REMOTEMINE || handnum != HAND_LEFT)
&& bgunSetState(handnum, HANDSTATE_AUTOSWITCH)) {
return lvupdate;
@@ -1745,9 +1745,9 @@ s32 bgun0f09a3f8(struct hand *hand, struct weaponfunc *func)
if ((func->type & 0xff00) == 0x100) {
struct weaponfunc_shootauto *autofunc = (struct weaponfunc_shootauto *) func;
if (autofunc->unk50 > 0) {
if (autofunc->turretaccel > 0) {
if (hand->gs_float1 < 1) {
hand->gs_float1 += LVUPDATE60FREAL() / autofunc->unk50;
hand->gs_float1 += LVUPDATE60FREAL() / autofunc->turretaccel;
if (hand->gs_float1 > 1) {
hand->gs_float1 = 1;
@@ -1798,14 +1798,12 @@ s32 bgun0f09a3f8(struct hand *hand, struct weaponfunc *func)
return 2;
}
if ((func->type & 0xff00) == 0x100) {
// This is similar to the earlier code, but uses unk51
// and subtracts the timer instead of adding to it.
if ((func->type & 0xff00) == (INVENTORYFUNCTYPE_SHOOT_AUTOMATIC & 0xff00)) {
struct weaponfunc_shootauto *autofunc = (struct weaponfunc_shootauto *) func;
if (autofunc->unk51 > 0) {
if (autofunc->turretdecel > 0) {
if (hand->gs_float1 > 0) {
hand->gs_float1 -= LVUPDATE60FREAL() / autofunc->unk51;
hand->gs_float1 -= LVUPDATE60FREAL() / autofunc->turretdecel;
if (hand->gs_float1 < 0) {
hand->gs_float1 = 0;
@@ -1841,7 +1839,7 @@ void bgun0f09a6f8(struct handweaponinfo *info, s32 handnum, struct hand *hand, s
f32 tmp;
f32 tmp2;
tmp = autofunc->initialfirerate + (autofunc->maxfirerate - autofunc->initialfirerate) * hand->gs_float1;
tmp = autofunc->initialrpm + (autofunc->maxrpm - autofunc->initialrpm) * hand->gs_float1;
tmp2 = tmp / 60.0f * (LVUPDATE60FREAL() / 60.0f) + hand->shotremainder;
hand->shotstotake = tmp2;
@@ -1972,12 +1970,12 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
s32 sum;
s32 unk26;
s32 unk27;
s32 unk18;
s32 recoverytime60;
s32 frames;
struct weapon *weapondef;
f32 mult1;
f32 recoil;
f32 unk2c;
f32 recoildist;
f32 recoilangle;
f32 mult2;
u32 stack;
@@ -1986,7 +1984,7 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
unk25 = func->unk25;
unk26 = func->unk26;
unk27 = func->unk27;
unk18 = func->unk18;
recoverytime60 = func->recoverytime60;
weapondef = info->definition;
if (unk24 >= 4) {
@@ -2005,8 +2003,8 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
unk27 = TICKS(unk27);
}
if (unk18 >= 4) {
unk18 = TICKS(unk18);
if (recoverytime60 >= 4) {
recoverytime60 = TICKS(recoverytime60);
}
sum = unk24 + unk25;
@@ -2015,7 +2013,7 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
unk25 = func->unk25;
unk26 = func->unk26;
unk27 = func->unk27;
unk18 = func->unk18;
recoverytime60 = func->recoverytime60;
weapondef = info->definition;
sum = unk24 + unk25;
#else
@@ -2024,7 +2022,7 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
sum = unk24 + unk25;
unk26 = func->unk26;
unk27 = func->unk27;
unk18 = func->unk18;
recoverytime60 = func->recoverytime60;
weapondef = info->definition;
#endif
@@ -2076,8 +2074,8 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
}
if (frames < sum && (hand->stateflags & HANDSTATEFLAG_00000040) == 0) {
recoil = func->recoil;
unk2c = func->unk2c;
recoildist = func->recoildist;
recoilangle = func->recoilangle;
if ((hand->stateflags & HANDSTATEFLAG_00000080) == 0) {
hand->stateflags |= HANDSTATEFLAG_00000080;
@@ -2087,11 +2085,11 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
hand->posstart.z = hand->posoffset.z;
}
hand->rotxend = M_BADTAU - (unk2c * M_BADTAU) / 360.0f;
hand->rotxend = M_BADTAU - (recoilangle * M_BADTAU) / 360.0f;
hand->posend.x = (func0f0b131c(handnum) - hand->aimpos.x) * recoil / 1000.0f;
hand->posend.x = (func0f0b131c(handnum) - hand->aimpos.x) * recoildist / 1000.0f;
hand->posend.y = 0;
hand->posend.z = (weapondef->frontback - hand->aimpos.z) * recoil / 1000.0f;
hand->posend.z = (weapondef->posz - hand->aimpos.z) * recoildist / 1000.0f;
if (frames < unk24) {
mult2 = sinf(frames * 1.5707963705063f / (f32)unk24);
@@ -2114,7 +2112,7 @@ bool bgun0f09aba4(struct hand *hand, struct handweaponinfo *info, s32 handnum, s
if (sum <= frames) {
if (unk27 >= 0 && hand->triggerreleased && hand->triggeron) {
return true;
} else if (sum + unk18 <= frames) {
} else if (sum + recoverytime60 <= frames) {
return true;
}
}
@@ -2167,11 +2165,11 @@ bool bgunTickIncAttackingShoot(struct handweaponinfo *info, s32 handnum, struct
if ((func->type & 0xff00) == 0x100) {
struct weaponfunc_shootauto *autofunc = (struct weaponfunc_shootauto *) func;
f32 auStack68[12];
f32 floats[12];
if (autofunc->unk48 != NULL && autofunc->unk4c != NULL) {
func0f097b64(autofunc->unk48, autofunc->unk4c, hand->gs_float1, auStack68);
func0f097b40(hand->upgrademult, auStack68, hand->finalmult);
if (autofunc->vibrationstart != NULL && autofunc->vibrationmax != NULL) {
func0f097b64(autofunc->vibrationstart, autofunc->vibrationmax, hand->gs_float1, floats);
func0f097b40(hand->upgrademult, floats, hand->finalmult);
}
}
@@ -2468,7 +2466,7 @@ bool bgunTickIncAttackingSpecial(struct hand *hand)
}
if (hand->stateminor == 2) {
if (hand->stateframes > TICKS(func->unk18)) {
if (hand->stateframes > TICKS(func->recoverytime60)) {
return true;
}
@@ -2792,7 +2790,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand *
if (hand->stateminor == 0) {
bool skipanim = false;
if (weaponHasFlag(info->weaponnum, WEAPONFLAG_00000001)
if (weaponHasFlag(info->weaponnum, WEAPONFLAG_THROWABLE)
&& (info->weaponnum != WEAPON_REMOTEMINE || handnum != HAND_LEFT)
&& bgun0f098ca0(0, info, hand) < 0) {
skipanim = true;
@@ -2933,7 +2931,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand *
bgun0f098f8c(info, hand);
if (weaponHasFlag(info->weaponnum, WEAPONFLAG_00000001)
if (weaponHasFlag(info->weaponnum, WEAPONFLAG_THROWABLE)
&& (info->weaponnum != WEAPON_REMOTEMINE || handnum != HAND_LEFT)
&& bgun0f098ca0(0, info, hand) < 0
&& bgunSetState(handnum, HANDSTATE_AUTOSWITCH)) {
@@ -3302,8 +3300,8 @@ void bgunDecreaseNoiseRadius(void)
}
}
subamount = g_Vars.lvupdate60freal * noisesettingsright.incradius / (noisesettingsright.unk0c * 60.0f);
consideramount = (player->hands[HAND_RIGHT].noiseradius - noisesettingsright.minradius) * g_Vars.lvupdate60freal / (noisesettingsright.unk10 * 60.0f);
subamount = g_Vars.lvupdate60freal * noisesettingsright.incradius / (noisesettingsright.decbasespeed * 60.0f);
consideramount = (player->hands[HAND_RIGHT].noiseradius - noisesettingsright.minradius) * g_Vars.lvupdate60freal / (noisesettingsright.decremspeed * 60.0f);
if (consideramount > subamount) {
subamount = consideramount;
@@ -3324,8 +3322,8 @@ void bgunDecreaseNoiseRadius(void)
}
}
subamount = g_Vars.lvupdate60freal * noisesettingsleft.incradius / (noisesettingsleft.unk0c * 60.0f);
consideramount = (player->hands[HAND_LEFT].noiseradius - noisesettingsleft.minradius) * g_Vars.lvupdate60freal / (noisesettingsleft.unk10 * 60.0f);
subamount = g_Vars.lvupdate60freal * noisesettingsleft.incradius / (noisesettingsleft.decbasespeed * 60.0f);
consideramount = (player->hands[HAND_LEFT].noiseradius - noisesettingsleft.minradius) * g_Vars.lvupdate60freal / (noisesettingsleft.decremspeed * 60.0f);
if (consideramount > subamount) {
subamount = consideramount;
@@ -3343,20 +3341,20 @@ void bgunCalculateBlend(s32 handnum)
s32 sp60[2];
s32 sp58[2];
struct weapon *weapon = weaponFindById(bgunGetWeaponNum(handnum));
f32 mult = weapon->unk38;
f32 sway = weapon->sway;
struct player *player = g_Vars.currentplayer;
sp60[handnum] = (player->hands[handnum].curblendpos + 2) % 4;
sp58[handnum] = (player->hands[handnum].curblendpos + 1) % 4;
player->hands[handnum].curblendpos = sp58[handnum];
player->hands[handnum].blendlook[sp60[handnum]].x = (RANDOMFRAC() - 0.5f) * 0.08f * mult;
player->hands[handnum].blendlook[sp60[handnum]].y = (RANDOMFRAC() - 0.5f) * 0.1f * mult;
player->hands[handnum].blendlook[sp60[handnum]].x = (RANDOMFRAC() - 0.5f) * 0.08f * sway;
player->hands[handnum].blendlook[sp60[handnum]].y = (RANDOMFRAC() - 0.5f) * 0.1f * sway;
player->hands[handnum].blendlook[sp60[handnum]].z = -1;
player->hands[handnum].blendup[sp60[handnum]].x = (RANDOMFRAC() - 0.5f) * 0.1f * mult;
player->hands[handnum].blendup[sp60[handnum]].x = (RANDOMFRAC() - 0.5f) * 0.1f * sway;
player->hands[handnum].blendup[sp60[handnum]].y = 1;
player->hands[handnum].blendup[sp60[handnum]].z = (RANDOMFRAC() - 0.5f) * 0.1f * mult;
player->hands[handnum].blendup[sp60[handnum]].z = (RANDOMFRAC() - 0.5f) * 0.1f * sway;
player->hands[handnum].blendpos[sp60[handnum]].x = (RANDOMFRAC() * 0.75f) + 1.5f;
player->hands[handnum].blendpos[sp60[handnum]].y = (2 + RANDOMFRAC()) * player->hands[handnum].blendscale1;
@@ -4715,8 +4713,8 @@ void bgunCreateFiredProjectile(s32 handnum)
spawnpos.z += 50.0f * sp1f8.z;
}
sp260 = funcdef->unk4c * 1.6666666f / 60.0f;
sp25c = funcdef->unk54 * 1.6666666f;
sp260 = funcdef->speed * 1.6666666f / 60.0f;
sp25c = funcdef->traveldist * 1.6666666f;
if (gsetHasFunctionFlags(&hand->gset, FUNCFLAG_CALCULATETRAJECTORY)) {
func0f061d54(0, 0, 0);
@@ -4864,7 +4862,7 @@ void bgunCreateFiredProjectile(s32 handnum)
weapon->base.projectile->unk014 = sp250.y;
weapon->base.projectile->unk018 = sp250.z;
weapon->base.projectile->pickuptimer240 = TICKS(240);
weapon->base.projectile->unk08c = funcdef->unk5c;
weapon->base.projectile->unk08c = funcdef->reflectangle;
weapon->base.projectile->unk098 = funcdef->unk50 * 1.6666666f;
if (funcdef->soundnum > 0) {
@@ -4940,7 +4938,7 @@ void bgunCreateFiredProjectile(s32 handnum)
weapon->base.projectile->unk014 = sp250.y;
weapon->base.projectile->unk018 = sp250.z;
weapon->base.projectile->pickuptimer240 = TICKS(240);
weapon->base.projectile->unk08c = funcdef->unk5c;
weapon->base.projectile->unk08c = funcdef->reflectangle;
weapon->base.projectile->unk098 = funcdef->unk50 * 1.6666666f;
if (funcdef->soundnum > 0) {
@@ -5132,7 +5130,7 @@ void bgunSwivel(f32 screenx, f32 screeny, f32 crossdamp, f32 aimdamp)
void bgunSwivelWithDamp(f32 screenx, f32 screeny, f32 crossdamp)
{
struct weapon *weapon = weaponFindById(bgunGetWeaponNum(HAND_RIGHT));
f32 aimdamp = PAL ? weapon->eptr->unk10 : weapon->eptr->unk14;
f32 aimdamp = PAL ? weapon->aimsettings->aimdamppal : weapon->aimsettings->aimdamp;
if (aimdamp < crossdamp) {
aimdamp = crossdamp;
@@ -5150,7 +5148,7 @@ void bgunSwivelWithDamp(f32 screenx, f32 screeny, f32 crossdamp)
void bgunSwivelWithoutDamp(f32 screenx, f32 screeny)
{
struct weapon *weapon = weaponFindById(bgunGetWeaponNum(HAND_RIGHT));
f32 aimdamp = PAL ? weapon->eptr->unk10 : weapon->eptr->unk14;
f32 aimdamp = PAL ? weapon->aimsettings->aimdamppal : weapon->aimsettings->aimdamp;
bgunSwivel(screenx, screeny, PAL ? 0.935f : 0.945f, aimdamp);
}
@@ -5196,7 +5194,7 @@ void bgunCalculatePlayerShotSpread(struct coord *arg0, struct coord *arg1, s32 h
}
// Unsure what this is
if (weaponHasClassFlag(bgunGetWeaponNum2(handnum), WEAPONCLASSFLAG_00000004)
if (weaponHasAimFlag(bgunGetWeaponNum2(handnum), INVAIMFLAG_ACCURATESINGLESHOT)
&& player->hands[handnum].burstbullets == 1) {
spread *= 0.25f;
}
@@ -5258,7 +5256,7 @@ void bgunCalculateBotShotSpread(struct coord *arg0, s32 weaponnum, s32 funcnum,
}
}
if (arg3 && weaponHasClassFlag(weaponnum, WEAPONCLASSFLAG_00000004)) {
if (arg3 && weaponHasAimFlag(weaponnum, INVAIMFLAG_ACCURATESINGLESHOT)) {
spread *= 0.25f;
}
@@ -6223,7 +6221,7 @@ void bgunDisarm(struct prop *attackerprop)
s32 i;
bool drop;
if (!weaponHasFlag(weaponnum, WEAPONFLAG_08000000) && weaponnum <= WEAPON_RCP45) {
if (!weaponHasFlag(weaponnum, WEAPONFLAG_UNDROPPABLE) && weaponnum <= WEAPON_RCP45) {
#if VERSION >= VERSION_NTSC_1_0
// Coop must not allow player to drop a mission critical weapon
// because AI lists can fail the mission if the player has zero
@@ -7246,14 +7244,14 @@ void bgun0f0a4e44(struct hand *hand, struct weapon *weapondef, struct modelfiled
s32 i;
s32 partnum;
f32 spb4;
f32 sway;
f32 muzzlez;
Mtxf sp70;
index = hand->burstbullets % maxburst;
shotstotake = hand->shotstotake;
spb4 = RANDOMFRAC() * 0.25f + 1.0f;
sway = weapondef->sway;
muzzlez = weapondef->muzzlez;
mtx4LoadIdentity(&spd8);
@@ -7268,7 +7266,7 @@ void bgun0f0a4e44(struct hand *hand, struct weapon *weapondef, struct modelfiled
mtx4MultMtx4InPlace(mtx, &spd8);
mtx00015f04(spb4, &spd8);
mtx00015ea8(sway, &spd8);
mtx00015ea8(muzzlez, &spd8);
mtx4Copy(&spd8, mtx);
if (shotstotake == 0 && weaponnum != WEAPON_REAPER) {
@@ -7310,7 +7308,7 @@ void bgun0f0a4e44(struct hand *hand, struct weapon *weapondef, struct modelfiled
mtx00016e98(arg10->m, 0, mtx->m[3][0] - hand->aimpos.x, mtx->m[3][1] - hand->aimpos.y, mtx->m[3][2] - hand->aimpos.z);
mtx4MultMtx4InPlace(arg10, &sp70);
mtx00016710(sway, sp70.m);
mtx00016710(muzzlez, sp70.m);
mtx4MultMtx4InPlace(arg9, &sp70);
mtx4SetTranslation(&sp60, &sp70);
@@ -7504,33 +7502,33 @@ void bgun0f0a5550(s32 handnum)
if (handnum == HAND_RIGHT) {
sp274.x = func0f0b131c(handnum) + hand->damppos.f[0] + hand->adjustpos.f[0];
sp274.y = weapondef->updown + hand->damppos.f[1] + hand->adjustpos.f[1];
sp274.z = weapondef->frontback + hand->damppos.f[2] + hand->adjustpos.f[2];
sp274.y = weapondef->posy + hand->damppos.f[1] + hand->adjustpos.f[1];
sp274.z = weapondef->posz + hand->damppos.f[2] + hand->adjustpos.f[2];
} else if (isdetonator) {
sp274.x = 6.5f + hand->damppos.f[0] - hand->adjustpos.f[0];
sp274.y = -16.5f + hand->damppos.f[1] + hand->adjustpos.f[1];
sp274.z = -16.0f + hand->damppos.f[2] + hand->adjustpos.f[2];
} else {
sp274.x = func0f0b131c(handnum) + hand->damppos.f[0] - hand->adjustpos.f[0];
sp274.y = weapondef->updown + hand->damppos.f[1] + hand->adjustpos.f[1];
sp274.z = weapondef->frontback + hand->damppos.f[2] + hand->adjustpos.f[2];
sp274.y = weapondef->posy + hand->damppos.f[1] + hand->adjustpos.f[1];
sp274.z = weapondef->posz + hand->damppos.f[2] + hand->adjustpos.f[2];
}
sp274.y += player->guncloseroffset * 5.0f / -90.0f * 50.0f;
sp274.z -= player->guncloseroffset * 15.0f / -90.0f * 50.0f;
if (hand->firing && shootfunc && g_Vars.lvupdate240 != 0 && shootfunc->unk14 != NULL) {
sp274.x += (RANDOMFRAC() - 0.5f) * shootfunc->unk14->minradius * hand->finalmult[0];
sp274.y += (RANDOMFRAC() - 0.5f) * shootfunc->unk14->maxradius * hand->finalmult[0];
sp274.z += (RANDOMFRAC() - 0.5f) * shootfunc->unk14->incradius * hand->finalmult[0];
if (hand->firing && shootfunc && g_Vars.lvupdate240 != 0 && shootfunc->recoilsettings != NULL) {
sp274.x += (RANDOMFRAC() - 0.5f) * shootfunc->recoilsettings->xrange * hand->finalmult[0];
sp274.y += (RANDOMFRAC() - 0.5f) * shootfunc->recoilsettings->yrange * hand->finalmult[0];
sp274.z += (RANDOMFRAC() - 0.5f) * shootfunc->recoilsettings->zrange * hand->finalmult[0];
}
hand->fspare1 = (player->crosspos2[0] - camGetScreenLeft() - camGetScreenWidth() * 0.5f) * weapondef->eptr->unk0c / (camGetScreenWidth() * 0.5f);
hand->fspare1 = (player->crosspos2[0] - camGetScreenLeft() - camGetScreenWidth() * 0.5f) * weapondef->aimsettings->guntransside / (camGetScreenWidth() * 0.5f);
if (player->crosspos2[1] - camGetScreenTop() > camGetScreenHeight() * 0.5f) {
hand->fspare2 = (player->crosspos2[1] - camGetScreenTop() - camGetScreenHeight() * 0.5f) * weapondef->eptr->unk08 / (camGetScreenHeight() * 0.5f);
hand->fspare2 = (player->crosspos2[1] - camGetScreenTop() - camGetScreenHeight() * 0.5f) * weapondef->aimsettings->guntransdown / (camGetScreenHeight() * 0.5f);
} else {
hand->fspare2 = (player->crosspos2[1] - camGetScreenTop() - camGetScreenHeight() * 0.5f) * weapondef->eptr->unk04 / (camGetScreenHeight() * 0.5f);
hand->fspare2 = (player->crosspos2[1] - camGetScreenTop() - camGetScreenHeight() * 0.5f) * weapondef->aimsettings->guntransup / (camGetScreenHeight() * 0.5f);
}
fspare1 = hand->fspare1;
+2 -2
View File
@@ -640,7 +640,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex);
weaponnum = bgunGetWeaponNum(HAND_RIGHT);
canmanualzoom = weaponHasClassFlag(weaponnum, WEAPONCLASSFLAG_MANUALZOOM);
canmanualzoom = weaponHasAimFlag(weaponnum, INVAIMFLAG_MANUALZOOM);
contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
c1stickx = allowc1x ? joyGetStickX(contpad1) : 0;
@@ -1757,7 +1757,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
&& (bmoveIsAutoAimXEnabledForCurrentWeapon() || bmoveIsAutoAimYEnabledForCurrentWeapon())
&& g_Vars.currentplayer->autoxaimprop
&& g_Vars.currentplayer->autoyaimprop
&& weaponHasClassFlag(weaponnum, WEAPONCLASSFLAG_AUTOAIM)
&& weaponHasAimFlag(weaponnum, INVAIMFLAG_AUTOAIM)
)
|| (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_CMP150 && g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponfunc == FUNC_SECONDARY)) {
// Auto aim - move crosshair towards target
+1 -1
View File
@@ -1137,7 +1137,7 @@ void botinvDrop(struct chrdata *chr, s32 weaponnum, u8 dropall)
if ((item->type == INVITEMTYPE_WEAP || item->type == INVITEMTYPE_DUAL)
&& (dropall || weaponnum == item->type_weap.weapon1)) {
if (weaponHasFlag(item->type_weap.weapon1, WEAPONFLAG_08000000) == 0
if (!weaponHasFlag(item->type_weap.weapon1, WEAPONFLAG_UNDROPPABLE)
|| (g_Vars.normmplayerisrunning
&& g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL
&& item->type_weap.weapon1 == WEAPON_DATAUPLINK)) {
+32 -32
View File
@@ -2993,9 +2993,9 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
s32 buddyplayernum;
struct eyespy *eyespy;
s32 objectivenum;
f32 mult1;
f32 mult2;
f32 mult3;
f32 impactforce1;
f32 impactforce2;
f32 impactforce3;
// If chr was previously knocked out, they are now dead so decrease KO counter
if (chr->actiontype == ACT_DRUGGEDCOMINGUP
@@ -3124,18 +3124,18 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
// Handle robots and Dr Caroll then return early
if (race == RACE_ROBOT || race == RACE_DRCAROLL) {
mult1 = gsetGetStrength(gset) * 0.5f;
impactforce1 = gsetGetImpactForce(gset) * 0.5f;
if (mult1 <= 0) {
mult1 = 3;
if (impactforce1 <= 0) {
impactforce1 = 3;
}
if (mult1 != 0.0f) {
if (impactforce1 != 0.0f) {
chr->elapseextra = 0;
chr->timeextra = mult1 * 15;
chr->extraspeed.x = dir->x * mult1;
chr->extraspeed.y = dir->y * mult1;
chr->extraspeed.z = dir->z * mult1;
chr->timeextra = impactforce1 * 15;
chr->extraspeed.x = dir->x * impactforce1;
chr->extraspeed.y = dir->y * impactforce1;
chr->extraspeed.z = dir->z * impactforce1;
}
if (race == RACE_DRCAROLL) {
@@ -3296,18 +3296,18 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
modelSetAnimEndFrame(model, row->endframe);
}
mult2 = gsetGetStrength(gset);
impactforce2 = gsetGetImpactForce(gset);
if (mult2 <= 0 && (chr->chrflags & CHRCFLAG_DIEWITHFORCE)) {
mult2 = 6;
if (impactforce2 <= 0 && (chr->chrflags & CHRCFLAG_DIEWITHFORCE)) {
impactforce2 = 6;
}
if (row->unk10 && mult2 > 0) {
chr->act_die.timeextra = mult2 * 15;
if (row->unk10 && impactforce2 > 0) {
chr->act_die.timeextra = impactforce2 * 15;
chr->act_die.elapseextra = 0;
chr->act_die.extraspeed.x = dir->x * mult2;
chr->act_die.extraspeed.y = dir->y * mult2;
chr->act_die.extraspeed.z = dir->z * mult2;
chr->act_die.extraspeed.x = dir->x * impactforce2;
chr->act_die.extraspeed.y = dir->y * impactforce2;
chr->act_die.extraspeed.z = dir->z * impactforce2;
}
chr->chrflags &= ~CHRCFLAG_HAS_SPECIAL_DEATH_ANIMATION;
@@ -3349,18 +3349,18 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
modelSetAnimEndFrame(model, row->endframe);
}
mult3 = gsetGetStrength(gset);
impactforce3 = gsetGetImpactForce(gset);
if (mult3 <= 0 && (chr->chrflags & CHRCFLAG_DIEWITHFORCE)) {
mult3 = 6;
if (impactforce3 <= 0 && (chr->chrflags & CHRCFLAG_DIEWITHFORCE)) {
impactforce3 = 6;
}
if (row->unk10 != 0 && mult3 > 0) {
chr->act_die.timeextra = mult3 * 15;
if (row->unk10 != 0 && impactforce3 > 0) {
chr->act_die.timeextra = impactforce3 * 15;
chr->act_die.elapseextra = 0;
chr->act_die.extraspeed.x = dir->x * mult3;
chr->act_die.extraspeed.y = dir->y * mult3;
chr->act_die.extraspeed.z = dir->z * mult3;
chr->act_die.extraspeed.x = dir->x * impactforce3;
chr->act_die.extraspeed.y = dir->y * impactforce3;
chr->act_die.extraspeed.z = dir->z * impactforce3;
}
}
} else if (race == RACE_DRCAROLL) {
@@ -3543,7 +3543,7 @@ void chrReactToDamage(struct chrdata *chr, struct coord *vector, f32 angle, s32
}
if (race == RACE_EYESPY) {
f32 strength = gsetGetStrength(gset);
f32 strength = gsetGetImpactForce(gset);
struct eyespy *eyespy = chrToEyespy(chr);
if (eyespy) {
@@ -3568,7 +3568,7 @@ void chrReactToDamage(struct chrdata *chr, struct coord *vector, f32 angle, s32
} else if (race == RACE_EYESPY) {
// empty
} else if (race == RACE_DRCAROLL || race == RACE_ROBOT) {
f32 strength = gsetGetStrength(gset);
f32 strength = gsetGetImpactForce(gset);
if (race == RACE_DRCAROLL) {
strength *= 0.5f;
@@ -10114,8 +10114,8 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
if (projectileobj) {
f32 spcc;
sp168 = func->unk4c * (1.0f / 0.6f) / 60.0f;
spcc = func->unk54 * (1.0f / 0.6f);
sp168 = func->speed * (1.0f / 0.6f) / 60.0f;
spcc = func->traveldist * (1.0f / 0.6f);
// AI bots are a bit smarter than solo chrs
// with regard to how they aim their projectiles
@@ -10219,7 +10219,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
projectileobj->base.projectile->unk018 = sp15c.z;
projectileobj->base.projectile->pickuptimer240 = TICKS(240);
projectileobj->base.projectile->unk08c = func->unk5c;
projectileobj->base.projectile->unk08c = func->reflectangle;
projectileobj->base.projectile->unk098 = func->unk50 * (1.0f / 0.6f);
projectileobj->base.projectile->targetprop = chrGetTargetProp(chr);
+28 -28
View File
@@ -102,15 +102,15 @@ u32 weaponGetNumFunctions(u32 weaponnum)
return 2;
}
struct inventory_class *func0f0b11bc(struct gset *gset)
struct invaimsettings *gsetGetAimSettings(struct gset *gset)
{
struct weapon *weapon = weaponFindById(gset->weaponnum);
if (weapon) {
return weapon->eptr;
return weapon->aimsettings;
}
return &invclass_default;
return &invaimsettings_default;
}
struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum)
@@ -125,25 +125,25 @@ struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum)
return NULL;
}
void currentPlayerGetWeaponSway(struct coord *sway)
void currentPlayerGetWeaponPos(struct coord *pos)
{
struct weapon *weapon = weaponFindById(bgunGetWeaponNum(HAND_RIGHT));
if (weapon) {
sway->x = weapon->leftright;
sway->y = weapon->updown;
sway->z = weapon->frontback;
pos->x = weapon->posx;
pos->y = weapon->posy;
pos->z = weapon->posz;
}
}
void currentPlayerSetWeaponSway(struct coord *sway)
void currentPlayerSetWeaponPos(struct coord *pos)
{
struct weapon *weapon = weaponFindById(bgunGetWeaponNum(HAND_RIGHT));
if (weapon) {
weapon->leftright = sway->x;
weapon->updown = sway->y;
weapon->frontback = sway->z;
weapon->posx = pos->x;
weapon->posy = pos->y;
weapon->posz = pos->z;
}
}
@@ -159,7 +159,7 @@ f32 func0f0b131c(s32 hand)
if (hand == 0) {
weapon = weaponFindById(bgunGetWeaponNum2(0));
x = weapon->leftright;
x = weapon->posx;
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
x -= 3.5f;
@@ -170,7 +170,7 @@ f32 func0f0b131c(s32 hand)
}
} else {
weapon = weaponFindById(bgunGetWeaponNum2(1));
x = -weapon->leftright;
x = -weapon->posx;
if (PLAYERCOUNT() == 2 && optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) {
x += 3.5f;
@@ -208,7 +208,7 @@ f32 currentPlayerGetGunZoomFov(void)
weapon = weaponFindById(bgunGetWeaponNum2(0));
if (weapon) {
f32 fov = weapon->eptr->zoomfov;
f32 fov = weapon->aimsettings->zoomfov;
return fov;
}
@@ -276,7 +276,7 @@ bool weaponHasFlag(s32 itemid, u32 flag)
return (weapon->flags & flag) != 0;
}
bool weaponHasClassFlag(s32 weaponnum, u32 flag)
bool weaponHasAimFlag(s32 weaponnum, u32 flag)
{
struct weapon *weapon = weaponFindById(weaponnum);
@@ -284,7 +284,7 @@ bool weaponHasClassFlag(s32 weaponnum, u32 flag)
return false;
}
return (weapon->eptr->flags & flag) != 0;
return (weapon->aimsettings->flags & flag) != 0;
}
bool weaponHasAmmoFlag(s32 weaponnum, s32 funcnum, u32 flag)
@@ -423,21 +423,21 @@ struct inventory_ammo *gsetGetAmmoDefinition(struct gset *gset)
return NULL;
}
u8 gsetGetSingleUnk3c(struct gset *gset)
u8 gsetGetSinglePenetration(struct gset *gset)
{
struct weaponfunc *func = gsetGetWeaponFunction(gset);
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
return funcshoot->unk3c;
return funcshoot->penetration;
}
return 0;
}
u32 handGetCasingEject(struct gset *gset)
s32 handGetCasingEject(struct gset *gset)
{
u32 result = 0;
s32 result = 0;
struct inventory_ammo *ammo = gsetGetAmmoDefinition(gset);
if (ammo) {
@@ -447,14 +447,14 @@ u32 handGetCasingEject(struct gset *gset)
return result;
}
f32 gsetGetStrength(struct gset *gset)
f32 gsetGetImpactForce(struct gset *gset)
{
struct weaponfunc *func = gsetGetWeaponFunction(gset);
f32 result = 0;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
result = funcshoot->strength;
result = funcshoot->impactforce;
}
return result;
@@ -505,7 +505,7 @@ u8 gsetGetFireslotDuration(struct gset *gset)
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
result = funcshoot->unk38;
result = funcshoot->duration60;
}
if (result >= 4) {
@@ -518,7 +518,7 @@ u8 gsetGetFireslotDuration(struct gset *gset)
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
return funcshoot->unk38;
return funcshoot->duration60;
}
return 0;
@@ -558,7 +558,7 @@ s8 weaponGetNumTicksPerShot(u32 weaponnum, u32 funcindex)
if (func && func->type == INVENTORYFUNCTYPE_SHOOT_AUTOMATIC) {
struct weaponfunc_shootauto *autofunc = (struct weaponfunc_shootauto *)func;
result = 3600.0f / autofunc->maxfirerate;
result = 3600.0f / autofunc->maxrpm;
}
#if VERSION != VERSION_PAL_BETA
@@ -652,14 +652,14 @@ void gsetGetNoiseSettings(struct gset *gset, struct noisesettings *dst)
}
if (settings == NULL) {
settings = &invnoisesettings_00010fd0;
settings = &invnoisesettings_silent;
}
dst->minradius = settings->minradius;
dst->maxradius = settings->maxradius;
dst->incradius = settings->incradius;
dst->unk0c = settings->unk0c;
dst->unk10 = settings->unk10;
dst->decbasespeed = settings->decbasespeed;
dst->decremspeed = settings->decremspeed;
}
struct guncmd *handGetEquipAnim(struct gset *gset)
+1901 -1831
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -592,7 +592,7 @@ void playermgrAllocatePlayer(s32 index)
g_Vars.players[index]->targetset[i] = 0;
}
g_Vars.players[index]->target = 0;
g_Vars.players[index]->sighttracktype = SIGHTTRACKTYPE_NONE;
g_Vars.players[index]->gunextraaimx = 0;
g_Vars.players[index]->gunextraaimy = 0;
+6 -6
View File
@@ -646,9 +646,9 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
}
if (arg1) {
shotdata.unk38 = gsetGetSingleUnk3c(&shotdata.gset);
shotdata.penetration = gsetGetSinglePenetration(&shotdata.gset);
} else {
shotdata.unk38 = 1;
shotdata.penetration = 1;
}
shotdata.unk34 = arg7;
@@ -789,7 +789,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
|| (explosiveshells && (obj->type == OBJTYPE_GLASS || obj->type == OBJTYPE_TINTEDGLASS))) {
s1++;
if (s1 >= shotdata.unk38) {
if (s1 >= shotdata.penetration) {
sp6cc = true;
doexplosiveshells = explosiveshells;
hitpos.x = shotdata.hits[i].pos.x;
@@ -963,7 +963,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
if (shotdata.hits[i].unk4c) {
s1++;
if (s1 >= shotdata.unk38) {
if (s1 >= shotdata.penetration) {
done = true;
}
}
@@ -1038,7 +1038,7 @@ void func0f061fa8(struct shotdata *shotdata, struct prop *prop, f32 arg2, s32 hi
}
}
if (count >= shotdata->unk38) {
if (count >= shotdata->penetration) {
shotdata->hits[bestindex].prop = NULL;
shotdata->unk34 = prevmostdist;
@@ -1051,7 +1051,7 @@ void func0f061fa8(struct shotdata *shotdata, struct prop *prop, f32 arg2, s32 hi
shotdata->hits[i].prop = NULL;
}
}
} else if (count + 1 == shotdata->unk38) {
} else if (count + 1 == shotdata->penetration) {
if (shotdata->unk34 > arg2) {
shotdata->unk34 = arg2;
}
+1 -1
View File
@@ -21844,7 +21844,7 @@ void currentPlayerDropAllItems(void)
for (i = WEAPON_UNARMED; i <= WEAPON_SUICIDEPILL; i++) {
if (playermgrGetModelOfWeapon(i) >= 0 && invHasSingleWeaponExcAllGuns(i)) {
if (!weaponHasFlag(i, WEAPONFLAG_08000000)
if (!weaponHasFlag(i, WEAPONFLAG_UNDROPPABLE)
|| (g_Vars.normmplayerisrunning
&& g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL
&& i == WEAPON_DATAUPLINK)) {
+31 -31
View File
@@ -157,10 +157,10 @@ void func0f0d7364(void)
void sightTick(bool sighton)
{
struct trackedprop *trackedprop;
u8 newtarget;
u8 newtracktype;
s32 i;
s32 index;
struct inventory_class *thing = func0f0b11bc(&g_Vars.currentplayer->hands[0].gset);
struct invaimsettings *gunsettings = gsetGetAimSettings(&g_Vars.currentplayer->hands[0].gset);
struct weaponfunc *func = weaponGetFunctionById(g_Vars.currentplayer->hands[0].gset.weaponnum,
g_Vars.currentplayer->hands[0].gset.weaponfunc);
@@ -182,36 +182,36 @@ void sightTick(bool sighton)
}
}
newtarget = thing->unk18 >> 28;
newtracktype = gunsettings->tracktype;
if (gsetHasFunctionFlags(&g_Vars.currentplayer->hands[0].gset, FUNCFLAG_THREATDETECTOR)) {
newtarget = 5;
newtracktype = SIGHTTRACKTYPE_THREATDETECTOR;
}
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_CLOSE) {
newtarget = 0;
newtracktype = SIGHTTRACKTYPE_NONE;
}
if (newtarget != g_Vars.currentplayer->target) {
if (newtarget == 5) {
if (newtracktype != g_Vars.currentplayer->sighttracktype) {
if (newtracktype == SIGHTTRACKTYPE_THREATDETECTOR) {
for (i = 0; i < 4; i++) {
g_Vars.currentplayer->trackedprops[i].prop = NULL;
}
}
g_Vars.currentplayer->target = newtarget;
g_Vars.currentplayer->sighttracktype = newtracktype;
switch (newtarget) {
case SIGHTTARGET_NONE:
case SIGHTTARGET_DEFAULT:
case SIGHTTARGET_BETASCANNER:
case SIGHTTARGET_ROCKETLAUNCHER:
case SIGHTTARGET_CMP150:
switch (newtracktype) {
case SIGHTTRACKTYPE_NONE:
case SIGHTTRACKTYPE_DEFAULT:
case SIGHTTRACKTYPE_BETASCANNER:
case SIGHTTRACKTYPE_ROCKETLAUNCHER:
case SIGHTTRACKTYPE_FOLLOWLOCKON:
break;
}
}
if (sighton && g_Vars.currentplayer->lastsighton == false && newtarget != 5) {
if (sighton && g_Vars.currentplayer->lastsighton == false && newtracktype != SIGHTTRACKTYPE_THREATDETECTOR) {
for (i = 0; i < 4; i++) {
g_Vars.currentplayer->trackedprops[i].prop = NULL;
}
@@ -231,9 +231,9 @@ void sightTick(bool sighton)
trackedprop->prop = NULL;
}
switch (g_Vars.currentplayer->target) {
case SIGHTTARGET_DEFAULT:
case SIGHTTARGET_BETASCANNER:
switch (g_Vars.currentplayer->sighttracktype) {
case SIGHTTRACKTYPE_DEFAULT:
case SIGHTTRACKTYPE_BETASCANNER:
// Conditionally copy lookingatprop to trackedprops[0], overwriting anything that's there
if (sighton) {
if (g_Vars.currentplayer->lookingatprop.prop) {
@@ -257,7 +257,7 @@ void sightTick(bool sighton)
}
}
break;
case SIGHTTARGET_ROCKETLAUNCHER:
case SIGHTTRACKTYPE_ROCKETLAUNCHER:
// Conditionally copy lookingatprop to trackedprops[0], but only if that slot is empty
if (sighton && g_Vars.currentplayer->lookingatprop.prop
&& sightCanTargetProp(g_Vars.currentplayer->lookingatprop.prop, 1)) {
@@ -280,7 +280,7 @@ void sightTick(bool sighton)
}
}
break;
case SIGHTTARGET_CMP150:
case SIGHTTRACKTYPE_FOLLOWLOCKON:
// Conditionally copy lookingatprop to any trackedprops slot, but only if the slot is empty
if (sighton && g_Vars.currentplayer->lookingatprop.prop
&& sightCanTargetProp(g_Vars.currentplayer->lookingatprop.prop, 4)) {
@@ -303,8 +303,8 @@ void sightTick(bool sighton)
}
}
break;
case SIGHTTARGET_NONE:
case SIGHTTARGET_THREATDETECTOR:
case SIGHTTRACKTYPE_NONE:
case SIGHTTRACKTYPE_THREATDETECTOR:
break;
}
@@ -633,9 +633,9 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
if (1);
switch (g_Vars.currentplayer->target) {
case SIGHTTARGET_NONE:
// SIGHTTARGET_NONE is used for unarmed, but this appears to be
switch (g_Vars.currentplayer->sighttracktype) {
case SIGHTTRACKTYPE_NONE:
// SIGHTTRACKTYPE_NONE is used for unarmed, but this appears to be
// unreachable. The aimer is never drawn when unarmed.
if (sighton) {
colour = 0x00ff0028;
@@ -644,7 +644,7 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
}
break;
case SIGHTTARGET_DEFAULT:
case SIGHTTRACKTYPE_DEFAULT:
// For most guns, render the aimer if holding R
if (sighton) {
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
@@ -669,7 +669,7 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
}
}
break;
case SIGHTTARGET_BETASCANNER:
case SIGHTTRACKTYPE_BETASCANNER:
// An unused sight target. When holding R, it flashes the text
// "Identify" and draws a red box around the targetted prop.
if (sighton) {
@@ -711,7 +711,7 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
}
}
break;
case SIGHTTARGET_ROCKETLAUNCHER:
case SIGHTTRACKTYPE_ROCKETLAUNCHER:
for (i = 0; i < 1; i++) {
trackedprop = &g_Vars.currentplayer->trackedprops[i];
@@ -734,13 +734,13 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
}
break;
case SIGHTTARGET_CMP150:
case SIGHTTARGET_THREATDETECTOR:
case SIGHTTRACKTYPE_FOLLOWLOCKON:
case SIGHTTRACKTYPE_THREATDETECTOR:
for (i = 0; i < 4; i++) {
trackedprop = &g_Vars.currentplayer->trackedprops[i];
if (trackedprop->prop) {
if (g_Vars.currentplayer->target == SIGHTTARGET_THREATDETECTOR) {
if (g_Vars.currentplayer->sighttracktype == SIGHTTRACKTYPE_THREATDETECTOR) {
struct defaultobj *obj = trackedprop->prop->obj;
struct weaponobj *weapon;
u32 textid = 0;
+1 -1
View File
@@ -268,7 +268,7 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
stackshotdata.dir.f[i] = shotdata->dir.f[i];
}
stackshotdata.unk38 = 1;
stackshotdata.penetration = 1;
for (i = 0; i < 3; i++) {
endpos.f[i] = stackshotdata.gunpos.f[i] + stackshotdata.dir.f[i] * g_SplatMaxDistance;
+25 -14
View File
@@ -1184,6 +1184,9 @@
#define GOPOSMASK_SPEED (GOPOSFLAG_WALK | GOPOSFLAG_JOG | GOPOSFLAG_RUN)
#define GUNAMMOREASON_OPTION 0x01
#define GUNAMMOREASON_NOCONTROL 0x02
#define GUNCMD_END 0
#define GUNCMD_SHOWPART 1
#define GUNCMD_HIDEPART 2
@@ -1204,14 +1207,21 @@
#define GUNMEMOWNER_CHANGING 10
#define GUNMEMOWNER_FREE 11
#define GUNAMMOREASON_OPTION 0x01
#define GUNAMMOREASON_NOCONTROL 0x02
#define GUNSIGHTREASON_1 0x01
#define GUNSIGHTREASON_NOTAIMING 0x02
#define GUNSIGHTREASON_NOCONTROL 0x04
#define GUNSIGHTREASON_DAMAGE 0x10
#define GUNVISCMD_END 0
#define GUNVISCMD_ALWAYSTRUE 1
#define GUNVISCMD_CHECKUPGRADE 4
#define GUNVISCMD_CHECKINLEFTHAND 5
#define GUNVISCMD_CHECKINRIGHTHAND 6
#define GUNVISOP_IFTRUE_SETVISIBLE 0
#define GUNVISOP_IFTRUE_SETHIDDEN 1
#define GUNVISOP_SETVISIBILITY 3
#define HAND_RIGHT 0
#define HAND_LEFT 1
@@ -2557,6 +2567,7 @@
#define MODELPART_0003 0x0003
#define MODELPART_0010 0x0010
#define MODELPART_0011 0x0011
#define MODELPART_0029 0x0029
#define MODELPART_0035 0x0035
#define MODELPART_0036 0x0036
#define MODELPART_0042 0x0042
@@ -3589,12 +3600,12 @@
#define SIGHT_MAIAN 6
#define SIGHT_NONE 7
#define SIGHTTARGET_NONE 0
#define SIGHTTARGET_DEFAULT 1
#define SIGHTTARGET_BETASCANNER 2
#define SIGHTTARGET_ROCKETLAUNCHER 3
#define SIGHTTARGET_CMP150 4
#define SIGHTTARGET_THREATDETECTOR 5
#define SIGHTTRACKTYPE_NONE 0
#define SIGHTTRACKTYPE_DEFAULT 1
#define SIGHTTRACKTYPE_BETASCANNER 2
#define SIGHTTRACKTYPE_ROCKETLAUNCHER 3
#define SIGHTTRACKTYPE_FOLLOWLOCKON 4
#define SIGHTTRACKTYPE_THREATDETECTOR 5
#define SKEL_BASIC 0x02
#define SKEL_CHRGUN 0x03
@@ -4340,11 +4351,11 @@ enum weaponnum {
/*0x5d*/ WEAPON_SUICIDEPILL
};
#define WEAPONCLASSFLAG_MANUALZOOM 0x00000001
#define WEAPONCLASSFLAG_AUTOAIM 0x00000002
#define WEAPONCLASSFLAG_00000004 0x00000004
#define INVAIMFLAG_MANUALZOOM 0x00000001
#define INVAIMFLAG_AUTOAIM 0x00000002
#define INVAIMFLAG_ACCURATESINGLESHOT 0x00000004
#define WEAPONFLAG_00000001 0x00000001 // mines, grenades and knives
#define WEAPONFLAG_THROWABLE 0x00000001 // Entire weapon is throwable (eg. grendes, mines, knives)
#define WEAPONFLAG_00000004 0x00000004
#define WEAPONFLAG_ONEHANDED 0x00000008 // Makes guards carry the gun with one hand
#define WEAPONFLAG_AICANUSE 0x00000010
@@ -4368,7 +4379,7 @@ enum weaponnum {
#define WEAPONFLAG_DETERMINER_F_THE 0x01000000 // "Picked up the ..." (full version)
#define WEAPONFLAG_02000000 0x02000000 // Slayer
#define WEAPONFLAG_04000000 0x04000000
#define WEAPONFLAG_08000000 0x08000000
#define WEAPONFLAG_UNDROPPABLE 0x08000000 // Do not drop when disarmed or killed
#define WEAPONFLAG_DETERMINER_S_SOME 0x10000000 // "Some ..." (short version - when vertically split)
#define WEAPONFLAG_DETERMINER_F_SOME 0x20000000 // "Picked up some ..." (full version)
#define WEAPONFLAG_AIMTRACK 0x40000000 // Allow drawing red box around targets in aim mode
-2
View File
@@ -241,8 +241,6 @@ extern bool g_ObjectiveChecksDisabled;
extern u16 var8006ae90[];
extern u16 var8006af0c[];
extern u16 var8006af8c[];
extern struct noisesettings invnoisesettings_00010fd0;
extern struct inventory_class invclass_default;
extern struct weapon *g_Weapons[];
extern u32 var800700ac;
extern bool g_CasingsActive;
+2 -2
View File
@@ -11,9 +11,9 @@ void bgunStop(void);
void bgunRumble(s32 handnum, s32 weaponnum);
s32 bgunGetUnequippedReloadIndex(s32 weaponnum);
void bgunTickUnequippedReload(void);
bool bgun0f097df0(struct inventory_typef *arg0, struct hand *hand);
bool bgunTestGunVisCommand(struct gunviscmd *cmd, struct hand *hand);
void bgunSetPartVisible(s16 partnum, bool visible, struct hand *hand, struct modelfiledata *filedata);
void bgun0f097f28(struct hand *hand, struct modelfiledata *arg1, struct inventory_typef *arg2);
void bgunExecuteGunVisCommands(struct hand *hand, struct modelfiledata *arg1, struct gunviscmd *command);
void bgun0f098030(struct hand *hand, struct modelfiledata *arg1);
f32 bgun0f09815c(struct hand *hand);
void bgun0f0981e8(struct hand *hand, struct modelfiledata *modeldef);
+4 -4
View File
@@ -10,7 +10,7 @@ struct weaponfunc *gsetGetWeaponFunction2(struct gset *gset);
struct weaponfunc *gsetGetWeaponFunction(struct gset *gset);
struct weaponfunc *weaponGetFunction(struct gset *gset, s32 which);
struct weaponfunc *currentPlayerGetWeaponFunction(u32 hand);
struct inventory_class *func0f0b11bc(struct gset *gset);
struct invaimsettings *gsetGetAimSettings(struct gset *gset);
struct inventory_ammo *weaponGetAmmoByFunction(u32 weaponnum, u32 funcnum);
f32 handGetXShift(s32 handnum);
f32 func0f0b131c(s32 handnum);
@@ -18,7 +18,7 @@ f32 currentPlayerGetGunZoomFov(void);
void currentPlayerZoomOut(f32 fovpersec);
void currentPlayerZoomIn(f32 fovpersec);
bool weaponHasFlag(s32 itemid, u32 flag);
bool weaponHasClassFlag(s32 weaponnum, u32 flag);
bool weaponHasAimFlag(s32 weaponnum, u32 flag);
bool weaponHasAmmoFlag(s32 weaponnum, s32 funcnum, u32 flag);
s32 currentPlayerGetDeviceState(s32 weaponnum);
void currentPlayerSetDeviceActive(s32 weaponum, bool active);
@@ -26,8 +26,8 @@ u16 weaponGetModelNum(s32 weaponnum);
u16 weaponGetModelNum2(s32 weaponnum);
void gsetPopulateFromCurrentPlayer(s32 handnum, struct gset *gset);
struct inventory_ammo *gsetGetAmmoDefinition(struct gset *gset);
u8 gsetGetSingleUnk3c(struct gset *gset);
f32 gsetGetStrength(struct gset *gset);
u8 gsetGetSinglePenetration(struct gset *gset);
f32 gsetGetImpactForce(struct gset *gset);
f32 gsetGetDamage(struct gset *gset);
u8 gsetGetFireslotDuration(struct gset *gset);
u16 gsetGetSingleShootSound(struct gset *gset);
+2 -2
View File
@@ -4,8 +4,8 @@
#include "data.h"
#include "types.h"
extern struct noisesettings invnoisesettings_00010fd0;
extern struct inventory_class invclass_default;
extern struct noisesettings invnoisesettings_silent;
extern struct invaimsettings invaimsettings_default;
extern struct weapon *g_Weapons[WEAPON_SUICIDEPILL + 1];
void invReset(void);
+14
View File
@@ -34,3 +34,17 @@
#define gunscript_setsoundspeed(keyframe, speed) \
{ GUNCMD_SETSOUNDSPEED, 0, keyframe, speed },
#define gunviscmd_end \
{ GUNVISCMD_END },
#define gunviscmd_sethidden(modelpart) \
{ GUNVISCMD_ALWAYSTRUE, 0, GUNVISOP_IFTRUE_SETHIDDEN, modelpart, 0 },
#define gunviscmd_checkupgrade(upgrade, operator, modelpart) \
{ GUNVISCMD_CHECKUPGRADE, upgrade, operator, modelpart, 0 },
#define gunviscmd_checkinlefthand(operator, modelpart) \
{ GUNVISCMD_CHECKINLEFTHAND, 0, operator, modelpart, 0 },
#define gunviscmd_checkinrighthand(operator, modelpart) \
{ GUNVISCMD_CHECKINRIGHTHAND, 0, operator, modelpart, 0 },
+67 -58
View File
@@ -2752,7 +2752,7 @@ struct player {
/*0x1b88*/ s32 introanimnum;
/*0x1b8c*/ s32 lastsighton;
/*0x1b90*/ u16 targetset[4]; // related to trackedprops
/*0x1b98*/ u8 target;
/*0x1b98*/ u8 sighttracktype; // eg. threat detector, follow lock-on
/*0x1b9c*/ f32 speedthetacontrol;
/*0x1ba0*/ s32 cam_room;
/*0x1ba4*/ s16 autocontrol_aimpad;
@@ -2860,37 +2860,46 @@ struct noisesettings {
f32 minradius;
f32 maxradius;
f32 incradius;
f32 unk0c;
f32 unk10;
f32 decbasespeed;
f32 decremspeed;
};
struct inventory_class {
struct recoilsettings {
f32 xrange;
f32 yrange;
f32 zrange;
f32 unk0c; // not used
u8 unk10; // not used
};
struct invaimsettings {
f32 zoomfov;
f32 unk04;
f32 unk08;
f32 unk0c;
f32 unk10;
f32 unk14;
u32 unk18;
f32 guntransup; // gun y translation when aiming upwards
f32 guntransdown; // gun y translation when aiming downwards
f32 guntransside; // gun x translation when aiming sideways
f32 aimdamppal; // slowdown speed when aiming or turning (PAL)
f32 aimdamp; // slowdown speed when aiming or turning (NTSC)
u32 tracktype : 4;
u32 unk18_04 : 4; // not used
u32 flags;
};
struct inventory_typef {
// See related functions: bgun0f097f28 and bgun0f097df0
struct gunviscmd {
// See related functions: bgunExecuteGunVisCommands and bgunTestGunVisCommand
// unk00 - Some kind of condition field
// 0 = terminator
// 4 = if bit in hand->unk0639 (bit index specified via unk02)
// 5 = if in left hand
// 6 = if in right hand
u8 unk00;
u8 type;
u16 unk02;
u16 param;
// 0 = do true thing if condition passed
// 1 = do false thing if condition passed
// 3 = do true thing if condition passed, or false thing if condition failed
u8 unk04;
// 0 = set part visible if condition passed
// 1 = set part hidden if condition passed
// 3 = set part visible if condition passed, or hidden if condition failed
u8 op;
u16 partnum;
u16 unk08;
@@ -2899,7 +2908,7 @@ struct inventory_typef {
struct weaponfunc {
/*0x00*/ s32 type;
/*0x04*/ u16 name;
/*0x06*/ u8 unk06;
/*0x06*/ u8 unk06; // not used
/*0x07*/ s8 ammoindex; // -1 = no ammo, 0 or 1 = index into weapon->ammos[]
/*0x08*/ struct noisesettings *noisesettings;
/*0x0c*/ struct guncmd *fire_animation;
@@ -2908,8 +2917,8 @@ struct weaponfunc {
struct weaponfunc_shoot {
struct weaponfunc base;
/*0x14*/ struct noisesettings *unk14;
/*0x18*/ s8 unk18;
/*0x14*/ struct recoilsettings *recoilsettings;
/*0x18*/ s8 recoverytime60;
/*0x1c*/ f32 damage;
/*0x20*/ f32 spread;
@@ -2922,13 +2931,13 @@ struct weaponfunc_shoot {
/*0x26*/ s8 unk26;
/*0x27*/ s8 unk27;
/*0x28*/ f32 recoil;
/*0x2c*/ f32 unk2c;
/*0x28*/ f32 recoildist;
/*0x2c*/ f32 recoilangle;
/*0x30*/ f32 slidemax;
/*0x34*/ f32 strength;
/*0x38*/ u8 unk38;
/*0x34*/ f32 impactforce;
/*0x38*/ u8 duration60;
/*0x3a*/ u16 shootsound;
/*0x3c*/ u8 unk3c;
/*0x3c*/ u8 penetration;
};
struct weaponfunc_shootsingle {
@@ -2937,24 +2946,24 @@ struct weaponfunc_shootsingle {
struct weaponfunc_shootauto {
struct weaponfunc_shoot base;
/*0x40*/ f32 initialfirerate; // rounds per minute
/*0x44*/ f32 maxfirerate; // rounds per minute
/*0x48*/ f32 *unk48;
/*0x4c*/ f32 *unk4c;
/*0x50*/ s8 unk50;
/*0x51*/ s8 unk51;
/*0x40*/ f32 initialrpm; // rounds per minute
/*0x44*/ f32 maxrpm; // rounds per minute
/*0x48*/ f32 *vibrationstart;
/*0x4c*/ f32 *vibrationmax;
/*0x50*/ s8 turretaccel;
/*0x51*/ s8 turretdecel;
};
struct weaponfunc_shootprojectile {
struct weaponfunc_shoot base;
/*0x40*/ s32 projectilemodelnum;
/*0x44*/ u32 unk44;
/*0x44*/ u32 unk44; // unused
/*0x48*/ f32 scale;
/*0x4c*/ s32 unk4c;
/*0x4c*/ s32 speed;
/*0x50*/ f32 unk50;
/*0x54*/ s32 unk54;
/*0x54*/ s32 traveldist;
/*0x58*/ s32 timer60;
/*0x5c*/ f32 unk5c;
/*0x5c*/ f32 reflectangle;
/*0x60*/ s16 soundnum;
};
@@ -2970,25 +2979,25 @@ struct weaponfunc_close {
struct weaponfunc base;
/*0x14*/ f32 damage;
/*0x18*/ f32 range;
/*0x1c*/ u32 unk1c;
/*0x20*/ u32 unk20;
/*0x24*/ u32 unk24;
/*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30;
/*0x34*/ u32 unk34;
/*0x38*/ u32 unk38;
/*0x3c*/ u32 unk3c;
/*0x40*/ u32 unk40;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x1c*/ u32 unk1c; // unused
/*0x20*/ u32 unk20; // unused
/*0x24*/ u32 unk24; // unused
/*0x28*/ f32 unk28; // unused
/*0x2c*/ f32 unk2c; // unused
/*0x30*/ f32 unk30; // unused
/*0x34*/ f32 unk34; // unused
/*0x38*/ f32 unk38; // unused
/*0x3c*/ f32 unk3c; // unused
/*0x40*/ f32 unk40; // unused
/*0x44*/ f32 unk44; // unused
/*0x48*/ u32 unk48; // unused
};
struct weaponfunc_special {
struct weaponfunc base;
/*0x14*/ s32 specialfunc;
/*0x18*/ s32 unk18;
/*0x1c*/ u32 unk1c;
/*0x18*/ s32 recoverytime60;
/*0x1c*/ u16 soundnum; // unused
};
struct weaponfunc_device {
@@ -3018,13 +3027,13 @@ struct weapon {
/*0x10*/ struct guncmd *sectopri_animation;
/*0x14*/ void *functions[2];
/*0x1c*/ struct inventory_ammo *ammos[2];
/*0x24*/ struct inventory_class *eptr;
/*0x28*/ f32 sway;
/*0x2c*/ f32 leftright;
/*0x30*/ f32 updown;
/*0x34*/ f32 frontback;
/*0x38*/ f32 unk38;
/*0x3c*/ struct inventory_typef *fptr;
/*0x24*/ struct invaimsettings *aimsettings;
/*0x28*/ f32 muzzlez;
/*0x2c*/ f32 posx;
/*0x30*/ f32 posy;
/*0x34*/ f32 posz;
/*0x38*/ f32 sway;
/*0x3c*/ struct gunviscmd *gunviscmds;
/*0x40*/ struct modelpartvisibility *partvisibility;
/*0x44*/ u16 shortname;
/*0x46*/ u16 name;
@@ -6019,7 +6028,7 @@ struct shotdata {
/*0x1c*/ struct coord gunpos;
/*0x28*/ struct coord dir;
/*0x34*/ f32 unk34;
/*0x38*/ s32 unk38;
/*0x38*/ s32 penetration;
/*0x3c*/ struct hit hits[10];
};