{ ".post_delay_random", ARG_UNDEFINED, TYPE_INTEGER },
{ ".name", ARG_UNDEFINED, TYPE_STRING },
{ ".scale_up_factor", ARG_UNDEFINED, TYPE_INTEGER },
+ { ".clone_from", ARG_UNDEFINED, TYPE_TOKEN },
{ NULL, NULL, 0 }
};
{ "menu.button_down.active.ypos", "9" },
{ "menu.button_down.active.frames", "1" },
- { "menu.button_enter_menu", "RocksDC.pcx" },
- { "menu.button_enter_menu.xpos", "9" },
- { "menu.button_enter_menu.ypos", "8" },
- { "menu.button_enter_menu.frames", "1" },
- { "menu.button_enter_menu.active", "RocksDC.pcx" },
- { "menu.button_enter_menu.active.xpos", "9" },
- { "menu.button_enter_menu.active.ypos", "9" },
- { "menu.button_enter_menu.active.frames", "1" },
+ { "menu.button_enter_menu2", "RocksDC.pcx" },
+ { "menu.button_enter_menu2.xpos", "9" },
+ { "menu.button_enter_menu2.ypos", "8" },
+ { "menu.button_enter_menu2.frames", "1" },
+ { "menu.button_enter_menu2.active", "RocksDC.pcx" },
+ { "menu.button_enter_menu2.active.xpos", "9" },
+ { "menu.button_enter_menu2.active.ypos", "9" },
+ { "menu.button_enter_menu2.active.frames", "1" },
{ "menu.button_leave_menu", "RocksDC.pcx" },
{ "menu.button_leave_menu.xpos", "8" },
{ "menu.button_leave_menu.ypos", "8" },
{ "menu.button_leave_menu.active.ypos", "9" },
{ "menu.button_leave_menu.active.frames", "1" },
+ { "menu.button_enter_menu", UNDEFINED_FILENAME },
+ { "menu.button_enter_menu.clone_from", "menu.button_right" },
+ { "menu.button_enter_menu.active", UNDEFINED_FILENAME },
+ { "menu.button_enter_menu.active.clone_from", "menu.button_right.active"},
+
{ "menu.scrollbar", "RocksDC.pcx" },
{ "menu.scrollbar.xpos", "8" },
{ "menu.scrollbar.ypos", "10" },
#define IMG_MENU_BUTTON_UP_ACTIVE 1410
#define IMG_MENU_BUTTON_DOWN 1411
#define IMG_MENU_BUTTON_DOWN_ACTIVE 1412
-#define IMG_MENU_BUTTON_ENTER_MENU 1413
-#define IMG_MENU_BUTTON_ENTER_MENU_ACTIVE 1414
+#define IMG_MENU_BUTTON_ENTER_MENU2 1413
+#define IMG_MENU_BUTTON_ENTER_MENU2_ACTIVE 1414
#define IMG_MENU_BUTTON_LEAVE_MENU 1415
#define IMG_MENU_BUTTON_LEAVE_MENU_ACTIVE 1416
-#define IMG_MENU_SCROLLBAR 1417
-#define IMG_MENU_SCROLLBAR_ACTIVE 1418
-#define IMG_FONT_INITIAL_1 1419
-#define IMG_FONT_INITIAL_2 1420
-#define IMG_FONT_INITIAL_3 1421
-#define IMG_FONT_INITIAL_4 1422
-#define IMG_FONT_TITLE_1 1423
-#define IMG_FONT_TITLE_1_LEVELS 1424
-#define IMG_FONT_TITLE_2 1425
-#define IMG_FONT_MENU_1 1426
-#define IMG_FONT_MENU_2 1427
-#define IMG_FONT_TEXT_1 1428
-#define IMG_FONT_TEXT_1_LEVELS 1429
-#define IMG_FONT_TEXT_1_PREVIEW 1430
-#define IMG_FONT_TEXT_1_SCORES 1431
-#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1432
-#define IMG_FONT_TEXT_2 1433
-#define IMG_FONT_TEXT_2_LEVELS 1434
-#define IMG_FONT_TEXT_2_PREVIEW 1435
-#define IMG_FONT_TEXT_2_SCORES 1436
-#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1437
-#define IMG_FONT_TEXT_3 1438
-#define IMG_FONT_TEXT_3_LEVELS 1439
-#define IMG_FONT_TEXT_3_PREVIEW 1440
-#define IMG_FONT_TEXT_3_SCORES 1441
-#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1442
-#define IMG_FONT_TEXT_4 1443
-#define IMG_FONT_TEXT_4_LEVELS 1444
-#define IMG_FONT_TEXT_4_SCORES 1445
-#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1446
-#define IMG_FONT_ENVELOPE_1 1447
-#define IMG_FONT_ENVELOPE_2 1448
-#define IMG_FONT_ENVELOPE_3 1449
-#define IMG_FONT_ENVELOPE_4 1450
-#define IMG_FONT_INPUT_1 1451
-#define IMG_FONT_INPUT_1_MAIN 1452
-#define IMG_FONT_INPUT_1_ACTIVE 1453
-#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1454
-#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1455
-#define IMG_FONT_INPUT_2 1456
-#define IMG_FONT_INPUT_2_ACTIVE 1457
-#define IMG_FONT_OPTION_OFF 1458
-#define IMG_FONT_OPTION_ON 1459
-#define IMG_FONT_VALUE_1 1460
-#define IMG_FONT_VALUE_2 1461
-#define IMG_FONT_VALUE_OLD 1462
-#define IMG_FONT_LEVEL_NUMBER 1463
-#define IMG_FONT_TAPE_RECORDER 1464
-#define IMG_FONT_GAME_INFO 1465
-#define IMG_GLOBAL_BORDER 1466
-#define IMG_GLOBAL_DOOR 1467
-#define IMG_EDITOR_ELEMENT_BORDER 1468
-#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1469
-#define IMG_BACKGROUND_ENVELOPE_1 1470
-#define IMG_BACKGROUND_ENVELOPE_2 1471
-#define IMG_BACKGROUND_ENVELOPE_3 1472
-#define IMG_BACKGROUND_ENVELOPE_4 1473
-#define IMG_BACKGROUND 1474
-#define IMG_BACKGROUND_MAIN 1475
-#define IMG_BACKGROUND_LEVELS 1476
-#define IMG_BACKGROUND_SCORES 1477
-#define IMG_BACKGROUND_EDITOR 1478
-#define IMG_BACKGROUND_INFO 1479
-#define IMG_BACKGROUND_INFO_ELEMENTS 1480
-#define IMG_BACKGROUND_INFO_MUSIC 1481
-#define IMG_BACKGROUND_INFO_CREDITS 1482
-#define IMG_BACKGROUND_INFO_PROGRAM 1483
-#define IMG_BACKGROUND_INFO_LEVELSET 1484
-#define IMG_BACKGROUND_SETUP 1485
-#define IMG_BACKGROUND_DOOR 1486
+#define IMG_MENU_BUTTON_ENTER_MENU 1417
+#define IMG_MENU_BUTTON_ENTER_MENU_ACTIVE 1418
+#define IMG_MENU_SCROLLBAR 1419
+#define IMG_MENU_SCROLLBAR_ACTIVE 1420
+#define IMG_FONT_INITIAL_1 1421
+#define IMG_FONT_INITIAL_2 1422
+#define IMG_FONT_INITIAL_3 1423
+#define IMG_FONT_INITIAL_4 1424
+#define IMG_FONT_TITLE_1 1425
+#define IMG_FONT_TITLE_1_LEVELS 1426
+#define IMG_FONT_TITLE_2 1427
+#define IMG_FONT_MENU_1 1428
+#define IMG_FONT_MENU_2 1429
+#define IMG_FONT_TEXT_1 1430
+#define IMG_FONT_TEXT_1_LEVELS 1431
+#define IMG_FONT_TEXT_1_PREVIEW 1432
+#define IMG_FONT_TEXT_1_SCORES 1433
+#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1434
+#define IMG_FONT_TEXT_2 1435
+#define IMG_FONT_TEXT_2_LEVELS 1436
+#define IMG_FONT_TEXT_2_PREVIEW 1437
+#define IMG_FONT_TEXT_2_SCORES 1438
+#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1439
+#define IMG_FONT_TEXT_3 1440
+#define IMG_FONT_TEXT_3_LEVELS 1441
+#define IMG_FONT_TEXT_3_PREVIEW 1442
+#define IMG_FONT_TEXT_3_SCORES 1443
+#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1444
+#define IMG_FONT_TEXT_4 1445
+#define IMG_FONT_TEXT_4_LEVELS 1446
+#define IMG_FONT_TEXT_4_SCORES 1447
+#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1448
+#define IMG_FONT_ENVELOPE_1 1449
+#define IMG_FONT_ENVELOPE_2 1450
+#define IMG_FONT_ENVELOPE_3 1451
+#define IMG_FONT_ENVELOPE_4 1452
+#define IMG_FONT_INPUT_1 1453
+#define IMG_FONT_INPUT_1_MAIN 1454
+#define IMG_FONT_INPUT_1_ACTIVE 1455
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1456
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1457
+#define IMG_FONT_INPUT_2 1458
+#define IMG_FONT_INPUT_2_ACTIVE 1459
+#define IMG_FONT_OPTION_OFF 1460
+#define IMG_FONT_OPTION_ON 1461
+#define IMG_FONT_VALUE_1 1462
+#define IMG_FONT_VALUE_2 1463
+#define IMG_FONT_VALUE_OLD 1464
+#define IMG_FONT_LEVEL_NUMBER 1465
+#define IMG_FONT_TAPE_RECORDER 1466
+#define IMG_FONT_GAME_INFO 1467
+#define IMG_GLOBAL_BORDER 1468
+#define IMG_GLOBAL_DOOR 1469
+#define IMG_EDITOR_ELEMENT_BORDER 1470
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1471
+#define IMG_BACKGROUND_ENVELOPE_1 1472
+#define IMG_BACKGROUND_ENVELOPE_2 1473
+#define IMG_BACKGROUND_ENVELOPE_3 1474
+#define IMG_BACKGROUND_ENVELOPE_4 1475
+#define IMG_BACKGROUND 1476
+#define IMG_BACKGROUND_MAIN 1477
+#define IMG_BACKGROUND_LEVELS 1478
+#define IMG_BACKGROUND_SCORES 1479
+#define IMG_BACKGROUND_EDITOR 1480
+#define IMG_BACKGROUND_INFO 1481
+#define IMG_BACKGROUND_INFO_ELEMENTS 1482
+#define IMG_BACKGROUND_INFO_MUSIC 1483
+#define IMG_BACKGROUND_INFO_CREDITS 1484
+#define IMG_BACKGROUND_INFO_PROGRAM 1485
+#define IMG_BACKGROUND_INFO_LEVELSET 1486
+#define IMG_BACKGROUND_SETUP 1487
+#define IMG_BACKGROUND_DOOR 1488
-#define NUM_IMAGE_FILES 1487
+#define NUM_IMAGE_FILES 1489
#endif /* CONF_GFX_H */
-#define COMPILE_DATE_STRING "[2005-12-05 23:02]"
+#define COMPILE_DATE_STRING "[2005-12-09 11:01]"
/* initialize special font/graphic mapping from static configuration */
for (i = 0; font_to_graphic[i].font_nr > -1; i++)
{
- int font_nr = font_to_graphic[i].font_nr;
- int special = font_to_graphic[i].special;
- int graphic = font_to_graphic[i].graphic;
-#if 1
- int base_graphic =
- font_info[font_nr].special_graphic[GFX_SPECIAL_ARG_DEFAULT];
-#endif
+ int font_nr = font_to_graphic[i].font_nr;
+ int special = font_to_graphic[i].special;
+ int graphic = font_to_graphic[i].graphic;
+ int base_graphic = font2baseimg(font_nr);
if (special >= 0 && special < NUM_SPECIAL_GFX_ARGS)
{
-#if 1
boolean base_redefined =
getImageListEntryFromImageID(base_graphic)->redefined;
boolean special_redefined =
anymore, but use the automatically determined default font */
if (base_redefined && !special_redefined)
continue;
-#endif
font_info[font_nr].special_graphic[special] = graphic;
font_info[font_nr].special_bitmap_id[special] = num_font_bitmaps;
static int get_element_from_token(char *token)
{
int i;
+ int x = 0;
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
if (strcmp(element_info[i].token_name, token) == 0)
return i;
+#if 1
+ for (i = 0; image_config[i].token != NULL; i++)
+ {
+ int len_config_value = strlen(image_config[i].value);
+
+ if (strcmp(&image_config[i].value[len_config_value - 4], ".pcx") != 0 &&
+ strcmp(&image_config[i].value[len_config_value - 4], ".wav") != 0 &&
+ strcmp(image_config[i].value, UNDEFINED_FILENAME) != 0)
+ continue;
+
+ if (strcmp(image_config[i].token, token) == 0)
+ return x;
+
+ x++;
+ }
+#endif
+
return -1;
}
int anim_frames_per_line = 1;
int i;
+#if 1
+ if (graphic != graphic_copy_from)
+ {
+ graphic_info[graphic] = graphic_info[graphic_copy_from];
+
+ return;
+ }
+#endif
+
/* if fallback to default artwork is done, also use the default parameters */
if (image->fallback_to_default)
parameter_raw = image->default_parameter;
graphic_info[graphic].bitmap = src_bitmap;
/* start with reliable default values */
+ graphic_info[graphic].src_image_width = 0;
+ graphic_info[graphic].src_image_height = 0;
graphic_info[graphic].src_x = 0;
graphic_info[graphic].src_y = 0;
graphic_info[graphic].width = TILEX;
graphic_info[graphic].diggable_like = -1; /* do not use clone element */
graphic_info[graphic].border_size = TILEX / 8; /* "CRUMBLED" border size */
graphic_info[graphic].scale_up_factor = 1; /* default: no scaling up */
+ graphic_info[graphic].clone_from = -1; /* do not use clone graphic */
graphic_info[graphic].anim_delay_fixed = 0;
graphic_info[graphic].anim_delay_random = 0;
graphic_info[graphic].post_delay_fixed = 0;
if (src_bitmap)
{
/* get final bitmap size (with scaling, but without small images) */
- int src_bitmap_width = get_scaled_graphic_width(graphic);
- int src_bitmap_height = get_scaled_graphic_height(graphic);
+ int src_image_width = get_scaled_graphic_width(graphic);
+ int src_image_height = get_scaled_graphic_height(graphic);
+
+ anim_frames_per_row = src_image_width / graphic_info[graphic].width;
+ anim_frames_per_col = src_image_height / graphic_info[graphic].height;
- anim_frames_per_row = src_bitmap_width / graphic_info[graphic].width;
- anim_frames_per_col = src_bitmap_height / graphic_info[graphic].height;
+ graphic_info[graphic].src_image_width = src_image_width;
+ graphic_info[graphic].src_image_height = src_image_height;
}
/* correct x or y offset dependent of vertical or horizontal frame order */
/* this is only used for drawing envelope graphics */
graphic_info[graphic].draw_masked = parameter[GFX_ARG_DRAW_MASKED];
+
+#if 1
+ /* optional graphic for cloning all graphics settings */
+ if (parameter[GFX_ARG_CLONE_FROM] != ARG_UNDEFINED_VALUE)
+ graphic_info[graphic].clone_from = parameter[GFX_ARG_CLONE_FROM];
+#else
+ /* optional graphic for cloning all graphics settings */
+ if (parameter[GFX_ARG_CLONE_FROM] != ARG_UNDEFINED_VALUE)
+ {
+ if (parameter[GFX_ARG_CLONE_FROM] != -1)
+ {
+ int clone_graphic = parameter[GFX_ARG_CLONE_FROM];
+
+ graphic_info[graphic] = graphic_info[clone_graphic];
+ graphic_info[graphic].clone_from = clone_graphic;
+
+ printf("::: %d -> %d\n", graphic, clone_graphic);
+ }
+ }
+#endif
}
static void InitGraphicInfo()
}
#endif
+#if 1
+ /* first set all graphic paramaters ... */
+ for (i = 0; i < num_images; i++)
+ {
+ set_graphic_parameters(i, i);
+ }
+
+ /* ... then copy these parameters for cloned graphics */
+ for (i = 0; i < num_images; i++)
+ {
+ if (graphic_info[i].clone_from != -1)
+ {
+ int clone_graphic = graphic_info[i].clone_from;
+
+ if (graphic_info[clone_graphic].clone_from != -1)
+ {
+ Error(ERR_RETURN_LINE, "-");
+ Error(ERR_RETURN, "warning: error found in config file:");
+ Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename());
+ Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(i));
+ Error(ERR_RETURN,
+ "error: cannot clone from already cloned graphic '%s'",
+ getTokenFromImageID(clone_graphic));
+ Error(ERR_RETURN, "custom graphic rejected for this element/action");
+
+ if (i == fallback_graphic)
+ Error(ERR_EXIT, "fatal error: no fallback graphic available");
+
+ Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic");
+ Error(ERR_RETURN_LINE, "-");
+
+ set_graphic_parameters(i, fallback_graphic);
+ }
+ else
+ {
+ graphic_info[i] = graphic_info[clone_graphic];
+ graphic_info[i].clone_from = clone_graphic;
+
+#if 0
+ printf("::: graphic %d ['%s'] is cloned from %d ['%s']\n",
+ i, getTokenFromImageID(i),
+ clone_graphic, getTokenFromImageID(clone_graphic));
+#endif
+ }
+ }
+ }
+#endif
+
for (i = 0; i < num_images; i++)
{
Bitmap *src_bitmap;
i, image->token, getTokenFromImageID(i));
#endif
+#if 0
set_graphic_parameters(i, i);
+#endif
/* now check if no animation frames are outside of the loaded image */
+#if 0
+ if (graphic_info[i].bitmap == NULL)
+ Error(ERR_WARN, "no bitmap for graphic %d ['%s']",
+ i, getTokenFromImageID(i));
+#endif
+
if (graphic_info[i].bitmap == NULL)
continue; /* skip check for optional images that are undefined */
+#if 1
+ /* get final bitmap size (with scaling, but without small images) */
+ src_bitmap_width = graphic_info[i].src_image_width;
+ src_bitmap_height = graphic_info[i].src_image_height;
+#else
/* get final bitmap size (with scaling, but without small images) */
src_bitmap_width = get_scaled_graphic_width(i);
src_bitmap_height = get_scaled_graphic_height(i);
+ if (graphic_info[i].clone_from != -1)
+ {
+ int clone_graphic = graphic_info[i].clone_from;
+
+ src_bitmap_width = get_scaled_graphic_width(clone_graphic);
+ src_bitmap_height = get_scaled_graphic_height(clone_graphic);
+ }
+#endif
+
first_frame = 0;
getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
if (src_x < 0 || src_y < 0 ||
{
Error(ERR_RETURN_LINE, "-");
Error(ERR_RETURN, "warning: error found in config file:");
- Error(ERR_RETURN, "- config file: '%s'",
- getImageConfigFilename());
- Error(ERR_RETURN, "- config token: '%s'",
- getTokenFromImageID(i));
- Error(ERR_RETURN, "- image file: '%s'",
- src_bitmap->source_filename);
+ Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename());
+ Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(i));
+ Error(ERR_RETURN, "- image file: '%s'", src_bitmap->source_filename);
Error(ERR_RETURN,
- "error: first animation frame out of bounds (%d, %d)",
- src_x, src_y);
+ "error: first animation frame out of bounds (%d, %d) [%d, %d]",
+ src_x, src_y, src_bitmap_width, src_bitmap_height);
Error(ERR_RETURN, "custom graphic rejected for this element/action");
if (i == fallback_graphic)
{
Error(ERR_RETURN_LINE, "-");
Error(ERR_RETURN, "warning: error found in config file:");
- Error(ERR_RETURN, "- config file: '%s'",
- getImageConfigFilename());
- Error(ERR_RETURN, "- config token: '%s'",
- getTokenFromImageID(i));
- Error(ERR_RETURN, "- image file: '%s'",
- src_bitmap->source_filename);
+ Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename());
+ Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(i));
+ Error(ERR_RETURN, "- image file: '%s'", src_bitmap->source_filename);
Error(ERR_RETURN,
- "error: last animation frame (%d) out of bounds (%d, %d)",
- last_frame, src_x, src_y);
+ "error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]",
+ last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height);
Error(ERR_RETURN, "custom graphic rejected for this element/action");
if (i == fallback_graphic)
#define GFX_ARG_POST_DELAY_RANDOM 35
#define GFX_ARG_NAME 36
#define GFX_ARG_SCALE_UP_FACTOR 37
+#define GFX_ARG_CLONE_FROM 38
-#define NUM_GFX_ARGS 38
+#define NUM_GFX_ARGS 39
/* values for sound configuration suffixes */
struct GraphicInfo
{
Bitmap *bitmap;
+ int src_image_width; /* scaled bitmap size, but w/o small images */
+ int src_image_height; /* scaled bitmap size, but w/o small images */
+
int src_x, src_y; /* start position of animation frames */
int width, height; /* width/height of each animation frame */
int offset_x, offset_y; /* x/y offset to next animation frame */
int diggable_like; /* element for cloning digging graphics */
int border_size; /* border size for "crumbled" graphics */
int scale_up_factor; /* optional factor for scaling image up */
+ int clone_from; /* graphic for cloning *all* settings */
int anim_delay_fixed; /* optional delay values for bored and */
int anim_delay_random; /* sleeping player animations (animation */
return element_info[element].special_graphic[GFX_SPECIAL_ARG_PREVIEW];
}
+int font2baseimg(int font_nr)
+{
+ return font_info[font_nr].special_graphic[GFX_SPECIAL_ARG_DEFAULT];
+}
+
int getGameFrameDelay_EM(int native_em_game_frame_delay)
{
int game_frame_delay_value;
int el2img(int);
int el2edimg(int);
int el2preimg(int);
+int font2baseimg(int);
unsigned int InitRND(long);
void InitGraphicInfo_EM(void);