From: DeaDDooMER Date: Mon, 17 Jan 2022 18:44:14 +0000 (+0300) Subject: render: use only r_render to access render X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=2490c26ff92664ba96915ef1a7c6bd38c8137bda;p=d2df-sdl.git render: use only r_render to access render --- diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 4c2d6de..fcd73a7 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -125,7 +125,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; @@ -434,11 +436,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, @@ -1721,7 +1726,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 @@ -2121,7 +2125,6 @@ begin g_Weapon_Update(); g_Monsters_Update(); g_GFX_Update(); - r_GFX_Update; g_Player_UpdateAll(); g_Player_UpdatePhysicalObjects(); @@ -2220,8 +2223,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; @@ -3281,7 +3286,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 @@ -5451,7 +5458,9 @@ begin end else if cmd = 'screenshot' then begin - g_TakeScreenShot() + {$IFNDEF HEADLESS} + g_TakeScreenShot() + {$ENDIF} end else if cmd = 'weapon' then begin @@ -5688,8 +5697,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 @@ -5735,6 +5746,7 @@ begin end; end; +{$IFNDEF HEADLESS} procedure g_TakeScreenShot(Filename: string = ''); var t: TDateTime; dir, date, name: String; begin @@ -5755,6 +5767,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 6bb5070..347fec5 100644 --- a/src/game/g_items.pas +++ b/src/game/g_items.pas @@ -90,7 +90,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; @@ -485,7 +485,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 3b1aad7..9690b74 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 @@ -4293,7 +4293,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 d88e6af..da87a4a 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -276,7 +276,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; @@ -1556,40 +1556,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; @@ -2534,7 +2534,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 92afc63..80f38b7 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -624,10 +624,13 @@ procedure g_Bot_RemoveAll(); 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, @@ -1631,7 +1634,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)); @@ -3909,7 +3919,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 @@ -4109,7 +4119,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 @@ -4161,7 +4171,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 @@ -5662,7 +5672,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) @@ -5678,7 +5688,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 64e87c6..ce31a88 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'; @@ -875,17 +875,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; @@ -1469,7 +1469,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 @@ -1481,7 +1481,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 @@ -1493,7 +1493,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 @@ -1556,7 +1556,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 @@ -1569,7 +1569,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 @@ -1582,7 +1582,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 6e555a4..12d20a4 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; @@ -1984,7 +1984,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; @@ -2155,7 +2155,7 @@ begin Obj.Y+(Obj.Rect.Height div 2), 1+Random(3), 16, 16) else - r_GFX_OnceAnim(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), Obj.Y+(Obj.Rect.Height div 2)-20+Random(9)); + g_GFX_QueueEffect(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), Obj.Y+(Obj.Rect.Height div 2)-20+Random(9)); // Ïîïàëè â êîãî-òî èëè â ñòåíó: if WordBool(st and (MOVE_HITWALL or MOVE_HITLAND or MOVE_HITCEIL)) or @@ -2169,12 +2169,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; @@ -2220,9 +2220,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; @@ -2244,7 +2244,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 g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16); @@ -2293,7 +2293,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; @@ -2316,7 +2316,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; @@ -2344,9 +2344,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; @@ -2365,7 +2365,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; @@ -2547,9 +2547,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; @@ -2559,16 +2559,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; @@ -2577,9 +2577,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; @@ -2587,7 +2587,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 5b62d63..63de883 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(); if NetMode = NET_SERVER then diff --git a/src/game/opengl/r_game.pas b/src/game/opengl/r_game.pas index 46ac2fd..6e58786 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 76ef595..1a35098 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.