rnd-20100303-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 2 Mar 2010 23:59:56 +0000 (00:59 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:58:40 +0000 (10:58 +0200)
src/conftime.h
src/game.c
src/game_sp/ASM.c
src/game_sp/ASM.h
src/game_sp/InitGameConditions.c
src/game_sp/export.h
src/game_sp/file.c
src/game_sp/main.c

index 82b874ad9f90720756b18d3d8eb4dd5854916e52..58e80c90e035d7152983e4db16ca65a58056e78c 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-02-24 00:22"
+#define COMPILE_DATE_STRING "2010-03-02 23:49"
index cf7193f87cafe33d5009ae32ac232b784fbb3bb0..46f050d2c3c18dd37c7ab8ae7fcdc40b3de2ad7a 100644 (file)
@@ -2221,17 +2221,25 @@ void UpdateGameControlValues()
              local_player->LevelSolved_CountingTime :
              level.game_engine_type == GAME_ENGINE_TYPE_EM ?
              level.native_em_level->lev->time :
+             level.game_engine_type == GAME_ENGINE_TYPE_SP ?
+             level.native_sp_level->game_sp->time_played :
              level.time == 0 ? TimePlayed : TimeLeft);
   int score = (local_player->LevelSolved ?
               local_player->LevelSolved_CountingScore :
               level.game_engine_type == GAME_ENGINE_TYPE_EM ?
               level.native_em_level->lev->score :
+              level.game_engine_type == GAME_ENGINE_TYPE_SP ?
+              level.native_sp_level->game_sp->score :
               local_player->score);
   int gems = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
              level.native_em_level->lev->required :
+             level.game_engine_type == GAME_ENGINE_TYPE_SP ?
+             level.native_sp_level->game_sp->infotrons_still_needed :
              local_player->gems_still_needed);
   int exit_closed = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
                     level.native_em_level->lev->required > 0 :
+                    level.game_engine_type == GAME_ENGINE_TYPE_SP ?
+                    level.native_sp_level->game_sp->infotrons_still_needed > 0 :
                     local_player->gems_still_needed > 0 ||
                     local_player->sokobanfields_still_needed > 0 ||
                     local_player->lights_still_needed > 0);
@@ -2253,6 +2261,10 @@ void UpdateGameControlValues()
   {
     for (i = 0; i < MAX_PLAYERS; i++)
     {
+      /* only one player in Supaplex game engine */
+      if (level.game_engine_type == GAME_ENGINE_TYPE_SP && i > 0)
+       break;
+
       for (k = 0; k < MAX_NUM_KEYS; k++)
       {
        if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
@@ -2269,6 +2281,9 @@ void UpdateGameControlValues()
       if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
        game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value +=
          level.native_em_level->ply[i]->dynamite;
+      else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+       game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value +=
+         level.native_sp_level->game_sp->red_disk_count;
       else
        game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value +=
          stored_player[i].inventory_size;
@@ -2301,6 +2316,9 @@ void UpdateGameControlValues()
     if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
       game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value +=
        level.native_em_level->ply[player_nr]->dynamite;
+    else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+      game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value +=
+       level.native_sp_level->game_sp->red_disk_count;
     else
       game_panel_controls[GAME_PANEL_INVENTORY_COUNT].value +=
        stored_player[player_nr].inventory_size;
index 9cad09d548a65f105ce0c765b3d27142486c994c..d31edfaed7f626ce516986d9f13a500b38b1fbc0 100644 (file)
@@ -4,19 +4,6 @@
 
 #include "ASM.h"
 
-// static char *VB_Name = "modASM";
-
-// --- Option Explicit
-
-// PseudoRegisters:
-// Public ax%, bx%
-// --- const int ByteMask = 0xFF;
-int cmpFlag;
-
-void Neg(int *Val)
-{
-  *Val = -*Val;
-}
 
 void Mov(int *Var, int Val)
 {
@@ -34,6 +21,7 @@ void MovHighByte(int *Var, int Val)
 
   Tmp = Val & 0x7F;
   Tmp = 0x100 * Tmp;
+
   if ((Val & 0x80) != 0)
     Tmp = Tmp | 0x8000;
 
@@ -44,9 +32,7 @@ int LowByte(int Var)
 {
   int LowByte;
 
-  // Dim Tmp As Byte
   LowByte = (Var & 0xFF);
-  // LowByte = ByteToInt(Tmp)
 
   return LowByte;
 }
@@ -56,13 +42,9 @@ int HighByte(int Var)
   int HighByte;
 
   if (Var & 0x8000)
-  {
     HighByte = ((Var & 0x7FFF) / 0x100) | 0x80;
-  }
   else
-  {
     HighByte = Var / 0x100;
-  }
 
   return HighByte;
 }
@@ -76,57 +58,30 @@ int SgnHighByte(int Var) // extends the signum to 16 bit
 #endif
 
   if (Var & 0x8000)
-  {
     SgnHighByte = ((Var & 0x7FFF) / 0x100) | 0xFF80;
-  }
   else
-  {
     SgnHighByte = Var / 0x100;
-  }
 
   return SgnHighByte;
 }
 
-boolean Less()
-{
-  boolean Less;
-
-  Less = (cmpFlag < 0);
-
-  return Less;
-}
-
-boolean GreaterOrEqual()
-{
-  boolean GreaterOrEqual;
-
-  GreaterOrEqual = (0 <= cmpFlag);
-
-  return GreaterOrEqual;
-}
-
-boolean Equal()
+int SHL(int *Var, int Count)
 {
-  boolean Equal;
-
-  Equal = (0 == cmpFlag);
+  int SHL;
 
-  return Equal;
-}
+  int i;
 
-void CMP(int A, int B)
-{
-  cmpFlag = A - B;
-}
+  for (i = 1; i <= Count; i++)
+  {
+    *Var = *Var & 0x7FFF;
 
-void Add(int *A, int B)
-{
-  *A = *A + B;
-}
+    if ((*Var & 0x4000) != 0)
+      *Var = (2 * (*Var & 0x3FFF)) | 0x8000;
+    else
+      *Var = 2 * *Var;
+  }
 
-void MySub(int *A, int B)
-{
-  *A = *A - B;
+  return SHL;
 }
 
 int SHR(int *Var, int Count)
@@ -136,56 +91,24 @@ int SHR(int *Var, int Count)
   int i;
 
   if (*Var & 0x8000)
-  {
     *Var = ((*Var & 0x7FFF) / 2) | 0x4000;
-  }
   else
-  {
     *Var = *Var / 2;
-  }
 
   for (i = 2; i <= Count; i++)
-  {
     *Var = *Var / 2;
-  }
 
   return SHR;
 }
 
-int SHL(int *Var, int Count)
-{
-  int SHL;
-
-  int i;
-
-  for (i = 1; i <= Count; i++)
-  {
-    *Var = *Var & 0x7FFF;
-    if ((*Var & 0x4000) != 0)
-    {
-      *Var = (2 * (*Var & 0x3FFF)) | 0x8000;
-    }
-    else
-    {
-      *Var = 2 * *Var;
-    }
-  }
-
-  return SHL;
-}
-
 int ByteToInt(byte B)
 {
   int ByteToInt;
 
   if ((B & 0x80) == 0x80)
-  {
     ByteToInt = -(0xFF - B + 1);
-  }
   else
-  {
     ByteToInt = B;
-  }
 
   return ByteToInt;
 }
@@ -194,17 +117,7 @@ byte IntToByte(int i)
 {
   byte IntToByte;
 
-  // IntToByte = CByte(i & 0xFF);
   IntToByte = (byte)(i & 0xFF);
 
   return IntToByte;
 }
-
-void XCHG(int A, int B)
-{
-  int Tmp;
-
-  Tmp = B;
-  B = A;
-  A = Tmp;
-}
index 09bb3938ba9b3c638a595c758f66fbf41b43c780..f1e4e4ac7da24143508cb2c34c4c162cd30fd453 100644 (file)
 
 #include "global.h"
 
+
 #define ByteMask                       (0xFF)
 
-extern void Add(int *A, int B);
-extern int ByteToInt(byte B);
-extern void CMP(int A, int B);
-extern boolean Equal();
-extern boolean GreaterOrEqual();
-extern int HighByte(int Var);
-extern byte IntToByte(int i);
-extern boolean Less();
-extern int LowByte(int Var);
 extern void Mov(int *Var, int Val);
-extern void MovHighByte(int *Var, int Val);
 extern void MovLowByte(int *Var, int Val);
-extern void MySub(int *A, int B);
-extern void Neg(int *Val);
+extern void MovHighByte(int *Var, int Val);
+extern int LowByte(int Var);
+extern int HighByte(int Var);
+extern int SgnHighByte(int Var);
 extern int SHL(int *Var, int Count);
 extern int SHR(int *Var, int Count);
-extern int SgnHighByte(int Var);
-extern void XCHG(int A, int B);
-
-extern int cmpFlag;
+extern int ByteToInt(byte B);
+extern byte IntToByte(int i);
 
 #endif /* ASM_H */
index 003cedc404cad6fcce1234f5cc926287d1285b1a..0afc9fa3e8e199486ccdf3a2ce29b19f234c728f 100644 (file)
@@ -97,7 +97,7 @@ int InitMurphyPosB(int si)
 
   // To Do: draw Murphy in location ax
 #if 1
-  StretchedSprites.BltImg(MurphyScreenXPos, MurphyScreenYPos, fiMurphy, 0);
+  StretchedSprites.BltImg(MurphyScreenXPos, MurphyScreenYPos, aniMurphy, 0);
 #else
   StretchedSprites.BltEx(MurphyScreenXPos, MurphyScreenYPos, fiMurphy);
 #endif
index bfeab9dd4973bfdee398ddfa100044dbe47b5c19..8abe983b6864621a7df930019b24b338eeb8bc5a 100644 (file)
@@ -90,6 +90,12 @@ struct GameInfo_SP
   boolean LevelSolved;
   boolean GameOver;
 
+  /* needed for updating panel */
+  int time_played;
+  int infotrons_still_needed;
+  int red_disk_count;
+  int score;
+
   /* needed for engine snapshots */
   int preceding_buffer_size;
 };
@@ -114,6 +120,9 @@ struct LevelInfo_SP
   byte playfield[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
 
   struct DemoInfo_SP demo;
+
+  /* used for runtime values */
+  struct GameInfo_SP *game_sp;
 };
 
 struct GraphicInfo_SP
index 5a525214b44576414d5e68a76578e6316d15aa6d..26f74167920efe9d835a4d154e378fe919b37270 100644 (file)
@@ -13,6 +13,8 @@ void setLevelInfoToDefaults_SP()
   char *empty_title = "-------- EMPTY --------";
   int i, x, y;
 
+  native_sp_level.game_sp = &game_sp;
+
   native_sp_level.width  = SP_STD_PLAYFIELD_WIDTH;
   native_sp_level.height = SP_STD_PLAYFIELD_HEIGHT;
 
index f30aa0dbbb5e8cd8f4c743f7c58064a6e62720ce..b73da64f9d4ffc6de9a9919e6963b96f3bc3dc5a 100644 (file)
@@ -22,6 +22,11 @@ void InitGameEngine_SP()
   game_sp.LevelSolved = FALSE;
   game_sp.GameOver = FALSE;
 
+  game_sp.time_played = 0;
+  game_sp.infotrons_still_needed = native_sp_level.header.InfotronsNeeded;
+  game_sp.red_disk_count = 0;
+  game_sp.score = 0;
+
   menBorder.Checked = setup.sp_show_border_elements;
 
   for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++)
@@ -73,6 +78,32 @@ void RedrawPlayfield_SP(boolean force_redraw)
   BackToFront_SP();
 }
 
+void DrawGameDoorValues_SP()
+{
+#if 1
+
+  game_sp.time_played = TimerVar / setup.game_frame_delay;
+  game_sp.infotrons_still_needed = InfotronsNeeded;
+  game_sp.red_disk_count = RedDiskCount;
+  game_sp.score = 0;           // (currently no score in Supaplex engine)
+
+#else
+
+  int infotrons_still_needed = InfotronsNeeded;
+  int red_disks = RedDiskCount;
+  int no_score_in_supaplex = 0;
+#if 1
+  int level_time_played = TimerVar / setup.game_frame_delay;
+#else
+  int level_time_played = TimerVar / 35;       /* !!! CHECK THIS !!! */
+#endif
+  int no_keys_in_supaplex = 0;
+
+  DrawAllGameValues(infotrons_still_needed, red_disks, no_score_in_supaplex,
+                   level_time_played, no_keys_in_supaplex);
+#endif
+}
+
 void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode)
 {
   byte single_player_action = action[0];
@@ -82,6 +113,9 @@ void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode)
 
   RedrawPlayfield_SP(FALSE);
 
+  if (!warp_mode)              /* do not redraw values in warp mode */
+    DrawGameDoorValues_SP();
+
   for (x = DisplayMinX; x <= DisplayMaxX; x++)
     for (y = DisplayMinY; y <= DisplayMaxY; y++)
       GfxFrame[x][y]++;