-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the health indicator blink if low #267
Conversation
I'd suggest introducing a new variable in Ideally we'll replace all of that with better code in the future? (I don't really like the autolook timer or my money hack either) //Edit: Also please don't upate submodules unless necessary |
There's a floating point game timer |
633ee35
to
42dbdb7
Compare
Taken care of accidentally including the submodules in the commit. The Seems like using I agree with JayFoxRox and think that the code I'm committing here will eventually be replaced with the introduction of librw or just during one of code refactors in the future. I'm not too proud of this commit, but still feel like it's worth including just to make the UI behavior more complete at this stage. |
If blinking twice is the correct behaviour (it looks like it is) could you make this blink twice per in-game minute. That way we can have the correct behaviour in place when comparing behaviour before & after if this code gets refactored. Besides that, looks good to me. |
Sure. Could you please hint me at what the multiplier for gameMinute is, relative to gameTime? |
@vflyson I'm assuming the health blink is not tied to the game clock ( I'm not sure how fast any of these timers advance (but assume frames or seconds), so we still need @danhedron or you'll have to figure this out yourself :) |
42dbdb7
to
35566c6
Compare
@JayFoxRox I've used adrenaline today (which on my 20th anniversary version freezes the in-game time completely) and the health indicator continued to blink with exactly the same frequency. It is most likely tied to the computer's clock in vanilla, not to in-game seconds of sorts. Found a video on youtube where the health is low. The health indicator goes off 2 times and on 2 times as well in a single in-game minute, which makes it 1/4 of a game minute. I've updated the multiplier here, should be good to go. |
35566c6
to
6a06b53
Compare
rwgame/DrawUI.cpp
Outdated
@@ -102,19 +103,20 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world, | |||
|
|||
infoTextY += ui_textHeight; | |||
|
|||
{ | |||
if (player->getCharacter()->getCurrentState().health > ui_lowHealth | |||
|| (int)(world->getGameTime() * 4.f) % 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about fmod
?
I'm totally against float pointers in general because they easily become inprecise due to float precision.
However, while we have them it looks like an even worse idea to convert them to integer.
//Edit: Also a comment what this math does wouldn't hurt (like: // UI: Blinking health indicator if health is low
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip!
LGTM |
There's no game->getSecond(), so currently made it disappear once every two game-minutes, even though the vanilla engine makes it blink exactly twice in a single game-minute.
The time runs slightly faster in the original game than so I thought it's okay for now.