mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-12 11:42:15 -04:00
Rename player.itemswitch to devicesactive and introduce DEVICE constants
This commit is contained in:
+5
-5
@@ -4020,7 +4020,7 @@ void chrUpdateCloak(struct chrdata *chr)
|
||||
prevplayernum = g_Vars.currentplayernum;
|
||||
setCurrentPlayerNum(propGetPlayerNum(chr->prop));
|
||||
|
||||
if (g_Vars.currentplayer->itemswitch & 0x00000040) {
|
||||
if (g_Vars.currentplayer->devicesactive & DEVICE_CLOAKDEVICE) {
|
||||
// Cloak is active - but may or may not be in effect due to recent shooting
|
||||
s32 qty = ammoGetQuantity(AMMOTYPE_CLOAK);
|
||||
|
||||
@@ -4037,19 +4037,19 @@ void chrUpdateCloak(struct chrdata *chr)
|
||||
}
|
||||
} else {
|
||||
// Out of cloak ammo - turn off cloak
|
||||
g_Vars.currentplayer->itemswitch &= ~0x00000040;
|
||||
g_Vars.currentplayer->devicesactive &= ~DEVICE_CLOAKDEVICE;
|
||||
}
|
||||
}
|
||||
|
||||
// If cloak is enabled via cloaking device or via RCP120
|
||||
if ((g_Vars.currentplayer->itemswitch & 0x00000040)
|
||||
if ((g_Vars.currentplayer->devicesactive & DEVICE_CLOAKDEVICE)
|
||||
|| (g_Vars.currentplayer->weaponnum == WEAPON_RCP120
|
||||
&& (g_Vars.currentplayer->itemswitch & 0x00000080))) {
|
||||
&& (g_Vars.currentplayer->devicesactive & DEVICE_CLOAKRCP120))) {
|
||||
if ((chr->hidden & CHRHFLAG_CLOAKED) == 0 && chr->cloakpause < 1) {
|
||||
chrCloak(chr, true);
|
||||
}
|
||||
} else {
|
||||
if ((g_Vars.currentplayer->itemswitch & 0x00000040) == 0
|
||||
if ((g_Vars.currentplayer->devicesactive & DEVICE_CLOAKDEVICE) == false
|
||||
&& (chr->hidden & CHRHFLAG_CLOAKED)) {
|
||||
chrUncloak(chr, true);
|
||||
}
|
||||
|
||||
@@ -10155,7 +10155,7 @@ bool aiClearInventory(void)
|
||||
|
||||
if (g_Vars.currentplayer == g_Vars.bond || g_Vars.currentplayer == g_Vars.coop) {
|
||||
currentPlayerClearInventory();
|
||||
g_Vars.currentplayer->itemswitch = 0;
|
||||
g_Vars.currentplayer->devicesactive = 0;
|
||||
currentPlayerGiveWeapon(WEAPON_UNARMED);
|
||||
currentPlayerEquipWeapon(WEAPON_UNARMED);
|
||||
}
|
||||
|
||||
+4
-4
@@ -118,12 +118,12 @@ u8 func0f000a10(s32 roomnum)
|
||||
if ((g_Vars.currentplayer->isdead == false
|
||||
&& var80070764 == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54 & 1))
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_NIGHTVISION))
|
||||
||
|
||||
(g_Vars.currentplayer->isdead == false
|
||||
&& var80070764 == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54 & 8))) {
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_IRSCANNER))) {
|
||||
value += var8009caec;
|
||||
} else {
|
||||
value += g_Rooms[roomnum].unk4b;
|
||||
@@ -152,12 +152,12 @@ u8 func0f000b24(s32 roomnum)
|
||||
if ((g_Vars.currentplayer->isdead == false
|
||||
&& var80070764 == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54 & 1))
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_NIGHTVISION))
|
||||
||
|
||||
(g_Vars.currentplayer->isdead == false
|
||||
&& var80070764 == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54 & 8))) {
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_IRSCANNER))) {
|
||||
return var8009caec;
|
||||
}
|
||||
|
||||
|
||||
@@ -2574,12 +2574,12 @@ glabel var7f1a863c
|
||||
// }
|
||||
//
|
||||
// // d5e8
|
||||
// g_Vars.players[i]->unk1c54 = 0;
|
||||
// g_Vars.players[i]->devicesinhibit = 0;
|
||||
//
|
||||
// if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||
// && PLAYERCOUNT() >= 2
|
||||
// && g_Menus[mpindex].curframe) {
|
||||
// g_Vars.players[i]->unk1c54 = 15;
|
||||
// g_Vars.players[i]->devicesinhibit = 15;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -20625,7 +20625,7 @@ void currentPlayerTickInventory(bool triggeron)
|
||||
}
|
||||
|
||||
g_Vars.currentplayer->unk1583_00 = 0;
|
||||
g_Vars.currentplayer->itemswitch = 0;
|
||||
g_Vars.currentplayer->devicesactive = 0;
|
||||
chr->cloakpause = 0;
|
||||
chr->cloakfadefrac = 0;
|
||||
chr->cloakfadefinished = false;
|
||||
|
||||
+16
-9
@@ -6678,7 +6678,14 @@ void currentPlayerLaunchSlayerRocket(struct weaponobj *rocket)
|
||||
{
|
||||
g_Vars.currentplayer->slayerrocket = rocket;
|
||||
g_Vars.currentplayer->visionmode = VISIONMODE_SLAYERROCKET;
|
||||
g_Vars.currentplayer->itemswitch &= ~0x0000000f;
|
||||
|
||||
// Turn off these devices
|
||||
g_Vars.currentplayer->devicesactive &= ~(
|
||||
DEVICE_NIGHTVISION |
|
||||
DEVICE_XRAYSCANNER |
|
||||
DEVICE_EYESPY |
|
||||
DEVICE_IRSCANNER);
|
||||
|
||||
g_Vars.currentplayer->badrockettime = 0;
|
||||
}
|
||||
|
||||
@@ -9341,7 +9348,7 @@ glabel var7f1ad6ac
|
||||
// }
|
||||
//
|
||||
// // dcdc
|
||||
// if (g_Vars.currentplayer->itemswitch & 0x20) {
|
||||
// if (g_Vars.currentplayer->devicesactive & DEVICE_SUICIDEPILL) {
|
||||
// // Suicide pill?
|
||||
// currentPlayerDieByShooter(g_Vars.currentplayernum, true);
|
||||
// }
|
||||
@@ -9364,7 +9371,7 @@ glabel var7f1ad6ac
|
||||
// func0f0926bc(eyespy->prop, 1, 0xffff);
|
||||
// chr->chrflags |= CHRCFLAG_HIDDEN;
|
||||
// chr->chrflags |= CHRCFLAG_INVINCIBLE_TO_GUNFIRE;
|
||||
// g_Vars.currentplayer->itemswitch &= ~0x00000004;
|
||||
// g_Vars.currentplayer->devicesactive &= ~DEVICE_EYESPY;
|
||||
// } else {
|
||||
// // dd7c
|
||||
// if (eyespy->init == false) {
|
||||
@@ -9390,19 +9397,19 @@ glabel var7f1ad6ac
|
||||
// }
|
||||
// } else {
|
||||
// // de34
|
||||
// if ((g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->joybutinhibit & 4)
|
||||
// if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->joybutinhibit & DEVICE_EYESPY)
|
||||
// && g_PlayersWithControl[playernum]
|
||||
// && func0f0d0310() == 0) {
|
||||
// eyespy->init = true;
|
||||
// eyespy->active = false;
|
||||
// g_Vars.currentplayer->itemswitch &= ~0x00000004;
|
||||
// g_Vars.currentplayer->devicesactive &= ~DEVICE_EYESPY;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // de90
|
||||
// if (eyespy->initialised
|
||||
// && g_PlayersWithControl[playernum]
|
||||
// && (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->joybutinhibit & 4)) {
|
||||
// && (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->joybutinhibit & DEVICE_EYESPY)) {
|
||||
// // ded8
|
||||
// if (eyespy->active == false) {
|
||||
// eyespy->buttonheld = eyespy->camerabuttonheld = false;
|
||||
@@ -9462,7 +9469,7 @@ glabel var7f1ad6ac
|
||||
// } else {
|
||||
// // e120
|
||||
// if (g_Vars.currentplayer->eyespy
|
||||
// && (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->joybutinhibit & 4)
|
||||
// && (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->joybutinhibit & DEVICE_EYESPY)
|
||||
// && g_Vars.currentplayer->eyespy->active) {
|
||||
// struct coord sp776;
|
||||
// currentPlayerSetFovY(120);
|
||||
@@ -11413,13 +11420,13 @@ Gfx *func0f0c07c8(Gfx *gdl)
|
||||
if (g_Vars.currentplayer->isdead == false
|
||||
&& var80070764 == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& ((g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54) & 1)) {
|
||||
&& ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit) & DEVICE_NIGHTVISION)) {
|
||||
gdl = func0f1472fc(gdl);
|
||||
gdl = func0f147570(gdl);
|
||||
} else if (g_Vars.currentplayer->isdead == false
|
||||
&& var80070764 == 0
|
||||
&& (!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))
|
||||
&& ((g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54) & 8)) {
|
||||
&& ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit) & DEVICE_IRSCANNER)) {
|
||||
gdl = func0f147578(gdl);
|
||||
gdl = hudRenderIrBinoculars(gdl);
|
||||
}
|
||||
|
||||
@@ -1609,7 +1609,7 @@ Gfx *renderFrame(Gfx *gdl)
|
||||
if (g_Vars.currentplayer->isdead
|
||||
|| var80070764
|
||||
|| !EYESPYINACTIVE()
|
||||
|| (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54 & 8) == 0) {
|
||||
|| (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_IRSCANNER) == false) {
|
||||
g_Vars.currentplayer->lookingatprop.prop = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1657,7 +1657,7 @@ Gfx *renderFrame(Gfx *gdl)
|
||||
|
||||
// Handle eyespy Z presses
|
||||
if (g_Vars.currentplayer->eyespy
|
||||
&& (g_Vars.currentplayer->itemswitch & ~g_Vars.currentplayer->unk1c54 & 4)
|
||||
&& (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_EYESPY)
|
||||
&& g_Vars.currentplayer->eyespy->camerabuttonheld) {
|
||||
if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) {
|
||||
objectiveCheckHolograph(400);
|
||||
|
||||
+1
-1
@@ -4692,7 +4692,7 @@ void dtRestorePlayer(void)
|
||||
|
||||
func0f0926bc(g_Vars.currentplayer->eyespy->prop, 1, 0xffff);
|
||||
|
||||
g_Vars.currentplayer->itemswitch &= ~0x04;
|
||||
g_Vars.currentplayer->devicesactive &= ~DEVICE_EYESPY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -536,6 +536,15 @@
|
||||
#define DESCRIPTION_DEVICETIP1 0x0b
|
||||
#define DESCRIPTION_DEVICETIP2 0x0c
|
||||
|
||||
#define DEVICE_NIGHTVISION 0x01
|
||||
#define DEVICE_XRAYSCANNER 0x02
|
||||
#define DEVICE_EYESPY 0x04
|
||||
#define DEVICE_IRSCANNER 0x08
|
||||
#define DEVICE_RTRACKER 0x10
|
||||
#define DEVICE_SUICIDEPILL 0x20
|
||||
#define DEVICE_CLOAKDEVICE 0x40
|
||||
#define DEVICE_CLOAKRCP120 0x80
|
||||
|
||||
#define DIFF_A 0x00
|
||||
#define DIFF_SA 0x01
|
||||
#define DIFF_PA 0x02
|
||||
|
||||
+2
-6
@@ -2219,11 +2219,7 @@ struct player {
|
||||
/*0x00b8*/ f32 crouchspeed;
|
||||
/*0x00bc*/ struct prop *prop;
|
||||
/*0x00c0*/ bool bondperimenabled;
|
||||
|
||||
// 0x00000040 = cloaking device enabled
|
||||
// 0x00000080 = RCP120 cloak enabled
|
||||
/*0x00c4*/ u32 itemswitch;
|
||||
|
||||
/*0x00c4*/ u32 devicesactive;
|
||||
/*0x00c8*/ s32 badrockettime;
|
||||
/*0x00cc*/ u32 unk00cc;
|
||||
/*0x00d0*/ s32 bondactivateorreload;
|
||||
@@ -2795,7 +2791,7 @@ struct player {
|
||||
/*0x1c4c*/ f32 unk1c4c;
|
||||
/*0x1c50*/ u8 unk1c50_01 : 1;
|
||||
/*0x1c51*/ u8 disguised : 1;
|
||||
/*0x1c54*/ u32 unk1c54;
|
||||
/*0x1c54*/ u32 devicesinhibit;
|
||||
/*0x1c58*/ f32 unk1c58;
|
||||
/*0x1c5c*/ f32 stealhealth;
|
||||
/*0x1c60*/ s32 unk1c60;
|
||||
|
||||
Reference in New Issue
Block a user