X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame.c;h=a88b3f04ec1a8525e904b45e13418c94580ea9c3;hp=aeb40a51fcc369b0e06378145c6891669790cc84;hb=1e422c29292f0583391b0ce9e9c872b38f035ac0;hpb=c6d59064aa782b8ad71eddac2797fdc50e4858f9 diff --git a/src/game.c b/src/game.c index aeb40a51..a88b3f04 100644 --- a/src/game.c +++ b/src/game.c @@ -2539,8 +2539,15 @@ void DisplayGameControlValues() 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 @@ -4539,8 +4546,24 @@ void InitGame() 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(); @@ -8115,7 +8138,7 @@ void StartMoving(int x, int y) 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]) { @@ -8143,7 +8166,7 @@ void StartMoving(int x, int 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]) { @@ -8171,7 +8194,7 @@ void StartMoving(int x, int 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]) { @@ -11998,6 +12021,20 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting) } } +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; @@ -12025,23 +12062,7 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action) 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); @@ -12065,6 +12086,8 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action) player->is_dropping_pressed = FALSE; player->drop_pressed_delay = 0; + CheckSingleStepMode(player); + return 0; } } @@ -13345,8 +13368,29 @@ void ScrollLevel(int dx, int dy) #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, @@ -13355,6 +13399,8 @@ void ScrollLevel(int dx, int dy) FX + TILEX * (dx == 1) - softscroll_offset, FY + TILEY * (dy == 1) - softscroll_offset); #endif + +#endif #endif if (dx != 0) @@ -16694,98 +16740,38 @@ boolean CheckEngineSnapshot() /* ---------- 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" + IMG_GAME_BUTTON_GFX_STOP, &game.button.stop, + GAME_CTRL_ID_STOP, "stop 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" + IMG_GAME_BUTTON_GFX_PAUSE, &game.button.pause, + GAME_CTRL_ID_PAUSE, "pause game" }, { - &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" + IMG_GAME_BUTTON_GFX_PLAY, &game.button.play, + GAME_CTRL_ID_PLAY, "play game" }, { - &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" - }, - { - GAME_BUTTON_PAUSE_XPOS, GAME_BUTTON_YPOS, - GAME_CTRL_ID_PAUSE, - "pause game" - }, - { - GAME_BUTTON_PLAY_XPOS, GAME_BUTTON_YPOS, - GAME_CTRL_ID_PLAY, - "play game" + IMG_GAME_BUTTON_GFX_SOUND_MUSIC, &game.button.sound_music, + SOUND_CTRL_ID_MUSIC, "background music on/off" }, { - SOUND_BUTTON_MUSIC_XPOS, SOUND_BUTTON_YPOS, - SOUND_CTRL_ID_MUSIC, - "background music on/off" + IMG_GAME_BUTTON_GFX_SOUND_LOOPS, &game.button.sound_loops, + SOUND_CTRL_ID_LOOPS, "sound loops on/off" }, { - SOUND_BUTTON_LOOPS_XPOS, SOUND_BUTTON_YPOS, - 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() @@ -16794,23 +16780,22 @@ 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) @@ -16818,8 +16803,6 @@ void CreateGameButtons() 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 { @@ -16829,28 +16812,21 @@ void CreateGameButtons() (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,