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

index 15f43aa6d8d5218c38765930beff51dfd7a94ecf..5958d83ca30b1970050899ee34e3f13974533e61 100644 (file)
@@ -3521,8 +3521,8 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   cav->width  = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH);
   cav->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT);
 
-  cav->time_seconds     = level->time;
-  cav->required_initial = level->gems_needed;
+  cav->time_seconds    = level->time;
+  cav->required                = level->gems_needed;
 
   cav->emerald_score   = level->score[SC_EMERALD];
   cav->diamond_score   = level->score[SC_DIAMOND];
@@ -3542,13 +3542,13 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
          map_element_RND_to_EM(level->yamyam_content[i].e[x][y]);
 
   cav->amoeba_time             = level->amoeba_speed;
-  cav->wonderwall_time_initial = level->time_magic_wall;
+  cav->wonderwall_time         = level->time_magic_wall;
   cav->wheel_time              = level->time_wheel;
 
   cav->android_move_time       = level->android_move_time;
   cav->android_clone_time      = level->android_clone_time;
   cav->ball_random             = level->ball_random;
-  cav->ball_state_initial      = level->ball_state_initial;
+  cav->ball_state              = level->ball_state_initial;
   cav->ball_time               = level->ball_time;
   cav->num_ball_arrays         = level->num_ball_contents;
 
@@ -3559,10 +3559,10 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   cav->lenses_time             = level->lenses_time;
   cav->magnify_time            = level->magnify_time;
 
-  cav->wind_direction_initial =
+  cav->wind_direction =
     map_direction_RND_to_EM(level->wind_direction_initial);
-  cav->wind_cnt_initial = (level->wind_direction_initial != MV_NONE ?
-                          cav->wind_time : 0);
+  cav->wind_cnt = (level->wind_direction_initial != MV_NONE ?
+                  cav->wind_time : 0);
 
   for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
     for (j = 0; j < 8; j++)
@@ -3575,7 +3575,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   // first fill the complete playfield with the default border element
   for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
     for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
-      cav->cave_raw[x][y] = Zborder;
+      cav->cave[x][y] = Zborder;
 
   // then copy the real level contents from level file into the playfield
   for (y = 0; y < cav->height; y++) for (x = 0; x < cav->width; x++)
@@ -3585,7 +3585,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
     if (level->field[x][y] == EL_AMOEBA_DEAD)
       new_element = map_element_RND_to_EM(EL_AMOEBA_WET);
 
-    cav->cave_raw[x][y] = new_element;
+    cav->cave[x][y] = new_element;
   }
 
   for (i = 0; i < MAX_PLAYERS; i++)
@@ -3604,7 +3604,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
       cav->player_x[player_nr] = x;
       cav->player_y[player_nr] = y;
 
-      cav->cave_raw[x][y] = map_element_RND_to_EM(EL_EMPTY);
+      cav->cave[x][y] = map_element_RND_to_EM(EL_EMPTY);
     }
   }
 }
@@ -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_initial;
+  level->gems_needed = cav->required;
 
   sprintf(level->name, "Level %d", level->file_info.nr);
 
@@ -3654,13 +3654,13 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
          map_element_EM_to_RND(cav->eater_array[i][y * 3 + x]);
 
   level->amoeba_speed          = cav->amoeba_time;
-  level->time_magic_wall       = cav->wonderwall_time_initial;
+  level->time_magic_wall       = cav->wonderwall_time;
   level->time_wheel            = cav->wheel_time;
 
   level->android_move_time     = cav->android_move_time;
   level->android_clone_time    = cav->android_clone_time;
   level->ball_random           = cav->ball_random;
-  level->ball_state_initial    = cav->ball_state_initial;
+  level->ball_state_initial    = cav->ball_state;
   level->ball_time             = cav->ball_time;
   level->num_ball_contents     = cav->num_ball_arrays;
 
@@ -3672,7 +3672,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   level->magnify_time          = cav->magnify_time;
 
   level->wind_direction_initial =
-    map_direction_EM_to_RND(cav->wind_direction_initial);
+    map_direction_EM_to_RND(cav->wind_direction);
 
   for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
     for (j = 0; j < 8; j++)
@@ -3684,7 +3684,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   // convert the playfield (some elements need special treatment)
   for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
   {
-    int new_element = map_element_EM_to_RND(cav->cave_raw[x][y]);
+    int new_element = map_element_EM_to_RND(cav->cave[x][y]);
 
     if (new_element == EL_AMOEBA_WET && level->amoeba_speed == 0)
       new_element = EL_AMOEBA_DEAD;
index de52ccf68934eae40b2df656938e2e852903bc9a..43732aa1ccd6b6cf2981a3680990c234919609e7 100644 (file)
@@ -28,29 +28,23 @@ void setLevelInfoToDefaults_EM(void)
     cav.player_y[i] = -1;
   }
 
-  cav.lenses_cnt_initial = 0;
-  cav.magnify_cnt_initial = 0;
+  cav.lenses_cnt = 0;
+  cav.magnify_cnt = 0;
 
-  cav.wheel_cnt_initial = 0;
-  cav.wheel_x_initial = 1;
-  cav.wheel_y_initial = 1;
+  cav.wheel_cnt = 0;
+  cav.wheel_x = 1;
+  cav.wheel_y = 1;
 
   cav.wind_time = 9999;
-  cav.wind_cnt_initial = 0;
+  cav.wind_cnt = 0;
 
-  cav.wonderwall_state_initial = 0;
-  cav.wonderwall_time_initial = 0;
+  cav.wonderwall_state = 0;
+  cav.wonderwall_time = 0;
 
   cav.num_ball_arrays = 8;
 
   for (i = 0; i < TILE_MAX; i++)
     cav.android_array[i] = Xblank;
-
-  for (i = 0; i < MAX_PLAYERS; i++)
-  {
-    ply[i].exists = 0;
-    ply[i].alive_initial = FALSE;
-  }
 }
 
 
index 936f2848fa1b211af2832eebf5d293202f1df112..36446707261a822830078df26832c62380981836 100644 (file)
@@ -8,25 +8,25 @@
 
 struct CAVE
 {
-  int width;                   /* playfield width */
-  int height;                  /* playfield height */
+  int width;                   /* cave width */
+  int height;                  /* cave height */
 
   int player_x[MAX_PLAYERS];   /* player x pos */
   int player_y[MAX_PLAYERS];   /* player y pos */
 
   int time_seconds;            /* available time (seconds) */
-  int required_initial;                /* emeralds needed */
+  int required;                        /* emeralds needed */
 
   int alien_score;             /* score for killing alien */
   int amoeba_time;             /* amoeba speed */
-  int android_move_cnt_initial;        /* android move counter (initial) */
+  int android_move_cnt;                /* android move counter */
   int android_move_time;       /* android move reset time */
-  int android_clone_cnt_initial;/* android clone counter (initial) */
+  int android_clone_cnt;       /* android clone counter */
   int android_clone_time;      /* android clone reset time */
   int ball_cnt;                        /* ball counter */
   int ball_pos;                        /* ball array pos counter */
   int ball_random;             /* ball is random flag */
-  int ball_state_initial;      /* ball active flag (initial) */
+  int ball_state;              /* ball active flag */
   int ball_time;               /* ball reset time */
   int bug_score;               /* score for killing bug */
   int diamond_score;           /* score for collecting diamond */
@@ -36,25 +36,25 @@ struct CAVE
   int emerald_score;           /* score for collecting emerald */
   int exit_score;              /* score for entering exit */
   int key_score;               /* score for colleting key */
-  int lenses_cnt_initial;      /* lenses counter (initial) */
+  int lenses_cnt;              /* lenses counter */
   int lenses_score;            /* score for collecting lenses */
   int lenses_time;             /* lenses reset time */
-  int magnify_cnt_initial;     /* magnify counter (initial) */
+  int magnify_cnt;             /* magnify counter */
   int magnify_score;           /* score for collecting magnifier */
   int magnify_time;            /* magnify reset time */
   int nut_score;               /* score for cracking nut */
   int shine_cnt;               /* shine counter for emerald/diamond */
   int slurp_score;             /* score for slurping alien */
   int tank_score;              /* score for killing tank */
-  int wheel_cnt_initial;       /* wheel counter (initial) */
-  int wheel_x_initial;         /* wheel x pos (initial) */
-  int wheel_y_initial;         /* wheel y pos (initial) */
+  int wheel_cnt;               /* wheel counter */
+  int wheel_x;                 /* wheel x pos */
+  int wheel_y;                 /* wheel y pos */
   int wheel_time;              /* wheel reset time */
-  int wind_cnt_initial;                /* wind counter (initial) */
-  int wind_direction_initial;  /* wind direction (initial) */
+  int wind_cnt;                        /* wind time counter */
+  int wind_direction;          /* wind direction */
   int wind_time;               /* wind reset time */
-  int wonderwall_state_initial;        /* wonderwall active flag (initial) */
-  int wonderwall_time_initial; /* wonderwall time (initial) */
+  int wonderwall_state;                /* wonderwall active flag */
+  int wonderwall_time;         /* wonderwall time */
 
   int num_ball_arrays;         /* number of ball data arrays used */
 
@@ -62,7 +62,7 @@ struct CAVE
   short ball_array[8][8];              /* ball data */
   short android_array[TILE_MAX];       /* android clone table */
 
-  short cave_raw[CAVE_WIDTH][CAVE_HEIGHT];
+  short cave[CAVE_WIDTH][CAVE_HEIGHT]; /* cave data */
 };
 
 #endif // CAVE_H
index 3510b25ff8acda889d0622ac6a5082b500060b6b..7d5d3ef04c3e794d7477eafba01fbc86c41d8c0e 100644 (file)
@@ -41,7 +41,7 @@ void prepare_em_level(void)
 
   for (x = 0; x < lev.width; x++)
     for (y = 0; y < lev.height; y++)
-      lev.cave[lev.left + x][lev.top + y] = cav.cave_raw[x][y];
+      lev.cave[lev.left + x][lev.top + y] = cav.cave[x][y];
 
   for (x = lev.left; x < lev.right; x++)
     for (y = lev.top; y < lev.bottom; y++)
@@ -49,7 +49,7 @@ void prepare_em_level(void)
 
   lev.time = cav.time_seconds;
 
-  lev.required = cav.required_initial;
+  lev.required = cav.required;
   lev.score = 0;
 
   lev.eater_score      = cav.eater_score;
@@ -76,7 +76,7 @@ void prepare_em_level(void)
 
   lev.ball_time   = cav.ball_time;
   lev.ball_cnt    = cav.ball_time;
-  lev.ball_state  = cav.ball_state_initial;
+  lev.ball_state  = cav.ball_state;
   lev.ball_random = cav.ball_random;
   lev.ball_pos    = 0;
 
@@ -84,22 +84,22 @@ void prepare_em_level(void)
   lev.shine_cnt = 0;
 
   lev.lenses_time = cav.lenses_time;
-  lev.lenses_cnt  = cav.lenses_cnt_initial;
+  lev.lenses_cnt  = cav.lenses_cnt;
 
   lev.magnify_time = cav.magnify_time;
-  lev.magnify_cnt  = cav.magnify_cnt_initial;
+  lev.magnify_cnt  = cav.magnify_cnt;
 
   lev.wheel_time = cav.wheel_time;
-  lev.wheel_cnt  = cav.wheel_cnt_initial;
-  lev.wheel_x    = cav.wheel_x_initial;
-  lev.wheel_y    = cav.wheel_y_initial;
+  lev.wheel_cnt  = cav.wheel_cnt;
+  lev.wheel_x    = cav.wheel_x;
+  lev.wheel_y    = cav.wheel_y;
 
   lev.wind_time      = cav.wind_time;
-  lev.wind_cnt       = cav.wind_cnt_initial;
-  lev.wind_direction = cav.wind_direction_initial;
+  lev.wind_cnt       = cav.wind_cnt;
+  lev.wind_direction = cav.wind_direction;
 
-  lev.wonderwall_time  = cav.wonderwall_time_initial;
-  lev.wonderwall_state = cav.wonderwall_state_initial;
+  lev.wonderwall_time  = cav.wonderwall_time;
+  lev.wonderwall_state = cav.wonderwall_state;
 
   lev.killed_out_of_time = FALSE;
 
index 38a2656f29ca7fd2d31b882cd5a063e52132c4fe..b2fbc165be4e28fcee7c740892b561a4a55ad057 100644 (file)
@@ -620,13 +620,13 @@ enum
 
 struct LOGIC
 {
-  int width;                   /* playfield width */
-  int height;                  /* playfield height */
+  int width;                   /* cave width */
+  int height;                  /* cave height */
 
-  int left;                    /* playfield left edge */
-  int top;                     /* playfield top edge */
-  int right;                   /* playfield right edge */
-  int bottom;                  /* playfield bottom edge */
+  int left;                    /* cave left edge */
+  int top;                     /* cave top edge */
+  int right;                   /* cave right edge */
+  int bottom;                  /* cave bottom edge */
 
   int time;                    /* time remaining */
   int required;                        /* emeralds needed */
index 0ee0e17b0dfdd26bcf722233195df85877e87be0..705de11d5fc26161d9b6c199bb68b9ded9b7856e 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_initial = src[2095];
+  cav.required = src[2095];
 
   /* scores */
 
@@ -367,40 +367,40 @@ void convert_em_level(unsigned char *src, int file_version)
     temp = 9999;
   cav.amoeba_time = temp;
 
-  cav.wonderwall_time_initial = GET_BE16(src[2102]);
+  cav.wonderwall_time = GET_BE16(src[2102]);
 
-  cav.wind_cnt_initial = src[2149] & 15 ? cav.wind_time : 0;
+  cav.wind_cnt = src[2149] & 15 ? cav.wind_time : 0;
   temp = src[2149];
-  cav.wind_direction_initial = (temp & 8 ? 0 :
-                               temp & 1 ? 1 :
-                               temp & 2 ? 2 :
-                               temp & 4 ? 3 : 0);
+  cav.wind_direction = (temp & 8 ? 0 :
+                       temp & 1 ? 1 :
+                       temp & 2 ? 2 :
+                       temp & 4 ? 3 : 0);
   /* global flags */
 
-  cav.ball_random       = src[2162] & 1   ? 1 : 0;
-  cav.ball_state_initial = src[2162] & 128 ? 1 : 0;
+  cav.ball_random = src[2162] & 1   ? 1 : 0;
+  cav.ball_state  = src[2162] & 128 ? 1 : 0;
 
   for (temp = 1; temp < 2047; temp++)
   {
     switch (src[temp])
     {
       case 36:                                 /* wonderwall */
-       cav.wonderwall_state_initial = 1;
-       cav.wonderwall_time_initial = 9999;
+       cav.wonderwall_state = 1;
+       cav.wonderwall_time = 9999;
        break;
 
       case 40:                                 /* wheel */
-       cav.wheel_x_initial = temp & 63;
-       cav.wheel_y_initial = temp >> 6;
-       cav.wheel_cnt_initial = cav.wheel_time;
+       cav.wheel_x = temp & 63;
+       cav.wheel_y = temp >> 6;
+       cav.wheel_cnt = cav.wheel_time;
        break;
 
       case 163:                                        /* fake blank */
-       cav.lenses_cnt_initial = 9999;
+       cav.lenses_cnt = 9999;
        break;
 
       case 164:                                        /* fake grass */
-       cav.magnify_cnt_initial = 9999;
+       cav.magnify_cnt = 9999;
        break;
     }
   }
@@ -456,18 +456,18 @@ void convert_em_level(unsigned char *src, int file_version)
   /* first fill the complete playfield with the default border element */
   for (y = 0; y < CAVE_HEIGHT; y++)
     for (x = 0; x < CAVE_WIDTH; x++)
-      cav.cave_raw[x][y] = Zborder;
+      cav.cave[x][y] = Zborder;
 
   /* then copy the real level contents from level file into the playfield */
   temp = 0;
   for (y = 0; y < cav.height; y++)
     for (x = 0; x < cav.width; x++)
-      cav.cave_raw[x][y] = map_emc[src[temp++]];
+      cav.cave[x][y] = map_emc[src[temp++]];
 
   /* at last, set the two players at their positions in the playfield */
   /* (native EM[C] levels always have exactly two players in a level) */
   for (i = 0; i < 2; i++)
-    cav.cave_raw[cav.player_x[i]][cav.player_y[i]] = Zplayer;
+    cav.cave[cav.player_x[i]][cav.player_y[i]] = Zplayer;
 
   native_em_level.file_version = file_version;
 }