From: Holger Schemel Date: Mon, 3 Jan 2005 00:23:32 +0000 (+0100) Subject: rnd-20050103-1-src X-Git-Tag: 3.1.1^2~34 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2d235297197dd0c325184f7fc401d9c5c41c2616;p=rocksndiamonds.git rnd-20050103-1-src * fixed bug with not converting RND levels which are set to use native engine to native level structure when loading * uploaded pre-release (test) version 3.2.0-0 binary and source code * version number set to 3.2.0 --- diff --git a/ChangeLog b/ChangeLog index 9a33a408..e9a6fa7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-01-02 + * fixed bug with not converting RND levels which are set to use native + engine to native level structure when loading + +2005-01-01 + * uploaded pre-release (test) version 3.2.0-0 binary and source code + +2005-01-01 + * version number set to 3.2.0 + 2004-12-30 * level data now reset to defaults after attempt to load invalid file diff --git a/src/cartoons.c b/src/cartoons.c index 55c36b5b..fc465fac 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -23,7 +23,15 @@ static struct ToonInfo toons[MAX_NUM_TOONS]; static void PrepareBackbuffer() { - /* Fill empty backbuffer for animation functions */ + if (game_status == GAME_MODE_PLAYING && + level.game_engine_type == GAME_ENGINE_TYPE_EM) + { + BlitScreenToBitmap_EM(backbuffer); + + return; + } + + /* fill empty backbuffer for animation functions */ if (setup.direct_draw && game_status == GAME_MODE_PLAYING) { int xx, yy; diff --git a/src/conftime.h b/src/conftime.h index 5865410b..87343c6c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-12-30 13:53]" +#define COMPILE_DATE_STRING "[2005-01-03 01:18]" diff --git a/src/engines.h b/src/engines.h index de7a5491..54a54325 100644 --- a/src/engines.h +++ b/src/engines.h @@ -23,7 +23,7 @@ extern void SetBitmaps_EM(Bitmap **); extern void UpdateEngineValues(int, int); -extern void DrawGameDoorValues_EM(int, int, int, int); +extern void DrawAllGameValues(int, int, int, int, int); extern int getGameFrameDelay_EM(int); extern void PlayLevelSound_EM(int, int, int, int); extern void InitGraphicInfo_EM(void); diff --git a/src/files.c b/src/files.c index 02f79efb..2ff37bc5 100644 --- a/src/files.c +++ b/src/files.c @@ -2508,7 +2508,10 @@ void LoadLevelFromFileInfo(struct LevelInfo *level, if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN) level->game_engine_type = GAME_ENGINE_TYPE_RND; - CopyNativeLevel_Native_to_RND(level); + if (level_file_info->type == LEVEL_FILE_TYPE_RND) + CopyNativeLevel_RND_to_Native(level); + else + CopyNativeLevel_Native_to_RND(level); } void LoadLevelFromFilename(struct LevelInfo *level, char *filename) diff --git a/src/game.c b/src/game.c index 902464c0..31bc2f52 100644 --- a/src/game.c +++ b/src/game.c @@ -1062,12 +1062,12 @@ inline void DrawGameValue_Dynamite(int value) DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(value, 3), FONT_TEXT_2); } -inline void DrawGameValue_Keys(struct PlayerInfo *player) +inline void DrawGameValue_Keys(int key[4]) { int i; for (i = 0; i < MAX_KEYS; i++) - if (player->key[i]) + if (key[i]) DrawMiniGraphicExt(drawto, DX_KEYS + i * MINI_TILEX, DY_KEYS, el2edimg(EL_KEY_1 + i)); } @@ -1109,27 +1109,43 @@ inline void DrawGameValue_Level(int value) } } +void DrawAllGameValues(int emeralds, int dynamite, int score, int time, + int key_bits) +{ + int key[4]; + int i; + + for (i = 0; i < MAX_KEYS; i++) + key[i] = key_bits & (1 << i); + + DrawGameValue_Emeralds(emeralds); + DrawGameValue_Dynamite(dynamite); + DrawGameValue_Score(score); + DrawGameValue_Time(time); + + DrawGameValue_Keys(key); +} + void DrawGameDoorValues() { int i; - DrawGameValue_Level(level_nr); + if (level.game_engine_type == GAME_ENGINE_TYPE_EM) + { + DrawGameDoorValues_EM(); - for (i = 0; i < MAX_PLAYERS; i++) - DrawGameValue_Keys(&stored_player[i]); + return; + } + + DrawGameValue_Level(level_nr); DrawGameValue_Emeralds(local_player->gems_still_needed); DrawGameValue_Dynamite(local_player->inventory_size); DrawGameValue_Score(local_player->score); 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); + for (i = 0; i < MAX_PLAYERS; i++) + DrawGameValue_Keys(stored_player[i].key); } static void resolve_group_element(int group_element, int recursion_depth) @@ -1699,6 +1715,7 @@ void InitGame() #endif ZX = ZY = -1; + ExitX = ExitY = -1; FrameCounter = 0; TimeFrames = 0; @@ -2400,8 +2417,9 @@ void GameWon() } /* close exit door after last player */ - if ((Feld[ExitX][ExitY] == EL_EXIT_OPEN || - Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN) && AllPlayersGone) + if (AllPlayersGone && ExitX >= 0 && ExitY >= 0 && + (Feld[ExitX][ExitY] == EL_EXIT_OPEN || + Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN)) { int element = Feld[ExitX][ExitY]; @@ -2412,7 +2430,9 @@ void GameWon() } /* Hero disappears */ - DrawLevelField(ExitX, ExitY); + if (ExitX >= 0 && ExitY >= 0) + DrawLevelField(ExitX, ExitY); + BackToFront(); if (tape.playing) @@ -11532,7 +11552,7 @@ int DigField(struct PlayerInfo *player, player->key[key_nr] = TRUE; - DrawGameValue_Keys(player); + DrawGameValue_Keys(player->key); redraw_mask |= REDRAW_DOOR_1; } diff --git a/src/game_em/game_em.h b/src/game_em/game_em.h index e3953c4c..820d7aa6 100644 --- a/src/game_em/game_em.h +++ b/src/game_em/game_em.h @@ -23,6 +23,7 @@ #include "main_em.h" +extern struct GlobalInfo_EM global_em_info; extern struct LevelInfo_EM native_em_level; extern struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8]; extern struct GraphicInfo_EM graphic_info_em_player[2][SPR_MAX][8]; @@ -38,5 +39,8 @@ extern unsigned int InitEngineRND_EM(long); extern void setLevelInfoToDefaults_EM(); extern boolean LoadNativeLevel_EM(char *); +extern void BlitScreenToBitmap_EM(Bitmap *); +extern void RedrawPlayfield_EM(); +extern void DrawGameDoorValues_EM(); #endif /* GAME_EM_H */ diff --git a/src/game_em/global.h b/src/game_em/global.h index 2f72dd71..2d30f24e 100644 --- a/src/game_em/global.h +++ b/src/game_em/global.h @@ -31,6 +31,8 @@ void blitscreen(void); void game_initscreen(void); void game_animscreen(void); +void DrawGameDoorValues_EM(); + void play_sound(int, int, int); void sound_play(void); diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index bc8092e4..78fbe8b0 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -22,51 +22,56 @@ static unsigned int crumbled_state[MAX_BUF_YSIZE][MAX_BUF_XSIZE]; * perhaps use mit-shm to speed this up */ -void blitscreen(void) +void BlitScreenToBitmap_EM(Bitmap *target_bitmap) { unsigned int x = screen_x % (MAX_BUF_XSIZE * TILEX); unsigned int y = screen_y % (MAX_BUF_YSIZE * TILEY); if (x < 2 * TILEX && y < 2 * TILEY) { - BlitBitmap(screenBitmap, window, x, y, + BlitBitmap(screenBitmap, target_bitmap, x, y, SCR_FIELDX * TILEX, SCR_FIELDY * TILEY, SX, SY); } else if (x < 2 * TILEX && y >= 2 * TILEY) { - BlitBitmap(screenBitmap, window, x, y, + BlitBitmap(screenBitmap, target_bitmap, x, y, SCR_FIELDX * TILEX, MAX_BUF_YSIZE * TILEY - y, SX, SY); - BlitBitmap(screenBitmap, window, x, 0, + BlitBitmap(screenBitmap, target_bitmap, x, 0, SCR_FIELDX * TILEX, y - 2 * TILEY, SX, SY + MAX_BUF_YSIZE * TILEY - y); } else if (x >= 2 * TILEX && y < 2 * TILEY) { - BlitBitmap(screenBitmap, window, x, y, + BlitBitmap(screenBitmap, target_bitmap, x, y, MAX_BUF_XSIZE * TILEX - x, SCR_FIELDY * TILEY, SX, SY); - BlitBitmap(screenBitmap, window, 0, y, + BlitBitmap(screenBitmap, target_bitmap, 0, y, x - 2 * TILEX, SCR_FIELDY * TILEY, SX + MAX_BUF_XSIZE * TILEX - x, SY); } else { - BlitBitmap(screenBitmap, window, x, y, + BlitBitmap(screenBitmap, target_bitmap, x, y, MAX_BUF_XSIZE * TILEX - x, MAX_BUF_YSIZE * TILEY - y, SX, SY); - BlitBitmap(screenBitmap, window, 0, y, + BlitBitmap(screenBitmap, target_bitmap, 0, y, x - 2 * TILEX, MAX_BUF_YSIZE * TILEY - y, SX + MAX_BUF_XSIZE * TILEX - x, SY); - BlitBitmap(screenBitmap, window, x, 0, + BlitBitmap(screenBitmap, target_bitmap, x, 0, MAX_BUF_XSIZE * TILEX - x, y - 2 * TILEY, SX, SY + MAX_BUF_YSIZE * TILEY - y); - BlitBitmap(screenBitmap, window, 0, 0, + BlitBitmap(screenBitmap, target_bitmap, 0, 0, x - 2 * TILEX, y - 2 * TILEY, SX + MAX_BUF_XSIZE * TILEX - x, SY + MAX_BUF_YSIZE * TILEY - y); } } +void blitscreen(void) +{ + BlitScreenToBitmap_EM(window); +} + static void DrawLevelField_EM(int x, int y, int sx, int sy, boolean draw_masked) { @@ -362,11 +367,11 @@ void game_initscreen(void) } } - DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score, - DISPLAY_TIME(lev.time + 4)); + DrawAllGameValues(lev.required, ply1.dynamite, lev.score, + DISPLAY_TIME(lev.time + 4), ply1.keys | ply2.keys); } -void game_animscreen(void) +void RedrawPlayfield_EM() { unsigned int x,y; @@ -395,3 +400,14 @@ void game_animscreen(void) FlushDisplay(); } + +void game_animscreen(void) +{ + RedrawPlayfield_EM(); +} + +void DrawGameDoorValues_EM() +{ + DrawAllGameValues(lev.required, ply1.dynamite, lev.score, + DISPLAY_TIME(lev.time), ply1.keys | ply2.keys); +} diff --git a/src/game_em/init.c b/src/game_em/init.c index 9a3dadb8..42117321 100644 --- a/src/game_em/init.c +++ b/src/game_em/init.c @@ -4,7 +4,10 @@ */ #include + +#if !defined(TARGET_SDL) #include +#endif #include "main_em.h" @@ -38,14 +41,16 @@ int play_x[SAMPLE_MAX]; int play_y[SAMPLE_MAX]; int play_element[SAMPLE_MAX]; +static boolean use_native_em_sound = 0; + +struct GlobalInfo_EM global_em_info; + #if defined(AUDIO_UNIX_NATIVE) static int sound_pid = -1; int sound_pipe[2] = { -1, -1 }; /* for communication */ short *sound_data[SAMPLE_MAX]; /* pointer to sound data */ long sound_length[SAMPLE_MAX]; /* length of sound data */ -static boolean use_native_em_sound = 0; - static const char *sound_names[SAMPLE_MAX] = { "00.blank.au", @@ -148,6 +153,9 @@ int open_all(void) screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY, DEFAULT_DEPTH); + + global_em_info.screenbuffer = screenBitmap; + #endif #if 0 @@ -238,7 +246,9 @@ void em_open_all() { /* pre-calculate some data */ tab_generate(); +#if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD) ulaw_generate(); +#endif progname = "emerald mine"; diff --git a/src/game_em/input.c b/src/game_em/input.c index 33df9f3f..f123b437 100644 --- a/src/game_em/input.c +++ b/src/game_em/input.c @@ -104,8 +104,8 @@ void GameActions_EM(byte action) synchro_3(); sound_play(); - DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score, - DISPLAY_TIME(lev.time)); + if (game_frame_delay_value > 0) /* do not redraw values in warp mode */ + DrawGameDoorValues_EM(); } } diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h index a525bbf3..2a422f6d 100644 --- a/src/game_em/main_em.h +++ b/src/game_em/main_em.h @@ -617,6 +617,11 @@ struct PLAYER #define FILE_VERSION_EM_ACTUAL FILE_VERSION_EM_V6 +struct GlobalInfo_EM +{ + Bitmap *screenbuffer; +}; + struct LevelInfo_EM { int file_version; diff --git a/src/game_em/synchro_1.c b/src/game_em/synchro_1.c index 9114d5f8..faea7eb5 100644 --- a/src/game_em/synchro_1.c +++ b/src/game_em/synchro_1.c @@ -994,11 +994,14 @@ static void player(struct PLAYER *ply) case Xexit_2: case Xexit_3: play_element_sound(x, y, SAMPLE_exit, Xexit_1); - if (--lev.home == 0 && lev.time_initial > 0) - lev.score += lev.time * lev.exit_score / 100; + + if (--lev.home == 0 && lev.time_initial > 0) /* game won */ + lev.score += lev.time * lev.exit_score / 100; + ply->anim = SPR_walk + anim; ply->x = x; ply->y = y; + break; } } diff --git a/src/main.h b/src/main.h index 4ff458ad..820d3c5b 100644 --- a/src/main.h +++ b/src/main.h @@ -1326,9 +1326,9 @@ /* program information and versioning definitions */ #define PROGRAM_VERSION_MAJOR 3 -#define PROGRAM_VERSION_MINOR 1 -#define PROGRAM_VERSION_PATCH 1 -#define PROGRAM_VERSION_BUILD 0 +#define PROGRAM_VERSION_MINOR 2 +#define PROGRAM_VERSION_PATCH 0 +#define PROGRAM_VERSION_BUILD 1 #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" diff --git a/src/screens.c b/src/screens.c index ed616df1..212a75ca 100644 --- a/src/screens.c +++ b/src/screens.c @@ -2953,6 +2953,19 @@ void HandleGameActions() byte tape_action[MAX_PLAYERS]; int i; + if (level.native_em_level->lev->home == 0) /* all players at home */ + { + GameWon(); + + if (!TAPE_IS_STOPPED(tape)) + TapeStop(); + + if (game_status != GAME_MODE_PLAYING) + return; + } + + /* --- game actions --- */ + if (tape.pausing) return; diff --git a/src/tape.c b/src/tape.c index e6fbcdab..72c7cc73 100644 --- a/src/tape.c +++ b/src/tape.c @@ -948,7 +948,7 @@ byte *TapePlayAction() if (!tape.playing || tape.pausing) return NULL; - if (tape.pause_before_death) /* STOP 10s BEFORE PLAYER GETS KILLED... */ + if (tape.pause_before_death) /* stop 10 seconds before player gets killed */ { if (!(FrameCounter % 20)) { @@ -969,6 +969,7 @@ byte *TapePlayAction() if (TapeTime > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) { TapeTogglePause(TAPE_TOGGLE_MANUAL); + return NULL; } } @@ -987,6 +988,7 @@ byte *TapePlayAction() DrawVideoDisplay(VIDEO_STATE_WARP2_ON, VIDEO_DISPLAY_SYMBOL_ONLY); } } + #if 0 /* !!! this makes things much slower !!! */ else if (tape.warp_forward) diff --git a/src/tools.c b/src/tools.c index 4771915a..1f857f6b 100644 --- a/src/tools.c +++ b/src/tools.c @@ -123,6 +123,14 @@ void SetDrawtoField(int mode) void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) { + if (game_status == GAME_MODE_PLAYING && + level.game_engine_type == GAME_ENGINE_TYPE_EM) + { + RedrawPlayfield_EM(); + + return; + } + if (game_status == GAME_MODE_PLAYING && !game.envelope_active) { if (force_redraw) @@ -2219,6 +2227,12 @@ boolean Request(char *text, unsigned int req_state) } } +#if 1 + if (game_status == GAME_MODE_PLAYING && + level.game_engine_type == GAME_ENGINE_TYPE_EM) + BlitScreenToBitmap_EM(backbuffer); +#endif + #if 1 /* disable deactivated drawing when quick-loading level tape recording */ if (tape.playing && tape.deactivate_display) @@ -5590,8 +5604,17 @@ int el2preimg(int element) int getGameFrameDelay_EM(int native_em_game_frame_delay) { - return (GameFrameDelay == GAME_FRAME_DELAY ? native_em_game_frame_delay : - GameFrameDelay); + int game_frame_delay_value; + + game_frame_delay_value = + (tape.playing && tape.fast_forward ? FfwdFrameDelay : + GameFrameDelay == GAME_FRAME_DELAY ? native_em_game_frame_delay : + GameFrameDelay); + + if (tape.playing && tape.warp_forward && !tape.pausing) + game_frame_delay_value = 0; + + return game_frame_delay_value; } unsigned int InitRND(long seed)