diff --git a/src/game/bondgun.c b/src/game/bondgun.c index c9bf7bff5..4c14ac833 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -6546,7 +6546,8 @@ void bgunUpdateLasersight(struct hand *hand, struct modelfiledata *modeldef, s32 mtx4TransformVecInPlace(camGetProjectionMtxF(), &beamnear); - if (hand->useposrot) { + if (hand->useposrot + || (g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_XRAYSCANNER)) { beamfar.x = 0.0f; beamfar.y = 0.0f; beamfar.z = 1.0f; @@ -7858,33 +7859,51 @@ void bgunTickGameplay2(void) bgunTickLoad(); } - if (player->gunsightoff == 0) { - if (player->hands[HAND_RIGHT].gset.weaponnum == WEAPON_FARSIGHT) { - // Aiming with the Farsight - if (player->visionmode != VISIONMODE_XRAY) { - player->erasertime = 0; - } else { - player->erasertime += g_Vars.lvupdate240; - } - - player->visionmode = VISIONMODE_XRAY; - player->ecol_1 = 16; - player->ecol_2 = 24; - player->ecol_3 = 8; - player->epcol_0 = 0; - player->epcol_1 = 1; - player->epcol_2 = 2; + if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_XRAYSCANNER) + && (bgunGetWeaponNum(HAND_RIGHT) != WEAPON_FARSIGHT || player->gunsightoff)) { + // Using normal xray scanner (not Farsight zoom) + if (player->visionmode != VISIONMODE_XRAY) { + player->erasertime = 0; } else { - // Aiming with non-Farsight + player->erasertime += g_Vars.lvupdate240; + } + + player->visionmode = VISIONMODE_XRAY; + player->ecol_1 = 24; + player->ecol_2 = 8; + player->ecol_3 = 24; + player->epcol_0 = 2; + player->epcol_1 = 0; + player->epcol_2 = 1; + } else { + if (player->gunsightoff == 0) { + if (player->hands[HAND_RIGHT].gset.weaponnum == WEAPON_FARSIGHT) { + // Aiming with the Farsight + if (player->visionmode != VISIONMODE_XRAY) { + player->erasertime = 0; + } else { + player->erasertime += g_Vars.lvupdate240; + } + + player->visionmode = VISIONMODE_XRAY; + player->ecol_1 = 16; + player->ecol_2 = 24; + player->ecol_3 = 8; + player->epcol_0 = 0; + player->epcol_1 = 1; + player->epcol_2 = 2; + } else { + // Aiming with non-Farsight + if (player->visionmode != VISIONMODE_SLAYERROCKET) { + player->visionmode = VISIONMODE_NORMAL; + } + } + } else { + // Not aiming if (player->visionmode != VISIONMODE_SLAYERROCKET) { player->visionmode = VISIONMODE_NORMAL; } } - } else { - // Not aiming - if (player->visionmode != VISIONMODE_SLAYERROCKET) { - player->visionmode = VISIONMODE_NORMAL; - } } if (player->gunctrl.weaponnum == WEAPON_MAULER) { diff --git a/src/game/game_0b0fd0.c b/src/game/game_0b0fd0.c index 5fee0dead..204d6dcf7 100644 --- a/src/game/game_0b0fd0.c +++ b/src/game/game_0b0fd0.c @@ -300,6 +300,10 @@ void currentPlayerSetDeviceActive(s32 weaponnum, bool active) if ((devicefunc->base.type & 0xff) == INVENTORYFUNCTYPE_DEVICE) { if (active) { + if (devicefunc->device & (DEVICE_NIGHTVISION | DEVICE_XRAYSCANNER | DEVICE_IRSCANNER)) { + g_Vars.currentplayer->devicesactive &= ~(DEVICE_NIGHTVISION | DEVICE_XRAYSCANNER | DEVICE_IRSCANNER); + } + g_Vars.currentplayer->devicesactive |= devicefunc->device; return; } diff --git a/src/game/player.c b/src/game/player.c index 494061d10..7d5b4439b 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -2369,6 +2369,13 @@ void playerLaunchSlayerRocket(struct weaponobj *rocket) { g_Vars.currentplayer->slayerrocket = rocket; g_Vars.currentplayer->visionmode = VISIONMODE_SLAYERROCKET; + + // Turn off these devices + g_Vars.currentplayer->devicesactive &= ~( + DEVICE_NIGHTVISION | + DEVICE_XRAYSCANNER | + DEVICE_IRSCANNER); + g_Vars.currentplayer->badrockettime = 0; }