Change prop->type to a bitfield and change checks to use a bitmask

This commit is contained in:
Ryan Dwyer
2022-11-10 23:33:50 +10:00
parent 5c9b1b1ac1
commit cfe4e51df8
24 changed files with 159 additions and 237 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ void bgrabInit(void)
g_Vars.currentplayer->bondprevtheta = g_Vars.currentplayer->vv_theta;
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR | PROPTYPE_WEAPON)) {
struct defaultobj *obj = prop->obj;
struct hov *hov = NULL;
s32 cdresult;
+2 -2
View File
@@ -11177,7 +11177,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
handle = bgunAllocateAudioHandle();
if (handle) {
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *chr = prop->chr;
s16 soundnum = -1;
bool overridden = false;
@@ -11322,7 +11322,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
handle = bgunAllocateAudioHandle();
if (handle) {
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *chr = prop->chr;
s16 soundnum;
bool overridden = false;
+9 -22
View File
@@ -637,7 +637,7 @@ void botCheckPickups(struct chrdata *chr)
while (*propnumptr >= 0) {
struct prop *prop = &g_Vars.props[*propnumptr];
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
if (prop->timetoregen == 0) {
struct defaultobj *obj = prop->obj;
@@ -2237,7 +2237,7 @@ s32 botIsChrsCtcTokenHeld(struct chrdata *chr)
struct mpchrconfig *mpchr = g_MpAllChrConfigPtrs[mpPlayerGetIndex(chr)];
struct prop *prop = g_ScenarioData.ctc.tokens[mpchr->team];
return prop && (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER);
return prop && (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER));
}
/**
@@ -2634,12 +2634,10 @@ void botTickUnpaused(struct chrdata *chr)
for (i = 0; i != 4; i++) {
if (i != botteamindex && g_ScenarioData.ctc.playercountsperteam[i]) {
if (g_ScenarioData.ctc.tokens[i]->type == PROPTYPE_WEAPON
|| g_ScenarioData.ctc.tokens[i]->type == PROPTYPE_OBJ) {
if (g_ScenarioData.ctc.tokens[i]->type & (PROPTYPE_WEAPON | PROPTYPE_OBJ)) {
// Token is not held
tokens[numtokens++] = g_ScenarioData.ctc.tokens[i];
} else if (g_ScenarioData.ctc.tokens[i]->type == PROPTYPE_CHR
|| g_ScenarioData.ctc.tokens[i]->type == PROPTYPE_PLAYER) {
} else if (g_ScenarioData.ctc.tokens[i]->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
// Token is held
struct chrdata *tokenchr = g_ScenarioData.ctc.tokens[i]->chr;
@@ -2679,7 +2677,7 @@ void botTickUnpaused(struct chrdata *chr)
// If the chosen token is not held then collect it,
// otherwise it's held by a teammate so go protect them
if (tokens[index]->type == PROPTYPE_WEAPON || tokens[index]->type == PROPTYPE_OBJ) {
if (tokens[index]->type & (PROPTYPE_WEAPON | PROPTYPE_OBJ)) {
newaction = MA_AIBOTGETITEM;
aibot->gotoprop = tokens[index];
} else if (botCanFollow(chr, tokens[index]->chr)) {
@@ -2695,7 +2693,7 @@ void botTickUnpaused(struct chrdata *chr)
// Find out where the bot's token is
struct prop *token = g_ScenarioData.ctc.tokens[radarGetTeamIndex(chr->team)];
if (token->type == PROPTYPE_CHR || token->type == PROPTYPE_PLAYER) {
if (token->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *tokenchr = token->chr;
if (tokenchr->team == chr->team) {
@@ -2778,8 +2776,7 @@ void botTickUnpaused(struct chrdata *chr)
&& g_ScenarioData.htm.uplink
&& g_ScenarioData.htm.uplink != chr->prop) {
// Uplink is not held by current bot
if (g_ScenarioData.htm.uplink->type == PROPTYPE_CHR
|| g_ScenarioData.htm.uplink->type == PROPTYPE_PLAYER) {
if (g_ScenarioData.htm.uplink->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *uplinkchr = g_ScenarioData.htm.uplink->chr;
if ((g_MpSetup.options & MPOPTION_TEAMSENABLED) && uplinkchr->team == chr->team) {
@@ -2809,8 +2806,7 @@ void botTickUnpaused(struct chrdata *chr)
&& g_ScenarioData.htb.token
&& g_ScenarioData.htb.token != chr->prop) {
// Briefcase is not held by current bot
if (g_ScenarioData.htb.token->type == PROPTYPE_CHR
|| g_ScenarioData.htb.token->type == PROPTYPE_PLAYER) {
if (g_ScenarioData.htb.token->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *tokenchr = g_ScenarioData.htb.token->chr;
if ((g_MpSetup.options & MPOPTION_TEAMSENABLED) && tokenchr->team == chr->team) {
@@ -3563,20 +3559,11 @@ void botCheckFetch(struct chrdata *chr)
if (chr->act_gopos.waypoints[chr->act_gopos.curindex] == 0) {
struct prop *prop = aibot->gotoprop;
#if VERSION >= VERSION_PAL_FINAL
// pal-final adds a check for prop->obj
if (prop && prop->obj && !prop->parent && prop->timetoregen == 0) {
if (prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_OBJ) {
prop->obj->flags3 |= OBJFLAG3_ISFETCHTARGET;
}
}
#else
if (prop && !prop->parent && prop->timetoregen == 0) {
if (prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_OBJ) {
if (prop->type & (PROPTYPE_WEAPON | PROPTYPE_OBJ)) {
prop->obj->flags3 |= OBJFLAG3_ISFETCHTARGET;
}
}
#endif
}
aibot->forcemainloop = true;
+13 -19
View File
@@ -3504,9 +3504,7 @@ void chrEmitSparks(struct chrdata *chr, struct prop *prop, s32 hitpart, struct c
return;
}
if (prop->type == PROPTYPE_OBJ
|| prop->type == PROPTYPE_WEAPON
|| prop->type == PROPTYPE_DOOR
if ((prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR))
|| hitpart == HITPART_GUN
|| hitpart == HITPART_HAT) {
sparksCreate(chrprop->rooms[0], chrprop, coord, coord2, 0, SPARKTYPE_DEFAULT);
@@ -5476,7 +5474,7 @@ bool chr0f028e6c(s32 arg0, struct prop *prop, struct prop **propptr, struct mode
struct model *model;
s32 stack;
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
model = prop->chr->model;
} else {
model = prop->obj->model;
@@ -5585,9 +5583,9 @@ void shieldhitCreate(struct prop *prop, f32 shield, struct prop *arg2, struct mo
}
}
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
prop->chr->hidden2 |= CHRH2FLAG_SHIELDHIT;
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
prop->obj->flags3 |= OBJFLAG3_SHIELDHIT;
}
}
@@ -5622,12 +5620,10 @@ void shieldhitRemove(struct shieldhit *shieldhit)
if (!exists) {
// Mark prop as shield no longer visible
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *chr = prop->chr;
chr->hidden2 &= ~CHRH2FLAG_SHIELDHIT;
} else if (prop->type == PROPTYPE_OBJ
|| prop->type == PROPTYPE_WEAPON
|| prop->type == PROPTYPE_DOOR) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
struct defaultobj *obj = prop->obj;
obj->flags3 &= ~OBJFLAG3_SHIELDHIT;
}
@@ -5781,13 +5777,11 @@ f32 propGetShieldThing(struct prop **propptr)
{
struct prop *prop = *propptr;
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
return chrGetShield(prop->chr);
}
if (prop->type == PROPTYPE_OBJ
|| prop->type == PROPTYPE_WEAPON
|| prop->type == PROPTYPE_DOOR) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
if (prop->obj->flags3 & OBJFLAG3_SHOWSHIELD) {
return 4;
}
@@ -5851,7 +5845,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop
s32 blue3;
s32 mtxindex;
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *chr = prop->chr;
gap = 10.0f / chr->model->scale;
shieldamount = chrGetShield(chr);
@@ -6038,7 +6032,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop
vertices = gfxAllocateVertices(24);
if ((prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR)
if ((prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR))
&& (prop->obj->flags3 & OBJFLAG3_SHOWSHIELD)) {
f32 mult = (sinf((g_Vars.thisframestart240 % TICKS(350)) * (PAL ? 0.021588264033198f : 0.0179491f)) + 1.0f) * 0.5f;
@@ -6261,7 +6255,7 @@ Gfx *chrRenderShieldComponent(Gfx *gdl, struct shieldhit *hit, struct prop *prop
sp104[j][0], sp104[j][2], sp104[j][3]);
}
} else {
if ((prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR)
if ((prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR))
&& (prop->obj->flags3 & OBJFLAG3_SHOWSHIELD)) {
alpha1 = 0xff;
alpha2 = 0xff;
@@ -6540,7 +6534,7 @@ Gfx *shieldhitRender(Gfx *gdl, struct prop *prop1, struct prop *prop2, s32 alpha
if (prop2->flags & PROPFLAG_ONTHISSCREENTHISTICK) {
// Find the model and specific node if any
if (prop2->type == PROPTYPE_CHR || prop2->type == PROPTYPE_PLAYER) {
if (prop2->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *chr = prop2->chr;
model = chr->model;
} else {
@@ -6666,7 +6660,7 @@ Gfx *chrRenderCloak(Gfx *gdl, struct prop *chrprop, struct prop *thisprop)
struct modelnode *node;
if (thisprop->flags & PROPFLAG_ONTHISSCREENTHISTICK) {
if (thisprop->type == PROPTYPE_CHR || thisprop->type == PROPTYPE_PLAYER) {
if (thisprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
model = thisprop->chr->model;
} else {
model = thisprop->obj->model;
+37 -37
View File
@@ -4306,7 +4306,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
&& g_Vars.coopfriendlyfire == false
&& aprop
&& aprop != vprop
&& (aprop->type == PROPTYPE_PLAYER || aprop->type == PROPTYPE_CHR)
&& (aprop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR))
&& chr->team == TEAM_ALLY
&& aprop->chr->team == TEAM_ALLY) {
return;
@@ -4470,33 +4470,35 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
setCurrentPlayerNum(prevplayernum);
}
// Find the attacker's player number if possible
// (includes MP aibots, not applicable for solo chrs)
if (g_Vars.mplayerisrunning) {
if (aprop && (aprop->type == PROPTYPE_PLAYER || aprop->type == PROPTYPE_CHR)) {
aplayernum = mpPlayerGetIndex(aprop->chr);
if (aprop) {
// Find the attacker's player number if possible
// (includes MP aibots, not applicable for solo chrs)
if (g_Vars.mplayerisrunning) {
if (aprop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR)) {
aplayernum = mpPlayerGetIndex(aprop->chr);
}
} else {
if (aprop->type == PROPTYPE_PLAYER) {
aplayernum = playermgrGetPlayerNumByProp(aprop);
}
}
} else {
if (aprop && aprop->type == PROPTYPE_PLAYER) {
aplayernum = playermgrGetPlayerNumByProp(aprop);
}
}
// If using the shotgun, scale the damage based on distance
if (aprop && aprop->type == PROPTYPE_CHR && gset->weaponnum == WEAPON_SHOTGUN) {
f32 xdiff = aprop->pos.x - vprop->pos.x;
f32 ydiff = aprop->pos.y - vprop->pos.y;
f32 zdiff = aprop->pos.z - vprop->pos.z;
f32 sqdist = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff;
// If using the shotgun, scale the damage based on distance
if (aprop->type == PROPTYPE_CHR && gset->weaponnum == WEAPON_SHOTGUN) {
f32 xdiff = aprop->pos.x - vprop->pos.x;
f32 ydiff = aprop->pos.y - vprop->pos.y;
f32 zdiff = aprop->pos.z - vprop->pos.z;
f32 sqdist = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff;
if (sqdist < 200 * 200) {
damage *= 4.0f + (s32)(random() % 3); // 4, 5 or 6
} else if (sqdist < 400 * 400) {
damage *= 3.0f + (s32)(random() % 2); // 3 or 4
} else if (sqdist < 800 * 800) {
damage *= 2.0f + (s32)(random() % 2); // 2 or 3
} else if (sqdist < 1600 * 1600) {
damage *= 1.0f + (s32)(random() % 2); // 1 or 2
if (sqdist < 200 * 200) {
damage *= 4.0f + (s32)(random() % 3); // 4, 5 or 6
} else if (sqdist < 400 * 400) {
damage *= 3.0f + (s32)(random() % 2); // 3 or 4
} else if (sqdist < 800 * 800) {
damage *= 2.0f + (s32)(random() % 2); // 2 or 3
} else if (sqdist < 1600 * 1600) {
damage *= 1.0f + (s32)(random() % 2); // 1 or 2
}
}
}
@@ -7648,7 +7650,7 @@ void chrPunchInflictDamage(struct chrdata *chr, s32 damage, s32 range, u8 revers
bgunPlayPropHitSound(&gset, targetprop, -1);
if (targetprop->type == PROPTYPE_PLAYER || targetprop->type == PROPTYPE_CHR) {
if (targetprop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR)) {
chrDamageByImpact(targetprop->chr, gsetGetDamage(&gset) * damage, &vector, &gset, chr->prop, 200);
}
}
@@ -7765,7 +7767,7 @@ bool chrTryPunch(struct chrdata *chr, u8 reverse)
if (ok) {
struct prop *targetprop = chrGetTargetProp(chr);
if (targetprop->type == PROPTYPE_EYESPY || targetprop->type == PROPTYPE_PLAYER) {
if (targetprop->type & (PROPTYPE_EYESPY | PROPTYPE_PLAYER)) {
chr->act_anim.hitradius = playerhitradius;
} else {
chr->act_anim.hitradius = chrhitradius;
@@ -10061,7 +10063,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
(gset.weaponnum == WEAPON_ROCKETLAUNCHER
|| gset.weaponnum == WEAPON_ROCKETLAUNCHER_34
|| gset.weaponnum == WEAPON_SLAYER)) {
if (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER) {
if (targetprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
// Rockets - aim at target's feet
aimpos.x = targetprop->pos.x;
aimpos.y = targetprop->chr->manground;
@@ -10076,7 +10078,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
}
} else if ((gset.weaponnum == WEAPON_DEVASTATOR && gset.weaponfunc == FUNC_PRIMARY)
|| gset.weaponnum == WEAPON_SUPERDRAGON) {
if (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER) {
if (targetprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
// Grenades - aim at target's feet
aimpos.x = targetprop->pos.x;
aimpos.y = targetprop->chr->manground;
@@ -10238,7 +10240,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
}
func0f0341dc(targetchr, damage, &vector, &gset, chr->prop, HITPART_GENERAL, targetprop, node, model, side, NULL);
} else if ((hitprop == NULL || (hitprop->type != PROPTYPE_CHR && hitprop->type != PROPTYPE_PLAYER))
} else if ((hitprop == NULL || (hitprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) == 0)
&& sqshotdist < 100.0f * 100.0f) {
// Hit the background or something other than a
// player or chr, and the shot distance was less
@@ -10249,7 +10251,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
if (effective) {
if (hitprop) {
if (hitprop->type == PROPTYPE_PLAYER || hitprop->type == PROPTYPE_CHR) {
if (hitprop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR)) {
// Hit a player or chr other than the one they
// were aiming for
if (isaibot
@@ -10274,9 +10276,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
makebeam = false;
firingthisframe = false;
}
} else if (hitprop->type == PROPTYPE_OBJ
|| hitprop->type == PROPTYPE_WEAPON
|| hitprop->type == PROPTYPE_DOOR) {
} else if (hitprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
// Hit an object
struct defaultobj *hitobj = hitprop->obj;
s32 playernum = -1;
@@ -13289,7 +13289,7 @@ void chraTickBg(void)
if (chr->model && chr->prop && !chrIsDead(chr)) {
struct prop *targetprop = chrGetTargetProp(chr);
if (targetprop && (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER)) {
if (targetprop && (targetprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
if ((targetprop->type == PROPTYPE_PLAYER
&& !(g_Vars.antiplayernum >= 0 && g_Vars.anti && g_Vars.anti->prop == targetprop)
&& chrCompareTeams(chr, targetprop->chr, COMPARE_ENEMIES))
@@ -13982,7 +13982,7 @@ s32 chrResolveId(struct chrdata *ref, s32 id)
case CHR_TARGET:
{
struct prop *target = chrGetTargetProp(ref);
if ((target->type == PROPTYPE_CHR || target->type == PROPTYPE_PLAYER) && target->chr) {
if ((target->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) && target->chr) {
id = target->chr->chrnum;
}
}
@@ -14533,7 +14533,7 @@ bool chrSetChrPresetToChrNearPos(u8 checktype, struct chrdata *chr, f32 distance
while (*propnumptr >= 0) {
struct prop *prop = &g_Vars.props[*propnumptr];
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *loopchr = prop->chr;
if (loopchr->chrnum != chr->chrnum
+3 -3
View File
@@ -1762,7 +1762,7 @@ bool aiIfChrYGreaterThan(s32 chrref, f32 limit)
if (chopper) {
struct prop *target = chopperGetTargetProp(chopper);
if (target && (target->type == PROPTYPE_CHR || target->type == PROPTYPE_PLAYER)) {
if (target && (target->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
chr = target->chr;
}
}
@@ -1783,7 +1783,7 @@ bool aiIfChrYLessThan(s32 chrref, f32 limit)
if (chopper) {
struct prop *target = chopperGetTargetProp(chopper);
if (target && (target->type == PROPTYPE_CHR || target->type == PROPTYPE_PLAYER)) {
if (target && (target->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
chr = target->chr;
}
}
@@ -2300,7 +2300,7 @@ bool aiIfTargetIsPlayer(void)
{
struct prop *target = chrGetTargetProp(g_Vars.chrdata);
return target->type == PROPTYPE_EYESPY || target->type == PROPTYPE_PLAYER;
return target->type & (PROPTYPE_EYESPY | PROPTYPE_PLAYER);
}
bool aiIfTargetMovingAway(void)
+2 -2
View File
@@ -749,7 +749,7 @@ void explosionInflictDamage(struct prop *expprop)
struct prop *prop = &g_Vars.props[*propnumptr];
if (prop != exp->source && prop->timetoregen == 0) {
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
f32 xdist;
f32 ydist;
f32 zdist;
@@ -880,7 +880,7 @@ void explosionInflictDamage(struct prop *expprop)
}
}
}
} else if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
} else if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
f32 xdist = prop->pos.f[0] - expprop->pos.f[0];
f32 ydist = prop->pos.f[1] - expprop->pos.f[1];
f32 zdist = prop->pos.f[2] - expprop->pos.f[2];
+4 -13
View File
@@ -628,10 +628,6 @@ bool lvUpdateTrackedProp(struct trackedprop *trackedprop, s32 index)
return false;
}
return false;
case PROPTYPE_DOOR:
case PROPTYPE_EYESPY:
case PROPTYPE_EXPLOSION:
case PROPTYPE_SMOKE:
default:
return false;
}
@@ -664,7 +660,7 @@ void lvFindThreatsForProp(struct prop *prop, bool inchild, struct coord *playerp
if (prop->obj
&& (prop->flags & PROPFLAG_ONTHISSCREENTHISTICK)
&& (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON)
&& (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON))
&& condition) {
pass = false;
obj = prop->obj;
@@ -787,9 +783,7 @@ void func0f168f24(struct prop *prop, bool inchild, struct coord *playerpos, s32
&& (prop->flags & PROPFLAG_ONTHISSCREENTHISTICK)) {
model = NULL;
if (prop->type == PROPTYPE_OBJ
|| prop->type == PROPTYPE_WEAPON
|| prop->type == PROPTYPE_DOOR) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
model = g_Vars.currentplayer->trackedprops[i].prop->obj->model;
} else {
if (prop->type == PROPTYPE_CHR
@@ -1282,16 +1276,13 @@ Gfx *lvRender(Gfx *gdl)
g_Vars.currentplayer->lookingatprop.prop = func0f061d54(HAND_RIGHT, 0, 0);
if (g_Vars.currentplayer->lookingatprop.prop) {
if (g_Vars.currentplayer->lookingatprop.prop->type == PROPTYPE_CHR
|| g_Vars.currentplayer->lookingatprop.prop->type == PROPTYPE_PLAYER) {
if (g_Vars.currentplayer->lookingatprop.prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
chr = g_Vars.currentplayer->lookingatprop.prop->chr;
if ((chr->hidden & CHRHFLAG_CLOAKED) && !USINGDEVICE(DEVICE_IRSCANNER)) {
g_Vars.currentplayer->lookingatprop.prop = NULL;
}
} else if (g_Vars.currentplayer->lookingatprop.prop->type == PROPTYPE_OBJ
|| g_Vars.currentplayer->lookingatprop.prop->type == PROPTYPE_WEAPON
|| g_Vars.currentplayer->lookingatprop.prop->type == PROPTYPE_DOOR) {
} else if (g_Vars.currentplayer->lookingatprop.prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
struct defaultobj *obj = g_Vars.currentplayer->lookingatprop.prop->obj;
if ((obj->flags3 & OBJFLAG3_REACTTOSIGHT) == 0) {
+2 -2
View File
@@ -717,7 +717,7 @@ bool scenarioHighlightProp(struct prop *prop, s32 *colour)
}
}
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR | PROPTYPE_WEAPON)) {
struct defaultobj *obj = prop->obj;
if ((g_MpSetup.scenario != MPSCENARIO_COMBAT || (g_MpSetup.options & MPOPTION_NOPICKUPHIGHLIGHT) == 0)
@@ -735,7 +735,7 @@ bool scenarioHighlightProp(struct prop *prop, s32 *colour)
return true;
}
}
} else if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
} else if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
bool pulse = false;
bool isunselectedbot = false;
bool useblue = false;
@@ -377,8 +377,7 @@ Gfx *ctcRadarExtra(Gfx *gdl)
for (i = 0; i < scenarioGetMaxTeams(); i++) {
if (g_ScenarioData.ctc.tokens[i] &&
g_ScenarioData.ctc.tokens[i]->type != PROPTYPE_CHR &&
g_ScenarioData.ctc.tokens[i]->type != PROPTYPE_PLAYER) {
(g_ScenarioData.ctc.tokens[i]->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) == 0) {
struct coord dist;
dist.x = g_ScenarioData.ctc.tokens[i]->pos.x - g_Vars.currentplayer->prop->pos.x;
dist.y = g_ScenarioData.ctc.tokens[i]->pos.y - g_Vars.currentplayer->prop->pos.y;
@@ -398,7 +397,7 @@ bool ctcRadarChr(Gfx **gdl, struct prop *prop)
if (g_MpSetup.options & MPOPTION_CTC_SHOWONRADAR) {
for (i = 0; i < scenarioGetMaxTeams(); i++) {
if (prop == g_ScenarioData.ctc.tokens[i] &&
(g_ScenarioData.ctc.tokens[i]->type == PROPTYPE_CHR || g_ScenarioData.ctc.tokens[i]->type == PROPTYPE_PLAYER)) {
(g_ScenarioData.ctc.tokens[i]->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
struct coord dist;
s32 colour = g_TeamColours[radarGetTeamIndex(prop->chr->team)];
dist.x = g_ScenarioData.ctc.tokens[i]->pos.x - g_Vars.currentplayer->prop->pos.x;
@@ -418,7 +417,7 @@ bool ctcHighlightProp(struct prop *prop, s32 *colour)
{
struct defaultobj *obj = prop->obj;
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
if (obj->type == OBJTYPE_WEAPON) {
struct weaponobj *weapon = prop->weapon;
+2 -2
View File
@@ -670,7 +670,7 @@ Gfx *htmRadarExtra(Gfx *gdl)
if (g_MpSetup.options & MPOPTION_HTM_SHOWONRADAR) {
// Show the uplink
if (data->uplink && data->uplink->type != PROPTYPE_PLAYER && data->uplink->type != PROPTYPE_CHR) {
if (data->uplink && (data->uplink->type & (PROPTYPE_PLAYER | PROPTYPE_CHR)) == 0) {
dist.x = data->uplink->pos.x - g_Vars.currentplayer->prop->pos.x;
dist.y = data->uplink->pos.y - g_Vars.currentplayer->prop->pos.y;
dist.z = data->uplink->pos.z - g_Vars.currentplayer->prop->pos.z;
@@ -738,7 +738,7 @@ bool htmRadarChr(Gfx **gdl, struct prop *prop)
{
if ((g_MpSetup.options & MPOPTION_HTM_SHOWONRADAR) && g_ScenarioData.htm.uplink) {
if (prop == g_ScenarioData.htm.uplink &&
(prop->type == PROPTYPE_PLAYER || prop->type == PROPTYPE_CHR)) {
(prop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR))) {
struct coord dist;
dist.x = prop->pos.x - g_Vars.currentplayer->prop->pos.x;
dist.y = prop->pos.y - g_Vars.currentplayer->prop->pos.y;
@@ -470,8 +470,7 @@ Gfx *htbRadarExtra(Gfx *gdl)
{
if ((g_MpSetup.options & MPOPTION_HTB_SHOWONRADAR) &&
g_ScenarioData.htb.token != NULL &&
g_ScenarioData.htb.token->type != PROPTYPE_PLAYER &&
g_ScenarioData.htb.token->type != PROPTYPE_CHR) {
(g_ScenarioData.htb.token->type & (PROPTYPE_PLAYER | PROPTYPE_CHR)) == 0) {
struct coord dist;
dist.x = g_ScenarioData.htb.pos.x - g_Vars.currentplayer->prop->pos.x;
dist.y = g_ScenarioData.htb.pos.y - g_Vars.currentplayer->prop->pos.y;
@@ -487,7 +486,7 @@ bool htbRadarChr(Gfx **gdl, struct prop *prop)
if ((g_MpSetup.options & MPOPTION_HTB_SHOWONRADAR) &&
g_ScenarioData.htb.token &&
prop == g_ScenarioData.htb.token) {
if (prop->type == PROPTYPE_PLAYER || prop->type == PROPTYPE_CHR) {
if (prop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR)) {
struct coord dist;
dist.x = prop->pos.x - g_Vars.currentplayer->prop->pos.x;
dist.y = prop->pos.y - g_Vars.currentplayer->prop->pos.y;
+1 -1
View File
@@ -303,7 +303,7 @@ void kohTick(void)
prop = g_Vars.activeprops;
while (prop) {
if (prop->type == PROPTYPE_PLAYER || prop->type == PROPTYPE_CHR) {
if (prop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR)) {
inhill = false;
if (prop->rooms[0] == g_ScenarioData.koh.hillrooms[0]) {
+1 -1
View File
@@ -175,7 +175,7 @@ bool pacHighlightProp(struct prop *prop, s32 *colour)
struct scenariodata_pac *data = &g_ScenarioData.pac;
if (g_MpSetup.options & MPOPTION_PAC_HIGHLIGHTTARGET
&& (prop->type == PROPTYPE_PLAYER || prop->type == PROPTYPE_CHR)
&& (prop->type & (PROPTYPE_PLAYER | PROPTYPE_CHR))
&& data->victimindex != -1
&& prop->chr == g_MpAllChrPtrs[data->victims[data->victimindex]]) {
colour[0] = 0;
+1 -1
View File
@@ -479,7 +479,7 @@ void nbombInflictDamage(struct nbomb *nbomb)
struct prop *prop = &g_Vars.props[*propnumptr];
if (prop->timetoregen == 0) {
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
f32 xdiff = prop->pos.f[0] - nbomb->pos.f[0];
f32 ydiff = prop->pos.f[1] - nbomb->pos.f[1];
f32 zdiff = prop->pos.f[2] - nbomb->pos.f[2];
+26 -69
View File
@@ -347,26 +347,16 @@ void propDetach(struct prop *prop)
Gfx *propRender(Gfx *gdl, struct prop *prop, bool xlupass)
{
switch (prop->type) {
case 0:
break;
case PROPTYPE_OBJ:
case PROPTYPE_DOOR:
case PROPTYPE_WEAPON:
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR | PROPTYPE_WEAPON)) {
gdl = objRender(prop, gdl, xlupass);
break;
case PROPTYPE_CHR:
} else if (prop->type == PROPTYPE_CHR) {
gdl = chrRender(prop, gdl, xlupass);
break;
case PROPTYPE_PLAYER:
gdl = playerRender(prop, gdl, xlupass);
break;
case PROPTYPE_EXPLOSION:
gdl = explosionRender(prop, gdl, xlupass);
break;
case PROPTYPE_SMOKE:
} else if (prop->type == PROPTYPE_SMOKE) {
gdl = smokeRender(prop, gdl, xlupass);
break;
} else if (prop->type == PROPTYPE_EXPLOSION) {
gdl = explosionRender(prop, gdl, xlupass);
} else if (prop->type == PROPTYPE_PLAYER) {
gdl = playerRender(prop, gdl, xlupass);
}
return gdl;
@@ -725,7 +715,7 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
if (!shortrange) {
chr0f027994(prop, &shotdata, arg1, arg8);
}
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
func0f085e00(prop, &shotdata);
}
}
@@ -761,9 +751,9 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
root = root->parent;
}
if (root->type == PROPTYPE_CHR || root->type == PROPTYPE_PLAYER) {
if (root->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
chrHit(&shotdata, &shotdata.hits[i]);
} else if (hitprop->type == PROPTYPE_OBJ || hitprop->type == PROPTYPE_WEAPON || hitprop->type == PROPTYPE_DOOR) {
} else if (hitprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
objHit(&shotdata, &shotdata.hits[i]);
}
@@ -928,13 +918,10 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
if (laserstream && shotdata.hits[i].distance > 300) {
done = true;
} else {
if (hitprop->type == PROPTYPE_CHR
|| hitprop->type == PROPTYPE_PLAYER) {
if (hitprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
result = hitprop;
done = true;
} else if (hitprop->type == PROPTYPE_OBJ
|| hitprop->type == PROPTYPE_WEAPON
|| hitprop->type == PROPTYPE_DOOR) {
} else if (hitprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
result = hitprop;
done = true;
}
@@ -1346,7 +1333,7 @@ void handsTickAttack(void)
void propExecuteTickOperation(struct prop *prop, s32 op)
{
if (op == TICKOP_FREE) {
if ((prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_OBJ)
if ((prop->type & (PROPTYPE_WEAPON | PROPTYPE_OBJ))
&& prop->obj && (prop->obj->hidden2 & OBJH2FLAG_CANREGEN)) {
struct defaultobj *obj = prop->obj;
@@ -1395,18 +1382,12 @@ struct prop *propFindForInteract(bool usingeyespy)
struct prop *prop = *ptr;
if (prop) {
if (prop->type == PROPTYPE_CHR) {
// empty
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
if (!usingeyespy) {
checkmore = objTestForInteract(prop);
}
} else if (prop->type == PROPTYPE_DOOR) {
checkmore = doorTestForInteract(prop);
} else if (prop->type == PROPTYPE_EXPLOSION) {
// empty
} else if (prop->type == PROPTYPE_SMOKE) {
// empty
}
if (!checkmore) {
@@ -1432,7 +1413,7 @@ void propFindForUplink(void)
struct prop *prop = *ptr;
if (prop) {
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
checkmore = objTestForInteract(prop);
}
@@ -1453,20 +1434,10 @@ bool currentPlayerInteract(bool eyespy)
prop = propFindForInteract(eyespy);
if (prop) {
switch (prop->type) {
case PROPTYPE_OBJ:
case PROPTYPE_WEAPON:
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
op = propobjInteract(prop);
break;
case PROPTYPE_DOOR:
} else if (prop->type == PROPTYPE_DOOR) {
op = propdoorInteract(prop);
break;
case PROPTYPE_CHR:
case PROPTYPE_EYESPY:
case PROPTYPE_PLAYER:
case PROPTYPE_EXPLOSION:
case PROPTYPE_SMOKE:
break;
}
propExecuteTickOperation(prop, op);
@@ -1809,7 +1780,7 @@ void propsTickPlayer(bool islastplayer)
// The player and projectiles must always be in the foreground
if (prop->type == PROPTYPE_PLAYER) {
i++;
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
obj = prop->obj;
if (obj->hidden & OBJHFLAG_PROJECTILE) {
@@ -1882,7 +1853,7 @@ void propsTickPlayer(bool islastplayer)
} else {
g_Vars.propstates[prop->propstateindex].foregroundpropcount++;
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
op = objTickPlayer(prop);
} else if (prop->type == PROPTYPE_EXPLOSION) {
op = explosionTickPlayer(prop);
@@ -1939,7 +1910,7 @@ void propsTickPlayer(bool islastplayer)
} else {
op = chrTick(prop);
}
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
obj = prop->obj;
if (!g_PausableObjs[obj->type]) {
@@ -2269,7 +2240,7 @@ void propSetPerimEnabled(struct prop *prop, s32 enable)
chrSetPerimEnabled(prop->chr, enable);
} else if (prop->type == PROPTYPE_PLAYER) {
playerSetPerimEnabled(prop, enable);
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR || prop->type == PROPTYPE_WEAPON) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR | PROPTYPE_WEAPON)) {
objSetPerimEnabled(prop, enable);
}
}
@@ -2301,20 +2272,8 @@ void propsTestForPickup(void)
s32 op = TICKOP_NONE;
if (prop->timetoregen <= 0 && prop->obj) {
switch (prop->type) {
case PROPTYPE_OBJ:
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
op = objTestForPickup(prop);
break;
case PROPTYPE_WEAPON:
op = weaponTestForPickup(prop);
break;
case PROPTYPE_DOOR:
case PROPTYPE_CHR:
case PROPTYPE_EYESPY:
case PROPTYPE_PLAYER:
case PROPTYPE_EXPLOSION:
case PROPTYPE_SMOKE:
break;
}
}
@@ -2561,9 +2520,7 @@ void autoaimTick(void)
bestprop = trackedprop->prop;
if (bestprop->type == PROPTYPE_OBJ
|| bestprop->type == PROPTYPE_WEAPON
|| bestprop->type == PROPTYPE_DOOR) {
if (bestprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
// trackedprop is an object
aimpos[0] = (trackedprop->x2 + trackedprop->x1) / 2;
aimpos[1] = (trackedprop->y2 + trackedprop->y1) / 2;
@@ -2780,7 +2737,7 @@ bool propIsOfCdType(struct prop *prop, u32 types)
result = false;
}
}
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
struct defaultobj *obj = prop->obj;
if (obj->unkgeo == NULL) {
@@ -3232,7 +3189,7 @@ void propGetBbox(struct prop *prop, f32 *radius, f32 *ymax, f32 *ymin)
chrGetBbox(prop, radius, ymax, ymin);
} else if (prop->type == PROPTYPE_PLAYER) {
playerGetBbox(prop, radius, ymax, ymin);
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR)) {
objGetBbox(prop, radius, ymax, ymin);
} else {
*radius = 0;
@@ -3249,7 +3206,7 @@ bool propUpdateGeometry(struct prop *prop, u8 **start, u8 **end)
result = playerUpdateGeometry(prop, start, end);
} else if (prop->type == PROPTYPE_CHR) {
result = chrUpdateGeometry(prop, start, end);
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR)) {
result = objUpdateGeometry(prop, start, end);
}
+27 -29
View File
@@ -142,7 +142,7 @@ bool doorCallLift(struct prop *doorprop, bool allowclose)
while (link) {
if (doorprop == link->door && link->lift
&& (link->lift->type == PROPTYPE_OBJ || link->lift->type == PROPTYPE_DOOR)) {
&& (link->lift->type & (PROPTYPE_OBJ | PROPTYPE_DOOR))) {
bool type = link->lift->obj->type;
handled = true;
@@ -1519,7 +1519,7 @@ void propCalculateShadeColour(struct prop *prop, u8 *nextcol, u16 floorcol)
mainOverrideVariable("scol", &scol);
mainOverrideVariable("salp", &salp);
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
obj = prop->obj;
} else {
obj = NULL;
@@ -3091,9 +3091,7 @@ bool projectileFindCollidingProp(struct prop *prop, struct coord *pos1, struct c
if (*propnumptr);
if (iterprop != prop) {
if (iterprop->type == PROPTYPE_OBJ
|| iterprop->type == PROPTYPE_WEAPON
|| iterprop->type == PROPTYPE_DOOR) {
if (iterprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
struct defaultobj *obj = iterprop->obj;
if ((obj->hidden & OBJHFLAG_ISRETICK) == 0 && (obj->flags2 & OBJFLAG2_THROWTHROUGH) == 0) {
@@ -4057,7 +4055,7 @@ void objLand(struct prop *prop, struct coord *arg1, struct coord *arg2, bool *em
bgunPlayPropHitSound(&weapon->gset, g_EmbedProp, -1);
if (weapon->weaponnum == WEAPON_COMBATKNIFE
&& (g_EmbedProp->type == PROPTYPE_CHR || g_EmbedProp->type == PROPTYPE_PLAYER)) {
&& (g_EmbedProp->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
chrSetPoisoned(g_EmbedProp->chr, ownerprop);
}
}
@@ -4198,7 +4196,7 @@ void weaponTick(struct prop *prop)
parent = parent->parent;
}
if (parent && (parent->type == PROPTYPE_CHR || parent->type == PROPTYPE_PLAYER)) {
if (parent && (parent->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
parent->chr->hidden |= CHRHFLAG_00000001;
} else {
projectile->ownerprop = NULL;
@@ -6406,7 +6404,7 @@ f32 objCollide(struct defaultobj *movingobj, struct coord *movingvel, f32 rotati
struct prop *obstacle = cdGetObstacleProp();
if (obstacle && g_Vars.lvupdate240 > 0) {
if (obstacle->type == PROPTYPE_CHR || obstacle->type == PROPTYPE_PLAYER) {
if (obstacle->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
if (1);
} else if (obstacle->type == PROPTYPE_OBJ) {
struct defaultobj *obstacleobj = obstacle->obj;
@@ -6679,7 +6677,7 @@ void platformDisplaceProps2(struct prop *platform, Mtxf *arg1)
while (*propnumptr >= 0) {
prop = &g_Vars.props[*propnumptr];
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
struct defaultobj *obj = prop->obj;
if (prop->pos.y > platform->pos.y
@@ -7622,7 +7620,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
}
#if VERSION >= VERSION_NTSC_1_0
if (g_EmbedProp && (g_EmbedProp->type == PROPTYPE_OBJ || g_EmbedProp->type == PROPTYPE_WEAPON || g_EmbedProp->type == PROPTYPE_DOOR)) {
if (g_EmbedProp && (g_EmbedProp->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR))) {
struct defaultobj *embedobj = g_EmbedProp->obj;
if (weapon
@@ -7634,7 +7632,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
#endif
if (hitprop != NULL) {
if (hitprop->type == PROPTYPE_OBJ || hitprop->type == PROPTYPE_WEAPON || hitprop->type == PROPTYPE_DOOR) {
if (hitprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
struct defaultobj *hitobj = hitprop->obj;
if ((hitobj->hidden & OBJHFLAG_PROJECTILE)
@@ -7663,7 +7661,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
}
}
}
} else if ((hitprop->type == PROPTYPE_CHR || hitprop->type == PROPTYPE_PLAYER)
} else if ((hitprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))
&& chrGetShield(hitprop->chr) > 0.0f) {
stick = false;
}
@@ -7738,7 +7736,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
func0f0341dc(g_EmbedProp->chr, 2.0f, &var8009ce78, &weapon->gset, ownerprop2,
g_EmbedHitPart, g_EmbedProp, g_EmbedNode, g_EmbedModel, g_EmbedSide, var8006993c);
} else if (g_EmbedProp->type == PROPTYPE_OBJ || g_EmbedProp->type == PROPTYPE_WEAPON) {
} else if (g_EmbedProp->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
if (var80069944 == 10000) {
f32 shield = (g_EmbedProp->obj->flags3 & OBJFLAG3_SHOWSHIELD) ? 4 : 8;
@@ -7755,7 +7753,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
if (hitprop->type == PROPTYPE_CHR || (hitprop->type == PROPTYPE_PLAYER && hitprop->chr)) {
struct chrdata *chr = hitprop->chr;
func0f034080(chr, g_EmbedNode, g_EmbedProp, g_EmbedModel, g_EmbedSide, var8006993c);
} else if ((hitprop->type == PROPTYPE_OBJ || hitprop->type == PROPTYPE_WEAPON) && var80069944 == 10000) {
} else if ((hitprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) && var80069944 == 10000) {
shield = (hitprop->obj->flags3 & OBJFLAG3_SHOWSHIELD) ? 4 : 8;
shieldhitCreate(hitprop, shield, g_EmbedProp, g_EmbedNode, g_EmbedModel, g_EmbedSide, var8006993c);
@@ -7782,7 +7780,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
if (objIsHealthy(g_EmbedProp->obj)) {
mpstatsIncrementPlayerShotCount(&weapon->gset, SHOTREGION_OBJECT);
}
} else if (g_EmbedProp->type == PROPTYPE_CHR || g_EmbedProp->type == PROPTYPE_PLAYER) {
} else if (g_EmbedProp->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *embedchr = g_EmbedProp->chr;
bool dead = false;
@@ -7822,7 +7820,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
setCurrentPlayerNum(prevplayernum);
}
if (hitprop == NULL || hitprop->type == PROPTYPE_OBJ || hitprop->type == PROPTYPE_WEAPON || hitprop->type == PROPTYPE_DOOR) {
if (hitprop == NULL || (hitprop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR))) {
struct coord dir;
struct prop *ownerprop = obj->projectile->ownerprop;
@@ -7856,7 +7854,7 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded)
} else {
s16 rooms[8];
if (g_EmbedProp && (g_EmbedProp->type == PROPTYPE_CHR || g_EmbedProp->type == PROPTYPE_PLAYER)) {
if (g_EmbedProp && (g_EmbedProp->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
sp5dc.x = prop->pos.x;
sp5dc.z = prop->pos.z;
} else {
@@ -8477,7 +8475,7 @@ void platformDisplaceProps(struct prop *platform, s16 *propnums, struct coord *p
while (*propnumptr >= 0) {
prop = &g_Vars.props[*propnumptr];
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
struct defaultobj *obj = prop->obj;
if ((obj->hidden & OBJHFLAG_00020000) == 0) {
if ((obj->hidden & OBJHFLAG_PROJECTILE) == 0
@@ -9097,7 +9095,7 @@ void autogunTick(struct prop *prop)
if (target) {
if (target->chr == NULL) {
target = NULL;
} else if (target->type != PROPTYPE_CHR && target->type != PROPTYPE_PLAYER && !frIsInTraining()) {
} else if ((target->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) == 0 && !frIsInTraining()) {
target = NULL;
}
}
@@ -9546,7 +9544,7 @@ void autogunTickShoot(struct prop *autogunprop)
// SP: If the hit prop is a chr and it's our target
// MP: If the hit prop is a chr
if (hitprop
&& (hitprop->type == PROPTYPE_CHR || hitprop->type == PROPTYPE_PLAYER)
&& (hitprop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))
&& (g_Vars.normmplayerisrunning || targetprop == hitprop)) {
struct modelnode *hitnode = NULL;
struct model *hitmodel = NULL;
@@ -14717,7 +14715,7 @@ void objDetach(struct prop *prop)
obj->hidden &= ~OBJHFLAG_HASOWNER;
if (parent->type == PROPTYPE_CHR || parent->type == PROPTYPE_PLAYER) {
if (parent->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct chrdata *chr = parent->chr;
if (chr) {
@@ -15034,7 +15032,7 @@ void objDestroySupportedObjects(struct prop *tableprop, s32 playernum)
while (*propnumptr >= 0) {
prop = &g_Vars.props[*propnumptr];
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON)) {
struct defaultobj *obj = prop->obj;
#if VERSION >= VERSION_NTSC_1_0
@@ -19020,7 +19018,7 @@ bool doorIsRangeEmpty(struct doorobj *door)
while (*propnumptr >= 0) {
struct prop *prop = &g_Vars.props[*propnumptr];
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
if (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
if (doorIsPosInRange(door, &prop->pos, 0, false)) {
return false;
}
@@ -19437,7 +19435,7 @@ void doorPlayOpeningSound(s32 soundtype, struct prop *prop)
func0f0926bc(prop, 12, 0xffff);
if (g_Vars.in_cutscene
&& (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR)
&& (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR))
&& (prop->obj->flags3 & OBJFLAG3_AUTOCUTSCENESOUNDS) == 0) {
return;
}
@@ -19514,7 +19512,7 @@ void doorPlayClosingSound(s32 soundtype, struct prop *prop)
func0f0926bc(prop, 12, 0xffff);
if (g_Vars.in_cutscene
&& (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR)
&& (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR))
&& (prop->obj->flags3 & OBJFLAG3_AUTOCUTSCENESOUNDS) == 0) {
return;
}
@@ -19573,7 +19571,7 @@ void doorPlayOpenedSound(s32 soundtype, struct prop *prop)
func0f0926bc(prop, 12, 0xffff);
if (g_Vars.in_cutscene
&& (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR)
&& (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR))
&& (prop->obj->flags3 & OBJFLAG3_AUTOCUTSCENESOUNDS) == 0) {
return;
}
@@ -19626,7 +19624,7 @@ void doorPlayClosedSound(s32 soundtype, struct prop *prop)
func0f0926bc(prop, 12, 0xffff);
if (g_Vars.in_cutscene
&& (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR)
&& (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR))
&& (prop->obj->flags3 & OBJFLAG3_AUTOCUTSCENESOUNDS) == 0) {
return;
}
@@ -21243,7 +21241,7 @@ void projectileCreate(struct prop *fromprop, struct fireslotthing *arg1, struct
if (blocked) {
if (obstacle) {
if (obstacle->type == PROPTYPE_CHR || obstacle->type == PROPTYPE_PLAYER) {
if (obstacle->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) {
struct modelnode *node = NULL;
struct model *model = NULL;
s32 side = -1;
@@ -21265,7 +21263,7 @@ void projectileCreate(struct prop *fromprop, struct fireslotthing *arg1, struct
}
func0f0341dc(chr, gsetGetDamage(&gset), dir, &gset, 0, hitpart, obstacle, node, model, side, NULL);
} else if (obstacle->type == PROPTYPE_OBJ || obstacle->type == PROPTYPE_WEAPON || obstacle->type == PROPTYPE_DOOR) {
} else if (obstacle->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
struct defaultobj *obj = obstacle->obj;
if (weaponnum != WEAPON_CHOPPERGUN) {
+1 -1
View File
@@ -72,7 +72,7 @@ void propsTick(void)
if (prop->type == PROPTYPE_CHR) {
tickop = chrTickBeams(prop);
} else if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
} else if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
tickop = objTick(prop);
} else if (prop->type == PROPTYPE_EXPLOSION) {
tickop = explosionTick(prop);
+2 -7
View File
@@ -429,10 +429,7 @@ Gfx *radarRenderRTrackedProps(Gfx *gdl)
struct coord dist2;
while (prop) {
switch (prop->type) {
case PROPTYPE_OBJ:
case PROPTYPE_DOOR:
case PROPTYPE_WEAPON:
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR | PROPTYPE_WEAPON)) {
obj = prop->obj;
if ((obj->flags3 & OBJFLAG3_RTRACKED_YELLOW) ||
@@ -445,8 +442,7 @@ Gfx *radarRenderRTrackedProps(Gfx *gdl)
(obj->flags3 & OBJFLAG3_RTRACKED_YELLOW) ? 0xffff0000 : 0x0000ff00,
0, 0);
}
break;
case PROPTYPE_CHR:
} else if (prop->type == PROPTYPE_CHR) {
chr = prop->chr;
if (chr && chr->rtracked
@@ -458,7 +454,6 @@ Gfx *radarRenderRTrackedProps(Gfx *gdl)
dist2.z = prop->pos.z - playerpos->z;
gdl = radarDrawDot(gdl, prop, &dist2, 0xff000000, 0, 0);
}
break;
}
prop = prop->next;
+3 -3
View File
@@ -33,7 +33,7 @@ bool sightIsPropFriendly(struct prop *prop)
return false;
}
if (prop->type != PROPTYPE_CHR && prop->type != PROPTYPE_PLAYER) {
if ((prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER)) == 0) {
return false;
}
@@ -85,7 +85,7 @@ bool sightCanTargetProp(struct prop *prop, s32 max)
return true;
}
if ((prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR)
if ((prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR))
&& prop->obj && (prop->obj->flags3 & OBJFLAG3_REACTTOSIGHT)) {
return true;
}
@@ -106,7 +106,7 @@ bool sightIsReactiveToProp(struct prop *prop)
return false;
}
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_DOOR) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_WEAPON | PROPTYPE_DOOR)) {
struct defaultobj *obj = prop->obj;
if (g_Vars.stagenum == STAGE_CITRAINING
+1 -1
View File
@@ -327,7 +327,7 @@ bool splat0f149274(f32 arg0, struct prop *chrprop, struct shotdata *shotdata, f3
struct prop *prop = *propptr;
if (prop) {
if (prop->type == PROPTYPE_OBJ || prop->type == PROPTYPE_DOOR || prop->type == PROPTYPE_WEAPON) {
if (prop->type & (PROPTYPE_OBJ | PROPTYPE_DOOR | PROPTYPE_WEAPON)) {
func0f085e00(prop, &stackshotdata);
if (1);
}
+7 -5
View File
@@ -1544,11 +1544,13 @@ bool frIsAmmoWasted(void)
prop = &g_Vars.props[*propnumptr];
child = prop->child;
if ((child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_TIMEDMINE)
|| (child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_REMOTEMINE)
|| (child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_PROXIMITYMINE)
|| (child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_GRENADEROUND)) {
return false;
if (child && child->type == PROPTYPE_WEAPON) {
if (child->weapon->weaponnum == WEAPON_TIMEDMINE
|| child->weapon->weaponnum == WEAPON_REMOTEMINE
|| child->weapon->weaponnum == WEAPON_PROXIMITYMINE
|| child->weapon->weaponnum == WEAPON_GRENADEROUND) {
return false;
}
}
if (prop->type == PROPTYPE_WEAPON) {
+1 -1
View File
@@ -229,7 +229,7 @@ bool chrIsUsingPaintball(struct chrdata *chr)
void wallhitChooseBloodColour(struct prop *prop)
{
if (prop && prop->chr && (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER)) {
if (prop && prop->chr && (prop->type & (PROPTYPE_CHR | PROPTYPE_PLAYER))) {
struct chrdata *chr = prop->chr;
chrGetBloodColour(chr->bodynum, g_WallhitBloodColour, NULL);
} else {
+8 -8
View File
@@ -3541,14 +3541,14 @@ enum rspevent {
#define PROPFLAG_ONANYSCREENTHISTICK 0x40
#define PROPFLAG_ONANYSCREENPREVTICK 0x80
#define PROPTYPE_OBJ 1
#define PROPTYPE_DOOR 2
#define PROPTYPE_CHR 3
#define PROPTYPE_WEAPON 4
#define PROPTYPE_EYESPY 5
#define PROPTYPE_PLAYER 6
#define PROPTYPE_EXPLOSION 7
#define PROPTYPE_SMOKE 8
#define PROPTYPE_OBJ 0x01
#define PROPTYPE_DOOR 0x02
#define PROPTYPE_CHR 0x04
#define PROPTYPE_WEAPON 0x08
#define PROPTYPE_EYESPY 0x10
#define PROPTYPE_PLAYER 0x20
#define PROPTYPE_EXPLOSION 0x40
#define PROPTYPE_SMOKE 0x80
#define QUADRANT_BACK 0x01
#define QUADRANT_SIDE1 0x02