summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dd11b3a)
The internal representaion of a native Emerald Mine cave (level) does
not contain surrounding internal game engine elements anymore now
(which are only needed for game engine logic when playing the level).
The stored player positions were adjusted accordingly.
struct PLAYER **ply = level_em->ply;
int i, j, x, y;
struct PLAYER **ply = level_em->ply;
int i, j, x, y;
- lev->width = MIN(level->fieldx, EM_MAX_CAVE_BUFFER_WIDTH);
- lev->height = MIN(level->fieldy, EM_MAX_CAVE_BUFFER_HEIGHT);
+ lev->width = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH);
+ lev->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT);
lev->time_seconds = level->time;
lev->required_initial = level->gems_needed;
lev->time_seconds = level->time;
lev->required_initial = level->gems_needed;
map_android_clone_elements_RND_to_EM(level);
// first fill the complete playfield with the default border element
map_android_clone_elements_RND_to_EM(level);
// first fill the complete playfield with the default border element
- for (y = 0; y < EM_MAX_CAVE_BUFFER_HEIGHT; y++)
- for (x = 0; x < EM_MAX_CAVE_BUFFER_WIDTH; x++)
+ for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
+ for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
level_em->cave[x][y] = Zborder;
if (BorderElement == EL_STEELWALL)
{
for (y = 0; y < lev->height + 2; y++)
for (x = 0; x < lev->width + 2; x++)
level_em->cave[x][y] = Zborder;
if (BorderElement == EL_STEELWALL)
{
for (y = 0; y < lev->height + 2; y++)
for (x = 0; x < lev->width + 2; x++)
- level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_STEELWALL);
+ level_em->cave[x][y] = map_element_RND_to_EM(EL_STEELWALL);
}
// then copy the real level contents from level file into the playfield
}
// then copy the real level contents from level file into the playfield
{
int new_element = map_element_RND_to_EM(level->field[x][y]);
int offset = (BorderElement == EL_STEELWALL ? 1 : 0);
{
int new_element = map_element_RND_to_EM(level->field[x][y]);
int offset = (BorderElement == EL_STEELWALL ? 1 : 0);
- int xx = x + 1 + offset;
- int yy = y + 1 + offset;
+ int xx = x + offset;
+ int yy = y + offset;
if (level->field[x][y] == EL_AMOEBA_DEAD)
new_element = map_element_RND_to_EM(EL_AMOEBA_WET);
if (level->field[x][y] == EL_AMOEBA_DEAD)
new_element = map_element_RND_to_EM(EL_AMOEBA_WET);
for (i = 0; i < MAX_PLAYERS; i++)
{
for (i = 0; i < MAX_PLAYERS; i++)
{
- ply[i]->x_initial = 0;
- ply[i]->y_initial = 0;
+ ply[i]->x_initial = -1;
+ ply[i]->y_initial = -1;
}
// initialize player positions and delete players from the playfield
}
// initialize player positions and delete players from the playfield
{
int player_nr = GET_PLAYER_NR(level->field[x][y]);
int offset = (BorderElement == EL_STEELWALL ? 1 : 0);
{
int player_nr = GET_PLAYER_NR(level->field[x][y]);
int offset = (BorderElement == EL_STEELWALL ? 1 : 0);
- int xx = x + 1 + offset;
- int yy = y + 1 + offset;
+ int xx = x + offset;
+ int yy = y + offset;
ply[player_nr]->x_initial = xx;
ply[player_nr]->y_initial = yy;
ply[player_nr]->x_initial = xx;
ply[player_nr]->y_initial = yy;
// convert the playfield (some elements need special treatment)
for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
{
// 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(level_em->cave[x + 1][y + 1]);
+ int new_element = map_element_EM_to_RND(level_em->cave[x][y]);
if (new_element == EL_AMOEBA_WET && level->amoeba_speed == 0)
new_element = EL_AMOEBA_DEAD;
if (new_element == EL_AMOEBA_WET && level->amoeba_speed == 0)
new_element = EL_AMOEBA_DEAD;
{
// in case of all players set to the same field, use the first player
int nr = MAX_PLAYERS - i - 1;
{
// in case of all players set to the same field, use the first player
int nr = MAX_PLAYERS - i - 1;
- int jx = ply[nr]->x_initial - 1;
- int jy = ply[nr]->y_initial - 1;
+ int jx = ply[nr]->x_initial;
+ int jy = ply[nr]->y_initial;
if (jx != -1 && jy != -1)
level->field[jx][jy] = EL_PLAYER_1 + nr;
if (jx != -1 && jy != -1)
level->field[jx][jy] = EL_PLAYER_1 + nr;
for (i = 0; i < MAX_PLAYERS; i++)
{
for (i = 0; i < MAX_PLAYERS; i++)
{
- ply[i].x_initial = 0;
- ply[i].y_initial = 0;
+ ply[i].x_initial = -1;
+ ply[i].y_initial = -1;
}
lev.lenses_cnt_initial = 0;
}
lev.lenses_cnt_initial = 0;
for (i = 0; i < 2; i++)
{
temp = src[0x830 + i * 2] << 8 | src[0x831 + i * 2];
for (i = 0; i < 2; i++)
{
temp = src[0x830 + i * 2] << 8 | src[0x831 + i * 2];
- ply[i].x_initial = (temp & 63) + 1;
- ply[i].y_initial = (temp >> 6 & 31) + 1;
+ ply[i].x_initial = (temp & 63);
+ ply[i].y_initial = (temp >> 6 & 31);
}
temp = (src[0x834] << 8 | src[0x835]) * 28;
}
temp = (src[0x834] << 8 | src[0x835]) * 28;
}
/* first fill the complete playfield with the default border element */
}
/* first fill the complete playfield with the default border element */
- for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
- for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
native_em_level.cave[x][y] = Zborder;
/* then copy the real level contents from level file into the playfield */
temp = 0;
for (y = 0; y < lev.height; y++)
for (x = 0; x < lev.width; x++)
native_em_level.cave[x][y] = Zborder;
/* then copy the real level contents from level file into the playfield */
temp = 0;
for (y = 0; y < lev.height; y++)
for (x = 0; x < lev.width; x++)
- native_em_level.cave[x + 1][y + 1] =
+ native_em_level.cave[x][y] =
get_em_element(src[temp++], file_version);
/* at last, set the two players at their positions in the playfield */
get_em_element(src[temp++], file_version);
/* at last, set the two players at their positions in the playfield */
/* reset all runtime variables to their initial values */
/* reset all runtime variables to their initial values */
- for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
- for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
- lev.cave[x][y] = native_em_level.cave[x][y];
+ for (y = 0; y < CAVE_HEIGHT; y++)
+ for (x = 0; x < CAVE_WIDTH; x++)
+ lev.cave[x + CAVE_BUFFER_XOFFSET][y + CAVE_BUFFER_YOFFSET] =
+ native_em_level.cave[x][y];
for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
ply[i].exists = 0;
ply[i].alive_initial = FALSE;
ply[i].exists = 0;
ply[i].alive_initial = FALSE;
- if (ply[i].x_initial > 0 && ply[i].y_initial > 0)
+ if (ply[i].x_initial != -1 && ply[i].y_initial != -1)
native_em_level.cave[x][y] = Xblank;
native_em_level.cave[x][y] = Xblank;
- lev.cave[x][y] = lev.next[x][y] = lev.draw[x][y] = Xblank;
+ lev.cave[x + CAVE_BUFFER_XOFFSET][y + CAVE_BUFFER_YOFFSET] = Xblank;
+ lev.next[x + CAVE_BUFFER_XOFFSET][y + CAVE_BUFFER_YOFFSET] = Xblank;
+ lev.draw[x + CAVE_BUFFER_XOFFSET][y + CAVE_BUFFER_YOFFSET] = Xblank;
ply[i].dynamite_cnt = 0;
ply[i].keys = 0;
ply[i].anim = 0;
ply[i].dynamite_cnt = 0;
ply[i].keys = 0;
ply[i].anim = 0;
- ply[i].oldx = ply[i].x = ply[i].x_initial;
- ply[i].oldy = ply[i].y = ply[i].y_initial;
+ ply[i].oldx = ply[i].x = ply[i].x_initial + CAVE_BUFFER_XOFFSET;
+ ply[i].oldy = ply[i].y = ply[i].y_initial + CAVE_BUFFER_YOFFSET;
ply[i].last_move_dir = MV_NONE;
ply[i].joy_n = ply[i].joy_e = ply[i].joy_s = ply[i].joy_w = 0;
ply[i].joy_snap = ply[i].joy_drop = 0;
ply[i].last_move_dir = MV_NONE;
ply[i].joy_n = ply[i].joy_e = ply[i].joy_s = ply[i].joy_w = 0;
ply[i].joy_snap = ply[i].joy_drop = 0;
// constant definitions
// ----------------------------------------------------------------------------
// constant definitions
// ----------------------------------------------------------------------------
-#define EM_MAX_CAVE_BUFFER_WIDTH CAVE_BUFFER_WIDTH
-#define EM_MAX_CAVE_BUFFER_HEIGHT CAVE_BUFFER_HEIGHT
+#define EM_MAX_CAVE_WIDTH CAVE_WIDTH
+#define EM_MAX_CAVE_HEIGHT CAVE_HEIGHT
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
- short cave[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
+ short cave[CAVE_WIDTH][CAVE_HEIGHT];
struct LEVEL *lev;
struct PLAYER *ply[MAX_PLAYERS];
struct LEVEL *lev;
struct PLAYER *ply[MAX_PLAYERS];