X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2FDoom2DF.lpr;h=33a069dc79288ea61dd312f8b0742dd285afe121;hb=02521d15eb6020ddac536714d2eefedd69fd0f6e;hp=1db010902c294eb9f71d319085a669ce632d0c03;hpb=0e06274972c1cdc5b48441b5d1cf354096896d7f;p=d2df-sdl.git diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr index 1db0109..33a069d 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -123,7 +123,18 @@ uses g_res_downloader in 'g_res_downloader.pas', g_grid in 'g_grid.pas', g_game in 'g_game.pas', - g_gfx in 'g_gfx.pas', + {$IFDEF ENABLE_GFX} + g_gfx in 'g_gfx.pas', + {$ENDIF} + {$IFDEF ENABLE_GIBS} + g_gibs in 'g_gibs.pas', + {$ENDIF} + {$IFDEF ENABLE_SHELLS} + g_shells in 'g_shells.pas', + {$ENDIF} + {$IFDEF ENABLE_CORPSES} + g_corpses in 'g_corpses.pas', + {$ENDIF} g_items in 'g_items.pas', g_map in 'g_map.pas', g_monsters in 'g_monsters.pas', @@ -133,47 +144,55 @@ uses g_playermodel in 'g_playermodel.pas', g_saveload in 'g_saveload.pas', g_sound in 'g_sound.pas', - g_textures in 'g_textures.pas', + g_animations in 'g_animations.pas', g_triggers in 'g_triggers.pas', g_weapons in 'g_weapons.pas', g_window in 'g_window.pas', -{$IFNDEF HEADLESS} - {$IFDEF USE_SYSSTUB} - g_system in 'stub/g_system.pas', - g_touch in 'stub/g_touch.pas', - {$ENDIF} - {$IFDEF USE_SDL} - g_system in 'sdl/g_system.pas', - g_touch in 'sdl/g_touch.pas', - {$ENDIF} - {$IFDEF USE_SDL2} - g_system in 'sdl2/g_system.pas', - g_touch in 'sdl2/g_touch.pas', + + {$IFDEF ENABLE_SYSTEM} + {$IFDEF USE_SYSSTUB} + g_system in 'stub/g_system.pas', + {$ENDIF} + {$IFDEF USE_SDL} + g_system in 'sdl/g_system.pas', + {$ENDIF} + {$IFDEF USE_SDL2} + g_system in 'sdl2/g_system.pas', + {$ENDIF} {$ENDIF} -{$ENDIF} -{$IFNDEF HEADLESS} - {$I ../shared/vampimg.inc} - r_animations in 'opengl/r_animations.pas', - r_console in 'opengl/r_console.pas', - r_game in 'opengl/r_game.pas', - r_gfx in 'opengl/r_gfx.pas', - r_graphics in 'opengl/r_graphics.pas', - r_items in 'opengl/r_items.pas', - r_map in 'opengl/r_map.pas', - r_monsters in 'opengl/r_monsters.pas', - r_netmaster in 'opengl/r_netmaster.pas', - r_player in 'opengl/r_player.pas', - r_playermodel in 'opengl/r_playermodel.pas', - r_render in 'opengl/r_render.pas', - r_texture in 'opengl/r_texture.pas', - r_textures in 'opengl/r_textures.pas', - r_weapons in 'opengl/r_weapons.pas', - r_window in 'opengl/r_window.pas', {$IFDEF ENABLE_MENU} g_gui in 'g_gui.pas', g_menu in 'g_menu.pas', {$ENDIF} + +{$IFDEF ENABLE_RENDER} + {$IF DEFINED(USE_STUBRENDER)} + r_render in 'renders/stub/r_render.pas', + {$ELSEIF DEFINED(USE_OPENGL) OR DEFINED(USE_GLES1) OR DEFINED(USE_GLSTUB) OR DEFINED(USE_NEWGL)} + {$I ../shared/vampimg.inc} + r_render in 'renders/opengl/r_render.pas', + r_atlas in 'renders/opengl/r_atlas.pas', + r_textures in 'renders/opengl/r_textures.pas', + r_draw in 'renders/opengl/r_draw.pas', + r_map in 'renders/opengl/r_map.pas', + r_fonts in 'renders/opengl/r_fonts.pas', + r_common in 'renders/opengl/r_common.pas', + r_console in 'renders/opengl/r_console.pas', + {$IFDEF ENABLE_MENU} + r_gui in 'renders/opengl/r_gui.pas', + {$ENDIF} + r_loadscreen in 'renders/opengl/r_loadscreen.pas', + {$IFDEF ENABLE_TOUCH} + r_touch in 'renders/opengl/r_touch.pas', + {$ENDIF} + {$IFDEF ENABLE_HOLMES} + r_fui_gfx_gl in 'renders/opengl/r_fui_gfx_gl.pas', + r_holmes in 'renders/opengl/r_holmes.pas', + {$ENDIF} + {$ELSE} + {$FATAL render driver not selected} + {$ENDIF} {$ENDIF} {$IFDEF USE_FMOD} @@ -202,7 +221,7 @@ uses fui_wadread in '../flexui/fui_wadread.pas', fui_common in '../flexui/fui_common.pas', - fui_gfx_gl in '../flexui/fui_gfx_gl.pas', + fui_gfx in '../flexui/fui_gfx.pas', fui_events in '../flexui/fui_events.pas', fui_style in '../flexui/fui_style.pas', fui_flexlay in '../flexui/fui_flexlay.pas', @@ -238,7 +257,7 @@ begin if (NetMode = NET_SERVER) then g_Net_Host_Update() else if (NetMode = NET_CLIENT) then g_Net_Client_Update(); // think -{$IFNDEF HEADLESS} +{$IFDEF ENABLE_RENDER} r_Render_Update; {$ENDIF} g_Game_Update(); @@ -253,10 +272,10 @@ var Time, Time_Delta: Int64; Frame: Int64; begin - {$IFDEF HEADLESS} - Result := False; - {$ELSE} + {$IFDEF ENABLE_SYSTEM} Result := sys_HandleInput(); + {$ELSE} + Result := False; {$ENDIF} Time := GetTickCount64(); @@ -305,10 +324,9 @@ begin gLerpFactor := 1.0 else gLerpFactor := nmin(1.0, (Time - Time_Old) / 28.0); -{$IFNDEF HEADLESS} - r_Render_Draw; - sys_Repaint; -{$ENDIF} + {$IFDEF ENABLE_RENDER} + r_Render_Draw; + {$ENDIF} Frame := Time end else @@ -334,19 +352,21 @@ begin Inc(idx); //if arg = '--twinkletwinkle' then gwin_k8_enable_light_experiments := true; if arg = '--jah' then g_profile_history_size := 100; - if arg = '--no-particles' then gpart_dbg_enabled := false; if arg = '--no-los' then gmon_dbg_los_enabled := false; if arg = '--profile-render' then g_profile_frame_draw := true; if arg = '--profile-coldet' then g_profile_collision := true; if arg = '--profile-los' then g_profile_los := true; - if arg = '--no-part-phys' then gpart_dbg_phys_enabled := false; - if arg = '--no-part-physics' then gpart_dbg_phys_enabled := false; - if arg = '--no-particles-phys' then gpart_dbg_phys_enabled := false; - if arg = '--no-particles-physics' then gpart_dbg_phys_enabled := false; - if arg = '--no-particle-phys' then gpart_dbg_phys_enabled := false; - if arg = '--no-particle-physics' then gpart_dbg_phys_enabled := false; + {$IFDEF ENABLE_GFX} + if arg = '--no-particles' then gpart_dbg_enabled := false; + if arg = '--no-part-phys' then gpart_dbg_phys_enabled := false; + if arg = '--no-part-physics' then gpart_dbg_phys_enabled := false; + if arg = '--no-particles-phys' then gpart_dbg_phys_enabled := false; + if arg = '--no-particles-physics' then gpart_dbg_phys_enabled := false; + if arg = '--no-particle-phys' then gpart_dbg_phys_enabled := false; + if arg = '--no-particle-physics' then gpart_dbg_phys_enabled := false; + {$ENDIF} if arg = '--debug-input' then g_dbg_input := True; @@ -372,7 +392,6 @@ begin begin itmp := 0; val(ParamStr(idx), itmp, valres); - {$IFNDEF HEADLESS} if (valres = 0) and (not g_holmes_imfunctional) then begin case itmp of @@ -381,11 +400,6 @@ begin 16: uiContext.font := 'win16'; end; end; - {$ELSE} - // fuck off, fpc! - itmp := itmp; - valres := valres; - {$ENDIF} Inc(idx); end; end; @@ -863,11 +877,11 @@ end; if not fuiAddWad('./data/flexui.wad') then fuiAddWad('./flexui.wad'); end; try - fuiGfxLoadFont('win8', 'flexui/fonts/win8.fuifont'); - fuiGfxLoadFont('win14', 'flexui/fonts/win14.fuifont'); - fuiGfxLoadFont('win16', 'flexui/fonts/win16.fuifont'); - fuiGfxLoadFont('dos8', 'flexui/fonts/dos8.fuifont'); - fuiGfxLoadFont('msx6', 'flexui/fonts/msx6.fuifont'); + gxGfxLoadFont('win8', 'flexui/fonts/win8.fuifont'); + gxGfxLoadFont('win14', 'flexui/fonts/win14.fuifont'); + gxGfxLoadFont('win16', 'flexui/fonts/win16.fuifont'); + gxGfxLoadFont('dos8', 'flexui/fonts/dos8.fuifont'); + gxGfxLoadFont('msx6', 'flexui/fonts/msx6.fuifont'); except on e: Exception do begin writeln('ERROR loading FlexUI fonts'); @@ -962,7 +976,7 @@ end; procedure ScreenResize (w, h: Integer); begin - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_RENDER} r_Render_Resize(w, h); {$IFDEF ENABLE_HOLMES} fuiScrWdt := w; @@ -981,6 +995,26 @@ end; {$ENDIF} end; + procedure ProcessLoading; + var update: Boolean; + begin + {$IFDEF ENABLE_SYSTEM} + update := sys_HandleInput() = False; + {$ELSE} + update := True; + {$ENDIF} + if update then + begin + e_SoundUpdate; + // TODO: At the moment, I left here only host network processing, because the client code must + // handle network events on its own. Otherwise separate network cases that use different calls to + // enet_host_service() WILL lose their packets (for example, resource downloading). So they have + // to handle everything by themselves. But in general, this MUST be removed completely, since + // updating the window should never affect the network. Use single enet_host_service(), period. + if NetMode = NET_SERVER then g_Net_Host_Update(); + end + end; + procedure Startup; begin Randomize; @@ -989,7 +1023,7 @@ end; InitPrep; e_Input_Initialize; InitSound; - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_SYSTEM} sys_Init; sys_CharPress := @CharPress; (* install hook *) sys_ScreenResize := @ScreenResize; (* install hook *) @@ -999,26 +1033,29 @@ end; g_Console_Initialize; // TODO move load configs here g_Language_Set(gLanguage); - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_RENDER} r_Render_Initialize; - g_Touch_Init; {$ENDIF} DebugOptions; g_Net_InitLowLevel; // TODO init serverlist + {$IFDEF ENABLE_RENDER} + r_Render_SetProcessLoadingCallback(@ProcessLoading); + {$ENDIF} + g_Game_SetLoadingText(Format('Doom 2D: Forever %s', [GAME_VERSION]), 0, False); + g_Game_SetLoadingText('', 0, False); {$IFDEF ENABLE_HOLMES} InitHolmes; {$ENDIF} - {$IFDEF HEADLESS} - g_PlayerModel_LoadFake('doomer', 'doomer.wad'); - {$ELSE} + {$IFDEF ENABLE_RENDER} g_PlayerModel_LoadAll; r_Render_Load; + {$ELSE} + g_PlayerModel_LoadFake('doomer', 'doomer.wad'); {$ENDIF} g_Game_Init; {$IFDEF ENABLE_MENU} g_Menu_Init; - g_GUI_Init; {$ENDIF} g_Game_Process_Params; // TODO reload GAME textures @@ -1029,12 +1066,15 @@ end; {$ENDIF} Time_Old := GetTickCount64(); while not ProcessMessage() do begin end; + {$IFDEF ENABLE_RENDER} + r_Render_SetProcessLoadingCallback(nil); + {$ENDIF} g_Console_WriteGameConfig; {$IFDEF ENABLE_MENU} g_GUI_Destroy; g_Menu_Free; {$ENDIF} - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_RENDER} r_Render_Free; {$ENDIF} {$IFDEF ENABLE_HOLMES} @@ -1043,8 +1083,10 @@ end; g_Net_Slist_ShutdownAll; g_Net_DeinitLowLevel; (* g_Touch_Finalize; *) - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_RENDER} r_Render_Finalize; + {$ENDIF} + {$IFDEF ENABLE_SYSTEM} sys_Final; {$ENDIF} g_Console_Finalize;