DEADSOFTWARE

94d1d4ade21ae5e423c512a020269bc8d431763d
[d2df-sdl.git] / src / game / opengl / r_weapons.pas
1 (* Copyright (C) Doom 2D: Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *)
15 {$INCLUDE ../../shared/a_modes.inc}
16 unit r_weapons;
18 interface
20 procedure r_Weapon_Draw;
22 implementation
24 uses
25 SysUtils, Classes, Math,
26 MAPDEF,
27 r_graphics, r_animations,
28 g_base, g_basic, g_game,
29 g_weapons
30 ;
32 procedure r_Weapon_Draw;
33 var i, fX, fY, xx, yy: Integer; a: SmallInt; p: TDFPoint;
34 begin
35 if Shots = nil then
36 Exit;
38 for i := 0 to High(Shots) do
39 begin
40 if Shots[i].ShotType <> 0 then
41 begin
42 with Shots[i] do
43 begin
44 if Shots[i].ShotType in [WEAPON_ROCKETLAUNCHER, WEAPON_BARON_FIRE, WEAPON_MANCUB_FIRE, WEAPON_SKEL_FIRE] then
45 a := -GetAngle2(Obj.Vel.X, Obj.Vel.Y)
46 else
47 a := 0;
49 Obj.lerp(gLerpFactor, fX, fY);
50 p.X := Obj.Rect.Width div 2;
51 p.Y := Obj.Rect.Height div 2;
53 if Animation <> nil then
54 begin
55 if Shots[i].ShotType in [WEAPON_BARON_FIRE, WEAPON_MANCUB_FIRE, WEAPON_SKEL_FIRE] then
56 r_Animation_DrawEx(Animation, fX, fY, TMirrorType.None, p, a)
57 else
58 r_Animation_Draw(Animation, fX, fY, TMirrorType.None);
59 end
60 else if TextureID <> 0 then
61 begin
62 if (Shots[i].ShotType = WEAPON_ROCKETLAUNCHER) then
63 e_DrawAdv(TextureID, fX, fY, 0, True, False, a, @p, TMirrorType.None)
64 else if (Shots[i].ShotType <> WEAPON_FLAMETHROWER) then
65 e_Draw(TextureID, fX, fY, 0, True, False);
66 end;
68 if g_debug_Frames then
69 begin
70 xx := Obj.X + Obj.Rect.X;
71 yy := Obj.Y + Obj.Rect.Y;
72 e_DrawQuad(xx, yy, xx + Obj.Rect.Width - 1, yy + Obj.Rect.Height - 1, 0, 255, 0);
73 end
74 end
75 end
76 end
77 end;
79 end.