diff --git a/include/game.h b/include/game.h index a0b45cf..386790e 100644 --- a/include/game.h +++ b/include/game.h @@ -42,6 +42,7 @@ typedef struct { U8 name[10]; } hscore_t; +extern U16 game_status_dirty; /* status dirty flag */ extern U8 game_lives; /* lives counter */ extern U8 game_bombs; /* bombs counter */ extern U8 game_bullets; /* bullets counter */ diff --git a/src/e_bonus.c b/src/e_bonus.c index 84ca476..ff1d5dc 100644 --- a/src/e_bonus.c +++ b/src/e_bonus.c @@ -37,6 +37,7 @@ e_bonus_action(ent_t *pEnt) if (pEnt->seq == 0) { if (e_rick_boxtest(pEnt)) { game_score += 500; + game_status_dirty = 1; #ifdef ENABLE_SOUND syssnd_play(WAV_BONUS, 1); #endif diff --git a/src/e_box.c b/src/e_box.c index 671bc04..4f327cb 100644 --- a/src/e_box.c +++ b/src/e_box.c @@ -77,6 +77,8 @@ e_box_action(ent_t* pEnt) game_bombs = GAME_BOMBS_INIT; else /* 0x11 */ game_bullets = GAME_BULLETS_INIT; + + game_status_dirty = 1; pEnt->n = 0; map_marks[pEnt->mark].ent |= MAP_MARK_NACT; } diff --git a/src/e_rick.c b/src/e_rick.c index 3734571..6da00c3 100644 --- a/src/e_rick.c +++ b/src/e_rick.c @@ -309,7 +309,10 @@ e_rick_action2(void) #ifdef ENABLE_CHEATS if (!game_cheat1) #endif - game_bullets--; + { + game_bullets--; + game_status_dirty = 1; + } /* initialize bullet */ e_bullet_init(E_RICK_ENT.x, E_RICK_ENT.y); return; @@ -328,7 +331,10 @@ e_rick_action2(void) #ifdef ENABLE_CHEATS if (!game_cheat1) #endif - game_bombs--; + { + game_bombs--; + game_status_dirty = 1; + } /* initialize bomb */ e_bomb_init(E_RICK_ENT.x, E_RICK_ENT.y); return; diff --git a/src/e_sbonus.c b/src/e_sbonus.c index f59b0fb..b3839aa 100644 --- a/src/e_sbonus.c +++ b/src/e_sbonus.c @@ -73,6 +73,7 @@ e_sbonus_stop(ent_t* pEnt) e_sbonus_counting = FALSE; /* stop counting */ pEnt->n = 0; /* deactivate entity */ game_score += e_sbonus_bonus; /* add bonus to score */ + game_status_dirty = 1; #ifdef ENABLE_SOUND syssnd_play(WAV_SBONUS2, 1); #endif diff --git a/src/e_them.c b/src/e_them.c index 7149af1..83e0fed 100644 --- a/src/e_them.c +++ b/src/e_them.c @@ -81,6 +81,7 @@ e_them_gozombie(ent_t* pEnt) syssnd_play(WAV_DIE, 1); #endif game_score += 50; + game_status_dirty = 1; if (pEnt->flags & ENT_FLG_ONCE) { /* make sure entity won't be activated again */ map_marks[pEnt->mark].ent |= MAP_MARK_NACT; diff --git a/src/game.c b/src/game.c index ecb76fb..e983745 100644 --- a/src/game.c +++ b/src/game.c @@ -78,6 +78,8 @@ U8 game_cheat1 = 0; U8 game_cheat2 = 0; U8 game_cheat3 = 0; +U16 game_status_dirty = 0; + #if defined(GFXST) || defined(GFXGS) hscore_t game_hscores[8] = { { 8000, "SIMES@@@@@" }, @@ -183,6 +185,7 @@ game_toggleCheat(U8 nbr) game_lives = 6; game_bombs = 6; game_bullets = 6; + game_status_dirty = 1; break; case 2: game_cheat2 = ~game_cheat2; @@ -497,6 +500,7 @@ frame(void) } else { game_state = GAMEOVER; } + game_status_dirty = 1; } else if (game_chsm) /* request to chain to next submap */ game_state = CHAIN_SUBMAP; @@ -516,6 +520,7 @@ frame(void) if (map_chain()) game_state = CHAIN_END; else { + game_status_dirty = 1; game_bullets = 0x06; game_bombs = 0x06; game_map++; @@ -578,8 +583,6 @@ frame(void) } break; - - case SCROLL_DOWN: switch (scroll_down()) { case SCROLL_RUNNING: @@ -651,6 +654,7 @@ init(void) game_bombs = 6; game_bullets = 6; game_score = 0; + game_status_dirty = 1; game_map = sysarg_args_map; @@ -719,13 +723,20 @@ play3(void) { static rect_t *r; - draw_clearStatus(); /* clear the status bar */ - ent_draw(); /* draw all entities onto the buffer */ - /* sound */ - draw_drawStatus(); /* draw the status bar onto the buffer*/ - - r = &draw_STATUSRECT; r->next = ent_rects; /* refresh status bar too */ - game_rects = r; /* take care to cleanup draw_STATUSRECT->next later! */ + if (game_status_dirty) + { + draw_clearStatus(); /* clear the status bar */ + ent_draw(); /* draw all entities onto the buffer */ + draw_drawStatus(); /* draw the status bar onto the buffer*/ + r = &draw_STATUSRECT; r->next = ent_rects; /* refresh status bar too */ + game_rects = r; /* take care to cleanup draw_STATUSRECT->next later! */ + game_status_dirty = 0; + } + else + { + ent_draw(); /* draw all entities onto the buffer */ + game_rects = ent_rects; + } if (!E_RICK_STTST(E_RICK_STZOMBIE)) { /* need to scroll ? */ if (ent_ents[1].y >= 0xCC) { @@ -754,6 +765,8 @@ restart(void) game_bullets = 6; game_bombs = 6; + game_status_dirty = 1; + ent_ents[1].n = 1; irestore();