1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-03 17:19:46 +02: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)
, cutsceneStartTime(-1.f)
, isCinematic(false)
, hudFlash(HudFlash::Disabled)
, cameraNear(0.1f)
, cameraFixed(false)
, 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
* world state.
@ -301,6 +308,7 @@ public:
float cutsceneStartTime;
/** Flag for rendering cutscene letterbox */
bool isCinematic;
HudFlash hudFlash;
std::string lastMissionName;

View File

@ -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;
}
/**

View File

@ -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<float>();
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<float>();
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;