X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=0b731c327dc35ad1276082b0193367580f70fac3;hb=4c23826c2c9f8f6c7d1fec69769ba0d7254c9a7c;hp=14e6445da7ccb717999e5b7574d8d85b443f1418;hpb=40864847307c459d5998dfd639e7a014890d72fa;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 14e6445d..0b731c32 100644 --- a/src/game.c +++ b/src/game.c @@ -176,6 +176,9 @@ void GetPlayerConfig() setup.sound_music = FALSE; } + if (!fullscreen_available) + setup.fullscreen = FALSE; + setup.sound_simple = setup.sound; InitJoysticks(); @@ -502,7 +505,7 @@ void InitGame() network_player_action_received = FALSE; -#ifndef MSDOS +#if !defined(MSDOS) && !defined(WIN32) /* initial null action */ if (network_playing) SendToServer_MovePlayer(MV_NO_MOVING); @@ -709,20 +712,18 @@ void InitGame() DrawAllPlayers(); FadeToFront(); - /* after drawing the level, corect some elements */ - + /* after drawing the level, correct some elements */ if (game.timegate_time_left == 0) CloseAllOpenTimegates(); if (setup.soft_scrolling) - XCopyArea(display, fieldbuffer, backbuffer, gc, - FX, FY, SXSIZE, SYSIZE, SX, SY); + BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); redraw_mask |= REDRAW_FROM_BACKBUFFER; /* copy default game door content to main double buffer */ - XCopyArea(display, pix[PIX_DOOR], drawto, gc, - DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); + BlitBitmap(pix[PIX_DOOR], drawto, + DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); if (level_nr < 100) DrawText(DX + XX_LEVEL, DY + YY_LEVEL, @@ -731,10 +732,10 @@ void InitGame() { DrawTextExt(drawto, gc, DX + XX_EMERALDS, DY + YY_EMERALDS, int2str(level_nr, 3), FS_SMALL, FC_SPECIAL3); - XCopyArea(display, drawto, drawto, gc, - DX + XX_EMERALDS, DY + YY_EMERALDS + 1, - FONT5_XSIZE * 3, FONT5_YSIZE - 1, - DX + XX_LEVEL - 1, DY + YY_LEVEL + 1); + BlitBitmap(drawto, drawto, + DX + XX_EMERALDS, DY + YY_EMERALDS + 1, + FONT5_XSIZE * 3, FONT5_YSIZE - 1, + DX + XX_LEVEL - 1, DY + YY_LEVEL + 1); } DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS, @@ -754,15 +755,15 @@ void InitGame() MapTapeButtons(); /* copy actual game door content to door double buffer for OpenDoor() */ - XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc, - DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); + BlitBitmap(drawto, pix[PIX_DB_DOOR], + DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); OpenDoor(DOOR_OPEN_ALL); if (setup.sound_music) PlaySoundLoop(background_loop[level_nr % num_bg_loops]); - XAutoRepeatOff(display); + KeyboardAutoRepeatOff(); if (options.verbose) { @@ -3793,8 +3794,8 @@ void EdelsteinFunkeln(int x, int y) dest_x = FX + SCREENX(x)*TILEX; dest_y = FY + SCREENY(y)*TILEY; - XCopyArea(display, drawto_field, window, gc, - dest_x, dest_y, TILEX, TILEY, dest_x, dest_y); + BlitBitmap(drawto_field, window, + dest_x, dest_y, TILEX, TILEY, dest_x, dest_y); SetDrawtoField(DRAW_DIRECT); } } @@ -4241,7 +4242,7 @@ void GameActions() #endif */ -#ifndef MSDOS +#if !defined(MSDOS) && !defined(WIN32) /* last chance to get network player actions without main loop delay */ HandleNetworking(); #endif @@ -4278,7 +4279,7 @@ void GameActions() stored_player[i].effective_action = stored_player[i].action; } -#ifndef MSDOS +#if !defined(MSDOS) && !defined(WIN32) if (network_playing) SendToServer_MovePlayer(summarized_player_action); #endif @@ -4561,6 +4562,25 @@ void GameActions() } DrawAllPlayers(); + + if (options.debug) /* calculate frames per second */ + { + static unsigned long fps_counter = 0; + static int fps_frames = 0; + unsigned long fps_delay_ms = Counter() - fps_counter; + + fps_frames++; + + if (fps_delay_ms >= 500) /* calculate fps every 0.5 seconds */ + { + global.frames_per_second = 1000 * (float)fps_frames / fps_delay_ms; + + fps_frames = 0; + fps_counter = Counter(); + } + + redraw_mask |= REDRAW_FPS; + } } static boolean AllPlayersInSight(struct PlayerInfo *player, int x, int y) @@ -4607,13 +4627,13 @@ void ScrollLevel(int dx, int dy) int softscroll_offset = (setup.soft_scrolling ? TILEX : 0); int x, y; - XCopyArea(display, drawto_field, drawto_field, gc, - 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); + 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); if (dx) { @@ -6065,7 +6085,7 @@ void CreateGameButtons() for (i=0; i