From: Holger Schemel Date: Tue, 4 Mar 2014 00:20:59 +0000 (+0100) Subject: rnd-20140304-1-src X-Git-Tag: 4.0.0.0-rc1~386 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=769c024e3cbfa77b7214bb91358fd14bb02deba9;p=rocksndiamonds.git rnd-20140304-1-src * added compatibility code for existing request door animation settings --- diff --git a/ChangeLog b/ChangeLog index fd98ab0d..0619522e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2014-03-03 + * added compatibility code for existing request door animation settings + 2014-03-01 * added ultra-generic, ultra-flexible request door animation handling diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 317c11bd..d503d1b8 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5390,28 +5390,6 @@ struct ConfigInfo image_config[] = { "door_2.gfx.part_7", UNDEFINED_FILENAME }, { "door_2.gfx.part_8", UNDEFINED_FILENAME }, - { "door_1.wing_left", "RocksDoor.png" }, - { "door_1.wing_left.x", "0" }, - { "door_1.wing_left.y", "0" }, - { "door_1.wing_left.width", "100" }, - { "door_1.wing_left.height", "280" }, - { "door_1.wing_right", "RocksDoor.png" }, - { "door_1.wing_right.x", "100" }, - { "door_1.wing_right.y", "0" }, - { "door_1.wing_right.width", "100" }, - { "door_1.wing_right.height", "280" }, - - { "door_2.wing_left", "RocksDoor.png" }, - { "door_2.wing_left.x", "0" }, - { "door_2.wing_left.y", "280" }, - { "door_2.wing_left.width", "100" }, - { "door_2.wing_left.height", "100" }, - { "door_2.wing_right", "RocksDoor.png" }, - { "door_2.wing_right.x", "100" }, - { "door_2.wing_right.y", "280" }, - { "door_2.wing_right.width", "100" }, - { "door_2.wing_right.height", "100" }, - { "door_2.top_border_correction", "RocksDoor.png" }, { "door_2.top_border_correction.x", "600" }, { "door_2.top_border_correction.y", "0" }, @@ -5972,7 +5950,7 @@ struct ConfigInfo image_config[] = { "door_1.part_1.y", "0" }, { "door_1.part_1.step_xoffset", "3" }, { "door_1.part_1.step_yoffset", "1" }, - { "door_1.part_1.step_delay", "20" }, + { "door_1.part_1.step_delay", "10" }, { "door_1.part_1.start_step", "0" }, { "door_1.part_1.start_step_opening", "0" }, { "door_1.part_1.start_step_closing", "0" }, @@ -5982,7 +5960,7 @@ struct ConfigInfo image_config[] = { "door_1.part_2.y", "77" }, { "door_1.part_2.step_xoffset", "3" }, { "door_1.part_2.step_yoffset", "1" }, - { "door_1.part_2.step_delay", "20" }, + { "door_1.part_2.step_delay", "10" }, { "door_1.part_2.start_step", "0" }, { "door_1.part_2.start_step_opening", "0" }, { "door_1.part_2.start_step_closing", "0" }, @@ -5992,7 +5970,7 @@ struct ConfigInfo image_config[] = { "door_1.part_3.y", "140" }, { "door_1.part_3.step_xoffset", "3" }, { "door_1.part_3.step_yoffset", "1" }, - { "door_1.part_3.step_delay", "20" }, + { "door_1.part_3.step_delay", "10" }, { "door_1.part_3.start_step", "0" }, { "door_1.part_3.start_step_opening", "0" }, { "door_1.part_3.start_step_closing", "0" }, @@ -6002,7 +5980,7 @@ struct ConfigInfo image_config[] = { "door_1.part_4.y", "203" }, { "door_1.part_4.step_xoffset", "3" }, { "door_1.part_4.step_yoffset", "1" }, - { "door_1.part_4.step_delay", "20" }, + { "door_1.part_4.step_delay", "10" }, { "door_1.part_4.start_step", "0" }, { "door_1.part_4.start_step_opening", "0" }, { "door_1.part_4.start_step_closing", "0" }, @@ -6012,7 +5990,7 @@ struct ConfigInfo image_config[] = { "door_1.part_5.y", "0" }, { "door_1.part_5.step_xoffset", "-3" }, { "door_1.part_5.step_yoffset", "-1" }, - { "door_1.part_5.step_delay", "20" }, + { "door_1.part_5.step_delay", "10" }, { "door_1.part_5.start_step", "0" }, { "door_1.part_5.start_step_opening", "0" }, { "door_1.part_5.start_step_closing", "0" }, @@ -6022,7 +6000,7 @@ struct ConfigInfo image_config[] = { "door_1.part_6.y", "77" }, { "door_1.part_6.step_xoffset", "-3" }, { "door_1.part_6.step_yoffset", "-1" }, - { "door_1.part_6.step_delay", "20" }, + { "door_1.part_6.step_delay", "10" }, { "door_1.part_6.start_step", "0" }, { "door_1.part_6.start_step_opening", "0" }, { "door_1.part_6.start_step_closing", "0" }, @@ -6032,7 +6010,7 @@ struct ConfigInfo image_config[] = { "door_1.part_7.y", "140" }, { "door_1.part_7.step_xoffset", "-3" }, { "door_1.part_7.step_yoffset", "-1" }, - { "door_1.part_7.step_delay", "20" }, + { "door_1.part_7.step_delay", "10" }, { "door_1.part_7.start_step", "0" }, { "door_1.part_7.start_step_opening", "0" }, { "door_1.part_7.start_step_closing", "0" }, @@ -6042,7 +6020,7 @@ struct ConfigInfo image_config[] = { "door_1.part_8.y", "203" }, { "door_1.part_8.step_xoffset", "-3" }, { "door_1.part_8.step_yoffset", "-1" }, - { "door_1.part_8.step_delay", "20" }, + { "door_1.part_8.step_delay", "10" }, { "door_1.part_8.start_step", "0" }, { "door_1.part_8.start_step_opening", "0" }, { "door_1.part_8.start_step_closing", "0" }, @@ -6053,7 +6031,7 @@ struct ConfigInfo image_config[] = { "door_2.part_1.y", "0" }, { "door_2.part_1.step_xoffset", "3" }, { "door_2.part_1.step_yoffset", "1" }, - { "door_2.part_1.step_delay", "20" }, + { "door_2.part_1.step_delay", "10" }, { "door_2.part_1.start_step", "0" }, { "door_2.part_1.start_step_opening", "0" }, { "door_2.part_1.start_step_closing", "0" }, @@ -6063,7 +6041,7 @@ struct ConfigInfo image_config[] = { "door_2.part_2.y", "50" }, { "door_2.part_2.step_xoffset", "3" }, { "door_2.part_2.step_yoffset", "1" }, - { "door_2.part_2.step_delay", "20" }, + { "door_2.part_2.step_delay", "10" }, { "door_2.part_2.start_step", "0" }, { "door_2.part_2.start_step_opening", "0" }, { "door_2.part_2.start_step_closing", "0" }, @@ -6073,7 +6051,7 @@ struct ConfigInfo image_config[] = { "door_2.part_3.y", "0" }, { "door_2.part_3.step_xoffset", "-3" }, { "door_2.part_3.step_yoffset", "-1" }, - { "door_2.part_3.step_delay", "20" }, + { "door_2.part_3.step_delay", "10" }, { "door_2.part_3.start_step", "0" }, { "door_2.part_3.start_step_opening", "0" }, { "door_2.part_3.start_step_closing", "0" }, @@ -6083,7 +6061,7 @@ struct ConfigInfo image_config[] = { "door_2.part_4.y", "50" }, { "door_2.part_4.step_xoffset", "-3" }, { "door_2.part_4.step_yoffset", "-1" }, - { "door_2.part_4.step_delay", "20" }, + { "door_2.part_4.step_delay", "10" }, { "door_2.part_4.start_step", "0" }, { "door_2.part_4.start_step_opening", "0" }, { "door_2.part_4.start_step_closing", "0" }, @@ -6135,7 +6113,7 @@ struct ConfigInfo image_config[] = { "door_1.panel.step_xoffset", "0" }, { "door_1.panel.step_yoffset", "1" }, { "door_1.panel.step_delay", "10" }, - { "door_1.panel.start_step", "212" }, + { "door_1.panel.start_step", "246" }, { "door_1.panel.start_step_opening", "0" }, { "door_1.panel.start_step_closing", "0" }, { "door_1.panel.draw_masked", "false" }, @@ -6146,7 +6124,7 @@ struct ConfigInfo image_config[] = { "door_2.panel.step_xoffset", "0" }, { "door_2.panel.step_yoffset", "1" }, { "door_2.panel.step_delay", "10" }, - { "door_2.panel.start_step", "32" }, + { "door_2.panel.start_step", "66" }, { "door_2.panel.start_step_opening", "0" }, { "door_2.panel.start_step_closing", "0" }, { "door_2.panel.draw_masked", "false" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index a2970b37..cbe2796b 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1884,13 +1884,9 @@ #define IMG_DOOR_2_GFX_PART_6 1863 #define IMG_DOOR_2_GFX_PART_7 1864 #define IMG_DOOR_2_GFX_PART_8 1865 -#define IMG_DOOR_1_WING_LEFT 1866 -#define IMG_DOOR_1_WING_RIGHT 1867 -#define IMG_DOOR_2_WING_LEFT 1868 -#define IMG_DOOR_2_WING_RIGHT 1869 -#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1870 -#define IMG_LAST_IMAGE_ENTRY_BUG 1871 +#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1866 +#define IMG_LAST_IMAGE_ENTRY_BUG 1867 -#define NUM_IMAGE_FILES 1872 +#define NUM_IMAGE_FILES 1868 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index 2154ffca..3a73b8b8 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-03-01 00:52" +#define COMPILE_DATE_STRING "2014-03-04 00:32" diff --git a/src/init.c b/src/init.c index 522b1b40..33bfb5ec 100644 --- a/src/init.c +++ b/src/init.c @@ -2003,6 +2003,10 @@ static void InitGraphicCompatibilityInfo() } #if 1 + InitGraphicCompatibilityInfo_Doors(); +#endif + +#if 0 struct { int graphic; diff --git a/src/tools.c b/src/tools.c index d7f64e0a..09592032 100644 --- a/src/tools.c +++ b/src/tools.c @@ -58,7 +58,7 @@ static struct DoorPartOrderInfo door_part_order[MAX_DOOR_PARTS]; struct DoorPartControlInfo { - int door_nr; + int door_token; int graphic; struct DoorPartPosInfo *pos; }; @@ -5326,11 +5326,166 @@ static int compareDoorPartOrderInfo(const void *object1, const void *object2) return compare_result; } +void InitGraphicCompatibilityInfo_Doors() +{ + struct + { + int door_token; + int part_1, part_8; + struct DoorInfo *door; + } + doors[] = + { + { DOOR_1, IMG_DOOR_1_GFX_PART_1, IMG_DOOR_1_GFX_PART_8, &door_1 }, + { DOOR_2, IMG_DOOR_2_GFX_PART_1, IMG_DOOR_2_GFX_PART_8, &door_2 }, + + { -1, -1, -1, NULL } + }; + struct Rect door_rect_list[] = + { + { DX, DY, DXSIZE, DYSIZE }, + { VX, VY, VXSIZE, VYSIZE } + }; + int i, j; + + for (i = 0; doors[i].door_token != -1; i++) + { + int door_token = doors[i].door_token; + int door_index = DOOR_INDEX_FROM_TOKEN(door_token); + int part_1 = doors[i].part_1; + int part_8 = doors[i].part_8; + int part_2 = part_1 + 1; + int part_3 = part_1 + 2; + struct DoorInfo *door = doors[i].door; + struct Rect *door_rect = &door_rect_list[door_index]; + boolean door_gfx_redefined = FALSE; + + /* check if any door part graphic definitions have been redefined */ + + for (j = 0; door_part_controls[j].door_token != -1; j++) + { + struct DoorPartControlInfo *dpc = &door_part_controls[j]; + struct FileInfo *fi = getImageListEntryFromImageID(dpc->graphic); + + if (dpc->door_token == door_token && fi->redefined) + door_gfx_redefined = TRUE; + } + + /* check for old-style door graphic/animation modifications */ + + if (!door_gfx_redefined) + { + if (door->anim_mode & ANIM_STATIC_PANEL) + { + door->panel.step_xoffset = 0; + door->panel.step_yoffset = 0; + } + + if (door->anim_mode & (ANIM_HORIZONTAL | ANIM_VERTICAL)) + { + struct GraphicInfo *g_part_1 = &graphic_info[part_1]; + struct GraphicInfo *g_part_2 = &graphic_info[part_2]; + int num_door_steps, num_panel_steps; + + /* remove door part graphics other than the two default wings */ + + for (j = 0; door_part_controls[j].door_token != -1; j++) + { + struct DoorPartControlInfo *dpc = &door_part_controls[j]; + struct GraphicInfo *g = &graphic_info[dpc->graphic]; + + if (dpc->graphic >= part_3 && + dpc->graphic <= part_8) + g->bitmap = NULL; + } + + /* set graphics and screen positions of the default wings */ + + g_part_1->width = door_rect->width; + g_part_1->height = door_rect->height; + g_part_2->width = door_rect->width; + g_part_2->height = door_rect->height; + g_part_2->src_x = door_rect->width; + g_part_2->src_y = g_part_1->src_y; + + door->part_2.x = door->part_1.x; + door->part_2.y = door->part_1.y; + + if (door->width != -1) + { + g_part_1->width = door->width; + g_part_2->width = door->width; + + // special treatment for graphics and screen position of right wing + g_part_2->src_x += door_rect->width - door->width; + door->part_2.x += door_rect->width - door->width; + } + + if (door->height != -1) + { + g_part_1->height = door->height; + g_part_2->height = door->height; + + // special treatment for graphics and screen position of bottom wing + g_part_2->src_y += door_rect->height - door->height; + door->part_2.y += door_rect->height - door->height; + } + + /* set animation delays for the default wings and panels */ + + door->part_1.step_delay = door->step_delay; + door->part_2.step_delay = door->step_delay; + door->panel.step_delay = door->step_delay; + + /* set animation draw order for the default wings */ + + door->part_1.sort_priority = 2; /* draw left wing over ... */ + door->part_2.sort_priority = 1; /* ... right wing */ + + /* set animation draw offset for the default wings */ + + if (door->anim_mode & ANIM_HORIZONTAL) + { + door->part_1.step_xoffset = door->step_offset; + door->part_1.step_yoffset = 0; + door->part_2.step_xoffset = door->step_offset * -1; + door->part_2.step_yoffset = 0; + + num_door_steps = g_part_1->width / door->step_offset; + } + else // ANIM_VERTICAL + { + door->part_1.step_xoffset = 0; + door->part_1.step_yoffset = door->step_offset; + door->part_2.step_xoffset = 0; + door->part_2.step_yoffset = door->step_offset * -1; + + num_door_steps = g_part_1->height / door->step_offset; + } + + /* set animation draw offset for the default panels */ + + if (door->step_offset > 1) + { + num_panel_steps = 2 * door_rect->height / door->step_offset; + door->panel.start_step = num_panel_steps - num_door_steps; + } + else + { + num_panel_steps = door_rect->height / door->step_offset; + door->panel.start_step = num_panel_steps - num_door_steps / 2; + door->panel.step_delay *= 2; + } + } + } + } +} + void InitDoors() { int i; - for (i = 0; door_part_controls[i].door_nr != -1; i++) + for (i = 0; door_part_controls[i].door_token != -1; i++) { struct DoorPartControlInfo *dpc = &door_part_controls[i]; struct DoorPartOrderInfo *dpo = &door_part_order[i]; @@ -5339,7 +5494,7 @@ void InitDoors() if (dpc->pos->start_step_opening == 0 && dpc->pos->start_step_closing == 0) { - dpc->pos->start_step_opening = dpc->pos->start_step; + // dpc->pos->start_step_opening = dpc->pos->start_step; dpc->pos->start_step_closing = dpc->pos->start_step; } @@ -5499,7 +5654,9 @@ unsigned int MoveDoor(unsigned int door_state) { boolean door_panel_drawn[NUM_DOORS]; boolean door_part_done[MAX_DOOR_PARTS]; +#if 1 boolean door_part_done_all; +#endif int num_steps[MAX_DOOR_PARTS]; int max_move_delay = 0; // delay for complete animations of all doors int max_step_delay = 0; // delay (ms) between two animation frames @@ -5511,7 +5668,7 @@ unsigned int MoveDoor(unsigned int door_state) { struct DoorPartControlInfo *dpc = &door_part_controls[i]; struct GraphicInfo *g = &graphic_info[dpc->graphic]; - int door_token = dpc->door_nr; + int door_token = dpc->door_token; door_part_done[i] = (!(door_state & door_token) || !g->bitmap); @@ -5535,7 +5692,7 @@ unsigned int MoveDoor(unsigned int door_state) struct DoorPartControlInfo *dpc = &door_part_controls[nr]; struct DoorPartPosInfo *pos = dpc->pos; struct GraphicInfo *g = &graphic_info[dpc->graphic]; - int door_token = dpc->door_nr; + int door_token = dpc->door_token; boolean is_panel = DOOR_PART_IS_PANEL(nr); int step_xoffset = ABS(pos->step_xoffset); int step_yoffset = ABS(pos->step_yoffset); @@ -5598,7 +5755,7 @@ unsigned int MoveDoor(unsigned int door_state) struct DoorPartControlInfo *dpc = &door_part_controls[nr]; struct DoorPartPosInfo *pos = dpc->pos; struct GraphicInfo *g = &graphic_info[dpc->graphic]; - int door_token = dpc->door_nr; + int door_token = dpc->door_token; int door_index = DOOR_INDEX_FROM_TOKEN(door_token); boolean is_panel = DOOR_PART_IS_PANEL(nr); struct XY *panel_pos = &panel_pos_list[door_index]; @@ -5787,13 +5944,13 @@ unsigned int MoveDoor(unsigned int door_state) current_move_delay += max_step_delay; } +#if 1 door_part_done_all = TRUE; for (i = 0; i < MAX_DOOR_PARTS; i++) - if (!door_part_done[i]) + if (!door_part_done[i] && !DOOR_PART_IS_PANEL(i)) door_part_done_all = FALSE; -#if 0 if (door_part_done_all) break; #endif diff --git a/src/tools.h b/src/tools.h index 202025fa..3d7c96ea 100644 --- a/src/tools.h +++ b/src/tools.h @@ -181,8 +181,9 @@ void DrawMiniLevel(int, int, int, int); void DrawPreviewLevelInitial(void); void DrawPreviewLevelAnimation(void); -void WaitForEventToContinue(); +void WaitForEventToContinue(void); boolean Request(char *, unsigned int); +void InitGraphicCompatibilityInfo_Doors(void); void InitDoors(void); unsigned int OpenDoor(unsigned int); unsigned int CloseDoor(unsigned int);