diff --git a/src/duel_banked.c b/src/duel_banked.c index 6c4f361..d7cd492 100644 --- a/src/duel_banked.c +++ b/src/duel_banked.c @@ -239,7 +239,7 @@ void print_duel_text() { } void print_duel_score() { - for (UINT8 y = 7; y != 12; y++) { + for (UINT8 y = 6; y != 13; y++) { for (UINT8 x = 0; x != 32; x++) { set_bkg_tile_xy(x, y, 0x00); } @@ -247,23 +247,43 @@ void print_duel_score() { UINT8 i = 0; while(you_text[i] != '\0') { if (you_text[i] > 64 && you_text[i] < 91) { - set_bkg_tile_xy(6+i, 8, you_text[i] + 111); + set_bkg_tile_xy(6+i, 7, you_text[i] + 111); } else if (you_text[i] == '-') { - set_bkg_tile_xy(6+i, 8, 204); + set_bkg_tile_xy(6+i, 7, 204); } i++; } - set_bkg_tile_xy(6+i, 8, 245 + roundsWon); + set_bkg_tile_xy(6+i, 7, 245 + roundsWon); i = 0; while(enemy_text[i] != '\0') { if (enemy_text[i] > 64 && enemy_text[i] < 91) { - set_bkg_tile_xy(4+i, 10, enemy_text[i] + 111); + set_bkg_tile_xy(4+i, 9, enemy_text[i] + 111); } else if (enemy_text[i] == '-') { - set_bkg_tile_xy(4+i, 10, 204); + set_bkg_tile_xy(4+i, 9, 204); } i++; } - set_bkg_tile_xy(4+i, 10, 245 + roundsLost); + set_bkg_tile_xy(4+i, 9, 245 + roundsLost); + i = 0; + if (roundsWon == 3) { + while(you_win_text[i] != '\0') { + if (you_win_text[i] > 64 && you_win_text[i] < 91) { + set_bkg_tile_xy(6+i, 11, you_win_text[i] + 111); + } else if (you_win_text[i] == '!') { + set_bkg_tile_xy(6+i, 11, 205); + } + i++; + } + } else if (roundsLost == 3) { + while(you_lose_text[i] != '\0') { + if (you_lose_text[i] > 64 && you_lose_text[i] < 91) { + set_bkg_tile_xy(5+i, 11, you_lose_text[i] + 111); + } else if (you_lose_text[i] == '!') { + set_bkg_tile_xy(5+i, 11, 205); + } + i++; + } + } } diff --git a/src/levels.c b/src/levels.c index 133bff6..8fea753 100644 --- a/src/levels.c +++ b/src/levels.c @@ -32,6 +32,7 @@ BOOLEAN isSurvivalMode; BOOLEAN loadPrelevelScreen; BOOLEAN showingHowToPlay; BOOLEAN showingPressAnyKey; +BOOLEAN newRecord; const level levels[] = { @@ -106,8 +107,7 @@ void load_level() { default: break; } - } else { - update_score(); + } else { load_credits(); } } @@ -173,7 +173,10 @@ void game_over_loop() { if (textScreenTimer != 0 && decimalTimer == 0) { textScreenTimer--; if (textScreenTimer == 1) { - print_text_win(1, 15, press_any_button_text); + print_text_win(1, 16, press_any_button_text); + if (newRecord == TRUE) { + print_text_win(4, 13, new_record_text); + } } } else if (joypad() && textScreenTimer == 0) { reset_values(); @@ -217,7 +220,7 @@ void load_game_over() { set_win_tile_xy(14 - x, 12, 245 + digit); } } - update_score(); + newRecord = update_score(); enable_interrupts(); move_win(7,0); SHOW_WIN; @@ -233,7 +236,10 @@ void game_mode_level_complete_loop() { if (textScreenTimer != 0 && decimalTimer == 0) { textScreenTimer--; if (textScreenTimer == 1) { - print_text_win(1, 15, press_any_button_text); + print_text_win(1, 16, press_any_button_text); + if (newRecord == TRUE) { + print_text_win(4, 14, new_record_text); + } } else if (textScreenTimer == 50) { print_text_win(1, 4, bonus_text); print_current_score(13); @@ -261,7 +267,12 @@ void game_mode_level_complete_loop() { print_number_win(8, 11, difficultyBonus); currentScore += difficultyBonus; print_current_score(13); - play_reload_sound(); + play_reload_sound(); + if (currentLevel == 14) { + newRecord = update_score(); + } else { + newRecord = FALSE; + } } } else if (joypad() && textScreenTimer == 0) { gameMode = previousGameMode; @@ -288,6 +299,7 @@ void load_level_complete() { performant_delay(4); } if (isPracticeMode == FALSE) { + UINT8 bank =_current_bank; SWITCH_ROM_MBC1(2); gb_decompress_bkg_data(205, borderTiles); @@ -537,7 +549,7 @@ void game_mode_credits_loop() { } else if (credits_text[creditsTextIndex] == '!') { set_bkg_tile_xy(creditsTextCursor, creditsLine, 0xF3); } else if (credits_text[creditsTextIndex] == '\0') { - print_text_bkg(1, 15, press_any_button_text); + print_text_bkg(1, 16, press_any_button_text); showingPressAnyKey = TRUE; } creditsTextCursor++; diff --git a/src/levels.h b/src/levels.h index 8270ee2..33e1536 100644 --- a/src/levels.h +++ b/src/levels.h @@ -43,6 +43,7 @@ extern BOOLEAN isSurvivalMode; extern BOOLEAN loadPrelevelScreen; extern BOOLEAN showingHowToPlay; extern BOOLEAN showingPressAnyKey; +extern BOOLEAN newRecord; extern const level levels[]; extern const duelLevel duelLevels[]; diff --git a/src/shooting_banked.c b/src/shooting_banked.c index 609b70b..5d308fa 100644 --- a/src/shooting_banked.c +++ b/src/shooting_banked.c @@ -154,7 +154,11 @@ void shoot() { break; } } - play_shoot_sound(); + if (ammo == 0) { + play_last_bullet_shoot_sound(); + } else { + play_shoot_sound(); + } canShoot = FALSE; } else if (canShoot == TRUE && ammo == 0) { play_empty_sound(); diff --git a/src/sound.c b/src/sound.c index 41e745d..823bcf5 100644 --- a/src/sound.c +++ b/src/sound.c @@ -121,6 +121,19 @@ void play_shoot_sound() { channel1Timer = 10; } +void play_last_bullet_shoot_sound() { + UINT8 bank = _current_bank; + SWITCH_ROM_MBC1(3); + hUGE_mute_channel(HT_CH1, HT_CH_MUTE); + SWITCH_ROM_MBC1(bank); + NR10_REG = 0x5E; + NR11_REG = 0xC2; + NR12_REG = 0xB3; + NR13_REG = 0x66; + NR14_REG = 0x85; + channel1Timer = 10; +} + void play_almost_exploding_sound() { UINT8 bank = _current_bank; SWITCH_ROM_MBC1(3); diff --git a/src/sound.h b/src/sound.h index 165a8b3..794ba21 100644 --- a/src/sound.h +++ b/src/sound.h @@ -15,6 +15,7 @@ void set_riding_song(); void set_win_song(); void set_lose_song(); void play_shoot_sound(); +void play_last_bullet_shoot_sound(); void play_explosion_sound(); void play_empty_sound(); void play_reload_sound(); diff --git a/src/text.c b/src/text.c index 334fbda..e3005a8 100644 --- a/src/text.c +++ b/src/text.c @@ -78,6 +78,8 @@ const unsigned char round_text[] = "ROUND \0"; const unsigned char rounds_text[] = "ROUNDS\0"; const unsigned char enemy_text[] = "ENEMY - \0"; const unsigned char you_text[] = "YOU - \0"; +const unsigned char you_win_text[] = "YOU WIN!\0"; +const unsigned char you_lose_text[] = "YOU LOSE!\0"; const unsigned char lives_text[] = "LIVES\0"; const unsigned char start_text[] = "START\0"; @@ -122,4 +124,5 @@ const unsigned char * credits_texts[] = { credits_text_9, credits_text_10, }; -const unsigned char credits_text[] = " EL DUELOROSO\nA GAME BY ADRIAN JG\n\nTHANKS TO\nGBDK-2020 DEVS\nHUGETRACKER DEVS\nHUGEBUILD DEVS\nGAMINGMONSTERS\n\nSPECIAL THANKS TO\nALEX @\n\nAND THANK YOU\nFOR PLAYING!\n\0"; \ No newline at end of file +const unsigned char credits_text[] = " EL DUELOROSO\nA GAME BY ADRIAN JG\n\nTHANKS TO\nGBDK-2020 DEVS\nHUGETRACKER DEVS\nHUGEBUILD DEVS\nGAMINGMONSTERS\n\nSPECIAL THANKS TO\nALEX @\n\nAND THANK YOU\nFOR PLAYING!\n\0"; +const unsigned char new_record_text[] = "NEW RECORD!\n"; \ No newline at end of file diff --git a/src/text.h b/src/text.h index a232d75..fbda6df 100644 --- a/src/text.h +++ b/src/text.h @@ -44,6 +44,8 @@ extern const unsigned char round_text[]; extern const unsigned char rounds_text[]; extern const unsigned char enemy_text[]; extern const unsigned char you_text[]; +extern const unsigned char you_win_text[]; +extern const unsigned char you_lose_text[]; extern const unsigned char lives_text[]; extern const unsigned char start_text[]; @@ -72,5 +74,6 @@ extern const unsigned char credits_text_9[]; extern const unsigned char credits_text_10[]; extern const unsigned char * credits_texts[]; extern const unsigned char credits_text[]; +extern const unsigned char new_record_text[]; #endif \ No newline at end of file diff --git a/src/utils.c b/src/utils.c index 989bc6a..e1229ab 100644 --- a/src/utils.c +++ b/src/utils.c @@ -228,6 +228,8 @@ void print_text_win(UINT8 x, UINT8 y, unsigned char text[]) { set_win_tile_xy(i+x, y, text[i] + 149); } else if (text[i] == ':') { set_win_tile_xy(i+x, y, 0xF2); + } else if (text[i] == '!') { + set_win_tile_xy(i+x, y, 0xF3); } i++; }