1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

Map flashing

This commit is contained in:
Florin9doi 2018-01-21 17:44:34 +02:00 committed by Daniel Evans
parent 6f9c3db52e
commit e5694b383c
4 changed files with 34 additions and 23 deletions

View File

@ -108,6 +108,7 @@ GameState::GameState()
, currentCutscene(nullptr) , currentCutscene(nullptr)
, cutsceneStartTime(-1.f) , cutsceneStartTime(-1.f)
, isCinematic(false) , isCinematic(false)
, hudFlash(HudFlash::Disabled)
, cameraNear(0.1f) , cameraNear(0.1f)
, cameraFixed(false) , cameraFixed(false)
, cameraTarget(0) , cameraTarget(0)

View File

@ -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 * Gameplay state object that holds persistent state, and references runtime
* world state. * world state.
@ -301,6 +308,7 @@ public:
float cutsceneStartTime; float cutsceneStartTime;
/** Flag for rendering cutscene letterbox */ /** Flag for rendering cutscene letterbox */
bool isCinematic; bool isCinematic;
HudFlash hudFlash;
std::string lastMissionName; std::string lastMissionName;

View File

@ -11835,9 +11835,7 @@ void opcode_03e6(const ScriptArguments& args) {
@arg arg1 @arg arg1
*/ */
void opcode_03e7(const ScriptArguments& args, const ScriptHudFlash arg1) { void opcode_03e7(const ScriptArguments& args, const ScriptHudFlash arg1) {
RW_UNIMPLEMENTED_OPCODE(0x03e7); args.getState()->hudFlash = (HudFlash)arg1;
RW_UNUSED(arg1);
RW_UNUSED(args);
} }
/** /**

View File

@ -32,6 +32,8 @@ void drawMap(ViewCamera& currentView, PlayerController* player,
GameWorld* world, GameRenderer* render) { GameWorld* world, GameRenderer* render) {
MapRenderer::MapInfo map; MapRenderer::MapInfo map;
if (world->state->hudFlash != HudFlash::FlashRadar
|| std::fmod(world->getGameTime(), 0.5f) >= .25f) {
glm::quat camRot = currentView.rotation; glm::quat camRot = currentView.rotation;
map.rotation = glm::roll(camRot) - glm::half_pi<float>(); map.rotation = glm::roll(camRot) - glm::half_pi<float>();
@ -53,6 +55,7 @@ void drawMap(ViewCamera& currentView, PlayerController* player,
render->map.draw(world, map); render->map.draw(world, map);
} }
}
void drawPlayerInfo(PlayerController* player, GameWorld* world, void drawPlayerInfo(PlayerController* player, GameWorld* world,
GameRenderer* render) { GameRenderer* render) {
@ -104,8 +107,9 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world,
infoTextY += ui_textHeight; infoTextY += ui_textHeight;
if (player->getCharacter()->getCurrentState().health > ui_lowHealth if ((world->state->hudFlash != HudFlash::FlashHealth
|| fmod(world->getGameTime(), 0.5) >= .25) { // UI: Blinking health indicator if health is low && player->getCharacter()->getCurrentState().health > ui_lowHealth)
|| std::fmod(world->getGameTime(), 0.5f) >= .25f) { // UI: Blinking health indicator if health is low
std::stringstream ss; std::stringstream ss;
ss << std::setw(3) << std::setfill('0') ss << std::setw(3) << std::setfill('0')
<< (int)player->getCharacter()->getCurrentState().health; << (int)player->getCharacter()->getCurrentState().health;