From fd593e3b37f142503b0b34541d70e51f2d1cfc05 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 20 Jan 2001 21:13:03 +0100 Subject: [PATCH] rnd-20010120-5-src --- src/game.c | 53 ++++++++++++++++++++--------------------------------- src/tools.c | 16 ++++++++++++++++ src/tools.h | 1 + 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/game.c b/src/game.c index 7fa68505..a3dd01df 100644 --- a/src/game.c +++ b/src/game.c @@ -1201,20 +1201,12 @@ void RemoveMovingField(int x, int y) Feld[oldx][oldy] == EL_MAGIC_WALL_EMPTYING || Feld[oldx][oldy] == EL_MAGIC_WALL_BD_EMPTYING || Feld[oldx][oldy] == EL_AMOEBA_DRIPPING)) - { - Feld[oldx][oldy] = (Feld[oldx][oldy] == EL_QUICKSAND_EMPTYING ? - EL_MORAST_LEER : - Feld[oldx][oldy] == EL_MAGIC_WALL_EMPTYING ? - EL_MAGIC_WALL_EMPTY : - Feld[oldx][oldy] == EL_MAGIC_WALL_BD_EMPTYING ? - EL_MAGIC_WALL_BD_EMPTY : - Feld[oldx][oldy] == EL_AMOEBA_DRIPPING ? - EL_AMOEBE_NASS : 0); - Store[oldx][oldy] = Store2[oldx][oldy] = 0; - } + Feld[oldx][oldy] = get_next_element(Feld[oldx][oldy]); else Feld[oldx][oldy] = EL_LEERRAUM; + Store[oldx][oldy] = Store2[oldx][oldy] = 0; + Feld[newx][newy] = EL_LEERRAUM; MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0; MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0; @@ -2999,58 +2991,53 @@ void ContinueMoving(int x, int y) if (element == EL_QUICKSAND_FILLING) { - element = Feld[newx][newy] = EL_MORAST_VOLL; + element = Feld[newx][newy] = get_next_element(element); Store[newx][newy] = Store[x][y]; - Store[x][y] = 0; } else if (element == EL_QUICKSAND_EMPTYING) { - Feld[x][y] = EL_MORAST_LEER; + Feld[x][y] = get_next_element(element); element = Feld[newx][newy] = Store[x][y]; - Store[x][y] = 0; } else if (element == EL_MAGIC_WALL_FILLING) { - element = Feld[newx][newy] = - (game.magic_wall_active ? EL_MAGIC_WALL_FULL : EL_MAGIC_WALL_DEAD); + element = Feld[newx][newy] = get_next_element(element); + if (!game.magic_wall_active) + element = Feld[newx][newy] = EL_MAGIC_WALL_DEAD; Store[newx][newy] = Store[x][y]; - Store[x][y] = 0; } else if (element == EL_MAGIC_WALL_EMPTYING) { - Feld[x][y] = (game.magic_wall_active ? EL_MAGIC_WALL_EMPTY : - EL_MAGIC_WALL_DEAD); + Feld[x][y] = get_next_element(element); + if (!game.magic_wall_active) + Feld[x][y] = EL_MAGIC_WALL_DEAD; element = Feld[newx][newy] = Store[x][y]; - Store[x][y] = 0; } else if (element == EL_MAGIC_WALL_BD_FILLING) { - element = Feld[newx][newy] = - (game.magic_wall_active ? EL_MAGIC_WALL_BD_FULL : - EL_MAGIC_WALL_BD_DEAD); + element = Feld[newx][newy] = get_next_element(element); + if (!game.magic_wall_active) + element = Feld[newx][newy] = EL_MAGIC_WALL_BD_DEAD; Store[newx][newy] = Store[x][y]; - Store[x][y] = 0; } else if (element == EL_MAGIC_WALL_BD_EMPTYING) { - Feld[x][y] = (game.magic_wall_active ? EL_MAGIC_WALL_BD_EMPTY : - EL_MAGIC_WALL_BD_DEAD); + Feld[x][y] = get_next_element(element); + if (!game.magic_wall_active) + Feld[x][y] = EL_MAGIC_WALL_BD_DEAD; element = Feld[newx][newy] = Store[x][y]; - Store[x][y] = 0; } else if (element == EL_AMOEBA_DRIPPING) { - Feld[x][y] = EL_AMOEBE_NASS; + Feld[x][y] = get_next_element(element); element = Feld[newx][newy] = Store[x][y]; - Store[x][y] = 0; } else if (Store[x][y] == EL_SALZSAEURE) { - Store[x][y] = 0; - Feld[newx][newy] = EL_SALZSAEURE; - element = EL_SALZSAEURE; + element = Feld[newx][newy] = EL_SALZSAEURE; } + Store[x][y] = 0; MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0; MovDelay[newx][newy] = 0; diff --git a/src/tools.c b/src/tools.c index e1ec84bd..b1c832c0 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2356,6 +2356,22 @@ static void HandleToolButtons(struct GadgetInfo *gi) request_gadget_id = gi->custom_id; } +int get_next_element(int element) +{ + switch(element) + { + case EL_QUICKSAND_FILLING: return EL_MORAST_VOLL; + case EL_QUICKSAND_EMPTYING: return EL_MORAST_LEER; + case EL_MAGIC_WALL_FILLING: return EL_MAGIC_WALL_FULL; + case EL_MAGIC_WALL_EMPTYING: return EL_MAGIC_WALL_EMPTY; + case EL_MAGIC_WALL_BD_FILLING: return EL_MAGIC_WALL_BD_FULL; + case EL_MAGIC_WALL_BD_EMPTYING: return EL_MAGIC_WALL_BD_EMPTY; + case EL_AMOEBA_DRIPPING: return EL_AMOEBE_NASS; + + default: return element; + } +} + int el2gfx(int element) { switch(element) diff --git a/src/tools.h b/src/tools.h index cf4c3706..cb159f17 100644 --- a/src/tools.h +++ b/src/tools.h @@ -111,6 +111,7 @@ int ReadPixel(DrawBuffer *, int, int); void CreateToolButtons(); +int get_next_element(int); int el2gfx(int); #endif /* TOOLS_H */ -- 2.34.1