rnd-20070407-4-src
authorHolger Schemel <info@artsoft.org>
Sat, 7 Apr 2007 20:52:49 +0000 (22:52 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:55:30 +0000 (10:55 +0200)
* added game panel control to display arbitrary elements on game panel

ChangeLog
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/game.c
src/game.h
src/main.h

index 7a1ef5d8eb10b9b12257474e74479545dcf2eddc..89ccb10c923c0346d105db950622f069ee3fb6cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 2007-04-07
+       * added game panel control to display arbitrary elements on game panel
        * added game panel control to display custom element score (globally
          unique for identical custom elements) either as value or as element
        * added ".draw_masked" and ".draw_order" to game panel control drawing
index f15b8c1dda94cdf855a8ba506093596630e9f272..7179170135292bb17ab002bdc2ec46292df25688 100644 (file)
@@ -5925,6 +5925,55 @@ struct ConfigInfo image_config[] =
   { "game.panel.gravity_state.draw_masked",    "true"                  },
   { "game.panel.gravity_state.draw_order",     "0"                     },
 
+  { "game.panel.element_1.x",                  "-1"                    },
+  { "game.panel.element_1.y",                  "-1"                    },
+  { "game.panel.element_1.tile_size",          "16"                    },
+  { "game.panel.element_1.element",            "custom_1"              },
+  { "game.panel.element_1.draw_masked",                "false"                 },
+  { "game.panel.element_1.draw_order",         "0"                     },
+  { "game.panel.element_2.x",                  "-1"                    },
+  { "game.panel.element_2.y",                  "-1"                    },
+  { "game.panel.element_2.tile_size",          "16"                    },
+  { "game.panel.element_2.element",            "custom_1"              },
+  { "game.panel.element_2.draw_masked",                "false"                 },
+  { "game.panel.element_2.draw_order",         "0"                     },
+  { "game.panel.element_3.x",                  "-1"                    },
+  { "game.panel.element_3.y",                  "-1"                    },
+  { "game.panel.element_3.tile_size",          "16"                    },
+  { "game.panel.element_3.element",            "custom_1"              },
+  { "game.panel.element_3.draw_masked",                "false"                 },
+  { "game.panel.element_3.draw_order",         "0"                     },
+  { "game.panel.element_4.x",                  "-1"                    },
+  { "game.panel.element_4.y",                  "-1"                    },
+  { "game.panel.element_4.tile_size",          "16"                    },
+  { "game.panel.element_4.element",            "custom_1"              },
+  { "game.panel.element_4.draw_masked",                "false"                 },
+  { "game.panel.element_4.draw_order",         "0"                     },
+  { "game.panel.element_5.x",                  "-1"                    },
+  { "game.panel.element_5.y",                  "-1"                    },
+  { "game.panel.element_5.tile_size",          "16"                    },
+  { "game.panel.element_5.element",            "custom_1"              },
+  { "game.panel.element_5.draw_masked",                "false"                 },
+  { "game.panel.element_5.draw_order",         "0"                     },
+  { "game.panel.element_6.x",                  "-1"                    },
+  { "game.panel.element_6.y",                  "-1"                    },
+  { "game.panel.element_6.tile_size",          "16"                    },
+  { "game.panel.element_6.element",            "custom_1"              },
+  { "game.panel.element_6.draw_masked",                "false"                 },
+  { "game.panel.element_6.draw_order",         "0"                     },
+  { "game.panel.element_7.x",                  "-1"                    },
+  { "game.panel.element_7.y",                  "-1"                    },
+  { "game.panel.element_7.tile_size",          "16"                    },
+  { "game.panel.element_7.element",            "custom_1"              },
+  { "game.panel.element_7.draw_masked",                "false"                 },
+  { "game.panel.element_7.draw_order",         "0"                     },
+  { "game.panel.element_8.x",                  "-1"                    },
+  { "game.panel.element_8.y",                  "-1"                    },
+  { "game.panel.element_8.tile_size",          "16"                    },
+  { "game.panel.element_8.element",            "custom_1"              },
+  { "game.panel.element_8.draw_masked",                "false"                 },
+  { "game.panel.element_8.draw_order",         "0"                     },
+
   { "game.panel.ce_score_1.x",                 "-1"                    },
   { "game.panel.ce_score_1.y",                 "-1"                    },
   { "game.panel.ce_score_1.align",             "left"                  },
index 57d32a7df9aa057c4046f3d0e052d854f6667395..799331dc4dd8efe1b6c7aa8751dba6ffa0591b61 100644 (file)
@@ -3624,6 +3624,198 @@ struct TokenIntPtrInfo image_config_vars[] =
     "game.panel.gravity_state.draw_order",
     &game.panel.gravity_state.sort_priority
   },
+  {
+    "game.panel.element_1.x",
+    &game.panel.element[0].x
+  },
+  {
+    "game.panel.element_1.y",
+    &game.panel.element[0].y
+  },
+  {
+    "game.panel.element_1.tile_size",
+    &game.panel.element[0].size
+  },
+  {
+    "game.panel.element_1.element",
+    &game.panel.element[0].id
+  },
+  {
+    "game.panel.element_1.draw_masked",
+    &game.panel.element[0].draw_masked
+  },
+  {
+    "game.panel.element_1.draw_order",
+    &game.panel.element[0].sort_priority
+  },
+  {
+    "game.panel.element_2.x",
+    &game.panel.element[1].x
+  },
+  {
+    "game.panel.element_2.y",
+    &game.panel.element[1].y
+  },
+  {
+    "game.panel.element_2.tile_size",
+    &game.panel.element[1].size
+  },
+  {
+    "game.panel.element_2.element",
+    &game.panel.element[1].id
+  },
+  {
+    "game.panel.element_2.draw_masked",
+    &game.panel.element[1].draw_masked
+  },
+  {
+    "game.panel.element_2.draw_order",
+    &game.panel.element[1].sort_priority
+  },
+  {
+    "game.panel.element_3.x",
+    &game.panel.element[2].x
+  },
+  {
+    "game.panel.element_3.y",
+    &game.panel.element[2].y
+  },
+  {
+    "game.panel.element_3.tile_size",
+    &game.panel.element[2].size
+  },
+  {
+    "game.panel.element_3.element",
+    &game.panel.element[2].id
+  },
+  {
+    "game.panel.element_3.draw_masked",
+    &game.panel.element[2].draw_masked
+  },
+  {
+    "game.panel.element_3.draw_order",
+    &game.panel.element[2].sort_priority
+  },
+  {
+    "game.panel.element_4.x",
+    &game.panel.element[3].x
+  },
+  {
+    "game.panel.element_4.y",
+    &game.panel.element[3].y
+  },
+  {
+    "game.panel.element_4.tile_size",
+    &game.panel.element[3].size
+  },
+  {
+    "game.panel.element_4.element",
+    &game.panel.element[3].id
+  },
+  {
+    "game.panel.element_4.draw_masked",
+    &game.panel.element[3].draw_masked
+  },
+  {
+    "game.panel.element_4.draw_order",
+    &game.panel.element[3].sort_priority
+  },
+  {
+    "game.panel.element_5.x",
+    &game.panel.element[4].x
+  },
+  {
+    "game.panel.element_5.y",
+    &game.panel.element[4].y
+  },
+  {
+    "game.panel.element_5.tile_size",
+    &game.panel.element[4].size
+  },
+  {
+    "game.panel.element_5.element",
+    &game.panel.element[4].id
+  },
+  {
+    "game.panel.element_5.draw_masked",
+    &game.panel.element[4].draw_masked
+  },
+  {
+    "game.panel.element_5.draw_order",
+    &game.panel.element[4].sort_priority
+  },
+  {
+    "game.panel.element_6.x",
+    &game.panel.element[5].x
+  },
+  {
+    "game.panel.element_6.y",
+    &game.panel.element[5].y
+  },
+  {
+    "game.panel.element_6.tile_size",
+    &game.panel.element[5].size
+  },
+  {
+    "game.panel.element_6.element",
+    &game.panel.element[5].id
+  },
+  {
+    "game.panel.element_6.draw_masked",
+    &game.panel.element[5].draw_masked
+  },
+  {
+    "game.panel.element_6.draw_order",
+    &game.panel.element[5].sort_priority
+  },
+  {
+    "game.panel.element_7.x",
+    &game.panel.element[6].x
+  },
+  {
+    "game.panel.element_7.y",
+    &game.panel.element[6].y
+  },
+  {
+    "game.panel.element_7.tile_size",
+    &game.panel.element[6].size
+  },
+  {
+    "game.panel.element_7.element",
+    &game.panel.element[6].id
+  },
+  {
+    "game.panel.element_7.draw_masked",
+    &game.panel.element[6].draw_masked
+  },
+  {
+    "game.panel.element_7.draw_order",
+    &game.panel.element[6].sort_priority
+  },
+  {
+    "game.panel.element_8.x",
+    &game.panel.element[7].x
+  },
+  {
+    "game.panel.element_8.y",
+    &game.panel.element[7].y
+  },
+  {
+    "game.panel.element_8.tile_size",
+    &game.panel.element[7].size
+  },
+  {
+    "game.panel.element_8.element",
+    &game.panel.element[7].id
+  },
+  {
+    "game.panel.element_8.draw_masked",
+    &game.panel.element[7].draw_masked
+  },
+  {
+    "game.panel.element_8.draw_order",
+    &game.panel.element[7].sort_priority
+  },
   {
     "game.panel.ce_score_1.x",
     &game.panel.ce_score[0].x
index a22a5e5b9673360e4b781cd662a3a003d2d2fa01..0cc17aa27eb21c30983076759e78d223aaa2bcbd 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-04-07 19:50"
+#define COMPILE_DATE_STRING "2007-04-07 22:49"
index 0d748e5b5330707b58f95191ce497807248ac60b..3f6ec77b97628b366a671484bc2c9f203ebc4886 100644 (file)
 #define GAME_PANEL_MAGIC_WALL                  66
 #define GAME_PANEL_MAGIC_WALL_TIME             67
 #define GAME_PANEL_GRAVITY_STATE               68
-#define GAME_PANEL_CE_SCORE_1                  69
-#define GAME_PANEL_CE_SCORE_2                  70
-#define GAME_PANEL_CE_SCORE_3                  71
-#define GAME_PANEL_CE_SCORE_4                  72
-#define GAME_PANEL_CE_SCORE_5                  73
-#define GAME_PANEL_CE_SCORE_6                  74
-#define GAME_PANEL_CE_SCORE_7                  75
-#define GAME_PANEL_CE_SCORE_8                  76
-#define GAME_PANEL_CE_SCORE_1_ELEMENT          77
-#define GAME_PANEL_CE_SCORE_2_ELEMENT          78
-#define GAME_PANEL_CE_SCORE_3_ELEMENT          79
-#define GAME_PANEL_CE_SCORE_4_ELEMENT          80
-#define GAME_PANEL_CE_SCORE_5_ELEMENT          81
-#define GAME_PANEL_CE_SCORE_6_ELEMENT          82
-#define GAME_PANEL_CE_SCORE_7_ELEMENT          83
-#define GAME_PANEL_CE_SCORE_8_ELEMENT          84
-#define GAME_PANEL_PLAYER_NAME                 85
-#define GAME_PANEL_LEVEL_NAME                  86
-#define GAME_PANEL_LEVEL_AUTHOR                        87
-
-#define NUM_GAME_PANEL_CONTROLS                        88
+#define GAME_PANEL_ELEMENT_1                   69
+#define GAME_PANEL_ELEMENT_2                   70
+#define GAME_PANEL_ELEMENT_3                   71
+#define GAME_PANEL_ELEMENT_4                   72
+#define GAME_PANEL_ELEMENT_5                   73
+#define GAME_PANEL_ELEMENT_6                   74
+#define GAME_PANEL_ELEMENT_7                   75
+#define GAME_PANEL_ELEMENT_8                   76
+#define GAME_PANEL_CE_SCORE_1                  77
+#define GAME_PANEL_CE_SCORE_2                  78
+#define GAME_PANEL_CE_SCORE_3                  79
+#define GAME_PANEL_CE_SCORE_4                  80
+#define GAME_PANEL_CE_SCORE_5                  81
+#define GAME_PANEL_CE_SCORE_6                  82
+#define GAME_PANEL_CE_SCORE_7                  83
+#define GAME_PANEL_CE_SCORE_8                  84
+#define GAME_PANEL_CE_SCORE_1_ELEMENT          85
+#define GAME_PANEL_CE_SCORE_2_ELEMENT          86
+#define GAME_PANEL_CE_SCORE_3_ELEMENT          87
+#define GAME_PANEL_CE_SCORE_4_ELEMENT          88
+#define GAME_PANEL_CE_SCORE_5_ELEMENT          89
+#define GAME_PANEL_CE_SCORE_6_ELEMENT          90
+#define GAME_PANEL_CE_SCORE_7_ELEMENT          91
+#define GAME_PANEL_CE_SCORE_8_ELEMENT          92
+#define GAME_PANEL_PLAYER_NAME                 93
+#define GAME_PANEL_LEVEL_NAME                  94
+#define GAME_PANEL_LEVEL_AUTHOR                        95
+
+#define NUM_GAME_PANEL_CONTROLS                        96
 
 struct GamePanelOrderInfo
 {
@@ -240,6 +248,7 @@ struct GamePanelControlInfo
   int value, last_value;
   int frame, last_frame;
   int gfx_frame;
+  int gfx_random;
 };
 
 static struct GamePanelControlInfo game_panel_controls[] =
@@ -589,6 +598,46 @@ static struct GamePanelControlInfo game_panel_controls[] =
     &game.panel.gravity_state,
     TYPE_STRING,
   },
+  {
+    GAME_PANEL_ELEMENT_1,
+    &game.panel.element[0],
+    TYPE_ELEMENT,
+  },
+  {
+    GAME_PANEL_ELEMENT_2,
+    &game.panel.element[1],
+    TYPE_ELEMENT,
+  },
+  {
+    GAME_PANEL_ELEMENT_3,
+    &game.panel.element[2],
+    TYPE_ELEMENT,
+  },
+  {
+    GAME_PANEL_ELEMENT_4,
+    &game.panel.element[3],
+    TYPE_ELEMENT,
+  },
+  {
+    GAME_PANEL_ELEMENT_5,
+    &game.panel.element[4],
+    TYPE_ELEMENT,
+  },
+  {
+    GAME_PANEL_ELEMENT_6,
+    &game.panel.element[5],
+    TYPE_ELEMENT,
+  },
+  {
+    GAME_PANEL_ELEMENT_7,
+    &game.panel.element[6],
+    TYPE_ELEMENT,
+  },
+  {
+    GAME_PANEL_ELEMENT_8,
+    &game.panel.element[7],
+    TYPE_ELEMENT,
+  },
   {
     GAME_PANEL_CE_SCORE_1,
     &game.panel.ce_score[0],
@@ -869,6 +918,8 @@ static struct GamePanelControlInfo game_panel_controls[] =
 
 static void CreateField(int, int, int);
 
+static void ResetGfxAnimation(int, int);
+
 static void SetPlayerWaiting(struct PlayerInfo *, boolean);
 static void AdvanceFrameAndPlayerCounters(int);
 
@@ -2123,21 +2174,21 @@ void UpdateGameControlValues()
   game_panel_controls[GAME_PANEL_GRAVITY_STATE].value = game.gravity;
 #endif
 
+  for (i = 0; i < NUM_PANEL_ELEMENTS; i++)
+    game_panel_controls[GAME_PANEL_ELEMENT_1 + i].value =
+      (IS_DRAWABLE_ELEMENT(game.panel.element[i].id) ?
+       game.panel.element[i].id : EL_UNDEFINED);
+
   for (i = 0; i < NUM_PANEL_CE_SCORE; i++)
-  {
-    if (IS_CUSTOM_ELEMENT(game.panel.ce_score[i].id))
-    {
-      int ce_score = element_info[game.panel.ce_score[i].id].collect_score;
+    game_panel_controls[GAME_PANEL_CE_SCORE_1 + i].value =
+      (IS_CUSTOM_ELEMENT(game.panel.ce_score[i].id) ?
+       element_info[game.panel.ce_score[i].id].collect_score : 0);
 
-      game_panel_controls[GAME_PANEL_CE_SCORE_1 + i].value = ce_score;
-      game_panel_controls[GAME_PANEL_CE_SCORE_1_ELEMENT + i].value = ce_score;
-    }
-    else
-    {
-      game_panel_controls[GAME_PANEL_CE_SCORE_1 + i].value = 0;
-      game_panel_controls[GAME_PANEL_CE_SCORE_1_ELEMENT + i].value = 0;
-    }
-  }
+  for (i = 0; i < NUM_PANEL_CE_SCORE; i++)
+    game_panel_controls[GAME_PANEL_CE_SCORE_1_ELEMENT + i].value =
+      (IS_CUSTOM_ELEMENT(game.panel.ce_score_element[i].id) ?
+       element_info[game.panel.ce_score_element[i].id].collect_score :
+       EL_UNDEFINED);
 
   game_panel_controls[GAME_PANEL_PLAYER_NAME].value = 0;
   game_panel_controls[GAME_PANEL_LEVEL_NAME].value = 0;
@@ -2149,13 +2200,35 @@ void UpdateGameControlValues()
 
     if (gpc->type == TYPE_ELEMENT)
     {
+      int last_anim_random_frame = gfx.anim_random_frame;
+      int element = gpc->value;
+      int graphic = el2panelimg(element);
+
       if (gpc->value != gpc->last_value)
+      {
        gpc->gfx_frame = 0;
+       gpc->gfx_random = INIT_GFX_RANDOM();
+      }
       else
+      {
        gpc->gfx_frame++;
 
+       if (ANIM_MODE(graphic) == ANIM_RANDOM &&
+           IS_NEXT_FRAME(gpc->gfx_frame, graphic))
+         gpc->gfx_random = INIT_GFX_RANDOM();
+      }
+
+      if (ANIM_MODE(graphic) == ANIM_RANDOM)
+       gfx.anim_random_frame = gpc->gfx_random;
+
+      if (ANIM_MODE(graphic) == ANIM_CE_SCORE)
+       gpc->gfx_frame = element_info[element].collect_score;
+
       gpc->frame = getGraphicAnimationFrame(el2panelimg(gpc->value),
                                            gpc->gfx_frame);
+
+      if (ANIM_MODE(graphic) == ANIM_RANDOM)
+       gfx.anim_random_frame = last_anim_random_frame;
     }
   }
 }
@@ -3568,6 +3641,8 @@ void InitGame()
       emulate_sp = FALSE;
 
     InitField(x, y, TRUE);
+
+    ResetGfxAnimation(x, y);
   }
 
   InitBeltMovement();
index 739c51af641874b495fde459637e27435e7a5676..ac2496e1bae9949340b3f2284bdebe75ab0c27d5 100644 (file)
@@ -26,6 +26,7 @@
 #define NUM_BELT_PARTS         3
 
 #define NUM_PANEL_INVENTORY    8
+#define NUM_PANEL_ELEMENTS     8
 #define NUM_PANEL_CE_SCORE     8
 
 #if 1
@@ -73,6 +74,7 @@ struct GamePanelInfo
   struct TextPosInfo magic_wall;
   struct TextPosInfo magic_wall_time;
   struct TextPosInfo gravity_state;
+  struct TextPosInfo element[NUM_PANEL_ELEMENTS];
   struct TextPosInfo ce_score[NUM_PANEL_CE_SCORE];
   struct TextPosInfo ce_score_element[NUM_PANEL_CE_SCORE];
   struct TextPosInfo player_name;
index 1e62cc61186a8ab658c32be77c43875a7ff6d2ab..1b877e7e31401e23a454b6a0b76bec2d27984ed7 100644 (file)
 #define IS_OBSOLETE(e)         HAS_PROPERTY(e, EP_OBSOLETE)
 
 /* special macros used in game engine */
+#define IS_FILE_ELEMENT(e)     ((e) >= 0 &&                            \
+                                (e) <= NUM_FILE_ELEMENTS)
+
+#define IS_DRAWABLE_ELEMENT(e) ((e) >= 0 &&                            \
+                                (e) <= NUM_DRAWABLE_ELEMENTS)
+
+#define IS_RUNTIME_ELEMENT(e)  ((e) >= 0 &&                            \
+                                (e) <= NUM_RUNTIME_ELEMENTS)
+
+#define IS_VALID_ELEMENT(e)    ((e) >= 0 &&                            \
+                                (e) <= MAX_NUM_ELEMENTS)
+
 #define IS_CUSTOM_ELEMENT(e)   ((e) >= EL_CUSTOM_START &&              \
                                 (e) <= EL_CUSTOM_END)
 
 #define EL_EMC_DRIPPER_ACTIVE          (EL_FIRST_RUNTIME_REAL + 70)
 #define EL_EMC_SPRING_BUMPER_ACTIVE    (EL_FIRST_RUNTIME_REAL + 71)
 
+#define NUM_DRAWABLE_ELEMENTS          (EL_FIRST_RUNTIME_REAL + 72)
+
 /* "unreal" (and therefore not drawable) runtime elements */
-#define EL_FIRST_RUNTIME_UNREAL                (EL_FIRST_RUNTIME_REAL + 72)
+#define EL_FIRST_RUNTIME_UNREAL                (NUM_DRAWABLE_ELEMENTS)
 
 #define EL_BLOCKED                     (EL_FIRST_RUNTIME_UNREAL + 0)
 #define EL_EXPLOSION                   (EL_FIRST_RUNTIME_UNREAL + 1)