omf2097 / openomf

One Must Fall 2097 Remake
http://www.openomf.org
MIT License
362 stars 35 forks source link

[question] slowdowns with values not fully understood #308

Closed gdeda closed 9 years ago

gdeda commented 9 years ago

Much like a question than an issue...

I was working on #290 and making a bigger slowdown on last hit, when I noticed this in the debug messages:

har_take_damage(): Slowdown: Slowing from 5 to 4.

and then:

game_state_call_tick(): Slowdown: Speed back up from 4 to 10.

My question is: why har_take_damage() starts from 5? Shouldn't start from 10 as game_state_call_tick() returns speed to 10? Are there 2 slowdowns working togheter???

Vagabond commented 9 years ago

Yeah, I looked at this and it looks weird. I don't understand this, unless you changed the game speed from the menu in the middle or something.

katajakasa commented 9 years ago

Some of the functions get the speed values via game_state_get_speed, which gives out values ( - 5), while others use the real speed value without any changes. And no, I can't remember why. Afaik it worked around some bug that was in the code previously.

gdeda commented 9 years ago

Yes, I ended with same conclusion.

unsigned int game_state_get_speed(game_state *gs) { return gs->speed -5 ;

That is causing that discrepancy of values. Anyway, that function is called only in har.c and, by removing that -5 and properly adjust other values, looks like to resolve the issue.

Let me make some PRs to check and propose for.