mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-07-04 20:15:28 -04:00
Introduce DEVICE_IS_ACTIVE
This commit is contained in:
+6
-9
@@ -1442,7 +1442,7 @@ s32 bgun_tick_inc_reload(struct handweaponinfo *info, s32 handnum, struct hand *
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
if (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY) {
|
||||
if (DEVICE_IS_ACTIVE(DEVICE_EYESPY)) {
|
||||
hand->incrementalreloading = false;
|
||||
}
|
||||
#endif
|
||||
@@ -4083,7 +4083,7 @@ bool bgun_load_all(void)
|
||||
{
|
||||
// PAL adds a check for the eyespy being used
|
||||
#if VERSION >= VERSION_PAL_BETA
|
||||
if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY)) {
|
||||
if (DEVICE_IS_ACTIVE(DEVICE_EYESPY)) {
|
||||
g_Vars.currentplayer->gunctrl.loadall = false;
|
||||
return false;
|
||||
}
|
||||
@@ -6662,8 +6662,7 @@ void bgun_update_lasersight(struct hand *hand, struct modeldef *modeldef, s32 ha
|
||||
|
||||
mtx4_transform_vec_in_place(cam_get_projection_mtxf(), &beamnear);
|
||||
|
||||
if (hand->useposrot
|
||||
|| (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_XRAYSCANNER)) {
|
||||
if (hand->useposrot || DEVICE_IS_ACTIVE(DEVICE_XRAYSCANNER)) {
|
||||
beamfar.x = 0.0f;
|
||||
beamfar.y = 0.0f;
|
||||
beamfar.z = 1.0f;
|
||||
@@ -7981,12 +7980,11 @@ void bgun_tick_gameplay2(void)
|
||||
}
|
||||
|
||||
// Return control to Jo if eyespy has been deselected
|
||||
if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY) == 0
|
||||
&& player->eyespy) {
|
||||
if (!DEVICE_IS_ACTIVE(DEVICE_EYESPY) && player->eyespy) {
|
||||
player->eyespy->active = false;
|
||||
}
|
||||
|
||||
if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_XRAYSCANNER)
|
||||
if (DEVICE_IS_ACTIVE(DEVICE_XRAYSCANNER)
|
||||
&& (bgun_get_weapon_num(HAND_RIGHT) != WEAPON_FARSIGHT || player->gunsightoff)) {
|
||||
// Using normal xray scanner (not Farsight zoom)
|
||||
if (player->visionmode != VISIONMODE_XRAY) {
|
||||
@@ -8047,8 +8045,7 @@ void bgun_tick_gameplay2(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Vars.currentplayer->devicesactive &
|
||||
~g_Vars.currentplayer->devicesinhibit & DEVICE_CLOAKRCP120) {
|
||||
if (DEVICE_IS_ACTIVE(DEVICE_CLOAKRCP120)) {
|
||||
if (player->gunctrl.weaponnum == WEAPON_RCP120) {
|
||||
struct chrdata *chr = player->prop->chr;
|
||||
|
||||
|
||||
+1
-1
@@ -1270,7 +1270,7 @@ Gfx *lv_render(Gfx *gdl)
|
||||
|
||||
// Handle eyespy Z presses
|
||||
if (g_Vars.currentplayer->eyespy
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY)
|
||||
&& DEVICE_IS_ACTIVE(DEVICE_EYESPY)
|
||||
&& g_Vars.currentplayer->eyespy->camerabuttonheld) {
|
||||
if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) {
|
||||
objective_check_holograph(400);
|
||||
|
||||
+1
-3
@@ -5236,9 +5236,7 @@ Gfx *menu_render(Gfx *gdl)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Vars.currentplayer->eyespy
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY)
|
||||
&& g_Vars.currentplayer->eyespy->active) {
|
||||
if (g_Vars.currentplayer->eyespy && DEVICE_IS_ACTIVE(DEVICE_EYESPY) && g_Vars.currentplayer->eyespy->active) {
|
||||
removepiece = true;
|
||||
}
|
||||
|
||||
|
||||
+5
-11
@@ -3262,9 +3262,7 @@ void player_tick(bool arg0)
|
||||
} else {
|
||||
// Eyespy is held
|
||||
// If eyespy is activated, launch it
|
||||
if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY)
|
||||
&& g_PlayersWithControl[playernum]
|
||||
&& !eyespy_try_launch()) {
|
||||
if (DEVICE_IS_ACTIVE(DEVICE_EYESPY) && g_PlayersWithControl[playernum] && !eyespy_try_launch()) {
|
||||
// Launch failed
|
||||
eyespy->held = true;
|
||||
eyespy->active = false;
|
||||
@@ -3272,9 +3270,7 @@ void player_tick(bool arg0)
|
||||
}
|
||||
}
|
||||
|
||||
if (eyespy->deployed
|
||||
&& g_PlayersWithControl[playernum]
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY)) {
|
||||
if (eyespy->deployed && g_PlayersWithControl[playernum] && DEVICE_IS_ACTIVE(DEVICE_EYESPY)) {
|
||||
// Eyespy is being controlled
|
||||
if (eyespy->active == false) {
|
||||
// Eyespy is being turned off
|
||||
@@ -3330,9 +3326,7 @@ void player_tick(bool arg0)
|
||||
for (i = 0; i < PLAYERCOUNT(); i++) {
|
||||
g_Vars.players[i]->joybutinhibit = 0xffffffff;
|
||||
}
|
||||
} else if (g_Vars.currentplayer->eyespy
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY)
|
||||
&& g_Vars.currentplayer->eyespy->active) {
|
||||
} else if (g_Vars.currentplayer->eyespy && DEVICE_IS_ACTIVE(DEVICE_EYESPY) && g_Vars.currentplayer->eyespy->active) {
|
||||
// Controlling an eyespy
|
||||
struct coord sp308;
|
||||
playermgr_set_fov_y(120);
|
||||
@@ -4503,13 +4497,13 @@ Gfx *player_render_hud(Gfx *gdl)
|
||||
if (g_Vars.currentplayer->isdead == false
|
||||
&& g_InCutscene == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit) & DEVICE_NIGHTVISION)) {
|
||||
&& DEVICE_IS_ACTIVE(DEVICE_NIGHTVISION)) {
|
||||
gdl = bview_draw_nv_lens(gdl);
|
||||
gdl = bview_draw_nv_binoculars(gdl);
|
||||
} else if (g_Vars.currentplayer->isdead == false
|
||||
&& g_InCutscene == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit) & DEVICE_IRSCANNER)) {
|
||||
&& DEVICE_IS_ACTIVE(DEVICE_IRSCANNER)) {
|
||||
gdl = bview_draw_ir_lens(gdl);
|
||||
gdl = bview_draw_ir_binoculars(gdl);
|
||||
}
|
||||
|
||||
+2
-4
@@ -954,10 +954,8 @@ void obj_get_screeninfo(struct coord *arg0, f32 *arg1, f32 *arg2, f32 *arg3, f32
|
||||
f32 aspect = vi_get_aspect();
|
||||
f32 fovy = vi_get_fov_y();
|
||||
|
||||
if (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY) {
|
||||
if (g_Vars.currentplayer->eyespy && g_Vars.currentplayer->eyespy->active) {
|
||||
fovy = 120.0f;
|
||||
}
|
||||
if (DEVICE_IS_ACTIVE(DEVICE_EYESPY) && g_Vars.currentplayer->eyespy && g_Vars.currentplayer->eyespy->active) {
|
||||
fovy = 120.0f;
|
||||
}
|
||||
|
||||
sp4c.x = arg1[0];
|
||||
|
||||
+3
-3
@@ -261,10 +261,10 @@ Gfx *radar_render(Gfx *gdl)
|
||||
return gdl;
|
||||
}
|
||||
|
||||
if ((g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.displayoptions & 0x00000004) == 0) {
|
||||
if ((g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.displayoptions & MPDISPLAYOPTION_RADAR) == 0) {
|
||||
return gdl;
|
||||
}
|
||||
} else if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_RTRACKER) == 0) {
|
||||
} else if (!DEVICE_IS_ACTIVE(DEVICE_RTRACKER)) {
|
||||
if (!g_MissionConfig.iscoop || !g_Vars.coopradaron) {
|
||||
return gdl;
|
||||
}
|
||||
@@ -394,7 +394,7 @@ Gfx *radar_render(Gfx *gdl)
|
||||
gdl = scenario_radar_extra(gdl);
|
||||
|
||||
// Draw dots for r-tracked props
|
||||
if (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_RTRACKER) {
|
||||
if (DEVICE_IS_ACTIVE(DEVICE_RTRACKER)) {
|
||||
gdl = radar_render_r_tracked_props(gdl);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,10 +83,12 @@
|
||||
#define VALIDWEAPON() (g_Vars.currentplayer->gunctrl.weaponnum >= WEAPON_UNARMED && g_Vars.currentplayer->gunctrl.weaponnum <= WEAPON_COMBATBOOST)
|
||||
#define FUNCISSEC() (VALIDWEAPON() && (g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->gunctrl.weaponnum - 1) >> 3] & (1 << ((g_Vars.currentplayer->gunctrl.weaponnum - 1) & 7))))
|
||||
|
||||
#define DEVICE_IS_ACTIVE(device) (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & (device))
|
||||
|
||||
#define USINGDEVICE(device) (!g_Vars.currentplayer->isdead \
|
||||
&& !g_InCutscene \
|
||||
&& EYESPYINACTIVE() \
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & (device)))
|
||||
&& DEVICE_IS_ACTIVE(device))
|
||||
|
||||
#if VERSION >= VERSION_PAL_BETA
|
||||
#define LVUPDATE60FREAL() g_Vars.lvupdate60freal
|
||||
|
||||
Reference in New Issue
Block a user