X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=fd89096ab4dd6259aa320061a3f290e44bca3533;hb=3d07b68a314ce189f207e42d95f786979662410d;hp=5561d17caaa752f1b63d4cb236696b39ca2dba61;hpb=8eee8a56a5aae567522998ccddf929e38aed6872;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 5561d17c..fd89096a 100644 --- a/src/game.c +++ b/src/game.c @@ -11,13 +11,12 @@ * game.c * ***********************************************************/ +#include "libgame/libgame.h" + #include "game.h" -#include "misc.h" #include "tools.h" #include "screens.h" -#include "sound.h" #include "init.h" -#include "buttons.h" #include "files.h" #include "tape.h" #include "joystick.h" @@ -167,20 +166,21 @@ static unsigned int getStateCheckSum(int counter) void GetPlayerConfig() { - if (sound_status == SOUND_OFF) + if (!audio.sound_available) setup.sound = FALSE; - if (!sound_loops_allowed) + if (!audio.loops_available) { setup.sound_loops = FALSE; setup.sound_music = FALSE; } - if (!fullscreen_available) + if (!video.fullscreen_available) setup.fullscreen = FALSE; setup.sound_simple = setup.sound; + SetAudioMode(setup.sound); InitJoysticks(); } @@ -505,7 +505,7 @@ void InitGame() network_player_action_received = FALSE; -#if !defined(MSDOS) && !defined(WIN32) +#if defined(PLATFORM_UNIX) /* initial null action */ if (network_playing) SendToServer_MovePlayer(MV_NO_MOVING); @@ -513,7 +513,6 @@ void InitGame() ZX = ZY = -1; - game.yam_content_nr = 0; FrameCounter = 0; TimeFrames = 0; TimePlayed = 0; @@ -526,6 +525,8 @@ void InitGame() ScrollStepSize = 0; /* will be correctly initialized by ScrollScreen() */ AllPlayersGone = FALSE; + + game.yam_content_nr = 0; game.magic_wall_active = FALSE; game.magic_wall_time_left = 0; game.light_time_left = 0; @@ -712,8 +713,7 @@ 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(); @@ -731,7 +731,7 @@ void InitGame() int2str(level_nr, 2), FS_SMALL, FC_YELLOW); else { - DrawTextExt(drawto, gc, DX + XX_EMERALDS, DY + YY_EMERALDS, + DrawTextExt(drawto, DX + XX_EMERALDS, DY + YY_EMERALDS, int2str(level_nr, 3), FS_SMALL, FC_SPECIAL3); BlitBitmap(drawto, drawto, DX + XX_EMERALDS, DY + YY_EMERALDS + 1, @@ -4243,7 +4243,7 @@ void GameActions() #endif */ -#if !defined(MSDOS) && !defined(WIN32) +#if defined(PLATFORM_UNIX) /* last chance to get network player actions without main loop delay */ HandleNetworking(); #endif @@ -4280,7 +4280,7 @@ void GameActions() stored_player[i].effective_action = stored_player[i].action; } -#if !defined(MSDOS) && !defined(WIN32) +#if defined(PLATFORM_UNIX) if (network_playing) SendToServer_MovePlayer(summarized_player_action); #endif @@ -5403,12 +5403,10 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->key[key_nr] = TRUE; RaiseScoreElement(EL_SCHLUESSEL); - DrawMiniGraphicExt(drawto, gc, - DX_KEYS+key_nr*MINI_TILEX, DY_KEYS, - GFX_SCHLUESSEL1+key_nr); - DrawMiniGraphicExt(window, gc, - DX_KEYS+key_nr*MINI_TILEX, DY_KEYS, - GFX_SCHLUESSEL1+key_nr); + DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + GFX_SCHLUESSEL1 + key_nr); + DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_PONG); break; } @@ -5423,12 +5421,10 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->key[key_nr] = TRUE; RaiseScoreElement(EL_SCHLUESSEL); - DrawMiniGraphicExt(drawto, gc, - DX_KEYS+key_nr*MINI_TILEX, DY_KEYS, - GFX_SCHLUESSEL1+key_nr); - DrawMiniGraphicExt(window, gc, - DX_KEYS+key_nr*MINI_TILEX, DY_KEYS, - GFX_SCHLUESSEL1+key_nr); + DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + GFX_SCHLUESSEL1 + key_nr); + DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_PONG); break; } @@ -5950,7 +5946,7 @@ void PlaySoundLevel(int x, int y, int sound_nr) volume = PSND_MAX_VOLUME; -#ifndef MSDOS +#if !defined(PLATFORM_MSDOS) stereo = (sx - SCR_FIELDX/2) * 12; #else stereo = PSND_MIDDLE + (2 * sx - (SCR_FIELDX - 1)) * 5; @@ -6184,7 +6180,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) Request("Do you really want to quit the game ?", REQ_ASK | REQ_STAY_CLOSED)) { -#if !defined(MSDOS) && !defined(WIN32) +#if defined(PLATFORM_UNIX) if (options.network) SendToServer_StopPlaying(); else @@ -6201,7 +6197,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) case GAME_CTRL_ID_PAUSE: if (options.network) { -#if !defined(MSDOS) && !defined(WIN32) +#if defined(PLATFORM_UNIX) if (tape.pausing) SendToServer_ContinuePlaying(); else @@ -6215,7 +6211,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) case GAME_CTRL_ID_PLAY: if (tape.pausing) { -#if !defined(MSDOS) && !defined(WIN32) +#if defined(PLATFORM_UNIX) if (options.network) SendToServer_ContinuePlaying(); else @@ -6233,7 +6229,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) setup.sound_music = FALSE; FadeSound(background_loop[level_nr % num_bg_loops]); } - else if (sound_loops_allowed) + else if (audio.loops_available) { setup.sound = setup.sound_music = TRUE; PlaySoundLoop(background_loop[level_nr % num_bg_loops]); @@ -6243,14 +6239,14 @@ static void HandleGameButtons(struct GadgetInfo *gi) case SOUND_CTRL_ID_LOOPS: if (setup.sound_loops) setup.sound_loops = FALSE; - else if (sound_loops_allowed) + else if (audio.loops_available) setup.sound = setup.sound_loops = TRUE; break; case SOUND_CTRL_ID_SIMPLE: if (setup.sound_simple) setup.sound_simple = FALSE; - else if (sound_status==SOUND_AVAILABLE) + else if (audio.sound_available) setup.sound = setup.sound_simple = TRUE; break;