static struct
{
int element;
+ int direction;
+ int action;
+
int graphic;
}
element_to_graphic[] =
-#define COMPILE_DATE_STRING "[2002-09-21 21:53]"
+#define COMPILE_DATE_STRING "[2002-09-21 23:08]"
#include "cartoons.h"
#include "config.h"
+#include "conf_e2g.c" /* include auto-generated data structure definitions */
+
+
static char *image_filename[NUM_PICTURES] =
{
"RocksScreen.pcx",
void InitElementInfo()
{
- int i, j;
-
+#if 0
static struct
{
int element;
-1, -1
}
};
+#endif
+
+ int i, j, k;
/* always start with reliable default values */
for(i=0; i<MAX_ELEMENTS; i++)
{
for(j=0; j<NUM_GFX_ACTIONS_MAPPED; j++)
{
- element_info[i].graphic[j] = GFX_LEERRAUM;
+ element_info[i].graphic[j] = IMG_EMPTY_SPACE;
+
+ for(k=0; k<NUM_MV_DIRECTIONS; k++)
+ element_info[i].direction_graphic[j][k] = IMG_EMPTY_SPACE;
element_info[i].has_direction_graphic[j] = FALSE;
}
}
GFX_START_ROCKSSP + nr_graphic;
}
+#if 0
/* this overrides some of the above default settings (GFX_SP_ZONK etc.) */
i = 0;
while (element_to_graphic[i].element > -1)
element_info[element].has_direction_graphic[GFX_ACTION_DEFAULT] = TRUE;
i++;
}
+#else
+ i = 0;
+ while (element_to_graphic[i].element > -1)
+ {
+ int element = element_to_graphic[i].element;
+ int direction = element_to_graphic[i].direction;
+ int action = element_to_graphic[i].action;
+ int graphic = element_to_graphic[i].graphic;
+
+ if (action > -1)
+ action = graphics_action_mapping[action];
+ else
+ action = GFX_ACTION_DEFAULT;
+
+ if (direction > -1)
+ {
+ direction = MV_DIR_BIT(direction);
+
+ element_info[element].direction_graphic[action][direction] = graphic;
+ element_info[element].has_direction_graphic[action] = TRUE;
+ }
+ else
+ element_info[element].graphic[action] = graphic;
+
+ i++;
+ }
+#endif
}
static void InitGraphicInfo()
#define MV_BIT_RIGHT 1
#define MV_BIT_UP 2
#define MV_BIT_DOWN 3
+#define NUM_MV_DIRECTIONS 4
#define MV_NO_MOVING 0
#define MV_LEFT (1 << MV_BIT_LEFT)
#define KEY_BUTTON (KEY_BUTTON_1 | KEY_BUTTON_2)
#define KEY_ACTION (KEY_MOTION | KEY_BUTTON)
-#define LOG_MV_DIR(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \
+#define MV_DIR_BIT(x) ((x) == MV_LEFT ? MV_BIT_LEFT : \
(x) == MV_RIGHT ? MV_BIT_RIGHT : \
(x) == MV_UP ? MV_BIT_UP : MV_BIT_DOWN)
};
/* this is used to reduce memory usage of the different animation types */
-int anim_action_mapping[] =
+int graphics_action_mapping[] =
{
0, /* GFX_ACTION_UNKNOWN (0) */
0, /* GFX_ACTION_DEFAULT (1) */
int graphic[NUM_GFX_ACTIONS_MAPPED];
/* special graphics for left/right/up/down */
- int direction_graphic[NUM_GFX_ACTIONS_MAPPED][4];
+ int direction_graphic[NUM_GFX_ACTIONS_MAPPED][NUM_MV_DIRECTIONS];
boolean has_direction_graphic[NUM_GFX_ACTIONS_MAPPED];
};
extern boolean network_player_action_received;
+extern int graphics_action_mapping[];
+
extern struct LevelInfo level;
extern struct PlayerInfo stored_player[], *local_player;
extern struct HiScore highscore[];
int el2gfx(int element)
{
+#if 1
+ int graphic_OLD = el2gfx_OLD(element);
+
+ return graphic_OLD;
+#else
+
int graphic_NEW = element_info[element].graphic[GFX_ACTION_DEFAULT];
#if DEBUG
#endif
return graphic_NEW;
+#endif
}
int el2img(int element)
{
+#if 1
+ int graphic_NEW = element_info[element].graphic[GFX_ACTION_DEFAULT];
+
+ return graphic_NEW;
+#else
+
switch(element)
{
case EL_BD_BUTTERFLY: return IMG_BD_BUTTERFLY;
}
return IMG_EMPTY_SPACE;
+#endif
}
int el_dir2img(int element, int direction)
{
- if (element_info[element].has_direction_graphic[GFX_ACTION_DEFAULT])
+ int action = GFX_ACTION_DEFAULT;
+
+ if (element_info[element].has_direction_graphic[action])
{
- int i = LOG_MV_DIR(direction);
+ int direction = MV_DIR_BIT(direction);
- return element_info[element].direction_graphic[GFX_ACTION_DEFAULT][i];
+ return element_info[element].direction_graphic[action][direction];
}
else
return el2img(element);
}
+
+int el_dir_act2img(int element, int direction, int action)
+{
+ if (element_info[element].has_direction_graphic[action])
+ {
+ int direction = MV_DIR_BIT(direction);
+
+ return element_info[element].direction_graphic[action][direction];
+ }
+ else
+ return el_dir2img(element, direction);
+}
int el2gfx(int);
int el2img(int);
int el_dir2img(int, int);
+int el_dir_act2img(int, int, int);
#endif /* TOOLS_H */