From 09f90416c51f96c37bf133690eb3dcdaf6dd997c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 7 Apr 2003 23:59:22 +0200 Subject: [PATCH] rnd-20030407-2-src --- CHANGES | 13 ++++++++++++- src/conftime.h | 2 +- src/editor.c | 31 +++++++++++++++++++++---------- src/files.c | 26 ++++++++++++++++++++++++++ src/init.c | 19 +++++++++++++------ src/tools.c | 12 ++++++++---- 6 files changed, 81 insertions(+), 22 deletions(-) diff --git a/CHANGES b/CHANGES index 01355225..3692cfdc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,16 @@ -Pre-Release Version 2.2.0rc3 [?? ??? ????] +Pre-Release Version 2.2.0rc4 [?? ??? ????] ------------------------------------------ + - added generic selectbox gadget + - added special mouse cursor for playfield while playing + - font handling now more flexible (support for ISO-Latin-1 fonts) + +Pre-Release Version 2.2.0rc3 [11 FEB 2003] +------------------------------------------ + - first custom element properties + - animation configuration for dynamically defined element actions + - automatically downscaled graphics (small graphics not needed anymore) + - ".EDITOR" and ".PREVIEW" suffixes for special editor/preview graphics + - toon animations (and number of toons) now fully configurable Pre-Release Version 2.2.0rc2 [13 JAN 2003] ------------------------------------------ diff --git a/src/conftime.h b/src/conftime.h index de44c3ea..2d881d35 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-04-07 00:31]" +#define COMPILE_DATE_STRING "[2003-04-07 23:42]" diff --git a/src/editor.c b/src/editor.c index f04834c0..5d931bd1 100644 --- a/src/editor.c +++ b/src/editor.c @@ -95,8 +95,11 @@ #define ED_COUNTER_YDISTANCE (3 * MINI_TILEY) #define ED_COUNTER_YPOS(n) (ED_COUNTER_YSTART + \ n * ED_COUNTER_YDISTANCE) +#define ED_COUNTER_YPOS2(n) (ED_COUNTER_YSTART + \ + n * ED_COUNTER_YDISTANCE / 2) #define ED_COUNTER2_YPOS(n) (ED_COUNTER_YSTART + \ n * ED_COUNTER_YDISTANCE - 2) + /* standard distances */ #define ED_BORDER_SIZE 3 #define ED_GADGET_DISTANCE 2 @@ -744,31 +747,31 @@ static struct "slip down from certain flat walls","use EM style slipping behaviour" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS(4), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(10), GADGET_ID_CUSTOM_INDESTRUCTIBLE, &custom_element_properties[0].indestructible, "indestructible", "element cannot be destroyed" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS(5), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(11), GADGET_ID_CUSTOM_CAN_FALL, &custom_element_properties[0].can_fall, "can fall", "element can fall down" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS(6), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(12), GADGET_ID_CUSTOM_CAN_SMASH, &custom_element_properties[0].can_smash, "can smash", "element can smash other elements" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS(7), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(13), GADGET_ID_CUSTOM_PUSHABLE, &custom_element_properties[0].pushable, "pushable", "element can be pushed" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS(8), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(14), GADGET_ID_CUSTOM_SLIPPERY, &custom_element_properties[0].slippery, "slippery", "other elements can fall down from it" @@ -3227,7 +3230,8 @@ static void DrawPropertiesWindow() } } - if (HAS_CONTENT(properties_element)) + if (HAS_CONTENT(properties_element) || + IS_CUSTOM_ELEMENT(properties_element)) { /* draw stickybutton gadget */ i = ED_CHECKBUTTON_ID_STICK_ELEMENT; @@ -3239,10 +3243,13 @@ static void DrawPropertiesWindow() GDI_CHECKED, *checkbutton_info[i].value, GDI_END); MapCheckbuttonGadget(i); - if (IS_AMOEBOID(properties_element)) - DrawAmoebaContentArea(); - else - DrawElementContentAreas(); + if (HAS_CONTENT(properties_element)) + { + if (IS_AMOEBOID(properties_element)) + DrawAmoebaContentArea(); + else + DrawElementContentAreas(); + } } if (IS_GEM(properties_element)) @@ -4555,8 +4562,12 @@ static void HandleControlButtons(struct GadgetInfo *gi) PickDrawingElement(button, new_element); +#if 1 + if (!stick_element_properties_window) +#else if (!HAS_CONTENT(properties_element) || !stick_element_properties_window) +#endif { properties_element = new_element; if (edit_mode == ED_MODE_PROPERTIES) diff --git a/src/files.c b/src/files.c index 15264d2d..588d9404 100644 --- a/src/files.c +++ b/src/files.c @@ -515,6 +515,32 @@ void LoadLevelFromFilename(char *filename) level.em_slippery_gems = TRUE; } + /* map some elements which have changed in newer versions */ + if (level.game_version <= VERSION_IDENT(2,2,0)) + { + int x, y; + + /* map game font elements */ + for(y=0; ywidth / graphic_info[graphic].width; - num_ytiles = src_bitmap->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; } /* correct x or y offset dependant of vertical or horizontal frame order */ if (parameter[GFX_ARG_VERTICAL]) /* frames are ordered vertically */ + { 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 */ + { 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_XOFFSET] != ARG_UNDEFINED_VALUE) @@ -639,15 +646,15 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) 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] : graphic_info[graphic].anim_frames); + 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 */ diff --git a/src/tools.c b/src/tools.c index b29cb819..8582ac84 100644 --- a/src/tools.c +++ b/src/tools.c @@ -779,13 +779,17 @@ void getGraphicSource(int graphic, int frame, Bitmap **bitmap, int *x, int *y) if (g->offset_y == 0) /* frames are ordered horizontally */ { - *x = g->src_x + (frame % g->anim_frames_per_line) * g->offset_x; - *y = g->src_y + (frame / g->anim_frames_per_line) * g->height; + int max_width = g->anim_frames_per_line * g->width; + + *x = (g->src_x + frame * g->offset_x) % max_width; + *y = g->src_y + (g->src_x + frame * g->offset_x) / max_width * g->height; } else if (g->offset_x == 0) /* frames are ordered vertically */ { - *x = g->src_x + (frame / g->anim_frames_per_line) * g->width; - *y = g->src_y + (frame % g->anim_frames_per_line) * g->offset_y; + int max_height = g->anim_frames_per_line * g->height; + + *x = g->src_x + (g->src_y + frame * g->offset_y) / max_height * g->width; + *y = (g->src_y + frame * g->offset_y) % max_height; } else /* frames are ordered diagonally */ { -- 2.34.1