rnd-20091023-1-src
authorHolger Schemel <info@artsoft.org>
Thu, 22 Oct 2009 22:19:48 +0000 (00:19 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:57:46 +0000 (10:57 +0200)
src/cartoons.c
src/conftime.h
src/editor.c
src/files.c
src/game_sp/init.c
src/game_sp/main.c
src/tools.c

index 70d6d3d54ac6a8731eff3a45fd86483fa438b517..8ca4bdd5efde9c2e81ffbf96bc1796d1a2adcf17 100644 (file)
@@ -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;
 
index ab8b8f0d6f86d9f804e15f068fe1b8208fe9ac4c..5d237cbb4a466f22ce234c1707491a656fc92426 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2009-10-22 22:59"
+#define COMPILE_DATE_STRING "2009-10-23 00:17"
index 5fb4dd93b4444f26017086e13c78fbcd145dee6c..a75d128500553814e1de836731ed2a16af5d4355 100644 (file)
@@ -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                            }
 };
index 85a4b23d9adbe64f2a60081fff538bdf61da7c7b..e71ca2a26a34b72b86c04e5b0684e4135db4efbb 100644 (file)
@@ -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:
index 736211c8642a97759295c406ba800bd8765bb5b7..953b9ec8256a570d6643cd6d956a45870c7bba2c 100644 (file)
@@ -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;
+}
index a8d61e3ff7729f71309d57b5d319ae60afb71ec2..9f343318407a45100de8d4673dd1ed83b385143f 100644 (file)
@@ -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();
+}
index e80cd9967eb6c6acfd8e603e3c3fe0e87bf7c6f2..0650532c0cc8610ed6d5764646bff28d67828cb6 100644 (file)
@@ -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);
 }