diff --git a/rwengine/src/engine/GameState.cpp b/rwengine/src/engine/GameState.cpp index ae30a168..1fc0fc90 100644 --- a/rwengine/src/engine/GameState.cpp +++ b/rwengine/src/engine/GameState.cpp @@ -108,6 +108,7 @@ GameState::GameState() , currentCutscene(nullptr) , cutsceneStartTime(-1.f) , isCinematic(false) + , hudFlash(HudFlash::Disabled) , cameraNear(0.1f) , cameraFixed(false) , cameraTarget(0) diff --git a/rwengine/src/engine/GameState.hpp b/rwengine/src/engine/GameState.hpp index 909e6eb6..ba885dc3 100644 --- a/rwengine/src/engine/GameState.hpp +++ b/rwengine/src/engine/GameState.hpp @@ -243,6 +243,13 @@ struct GarageInfo { } }; +enum class HudFlash { + Disabled = -1, + FlashArmor = 3, + FlashHealth = 4, + FlashRadar = 8 +}; + /** * Gameplay state object that holds persistent state, and references runtime * world state. @@ -301,6 +308,7 @@ public: float cutsceneStartTime; /** Flag for rendering cutscene letterbox */ bool isCinematic; + HudFlash hudFlash; std::string lastMissionName; diff --git a/rwengine/src/script/modules/GTA3ModuleImpl.inl b/rwengine/src/script/modules/GTA3ModuleImpl.inl index 374f9d95..ea9bcec5 100644 --- a/rwengine/src/script/modules/GTA3ModuleImpl.inl +++ b/rwengine/src/script/modules/GTA3ModuleImpl.inl @@ -11835,9 +11835,7 @@ void opcode_03e6(const ScriptArguments& args) { @arg arg1 */ void opcode_03e7(const ScriptArguments& args, const ScriptHudFlash arg1) { - RW_UNIMPLEMENTED_OPCODE(0x03e7); - RW_UNUSED(arg1); - RW_UNUSED(args); + args.getState()->hudFlash = (HudFlash)arg1; } /** diff --git a/rwgame/DrawUI.cpp b/rwgame/DrawUI.cpp index e27721c3..84af3f0a 100644 --- a/rwgame/DrawUI.cpp +++ b/rwgame/DrawUI.cpp @@ -32,26 +32,29 @@ void drawMap(ViewCamera& currentView, PlayerController* player, GameWorld* world, GameRenderer* render) { MapRenderer::MapInfo map; - glm::quat camRot = currentView.rotation; + if (world->state->hudFlash != HudFlash::FlashRadar + || std::fmod(world->getGameTime(), 0.5f) >= .25f) { + glm::quat camRot = currentView.rotation; - map.rotation = glm::roll(camRot) - glm::half_pi(); - map.worldSize = ui_worldSizeMin; - map.worldSize = ui_worldSizeMax; - if (player) { - map.worldCenter = glm::vec2(player->getCharacter()->getPosition()); + map.rotation = glm::roll(camRot) - glm::half_pi(); + map.worldSize = ui_worldSizeMin; + map.worldSize = ui_worldSizeMax; + if (player) { + map.worldCenter = glm::vec2(player->getCharacter()->getPosition()); + } + + const glm::ivec2& vp = render->getRenderer()->getViewport(); + + glm::vec2 mapTop = + glm::vec2(ui_outerMargin, vp.y - (ui_outerMargin + ui_mapSize)); + glm::vec2 mapBottom = + glm::vec2(ui_outerMargin + ui_mapSize, vp.y - ui_outerMargin); + + map.screenPosition = (mapTop + mapBottom) / 2.f; + map.screenSize = ui_mapSize * 0.95f; + + render->map.draw(world, map); } - - const glm::ivec2& vp = render->getRenderer()->getViewport(); - - glm::vec2 mapTop = - glm::vec2(ui_outerMargin, vp.y - (ui_outerMargin + ui_mapSize)); - glm::vec2 mapBottom = - glm::vec2(ui_outerMargin + ui_mapSize, vp.y - ui_outerMargin); - - map.screenPosition = (mapTop + mapBottom) / 2.f; - map.screenSize = ui_mapSize * 0.95f; - - render->map.draw(world, map); } void drawPlayerInfo(PlayerController* player, GameWorld* world, @@ -104,8 +107,9 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world, infoTextY += ui_textHeight; - if (player->getCharacter()->getCurrentState().health > ui_lowHealth - || fmod(world->getGameTime(), 0.5) >= .25) { // UI: Blinking health indicator if health is low + if ((world->state->hudFlash != HudFlash::FlashHealth + && player->getCharacter()->getCurrentState().health > ui_lowHealth) + || std::fmod(world->getGameTime(), 0.5f) >= .25f) { // UI: Blinking health indicator if health is low std::stringstream ss; ss << std::setw(3) << std::setfill('0') << (int)player->getCharacter()->getCurrentState().health;