From 965a25fec3fb93ced92ca5e4060dfa29141fa32b Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Mon, 17 Jan 2022 21:44:14 +0300 Subject: [PATCH] render: use only r_render to access render --- src/game/g_game.pas | 39 ++++++++++++++++++---------- src/game/g_gfx.pas | 38 +++++++++++++++++++++++++--- src/game/g_items.pas | 4 +-- src/game/g_monsters.pas | 8 +++--- src/game/g_netmsg.pas | 16 ++++++------ src/game/g_player.pas | 30 ++++++++++++++-------- src/game/g_triggers.pas | 24 +++++++++--------- src/game/g_weapons.pas | 46 +++++++++++++++++----------------- src/game/g_window.pas | 9 +++++-- src/game/opengl/r_game.pas | 2 ++ src/game/opengl/r_gfx.pas | 22 ++-------------- src/game/opengl/r_monsters.pas | 2 +- src/game/opengl/r_render.pas | 24 ++++++++++++++++++ 13 files changed, 166 insertions(+), 98 deletions(-) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 473ca90..36c4899 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -130,7 +130,9 @@ procedure g_Game_Announce_KillCombo(Param: Integer); procedure g_Game_Announce_BodyKill(SpawnerUID: Word); procedure g_Game_StartVote(Command, Initiator: string); procedure g_Game_CheckVote; -procedure g_TakeScreenShot(Filename: string = ''); +{$IFNDEF HEADLESS} + procedure g_TakeScreenShot(Filename: string = ''); +{$ENDIF} procedure g_FatalError(Text: String); procedure g_SimpleError(Text: String); function g_Game_IsTestMap(): Boolean; @@ -443,11 +445,14 @@ function gPause (): Boolean; inline; implementation uses -{$IFDEF ENABLE_HOLMES} - g_holmes, -{$ENDIF} - e_res, g_window, g_menu, r_render, r_gfx, - e_input, e_log, g_console, r_console, g_items, g_map, g_panel, + {$IFDEF ENABLE_HOLMES} + g_holmes, + {$ENDIF} + {$IFNDEF HEADLESS} + r_render, + {$ENDIF} + e_res, g_window, g_menu, + e_input, e_log, g_console, g_items, g_map, g_panel, g_playermodel, g_gfx, g_options, Math, g_triggers, g_monsters, e_sound, CONFIG, g_language, g_net, g_phys, @@ -1756,7 +1761,6 @@ begin // no need to, as we'll do it in event handler // Обновляем консоль (движение и сообщения): - r_Console_Update; g_Console_Update(); if (NetMode = NET_NONE) and (g_Game_IsNet) and (gGameOn or (gState in [STATE_FOLD, STATE_INTERCUSTOM])) then @@ -2153,7 +2157,6 @@ begin g_Weapon_Update(); g_Monsters_Update(); g_GFX_Update(); - r_GFX_Update; g_Player_UpdateAll(); g_Player_UpdatePhysicalObjects(); @@ -2264,8 +2267,10 @@ begin // Нужно сменить разрешение: if gResolutionChange then begin - e_WriteLog('Changing resolution', TMsgType.Notify); - r_Render_Apply; + {$IFNDEF HEADLESS} + e_WriteLog('Changing resolution', TMsgType.Notify); + r_Render_Apply; + {$ENDIF} gResolutionChange := False; g_ActiveWindow := nil; end; @@ -3358,7 +3363,9 @@ begin begin //result := g_Map_Load(gGameSettings.WAD + ':\' + ResName); result := g_Map_Load(NewWAD+':\'+ResName); - r_Render_LoadTextures; + {$IFNDEF HEADLESS} + r_Render_LoadTextures; + {$ENDIF} end; if Result then begin @@ -5783,7 +5790,9 @@ begin end else if cmd = 'screenshot' then begin - g_TakeScreenShot() + {$IFNDEF HEADLESS} + g_TakeScreenShot() + {$ENDIF} end else if (cmd = 'weapnext') or (cmd = 'weapprev') then begin @@ -6067,8 +6076,10 @@ begin g_Game_Free(); g_Game_Quit(); end; +{$IFNDEF HEADLESS} 'r_reset': - r_Render_Apply; + r_Render_Apply; +{$ENDIF} 'r_maxfps': begin if Length(p) = 2 then @@ -6114,6 +6125,7 @@ begin end; end; +{$IFNDEF HEADLESS} procedure g_TakeScreenShot(Filename: string = ''); var t: TDateTime; dir, date, name: String; begin @@ -6134,6 +6146,7 @@ begin else g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [name])); end; +{$ENDIF} procedure g_Game_InGameMenu(Show: Boolean); begin diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas index 00630f3..d0bf54b 100644 --- a/src/game/g_gfx.pas +++ b/src/game/g_gfx.pas @@ -28,9 +28,6 @@ const BLOOD_CSPARKS = 2; BLOOD_COMBINE = 3; - ONCEANIM_NONE = 0; - ONCEANIM_SMOKE = 1; - MARK_FREE = 0; MARK_WALL = 1; MARK_WATER = 2; @@ -44,6 +41,30 @@ const MARK_LIQUID = MARK_WATER or MARK_ACID; MARK_LIFT = MARK_LIFTDOWN or MARK_LIFTUP or MARK_LIFTLEFT or MARK_LIFTRIGHT; + R_GFX_NONE = 0; + R_GFX_TELEPORT = 1; + R_GFX_FLAME = 2; + R_GFX_EXPLODE_ROCKET = 3; + R_GFX_EXPLODE_BFG = 4; + R_GFX_BFG_HIT = 5; + R_GFX_FIRE = 6; + R_GFX_ITEM_RESPAWN = 7; + R_GFX_SMOKE = 8; + R_GFX_EXPLODE_SKELFIRE = 9; + R_GFX_EXPLODE_PLASMA = 10; + R_GFX_EXPLODE_BSPFIRE = 11; + R_GFX_EXPLODE_IMPFIRE = 12; + R_GFX_EXPLODE_CACOFIRE = 13; + R_GFX_EXPLODE_BARONFIRE = 14; + R_GFX_TELEPORT_FAST = 15; + R_GFX_SMOKE_TRANS = 16; + R_GFX_FLAME_RAND = 17; + R_GFX_LAST = 17; + + R_GFX_FLAME_WIDTH = 32; + R_GFX_FLAME_HEIGHT = 32; + R_GFX_SMOKE_WIDTH = 32; + R_GFX_SMOKE_HEIGHT = 32; procedure g_GFX_Init (); procedure g_GFX_Free (); @@ -61,6 +82,8 @@ function g_GFX_GetMax (): Integer; procedure g_Mark (x, y, Width, Height: Integer; t: Byte; st: Boolean=true); +procedure g_GFX_QueueEffect (AnimType, X, Y: Integer); + procedure g_GFX_Update (); var @@ -125,6 +148,9 @@ 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; @@ -148,6 +174,12 @@ var awakeMapHlm: packed array of LongWord = nil; {$ENDIF} + procedure g_GFX_QueueEffect (AnimType, X, Y: Integer); + begin + {$IFNDEF HEADLESS} + r_Render_QueueEffect(AnimType, X, Y) + {$ENDIF} + end; // ////////////////////////////////////////////////////////////////////////// // function awmIsSetHolmes (x, y: Integer): Boolean; inline; diff --git a/src/game/g_items.pas b/src/game/g_items.pas index 7a1fd51..636b682 100644 --- a/src/game/g_items.pas +++ b/src/game/g_items.pas @@ -93,7 +93,7 @@ implementation uses Math, - g_basic, g_sound, g_gfx, g_map, r_gfx, + 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; @@ -509,7 +509,7 @@ begin if (RespawnTime = 0) and (not alive) then begin if not QuietRespawn then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', InitX, InitY); - r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, InitX + (Obj.Rect.Width div 2) - 16, InitY + (Obj.Rect.Height div 2) - 16); + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, InitX + (Obj.Rect.Width div 2) - 16, InitY + (Obj.Rect.Height div 2) - 16); Obj.oldX := InitX; Obj.oldY := InitY; Obj.X := InitX; diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index b450139..b97e48d 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -521,7 +521,7 @@ var implementation uses - e_log, g_sound, g_gfx, g_player, g_game, r_gfx, + e_log, g_sound, g_gfx, g_player, g_game, g_weapons, g_triggers, g_items, g_options, g_console, g_map, Math, g_menu, wadreader, g_language, g_netmsg, idpool, utils, xstreams; @@ -1984,7 +1984,7 @@ begin if not silent then begin g_Sound_PlayExAt('SOUND_GAME_TELEPORT', Obj.X, Obj.Y); - r_GFX_OnceAnim( + 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 @@ -2019,7 +2019,7 @@ begin // Эффект телепорта в точке назначения: if not silent then begin - r_GFX_OnceAnim( + 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 @@ -4297,7 +4297,7 @@ begin 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); - r_GFX_OnceAnim(R_GFX_FLAME, x, y); + g_GFX_QueueEffect(R_GFX_FLAME, x, y); end; end; diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 6d4f5c1..2e6d0a4 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -284,7 +284,7 @@ function IsValidFilePath(const S: String): Boolean; implementation uses - Math, ENet, e_input, e_log, g_base, g_basic, r_gfx, + 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_gui, g_language, g_monsters, g_netmaster, utils, wadreader, MAPDEF; @@ -1736,40 +1736,40 @@ begin NET_GFX_TELE: begin - r_GFX_OnceAnim(R_GFX_TELEPORT_FAST, X, Y); + g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X, Y); if Ang = 1 then g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y); end; NET_GFX_EXPLODE: begin - r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, X - 64, Y - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, X - 64, Y - 64); if Ang = 1 then g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', X, Y); end; NET_GFX_BFGEXPL: begin - r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, X - 64, Y - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, X - 64, Y - 64); if Ang = 1 then g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', X, Y); end; NET_GFX_BFGHIT: begin - r_GFX_OnceAnim(R_GFX_BFG_HIT, X - 32, Y - 32); + g_GFX_QueueEffect(R_GFX_BFG_HIT, X - 32, Y - 32); end; NET_GFX_FIRE: begin - r_GFX_OnceAnim(R_GFX_FIRE, X, Y); + g_GFX_QueueEffect(R_GFX_FIRE, X, Y); if Ang = 1 then g_Sound_PlayExAt('SOUND_FIRE', X, Y); end; NET_GFX_RESPAWN: begin - r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X, Y); + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X, Y); if Ang = 1 then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y); end; @@ -2732,7 +2732,7 @@ begin if not Quiet then begin g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y); - r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16); + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16); end; end; diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 6aa7323..2e9afdc 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -648,10 +648,13 @@ function g_Bot_GetCount(): Integer; implementation uses -{$IFDEF ENABLE_HOLMES} - g_holmes, -{$ENDIF} - e_log, g_map, g_items, g_console, g_gfx, Math, r_playermodel, r_gfx, + {$IFDEF ENABLE_HOLMES} + g_holmes, + {$ENDIF} + {$IFNDEF HEADLESS} + r_render, + {$ENDIF} + e_log, g_map, g_items, g_console, g_gfx, Math, g_options, g_triggers, g_menu, g_game, g_grid, e_res, wadreader, g_monsters, CONFIG, g_language, g_net, g_netmsg, @@ -1593,7 +1596,14 @@ begin Color := fColor; alive := True; g_Obj_Init(@Obj); - Obj.Rect := r_PlayerModel_GetGibRect(ModelID, GibID); + {$IFNDEF HEADLESS} + Obj.Rect := r_Render_GetGibRect(ModelID, GibID); + {$ELSE} + Obj.Rect.X := 16; + Obj.Rect.Y := 16; + Obj.Rect.Width := 16; + Obj.Rect.Height := 16; + {$ENDIF} Obj.X := fX - Obj.Rect.X - (Obj.Rect.Width div 2); Obj.Y := fY - Obj.Rect.Y - (Obj.Rect.Height div 2); g_Obj_PushA(@Obj, 25 + Random(10), Random(361)); @@ -3988,7 +3998,7 @@ begin // Анимация возрождения: if (not gLoadGameMode) and (not Silent) then - r_GFX_OnceAnim( + 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 @@ -4188,7 +4198,7 @@ begin if not silent then begin g_Sound_PlayExAt('SOUND_GAME_TELEPORT', FObj.X, FObj.Y); - r_GFX_OnceAnim( + 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 @@ -4240,7 +4250,7 @@ begin if not silent then begin - r_GFX_OnceAnim( + 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 @@ -5742,7 +5752,7 @@ begin for i := 1 to Times do begin - r_GFX_OnceAnim( + 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) @@ -5758,7 +5768,7 @@ begin for i := 1 to Times do begin - r_GFX_OnceAnim( + 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) diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index e37dff5..b816588 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -103,7 +103,7 @@ implementation uses Math, - g_player, g_map, g_panel, g_gfx, g_game, r_gfx, + 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; @@ -776,7 +776,7 @@ begin TRIGGER_SHOT_EXPL: begin - r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, wx - 64, wy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, wx - 64, wy - 64); Projectile := False; g_Weapon_Explode(wx, wy, 60, 0); snd := 'SOUND_WEAPON_EXPLODEROCKET'; @@ -784,7 +784,7 @@ begin TRIGGER_SHOT_BFGEXPL: begin - r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, wx - 64, wy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, wx - 64, wy - 64); Projectile := False; g_Weapon_BFG9000(wx, wy, 0); snd := 'SOUND_WEAPON_EXPLODEBFG'; @@ -881,17 +881,17 @@ begin case ST of EFFECT_TELEPORT: begin if not Silent then g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y); - r_GFX_OnceAnim(R_GFX_TELEPORT_FAST, X - 32, Y - 32); + g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X - 32, Y - 32); 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); - r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X - 16, Y - 16); + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X - 16, Y - 16); 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); - r_GFX_OnceAnim(R_GFX_FIRE, X - 32, Y - 128); + g_GFX_QueueEffect(R_GFX_FIRE, X - 32, Y - 128); 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; @@ -1475,7 +1475,7 @@ begin case tgcEffect of EFFECT_TELEPORT: begin g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); - r_GFX_OnceAnim( + 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 @@ -1487,7 +1487,7 @@ begin end; EFFECT_RESPAWN: begin g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); - r_GFX_OnceAnim( + 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 @@ -1499,7 +1499,7 @@ begin end; EFFECT_FIRE: begin g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); - r_GFX_OnceAnim( + 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 @@ -1562,7 +1562,7 @@ begin EFFECT_TELEPORT: begin it := g_Items_ByIdx(iid); g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); - r_GFX_OnceAnim( + 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 @@ -1575,7 +1575,7 @@ begin EFFECT_RESPAWN: begin it := g_Items_ByIdx(iid); g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); - r_GFX_OnceAnim( + 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 @@ -1588,7 +1588,7 @@ begin EFFECT_FIRE: begin it := g_Items_ByIdx(iid); g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); - r_GFX_OnceAnim( + 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 diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas index 4307984..ce840d0 100644 --- a/src/game/g_weapons.pas +++ b/src/game/g_weapons.pas @@ -112,7 +112,7 @@ implementation uses Math, g_map, g_player, g_gfx, g_sound, g_panel, - g_console, g_options, g_game, r_gfx, + 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; @@ -2011,7 +2011,7 @@ end; procedure g_Weapon_bfghit(x, y: Integer); begin - r_GFX_OnceAnim(R_GFX_BFG_HIT, x - 32, y - 32); + g_GFX_QueueEffect(R_GFX_BFG_HIT, x - 32, y - 32); end; procedure g_Weapon_pistol(x, y, xd, yd: Integer; SpawnerUID: Word; @@ -2204,7 +2204,7 @@ begin end else begin - r_GFX_OnceAnim(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), cy-20+Random(9)); + g_GFX_QueueEffect(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), cy-20+Random(9)); end; // Ïîïàëè â êîãî-òî èëè â ñòåíó: @@ -2219,12 +2219,12 @@ begin if ShotType = WEAPON_SKEL_FIRE then begin // Âçðûâ ñíàðÿäà Ñêåëåòà - r_GFX_OnceAnim(R_GFX_EXPLODE_SKELFIRE, Obj.X + 32 - 58, Obj.Y + 8 - 36); + 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 else begin // Âçðûâ Ðàêåòû - r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); g_DynLightExplosion(cx, cy, 64, 1, 0, 0); end; @@ -2270,9 +2270,9 @@ begin (Timeout < 1) then begin if ShotType = WEAPON_PLASMA then - r_GFX_OnceAnim(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) + g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) else - r_GFX_OnceAnim(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); + g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); g_DynLightExplosion(cx, cy, 32, 0, 0.5, 0.5); g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEPLASMA', Obj.X, Obj.Y); ShotType := 0; @@ -2294,7 +2294,7 @@ begin begin tcx := Random(8); tcy := Random(8); - r_GFX_OnceAnim(R_GFX_SMOKE, cx-4+tcx-(R_GFX_SMOKE_WIDTH div 2), cy-4+tcy-(R_GFX_SMOKE_HEIGHT div 2)); + g_GFX_QueueEffect(R_GFX_SMOKE, cx-4+tcx-(R_GFX_SMOKE_WIDTH div 2), cy-4+tcy-(R_GFX_SMOKE_HEIGHT div 2)); end else begin @@ -2348,7 +2348,7 @@ begin 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; - r_GFX_OnceAnim(R_GFX_FLAME_RAND, tcx - (R_GFX_FLAME_WIDTH div 2), tcy - (R_GFX_FLAME_HEIGHT div 2)); + 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); end; end; @@ -2371,7 +2371,7 @@ begin begin // Ëó÷è BFG: if g_Game_IsServer then g_Weapon_BFG9000(cx, cy, SpawnerUID); - r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); g_DynLightExplosion(cx, cy, 96, 0, 1, 0); g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', Obj.X, Obj.Y); ShotType := 0; @@ -2399,9 +2399,9 @@ begin (Timeout < 1) then begin case ShotType of - WEAPON_IMP_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32); - WEAPON_CACO_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32); - WEAPON_BARON_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32); + 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; g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); ShotType := 0; @@ -2420,7 +2420,7 @@ begin (Timeout < 1) then begin // Âçðûâ: - r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); ShotType := 0; end; @@ -2602,9 +2602,9 @@ begin if Loud then begin if ShotType = WEAPON_SKEL_FIRE then - r_GFX_OnceAnim(R_GFX_EXPLODE_SKELFIRE, (Obj.X + 32) - 32, (Obj.Y + 8) - 32) + g_GFX_QueueEffect(R_GFX_EXPLODE_SKELFIRE, (Obj.X + 32) - 32, (Obj.Y + 8) - 32) else - r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', Obj.X, Obj.Y); end; end; @@ -2614,16 +2614,16 @@ begin if loud then begin if ShotType = WEAPON_PLASMA then - r_GFX_OnceAnim(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) + g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16) else - r_GFX_OnceAnim(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); + g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16); g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEPLASMA', Obj.X, Obj.Y); end; end; WEAPON_BFG: // BFG begin - r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64); g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', Obj.X, Obj.Y); end; @@ -2632,9 +2632,9 @@ begin if loud then begin case ShotType of - WEAPON_IMP_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32); - WEAPON_CACO_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32); - WEAPON_BARON_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32); + 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; g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); end; @@ -2642,7 +2642,7 @@ begin WEAPON_MANCUB_FIRE: // Âûñòðåë Ìàíêóáóñà begin - r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64); g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y); end; end; // case ShotType of... diff --git a/src/game/g_window.pas b/src/game/g_window.pas index 98d27cc..2cbc4a7 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -21,14 +21,19 @@ interface implementation - uses e_sound, g_system, g_net, r_window; + uses + {$IFNDEF HEADLESS} + r_render, + {$ENDIF} + e_sound, g_system, g_net + ; procedure ProcessLoading (forceUpdate: Boolean = False); begin if sys_HandleInput() = False then begin {$IFNDEF HEADLESS} - r_Window_DrawLoading(forceUpdate); + r_Render_DrawLoading(forceUpdate); {$ENDIF} e_SoundUpdate(); // TODO: At the moment, I left here only host network processing, because the client code must diff --git a/src/game/opengl/r_game.pas b/src/game/opengl/r_game.pas index adeb109..2464498 100644 --- a/src/game/opengl/r_game.pas +++ b/src/game/opengl/r_game.pas @@ -711,7 +711,9 @@ begin // HACK: take stats screenshot immediately after the first frame of the stats showing if gScreenshotStats and (not StatShotDone) and (Length(CustomStat.PlayerStat) > 1) then begin +{$IFNDEF HEADLESS} g_TakeScreenShot('stats/' + StatFilename); +{$ENDIF} StatShotDone := True; end; end; diff --git a/src/game/opengl/r_gfx.pas b/src/game/opengl/r_gfx.pas index 91b9c38..5ec0017 100644 --- a/src/game/opengl/r_gfx.pas +++ b/src/game/opengl/r_gfx.pas @@ -17,31 +17,13 @@ unit r_gfx; interface +{ const - R_GFX_NONE = 0; - R_GFX_TELEPORT = 1; - R_GFX_FLAME = 2; - R_GFX_EXPLODE_ROCKET = 3; - R_GFX_EXPLODE_BFG = 4; - R_GFX_BFG_HIT = 5; - R_GFX_FIRE = 6; - R_GFX_ITEM_RESPAWN = 7; - R_GFX_SMOKE = 8; - R_GFX_EXPLODE_SKELFIRE = 9; - R_GFX_EXPLODE_PLASMA = 10; - R_GFX_EXPLODE_BSPFIRE = 11; - R_GFX_EXPLODE_IMPFIRE = 12; - R_GFX_EXPLODE_CACOFIRE = 13; - R_GFX_EXPLODE_BARONFIRE = 14; - R_GFX_TELEPORT_FAST = 15; - R_GFX_SMOKE_TRANS = 16; - R_GFX_FLAME_RAND = 17; - R_GFX_LAST = 17; - R_GFX_FLAME_WIDTH = 32; R_GFX_FLAME_HEIGHT = 32; R_GFX_SMOKE_WIDTH = 32; R_GFX_SMOKE_HEIGHT = 32; +} procedure r_GFX_Load; procedure r_GFX_Free; diff --git a/src/game/opengl/r_monsters.pas b/src/game/opengl/r_monsters.pas index d2f2dfd..8acec37 100644 --- a/src/game/opengl/r_monsters.pas +++ b/src/game/opengl/r_monsters.pas @@ -178,7 +178,7 @@ implementation end; procedure r_Monsters_Load; - var m, a: Integer; s, info: String; FramesID: DWORD; + var m, a: Integer; s: String; FramesID: DWORD; begin g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_SLEEP', GameWAD+':MTEXTURES\BARREL_SLEEP', 64, 64, 3); g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_DIE', GameWAD+':MTEXTURES\BARREL_DIE', 64, 64, 4); diff --git a/src/game/opengl/r_render.pas b/src/game/opengl/r_render.pas index 3535a2d..89faffb 100644 --- a/src/game/opengl/r_render.pas +++ b/src/game/opengl/r_render.pas @@ -17,6 +17,8 @@ unit r_render; interface + uses g_base; // TRectWH + procedure r_Render_Initialize; procedure r_Render_Finalize; @@ -33,6 +35,11 @@ interface function r_Render_WriteScreenShot (filename: String): Boolean; + function r_Render_GetGibRect (m, id: Integer): TRectWH; + procedure r_Render_QueueEffect (AnimType, X, Y: Integer); + + procedure r_Render_DrawLoading (force: Boolean); // !!! remove it + implementation uses @@ -139,8 +146,10 @@ implementation procedure r_Render_Update; begin + r_GFX_Update; r_Map_Update; r_PlayerModel_Update; + r_Console_Update; end; procedure r_Render_Resize (w, h: Integer); @@ -196,4 +205,19 @@ implementation end end; + function r_Render_GetGibRect (m, id: Integer): TRectWH; + begin + Result := r_PlayerModel_GetGibRect(m, id) + end; + + procedure r_Render_QueueEffect (AnimType, X, Y: Integer); + begin + r_GFX_OnceAnim(AnimType, X, Y) + end; + + procedure r_Render_DrawLoading (force: Boolean); + begin + r_Window_DrawLoading(force) + end; + end. -- 2.29.2