From 2a5c67b00174b07749ca8bef96ba3281e6839dba Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 3 May 2003 01:55:30 +0200 Subject: [PATCH 1/1] rnd-20030503-1-src --- src/conftime.h | 2 +- src/editor.c | 6 +++--- src/game.c | 21 ++++++++++++++++++--- src/libgame/misc.c | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index a1c7eb1e..d8967827 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-05-02 20:55]" +#define COMPILE_DATE_STRING "[2003-05-03 01:52]" diff --git a/src/editor.c b/src/editor.c index a726f913..4fc9d68f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -3336,7 +3336,6 @@ static void DrawCustomChangedArea() int area_y = ypos / MINI_TILEY; int area_sx = SX + xpos; int area_sy = SY + ypos; - int i = properties_element - EL_CUSTOM_START; if (!IS_CUSTOM_ELEMENT(properties_element)) { @@ -3346,7 +3345,7 @@ static void DrawCustomChangedArea() return; } - ElementContent[0][0][0] = level.custom_element[i].change.successor; + ElementContent[0][0][0] = custom_element_change.successor; DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY); DrawMiniElement(area_x, area_y, ElementContent[0][0][0]); @@ -4756,7 +4755,8 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) { int i = properties_element - EL_CUSTOM_START; - level.custom_element[i].change.successor = new_element; + custom_element_change.successor = new_element; + level.custom_element[i].change = custom_element_change; } else if (id == GADGET_ID_RANDOM_BACKGROUND) random_placement_background_element = new_element; diff --git a/src/game.c b/src/game.c index 38445772..5a63c25e 100644 --- a/src/game.c +++ b/src/game.c @@ -698,7 +698,7 @@ static void InitGameEngine() changing_element[element].base_element = element; changing_element[element].next_element = change->successor; - changing_element[i].change_delay = 0; + changing_element[element].change_delay = 0; if (HAS_CHANGE_EVENT(element, CE_DELAY_FIXED)) changing_element[element].change_delay += @@ -4593,6 +4593,11 @@ static void ChangeElement(int x, int y) ResetGfxAnimation(x, y); ResetRandomAnimationValue(x, y); +#if 1 + InitField(x, y, FALSE); + if (CAN_MOVE(element)) + InitMovDir(x, y); +#endif DrawLevelField(x, y); if (changing_element[element].post_change_function) @@ -4796,6 +4801,15 @@ void GameActions() element = Feld[x][y]; graphic = el2img(element); +#if 0 + if (element == -1) + { + printf("::: %d,%d: %d [%d]\n", x, y, element, FrameCounter); + + element = graphic = 0; + } +#endif + if (graphic_info[graphic].anim_global_sync) GfxFrame[x][y] = FrameCounter; @@ -4878,11 +4892,12 @@ void GameActions() #endif else if (element == EL_EXPLOSION) ; /* drawing of correct explosion animation is handled separately */ - else if (IS_ANIMATED(graphic)) + else if (IS_ANIMATED(graphic) && !IS_AUTO_CHANGING(element)) DrawLevelGraphicAnimationIfNeeded(x, y, graphic); #if 1 - if (IS_AUTO_CHANGING(element)) + /* this may take place after moving, therefore element may have changed */ + if (IS_AUTO_CHANGING(Feld[x][y])) ChangeElement(x, y); #endif diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 10656e46..60aff1cc 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -324,7 +324,7 @@ unsigned int init_random_number(int nr, long seed) unsigned int get_random_number(int nr, unsigned int max) { - return (random_linux_libc(nr) % max); + return (max > 0 ? random_linux_libc(nr) % max : 0); } -- 2.34.1