X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=5561d17caaa752f1b63d4cb236696b39ca2dba61;hb=bb2ddcf13df18d69e4472d4697da173981970e9d;hp=93c23dc2227982200f8dcea0b43e562239ee7ba0;hpb=f8f7840ddc57a2c31a3d6ab664b0e4e7e7ad69ce;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 93c23dc2..5561d17c 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(); @@ -229,8 +232,17 @@ static void InitField(int x, int y, boolean init_game) { switch (Feld[x][y]) { - case EL_SPIELFIGUR: case EL_SP_MURPHY: + if (init_game) + { + if (stored_player[0].present) + { + Feld[x][y] = EL_SP_MURPHY_CLONE; + break; + } + } + /* no break! */ + case EL_SPIELFIGUR: if (init_game) Feld[x][y] = EL_SPIELER1; /* no break! */ @@ -493,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); @@ -706,14 +718,13 @@ void InitGame() 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, @@ -722,10 +733,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, @@ -745,15 +756,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) { @@ -3784,8 +3795,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); } } @@ -4232,7 +4243,7 @@ void GameActions() #endif */ -#ifndef MSDOS +#if !defined(MSDOS) && !defined(WIN32) /* last chance to get network player actions without main loop delay */ HandleNetworking(); #endif @@ -4269,7 +4280,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 @@ -4552,6 +4563,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) @@ -4598,13 +4628,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) { @@ -6056,7 +6086,7 @@ void CreateGameButtons() for (i=0; i