void GetPlayerConfig()
{
if (!audio.sound_available)
- setup.sound = FALSE;
+ setup.sound_simple = FALSE;
if (!audio.loops_available)
setup.sound_loops = FALSE;
if (!video.fullscreen_available)
setup.fullscreen = FALSE;
- setup.sound_simple = setup.sound;
+ setup.sound = (setup.sound_simple || setup.sound_loops || setup.sound_music);
SetAudioMode(setup.sound);
InitJoysticks();
{
int start_x = 0, start_y = 0;
int found_rating = 0;
+ int found_element = EL_UNDEFINED;
- for(y=0; y < lev_fieldy; y++)
+ for(y=0; y < lev_fieldy; y++) for(x=0; x < lev_fieldx; x++)
{
- for(x=0; x < lev_fieldx; x++)
+ int element = Feld[x][y];
+ int content;
+ int xx, yy;
+ boolean is_player;
+
+ if (!IS_CUSTOM_ELEMENT(element))
+ continue;
+
+ if (CAN_CHANGE(element))
{
- int element = Feld[x][y];
+ content = element_info[element].change.target_element;
+ is_player = ELEM_IS_PLAYER(content);
- if (IS_CUSTOM_ELEMENT(element))
+ if (is_player && (found_rating < 3 || element < found_element))
{
- int xx, yy;
+ start_x = x;
+ start_y = y;
- for(yy=0; yy < 3; yy++)
- {
- for(xx=0; xx < 3; xx++)
- {
- int content;
- boolean is_player;
+ found_rating = 3;
+ found_element = element;
+ }
+ }
- content = element_info[element].content[xx][yy];
- is_player = (ELEM_IS_PLAYER(content) || content == EL_SP_MURPHY);
+ for(yy=0; yy < 3; yy++) for(xx=0; xx < 3; xx++)
+ {
+ content = element_info[element].content[xx][yy];
+ is_player = ELEM_IS_PLAYER(content);
- if (is_player && found_rating < 2)
- {
- start_x = x + xx - 1;
- start_y = y + yy - 1;
+ if (is_player && (found_rating < 2 || element < found_element))
+ {
+ start_x = x + xx - 1;
+ start_y = y + yy - 1;
- found_rating = 2;
- }
+ found_rating = 2;
+ found_element = element;
+ }
- content = element_info[element].change.content[xx][yy];
- is_player = (ELEM_IS_PLAYER(content) || content == EL_SP_MURPHY);
+ if (!CAN_CHANGE(element))
+ continue;
- if (is_player && found_rating < 1)
- {
- start_x = x + xx - 1;
- start_y = y + yy - 1;
+ content = element_info[element].change.content[xx][yy];
+ is_player = ELEM_IS_PLAYER(content);
- found_rating = 1;
- }
- }
- }
+ if (is_player && (found_rating < 1 || element < found_element))
+ {
+ start_x = x + xx - 1;
+ start_y = y + yy - 1;
+
+ found_rating = 1;
+ found_element = element;
}
}
}
}
RemoveField(player->jx, player->jy);
+ DrawLevelField(player->jx, player->jy);
}
InitPlayerField(x, y, element, TRUE);
if (player == local_player)
{
- scroll_x = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left :
- local_player->jx > SBX_Right + MIDPOSX ? SBX_Right :
- local_player->jx - MIDPOSX);
+ int scroll_xx = -999, scroll_yy = -999;
- scroll_y = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
- local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
- local_player->jy - MIDPOSY);
- }
+ while (scroll_xx != scroll_x || scroll_yy != scroll_y)
+ {
+ int dx = 0, dy = 0;
+ int fx = FX, fy = FY;
- DrawLevel();
+ scroll_xx = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left :
+ local_player->jx > SBX_Right + MIDPOSX ? SBX_Right :
+ local_player->jx - MIDPOSX);
+
+ scroll_yy = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
+ local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
+ local_player->jy - MIDPOSY);
+
+ dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0);
+ dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0);
+
+ scroll_x -= dx;
+ scroll_y -= dy;
+
+ fx += dx * TILEX / 2;
+ fy += dy * TILEY / 2;
+
+ ScrollLevel(dx, dy);
+ DrawAllPlayers();
+
+ /* scroll in to steps of half tile size to make things smoother */
+ BlitBitmap(drawto_field, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ FlushDisplay();
+ Delay(GAME_FRAME_DELAY);
+
+ /* scroll second step to align at full tile size */
+ BackToFront();
+ Delay(GAME_FRAME_DELAY);
+ }
+ }
}
void Explode(int ex, int ey, int phase, int mode)
static void ChangeElementNowExt(int x, int y, int target_element)
{
-#if 0 /* !!! let the player exacpe from a suddenly unaccessible element */
+#if 1
+ /* check if the new element is unaccessible for the player */
if (IS_PLAYER(x, y) && !IS_ACCESSIBLE(target_element))
{
Bang(x, y);
TestIfBadThingTouchesHero(x, y);
TestIfPlayerTouchesCustomElement(x, y);
TestIfElementTouchesCustomElement(x, y);
+
+ if (ELEM_IS_PLAYER(target_element))
+ RelocatePlayer(x, y, target_element);
}
static void ChangeElementNow(int x, int y, int element)
int x, y;
BlitBitmap(drawto_field, drawto_field,
- FX + TILEX*(dx == -1) - softscroll_offset,
- FY + TILEY*(dy == -1) - softscroll_offset,
- SXSIZE - TILEX*(dx!=0) + 2*softscroll_offset,
- SYSIZE - TILEY*(dy!=0) + 2*softscroll_offset,
- FX + TILEX*(dx == 1) - softscroll_offset,
- FY + TILEY*(dy == 1) - softscroll_offset);
+ FX + TILEX * (dx == -1) - softscroll_offset,
+ FY + TILEY * (dy == -1) - softscroll_offset,
+ SXSIZE - TILEX * (dx!=0) + 2 * softscroll_offset,
+ SYSIZE - TILEY * (dy!=0) + 2 * softscroll_offset,
+ FX + TILEX * (dx == 1) - softscroll_offset,
+ FY + TILEY * (dy == 1) - softscroll_offset);
if (dx)
{
x = (dx == 1 ? BX1 : BX2);
- for (y=BY1; y<=BY2; y++)
+ for (y=BY1; y <= BY2; y++)
DrawScreenField(x, y);
}
if (dy)
{
y = (dy == 1 ? BY1 : BY2);
- for (x=BX1; x<=BX2; x++)
+ for (x=BX1; x <= BX2; x++)
DrawScreenField(x, y);
}
if (can_move != MF_MOVING)
return can_move;
+ /* check if DigField() has caused relocation of the player */
+ if (player->jx != jx || player->jy != jy)
+ return MF_NO_ACTION;
+
StorePlayer[jx][jy] = 0;
player->last_jx = jx;
player->last_jy = jy;
if (Feld[jx][jy] == EL_EXIT_OPEN ||
Feld[jx][jy] == EL_SP_EXIT_OPEN)
{
+ DrawPlayer(player); /* needed here only to cleanup last field */
RemoveHero(player);
if (local_player->friends_still_needed == 0 ||