+#define PANEL_XPOS(p) (DX + ALIGNED_TEXT_XPOS(p))
+#define PANEL_YPOS(p) (DY + ALIGNED_TEXT_YPOS(p))
+
+/* game panel display and control definitions */
+#define GAME_PANEL_LEVEL_NUMBER 0
+#define GAME_PANEL_GEMS 1
+#define GAME_PANEL_INVENTORY_COUNT 2
+#define GAME_PANEL_INVENTORY_FIRST_1 3
+#define GAME_PANEL_INVENTORY_FIRST_2 4
+#define GAME_PANEL_INVENTORY_FIRST_3 5
+#define GAME_PANEL_INVENTORY_FIRST_4 6
+#define GAME_PANEL_INVENTORY_FIRST_5 7
+#define GAME_PANEL_INVENTORY_FIRST_6 8
+#define GAME_PANEL_INVENTORY_FIRST_7 9
+#define GAME_PANEL_INVENTORY_FIRST_8 10
+#define GAME_PANEL_INVENTORY_LAST_1 11
+#define GAME_PANEL_INVENTORY_LAST_2 12
+#define GAME_PANEL_INVENTORY_LAST_3 13
+#define GAME_PANEL_INVENTORY_LAST_4 14
+#define GAME_PANEL_INVENTORY_LAST_5 15
+#define GAME_PANEL_INVENTORY_LAST_6 16
+#define GAME_PANEL_INVENTORY_LAST_7 17
+#define GAME_PANEL_INVENTORY_LAST_8 18
+#define GAME_PANEL_KEY_1 19
+#define GAME_PANEL_KEY_2 20
+#define GAME_PANEL_KEY_3 21
+#define GAME_PANEL_KEY_4 22
+#define GAME_PANEL_KEY_5 23
+#define GAME_PANEL_KEY_6 24
+#define GAME_PANEL_KEY_7 25
+#define GAME_PANEL_KEY_8 26
+#define GAME_PANEL_KEY_WHITE 27
+#define GAME_PANEL_KEY_WHITE_COUNT 28
+#define GAME_PANEL_SCORE 29
+#define GAME_PANEL_HIGHSCORE 30
+#define GAME_PANEL_TIME 31
+#define GAME_PANEL_TIME_HH 32
+#define GAME_PANEL_TIME_MM 33
+#define GAME_PANEL_TIME_SS 34
+#define GAME_PANEL_TIME_ANIM 35
+#define GAME_PANEL_HEALTH 36
+#define GAME_PANEL_HEALTH_ANIM 37
+#define GAME_PANEL_FRAME 38
+#define GAME_PANEL_SHIELD_NORMAL 39
+#define GAME_PANEL_SHIELD_NORMAL_TIME 40
+#define GAME_PANEL_SHIELD_DEADLY 41
+#define GAME_PANEL_SHIELD_DEADLY_TIME 42
+#define GAME_PANEL_EXIT 43
+#define GAME_PANEL_EMC_MAGIC_BALL 44
+#define GAME_PANEL_EMC_MAGIC_BALL_SWITCH 45
+#define GAME_PANEL_LIGHT_SWITCH 46
+#define GAME_PANEL_LIGHT_SWITCH_TIME 47
+#define GAME_PANEL_TIMEGATE_SWITCH 48
+#define GAME_PANEL_TIMEGATE_SWITCH_TIME 49
+#define GAME_PANEL_SWITCHGATE_SWITCH 50
+#define GAME_PANEL_EMC_LENSES 51
+#define GAME_PANEL_EMC_LENSES_TIME 52
+#define GAME_PANEL_EMC_MAGNIFIER 53
+#define GAME_PANEL_EMC_MAGNIFIER_TIME 54
+#define GAME_PANEL_BALLOON_SWITCH 55
+#define GAME_PANEL_DYNABOMB_NUMBER 56
+#define GAME_PANEL_DYNABOMB_SIZE 57
+#define GAME_PANEL_DYNABOMB_POWER 58
+#define GAME_PANEL_PENGUINS 59
+#define GAME_PANEL_SOKOBAN_OBJECTS 60
+#define GAME_PANEL_SOKOBAN_FIELDS 61
+#define GAME_PANEL_ROBOT_WHEEL 62
+#define GAME_PANEL_CONVEYOR_BELT_1 63
+#define GAME_PANEL_CONVEYOR_BELT_2 64
+#define GAME_PANEL_CONVEYOR_BELT_3 65
+#define GAME_PANEL_CONVEYOR_BELT_4 66
+#define GAME_PANEL_CONVEYOR_BELT_1_SWITCH 67
+#define GAME_PANEL_CONVEYOR_BELT_2_SWITCH 68
+#define GAME_PANEL_CONVEYOR_BELT_3_SWITCH 69
+#define GAME_PANEL_CONVEYOR_BELT_4_SWITCH 70
+#define GAME_PANEL_MAGIC_WALL 71
+#define GAME_PANEL_MAGIC_WALL_TIME 72
+#define GAME_PANEL_GRAVITY_STATE 73
+#define GAME_PANEL_GRAPHIC_1 74
+#define GAME_PANEL_GRAPHIC_2 75
+#define GAME_PANEL_GRAPHIC_3 76
+#define GAME_PANEL_GRAPHIC_4 77
+#define GAME_PANEL_GRAPHIC_5 78
+#define GAME_PANEL_GRAPHIC_6 79
+#define GAME_PANEL_GRAPHIC_7 80
+#define GAME_PANEL_GRAPHIC_8 81
+#define GAME_PANEL_ELEMENT_1 82
+#define GAME_PANEL_ELEMENT_2 83
+#define GAME_PANEL_ELEMENT_3 84
+#define GAME_PANEL_ELEMENT_4 85
+#define GAME_PANEL_ELEMENT_5 86
+#define GAME_PANEL_ELEMENT_6 87
+#define GAME_PANEL_ELEMENT_7 88
+#define GAME_PANEL_ELEMENT_8 89
+#define GAME_PANEL_ELEMENT_COUNT_1 90
+#define GAME_PANEL_ELEMENT_COUNT_2 91
+#define GAME_PANEL_ELEMENT_COUNT_3 92
+#define GAME_PANEL_ELEMENT_COUNT_4 93
+#define GAME_PANEL_ELEMENT_COUNT_5 94
+#define GAME_PANEL_ELEMENT_COUNT_6 95
+#define GAME_PANEL_ELEMENT_COUNT_7 96
+#define GAME_PANEL_ELEMENT_COUNT_8 97
+#define GAME_PANEL_CE_SCORE_1 98
+#define GAME_PANEL_CE_SCORE_2 99
+#define GAME_PANEL_CE_SCORE_3 100
+#define GAME_PANEL_CE_SCORE_4 101
+#define GAME_PANEL_CE_SCORE_5 102
+#define GAME_PANEL_CE_SCORE_6 103
+#define GAME_PANEL_CE_SCORE_7 104
+#define GAME_PANEL_CE_SCORE_8 105
+#define GAME_PANEL_CE_SCORE_1_ELEMENT 106
+#define GAME_PANEL_CE_SCORE_2_ELEMENT 107
+#define GAME_PANEL_CE_SCORE_3_ELEMENT 108
+#define GAME_PANEL_CE_SCORE_4_ELEMENT 109
+#define GAME_PANEL_CE_SCORE_5_ELEMENT 110
+#define GAME_PANEL_CE_SCORE_6_ELEMENT 111
+#define GAME_PANEL_CE_SCORE_7_ELEMENT 112
+#define GAME_PANEL_CE_SCORE_8_ELEMENT 113
+#define GAME_PANEL_PLAYER_NAME 114
+#define GAME_PANEL_LEVEL_NAME 115
+#define GAME_PANEL_LEVEL_AUTHOR 116
+
+#define NUM_GAME_PANEL_CONTROLS 117
+
+struct GamePanelOrderInfo
+{
+ int nr;
+ int sort_priority;
+};
+
+static struct GamePanelOrderInfo game_panel_order[NUM_GAME_PANEL_CONTROLS];
+
+struct GamePanelControlInfo
+{
+ int nr;
+
+ struct TextPosInfo *pos;
+ int type;
+
+ int graphic, graphic_active;
+
+ int value, last_value;
+ int frame, last_frame;
+ int gfx_frame;
+ int gfx_random;
+};
+
+static struct GamePanelControlInfo game_panel_controls[] =
+{
+ {
+ GAME_PANEL_LEVEL_NUMBER,
+ &game.panel.level_number,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_GEMS,
+ &game.panel.gems,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_INVENTORY_COUNT,
+ &game.panel.inventory_count,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_1,
+ &game.panel.inventory_first[0],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_2,
+ &game.panel.inventory_first[1],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_3,
+ &game.panel.inventory_first[2],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_4,
+ &game.panel.inventory_first[3],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_5,
+ &game.panel.inventory_first[4],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_6,
+ &game.panel.inventory_first[5],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_7,
+ &game.panel.inventory_first[6],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_FIRST_8,
+ &game.panel.inventory_first[7],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_1,
+ &game.panel.inventory_last[0],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_2,
+ &game.panel.inventory_last[1],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_3,
+ &game.panel.inventory_last[2],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_4,
+ &game.panel.inventory_last[3],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_5,
+ &game.panel.inventory_last[4],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_6,
+ &game.panel.inventory_last[5],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_7,
+ &game.panel.inventory_last[6],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_INVENTORY_LAST_8,
+ &game.panel.inventory_last[7],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_1,
+ &game.panel.key[0],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_2,
+ &game.panel.key[1],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_3,
+ &game.panel.key[2],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_4,
+ &game.panel.key[3],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_5,
+ &game.panel.key[4],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_6,
+ &game.panel.key[5],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_7,
+ &game.panel.key[6],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_8,
+ &game.panel.key[7],
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_WHITE,
+ &game.panel.key_white,
+ TYPE_ELEMENT,
+ },
+ {
+ GAME_PANEL_KEY_WHITE_COUNT,
+ &game.panel.key_white_count,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_SCORE,
+ &game.panel.score,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_HIGHSCORE,
+ &game.panel.highscore,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_TIME,
+ &game.panel.time,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_TIME_HH,
+ &game.panel.time_hh,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_TIME_MM,
+ &game.panel.time_mm,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_TIME_SS,
+ &game.panel.time_ss,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_TIME_ANIM,
+ &game.panel.time_anim,
+ TYPE_GRAPHIC,
+
+ IMG_GFX_GAME_PANEL_TIME_ANIM,
+ IMG_GFX_GAME_PANEL_TIME_ANIM_ACTIVE
+ },
+ {
+ GAME_PANEL_HEALTH,
+ &game.panel.health,
+ TYPE_INTEGER,
+ },
+ {
+ GAME_PANEL_HEALTH_ANIM,
+ &game.panel.health_anim,
+ TYPE_GRAPHIC,