aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Murphy <alec@checksum.fail>2020-04-04 09:49:53 -0400
committerAlec Murphy <alec@checksum.fail>2020-04-04 09:49:53 -0400
commitee9be47f3f5c7521d56156ff75958dcc98ca7a37 (patch)
tree2b86ab12ee42641d3140f451a0811f76efc90cb8
parenta1bb71b1be4a6f0726f415f7c411c2719a86f52d (diff)
Fix game timing and health bug
-rw-r--r--Game.HC11
-rw-r--r--Status.HC2
2 files changed, 9 insertions, 4 deletions
diff --git a/Game.HC b/Game.HC
index 44ce2c8..36dbc84 100644
--- a/Game.HC
+++ b/Game.HC
@@ -3,6 +3,8 @@ extern I64 palette_2E1EE;
extern U0 update_palette_anim();
extern U0 fade_to_black(uint16 wait_time);
+I64 last_wait = cnts.jiffies;
+
#define COSMO_INTERVAL 100
//Data
@@ -66,6 +68,7 @@ U0 reset_game_state()
word_32EAC = 0;
energy_beam_enabled_flag = 1;
byte_2E17C = 0;
+ health = num_health_bars + 1;
sub_11062();
@@ -288,8 +291,6 @@ Bool executeTick() {
map_display();
- //player_update_sprite();
-
if (player_update_sprite() != 0) {
return TRUE;
}
@@ -342,7 +343,11 @@ Bool executeTick() {
U0 game_wait()
{
- Sleep(100);
+ while (last_wait + 100 > cnts.jiffies)
+ {
+ Sleep(1);
+ }
+ last_wait = cnts.jiffies;
}
U0 game_loop()
diff --git a/Status.HC b/Status.HC
index d2bcf80..8cf6ca4 100644
--- a/Status.HC
+++ b/Status.HC
@@ -3,7 +3,7 @@
extern uint32 score;
extern U8 num_health_bars;
-extern U8 health;
+I64 health = 0;
extern U32 num_stars_collected;
extern U16 num_bombs;
extern CDC *game_surface;