From: Holger Schemel Date: Wed, 10 May 2017 15:53:29 +0000 (+0200) Subject: fixed element scores for MM style elements (MM engine) X-Git-Tag: 4.1.0.0~113 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b903ee03857c26c3816a37b4c7c858c24250a7ef;p=rocksndiamonds.git fixed element scores for MM style elements (MM engine) --- diff --git a/src/editor.c b/src/editor.c index 8a093cbc..92b35d0f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -9195,6 +9195,15 @@ static struct { EL_EMC_KEY_7, &level.score[SC_KEY], TEXT_COLLECTING }, { EL_EMC_KEY_8, &level.score[SC_KEY], TEXT_COLLECTING }, { EL_DC_KEY_WHITE, &level.score[SC_KEY], TEXT_COLLECTING }, + { EL_MM_KETTLE, &level.score[SC_EMERALD], TEXT_COLLECTING }, + { EL_DF_CELL, &level.score[SC_EMERALD], TEXT_COLLECTING }, + { EL_MM_KEY, &level.score[SC_KEY], TEXT_COLLECTING }, + { EL_MM_LIGHTBALL, &level.score[SC_ELEM_BONUS], TEXT_COLLECTING }, + { EL_MM_PACMAN, &level.score[SC_PACMAN], TEXT_SMASHING }, + { EL_MM_PACMAN_RIGHT, &level.score[SC_PACMAN], TEXT_SMASHING }, + { EL_MM_PACMAN_UP, &level.score[SC_PACMAN], TEXT_SMASHING }, + { EL_MM_PACMAN_LEFT, &level.score[SC_PACMAN], TEXT_SMASHING }, + { EL_MM_PACMAN_DOWN, &level.score[SC_PACMAN], TEXT_SMASHING }, { EL_AMOEBA_WET, &level.amoeba_speed, TEXT_AMOEBA_SPEED }, { EL_AMOEBA_DRY, &level.amoeba_speed, TEXT_AMOEBA_SPEED }, { EL_AMOEBA_FULL, &level.amoeba_speed, TEXT_AMOEBA_SPEED }, diff --git a/src/files.c b/src/files.c index 649bf1b7..d42a2cd5 100644 --- a/src/files.c +++ b/src/files.c @@ -843,17 +843,17 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = TYPE_INTEGER, CONF_VALUE_16_BIT(1), &li.mm_time_fuse, 0 }, + { + EL_MM_LIGHTBALL, -1, + TYPE_INTEGER, CONF_VALUE_16_BIT(1), + &li.score[SC_ELEM_BONUS], 10 + }, /* ---------- unused values ----------------------------------------------- */ { EL_UNKNOWN, SAVE_CONF_NEVER, TYPE_INTEGER, CONF_VALUE_16_BIT(1), - &li.score[SC_UNKNOWN_14], 10 - }, - { - EL_UNKNOWN, SAVE_CONF_NEVER, - TYPE_INTEGER, CONF_VALUE_16_BIT(2), &li.score[SC_UNKNOWN_15], 10 }, @@ -3990,9 +3990,11 @@ void CopyNativeLevel_RND_to_MM(struct LevelInfo *level) strcpy(level_mm->name, level->name); strcpy(level_mm->author, level->author); + level_mm->score[SC_EMERALD] = level->score[SC_EMERALD]; level_mm->score[SC_PACMAN] = level->score[SC_PACMAN]; level_mm->score[SC_KEY] = level->score[SC_KEY]; level_mm->score[SC_TIME_BONUS] = level->score[SC_TIME_BONUS]; + level_mm->score[SC_ELEM_BONUS] = level->score[SC_ELEM_BONUS]; level_mm->amoeba_speed = level->amoeba_speed; level_mm->time_fuse = level->mm_time_fuse; @@ -4025,9 +4027,11 @@ void CopyNativeLevel_MM_to_RND(struct LevelInfo *level) if (!strEqual(level_mm->author, ANONYMOUS_NAME)) strcpy(level->author, level_mm->author); + level->score[SC_EMERALD] = level_mm->score[SC_EMERALD]; level->score[SC_PACMAN] = level_mm->score[SC_PACMAN]; level->score[SC_KEY] = level_mm->score[SC_KEY]; level->score[SC_TIME_BONUS] = level_mm->score[SC_TIME_BONUS]; + level->score[SC_ELEM_BONUS] = level_mm->score[SC_ELEM_BONUS]; level->amoeba_speed = level_mm->amoeba_speed; level->mm_time_fuse = level_mm->time_fuse; diff --git a/src/game_mm/mm_files.c b/src/game_mm/mm_files.c index 8e6a72bd..0b88735e 100644 --- a/src/game_mm/mm_files.c +++ b/src/game_mm/mm_files.c @@ -30,6 +30,16 @@ #define SCORE_COOKIE "MIRRORMAGIC_SCORE_FILE_VERSION_1.4" +int default_score[LEVEL_SCORE_ELEMENTS] = +{ + [SC_COLLECTIBLE] = 10, + [SC_PACMAN] = 50, + [SC_KEY] = 10, + [SC_TIME_BONUS] = 1, + [SC_LIGHTBALL] = 10, +}; + + /* ========================================================================= */ /* level file functions */ /* ========================================================================= */ @@ -162,6 +172,12 @@ static int LoadLevel_MM_HEAD(File *file, int chunk_size, for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++) level->score[i] = getFile8Bit(file); + // scores were 0 and hardcoded in game engine in level files up to 2.0.x + if (level->file_version <= MM_FILE_VERSION_2_0) + for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++) + if (level->score[i] == 0) + level->score[i] = default_score[i]; + level->auto_count_kettles = (getFile8Bit(file) == 1 ? TRUE : FALSE); level->amoeba_speed = getFile8Bit(file); level->time_fuse = getFile8Bit(file); diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 8d9743c6..e2a2e5f8 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -92,6 +92,7 @@ static int MovingOrBlocked2Element_MM(int, int); static void Bang_MM(int, int); static void RaiseScore_MM(int); +static void RaiseScoreElement_MM(int); static void RemoveMovingField_MM(int, int); static void InitMovingField_MM(int, int, int); static void ContinueMoving_MM(int, int); @@ -1527,8 +1528,6 @@ boolean HitElement(int element, int hit_mask) if (game_mm.kettles_still_needed > 0) game_mm.kettles_still_needed--; - RaiseScore_MM(10); - if (game_mm.kettles_still_needed == 0) { CheckExitMM(); @@ -1540,16 +1539,13 @@ boolean HitElement(int element, int hit_mask) { game_mm.num_keys++; } - else if (element == EL_LIGHTBALL) - { - RaiseScore_MM(10); - } else if (IS_PACMAN(element)) { DeletePacMan(ELX, ELY); - RaiseScore_MM(50); } + RaiseScoreElement_MM(element); + return FALSE; } @@ -2821,7 +2817,7 @@ void ClickElement(int x, int y, int button) else if (element == EL_LIGHTBALL) { Bang_MM(x, y); - RaiseScore_MM(10); + RaiseScoreElement_MM(element); DrawLaser(0, DL_LASER_ENABLED); } @@ -3893,7 +3889,7 @@ void GameWon_MM() if (!setup.sound_loops) PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT); if (TimePlayed < 999 && !(TimePlayed % 10)) - RaiseScore_MM(native_mm_level.score[SC_ZEITBONUS]); + RaiseScore_MM(native_mm_level.score[SC_TIME_BONUS]); if (TimePlayed < 900 && !(TimePlayed % 10)) TimePlayed += 10; else @@ -4162,6 +4158,10 @@ void RaiseScoreElement_MM(int element) switch(element) { case EL_PACMAN: + case EL_PACMAN_RIGHT: + case EL_PACMAN_UP: + case EL_PACMAN_LEFT: + case EL_PACMAN_DOWN: RaiseScore_MM(native_mm_level.score[SC_PACMAN]); break; @@ -4169,6 +4169,15 @@ void RaiseScoreElement_MM(int element) RaiseScore_MM(native_mm_level.score[SC_KEY]); break; + case EL_KETTLE: + case EL_CELL: + RaiseScore_MM(native_mm_level.score[SC_COLLECTIBLE]); + break; + + case EL_LIGHTBALL: + RaiseScore_MM(native_mm_level.score[SC_LIGHTBALL]); + break; + default: break; } diff --git a/src/game_mm/mm_game.h b/src/game_mm/mm_game.h index 84596820..682d8aab 100644 --- a/src/game_mm/mm_game.h +++ b/src/game_mm/mm_game.h @@ -15,20 +15,6 @@ #include "main_mm.h" -/* score for elements (also used by editor.c) */ -#define SC_EDELSTEIN 0 -#define SC_DIAMANT 1 -#define SC_KAEFER 2 -#define SC_FLIEGER 3 -#define SC_MAMPFER 4 -#define SC_ROBOT 5 -#define SC_PACMAN 6 -#define SC_KOKOSNUSS 7 -#define SC_DYNAMIT 8 -#define SC_KEY 9 -#define SC_ZEITBONUS 10 - - void InitAmoebaNr(int, int); void GameWon_MM(void); int NewHiScore_MM(void); diff --git a/src/game_mm/mm_main.h b/src/game_mm/mm_main.h index 7688cca1..3322a57e 100644 --- a/src/game_mm/mm_main.h +++ b/src/game_mm/mm_main.h @@ -156,11 +156,30 @@ #define MAX_SCORE_ENTRIES 100 #define MAX_ELEMENTS 700 /* 500 static + 200 runtime */ -#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */ - #define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */ #define MICROLEVEL_LABEL_DELAY 250 /* delay for micro level label */ +/* score for elements */ +#define SC_COLLECTIBLE 0 +#define SC_UNUSED_1 1 +#define SC_UNUSED_2 2 +#define SC_UNUSED_3 3 +#define SC_UNUSED_4 4 +#define SC_UNUSED_5 5 +#define SC_PACMAN 6 +#define SC_UNUSED_7 7 +#define SC_UNUSED_8 8 +#define SC_KEY 9 +#define SC_TIME_BONUS 10 +#define SC_UNUSED_11 11 +#define SC_UNUSED_12 12 +#define SC_UNUSED_13 13 +#define SC_LIGHTBALL 14 +#define SC_UNUSED_15 15 + +#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */ + + struct HiScore_MM { char Name[MAX_PLAYER_NAME_LEN + 1]; diff --git a/src/main.h b/src/main.h index b84872de..da76f7df 100644 --- a/src/main.h +++ b/src/main.h @@ -1008,7 +1008,7 @@ #define SC_CRYSTAL 11 #define SC_PEARL 12 #define SC_SHIELD 13 -#define SC_UNKNOWN_14 14 +#define SC_ELEM_BONUS 14 #define SC_UNKNOWN_15 15 #define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */