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;
-#define COMPILE_DATE_STRING "2009-10-22 22:59"
+#define COMPILE_DATE_STRING "2009-10-23 00:17"
{
{ GAME_ENGINE_TYPE_RND, "Rocks'n'Diamonds" },
{ GAME_ENGINE_TYPE_EM, "Emerald Mine" },
+ { GAME_ENGINE_TYPE_SP, "Supaplex" },
{ -1, NULL }
};
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)
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:
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;
+}
subMainGameLoop_Main(single_player_action, warp_mode);
}
+
+void RedrawPlayfield_SP(boolean force_redraw)
+{
+ subDisplayLevel();
+}
/* 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)
{
}
}
- 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)
{
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);
}