X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=fb479b0e964d2086a206fd79e217ab23fc2ae3fb;hb=7d76e4299f6171909990d2ba2f1f6a2b382d9cf3;hp=4b726a43f39fc7a5221077ba13f39c9c0fb819a5;hpb=6435b79b71c4033de78ab3e611ee63f6a2147874;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 4b726a43..fb479b0e 100644 --- a/src/game.c +++ b/src/game.c @@ -533,21 +533,15 @@ static void InitGameEngine() }; static int ep_em_slippery_wall_num = SIZEOF_ARRAY_INT(ep_em_slippery_wall); + /* special EM style gems behaviour */ for (i=0; i VERSION_IDENT(2,0,1)) - Properties2[EL_EXPANDABLE_WALL_GROWING] |= EP_BIT_EM_SLIPPERY_WALL; - else - Properties2[EL_EXPANDABLE_WALL_GROWING] &=~EP_BIT_EM_SLIPPERY_WALL; + SET_PROPERTY(EL_EXPANDABLE_WALL_GROWING, EP_EM_SLIPPERY_WALL, + (level.em_slippery_gems && + game.engine_version > VERSION_IDENT(2,0,1))); } /* initialize changing elements information */ @@ -919,7 +913,7 @@ void InitGame() else { DrawTextExt(drawto, DX + XX_EMERALDS, DY + YY_EMERALDS, - int2str(level_nr, 3), FONT_LEVEL_NUMBER, FONT_OPAQUE); + int2str(level_nr, 3), FONT_LEVEL_NUMBER, BLIT_OPAQUE); BlitBitmap(drawto, drawto, DX + XX_EMERALDS, DY + YY_EMERALDS + 1, getFontWidth(FONT_LEVEL_NUMBER) * 3, @@ -1112,7 +1106,7 @@ void GameWon() if (!tape.playing && !setup.sound_loops) PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); if (TimeLeft > 0 && !(TimeLeft % 10)) - RaiseScore(level.score[SC_ZEITBONUS]); + RaiseScore(level.score[SC_TIME_BONUS]); if (TimeLeft > 100 && !(TimeLeft % 10)) TimeLeft -= 10; else @@ -1138,7 +1132,7 @@ void GameWon() if (!tape.playing && !setup.sound_loops) PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); if (TimePlayed < 999 && !(TimePlayed % 10)) - RaiseScore(level.score[SC_ZEITBONUS]); + RaiseScore(level.score[SC_TIME_BONUS]); if (TimePlayed < 900 && !(TimePlayed % 10)) TimePlayed += 10; else @@ -1384,6 +1378,7 @@ static int MovingOrBlocked2ElementIfNotLeaving(int x, int y) static void RemoveField(int x, int y) { Feld[x][y] = EL_EMPTY; + GfxElement[x][y] = EL_EMPTY; MovPos[x][y] = 0; MovDir[x][y] = 0; MovDelay[x][y] = 0; @@ -1617,6 +1612,7 @@ void Explode(int ex, int ey, int phase, int mode) } Feld[x][y] = EL_EXPLOSION; + GfxElement[x][y] = EL_EMPTY; MovDir[x][y] = MovPos[x][y] = 0; AmoebaNr[x][y] = 0; ExplodePhase[x][y] = 1; @@ -1688,7 +1684,7 @@ void Explode(int ex, int ey, int phase, int mode) int frame = getGraphicAnimationFrame(graphic, phase - delay); if (phase == delay) - DrawCrumbledSand(SCREENX(x), SCREENY(y)); + DrawLevelFieldCrumbledSand(x, y); if (IS_PFORTE(Store[x][y])) { @@ -2433,11 +2429,11 @@ void TurnRound(int x, int y) if (IN_LEV_FIELD(left_x, left_y) && (IS_FREE_OR_PLAYER(left_x, left_y) || - IS_MAMPF2(Feld[left_x][left_y]))) + IS_FOOD_DARK_YAMYAM(Feld[left_x][left_y]))) can_turn_left = TRUE; if (IN_LEV_FIELD(right_x, right_y) && (IS_FREE_OR_PLAYER(right_x, right_y) || - IS_MAMPF2(Feld[right_x][right_y]))) + IS_FOOD_DARK_YAMYAM(Feld[right_x][right_y]))) can_turn_right = TRUE; if (can_turn_left && can_turn_right) @@ -2724,7 +2720,7 @@ void TurnRound(int x, int y) Feld[newx][newy] == EL_ACID || (element == EL_PENGUIN && (Feld[newx][newy] == EL_EXIT_OPEN || - IS_MAMPF3(Feld[newx][newy]))))) + IS_FOOD_PENGUIN(Feld[newx][newy]))))) return; MovDir[x][y] = @@ -2736,7 +2732,7 @@ void TurnRound(int x, int y) Feld[newx][newy] == EL_ACID || (element == EL_PENGUIN && (Feld[newx][newy] == EL_EXIT_OPEN || - IS_MAMPF3(Feld[newx][newy]))))) + IS_FOOD_PENGUIN(Feld[newx][newy]))))) return; MovDir[x][y] = old_move_dir; @@ -3026,8 +3022,8 @@ void StartMoving(int x, int y) if (!MovDelay[x][y]) /* start new movement phase */ { - /* all objects that can change their move direction after each step */ - /* (MAMPFER, MAMPFER2 and PACMAN go straight until they hit a wall */ + /* all objects that can change their move direction after each step + (YAMYAM, DARK_YAMYAM and PACMAN go straight until they hit a wall */ if (element != EL_YAMYAM && element != EL_DARK_YAMYAM && @@ -3154,7 +3150,7 @@ void StartMoving(int x, int y) return; } - else if (IS_MAMPF3(Feld[newx][newy])) + else if (IS_FOOD_PENGUIN(Feld[newx][newy])) { if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING) DrawLevelField(newx, newy); @@ -3249,7 +3245,7 @@ void StartMoving(int x, int y) PlaySoundLevel(x, y, SND_YAMYAM_DIGGING); } else if (element == EL_DARK_YAMYAM && IN_LEV_FIELD(newx, newy) && - IS_MAMPF2(Feld[newx][newy])) + IS_FOOD_DARK_YAMYAM(Feld[newx][newy])) { if (AmoebaNr[newx][newy]) { @@ -3397,7 +3393,7 @@ void ContinueMoving(int x, int y) yy = y + xy[i][1]; if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND) - DrawLevelField(xx, yy); /* for "DrawCrumbledSand()" */ + DrawLevelField(xx, yy); /* for "crumbled sand" */ } } @@ -4382,7 +4378,7 @@ static void ChangeActiveTrap(int x, int y) /* if new animation frame was drawn, correct crumbled sand border */ if (IS_NEW_FRAME(GfxFrame[x][y], graphic)) - DrawCrumbledSand(SCREENX(x), SCREENY(y)); + DrawLevelFieldCrumbledSand(x, y); } static void ChangeElement(int x, int y) @@ -5034,11 +5030,18 @@ static void CheckGravityMovement(struct PlayerInfo *player) if (field_under_player_is_free && !player_is_moving_to_valid_field && - !IS_TUBE(Feld[jx][jy])) + !IS_WALKABLE_THROUGH(Feld[jx][jy])) player->programmed_action = MV_DOWN; } } +/* + MoveFigureOneStep() + ----------------------------------------------------------------------------- + dx, dy: direction (non-diagonal) to try to move the player to + real_dx, real_dy: direction as read from input device (can be diagonal) +*/ + boolean MoveFigureOneStep(struct PlayerInfo *player, int dx, int dy, int real_dx, int real_dy) { @@ -5253,7 +5256,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) else if (old_jx == jx && old_jy != jy) player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP); - DrawLevelField(jx, jy); /* for "DrawCrumbledSand()" */ + DrawLevelField(jx, jy); /* for "crumbled sand" */ player->last_move_dir = player->MovDir; player->is_moving = TRUE; @@ -5313,7 +5316,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode) if (player->MovPos == 0) { - if (IS_QUICK_GATE(Feld[last_jx][last_jy])) + if (IS_PASSABLE(Feld[last_jx][last_jy])) { /* continue with normal speed after quickly moving through gate */ HALVE_PLAYER_SPEED(player); @@ -5654,6 +5657,25 @@ void RemoveHero(struct PlayerInfo *player) ExitY = ZY = jy; } +#if 0 +/* + checkDiagonalPushing() + ----------------------------------------------------------------------------- + check if diagonal input device direction results in pushing of object +*/ + +static boolean checkDiagonalPushing(int x, int y, int real_dx, int real_dy) +{ +} +#endif + +/* + DigField() + ----------------------------------------------------------------------------- + x, y: field next to player (non-diagonal) to try to dig to + real_dx, real_dy: direction as read from input device (can be diagonal) +*/ + int DigField(struct PlayerInfo *player, int x, int y, int real_dx, int real_dy, int mode) { @@ -5726,11 +5748,14 @@ int DigField(struct PlayerInfo *player, case EL_SP_BASE: case EL_SP_BUGGY_BASE: case EL_SP_BUGGY_BASE_ACTIVATING: + RemoveField(x, y); #if 1 - if (mode != DF_SNAP && element == EL_SAND) - GfxElement[x][y] = Feld[x][y]; + if (mode != DF_SNAP && element != EL_EMPTY) + { + GfxElement[x][y] = (CAN_BE_CRUMBLED(element) ? EL_SAND : element); + player->is_digging = TRUE; + } #endif - RemoveField(x, y); PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING); break; @@ -5744,6 +5769,13 @@ int DigField(struct PlayerInfo *player, case EL_PEARL: case EL_CRYSTAL: RemoveField(x, y); +#if 1 + if (mode != DF_SNAP) + { + GfxElement[x][y] = element; + player->is_collecting = TRUE; + } +#endif local_player->gems_still_needed -= (element == EL_DIAMOND ? 3 : element == EL_PEARL ? 5 : element == EL_CRYSTAL ? 8 : 1); @@ -6092,16 +6124,16 @@ int DigField(struct PlayerInfo *player, break; case EL_SP_PORT_LEFT: - case EL_SP_GRAVITY_PORT_LEFT: case EL_SP_PORT_RIGHT: - case EL_SP_GRAVITY_PORT_RIGHT: case EL_SP_PORT_UP: - case EL_SP_GRAVITY_PORT_UP: case EL_SP_PORT_DOWN: - case EL_SP_GRAVITY_PORT_DOWN: case EL_SP_PORT_HORIZONTAL: case EL_SP_PORT_VERTICAL: case EL_SP_PORT_ANY: + case EL_SP_GRAVITY_PORT_LEFT: + case EL_SP_GRAVITY_PORT_RIGHT: + case EL_SP_GRAVITY_PORT_UP: + case EL_SP_GRAVITY_PORT_DOWN: if ((dx == -1 && element != EL_SP_PORT_LEFT && element != EL_SP_GRAVITY_PORT_LEFT && @@ -6374,12 +6406,7 @@ int DigField(struct PlayerInfo *player, player->push_delay = 0; if (Feld[x][y] != element) /* really digged/collected something */ - { - if (GfxElement[x][y] == EL_SAND) - player->is_digging = TRUE; - else - player->is_collecting = TRUE; - } + player->is_collecting = !player->is_digging; return MF_MOVING; } @@ -6610,22 +6637,22 @@ void RaiseScoreElement(int element) case EL_EMERALD_YELLOW: case EL_EMERALD_RED: case EL_EMERALD_PURPLE: - RaiseScore(level.score[SC_EDELSTEIN]); + RaiseScore(level.score[SC_EMERALD]); break; case EL_DIAMOND: - RaiseScore(level.score[SC_DIAMANT]); + RaiseScore(level.score[SC_DIAMOND]); break; case EL_BUG: case EL_BD_BUTTERFLY: - RaiseScore(level.score[SC_KAEFER]); + RaiseScore(level.score[SC_BUG]); break; case EL_SPACESHIP: case EL_BD_FIREFLY: - RaiseScore(level.score[SC_FLIEGER]); + RaiseScore(level.score[SC_SPACESHIP]); break; case EL_YAMYAM: case EL_DARK_YAMYAM: - RaiseScore(level.score[SC_MAMPFER]); + RaiseScore(level.score[SC_YAMYAM]); break; case EL_ROBOT: RaiseScore(level.score[SC_ROBOT]); @@ -6634,16 +6661,16 @@ void RaiseScoreElement(int element) RaiseScore(level.score[SC_PACMAN]); break; case EL_NUT: - RaiseScore(level.score[SC_KOKOSNUSS]); + RaiseScore(level.score[SC_NUT]); break; case EL_DYNAMITE: - RaiseScore(level.score[SC_DYNAMIT]); + RaiseScore(level.score[SC_DYNAMITE]); break; case EL_KEY_1: case EL_KEY_2: case EL_KEY_3: case EL_KEY_4: - RaiseScore(level.score[SC_SCHLUESSEL]); + RaiseScore(level.score[SC_KEY]); break; default: break;