#include "network.h"
#include "netserv.h"
#include "cartoons.h"
-#include "config.h"
#include "conf_e2g.c" /* include auto-generated data structure definitions */
#include "conf_esg.c" /* include auto-generated data structure definitions */
int font_bitmap_id = font_info[i].special_bitmap_id[j];
int graphic = font_info[i].special_graphic[j];
+ /* set 'graphic_info' for font entries, if uninitialized (guessed) */
+ if (graphic_info[graphic].anim_frames < MIN_NUM_CHARS_PER_FONT)
+ {
+ graphic_info[graphic].anim_frames = DEFAULT_NUM_CHARS_PER_FONT;
+ graphic_info[graphic].anim_frames_per_line= DEFAULT_NUM_CHARS_PER_LINE;
+ }
+
/* copy font relevant information from graphics information */
font_bitmap_info[font_bitmap_id].bitmap = graphic_info[graphic].bitmap;
font_bitmap_info[font_bitmap_id].src_x = graphic_info[graphic].src_x;
font_bitmap_info[font_bitmap_id].height = graphic_info[graphic].height;
font_bitmap_info[font_bitmap_id].draw_x = graphic_info[graphic].draw_x;
font_bitmap_info[font_bitmap_id].draw_y = graphic_info[graphic].draw_y;
+
+ font_bitmap_info[font_bitmap_id].num_chars =
+ graphic_info[graphic].anim_frames;
+ font_bitmap_info[font_bitmap_id].num_chars_per_line =
+ graphic_info[graphic].anim_frames_per_line;
}
}
int direction = element_to_graphic[i].direction;
int graphic = element_to_graphic[i].graphic;
+ if (graphic_info[graphic].bitmap == NULL)
+ continue;
+
if (action < 0)
action = ACTION_DEFAULT;
int special = property_mapping[i].ext3_index;
int graphic = property_mapping[i].artwork_index;
+ if (graphic_info[graphic].bitmap == NULL)
+ continue;
+
if (element >= MAX_NUM_ELEMENTS || special != -1)
continue;
for (act=0; act<NUM_ACTIONS; act++)
{
+ boolean act_empty = (act == ACTION_DIGGING ||
+ act == ACTION_SNAPPING ||
+ act == ACTION_COLLECTING);
+
for (dir=0; dir<NUM_DIRECTIONS; dir++)
{
int default_direction_graphic = element_info[i].graphic[act];
/* no graphic for current action -- use default direction graphic */
if (default_direction_graphic == -1)
- default_direction_graphic = default_action_direction_graphic[dir];
+ default_direction_graphic =
+ (act_empty ? IMG_EMPTY : default_action_direction_graphic[dir]);
if (element_info[i].direction_graphic[act][dir] == -1)
element_info[i].direction_graphic[act][dir] =
/* no graphic for this specific action -- use default action graphic */
if (element_info[i].graphic[act] == -1)
- element_info[i].graphic[act] = default_action_graphic;
+ element_info[i].graphic[act] =
+ (act_empty ? IMG_EMPTY : default_action_graphic);
}
}
static void set_graphic_parameters(int graphic, char **parameter_raw)
{
Bitmap *src_bitmap = getBitmapFromImageID(graphic);
- int num_xtiles = (src_bitmap ? src_bitmap->width : TILEX) / TILEX;
- int num_ytiles = (src_bitmap ? src_bitmap->height * 2 / 3 : TILEY) / TILEY;
int parameter[NUM_GFX_ARGS];
+ int anim_frames_per_row = 1, anim_frames_per_col = 1;
+ int anim_frames_per_line = 1;
int i;
/* get integer values from string parameters */
if (parameter[GFX_ARG_HEIGHT] != ARG_UNDEFINED_VALUE)
graphic_info[graphic].height = parameter[GFX_ARG_HEIGHT];
+ if (src_bitmap)
+ {
+ anim_frames_per_row = src_bitmap->width / graphic_info[graphic].width;
+ anim_frames_per_col = src_bitmap->height / graphic_info[graphic].height;
+ }
+
/* correct x or y offset dependant of vertical or horizontal frame order */
if (parameter[GFX_ARG_VERTICAL]) /* frames are ordered vertically */
{
- if (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE)
- graphic_info[graphic].offset_y = parameter[GFX_ARG_OFFSET];
- else
- graphic_info[graphic].offset_y = graphic_info[graphic].height;
+ graphic_info[graphic].offset_y =
+ (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE ?
+ parameter[GFX_ARG_OFFSET] : graphic_info[graphic].height);
+ anim_frames_per_line = anim_frames_per_col;
}
else /* frames are ordered horizontally */
{
- if (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE)
- graphic_info[graphic].offset_x = parameter[GFX_ARG_OFFSET];
- else
- graphic_info[graphic].offset_x = graphic_info[graphic].width;
+ graphic_info[graphic].offset_x =
+ (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE ?
+ parameter[GFX_ARG_OFFSET] : graphic_info[graphic].width);
+ anim_frames_per_line = anim_frames_per_row;
}
/* optionally, the x and y offset of frames can be specified directly */
if (parameter[GFX_ARG_FRAMES] != ARG_UNDEFINED_VALUE)
graphic_info[graphic].anim_frames = parameter[GFX_ARG_FRAMES];
else if (parameter[GFX_ARG_XPOS] == 0 && !parameter[GFX_ARG_VERTICAL])
- graphic_info[graphic].anim_frames = num_xtiles;
+ graphic_info[graphic].anim_frames = anim_frames_per_row;
else if (parameter[GFX_ARG_YPOS] == 0 && parameter[GFX_ARG_VERTICAL])
- graphic_info[graphic].anim_frames = num_ytiles;
+ graphic_info[graphic].anim_frames = anim_frames_per_col;
else
graphic_info[graphic].anim_frames = 1;
+ graphic_info[graphic].anim_frames_per_line =
+ (parameter[GFX_ARG_FRAMES_PER_LINE] != ARG_UNDEFINED_VALUE ?
+ parameter[GFX_ARG_FRAMES_PER_LINE] : anim_frames_per_line);
+
graphic_info[graphic].anim_delay = parameter[GFX_ARG_DELAY];
if (graphic_info[graphic].anim_delay == 0) /* delay must be at least 1 */
graphic_info[graphic].anim_delay = 1;
- if (parameter[GFX_ARG_ANIM_MODE] != ANIM_NONE)
- graphic_info[graphic].anim_mode = parameter[GFX_ARG_ANIM_MODE];
- else if (graphic_info[graphic].anim_frames > 1)
- graphic_info[graphic].anim_mode = ANIM_LOOP;
+ graphic_info[graphic].anim_mode = parameter[GFX_ARG_ANIM_MODE];
+ if (graphic_info[graphic].anim_frames == 1)
+ graphic_info[graphic].anim_mode = ANIM_NONE;
/* automatically determine correct start frame, if not defined */
if (parameter[GFX_ARG_START_FRAME] == ARG_UNDEFINED_VALUE)
static void ReinitializeGraphics()
{
+ InitGraphicInfo(); /* graphic properties mapping */
InitElementGraphicInfo(); /* element game graphic mapping */
InitElementSpecialGraphicInfo(); /* element special graphic mapping */
- InitGraphicInfo(); /* graphic properties mapping */
InitElementSmallImages(); /* create editor and preview images */
InitFontGraphicInfo(); /* initialize text drawing functions */
static void ReinitializeSounds()
{
- InitElementSoundInfo(); /* element game sound mapping */
InitSoundInfo(); /* sound properties mapping */
+ InitElementSoundInfo(); /* element game sound mapping */
#if 1
InitElementSoundInfo(); /* element game sound mapping */
};
static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube);
+ static int ep_em_slippery_wall[] =
+ {
+ };
+ static int ep_em_slippery_wall_num = SIZEOF_ARRAY_INT(ep_em_slippery_wall);
+
+ static int ep_can_be_crumbled[] =
+ {
+ EL_SAND,
+ EL_LANDMINE,
+ EL_TRAP,
+ EL_TRAP_ACTIVE
+ };
+ static int ep_can_be_crumbled_num = SIZEOF_ARRAY_INT(ep_can_be_crumbled);
+
static long ep1_bit[] =
{
EP_BIT_AMOEBALIVE,
EP_BIT_BELT,
EP_BIT_BELT_ACTIVE,
EP_BIT_BELT_SWITCH,
- EP_BIT_TUBE
+ EP_BIT_TUBE,
+ EP_BIT_EM_SLIPPERY_WALL,
+ EP_BIT_CAN_BE_CRUMBLED
};
static int *ep1_array[] =
{
ep_belt,
ep_belt_active,
ep_belt_switch,
- ep_tube
+ ep_tube,
+ ep_em_slippery_wall,
+ ep_can_be_crumbled
};
static int *ep1_num[] =
{
&ep_belt_num,
&ep_belt_active_num,
&ep_belt_switch_num,
- &ep_tube_num
+ &ep_tube_num,
+ &ep_em_slippery_wall_num,
+ &ep_can_be_crumbled_num
};
static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *);
static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *);
}
}
+ for (j=0; j < NUM_INITIAL_FONTS; j++)
+ {
+ font_initial[j].num_chars = DEFAULT_NUM_CHARS_PER_FONT;
+ font_initial[j].num_chars_per_line = DEFAULT_NUM_CHARS_PER_LINE;
+ }
+
if (filename_font_initial == NULL) /* should not happen */
Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL);
+ /* create additional image buffers for double-buffering */
+ bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
+ bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
+
/* initialize screen properties */
InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
- REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+ REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
+ bitmap_db_field);
InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
- /* create additional image buffers for double-buffering */
- bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
- bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
-
bitmap_font_initial = LoadCustomImage(filename_font_initial);
for (j=0; j < NUM_INITIAL_FONTS; j++)
exit(0); /* never reached */
}
- InitProgramInfo(UNIX_USERDATA_DIRECTORY,
- PROGRAM_TITLE_STRING, getWindowTitleString(),
- ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
- MSDOS_POINTER_FILENAME,
- COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
-
InitSetup();
InitPlayerInfo();