return;
/* copy default game door content to main double buffer */
+#if 1
+ /* !!! CHECK AGAIN !!! */
+ SetPanelBackground();
+ // SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
+ DrawBackground(DX, DY, DXSIZE, DYSIZE);
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+#endif
/* redraw game control buttons */
#if 1
ChangeViewportPropertiesIfNeeded();
#endif
+#if 1
+ DrawCompleteVideoDisplay();
+#endif
+
InitGameEngine();
InitGameControlValues();
SBY_Lower = lev_fieldy - SCR_FIELDY + 1;
}
+#if NEW_TILESIZE
+
+ if (lev_fieldx + (SBX_Left < 0 ? 2 : 0) <= SCR_FIELDX)
+ SBX_Left = SBX_Right = -1 * (SCR_FIELDX - lev_fieldx) / 2;
+
+ if (lev_fieldy + (SBY_Upper < 0 ? 2 : 0) <= SCR_FIELDY)
+ SBY_Upper = SBY_Lower = -1 * (SCR_FIELDY - lev_fieldy) / 2;
+
+ if (EVEN(SCR_FIELDX))
+ SBX_Left--;
+ if (EVEN(SCR_FIELDY))
+ SBY_Upper--;
+
+#else
+
if (lev_fieldx + (SBX_Left == -1 ? 2 : 0) <= SCR_FIELDX)
SBX_Left = SBX_Right = -1 * (SCR_FIELDX - lev_fieldx) / 2;
if (lev_fieldy + (SBY_Upper == -1 ? 2 : 0) <= SCR_FIELDY)
SBY_Upper = SBY_Lower = -1 * (SCR_FIELDY - lev_fieldy) / 2;
+#endif
/* if local player not found, look for custom element that might create
the player (make some assumptions about the right custom element) */
local_player->jy - MIDPOSY);
}
+#if 0
+ printf("::: %d, %d (initial)\n", scroll_x, scroll_y);
+#endif
+
#if 0
/* do not use PLAYING mask for fading out from main screen */
game_status = GAME_MODE_MAIN;
if (game.timegate_time_left == 0)
CloseAllOpenTimegates();
+#if NEW_TILESIZE
+ BlitScreenToBitmap(backbuffer);
+#else
/* blit playfield from scroll buffer to normal back buffer for fading in */
if (setup.soft_scrolling)
BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+#endif
redraw_mask |= REDRAW_FROM_BACKBUFFER;
}
if (!game.restart_level)
{
/* copy default game door content to main double buffer */
+#if 1
+#if 1
+ /* !!! CHECK AGAIN !!! */
+ SetPanelBackground();
+ // SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
+ DrawBackground(DX, DY, DXSIZE, DYSIZE);
+#else
+ struct GraphicInfo *gfx = &graphic_info[IMG_BACKGROUND_PANEL];
+
+ /* (ClearRectangle() only needed if panel bitmap is smaller than panel) */
+ ClearRectangle(drawto, DX, DY, DXSIZE, DYSIZE);
+ BlitBitmap(gfx->bitmap, drawto, gfx->src_x, gfx->src_y,
+ MIN(gfx->width, DXSIZE), MIN(gfx->height, DYSIZE), DX, DY);
+#endif
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+#endif
}
SetPanelBackground();
MapTapeButtons();
#endif
+ if (!game.restart_level && !tape.playing)
+ {
+ LevelStats_incPlayed(level_nr);
+
+ SaveLevelSetup_SeriesInfo();
+
+#if 0
+ printf("::: PLAYING LEVEL (%d)\n", LevelStats_getPlayed(level_nr));
+#endif
+ }
+
game.restart_level = FALSE;
}
local_player->LevelSolved_SaveTape = tape.recording;
local_player->LevelSolved_SaveScore = !tape.playing;
+ if (!tape.playing)
+ {
+ LevelStats_incSolved(level_nr);
+
+ SaveLevelSetup_SeriesInfo();
+
+#if 0
+ printf("::: LEVEL SOLVED (%d)\n", LevelStats_getSolved(level_nr));
+#endif
+ }
+
if (tape.auto_play) /* tape might already be stopped here */
tape.auto_play_level_solved = TRUE;
if (level_nr == leveldir_current->handicap_level)
{
leveldir_current->handicap_level++;
+
SaveLevelSetup_SeriesInfo();
}
else if (Feld[x][y + 1] == EL_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
else if (Feld[x][y + 1] == EL_BD_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
else if (Feld[x][y + 1] == EL_DC_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
}
}
+static void CheckSingleStepMode(struct PlayerInfo *player)
+{
+ if (tape.single_step && tape.recording && !tape.pausing)
+ {
+ /* as it is called "single step mode", just return to pause mode when the
+ player stopped moving after one tile (or never starts moving at all) */
+ if (!player->is_moving && !player->is_pushing)
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+ SnapField(player, 0, 0); /* stop snapping */
+ }
+ }
+}
+
static byte PlayerActions(struct PlayerInfo *player, byte player_action)
{
boolean moved = FALSE, snapped = FALSE, dropped = FALSE;
moved = MovePlayer(player, dx, dy);
}
- if (tape.single_step && tape.recording && !tape.pausing)
- {
-#if 1
- /* as it is called "single step mode", just return to pause mode when the
- player stopped moving after one tile (or never starts moving at all) */
- if (!player->is_moving)
-#else
- /* this is buggy: there are quite some cases where the single step mode
- does not return to pause mode (like pushing things that don't move
- or simply by trying to run against a wall) */
- if (button1 || (dropped && !moved))
-#endif
- {
- TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
- SnapField(player, 0, 0); /* stop snapping */
- }
- }
+ CheckSingleStepMode(player);
SetPlayerWaiting(player, FALSE);
player->is_dropping_pressed = FALSE;
player->drop_pressed_delay = 0;
+ CheckSingleStepMode(player);
+
return 0;
}
}
#else
+#if NEW_TILESIZE
+#if NEW_SCROLL
+ int softscroll_offset = (setup.soft_scrolling ? 2 * TILEX_VAR : 0);
+#else
+ int softscroll_offset = (setup.soft_scrolling ? TILEX_VAR : 0);
+#endif
+#else
+#if NEW_SCROLL
+ int softscroll_offset = (setup.soft_scrolling ? 2 * TILEX : 0);
+#else
int softscroll_offset = (setup.soft_scrolling ? TILEX : 0);
+#endif
+#endif
+#if NEW_TILESIZE
+ BlitBitmap(drawto_field, drawto_field,
+ FX + TILEX_VAR * (dx == -1) - softscroll_offset,
+ FY + TILEY_VAR * (dy == -1) - softscroll_offset,
+ SXSIZE - TILEX_VAR * (dx != 0) + 2 * softscroll_offset,
+ SYSIZE - TILEY_VAR * (dy != 0) + 2 * softscroll_offset,
+ FX + TILEX_VAR * (dx == 1) - softscroll_offset,
+ FY + TILEY_VAR * (dy == 1) - softscroll_offset);
+#else
BlitBitmap(drawto_field, drawto_field,
FX + TILEX * (dx == -1) - softscroll_offset,
FY + TILEY * (dy == -1) - softscroll_offset,
FX + TILEX * (dx == 1) - softscroll_offset,
FY + TILEY * (dy == 1) - softscroll_offset);
#endif
+
+#endif
#endif
if (dx != 0)
/* ---------- new game button stuff ---------------------------------------- */
-/* graphic position values for game buttons */
-#define GAME_BUTTON_XSIZE 30
-#define GAME_BUTTON_YSIZE 30
-#define GAME_BUTTON_XPOS 5
-#define GAME_BUTTON_YPOS 215
-#define SOUND_BUTTON_XPOS 5
-#define SOUND_BUTTON_YPOS (GAME_BUTTON_YPOS + GAME_BUTTON_YSIZE)
-
-#define GAME_BUTTON_STOP_XPOS (GAME_BUTTON_XPOS + 0 * GAME_BUTTON_XSIZE)
-#define GAME_BUTTON_PAUSE_XPOS (GAME_BUTTON_XPOS + 1 * GAME_BUTTON_XSIZE)
-#define GAME_BUTTON_PLAY_XPOS (GAME_BUTTON_XPOS + 2 * GAME_BUTTON_XSIZE)
-#define SOUND_BUTTON_MUSIC_XPOS (SOUND_BUTTON_XPOS + 0 * GAME_BUTTON_XSIZE)
-#define SOUND_BUTTON_LOOPS_XPOS (SOUND_BUTTON_XPOS + 1 * GAME_BUTTON_XSIZE)
-#define SOUND_BUTTON_SIMPLE_XPOS (SOUND_BUTTON_XPOS + 2 * GAME_BUTTON_XSIZE)
-
static struct
{
- int *x, *y;
- int gd_x, gd_y;
+ int graphic;
+ struct Rect *pos;
int gadget_id;
char *infotext;
} gamebutton_info[NUM_GAME_BUTTONS] =
{
-#if 1
- {
- &game.button.stop.x, &game.button.stop.y,
- GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_STOP,
- "stop game"
- },
- {
- &game.button.pause.x, &game.button.pause.y,
- GAME_BUTTON_PAUSE_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PAUSE,
- "pause game"
- },
- {
- &game.button.play.x, &game.button.play.y,
- GAME_BUTTON_PLAY_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PLAY,
- "play game"
- },
- {
- &game.button.sound_music.x, &game.button.sound_music.y,
- SOUND_BUTTON_MUSIC_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_MUSIC,
- "background music on/off"
- },
- {
- &game.button.sound_loops.x, &game.button.sound_loops.y,
- SOUND_BUTTON_LOOPS_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_LOOPS,
- "sound loops on/off"
- },
- {
- &game.button.sound_simple.x,&game.button.sound_simple.y,
- SOUND_BUTTON_SIMPLE_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_SIMPLE,
- "normal sounds on/off"
- }
-#else
{
- GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_STOP,
- "stop game"
+ IMG_GAME_BUTTON_GFX_STOP, &game.button.stop,
+ GAME_CTRL_ID_STOP, "stop game"
},
{
- GAME_BUTTON_PAUSE_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PAUSE,
- "pause game"
+ IMG_GAME_BUTTON_GFX_PAUSE, &game.button.pause,
+ GAME_CTRL_ID_PAUSE, "pause game"
},
{
- GAME_BUTTON_PLAY_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PLAY,
- "play game"
+ IMG_GAME_BUTTON_GFX_PLAY, &game.button.play,
+ GAME_CTRL_ID_PLAY, "play game"
},
{
- SOUND_BUTTON_MUSIC_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_MUSIC,
- "background music on/off"
+ IMG_GAME_BUTTON_GFX_SOUND_MUSIC, &game.button.sound_music,
+ SOUND_CTRL_ID_MUSIC, "background music on/off"
},
{
- SOUND_BUTTON_LOOPS_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_LOOPS,
- "sound loops on/off"
+ IMG_GAME_BUTTON_GFX_SOUND_LOOPS, &game.button.sound_loops,
+ SOUND_CTRL_ID_LOOPS, "sound loops on/off"
},
{
- SOUND_BUTTON_SIMPLE_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_SIMPLE,
- "normal sounds on/off"
+ IMG_GAME_BUTTON_GFX_SOUND_SIMPLE, &game.button.sound_simple,
+ SOUND_CTRL_ID_SIMPLE, "normal sounds on/off"
}
-#endif
};
void CreateGameButtons()
for (i = 0; i < NUM_GAME_BUTTONS; i++)
{
- Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ struct GraphicInfo *gfx = &graphic_info[gamebutton_info[i].graphic];
+ struct Rect *pos = gamebutton_info[i].pos;
struct GadgetInfo *gi;
int button_type;
boolean checked;
unsigned long event_mask;
- int x, y;
- int gd_xoffset, gd_yoffset;
- int gd_x1, gd_x2, gd_y1, gd_y2;
+ int gd_x = gfx->src_x;
+ int gd_y = gfx->src_y;
+ int gd_xp = gfx->src_x + gfx->pressed_xoffset;
+ int gd_yp = gfx->src_y + gfx->pressed_yoffset;
+ int gd_xa = gfx->src_x + gfx->active_xoffset;
+ int gd_ya = gfx->src_y + gfx->active_yoffset;
+ int gd_xap = gfx->src_x + gfx->active_xoffset + gfx->pressed_xoffset;
+ int gd_yap = gfx->src_y + gfx->active_yoffset + gfx->pressed_yoffset;
int id = i;
- x = DX + *gamebutton_info[i].x;
- y = DY + *gamebutton_info[i].y;
- gd_xoffset = gamebutton_info[i].gd_x;
- gd_yoffset = gamebutton_info[i].gd_y;
- gd_x1 = DOOR_GFX_PAGEX4 + gd_xoffset;
- gd_x2 = DOOR_GFX_PAGEX3 + gd_xoffset;
-
if (id == GAME_CTRL_ID_STOP ||
id == GAME_CTRL_ID_PAUSE ||
id == GAME_CTRL_ID_PLAY)
button_type = GD_TYPE_NORMAL_BUTTON;
checked = FALSE;
event_mask = GD_EVENT_RELEASED;
- gd_y1 = DOOR_GFX_PAGEY1 + gd_yoffset - GAME_BUTTON_YSIZE;
- gd_y2 = DOOR_GFX_PAGEY1 + gd_yoffset - GAME_BUTTON_YSIZE;
}
else
{
(id == SOUND_CTRL_ID_LOOPS && setup.sound_loops) ||
(id == SOUND_CTRL_ID_SIMPLE && setup.sound_simple) ? TRUE : FALSE);
event_mask = GD_EVENT_PRESSED;
- gd_y1 = DOOR_GFX_PAGEY1 + gd_yoffset;
- gd_y2 = DOOR_GFX_PAGEY1 + gd_yoffset - GAME_BUTTON_YSIZE;
}
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_INFO_TEXT, gamebutton_info[i].infotext,
-#if 1
- GDI_X, x,
- GDI_Y, y,
-#else
- GDI_X, DX + gd_xoffset,
- GDI_Y, DY + gd_yoffset,
-#endif
- GDI_WIDTH, GAME_BUTTON_XSIZE,
- GDI_HEIGHT, GAME_BUTTON_YSIZE,
+ GDI_X, DX + pos->x,
+ GDI_Y, DY + pos->y,
+ GDI_WIDTH, gfx->width,
+ GDI_HEIGHT, gfx->height,
GDI_TYPE, button_type,
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
- GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
- GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gfx->bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gfx->bitmap, gd_xp, gd_yp,
+ GDI_ALT_DESIGN_UNPRESSED, gfx->bitmap, gd_xa, gd_ya,
+ GDI_ALT_DESIGN_PRESSED, gfx->bitmap, gd_xap, gd_yap,
GDI_DIRECT_DRAW, FALSE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleGameButtons,