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];
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;
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++)
// 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++)
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++)
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);
}
}
}
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);
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;
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++)
// 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;
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;
- }
}
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 */
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 */
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
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++)
lev.time = cav.time_seconds;
- lev.required = cav.required_initial;
+ lev.required = cav.required;
lev.score = 0;
lev.eater_score = cav.eater_score;
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;
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;
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 */
if (cav.time_seconds > 9999)
cav.time_seconds = 9999;
- cav.required_initial = src[2095];
+ cav.required = src[2095];
/* scores */
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;
}
}
/* 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;
}