From 8f52363344f59d3bbe17c941b1f84fb41fd105ce Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 22 Aug 2004 01:54:35 +0200 Subject: [PATCH] rnd-20040822-2-src --- src/conftime.h | 2 +- src/game.c | 22 ++++++++++++++++++++++ src/game_em/game_em.h | 2 +- src/game_em/global.h | 2 ++ src/game_em/graphics.c | 33 +++++++++++++++++++++++---------- src/game_em/input.c | 3 +++ src/game_em/main.c | 18 +++++++++++++++--- src/screens.c | 8 -------- 8 files changed, 67 insertions(+), 23 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 26dc228f..00bdd029 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-08-22 00:42]" +#define COMPILE_DATE_STRING "[2004-08-22 01:50]" diff --git a/src/game.c b/src/game.c index eaf9ee12..1d2396b0 100644 --- a/src/game.c +++ b/src/game.c @@ -1124,6 +1124,14 @@ void DrawGameDoorValues() DrawGameValue_Time(TimeLeft); } +void DrawGameDoorValues_EM(int emeralds, int dynamite, int score, int time) +{ + DrawGameValue_Emeralds(emeralds); + DrawGameValue_Dynamite(dynamite); + DrawGameValue_Score(score); + DrawGameValue_Time(time); +} + static void resolve_group_element(int group_element, int recursion_depth) { static int group_nr; @@ -2052,6 +2060,18 @@ void InitGame() CloseDoor(DOOR_CLOSE_1); +#if 1 + + if (em_main_init_game(level_nr) != 0) + { + game_status = GAME_MODE_MAIN; + DrawMainMenu(); + + return; + } + +#else + DrawLevel(); DrawAllPlayers(); @@ -2065,6 +2085,8 @@ void InitGame() redraw_mask |= REDRAW_FROM_BACKBUFFER; FadeToFront(); +#endif + /* copy default game door content to main double buffer */ BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); diff --git a/src/game_em/game_em.h b/src/game_em/game_em.h index 48012ab2..77d00172 100644 --- a/src/game_em/game_em.h +++ b/src/game_em/game_em.h @@ -19,7 +19,7 @@ extern void em_open_all(); extern void em_close_all(); -extern void em_main_init_game(); +extern int em_main_init_game(int); extern int em_main_handle_game(byte); #endif /* GAME_EM_H */ diff --git a/src/game_em/global.h b/src/game_em/global.h index f86171a4..c2a13e89 100644 --- a/src/game_em/global.h +++ b/src/game_em/global.h @@ -26,6 +26,7 @@ extern unsigned int frame; #define EM_GAME_STATUS_PLAY 2 extern int em_game_status; +extern boolean skip_menu; extern short ulaw_to_linear[256]; extern unsigned char linear_to_ulaw[65536]; @@ -54,6 +55,7 @@ void sound_play(void); int cave_convert(char *filename); void game_init_vars(void); +int game_play_init(int); int game_loop(byte); void synchro_1(void); diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 70c45c53..d869bc88 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -15,6 +15,8 @@ #if defined(TARGET_X11) +extern void DrawGameDoorValues_EM(int, int, int, int); + unsigned int frame; /* current frame */ unsigned int screen_x; /* current scroll position */ unsigned int screen_y; @@ -110,11 +112,13 @@ void blitscreen(void) SX + MAX_BUF_XSIZE * TILEX - x, SY + MAX_BUF_YSIZE * TILEY - y); } - /* draw either the main menu footer or the in-game time/gems/score values */ - - if (em_game_status == EM_GAME_STATUS_PLAY) + if (em_game_status == EM_GAME_STATUS_PLAY && SCR_FIELDY < 17) + { BlitBitmap(scoreBitmap, window, 0, 0, SCR_FIELDX * TILEX, SCOREY, - SX, SY + SCR_FIELDY * TILEY - SCOREY); + SX, SY + SCR_FIELDY * TILEY); + ClearRectangle(window, SX, SY + SCR_FIELDY * TILEY + SCOREY, + SCR_FIELDX * TILEX, (17 - SCR_FIELDY) * TILEY - SCOREY); + } XFlush(display); @@ -332,16 +336,22 @@ void game_blitscore(void) xdebug("game_blitscore"); + DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score, + (lev.time + 4) / 5); + i = (lev.time + 4) / 5; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, - 7 * SCOREX, 0); i /= 10; + 7 * SCOREX, 0); + i /= 10; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, - 6 * SCOREX, 0); i /= 10; + 6 * SCOREX, 0); + i /= 10; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, - 5 * SCOREX, 0); i /= 10; + 5 * SCOREX, 0); + i /= 10; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, 4 * SCOREX, 0); @@ -349,13 +359,16 @@ void game_blitscore(void) i = lev.score; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, - 31 * SCOREX, 0); i /= 10; + 31 * SCOREX, 0); + i /= 10; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, - 30 * SCOREX, 0); i /= 10; + 30 * SCOREX, 0); + i /= 10; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, - 29 * SCOREX, 0); i /= 10; + 29 * SCOREX, 0); + i /= 10; BlitBitmap(botBitmap, scoreBitmap, (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY, 28 * SCOREX, 0); diff --git a/src/game_em/input.c b/src/game_em/input.c index 207a80ba..9c1681ff 100644 --- a/src/game_em/input.c +++ b/src/game_em/input.c @@ -331,6 +331,9 @@ int game_loop(byte action) { /* stop playing */ + if (skip_menu) + return 1; + em_game_status = EM_GAME_STATUS_MENU; game_menu_init(); } diff --git a/src/game_em/main.c b/src/game_em/main.c index a9701d69..7ae2810a 100644 --- a/src/game_em/main.c +++ b/src/game_em/main.c @@ -26,6 +26,7 @@ int arg_install; int arg_silence; int em_game_status; +boolean skip_menu = TRUE; extern void tab_generate(); extern void ulaw_generate(); @@ -51,10 +52,21 @@ void em_close_all() close_all(); } -void em_main_init_game() +int em_main_init_game(int level_nr) { - em_game_status = EM_GAME_STATUS_MENU; - game_menu_init(); + if (skip_menu) + { + em_game_status = EM_GAME_STATUS_PLAY; + if (game_play_init(level_nr) != 0) + return 1; + } + else + { + em_game_status = EM_GAME_STATUS_MENU; + game_menu_init(); + } + + return 0; } int em_main_handle_game(byte action) diff --git a/src/screens.c b/src/screens.c index ddc28e8d..d3728d2c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -503,15 +503,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { game_status = GAME_MODE_PLAYING; StopAnimation(); - -#if 1 - - em_main_init_game(); - -#else InitGame(); - -#endif } } else if (y == 6) -- 2.34.1