renamed field in level structure for EM engine
authorHolger Schemel <info@artsoft.org>
Thu, 13 Feb 2020 20:07:18 +0000 (21:07 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 19 May 2020 16:19:56 +0000 (18:19 +0200)
src/files.c
src/game.c
src/game_em/cave.c
src/game_em/cave.h
src/game_em/convert.c
src/game_em/emerald.h
src/game_em/logic.c
src/game_em/reademc.c

index 5958d83ca30b1970050899ee34e3f13974533e61..e94692c5edd653cda057191333b59bb3060d709f 100644 (file)
@@ -3522,7 +3522,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   cav->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT);
 
   cav->time_seconds    = level->time;
-  cav->required                = level->gems_needed;
+  cav->gems_needed     = level->gems_needed;
 
   cav->emerald_score   = level->score[SC_EMERALD];
   cav->diamond_score   = level->score[SC_DIAMOND];
@@ -3630,7 +3630,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   level->fieldy = MIN(cav->height, MAX_LEV_FIELDY);
 
   level->time        = cav->time_seconds;
-  level->gems_needed = cav->required;
+  level->gems_needed = cav->gems_needed;
 
   sprintf(level->name, "Level %d", level->file_info.nr);
 
index fbe34cc7a6eeef5328fc8bb5b85bef4a62c741fb..00c7b5e5a0befbc5821aa6305b18e993768833b9 100644 (file)
@@ -2228,14 +2228,14 @@ static void UpdateGameControlValues(void)
               game_mm.score :
               game.score);
   int gems = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
-             game_em.lev->required :
+             game_em.lev->gems_needed :
              level.game_engine_type == GAME_ENGINE_TYPE_SP ?
              game_sp.infotrons_still_needed :
              level.game_engine_type == GAME_ENGINE_TYPE_MM ?
              game_mm.kettles_still_needed :
              game.gems_still_needed);
   int exit_closed = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
-                    game_em.lev->required > 0 :
+                    game_em.lev->gems_needed > 0 :
                     level.game_engine_type == GAME_ENGINE_TYPE_SP ?
                     game_sp.infotrons_still_needed > 0 :
                     level.game_engine_type == GAME_ENGINE_TYPE_MM ?
index 821602ed328b8428e3be90848da547e7c215e8f3..42d2eb0aa63cad7c031188a39e63261472fb95e3 100644 (file)
@@ -29,16 +29,16 @@ void setLevelInfoToDefaults_EM(void)
   }
 
   cav.time_seconds     = 0;
-  cav.required         = 0;
+  cav.gems_needed      = 0;
 
   cav.eater_score      = 0;
   cav.alien_score      = 0;
   cav.bug_score                = 0;
   cav.tank_score       = 0;
+  cav.slurp_score      = 0;
+  cav.nut_score                = 0;
   cav.emerald_score    = 0;
   cav.diamond_score    = 0;
-  cav.nut_score                = 0;
-  cav.slurp_score      = 0;
   cav.dynamite_score   = 0;
   cav.key_score                = 0;
   cav.lenses_score     = 0;
index 133681c689f8bc5f84c4d01bb2115f9449aff3f3..28984d6de1f8be6b6549a29984f776bf695518ba 100644 (file)
@@ -15,16 +15,16 @@ struct CAVE
   int player_y[MAX_PLAYERS];   /* player y pos */
 
   int time_seconds;            /* available time (seconds) */
-  int required;                        /* emeralds needed */
+  int gems_needed;             /* emeralds needed */
 
   int eater_score;             /* score for killing eater */
   int alien_score;             /* score for killing alien */
   int bug_score;               /* score for killing bug */
   int tank_score;              /* score for killing tank */
+  int slurp_score;             /* score for slurping alien with spring */
+  int nut_score;               /* score for cracking nut to emerald */
   int emerald_score;           /* score for collecting emerald */
   int diamond_score;           /* score for collecting diamond */
-  int nut_score;               /* score for cracking nut */
-  int slurp_score;             /* score for slurping alien with spring */
   int dynamite_score;          /* score for collecting dynamite */
   int key_score;               /* score for colleting key */
   int lenses_score;            /* score for collecting lenses */
index 7d5d3ef04c3e794d7477eafba01fbc86c41d8c0e..509437c7a40db680e35c75bf79772c3498ec3849 100644 (file)
@@ -48,8 +48,7 @@ void prepare_em_level(void)
       lev.next[x][y] = lev.draw[x][y] = lev.cave[x][y];
 
   lev.time = cav.time_seconds;
-
-  lev.required = cav.required;
+  lev.gems_needed = cav.gems_needed;
   lev.score = 0;
 
   lev.eater_score      = cav.eater_score;
index 13854ac2868da25bccbf798eeec5f920d5efd532..b3f285a9d3d5c3803404787b88ab551d4a36f858 100644 (file)
@@ -629,17 +629,17 @@ struct LOGIC
   int bottom;                  /* cave bottom edge */
 
   int time;                    /* time remaining */
-  int required;                        /* emeralds needed */
+  int gems_needed;             /* emeralds needed */
   int score;                   /* score */
 
   int eater_score;             /* score for killing eater */
   int alien_score;             /* score for killing alien */
   int bug_score;               /* score for killing bug */
   int tank_score;              /* score for killing tank */
+  int slurp_score;             /* score for slurping alien with spring */
+  int nut_score;               /* score for cracking nut to emerald */
   int emerald_score;           /* score for collecting emerald */
   int diamond_score;           /* score for collecting diamond */
-  int nut_score;               /* score for cracking nut */
-  int slurp_score;             /* score for slurping alien with spring */
   int dynamite_score;          /* score for collecting dynamite */
   int key_score;               /* score for colleting key */
   int lenses_score;            /* score for collecting lenses */
index bfe1d8436e78a4a03b4117bdf5e26e875412e790..ae3a9541517d078149f94306388afc8ebca175a9 100644 (file)
@@ -533,7 +533,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Zplayer;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.diamond_score;
-       lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        ply->x = x;
@@ -546,7 +546,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Zplayer;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.emerald_score;
-       lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        ply->x = x;
@@ -1124,7 +1124,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.diamond_score;
-       lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        break;
@@ -1135,7 +1135,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.emerald_score;
-       lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        break;
@@ -6551,7 +6551,7 @@ static void Lslide_ew(int x, int y)
 
 static void Lexit(int x, int y)
 {
-  if (lev.required > 0)
+  if (lev.gems_needed > 0)
     return;
 
   switch (RANDOM(64) / 21)
index 705de11d5fc26161d9b6c199bb68b9ded9b7856e..c052ea98a2014829398ad4adf2258571a5dbb6f0 100644 (file)
@@ -333,7 +333,7 @@ void convert_em_level(unsigned char *src, int file_version)
   if (cav.time_seconds > 9999)
     cav.time_seconds = 9999;
 
-  cav.required = src[2095];
+  cav.gems_needed = src[2095];
 
   /* scores */