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
{ "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" },
"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
-#define COMPILE_DATE_STRING "2007-04-07 19:50"
+#define COMPILE_DATE_STRING "2007-04-07 22:49"
#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
{
int value, last_value;
int frame, last_frame;
int gfx_frame;
+ int gfx_random;
};
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],
static void CreateField(int, int, int);
+static void ResetGfxAnimation(int, int);
+
static void SetPlayerWaiting(struct PlayerInfo *, boolean);
static void AdvanceFrameAndPlayerCounters(int);
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;
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;
}
}
}
emulate_sp = FALSE;
InitField(x, y, TRUE);
+
+ ResetGfxAnimation(x, y);
}
InitBeltMovement();
#define NUM_BELT_PARTS 3
#define NUM_PANEL_INVENTORY 8
+#define NUM_PANEL_ELEMENTS 8
#define NUM_PANEL_CE_SCORE 8
#if 1
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;
#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)