From: Holger Schemel Date: Thu, 22 Oct 2009 22:19:48 +0000 (+0200) Subject: rnd-20091023-1-src X-Git-Tag: 3.3.0.0^2~73 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=83a31e12a79ab21deddbbb7533998a1a54a989dd rnd-20091023-1-src --- diff --git a/src/cartoons.c b/src/cartoons.c index 70d6d3d5..8ca4bdd5 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -23,15 +23,18 @@ static struct ToonInfo toons[MAX_NUM_TOONS]; static void PrepareBackbuffer() { - if (game_status == GAME_MODE_PLAYING && - level.game_engine_type == GAME_ENGINE_TYPE_EM) + if (game_status != GAME_MODE_PLAYING) + return; + + if (level.game_engine_type == GAME_ENGINE_TYPE_EM) { BlitScreenToBitmap_EM(backbuffer); - - return; } - - if (setup.soft_scrolling && game_status == GAME_MODE_PLAYING) + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + { + BlitScreenToBitmap_SP(backbuffer); + } + else if (setup.soft_scrolling) /* GAME_ENGINE_TYPE_RND */ { int fx = FX, fy = FY; diff --git a/src/conftime.h b/src/conftime.h index ab8b8f0d..5d237cbb 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-10-22 22:59" +#define COMPILE_DATE_STRING "2009-10-23 00:17" diff --git a/src/editor.c b/src/editor.c index 5fb4dd93..a75d1285 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1398,6 +1398,7 @@ static struct ValueTextInfo options_game_engine_type[] = { { GAME_ENGINE_TYPE_RND, "Rocks'n'Diamonds" }, { GAME_ENGINE_TYPE_EM, "Emerald Mine" }, + { GAME_ENGINE_TYPE_SP, "Supaplex" }, { -1, NULL } }; diff --git a/src/files.c b/src/files.c index 85a4b23d..e71ca2a2 100644 --- a/src/files.c +++ b/src/files.c @@ -4157,7 +4157,40 @@ static void LoadLevelFromFileInfo_SP(struct LevelInfo *level, void CopyNativeLevel_RND_to_SP(struct LevelInfo *level) { - /* ... yet to be written ... */ + LevelInfoType *header = &native_sp_level.header; + int i, x, y; + + native_sp_level.width = level->fieldx; + native_sp_level.height = level->fieldy; + + for (x = 0; x < level->fieldx; x++) + { + for (y = 0; y < level->fieldy; y++) + { + int element_old = level->field[x][y]; + int element_new; + + if (element_old >= EL_SP_START && + element_old <= EL_SP_END) + element_new = element_old - EL_SP_START; + else if (element_old == EL_INVISIBLE_WALL) + element_new = 0x28; + else + element_new = EL_SP_HARDWARE_YELLOW; /* unknown to Supaplex engine */ + + native_sp_level.playfield[x][y] = element_new; + } + } + + header->InitialGravity = (level->initial_player_gravity[0] ? 1 : 0); + + for (i = 0; i < SP_LEVEL_NAME_LEN; i++) + header->LevelTitle[i] = level->name[i]; + /* !!! NO STRING TERMINATION IN SUPAPLEX VB CODE YET -- FIX THIS !!! */ + + header->InfotronsNeeded = level->gems_needed; + + /* !!! ADD SPECIAL PORT DATABASE STUFF !!! */ } void CopyNativeLevel_SP_to_RND(struct LevelInfo *level) @@ -6302,9 +6335,7 @@ void LoadLevelFromFileInfo(struct LevelInfo *level, case LEVEL_FILE_TYPE_SP: LoadLevelFromFileInfo_SP(level, level_file_info); -#if 1 level->game_engine_type = GAME_ENGINE_TYPE_SP; -#endif break; case LEVEL_FILE_TYPE_DC: diff --git a/src/game_sp/init.c b/src/game_sp/init.c index 736211c8..953b9ec8 100644 --- a/src/game_sp/init.c +++ b/src/game_sp/init.c @@ -62,3 +62,17 @@ void sp_open_all() void sp_close_all() { } + +unsigned int InitEngineRandom_SP(long seed) +{ + if (seed == NEW_RANDOMIZE) + { + subRandomize(); + + seed = (long)RandomSeed; + } + + RandomSeed = (short)seed; + + return (unsigned int) seed; +} diff --git a/src/game_sp/main.c b/src/game_sp/main.c index a8d61e3f..9f343318 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -30,3 +30,8 @@ void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode) subMainGameLoop_Main(single_player_action, warp_mode); } + +void RedrawPlayfield_SP(boolean force_redraw) +{ + subDisplayLevel(); +} diff --git a/src/tools.c b/src/tools.c index e80cd996..0650532c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -144,7 +144,17 @@ void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) /* blit playfield from scroll buffer to normal back buffer for fading in */ BlitScreenToBitmap_EM(backbuffer); } - else if (game_status == GAME_MODE_PLAYING && !game.envelope_active) + else if (game_status == GAME_MODE_PLAYING && + level.game_engine_type == GAME_ENGINE_TYPE_SP) + { + /* currently there is no partial redraw -- always redraw whole playfield */ + RedrawPlayfield_SP(TRUE); + + /* blit playfield from scroll buffer to normal back buffer for fading in */ + BlitScreenToBitmap_SP(backbuffer); + } + else if (game_status == GAME_MODE_PLAYING && + !game.envelope_active) { if (force_redraw) { @@ -2811,9 +2821,13 @@ boolean Request(char *text, unsigned int req_state) } } - if (game_status == GAME_MODE_PLAYING && - level.game_engine_type == GAME_ENGINE_TYPE_EM) - BlitScreenToBitmap_EM(backbuffer); + if (game_status == GAME_MODE_PLAYING) + { + if (level.game_engine_type == GAME_ENGINE_TYPE_EM) + BlitScreenToBitmap_EM(backbuffer); + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + BlitScreenToBitmap_SP(backbuffer); + } /* disable deactivated drawing when quick-loading level tape recording */ if (tape.playing && tape.deactivate_display) @@ -6044,6 +6058,8 @@ unsigned int InitRND(long seed) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) return InitEngineRandom_EM(seed); + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + return InitEngineRandom_SP(seed); else return InitEngineRandom_RND(seed); }