From 174df2f6abf5f72b5539176a2591a3c1ee83f045 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 27 Nov 2005 23:22:21 +0100 Subject: [PATCH] rnd-20051127-3-src --- src/conftime.h | 2 +- src/editor.c | 2 ++ src/game.c | 69 ++++++++++++++++++++++++++++++++++++++++++++------ src/tools.c | 1 + 4 files changed, 65 insertions(+), 9 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 789edf55..10f069ba 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2005-11-27 17:26]" +#define COMPILE_DATE_STRING "[2005-11-27 23:21]" diff --git a/src/editor.c b/src/editor.c index e598db17..25704135 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1538,9 +1538,11 @@ static struct ValueTextInfo options_action_type[] = { CA_SET_SCORE, "set score" }, { CA_SET_CE_SCORE, "set CE score" }, { CA_SET_CE_COUNT, "set CE count" }, +#if 0 { CA_SET_DYNABOMB_NUMBER, "set bomb number" }, { CA_SET_DYNABOMB_SIZE, "set bomb size" }, { CA_SET_DYNABOMB_POWER, "set bomb power" }, +#endif { CA_TOGGLE_PLAYER_GRAVITY, "toggle gravity" }, { CA_ENABLE_PLAYER_GRAVITY, "enable gravity" }, { CA_DISABLE_PLAYER_GRAVITY, "disable gravity" }, diff --git a/src/game.c b/src/game.c index 2d0ae75c..08fee264 100644 --- a/src/game.c +++ b/src/game.c @@ -28,6 +28,7 @@ #define USE_NEW_STUFF (TRUE * 1) #define USE_NEW_SP_SLIPPERY (TRUE * USE_NEW_STUFF * 1) +#define USE_NEW_COLLECT_COUNT (TRUE * USE_NEW_STUFF * 1) /* for DigField() */ @@ -903,6 +904,10 @@ static void InitField(int x, int y, boolean init_game) } break; } + +#if USE_NEW_COLLECT_COUNT + Count[x][y] = element_info[Feld[x][y]].collect_count_initial; +#endif } static inline void InitField_WithBug1(int x, int y, boolean init_game) @@ -1644,7 +1649,9 @@ void InitGame() MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0; ChangeDelay[x][y] = 0; ChangePage[x][y] = -1; - Count[x][y] = element_info[Feld[x][y]].collect_count_initial; +#if USE_NEW_COLLECT_COUNT + Count[x][y] = 0; /* initialized in InitField() */ +#endif Store[x][y] = Store2[x][y] = StorePlayer[x][y] = Back[x][y] = 0; AmoebaNr[x][y] = 0; WasJustMoving[x][y] = 0; @@ -2488,7 +2495,9 @@ void InitMovingField(int x, int y, int direction) MovDir[newx][newy] = MovDir[x][y]; +#if USE_NEW_COLLECT_COUNT Count[newx][newy] = Count[x][y]; +#endif GfxFrame[newx][newy] = GfxFrame[x][y]; GfxRandom[newx][newy] = GfxRandom[x][y]; @@ -2571,7 +2580,9 @@ static void RemoveField(int x, int y) MovDir[x][y] = 0; MovDelay[x][y] = 0; +#if USE_NEW_COLLECT_COUNT Count[x][y] = 0; +#endif AmoebaNr[x][y] = 0; ChangeDelay[x][y] = 0; @@ -3158,7 +3169,10 @@ void Explode(int ex, int ey, int phase, int mode) GfxDir[x][y] = MV_NO_MOVING; ChangeDelay[x][y] = 0; ChangePage[x][y] = -1; + +#if USE_NEW_COLLECT_COUNT Count[x][y] = 0; +#endif InitField_WithBug2(x, y, FALSE); @@ -5367,6 +5381,10 @@ void ContinueMoving(int x, int y) if (!game.magic_wall_active) Feld[x][y] = EL_MAGIC_WALL_DEAD; element = Feld[newx][newy] = Store[x][y]; + +#if USE_NEW_COLLECT_COUNT + InitField(newx, newy, FALSE); +#endif } else if (element == EL_BD_MAGIC_WALL_FILLING) { @@ -5381,6 +5399,10 @@ void ContinueMoving(int x, int y) if (!game.magic_wall_active) Feld[x][y] = EL_BD_MAGIC_WALL_DEAD; element = Feld[newx][newy] = Store[x][y]; + +#if USE_NEW_COLLECT_COUNT + InitField(newx, newy, FALSE); +#endif } else if (element == EL_AMOEBA_DROPPING) { @@ -5403,8 +5425,6 @@ void ContinueMoving(int x, int y) MovDir[x][y] = 0; MovDelay[x][y] = 0; - Count[x][y] = 0; - MovDelay[newx][newy] = 0; if (CAN_CHANGE(element)) @@ -5414,6 +5434,10 @@ void ContinueMoving(int x, int y) ChangePage[newx][newy] = ChangePage[x][y]; Changed[newx][newy] = Changed[x][y]; ChangeEvent[newx][newy] = ChangeEvent[x][y]; + +#if USE_NEW_COLLECT_COUNT + Count[newx][newy] = Count[x][y]; +#endif } ChangeDelay[x][y] = 0; @@ -5421,6 +5445,10 @@ void ContinueMoving(int x, int y) Changed[x][y] = FALSE; ChangeEvent[x][y] = -1; +#if USE_NEW_COLLECT_COUNT + Count[x][y] = 0; +#endif + /* copy animation control values to new field */ GfxFrame[newx][newy] = GfxFrame[x][y]; GfxRandom[newx][newy] = GfxRandom[x][y]; /* keep same random value */ @@ -6453,7 +6481,11 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) action_arg == CA_ARG_NUMBER_MIN ? CA_ARG_MIN : action_arg == CA_ARG_NUMBER_MAX ? CA_ARG_MAX : action_arg == CA_ARG_NUMBER_CE_SCORE ? ei->collect_score : +#if USE_NEW_COLLECT_COUNT action_arg == CA_ARG_NUMBER_CE_COUNT ? Count[x][y] : +#else + action_arg == CA_ARG_NUMBER_CE_COUNT ? ei->collect_count_initial : +#endif action_arg == CA_ARG_NUMBER_CE_DELAY ? GET_CHANGE_DELAY(change) : -1); @@ -6638,7 +6670,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) case CA_SET_SCORE: { local_player->score = - getModifiedActionNumber(local_player->score, 0, 99999, + getModifiedActionNumber(local_player->score, 0, 9999, action_mode, action_arg_number); DrawGameValue_Score(local_player->score); @@ -6656,21 +6688,26 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) case CA_SET_CE_COUNT: { +#if USE_NEW_COLLECT_COUNT int count_last = Count[x][y]; Count[x][y] = getModifiedActionNumber(Count[x][y], 0, 9999, action_mode, action_arg_number); +#if 0 printf("::: Count == %d\n", Count[x][y]); +#endif if (Count[x][y] == 0 && count_last > 0) { - +#if 0 printf("::: CE_COUNT_AT_ZERO\n"); +#endif CheckElementChange(x, y, element, EL_UNDEFINED, CE_COUNT_AT_ZERO); CheckTriggeredElementChange(element, CE_COUNT_AT_ZERO_OF_X); } +#endif break; } @@ -7063,15 +7100,18 @@ static boolean CheckTriggeredElementChangeExt(int trigger_element, ChangeDelay[x][y] = 1; ChangeEvent[x][y] = trigger_event; ChangeElement(x, y, p); - - change_done = TRUE; - change_done_any = TRUE; } if (change->has_action) ExecuteCustomElementAction(x, y, element, p); } } + + if (change->can_change) + { + change_done = TRUE; + change_done_any = TRUE; + } } } } @@ -9144,7 +9184,20 @@ int DigField(struct PlayerInfo *player, return MF_NO_ACTION; /* field has no opening in this direction */ element = Feld[x][y]; +#if USE_NEW_COLLECT_COUNT collect_count = Count[x][y]; +#else + collect_count = element_info[element].collect_count_initial; +#endif + +#if 0 + if (element != EL_BLOCKED && + Count[x][y] != element_info[element].collect_count_initial) + printf("::: %d: %d != %d\n", + element, + Count[x][y], + element_info[element].collect_count_initial); +#endif if (!is_player && !IS_COLLECTIBLE(element)) /* penguin cannot collect it */ return MF_NO_ACTION; diff --git a/src/tools.c b/src/tools.c index 0f5aadab..d5a370cb 100644 --- a/src/tools.c +++ b/src/tools.c @@ -85,6 +85,7 @@ void DumpTile(int x, int y) printf(" MovDir: %d\n", MovDir[x][y]); printf(" MovDelay: %d\n", MovDelay[x][y]); printf(" ChangeDelay: %d\n", ChangeDelay[x][y]); + printf(" Count: %d\n", Count[x][y]); printf(" GfxElement: %d\n", GfxElement[x][y]); printf(" GfxAction: %d\n", GfxAction[x][y]); printf(" GfxFrame: %d\n", GfxFrame[x][y]); -- 2.34.1