X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame.c;h=5d1f08f90516fbf347f65246e676f1c2fce9b631;hb=9a3b7326f0a20338806bcdc48fe52eb7c2dcaa8e;hp=d78023fd15a8472d6f5a04d82b7283d4dfd0c764;hpb=95ff39b11bc3c268d8206193bad1433ac9526c94;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index d78023fd..5d1f08f9 100644 --- a/src/game.c +++ b/src/game.c @@ -41,6 +41,7 @@ #define USE_STOP_CHANGED_ELEMENTS (USE_NEW_STUFF * 1) #define USE_ELEMENT_TOUCHING_BUGFIX (USE_NEW_STUFF * 1) #define USE_NEW_CONTINUOUS_SNAPPING (USE_NEW_STUFF * 1) +#define USE_GFX_RESET_GFX_ANIMATION (USE_NEW_STUFF * 1) #define USE_QUICKSAND_IMPACT_BUGFIX (USE_NEW_STUFF * 0) @@ -363,6 +364,8 @@ void RemovePlayer(struct PlayerInfo *); boolean SnapField(struct PlayerInfo *, int, int); boolean DropElement(struct PlayerInfo *); +static int getInvisibleActiveFromInvisibleElement(int); +static int getInvisibleFromInvisibleActiveElement(int); static struct GadgetInfo *game_gadget[NUM_GAME_BUTTONS]; @@ -1126,6 +1129,14 @@ static void InitField(int x, int y, boolean init_game) game.light_time_left = level.time_light * FRAMES_PER_SECOND; break; + case EL_INVISIBLE_STEELWALL: + case EL_INVISIBLE_WALL: + case EL_INVISIBLE_SAND: + if (game.light_time_left > 0 || + game.lenses_time_left > 0) + Feld[x][y] = getInvisibleActiveFromInvisibleElement(element); + break; + case EL_EMC_MAGIC_BALL: if (game.ball_state) Feld[x][y] = EL_EMC_MAGIC_BALL_ACTIVE; @@ -3011,10 +3022,24 @@ void InitPlayerGfxAnimation(struct PlayerInfo *player, int action, int dir) } } -static void ResetRandomAnimationValue(int x, int y) +#if USE_GFX_RESET_GFX_ANIMATION +static void ResetGfxFrame(int x, int y, boolean redraw) { - GfxRandom[x][y] = INIT_GFX_RANDOM(); + int element = Feld[x][y]; + int graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]); + int last_gfx_frame = GfxFrame[x][y]; + + if (graphic_info[graphic].anim_global_sync) + GfxFrame[x][y] = FrameCounter; + else if (ANIM_MODE(graphic) == ANIM_CE_VALUE) + GfxFrame[x][y] = CustomValue[x][y]; + else if (ANIM_MODE(graphic) == ANIM_CE_SCORE) + GfxFrame[x][y] = element_info[element].collect_score; + + if (redraw && GfxFrame[x][y] != last_gfx_frame) + DrawLevelGraphicAnimation(x, y, graphic); } +#endif static void ResetGfxAnimation(int x, int y) { @@ -3022,9 +3047,9 @@ static void ResetGfxAnimation(int x, int y) int element, graphic; #endif - GfxFrame[x][y] = 0; GfxAction[x][y] = ACTION_DEFAULT; GfxDir[x][y] = MovDir[x][y]; + GfxFrame[x][y] = 0; #if 0 element = Feld[x][y]; @@ -3037,6 +3062,15 @@ static void ResetGfxAnimation(int x, int y) else if (ANIM_MODE(graphic) == ANIM_CE_SCORE) GfxFrame[x][y] = element_info[element].collect_score; #endif + +#if USE_GFX_RESET_GFX_ANIMATION + ResetGfxFrame(x, y, FALSE); +#endif +} + +static void ResetRandomAnimationValue(int x, int y) +{ + GfxRandom[x][y] = INIT_GFX_RANDOM(); } void InitMovingField(int x, int y, int direction) @@ -5696,7 +5730,7 @@ inline static void TurnRoundExt(int x, int y) static void TurnRound(int x, int y) { int direction = MovDir[x][y]; -#if 1 +#if 0 int element, graphic; #endif @@ -5711,6 +5745,8 @@ static void TurnRound(int x, int y) GfxAction[x][y] = ACTION_TURNING_FROM_LEFT + MV_DIR_TO_BIT(direction); #if 1 + ResetGfxFrame(x, y, FALSE); +#else element = Feld[x][y]; graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]); @@ -8246,15 +8282,15 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) case CA_SET_CE_VALUE: { #if USE_NEW_CUSTOM_VALUE - int last_custom_value = CustomValue[x][y]; + int last_ce_value = CustomValue[x][y]; CustomValue[x][y] = action_arg_number_new; #if 0 - printf("::: Count == %d\n", CustomValue[x][y]); + printf("::: CE value == %d\n", CustomValue[x][y]); #endif - if (CustomValue[x][y] == 0 && last_custom_value > 0) + if (CustomValue[x][y] == 0 && last_ce_value > 0) { #if 0 printf("::: CE_VALUE_GETS_ZERO\n"); @@ -8274,8 +8310,30 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) case CA_SET_CE_SCORE: { +#if USE_NEW_CUSTOM_VALUE + int last_ce_score = ei->collect_score; + ei->collect_score = action_arg_number_new; +#if 0 + printf("::: CE score == %d\n", ei->collect_score); +#endif + + if (ei->collect_score == 0 && last_ce_score > 0) + { +#if 0 + printf("::: CE_SCORE_GETS_ZERO\n"); +#endif + + CheckElementChange(x, y, element, EL_UNDEFINED, CE_SCORE_GETS_ZERO); + CheckTriggeredElementChange(x, y, element, CE_SCORE_GETS_ZERO_OF_X); + +#if 0 + printf("::: RESULT: %d, %d\n", Feld[x][y], ChangePage[x][y]); +#endif + } +#endif + break; } @@ -8325,8 +8383,10 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) Feld[x][y] = new_element; +#if !USE_GFX_RESET_GFX_ANIMATION ResetGfxAnimation(x, y); ResetRandomAnimationValue(x, y); +#endif if (element_info[new_element].move_direction_initial == MV_START_PREVIOUS) MovDir[x][y] = previous_move_direction; @@ -8340,6 +8400,11 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) new_element = Feld[x][y]; /* element may have changed */ +#if USE_GFX_RESET_GFX_ANIMATION + ResetGfxAnimation(x, y); + ResetRandomAnimationValue(x, y); +#endif + DrawLevelField(x, y); if (GFX_CRUMBLED(new_element)) @@ -9712,6 +9777,9 @@ void GameActions_RND() printf("::: Yo man! Rocks can fall!\n"); #endif +#if 1 + ResetGfxFrame(x, y, TRUE); +#else if (graphic_info[graphic].anim_global_sync) GfxFrame[x][y] = FrameCounter; else if (ANIM_MODE(graphic) == ANIM_CE_VALUE) @@ -9736,6 +9804,7 @@ void GameActions_RND() #endif DrawLevelGraphicAnimation(x, y, graphic); } +#endif if (ANIM_MODE(graphic) == ANIM_RANDOM && IS_NEXT_FRAME(GfxFrame[x][y], graphic))