From 6cdd36d2fb73f13be7b6ea1870a8b3b0817b37f1 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 29 Jan 2022 13:10:02 +0300 Subject: [PATCH] game: disable gfx for server --- src/game/Doom2DF.lpr | 24 +++-- src/game/g_basic.pas | 2 +- src/game/g_console.pas | 9 +- src/game/g_game.pas | 23 ++++- src/game/g_gfx.pas | 14 +-- src/game/g_items.pas | 24 +++-- src/game/g_map.pas | 63 +++++++----- src/game/g_menu.pas | 13 ++- src/game/g_monsters.pas | 94 +++++++++++------- src/game/g_netmsg.pas | 67 ++++++++----- src/game/g_options.pas | 9 +- src/game/g_panel.pas | 18 +++- src/game/g_phys.pas | 22 +++-- src/game/g_player.pas | 185 ++++++++++++++++++++++------------- src/game/g_playermodel.pas | 61 ++++++++---- src/game/g_triggers.pas | 166 ++++++++++++++++++------------- src/game/g_weapons.pas | 166 +++++++++++++++++++------------ src/game/opengl/r_game.pas | 11 ++- src/game/opengl/r_render.pas | 32 ++++-- src/shared/a_modes.inc | 16 +++ 20 files changed, 661 insertions(+), 358 deletions(-) diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr index 4131108..89e400e 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -123,7 +123,9 @@ 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} g_items in 'g_items.pas', g_map in 'g_map.pas', g_monsters in 'g_monsters.pas', @@ -154,7 +156,9 @@ uses 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', + {$IFDEF ENABLE_GFX} + r_gfx in 'opengl/r_gfx.pas', + {$ENDIF} r_graphics in 'opengl/r_graphics.pas', r_items in 'opengl/r_items.pas', r_map in 'opengl/r_map.pas', @@ -334,19 +338,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; diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas index 60b6a96..367c0e1 100644 --- a/src/game/g_basic.pas +++ b/src/game/g_basic.pas @@ -98,7 +98,7 @@ var implementation uses - Math, geom, e_log, g_map, g_gfx, g_player, SysUtils, MAPDEF, + Math, geom, e_log, g_map, g_player, SysUtils, MAPDEF, StrUtils, g_monsters, g_items, g_game; {$PUSH} diff --git a/src/game/g_console.pas b/src/game/g_console.pas index c872e8e..7937a19 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -108,7 +108,10 @@ uses {$IFDEF ENABLE_TOUCH} g_system, {$ENDIF} - g_textures, e_input, g_game, g_gfx, g_player, g_items, + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + g_textures, e_input, g_game, g_player, g_items, SysUtils, g_basic, g_options, Math, e_res, g_language, g_net, g_netmsg, e_log, conbuf, g_weapons, Keyboard; @@ -2084,7 +2087,9 @@ begin WriteLn(f, 'sv_public ', IfThen(NetUseMaster, 1, 0)); // game settings - WriteLn(f, 'g_max_particles ', g_GFX_GetMax()); + {$IFDEF ENABLE_GFX} + WriteLn(f, 'g_max_particles ', g_GFX_GetMax()); + {$ENDIF} WriteLn(f, 'g_max_shells ', g_Shells_GetMax()); WriteLn(f, 'g_max_gibs ', g_Gibs_GetMax()); WriteLn(f, 'g_max_corpses ', g_Corpses_GetMax()); diff --git a/src/game/g_game.pas b/src/game/g_game.pas index c15aeaa..01b7d02 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -457,12 +457,15 @@ uses {$IFDEF ENABLE_MENU} g_menu, {$ENDIF} + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} {$IFNDEF HEADLESS} r_render, g_system, {$ENDIF} e_res, g_window, e_input, e_log, g_console, g_items, g_map, g_panel, - g_playermodel, g_gfx, g_options, Math, + g_playermodel, g_options, Math, g_triggers, g_monsters, e_sound, CONFIG, g_language, g_net, g_phys, ENet, e_msg, g_netmsg, g_netmaster, @@ -2203,7 +2206,9 @@ begin g_Triggers_Update(); g_Weapon_Update(); g_Monsters_Update(); - g_GFX_Update(); + {$IFDEF ENABLE_GFX} + g_GFX_Update; + {$ENDIF} g_Player_UpdateAll(); g_Player_UpdatePhysicalObjects(); @@ -4033,12 +4038,18 @@ begin begin if Length(p) = 2 then begin - a := Max(0, StrToIntDef(p[1], 0)); - g_GFX_SetMax(a) + {$IFDEF ENABLE_GFX} + a := Max(0, StrToIntDef(p[1], 0)); + g_GFX_SetMax(a) + {$ENDIF} end else if Length(p) = 1 then begin - e_LogWritefln('%s', [g_GFX_GetMax()]) + {$IFDEF ENABLE_GFX} + e_LogWritefln('%s', [g_GFX_GetMax()]) + {$ELSE} + e_LogWritefln('%s', [0]) + {$ENDIF} end else begin @@ -6969,8 +6980,10 @@ begin conRegVar('mon_sq_enabled', @gmon_debug_use_sqaccel, 'accelerated spatial queries for monsters', 'accelerated monster coldet'); conRegVar('wtrace_sq_enabled', @gwep_debug_fast_trace, 'accelerated spatial queries for weapon hitscan trace', 'accelerated weapon hitscan'); +{$IFDEF ENABLE_GFX} conRegVar('pr_enabled', @gpart_dbg_enabled, 'enable/disable particles', 'particles'); conRegVar('pr_phys_enabled', @gpart_dbg_phys_enabled, 'enable/disable particle physics', 'particle physics'); +{$ENDIF} conRegVar('los_enabled', @gmon_dbg_los_enabled, 'enable/disable monster LOS calculations', 'monster LOS', true); conRegVar('mon_think', @gmon_debug_think, 'enable/disable monster thinking', 'monster thinking', true); diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas index d0bf54b..224faee 100644 --- a/src/game/g_gfx.pas +++ b/src/game/g_gfx.pas @@ -147,13 +147,13 @@ function awmIsSetHolmes (x, y: Integer): Boolean; inline; implementation -uses - {$IFNDEF HEADLESS} - r_render, - {$ENDIF} - g_map, g_panel, g_basic, Math, - g_options, g_console, SysUtils, g_triggers, MAPDEF, - g_game, g_language, g_net, utils, xprofiler; + uses + {$IFNDEF HEADLESS} + r_render, + {$ENDIF} + g_map, g_panel, Math, utils, + g_options, SysUtils, MAPDEF + ; const diff --git a/src/game/g_items.pas b/src/game/g_items.pas index 636b682..33ab113 100644 --- a/src/game/g_items.pas +++ b/src/game/g_items.pas @@ -91,12 +91,16 @@ var implementation -uses - Math, - g_basic, g_sound, g_gfx, g_map, - g_game, g_triggers, g_console, g_player, g_net, g_netmsg, - e_log, g_options, - g_grid, binheap, idpool, utils, xstreams; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + Math, + g_basic, g_sound, g_map, + g_game, g_triggers, g_console, g_player, g_net, g_netmsg, + e_log, g_options, + g_grid, binheap, idpool, utils, xstreams + ; // ////////////////////////////////////////////////////////////////////////// // var @@ -509,7 +513,13 @@ begin if (RespawnTime = 0) and (not alive) then begin if not QuietRespawn then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', InitX, InitY); - g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, InitX + (Obj.Rect.Width div 2) - 16, InitY + (Obj.Rect.Height div 2) - 16); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_ITEM_RESPAWN, + InitX + (Obj.Rect.Width div 2) - 16, + InitY + (Obj.Rect.Height div 2) - 16 + ); + {$ENDIF} Obj.oldX := InitX; Obj.oldY := InitY; Obj.X := InitX; diff --git a/src/game/g_map.pas b/src/game/g_map.pas index f62f761..5ce07e6 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -246,13 +246,17 @@ var (* private state *) implementation -uses - e_input, e_log, e_res, g_items, g_gfx, g_console, - g_weapons, g_game, g_sound, e_sound, CONFIG, - g_options, g_triggers, g_player, - Math, g_monsters, g_saveload, g_language, g_netmsg, - sfs, xstreams, hashtable, wadreader, - g_res_downloader; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + e_input, e_log, e_res, g_items, g_console, + g_weapons, g_game, g_sound, e_sound, CONFIG, + g_options, g_triggers, g_player, + Math, g_monsters, g_saveload, g_language, g_netmsg, + sfs, xstreams, hashtable, wadreader, + g_res_downloader + ; const FLAGRECT: TRectWH = (X:15; Y:12; Width:33; Height:52); @@ -1899,8 +1903,10 @@ begin g_Weapon_Init(); g_Monsters_Init(); - // Åñëè íå LoadState, òî ñîçäàåì êàðòó ñòîëêíîâåíèé: - if not gLoadGameMode then g_GFX_Init(); + {$IFDEF ENABLE_GFX} + // Åñëè íå LoadState, òî ñîçäàåì êàðòó ñòîëêíîâåíèé: + if not gLoadGameMode then g_GFX_Init(); + {$ENDIF} // Ñáðîñ ëîêàëüíûõ ìàññèâîâ: mapTextureList := nil; @@ -2078,7 +2084,9 @@ procedure g_Map_Free(freeTextures: Boolean=true); end; begin - g_GFX_Free(); + {$IFDEF ENABLE_GFX} + g_GFX_Free; + {$ENDIF} g_Weapon_Free(); g_Items_Free(); g_Triggers_Free(); @@ -2557,7 +2565,10 @@ begin if pan.Enabled and mapGrid.proxyEnabled[pan.proxyId] then exit; pan.Enabled := True; - g_Mark(pan.X, pan.Y, pan.Width, pan.Height, MARK_DOOR, true); + + {$IFDEF ENABLE_GFX} + g_Mark(pan.X, pan.Y, pan.Width, pan.Height, MARK_DOOR, true); + {$ENDIF} mapGrid.proxyEnabled[pan.proxyId] := true; //if (pan.proxyId >= 0) then mapGrid.proxyEnabled[pan.proxyId] := true @@ -2583,7 +2594,9 @@ begin if (not pan.Enabled) and (not mapGrid.proxyEnabled[pan.proxyId]) then exit; pan.Enabled := False; - g_Mark(pan.X, pan.Y, pan.Width, pan.Height, MARK_DOOR, false); + {$IFDEF ENABLE_GFX} + g_Mark(pan.X, pan.Y, pan.Width, pan.Height, MARK_DOOR, false); + {$ENDIF} mapGrid.proxyEnabled[pan.proxyId] := false; //if (pan.proxyId >= 0) then begin mapGrid.removeBody(pan.proxyId); pan.proxyId := -1; end; @@ -2624,15 +2637,16 @@ begin begin LiftType := t; - g_Mark(X, Y, Width, Height, MARK_LIFT, false); - //TODO: make separate lift tags, and change tag here - - case LiftType of - LIFTTYPE_UP: g_Mark(X, Y, Width, Height, MARK_LIFTUP); - LIFTTYPE_DOWN: g_Mark(X, Y, Width, Height, MARK_LIFTDOWN); - LIFTTYPE_LEFT: g_Mark(X, Y, Width, Height, MARK_LIFTLEFT); - LIFTTYPE_RIGHT: g_Mark(X, Y, Width, Height, MARK_LIFTRIGHT); - end; + {$IFDEF ENABLE_GFX} + g_Mark(X, Y, Width, Height, MARK_LIFT, false); + //TODO: make separate lift tags, and change tag here + case LiftType of + LIFTTYPE_UP: g_Mark(X, Y, Width, Height, MARK_LIFTUP); + LIFTTYPE_DOWN: g_Mark(X, Y, Width, Height, MARK_LIFTDOWN); + LIFTTYPE_LEFT: g_Mark(X, Y, Width, Height, MARK_LIFTLEFT); + LIFTTYPE_RIGHT: g_Mark(X, Y, Width, Height, MARK_LIFTRIGHT); + end; + {$ENDIF} //if g_Game_IsServer and g_Game_IsNet then MH_SEND_PanelState(pguid); // mark platform as interesting @@ -2832,8 +2846,11 @@ begin loadPanels(); ///// ///// - // Îáíîâëÿåì êàðòó ñòîëêíîâåíèé è ñåòêó - g_GFX_Init(); + {$IFDEF ENABLE_GFX} + // Îáíîâëÿåì êàðòó ñòîëêíîâåíèé è ñåòêó + g_GFX_Init(); + {$ENDIF} + //mapCreateGrid(); ///// Çàãðóæàåì ìóçûêó: ///// diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 2824c92..d306473 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -39,8 +39,11 @@ var implementation uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} g_gui, r_textures, r_graphics, g_game, g_map, - g_base, g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons, + g_base, g_basic, g_console, g_sound, g_player, g_options, g_weapons, e_log, SysUtils, CONFIG, g_playermodel, DateUtils, MAPDEF, Math, g_saveload, g_language, e_res, @@ -132,7 +135,9 @@ begin menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu')); - g_GFX_SetMax(TGUIScroll(menu.GetControl('scParticlesCount')).Value*1000); + {$IFDEF ENABLE_GFX} + g_GFX_SetMax(TGUIScroll(menu.GetControl('scParticlesCount')).Value*1000); + {$ENDIF} g_Shells_SetMax(TGUIScroll(menu.GetControl('scShellsMax')).Value*30); g_Gibs_SetMax(TGUIScroll(menu.GetControl('scGibsMax')).Value*25); g_Corpses_SetMax(TGUIScroll(menu.GetControl('scCorpsesMax')).Value*5); @@ -574,7 +579,9 @@ begin menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu')); - TGUIScroll(menu.GetControl('scParticlesCount')).Value := g_GFX_GetMax() div 1000; + {$IFDEF ENABLE_GFX} + TGUIScroll(menu.GetControl('scParticlesCount')).Value := g_GFX_GetMax() div 1000; + {$ENDIF} TGUIScroll(menu.GetControl('scShellsMax')).Value := g_Shells_GetMax() div 30; TGUIScroll(menu.GetControl('scGibsMax')).Value := g_Gibs_GetMax() div 25; TGUIScroll(menu.GetControl('scCorpsesMax')).Value := g_Corpses_GetMax() div 5; diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index 9715252..213e264 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -81,10 +81,12 @@ type tx, ty: Integer; FStartID: Integer; FObj: TObj; - FBloodRed: Byte; - FBloodGreen: Byte; - FBloodBlue: Byte; - FBloodKind: Byte; + {$IFDEF ENABLE_GFX} + FBloodRed: Byte; + FBloodGreen: Byte; + FBloodBlue: Byte; + FBloodKind: Byte; + {$ENDIF} FShellTimer: Integer; FShellType: Byte; FFirePainTime: Integer; @@ -524,7 +526,10 @@ uses {$IFDEF ENABLE_MENU} g_menu, {$ENDIF} - e_log, g_sound, g_gfx, g_player, g_game, + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + e_log, g_sound, g_player, g_game, g_weapons, g_triggers, g_items, g_options, g_console, g_map, Math, wadreader, g_language, g_netmsg, idpool, utils, xstreams; @@ -1633,6 +1638,7 @@ begin mplatCheckFrameId := 0; mNeedSend := false; +{$IFDEF ENABLE_GFX} if FMonsterType in [MONSTER_ROBO, MONSTER_BARREL] then FBloodKind := BLOOD_SPARKS else @@ -1655,6 +1661,7 @@ begin FBloodGreen := 0; FBloodBlue := 0; end; +{$ENDIF} SetLength(FAnim, Length(ANIMTABLE)); for a := ANIM_SLEEP to ANIM_PAIN do @@ -1888,6 +1895,7 @@ end; procedure TMonster.MakeBloodSimple(Count: Word); begin +{$IFDEF ENABLE_GFX} g_GFX_Blood(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)+8, FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2), Count div 2, 3, -1, 16, (FObj.Rect.Height*2 div 3), @@ -1896,14 +1904,17 @@ begin FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2), Count div 2, -3, -1, 16, (FObj.Rect.Height*2) div 3, FBloodRed, FBloodGreen, FBloodBlue, FBloodKind); +{$ENDIF} end; procedure TMonster.MakeBloodVector(Count: Word; VelX, VelY: Integer); begin +{$IFDEF ENABLE_GFX} g_GFX_Blood(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2), FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2), Count, VelX, VelY, 16, (FObj.Rect.Height*2) div 3, FBloodRed, FBloodGreen, FBloodBlue, FBloodKind); +{$ENDIF} end; procedure TMonster.Push(vx, vy: Integer); @@ -1987,12 +1998,13 @@ begin if not silent then begin g_Sound_PlayExAt('SOUND_GAME_TELEPORT', Obj.X, Obj.Y); +{$IFDEF ENABLE_GFX} g_GFX_QueueEffect( R_GFX_TELEPORT, FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32, FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32 ); - +{$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32, FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32, 1, @@ -2022,12 +2034,13 @@ begin // Эффект телепорта в точке назначения: if not silent then begin +{$IFDEF ENABLE_GFX} g_GFX_QueueEffect( R_GFX_TELEPORT, FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32, FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32 ); - +{$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32, FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32, 0, @@ -2157,18 +2170,20 @@ begin // Возможно, создаем пузырьки в воде: if WordBool(st and MOVE_INWATER) and (Random(32) = 0) then begin - case FMonsterType of - MONSTER_FISH: - if Random(4) <> 0 then bubbles := False else + {$IFDEF ENABLE_GFX} + case FMonsterType of + MONSTER_FISH: + if Random(4) <> 0 then bubbles := False else + g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), + FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); + MONSTER_ROBO, MONSTER_BARREL: g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); - MONSTER_ROBO, MONSTER_BARREL: - g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), - FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); - else - g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width-4), - FObj.Y+FObj.Rect.Y + Random(4), 5, 4, 4); - end; + else + g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width-4), + FObj.Y+FObj.Rect.Y + Random(4), 5, 4, 4); + end; + {$ENDIF} if bubbles then if Random(2) = 0 then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); @@ -3119,18 +3134,20 @@ begin // Возможно, создаем пузырьки в воде: if WordBool(st and MOVE_INWATER) and (Random(32) = 0) then begin - case FMonsterType of - MONSTER_FISH: - if Random(4) <> 0 then bubbles := False else + {$IFDEF ENABLE_GFX} + case FMonsterType of + MONSTER_FISH: + if Random(4) <> 0 then bubbles := False else + g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), + FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); + MONSTER_ROBO, MONSTER_BARREL: g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); - MONSTER_ROBO, MONSTER_BARREL: - g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), - FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); - else - g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width-4), - FObj.Y+FObj.Rect.Y + Random(4), 5, 4, 4); - end; + else + g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width-4), + FObj.Y+FObj.Rect.Y + Random(4), 5, 4, 4); + end; + {$ENDIF} if bubbles then if Random(2) = 0 then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); @@ -4291,17 +4308,20 @@ begin end; procedure TMonster.OnFireFlame(Times: DWORD = 1); - var i: DWORD; x, y: Integer; + {$IFDEF ENABLE_GFX} + var i: DWORD; x, y: Integer; + {$ENDIF} begin - if (Random(10) = 1) and (Times = 1) then - Exit; - - for i := 1 to Times do - begin - x := Obj.X + Obj.Rect.X + Random(Obj.Rect.Width + Times * 2) - (R_GFX_FLAME_WIDTH div 2); - y := Obj.Y + 8 + Random(8 + Times * 2) + IfThen(FState = MONSTATE_DEAD, 16, 0); - g_GFX_QueueEffect(R_GFX_FLAME, x, y); - end; + {$IFDEF ENABLE_GFX} + if (Random(10) = 1) and (Times = 1) then + Exit; + for i := 1 to Times do + begin + x := Obj.X + Obj.Rect.X + Random(Obj.Rect.Width + Times * 2) - (R_GFX_FLAME_WIDTH div 2); + y := Obj.Y + 8 + Random(8 + Times * 2) + IfThen(FState = MONSTATE_DEAD, 16, 0); + g_GFX_QueueEffect(R_GFX_FLAME, x, y); + end; + {$ENDIF} end; diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 759f4b6..02b6286 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -283,14 +283,18 @@ function IsValidFilePath(const S: String): Boolean; implementation -uses - {$IFDEF ENABLE_MENU} - g_gui, - {$ENDIF} - Math, ENet, e_input, e_log, g_base, g_basic, - g_textures, g_gfx, g_sound, g_console, g_options, - g_game, g_player, g_map, g_panel, g_items, g_weapons, g_phys, - g_language, g_monsters, g_netmaster, utils, wadreader, MAPDEF; + uses + {$IFDEF ENABLE_MENU} + g_gui, + {$ENDIF} + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + Math, ENet, e_input, e_log, g_base, g_basic, + g_textures, g_sound, g_console, g_options, + g_game, g_player, g_map, g_panel, g_items, g_weapons, g_phys, + g_language, g_monsters, g_netmaster, utils, wadreader, MAPDEF + ; const NET_KEY_LEFT = 1 shl 0; @@ -1735,54 +1739,65 @@ begin case Kind of NET_GFX_SPARK: - g_GFX_Spark(X, Y, 2 + Random(2), Ang, 0, 0); - + begin + {$IFDEF ENABLE_GFX} + g_GFX_Spark(X, Y, 2 + Random(2), Ang, 0, 0); + {$ENDIF} + end; NET_GFX_TELE: begin - g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X, Y); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X, Y); + {$ENDIF} if Ang = 1 then g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y); end; - NET_GFX_EXPLODE: begin - g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, X - 64, Y - 64); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, X - 64, Y - 64); + {$ENDIF} if Ang = 1 then g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', X, Y); end; - NET_GFX_BFGEXPL: begin - g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, X - 64, Y - 64); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, X - 64, Y - 64); + {$ENDIF} if Ang = 1 then g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', X, Y); end; - NET_GFX_BFGHIT: begin - g_GFX_QueueEffect(R_GFX_BFG_HIT, X - 32, Y - 32); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_BFG_HIT, X - 32, Y - 32); + {$ENDIF} end; - NET_GFX_FIRE: begin - g_GFX_QueueEffect(R_GFX_FIRE, X, Y); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_FIRE, X, Y); + {$ENDIF} if Ang = 1 then g_Sound_PlayExAt('SOUND_FIRE', X, Y); end; - NET_GFX_RESPAWN: begin - g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X, Y); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X, Y); + {$ENDIF} if Ang = 1 then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y); end; - NET_GFX_SHELL1: + begin g_Player_CreateShell(X, Y, 0, -2, SHELL_BULLET); - + end; NET_GFX_SHELL2: + begin g_Player_CreateShell(X, Y, 0, -2, SHELL_SHELL); - + end; NET_GFX_SHELL3: begin g_Player_CreateShell(X, Y, 0, -2, SHELL_SHELL); @@ -2735,7 +2750,9 @@ begin if not Quiet then begin g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y); - g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16); + {$ENDIF} end; end; diff --git a/src/game/g_options.pas b/src/game/g_options.pas index dea1ca3..ea41a27 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -125,7 +125,10 @@ uses {$IFDEF USE_SDL2} SDL2, {$ENDIF} - e_log, e_input, g_console, g_sound, g_gfx, g_player, Math, + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + e_log, e_input, g_console, g_sound, g_player, Math, g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_items, wadreader, envvars; @@ -277,7 +280,9 @@ begin end; (* section Game *) - g_GFX_SetMax(2000); + {$IFDEF ENABLE_GFX} + g_GFX_SetMax(2000); + {$ENDIF} g_Shells_SetMax(300); g_Gibs_SetMax(150); g_Corpses_SetMax(20); diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas index c3f47cf..1d2c5d2 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -222,9 +222,13 @@ var implementation -uses - g_basic, g_map, g_game, g_gfx, g_weapons, g_triggers, g_items, - g_console, g_language, g_monsters, g_player, g_grid, e_log, geom, utils, xstreams; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + g_basic, g_map, g_game, g_weapons, g_triggers, g_items, + g_console, g_language, g_monsters, g_player, g_grid, e_log, geom, utils, xstreams + ; const PANEL_SIGNATURE = $4C4E4150; // 'PANL' @@ -446,7 +450,9 @@ begin e_LogWritefln('panel moved: arridx=%s; guid=%s; proxyid=%s; old:(%s,%s)-(%sx%s); new:(%s,%s)-(%sx%s)', [arrIdx, mGUID, proxyId, px, py, pw, ph, x, y, width, height]); } - g_Mark(px, py, pw, ph, MARK_WALL, false); + {$IFDEF ENABLE_GFX} + g_Mark(px, py, pw, ph, MARK_WALL, false); + {$ENDIF} if (Width < 1) or (Height < 1) then begin mapGrid.proxyEnabled[proxyId] := false; @@ -463,7 +469,9 @@ begin begin mapGrid.moveBody(proxyId, X, Y); end; - g_Mark(X, Y, Width, Height, MARK_WALL); + {$IFDEF ENABLE_GFX} + g_Mark(X, Y, Width, Height, MARK_WALL); + {$ENDIF} end; end; end; diff --git a/src/game/g_phys.pas b/src/game/g_phys.pas index 6919979..3ff102b 100644 --- a/src/game/g_phys.pas +++ b/src/game/g_phys.pas @@ -76,9 +76,13 @@ var implementation -uses - g_map, g_basic, Math, g_player, g_console, SysUtils, - g_sound, g_gfx, MAPDEF, g_monsters, g_game, utils; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + g_map, g_basic, Math, g_player, g_console, SysUtils, + g_sound, MAPDEF, g_monsters, g_game, utils + ; const @@ -225,11 +229,13 @@ begin g_Sound_PlayExAt('SOUND_GAME_BULK2', Obj^.X, Obj^.Y); end; - g_GFX_Water(Obj^.X+Obj^.Rect.X+(Obj^.Rect.Width div 2), - Obj^.Y+Obj^.Rect.Y+(Obj^.Rect.Height div 2), - Min(5*(abs(Obj^.Vel.X)+abs(Obj^.Vel.Y)), 50), - -Obj^.Vel.X, -Obj^.Vel.Y, - Obj^.Rect.Width, 16, Color); + {$IFDEF ENABLE_GFX} + g_GFX_Water(Obj^.X+Obj^.Rect.X+(Obj^.Rect.Width div 2), + Obj^.Y+Obj^.Rect.Y+(Obj^.Rect.Height div 2), + Min(5*(abs(Obj^.Vel.X)+abs(Obj^.Vel.Y)), 50), + -Obj^.Vel.X, -Obj^.Vel.Y, + Obj^.Rect.Width, 16, Color); + {$ENDIF} end; diff --git a/src/game/g_player.pas b/src/game/g_player.pas index db45572..45e1461 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -657,7 +657,10 @@ uses {$IFNDEF HEADLESS} r_render, {$ENDIF} - e_log, g_map, g_items, g_console, g_gfx, Math, + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + e_log, g_map, g_items, g_console, Math, g_options, g_triggers, g_game, g_grid, e_res, wadreader, g_monsters, CONFIG, g_language, g_net, g_netmsg, @@ -1581,7 +1584,9 @@ procedure g_Player_CreateGibs (fX, fY, mid: Integer; fColor: TRGB); var a: Integer; GibsArray: TGibsArray; - Blood: TModelBlood; + {$IFDEF ENABLE_GFX} + Blood: TModelBlood; + {$ENDIF} begin if mid = -1 then Exit; @@ -1589,7 +1594,10 @@ begin Exit; if not g_PlayerModel_GetGibs(mid, GibsArray) then Exit; - Blood := PlayerModelsArray[mid].Blood; + + {$IFDEF ENABLE_GFX} + Blood := PlayerModelsArray[mid].Blood; + {$ENDIF} for a := 0 to High(GibsArray) do with gGibs[CurrentGib] do @@ -1613,9 +1621,24 @@ begin positionChanged(); // this updates spatial accelerators RAngle := Random(360); - if gBloodCount > 0 then - g_GFX_Blood(fX, fY, 16*gBloodCount+Random(5*gBloodCount), -16+Random(33), -16+Random(33), - Random(48), Random(48), Blood.R, Blood.G, Blood.B, Blood.Kind); + {$IFDEF ENABLE_GFX} + if gBloodCount > 0 then + begin + g_GFX_Blood( + fX, + fY, + 16 * gBloodCount + Random(5 * gBloodCount), + -16 + Random(33), + -16 + Random(33), + Random(48), + Random(48), + Blood.R, + Blood.G, + Blood.B, + Blood.Kind + ); + end; + {$ENDIF} if CurrentGib >= High(gGibs) then CurrentGib := 0 @@ -2220,14 +2243,16 @@ begin HIT_BFG, HIT_ROCKET, HIT_SOME: MakeBloodVector(c, vx, vy); end; - if t = HIT_WATER then - begin - g_GFX_Bubbles(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), - FObj.Y+PLAYER_RECT.Y-4, value div 2, 8, 4); - if Random(2) = 0 - then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) - else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); - end; + {$IFDEF ENABLE_GFX} + if t = HIT_WATER then + begin + g_GFX_Bubbles(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), + FObj.Y+PLAYER_RECT.Y-4, value div 2, 8, 4); + if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); + end; + {$ENDIF} end; // Буфер урона: @@ -3027,27 +3052,35 @@ begin end; procedure TPlayer.MakeBloodSimple(Count: Word); - var Blood: TModelBlood; + {$IFDEF ENABLE_GFX} + var Blood: TModelBlood; + {$ENDIF} begin - Blood := SELF.FModel.GetBlood(); - g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)+8, - FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2), - Count div 2, 3, -1, 16, (PLAYER_RECT.Height*2 div 3), - Blood.R, Blood.G, Blood.B, Blood.Kind); - g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-8, - FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2), - Count div 2, -3, -1, 16, (PLAYER_RECT.Height*2) div 3, - Blood.R, Blood.G, Blood.B, Blood.Kind); + {$IFDEF ENABLE_GFX} + Blood := SELF.FModel.GetBlood(); + g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)+8, + FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2), + Count div 2, 3, -1, 16, (PLAYER_RECT.Height*2 div 3), + Blood.R, Blood.G, Blood.B, Blood.Kind); + g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-8, + FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2), + Count div 2, -3, -1, 16, (PLAYER_RECT.Height*2) div 3, + Blood.R, Blood.G, Blood.B, Blood.Kind); + {$ENDIF} end; procedure TPlayer.MakeBloodVector(Count: Word; VelX, VelY: Integer); - var Blood: TModelBlood; + {$IFDEF ENABLE_GFX} + var Blood: TModelBlood; + {$ENDIF} begin - Blood := SELF.FModel.GetBlood(); - g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), - FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2), - Count, VelX, VelY, 16, (PLAYER_RECT.Height*2) div 3, - Blood.R, Blood.G, Blood.B, Blood.Kind); + {$IFDEF ENABLE_GFX} + Blood := SELF.FModel.GetBlood(); + g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), + FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2), + Count, VelX, VelY, 16, (PLAYER_RECT.Height*2) div 3, + Blood.R, Blood.G, Blood.B, Blood.Kind); + {$ENDIF} end; procedure TPlayer.ProcessWeaponAction(Action: Byte); @@ -3999,13 +4032,17 @@ begin FFirePainTime := 0; FFireAttacker := 0; -// Анимация возрождения: - if (not gLoadGameMode) and (not Silent) then - g_GFX_QueueEffect( - R_GFX_TELEPORT_FAST, - FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32, - FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32 - ); + {$IFDEF ENABLE_GFX} + // Анимация возрождения: + if (not gLoadGameMode) and (not Silent) then + begin + g_GFX_QueueEffect( + R_GFX_TELEPORT_FAST, + FObj.X + PLAYER_RECT.X + (PLAYER_RECT.Width div 2) - 32, + FObj.Y + PLAYER_RECT.Y + (PLAYER_RECT.Height div 2) - 32 + ); + end; + {$ENDIF} FSpectator := False; FGhost := False; @@ -4201,11 +4238,13 @@ begin if not silent then begin g_Sound_PlayExAt('SOUND_GAME_TELEPORT', FObj.X, FObj.Y); - g_GFX_QueueEffect( - R_GFX_TELEPORT_FAST, - FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32, - FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_TELEPORT_FAST, + FObj.X + PLAYER_RECT.X + (PLAYER_RECT.Width div 2) - 32, + FObj.Y + PLAYER_RECT.Y + (PLAYER_RECT.Height div 2) - 32 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32, FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, 1, @@ -4253,11 +4292,13 @@ begin if not silent then begin - g_GFX_QueueEffect( - R_GFX_TELEPORT_FAST, - FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32, - FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_TELEPORT_FAST, + FObj.X + PLAYER_RECT.X + (PLAYER_RECT.Width div 2) - 32, + FObj.Y + PLAYER_RECT.Y + (PLAYER_RECT.Height div 2) - 32 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32, FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, 0, @@ -4646,7 +4687,9 @@ begin end else if (FAir mod 31 = 0) and not blockmon then begin - g_GFX_Bubbles(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), FObj.Y+PLAYER_RECT.Y-4, 5+Random(6), 8, 4); + {$IFDEF ENABLE_GFX} + g_GFX_Bubbles(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), FObj.Y+PLAYER_RECT.Y-4, 5+Random(6), 8, 4); + {$ENDIF} if Random(2) = 0 then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); @@ -5745,8 +5788,10 @@ begin if BodyInLiquid(0, 0) then begin - g_GFX_Bubbles(Obj.X+Obj.Rect.X+(Obj.Rect.Width div 2)+Random(3)-1, - Obj.Y+Obj.Rect.Height+8, 1, 8, 4); + {$IFDEF ENABLE_GFX} + g_GFX_Bubbles(Obj.X+Obj.Rect.X+(Obj.Rect.Width div 2)+Random(3)-1, + Obj.Y+Obj.Rect.Height+8, 1, 8, 4); + {$ENDIF} if Random(2) = 0 then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); @@ -5755,11 +5800,13 @@ begin for i := 1 to Times do begin - g_GFX_QueueEffect( - R_GFX_SMOKE_TRANS, - Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_SMOKE_WIDTH div 2), - Obj.Y+Obj.Rect.Height-4+Random(8+Times*2) - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_SMOKE_TRANS, + Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_SMOKE_WIDTH div 2), + Obj.Y+Obj.Rect.Height-4+Random(8+Times*2) + ); + {$ENDIF} end; end; @@ -5771,11 +5818,13 @@ begin for i := 1 to Times do begin - g_GFX_QueueEffect( - R_GFX_FLAME, - Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_FLAME_WIDTH div 2), - Obj.Y+8+Random(8+Times*2) - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_FLAME, + Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_FLAME_WIDTH div 2), + Obj.Y+8+Random(8+Times*2) + ); + {$ENDIF} end; end; @@ -5847,7 +5896,9 @@ end; procedure TCorpse.Damage(Value: Word; SpawnerUID: Word; vx, vy: Integer); - var Blood: TModelBlood; + {$IFDEF ENABLE_GFX} + var Blood: TModelBlood; + {$ENDIF} begin if FState = CORPSE_STATE_REMOVEME then Exit; @@ -5881,13 +5932,15 @@ begin end else begin - Blood := FModel.GetBlood(); FObj.Vel.X := FObj.Vel.X + vx; FObj.Vel.Y := FObj.Vel.Y + vy; - g_GFX_Blood(FObj.X+PLAYER_CORPSERECT.X+(PLAYER_CORPSERECT.Width div 2), - FObj.Y+PLAYER_CORPSERECT.Y+(PLAYER_CORPSERECT.Height div 2), - Value, vx, vy, 16, (PLAYER_CORPSERECT.Height*2) div 3, - Blood.R, Blood.G, Blood.B, Blood.Kind); + {$IFDEF ENABLE_GFX} + Blood := FModel.GetBlood(); + g_GFX_Blood(FObj.X+PLAYER_CORPSERECT.X+(PLAYER_CORPSERECT.Width div 2), + FObj.Y+PLAYER_CORPSERECT.Y+(PLAYER_CORPSERECT.Height div 2), + Value, vx, vy, 16, (PLAYER_CORPSERECT.Height*2) div 3, + Blood.R, Blood.G, Blood.B, Blood.Kind); + {$ENDIF} end; end; diff --git a/src/game/g_playermodel.pas b/src/game/g_playermodel.pas index 86d5b5a..34dbdfd 100644 --- a/src/game/g_playermodel.pas +++ b/src/game/g_playermodel.pas @@ -18,7 +18,7 @@ unit g_playermodel; interface - uses MAPDEF, g_textures, g_base, g_basic, g_weapons, utils, g_gfx; + uses MAPDEF, g_textures, g_base, g_basic, g_weapons, utils; const A_STAND = 0; @@ -74,9 +74,11 @@ type Back: Boolean; end; +{$IFDEF ENABLE_GFX} TModelBlood = record R, G, B, Kind: Byte; end; +{$ENDIF} TModelSound = record ID: DWORD; @@ -109,7 +111,10 @@ type function PlaySound(SoundType, Level: Byte; X, Y: Integer): Boolean; procedure Update(); - function GetBlood (): TModelBlood; + {$IFDEF ENABLE_GFX} + function GetBlood (): TModelBlood; + {$ENDIF} + function GetName (): String; published @@ -130,11 +135,14 @@ procedure g_PlayerModel_LoadAll; procedure g_PlayerModel_FreeData(); function g_PlayerModel_Load(FileName: String): Boolean; function g_PlayerModel_GetNames(): SSArray; -function g_PlayerModel_GetBlood(ModelName: String): TModelBlood; function g_PlayerModel_Get(ModelName: String): TPlayerModel; function g_PlayerModel_GetGibs (ModelID: Integer; var Gibs: TGibsArray): Boolean; function g_PlayerModel_GetIndex (ModelName: String): Integer; +{$IFDEF ENABLE_GFX} + function g_PlayerModel_GetBlood(ModelName: String): TModelBlood; +{$ENDIF} + procedure g_PlayerModel_LoadFake (ModelName, FileName: String); (* --- private data --- *) @@ -152,7 +160,9 @@ procedure g_PlayerModel_LoadFake (ModelName, FileName: String); PainSounds: TModelSoundArray; DieSounds: TModelSoundArray; SlopSound: Byte; - Blood: TModelBlood; + {$IFDEF ENABLE_GFX} + Blood: TModelBlood; + {$ENDIF} // ======================= FileName: String; Anim: TModelTextures; @@ -167,9 +177,13 @@ procedure g_PlayerModel_LoadFake (ModelName, FileName: String); implementation -uses - g_sound, g_console, SysUtils, g_player, CONFIG, - e_sound, g_options, g_map, Math, e_log, wadreader; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + g_sound, g_console, SysUtils, g_player, CONFIG, + e_sound, g_options, g_map, Math, e_log, wadreader + ; const FLAG_DEFPOINT: TDFPoint = (X:32; Y:16); @@ -358,19 +372,22 @@ begin PlayerModelsArray[ID].Author := config.ReadStr('Model', 'author', ''); PlayerModelsArray[ID].Description := config.ReadStr('Model', 'description', ''); PlayerModelsArray[ID].FileName := FileName; - with PlayerModelsArray[ID] do - begin - Blood.R := MAX(0, MIN(255, config.ReadInt('Blood', 'R', 150))); - Blood.G := MAX(0, MIN(255, config.ReadInt('Blood', 'G', 0))); - Blood.B := MAX(0, MIN(255, config.ReadInt('Blood', 'B', 0))); - case config.ReadStr('Blood', 'Kind', 'NORMAL') of - 'NORMAL': Blood.Kind := BLOOD_NORMAL; - 'SPARKS': Blood.Kind := BLOOD_CSPARKS; - 'COMBINE': Blood.Kind := BLOOD_COMBINE; - else - Blood.Kind := BLOOD_NORMAL - end - end; + + {$IFDEF ENABLE_GFX} + with PlayerModelsArray[ID] do + begin + Blood.R := MAX(0, MIN(255, config.ReadInt('Blood', 'R', 150))); + Blood.G := MAX(0, MIN(255, config.ReadInt('Blood', 'G', 0))); + Blood.B := MAX(0, MIN(255, config.ReadInt('Blood', 'B', 0))); + case config.ReadStr('Blood', 'Kind', 'NORMAL') of + 'NORMAL': Blood.Kind := BLOOD_NORMAL; + 'SPARKS': Blood.Kind := BLOOD_CSPARKS; + 'COMBINE': Blood.Kind := BLOOD_COMBINE; + else + Blood.Kind := BLOOD_NORMAL + end + end; + {$ENDIF} for b := A_STAND to A_LAST do begin @@ -625,6 +642,7 @@ begin end; end; +{$IFDEF ENABLE_GFX} function g_PlayerModel_GetBlood(ModelName: string): TModelBlood; var a: Integer; @@ -642,6 +660,7 @@ begin Break; end; end; +{$ENDIF} procedure g_PlayerModel_FreeData(); var i, b: Integer; @@ -769,10 +788,12 @@ end; FCurrentWeapon := Weapon end; +{$IFDEF ENABLE_GFX} function TPlayerModel.GetBlood (): TModelBlood; begin Result := PlayerModelsArray[FID].Blood end; +{$ENDIF} function TPlayerModel.GetName (): String; begin diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index b816588..afbfc43 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -101,12 +101,16 @@ var implementation -uses - Math, - g_player, g_map, g_panel, g_gfx, g_game, - g_console, g_monsters, g_items, g_phys, g_weapons, - wadreader, e_log, g_language, e_res, - g_options, g_net, g_netmsg, utils, xparser, xstreams; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + Math, + g_player, g_map, g_panel, g_game, + g_console, g_monsters, g_items, g_phys, g_weapons, + wadreader, e_log, g_language, e_res, + g_options, g_net, g_netmsg, utils, xparser, xstreams + ; const TRIGGER_SIGNATURE = $58475254; // 'TRGX' @@ -776,7 +780,9 @@ begin TRIGGER_SHOT_EXPL: begin - g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, wx - 64, wy - 64); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, wx - 64, wy - 64); + {$ENDIF} Projectile := False; g_Weapon_Explode(wx, wy, 60, 0); snd := 'SOUND_WEAPON_EXPLODEROCKET'; @@ -784,7 +790,9 @@ begin TRIGGER_SHOT_BFGEXPL: begin - g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, wx - 64, wy - 64); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, wx - 64, wy - 64); + {$ENDIF} Projectile := False; g_Weapon_BFG9000(wx, wy, 0); snd := 'SOUND_WEAPON_EXPLODEBFG'; @@ -852,46 +860,54 @@ end; procedure tr_MakeEffect (X, Y, VX, VY: Integer; T, ST, CR, CG, CB: Byte; Silent, Send: Boolean); begin - if T = TRIGGER_EFFECT_PARTICLE then - begin - case ST of - TRIGGER_EFFECT_SLIQUID: - begin - if (CR = 255) and (CG = 0) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 1, 0, 0, 0) - else if (CR = 0) and (CG = 255) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 2, 0, 0, 0) - else if (CR = 0) and (CG = 0) and (CB = 255) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 3, 0, 0, 0) - else g_GFX_SimpleWater(X, Y, 1, VX, VY, 0, 0, 0, 0); - end; - TRIGGER_EFFECT_LLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 4, CR, CG, CB); - TRIGGER_EFFECT_DLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 5, CR, CG, CB); - TRIGGER_EFFECT_BLOOD: g_GFX_Blood(X, Y, 1, VX, VY, 0, 0, CR, CG, CB); - TRIGGER_EFFECT_SPARK: g_GFX_Spark(X, Y, 1, GetAngle2(VX, VY), 0, 0); - TRIGGER_EFFECT_BUBBLE: + if T = TRIGGER_EFFECT_PARTICLE then + begin + {$IFDEF ENABLE_GFX} + case ST of + TRIGGER_EFFECT_SLIQUID: + begin + if (CR = 255) and (CG = 0) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 1, 0, 0, 0) + else if (CR = 0) and (CG = 255) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 2, 0, 0, 0) + else if (CR = 0) and (CG = 0) and (CB = 255) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 3, 0, 0, 0) + else g_GFX_SimpleWater(X, Y, 1, VX, VY, 0, 0, 0, 0); + end; + TRIGGER_EFFECT_LLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 4, CR, CG, CB); + TRIGGER_EFFECT_DLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 5, CR, CG, CB); + TRIGGER_EFFECT_BLOOD: g_GFX_Blood(X, Y, 1, VX, VY, 0, 0, CR, CG, CB); + TRIGGER_EFFECT_SPARK: g_GFX_Spark(X, Y, 1, GetAngle2(VX, VY), 0, 0); + TRIGGER_EFFECT_BUBBLE: g_GFX_Bubbles(X, Y, 1, 0, 0); + end; + {$ENDIF} + if ST = TRIGGER_EFFECT_BUBBLE then begin - g_GFX_Bubbles(X, Y, 1, 0, 0); if not Silent then if Random(2) = 0 - then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', X, Y) - else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', X, Y); + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', X, Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', X, Y); end; end; - end; if T = TRIGGER_EFFECT_ANIMATION then begin case ST of EFFECT_TELEPORT: begin if not Silent then g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y); - g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X - 32, Y - 32); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X - 32, Y - 32); + {$ENDIF} if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X, Y, Byte(not Silent), NET_GFX_TELE); end; EFFECT_RESPAWN: begin if not Silent then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y); - g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X - 16, Y - 16); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X - 16, Y - 16); + {$ENDIF} if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X-16, Y-16, Byte(not Silent), NET_GFX_RESPAWN); end; EFFECT_FIRE: begin if not Silent then g_Sound_PlayExAt('SOUND_FIRE', X, Y); - g_GFX_QueueEffect(R_GFX_FIRE, X - 32, Y - 128); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_FIRE, X - 32, Y - 128); + {$ENDIF} if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X-32, Y-128, Byte(not Silent), NET_GFX_FIRE); end; end; @@ -1473,37 +1489,46 @@ begin if tgcMax > 0 then Inc(SpawnedCount); case tgcEffect of - EFFECT_TELEPORT: begin + EFFECT_TELEPORT: + begin g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); - g_GFX_QueueEffect( - R_GFX_TELEPORT_FAST, - mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, - mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-32 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_TELEPORT_FAST, + mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, + mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-32 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-32, 1, NET_GFX_TELE); end; - EFFECT_RESPAWN: begin + EFFECT_RESPAWN: + begin g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); - g_GFX_QueueEffect( - R_GFX_ITEM_RESPAWN, - mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-16, - mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-16 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_ITEM_RESPAWN, + mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-16, + mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-16 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-16, mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-16, 1, NET_GFX_RESPAWN); end; - EFFECT_FIRE: begin + EFFECT_FIRE: + begin g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); - g_GFX_QueueEffect( - R_GFX_FIRE, - mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, - mon.Obj.Y+mon.Obj.Rect.Y+mon.Obj.Rect.Height-128 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_FIRE, + mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, + mon.Obj.Y+mon.Obj.Rect.Y+mon.Obj.Rect.Height-128 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, mon.Obj.Y+mon.Obj.Rect.Y+mon.Obj.Rect.Height-128, 1, @@ -1559,40 +1584,49 @@ begin if tgcMax > 0 then Inc(SpawnedCount); case tgcEffect of - EFFECT_TELEPORT: begin + EFFECT_TELEPORT: + begin it := g_Items_ByIdx(iid); g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); - g_GFX_QueueEffect( - R_GFX_TELEPORT_FAST, - it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, - it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-32 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_TELEPORT_FAST, + it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, + it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-32 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-32, 1, NET_GFX_TELE); end; - EFFECT_RESPAWN: begin + EFFECT_RESPAWN: + begin it := g_Items_ByIdx(iid); g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); - g_GFX_QueueEffect( - R_GFX_ITEM_RESPAWN, - it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-16, - it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-16 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_ITEM_RESPAWN, + it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-16, + it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-16 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-16, it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-16, 1, NET_GFX_RESPAWN); end; - EFFECT_FIRE: begin + EFFECT_FIRE: + begin it := g_Items_ByIdx(iid); g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); - g_GFX_QueueEffect( - R_GFX_FIRE, - it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, - it.Obj.Y+it.Obj.Rect.Y+it.Obj.Rect.Height-128 - ); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_FIRE, + it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, + it.Obj.Y+it.Obj.Rect.Y+it.Obj.Rect.Height-128 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, it.Obj.Y+it.Obj.Rect.Y+it.Obj.Rect.Height-128, 1, diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas index ce840d0..922f8dc 100644 --- a/src/game/g_weapons.pas +++ b/src/game/g_weapons.pas @@ -110,12 +110,16 @@ var implementation -uses - Math, g_map, g_player, g_gfx, g_sound, g_panel, - g_console, g_options, g_game, - g_triggers, MAPDEF, e_log, g_monsters, g_saveload, - g_language, g_netmsg, g_grid, - geom, binheap, hashtable, utils, xstreams; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + Math, g_map, g_player, g_sound, g_panel, + g_console, g_options, g_game, + g_triggers, MAPDEF, e_log, g_monsters, g_saveload, + g_language, g_netmsg, g_grid, + geom, binheap, hashtable, utils, xstreams + ; type TWaterPanel = record @@ -1545,7 +1549,9 @@ begin stt := getTimeMicro()-stt; e_WriteLog(Format('*** new trace time: %u microseconds', [LongWord(stt)]), TMsgType.Notify); {$ENDIF} - g_GFX_Spark(wallHitX, wallHitY, 2+Random(2), 180+a, 0, 0); + {$IFDEF ENABLE_GFX} + g_GFX_Spark(wallHitX, wallHitY, 2+Random(2), 180+a, 0, 0); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(wallHitX, wallHitY, 180+a, NET_GFX_SPARK); end else @@ -1887,7 +1893,7 @@ end; procedure g_Weapon_aplasma(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1; Silent: Boolean = False; compat: Boolean = true); var - find_id, FramesID: DWORD; + find_id: DWORD; dx, dy: Integer; begin if WID < 0 then @@ -2011,7 +2017,9 @@ end; procedure g_Weapon_bfghit(x, y: Integer); begin - g_GFX_QueueEffect(R_GFX_BFG_HIT, x - 32, y - 32); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_BFG_HIT, x - 32, y - 32); + {$ENDIF} end; procedure g_Weapon_pistol(x, y, xd, yd: Integer; SpawnerUID: Word; @@ -2113,7 +2121,9 @@ var o: TObj; spl: Boolean; Loud: Boolean; - tcx, tcy: Integer; + {$IFDEF ENABLE_GFX} + var tcx, tcy: Integer; + {$ENDIF} begin if Shots = nil then Exit; @@ -2197,14 +2207,18 @@ begin //  âîäå øëåéô - ïóçûðè, â âîçäóõå øëåéô - äûì: if WordBool(st and MOVE_INWATER) then begin - g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16); + {$IFDEF ENABLE_GFX} + g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16); + {$ENDIF} if Random(2) = 0 then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', cx, cy) else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', cx, cy); end else begin - g_GFX_QueueEffect(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), cy-20+Random(9)); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), cy-20+Random(9)); + {$ENDIF} end; // Ïîïàëè â êîãî-òî èëè â ñòåíó: @@ -2218,15 +2232,19 @@ begin g_Weapon_Explode(cx, cy, 60, SpawnerUID); if ShotType = WEAPON_SKEL_FIRE then - begin // Âçðûâ ñíàðÿäà Ñêåëåòà + begin // Âçðûâ ñíàðÿäà Ñêåëåòà + {$IFDEF ENABLE_GFX} g_GFX_QueueEffect(R_GFX_EXPLODE_SKELFIRE, Obj.X + 32 - 58, Obj.Y + 8 - 36); g_DynLightExplosion((Obj.X+32), (Obj.Y+8), 64, 1, 0, 0); - end + {$ENDIF} + end else - begin // Âçðûâ Ðàêåòû + begin // Âçðûâ Ðàêåòû + {$IFDEF ENABLE_GFX} g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); g_DynLightExplosion(cx, cy, 64, 1, 0, 0); - end; + {$ENDIF} + end; g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', Obj.X, Obj.Y); @@ -2269,11 +2287,13 @@ begin (g_Weapon_Hit(@Obj, a, SpawnerUID, HIT_SOME, False) <> 0) or (Timeout < 1) then begin - if ShotType = WEAPON_PLASMA then - g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) - else - g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); - g_DynLightExplosion(cx, cy, 32, 0, 0.5, 0.5); + {$IFDEF ENABLE_GFX} + if ShotType = WEAPON_PLASMA then + g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) + else + g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); + g_DynLightExplosion(cx, cy, 32, 0, 0.5, 0.5); + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEPLASMA', Obj.X, Obj.Y); ShotType := 0; end; @@ -2292,13 +2312,17 @@ begin begin if WordBool(st and MOVE_HITWATER) then begin - tcx := Random(8); - tcy := Random(8); - g_GFX_QueueEffect(R_GFX_SMOKE, cx-4+tcx-(R_GFX_SMOKE_WIDTH div 2), cy-4+tcy-(R_GFX_SMOKE_HEIGHT div 2)); + {$IFDEF ENABLE_GFX} + tcx := Random(8); + tcy := Random(8); + g_GFX_QueueEffect(R_GFX_SMOKE, cx-4+tcx-(R_GFX_SMOKE_WIDTH div 2), cy-4+tcy-(R_GFX_SMOKE_HEIGHT div 2)); + {$ENDIF} end else begin - g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16); + {$IFDEF ENABLE_GFX} + g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16); + {$ENDIF} if Random(2) = 0 then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', cx, cy) else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', cx, cy); @@ -2342,14 +2366,16 @@ begin if (gTime mod LongWord(tf) = 0) then begin - case Stopped of - MOVE_HITWALL: begin tcx := cx-4+Random(8); tcy := cy-12+Random(24); end; - MOVE_HITLAND: begin tcx := cx-12+Random(24); tcy := cy-10+Random(8); end; - MOVE_HITCEIL: begin tcx := cx-12+Random(24); tcy := cy+6+Random(8); end; - else begin tcx := cx-4+Random(8); tcy := cy-4+Random(8); end; - end; - g_GFX_QueueEffect(R_GFX_FLAME_RAND, tcx - (R_GFX_FLAME_WIDTH div 2), tcy - (R_GFX_FLAME_HEIGHT div 2)); - //g_DynLightExplosion(tcx, tcy, 1, 1, 0.8, 0.3); + {$IFDEF ENABLE_GFX} + case Stopped of + MOVE_HITWALL: begin tcx := cx-4+Random(8); tcy := cy-12+Random(24); end; + MOVE_HITLAND: begin tcx := cx-12+Random(24); tcy := cy-10+Random(8); end; + MOVE_HITCEIL: begin tcx := cx-12+Random(24); tcy := cy+6+Random(8); end; + else begin tcx := cx-4+Random(8); tcy := cy-4+Random(8); end; + end; + g_GFX_QueueEffect(R_GFX_FLAME_RAND, tcx - (R_GFX_FLAME_WIDTH div 2), tcy - (R_GFX_FLAME_HEIGHT div 2)); + //g_DynLightExplosion(tcx, tcy, 1, 1, 0.8, 0.3); + {$ENDIF} end; end; @@ -2371,8 +2397,10 @@ begin begin // Ëó÷è BFG: if g_Game_IsServer then g_Weapon_BFG9000(cx, cy, SpawnerUID); - g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); - g_DynLightExplosion(cx, cy, 96, 0, 1, 0); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); + g_DynLightExplosion(cx, cy, 96, 0, 1, 0); + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', Obj.X, Obj.Y); ShotType := 0; end; @@ -2398,11 +2426,13 @@ begin (g_Weapon_Hit(@Obj, a, SpawnerUID, HIT_SOME) <> 0) or (Timeout < 1) then begin - case ShotType of - WEAPON_IMP_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32); - WEAPON_CACO_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32); - WEAPON_BARON_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32); - end; + {$IFDEF ENABLE_GFX} + case ShotType of + WEAPON_IMP_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32); + WEAPON_CACO_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32); + WEAPON_BARON_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32); + end; + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); ShotType := 0; end; @@ -2419,8 +2449,10 @@ begin (g_Weapon_Hit(@Obj, 40, SpawnerUID, HIT_SOME, False) <> 0) or (Timeout < 1) then begin - // Âçðûâ: - g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + // Âçðûâ: + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); ShotType := 0; end; @@ -2582,7 +2614,9 @@ begin end; procedure g_Weapon_DestroyShot(I: Integer; X, Y: Integer; Loud: Boolean = True); - var cx, cy: Integer; + {$IFDEF ENABLE_GFX} + var cx, cy: Integer; + {$ENDIF} begin if Shots = nil then Exit; @@ -2593,18 +2627,22 @@ begin if ShotType = 0 then Exit; Obj.X := X; Obj.Y := Y; - cx := Obj.X + (Obj.Rect.Width div 2); - cy := Obj.Y + (Obj.Rect.Height div 2); + {$IFDEF ENABLE_GFX} + cx := Obj.X + (Obj.Rect.Width div 2); + cy := Obj.Y + (Obj.Rect.Height div 2); + {$ENDIF} case ShotType of WEAPON_ROCKETLAUNCHER, WEAPON_SKEL_FIRE: // Ðàêåòû è ñíàðÿäû Ñêåëåòà begin if Loud then begin - if ShotType = WEAPON_SKEL_FIRE then - g_GFX_QueueEffect(R_GFX_EXPLODE_SKELFIRE, (Obj.X + 32) - 32, (Obj.Y + 8) - 32) - else - g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + {$IFDEF ENABLE_GFX} + if ShotType = WEAPON_SKEL_FIRE then + g_GFX_QueueEffect(R_GFX_EXPLODE_SKELFIRE, (Obj.X + 32) - 32, (Obj.Y + 8) - 32) + else + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', Obj.X, Obj.Y); end; end; @@ -2613,17 +2651,21 @@ begin begin if loud then begin - if ShotType = WEAPON_PLASMA then - g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) - else - g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); + {$IFDEF ENABLE_GFX} + if ShotType = WEAPON_PLASMA then + g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) + else + g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEPLASMA', Obj.X, Obj.Y); end; end; WEAPON_BFG: // BFG begin - g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', Obj.X, Obj.Y); end; @@ -2631,18 +2673,22 @@ begin begin if loud then begin - case ShotType of - WEAPON_IMP_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32); - WEAPON_CACO_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32); - WEAPON_BARON_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32); - end; + {$IFDEF ENABLE_GFX} + case ShotType of + WEAPON_IMP_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32); + WEAPON_CACO_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32); + WEAPON_BARON_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32); + end; + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); end; end; WEAPON_MANCUB_FIRE: // Âûñòðåë Ìàíêóáóñà begin - g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + {$ENDIF} g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); end; end; // case ShotType of... diff --git a/src/game/opengl/r_game.pas b/src/game/opengl/r_game.pas index 734eb1d..05346f3 100644 --- a/src/game/opengl/r_game.pas +++ b/src/game/opengl/r_game.pas @@ -44,14 +44,17 @@ implementation {$IFDEF ENABLE_MENU} g_gui, g_menu, {$ENDIF} + {$IFDEF ENABLE_GFX} + g_gfx, r_gfx, + {$ENDIF} SysUtils, Classes, Math, g_base, g_basic, r_graphics, g_system, MAPDEF, xprofiler, utils, wadreader, CONFIG, e_input, e_sound, g_language, g_console, g_triggers, g_player, g_options, g_monsters, g_map, g_panel, - g_items, g_weapons, g_gfx, g_phys, g_net, g_netmaster, - g_game, r_console, r_gfx, r_items, r_map, r_monsters, r_weapons, r_netmaster, r_player, r_textures, + g_items, g_weapons, g_phys, g_net, g_netmaster, + g_game, r_console, r_items, r_map, r_monsters, r_weapons, r_netmaster, r_player, r_textures, r_playermodel ; @@ -1552,7 +1555,9 @@ begin drawOther('monsters', @r_Monsters_Draw); drawOther('itemdrop', @r_Items_DrawDrop); drawPanelType('*door', PANEL_CLOSEDOOR, g_rlayer_door); - drawOther('gfx', @r_GFX_Draw); + {$IFDEF ENABLE_GFX} + drawOther('gfx', @r_GFX_Draw); + {$ENDIF} drawOther('flags', @r_Map_DrawFlags); drawPanelType('*acid1', PANEL_ACID1, g_rlayer_acid1); drawPanelType('*acid2', PANEL_ACID2, g_rlayer_acid2); diff --git a/src/game/opengl/r_render.pas b/src/game/opengl/r_render.pas index 203c9c2..74bb0ab 100644 --- a/src/game/opengl/r_render.pas +++ b/src/game/opengl/r_render.pas @@ -37,12 +37,15 @@ interface function r_Render_WriteScreenShot (filename: String): Boolean; function r_Render_GetGibRect (m, id: Integer): TRectWH; - procedure r_Render_QueueEffect (AnimType, X, Y: Integer); -{$IFDEF ENABLE_TOUCH} - // touch screen button location and size - procedure r_Render_GetKeyRect (key: Integer; out x, y, w, h: Integer; out founded: Boolean); -{$ENDIF} + {$IFDEF ENABLE_GFX} + procedure r_Render_QueueEffect (AnimType, X, Y: Integer); + {$ENDIF} + + {$IFDEF ENABLE_TOUCH} + // touch screen button location and size + procedure r_Render_GetKeyRect (key: Integer; out x, y, w, h: Integer; out founded: Boolean); + {$ENDIF} procedure r_Render_DrawLoading (force: Boolean); // !!! remove it @@ -53,11 +56,14 @@ implementation {$IFDEF ENABLE_TOUCH} r_touch, {$ENDIF} + {$IFDEF ENABLE_GFX} + r_gfx, + {$ENDIF} SysUtils, Classes, Math, e_log, g_system, utils, g_game, g_options, g_console, r_window, r_graphics, r_console, r_playermodel, r_textures, r_animations, - r_weapons, r_items, r_gfx, r_monsters, r_map, r_player, r_game + r_weapons, r_items, r_monsters, r_map, r_player, r_game ; var @@ -206,12 +212,16 @@ implementation r_Monsters_Load; r_Weapon_Load; r_Items_Load; - r_GFX_Load; + {$IFDEF ENABLE_GFX} + r_GFX_Load; + {$ENDIF} end; procedure r_Render_Free; begin - r_GFX_Free; + {$IFDEF ENABLE_GFX} + r_GFX_Free; + {$ENDIF} r_Items_Free; r_Weapon_Free; r_Monsters_Free; @@ -244,7 +254,9 @@ implementation procedure r_Render_Update; begin - r_GFX_Update; + {$IFDEF ENABLE_GFX} + r_GFX_Update; + {$ENDIF} r_Map_Update; r_PlayerModel_Update; r_Console_Update; @@ -316,10 +328,12 @@ implementation Result := r_PlayerModel_GetGibRect(m, id) end; +{$IFDEF ENABLE_GFX} procedure r_Render_QueueEffect (AnimType, X, Y: Integer); begin r_GFX_OnceAnim(AnimType, X, Y) end; +{$ENDIF} {$IFDEF ENABLE_TOUCH} procedure r_Render_GetKeyRect (key: Integer; out x, y, w, h: Integer; out founded: Boolean); diff --git a/src/shared/a_modes.inc b/src/shared/a_modes.inc index 909a813..17f76e1 100644 --- a/src/shared/a_modes.inc +++ b/src/shared/a_modes.inc @@ -115,6 +115,11 @@ {$UNDEF ENABLE_TOUCH} {$DEFINE DISABLE_TOUCH} {$ENDIF} + {$IFDEF ENABLE_GFX} + {$WARNING GFX in headless mode has no sense. Disabled.} + {$UNDEF ENABLE_GFX} + {$DEFINE DISABLE_GFX} + {$ENDIF} {$ENDIF} {$IF DEFINED(ENABLE_MENU) AND DEFINED(DISABLE_MENU)} @@ -139,6 +144,17 @@ {$ENDIF} {$ENDIF} +{$IF DEFINED(ENABLE_GFX) AND DEFINED(DISABLE_GFX)} + {$ERROR Select ENABLE_GFX or DISABLE_GFX} +{$ELSEIF NOT DEFINED(ENABLE_GFX) AND NOT DEFINED(DISABLE_GFX)} + // default ENABLE/DISABLE gfx + {$IFDEF HEADLESS} + {$DEFINE DISABLE_GFX} + {$ELSE} + {$DEFINE ENABLE_GFX} + {$ENDIF} +{$ENDIF} + {$IF DEFINED(USE_SYSSTUB)} {$IF DEFINED(USE_SDL) OR DEFINED(USE_SDL2)} {$ERROR Only one system driver must be selected!} -- 2.29.2