X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_window.pas;h=bfd4377830c271bc278fe5480357782093cec5f7;hp=4e84b5d53eb9823a4b5234c44a38cbbc99ca9077;hb=d0936017ccb8a078d1b03f55478af284bb015bbc;hpb=1f8100acd63d597420f56d3796e81f5268f49de5 diff --git a/src/game/g_window.pas b/src/game/g_window.pas index 4e84b5d..bfd4377 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -37,8 +37,8 @@ uses {$IFDEF ENABLE_HOLMES} g_holmes, sdlcarcass, fui_ctls, {$ENDIF} - SysUtils, Classes, MAPDEF, Math, - r_window, e_log, g_main, + SysUtils, Classes, MAPDEF, Math, r_graphics, + r_window, e_log, r_game, g_console, r_console, e_input, g_options, g_game, g_basic, g_textures, e_sound, g_sound, g_menu, ENet, g_net, g_map, g_gfx, g_monsters, xprofiler, @@ -51,6 +51,79 @@ var wNeedTimeReset: Boolean = false; wLoadingQuit: Boolean = false; +procedure Update (); +begin + // remember old mobj positions, prepare for update + g_Game_PreUpdate(); + // server: receive client commands for new frame + // client: receive game state changes from server + if (NetMode = NET_SERVER) then g_Net_Host_Update() + else if (NetMode = NET_CLIENT) then g_Net_Client_Update(); + // think + g_Game_Update(); + // server: send any accumulated outgoing data to clients + if NetMode = NET_SERVER then g_Net_Flush(); +end; + + +procedure Draw (); +begin + r_Game_Draw(); +end; + + +procedure Init(); +var + NoSound: Boolean; +begin + Randomize; + +{$IFDEF HEADLESS} + {$IFDEF USE_SDLMIXER} + NoSound := False; // hope env has set SDL_AUDIODRIVER to dummy + {$ELSE} + NoSound := True; // FMOD backend will sort it out + {$ENDIF} +{$ELSE} + NoSound := False; +{$ENDIF} + + g_Touch_Init; + +(* + if (e_JoysticksAvailable > 0) then + e_WriteLog('Input: Joysticks available.', TMsgType.Notify) + else + e_WriteLog('Input: No Joysticks.', TMsgType.Notify); +*) + + if (not gNoSound) then + begin + e_WriteLog('Initializing sound system', TMsgType.Notify); + e_InitSoundSystem(NoSound); + end; + + e_WriteLog('Init game', TMsgType.Notify); + g_Game_Init(); + +// FillChar(charbuff, sizeof(charbuff), ' '); +end; + +procedure Release(); +begin + e_WriteLog('Releasing engine', TMsgType.Notify); + e_ReleaseEngine(); + + e_WriteLog('Releasing input', TMsgType.Notify); + e_ReleaseInput(); + + if not gNoSound then + begin + e_WriteLog('Releasing sound', TMsgType.Notify); + e_ReleaseSoundSystem(); + end; +end; + procedure ResetTimer (); begin wNeedTimeReset := true;