DEADSOFTWARE

render: use only r_render to access render
[d2df-sdl.git] / src / game / opengl / r_monsters.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_monsters;
18 interface
20 procedure r_Monsters_Load;
21 procedure r_Monsters_Free;
22 procedure r_Monsters_Draw;
23 procedure r_Monsters_DrawHealth;
25 implementation
27 uses
28 SysUtils, Classes, Math, e_log,
29 r_graphics, g_options, r_animations, r_game,
30 MAPDEF,
31 g_base, g_basic, g_game, g_phys,
32 g_monsters
33 ;
35 type
36 TMonsterDirected = array [TDirection.D_LEFT..TDirection.D_RIGHT] of DWORD;
37 TMonsterAnims = array [ANIM_SLEEP..ANIM_PAIN] of TMonsterDirected;
39 var
40 VileFire: DWORD;
41 monFrames: array [MONSTER_DEMON..MONSTER_MAN] of TMonsterAnims;
43 procedure r_Monsters_Free;
44 begin
45 g_Frames_DeleteByName('FRAMES_MONSTER_BARREL_SLEEP');
46 g_Frames_DeleteByName('FRAMES_MONSTER_BARREL_PAIN');
47 g_Frames_DeleteByName('FRAMES_MONSTER_BARREL_DIE');
48 g_Frames_DeleteByName('FRAMES_MONSTER_ZOMBY_SLEEP');
49 g_Frames_DeleteByName('FRAMES_MONSTER_ZOMBY_GO');
50 g_Frames_DeleteByName('FRAMES_MONSTER_ZOMBY_DIE');
51 g_Frames_DeleteByName('FRAMES_MONSTER_ZOMBY_MESS');
52 g_Frames_DeleteByName('FRAMES_MONSTER_ZOMBY_ATTACK');
53 g_Frames_DeleteByName('FRAMES_MONSTER_ZOMBY_ATTACK_L');
54 g_Frames_DeleteByName('FRAMES_MONSTER_ZOMBY_PAIN');
55 g_Frames_DeleteByName('FRAMES_MONSTER_SERG_SLEEP');
56 g_Frames_DeleteByName('FRAMES_MONSTER_SERG_GO');
57 g_Frames_DeleteByName('FRAMES_MONSTER_SERG_DIE');
58 g_Frames_DeleteByName('FRAMES_MONSTER_SERG_MESS');
59 g_Frames_DeleteByName('FRAMES_MONSTER_SERG_ATTACK');
60 g_Frames_DeleteByName('FRAMES_MONSTER_SERG_ATTACK_L');
61 g_Frames_DeleteByName('FRAMES_MONSTER_SERG_PAIN');
62 g_Frames_DeleteByName('FRAMES_MONSTER_MAN_SLEEP');
63 g_Frames_DeleteByName('FRAMES_MONSTER_MAN_GO');
64 g_Frames_DeleteByName('FRAMES_MONSTER_MAN_DIE');
65 g_Frames_DeleteByName('FRAMES_MONSTER_MAN_MESS');
66 g_Frames_DeleteByName('FRAMES_MONSTER_MAN_ATTACK');
67 g_Frames_DeleteByName('FRAMES_MONSTER_MAN_PAIN');
68 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_SLEEP');
69 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_SLEEP_L');
70 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_GO');
71 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_GO_L');
72 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_DIE');
73 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_MESS');
74 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_ATTACK');
75 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_ATTACK_L');
76 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_PAIN');
77 g_Frames_DeleteByName('FRAMES_MONSTER_CGUN_PAIN_L');
78 g_Frames_DeleteByName('FRAMES_MONSTER_IMP_SLEEP');
79 g_Frames_DeleteByName('FRAMES_MONSTER_IMP_GO');
80 g_Frames_DeleteByName('FRAMES_MONSTER_IMP_DIE');
81 g_Frames_DeleteByName('FRAMES_MONSTER_IMP_MESS');
82 g_Frames_DeleteByName('FRAMES_MONSTER_IMP_ATTACK');
83 g_Frames_DeleteByName('FRAMES_MONSTER_IMP_PAIN');
84 g_Frames_DeleteByName('FRAMES_MONSTER_DEMON_SLEEP');
85 g_Frames_DeleteByName('FRAMES_MONSTER_DEMON_GO');
86 g_Frames_DeleteByName('FRAMES_MONSTER_DEMON_DIE');
87 g_Frames_DeleteByName('FRAMES_MONSTER_DEMON_ATTACK');
88 g_Frames_DeleteByName('FRAMES_MONSTER_DEMON_PAIN');
89 g_Frames_DeleteByName('FRAMES_MONSTER_SOUL_SLEEP');
90 g_Frames_DeleteByName('FRAMES_MONSTER_SOUL_GO');
91 g_Frames_DeleteByName('FRAMES_MONSTER_SOUL_PAIN');
92 g_Frames_DeleteByName('FRAMES_MONSTER_SOUL_ATTACK');
93 g_Frames_DeleteByName('FRAMES_MONSTER_SOUL_DIE');
94 g_Frames_DeleteByName('FRAMES_MONSTER_FISH_SLEEP');
95 g_Frames_DeleteByName('FRAMES_MONSTER_FISH_GO');
96 g_Frames_DeleteByName('FRAMES_MONSTER_FISH_PAIN');
97 g_Frames_DeleteByName('FRAMES_MONSTER_FISH_ATTACK');
98 g_Frames_DeleteByName('FRAMES_MONSTER_FISH_DIE');
99 g_Frames_DeleteByName('FRAMES_MONSTER_SPIDER_SLEEP');
100 g_Frames_DeleteByName('FRAMES_MONSTER_SPIDER_GO');
101 g_Frames_DeleteByName('FRAMES_MONSTER_SPIDER_PAIN');
102 g_Frames_DeleteByName('FRAMES_MONSTER_SPIDER_PAIN_L');
103 g_Frames_DeleteByName('FRAMES_MONSTER_SPIDER_ATTACK');
104 g_Frames_DeleteByName('FRAMES_MONSTER_SPIDER_DIE');
105 g_Frames_DeleteByName('FRAMES_MONSTER_BSP_SLEEP');
106 g_Frames_DeleteByName('FRAMES_MONSTER_BSP_GO');
107 g_Frames_DeleteByName('FRAMES_MONSTER_BSP_PAIN');
108 g_Frames_DeleteByName('FRAMES_MONSTER_BSP_PAIN_L');
109 g_Frames_DeleteByName('FRAMES_MONSTER_BSP_ATTACK');
110 g_Frames_DeleteByName('FRAMES_MONSTER_BSP_DIE');
111 g_Frames_DeleteByName('FRAMES_MONSTER_CACO_SLEEP');
112 g_Frames_DeleteByName('FRAMES_MONSTER_CACO_GO');
113 g_Frames_DeleteByName('FRAMES_MONSTER_CACO_PAIN');
114 g_Frames_DeleteByName('FRAMES_MONSTER_CACO_ATTACK');
115 g_Frames_DeleteByName('FRAMES_MONSTER_CACO_DIE');
116 g_Frames_DeleteByName('FRAMES_MONSTER_PAIN_SLEEP');
117 g_Frames_DeleteByName('FRAMES_MONSTER_PAIN_GO');
118 g_Frames_DeleteByName('FRAMES_MONSTER_PAIN_PAIN');
119 g_Frames_DeleteByName('FRAMES_MONSTER_PAIN_ATTACK');
120 g_Frames_DeleteByName('FRAMES_MONSTER_PAIN_DIE');
121 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_SLEEP');
122 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_SLEEP_L');
123 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_GO');
124 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_PAIN');
125 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_PAIN_L');
126 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_ATTACK');
127 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_ATTACK_L');
128 g_Frames_DeleteByName('FRAMES_MONSTER_BARON_DIE');
129 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_SLEEP');
130 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_SLEEP_L');
131 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_GO');
132 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_PAIN');
133 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_PAIN_L');
134 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_ATTACK');
135 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_ATTACK_L');
136 g_Frames_DeleteByName('FRAMES_MONSTER_KNIGHT_DIE');
137 g_Frames_DeleteByName('FRAMES_MONSTER_MANCUB_SLEEP');
138 g_Frames_DeleteByName('FRAMES_MONSTER_MANCUB_GO');
139 g_Frames_DeleteByName('FRAMES_MONSTER_MANCUB_PAIN');
140 g_Frames_DeleteByName('FRAMES_MONSTER_MANCUB_ATTACK');
141 g_Frames_DeleteByName('FRAMES_MONSTER_MANCUB_DIE');
142 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_SLEEP');
143 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_SLEEP_L');
144 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_GO');
145 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_PAIN');
146 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_PAIN_L');
147 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_ATTACK');
148 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_ATTACK_L');
149 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_ATTACK2');
150 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_ATTACK2_L');
151 g_Frames_DeleteByName('FRAMES_MONSTER_SKEL_DIE');
152 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_SLEEP');
153 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_SLEEP_L');
154 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_GO');
155 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_PAIN');
156 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_PAIN_L');
157 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_ATTACK');
158 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_ATTACK_L');
159 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_ATTACK2');
160 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_ATTACK2_L');
161 g_Frames_DeleteByName('FRAMES_MONSTER_VILE_DIE');
162 g_Frames_DeleteByName('FRAMES_MONSTER_ROBO_SLEEP');
163 g_Frames_DeleteByName('FRAMES_MONSTER_ROBO_GO');
164 g_Frames_DeleteByName('FRAMES_MONSTER_ROBO_ATTACK');
165 g_Frames_DeleteByName('FRAMES_MONSTER_ROBO_ATTACK2');
166 g_Frames_DeleteByName('FRAMES_MONSTER_ROBO_DIE');
167 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_SLEEP');
168 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_SLEEP_L');
169 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_GO');
170 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_GO_L');
171 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_PAIN');
172 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_PAIN_L');
173 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_ATTACK');
174 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_ATTACK_L');
175 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_ATTACK2');
176 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_ATTACK2_L');
177 g_Frames_DeleteByName('FRAMES_MONSTER_CYBER_DIE');
178 end;
180 procedure r_Monsters_Load;
181 var m, a: Integer; s: String; FramesID: DWORD;
182 begin
183 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_SLEEP', GameWAD+':MTEXTURES\BARREL_SLEEP', 64, 64, 3);
184 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_DIE', GameWAD+':MTEXTURES\BARREL_DIE', 64, 64, 4);
185 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_PAIN', GameWAD+':MTEXTURES\BARREL_PAIN', 64, 64, 1);
186 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ZOMBY_SLEEP', GameWAD+':MTEXTURES\ZOMBY_SLEEP', 64, 64, 2);
187 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ZOMBY_GO', GameWAD+':MTEXTURES\ZOMBY_GO', 64, 64, 4);
188 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ZOMBY_DIE', GameWAD+':MTEXTURES\ZOMBY_DIE', 64, 64, 6);
190 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ZOMBY_MESS', GameWAD+':MTEXTURES\ZOMBY_MESS', 64, 64, 9);
191 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ZOMBY_ATTACK', GameWAD+':MTEXTURES\ZOMBY_ATTACK', 64, 64, 2);
192 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ZOMBY_ATTACK_L', GameWAD+':MTEXTURES\ZOMBY_ATTACK_L', 64, 64, 2);
193 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ZOMBY_PAIN', GameWAD+':MTEXTURES\ZOMBY_PAIN', 64, 64, 1);
194 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SERG_SLEEP', GameWAD+':MTEXTURES\SERG_SLEEP', 64, 64, 2);
195 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SERG_GO', GameWAD+':MTEXTURES\SERG_GO', 64, 64, 4);
196 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SERG_DIE', GameWAD+':MTEXTURES\SERG_DIE', 64, 64, 5);
198 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SERG_MESS', GameWAD+':MTEXTURES\SERG_MESS', 64, 64, 9);
199 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SERG_ATTACK', GameWAD+':MTEXTURES\SERG_ATTACK', 64, 64, 2);
200 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SERG_ATTACK_L', GameWAD+':MTEXTURES\SERG_ATTACK_L', 64, 64, 2);
201 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SERG_PAIN', GameWAD+':MTEXTURES\SERG_PAIN', 64, 64, 1);
202 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MAN_SLEEP', GameWAD+':MTEXTURES\MAN_SLEEP', 64, 64, 2);
203 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MAN_GO', GameWAD+':MTEXTURES\MAN_GO', 64, 64, 4);
204 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MAN_DIE', GameWAD+':MTEXTURES\MAN_DIE', 64, 64, 7);
206 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MAN_MESS', GameWAD+':MTEXTURES\MAN_MESS', 64, 64, 9);
207 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MAN_ATTACK', GameWAD+':MTEXTURES\MAN_ATTACK', 64, 64, 2);
208 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MAN_PAIN', GameWAD+':MTEXTURES\MAN_PAIN', 64, 64, 1);
209 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_SLEEP', GameWAD+':MTEXTURES\CGUN_SLEEP', 64, 64, 2);
210 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_SLEEP_L', GameWAD+':MTEXTURES\CGUN_SLEEP_L', 64, 64, 2);
211 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_GO', GameWAD+':MTEXTURES\CGUN_GO', 64, 64, 4);
213 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_GO_L', GameWAD+':MTEXTURES\CGUN_GO_L', 64, 64, 4);
214 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_DIE', GameWAD+':MTEXTURES\CGUN_DIE', 64, 64, 7);
215 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_MESS', GameWAD+':MTEXTURES\CGUN_MESS', 64, 64, 6);
216 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_ATTACK', GameWAD+':MTEXTURES\CGUN_ATTACK', 64, 64, 2);
217 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_ATTACK_L', GameWAD+':MTEXTURES\CGUN_ATTACK_L', 64, 64, 2);
218 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_PAIN', GameWAD+':MTEXTURES\CGUN_PAIN', 64, 64, 1);
220 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CGUN_PAIN_L', GameWAD+':MTEXTURES\CGUN_PAIN_L', 64, 64, 1);
221 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_IMP_SLEEP', GameWAD+':MTEXTURES\IMP_SLEEP', 64, 64, 2);
222 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_IMP_GO', GameWAD+':MTEXTURES\IMP_GO', 64, 64, 4);
223 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_IMP_DIE', GameWAD+':MTEXTURES\IMP_DIE', 64, 64, 5);
224 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_IMP_MESS', GameWAD+':MTEXTURES\IMP_MESS', 64, 64, 8);
225 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_IMP_ATTACK', GameWAD+':MTEXTURES\IMP_ATTACK', 64, 64, 3);
226 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_IMP_PAIN', GameWAD+':MTEXTURES\IMP_PAIN', 64, 64, 1);
227 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_DEMON_SLEEP', GameWAD+':MTEXTURES\DEMON_SLEEP', 64, 64, 2);
228 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_DEMON_GO', GameWAD+':MTEXTURES\DEMON_GO', 64, 64, 4);
229 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_DEMON_DIE', GameWAD+':MTEXTURES\DEMON_DIE', 64, 64, 6);
230 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_DEMON_ATTACK', GameWAD+':MTEXTURES\DEMON_ATTACK', 64, 64, 3);
231 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_DEMON_PAIN', GameWAD+':MTEXTURES\DEMON_PAIN', 64, 64, 1);
233 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SOUL_SLEEP', GameWAD+':MTEXTURES\SOUL_SLEEP', 64, 64, 2);
234 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SOUL_GO', GameWAD+':MTEXTURES\SOUL_GO', 64, 64, 2);
235 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SOUL_PAIN', GameWAD+':MTEXTURES\SOUL_PAIN', 64, 64, 1);
236 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SOUL_ATTACK', GameWAD+':MTEXTURES\SOUL_ATTACK', 64, 64, 2);
237 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SOUL_DIE', GameWAD+':MTEXTURES\SOUL_DIE', 128, 128, 7);
238 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_FISH_SLEEP', GameWAD+':MTEXTURES\FISH_SLEEP', 32, 32, 2);
240 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_FISH_GO', GameWAD+':MTEXTURES\FISH_GO', 32, 32, 4);
241 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_FISH_PAIN', GameWAD+':MTEXTURES\FISH_PAIN', 32, 32, 3);
242 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_FISH_ATTACK', GameWAD+':MTEXTURES\FISH_ATTACK', 32, 32, 2);
243 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_FISH_DIE', GameWAD+':MTEXTURES\FISH_DIE', 32, 32, 1);
244 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SPIDER_SLEEP', GameWAD+':MTEXTURES\SPIDER_SLEEP', 256, 128, 2);
245 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SPIDER_GO', GameWAD+':MTEXTURES\SPIDER_GO', 256, 128, 6);
247 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SPIDER_PAIN', GameWAD+':MTEXTURES\SPIDER_PAIN', 256, 128, 1);
248 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SPIDER_PAIN_L', GameWAD+':MTEXTURES\SPIDER_PAIN_L', 256, 128, 1);
249 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SPIDER_ATTACK', GameWAD+':MTEXTURES\SPIDER_ATTACK', 256, 128, 2);
250 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SPIDER_DIE', GameWAD+':MTEXTURES\SPIDER_DIE', 256, 128, 10);
251 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BSP_SLEEP', GameWAD+':MTEXTURES\BSP_SLEEP', 128, 64, 2);
252 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BSP_GO', GameWAD+':MTEXTURES\BSP_GO', 128, 64, 6);
254 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BSP_PAIN', GameWAD+':MTEXTURES\BSP_PAIN', 128, 64, 1);
255 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BSP_PAIN_L', GameWAD+':MTEXTURES\BSP_PAIN_L', 128, 64, 1);
256 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BSP_ATTACK', GameWAD+':MTEXTURES\BSP_ATTACK', 128, 64, 2);
257 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BSP_DIE', GameWAD+':MTEXTURES\BSP_DIE', 128, 64, 7);
258 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CACO_SLEEP', GameWAD+':MTEXTURES\CACO_SLEEP', 128, 128, 1);
259 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CACO_GO', GameWAD+':MTEXTURES\CACO_GO', 128, 128, 1);
261 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CACO_PAIN', GameWAD+':MTEXTURES\CACO_PAIN', 128, 128, 1);
262 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CACO_ATTACK', GameWAD+':MTEXTURES\CACO_ATTACK', 128, 128, 6);
263 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CACO_DIE', GameWAD+':MTEXTURES\CACO_DIE', 128, 128, 7);
264 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_PAIN_SLEEP', GameWAD+':MTEXTURES\PAIN_SLEEP', 128, 128, 4);
265 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_PAIN_GO', GameWAD+':MTEXTURES\PAIN_GO', 128, 128, 4);
266 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_PAIN_PAIN', GameWAD+':MTEXTURES\PAIN_PAIN', 128, 128, 1);
268 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_PAIN_ATTACK', GameWAD+':MTEXTURES\PAIN_ATTACK', 128, 128, 4);
269 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_PAIN_DIE', GameWAD+':MTEXTURES\PAIN_DIE', 128, 128, 7);
270 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_SLEEP', GameWAD+':MTEXTURES\BARON_SLEEP', 128, 128, 2);
271 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_SLEEP_L', GameWAD+':MTEXTURES\BARON_SLEEP_L', 128, 128, 2);
272 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_GO', GameWAD+':MTEXTURES\BARON_GO', 128, 128, 4);
273 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_PAIN', GameWAD+':MTEXTURES\BARON_PAIN', 128, 128, 1);
275 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_PAIN_L', GameWAD+':MTEXTURES\BARON_PAIN_L', 128, 128, 1);
276 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_ATTACK', GameWAD+':MTEXTURES\BARON_ATTACK', 128, 128, 3);
277 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_ATTACK_L', GameWAD+':MTEXTURES\BARON_ATTACK_L', 128, 128, 3);
278 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARON_DIE', GameWAD+':MTEXTURES\BARON_DIE', 128, 128, 7);
279 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_SLEEP', GameWAD+':MTEXTURES\KNIGHT_SLEEP', 128, 128, 2);
280 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_SLEEP_L', GameWAD+':MTEXTURES\KNIGHT_SLEEP_L', 128, 128, 2);
282 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_GO', GameWAD+':MTEXTURES\KNIGHT_GO', 128, 128, 4);
283 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_PAIN', GameWAD+':MTEXTURES\KNIGHT_PAIN', 128, 128, 1);
284 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_PAIN_L', GameWAD+':MTEXTURES\KNIGHT_PAIN_L', 128, 128, 1);
285 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_ATTACK', GameWAD+':MTEXTURES\KNIGHT_ATTACK', 128, 128, 3);
286 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_ATTACK_L', GameWAD+':MTEXTURES\KNIGHT_ATTACK_L', 128, 128, 3);
287 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_KNIGHT_DIE', GameWAD+':MTEXTURES\KNIGHT_DIE', 128, 128, 7);
289 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MANCUB_SLEEP', GameWAD+':MTEXTURES\MANCUB_SLEEP', 128, 128, 2);
290 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MANCUB_GO', GameWAD+':MTEXTURES\MANCUB_GO', 128, 128, 6);
291 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MANCUB_PAIN', GameWAD+':MTEXTURES\MANCUB_PAIN', 128, 128, 1);
292 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MANCUB_ATTACK', GameWAD+':MTEXTURES\MANCUB_ATTACK', 128, 128, 3);
293 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_MANCUB_DIE', GameWAD+':MTEXTURES\MANCUB_DIE', 128, 128, 10);
294 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_SLEEP', GameWAD+':MTEXTURES\SKEL_SLEEP', 128, 128, 2);
296 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_SLEEP_L', GameWAD+':MTEXTURES\SKEL_SLEEP_L', 128, 128, 2);
297 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_GO', GameWAD+':MTEXTURES\SKEL_GO', 128, 128, 6);
298 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_PAIN', GameWAD+':MTEXTURES\SKEL_PAIN', 128, 128, 1);
299 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_PAIN_L', GameWAD+':MTEXTURES\SKEL_PAIN_L', 128, 128, 1);
300 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_ATTACK', GameWAD+':MTEXTURES\SKEL_ATTACK', 128, 128, 2);
301 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_ATTACK_L', GameWAD+':MTEXTURES\SKEL_ATTACK_L', 128, 128, 2);
302 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_ATTACK2', GameWAD+':MTEXTURES\SKEL_ATTACK2', 128, 128, 2);
303 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_ATTACK2_L', GameWAD+':MTEXTURES\SKEL_ATTACK2_L', 128, 128, 2);
304 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_SKEL_DIE', GameWAD+':MTEXTURES\SKEL_DIE', 128, 128, 5);
305 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_SLEEP', GameWAD+':MTEXTURES\VILE_SLEEP', 128, 128, 2);
306 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_SLEEP_L', GameWAD+':MTEXTURES\VILE_SLEEP_L', 128, 128, 2);
307 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_GO', GameWAD+':MTEXTURES\VILE_GO', 128, 128, 6);
309 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_PAIN', GameWAD+':MTEXTURES\VILE_PAIN', 128, 128, 1);
310 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_PAIN_L', GameWAD+':MTEXTURES\VILE_PAIN_L', 128, 128, 1);
311 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_ATTACK', GameWAD+':MTEXTURES\VILE_ATTACK', 128, 128, 10);
312 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_ATTACK_L', GameWAD+':MTEXTURES\VILE_ATTACK_L', 128, 128, 10);
313 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_ATTACK2', GameWAD+':MTEXTURES\VILE_ATTACK2', 128, 128, 3);
314 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_ATTACK2_L', GameWAD+':MTEXTURES\VILE_ATTACK2_L', 128, 128, 3);
316 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_VILE_DIE', GameWAD+':MTEXTURES\VILE_DIE', 128, 128, 9);
317 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ROBO_SLEEP', GameWAD+':MTEXTURES\ROBO_SLEEP', 128, 128, 1);
318 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ROBO_GO', GameWAD+':MTEXTURES\ROBO_GO', 128, 128, 12);
319 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ROBO_ATTACK', GameWAD+':MTEXTURES\ROBO_ATTACK', 128, 128, 2);
320 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ROBO_ATTACK2', GameWAD+':MTEXTURES\ROBO_ATTACK2', 128, 128, 4);
321 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_ROBO_DIE', GameWAD+':MTEXTURES\ROBO_DIE', 128, 128, 1);
323 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_SLEEP', GameWAD+':MTEXTURES\CYBER_SLEEP', 128, 128, 2);
324 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_SLEEP_L', GameWAD+':MTEXTURES\CYBER_SLEEP_L', 128, 128, 2);
325 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_GO', GameWAD+':MTEXTURES\CYBER_GO', 128, 128, 4);
326 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_GO_L', GameWAD+':MTEXTURES\CYBER_GO_L', 128, 128, 4);
327 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_PAIN', GameWAD+':MTEXTURES\CYBER_PAIN', 128, 128, 1);
328 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_PAIN_L', GameWAD+':MTEXTURES\CYBER_PAIN_L', 128, 128, 1);
330 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_ATTACK', GameWAD+':MTEXTURES\CYBER_ATTACK', 128, 128, 2);
331 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_ATTACK_L', GameWAD+':MTEXTURES\CYBER_ATTACK_L', 128, 128, 2);
332 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_ATTACK2', GameWAD+':MTEXTURES\CYBER_ATTACK2', 128, 128, 2);
333 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_ATTACK2_L', GameWAD+':MTEXTURES\CYBER_ATTACK2_L', 128, 128, 2);
334 g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_CYBER_DIE', GameWAD+':MTEXTURES\CYBER_DIE', 128, 128, 9);
336 g_Frames_CreateWAD(nil, 'FRAMES_FIRE', GameWAD+':TEXTURES\FIRE', 64, 128, 8);
338 g_Frames_Get(vilefire, 'FRAMES_FIRE');
339 for m := MONSTER_DEMON to MONSTER_MAN do
340 begin
341 for a := ANIM_SLEEP to ANIM_PAIN do
342 begin
343 monFrames[m, a, TDirection.D_LEFT] := DWORD(-1);
344 monFrames[m, a, TDirection.D_RIGHT] := DWORD(-1);
345 if (ANIMTABLE[a].name <> '') and (MONSTER_ANIMTABLE[m].AnimSpeed[a] <> 0) then
346 begin
347 s := 'FRAMES_MONSTER_' + MONSTERTABLE[m].Name + '_' + ANIMTABLE[a].name;
348 if not (g_Frames_Exists(s) and g_Frames_Get(FramesID, s)) then
349 begin
350 // Заменяем только ANIM_MESS на ANIM_DIE:
351 if a <> ANIM_MESS then
352 Continue;
353 if g_Frames_Get(FramesID, 'FRAMES_MONSTER_' + MONSTERTABLE[m].Name + '_' + ANIMTABLE[ANIM_DIE].name) then
354 begin
355 monFrames[m, a, TDirection.D_RIGHT] := FramesID;
356 monFrames[m, a, TDirection.D_LEFT] := FramesID;
357 Continue;
358 end;
359 end;
360 monFrames[m, a, TDirection.D_RIGHT] := FramesID;
361 // Если есть отдельная левая анимация - загружаем:
362 if MONSTER_ANIMTABLE[m].LeftAnim then
363 begin
364 s := 'FRAMES_MONSTER_' + MONSTERTABLE[m].Name + '_' + ANIMTABLE[a].name + '_L';
365 if g_Frames_Exists(s) then
366 g_Frames_Get(FramesID, s);
367 end;
368 monFrames[m, a, TDirection.D_LEFT] := FramesID;
369 end
370 end
371 end
372 end;
374 procedure r_Monsters_Draw (constref monster: TMonster);
375 var m: TMirrorType; dx, dy, c, fX, fY: Integer; o: TObj;
376 begin
377 with monster do
378 begin
379 //e_CharFont_Print(gMenuSmallFont, Obj.X + Obj.Rect.X, Obj.Y + Obj.Rect.Y, 'TYPE: ' + IntToStr(MonsterType));
380 //e_CharFont_Print(gMenuSmallFont, Obj.X + Obj.Rect.X, Obj.Y + Obj.Rect.Y + 16, 'STATE: ' + IntToStr(MonsterState));
382 Obj.lerp(gLerpFactor, fX, fY);
384 // Если колдун стреляет, то рисуем огонь:
385 if MonsterType = MONSTER_VILE then
386 if MonsterState = MONSTATE_SHOOT then
387 if GetPos(MonsterTargetUID, @o) then
388 r_AnimationState_Draw(VileFire, VileFireAnim, o.X + o.Rect.X + (o.Rect.Width div 2) - 32, o.Y + o.Rect.Y + o.Rect.Height - 128, TMirrorType.None);
390 // Не в области рисования не ресуем:
391 //FIXME!
392 if (g_dbg_scale = 1.0) then
393 begin
394 if not g_Collide(Obj.X + Obj.Rect.X, Obj.Y + Obj.Rect.Y, Obj.Rect.Width, Obj.Rect.Height, sX - 128, sY - 128, sWidth + 256, sHeight + 256) then
395 Exit;
396 end;
398 // Эти монстры, умирая, не оставляют трупов:
399 if MonsterState = MONSTATE_DEAD then
400 case MonsterType of
401 MONSTER_BARREL, MONSTER_SOUL, MONSTER_PAIN: Exit;
402 end;
404 // Есть что рисовать при текущем поведении:
405 if monFrames[MonsterType, MonsterAnim, GameDirection] <> DWORD(-1) then
406 begin
407 // Если нет левой анимации или она совпадает с правой => отражаем правую:
408 if (GameDirection = TDirection.D_LEFT) and ((not MONSTER_ANIMTABLE[MonsterType].LeftAnim) or (monFrames[MonsterType, MonsterAnim, TDirection.D_LEFT] = monFrames[MonsterType, MonsterAnim, TDirection.D_RIGHT])) and (MonsterType <> MONSTER_BARREL) then
409 m := TMirrorType.Horizontal
410 else
411 m := TMirrorType.None;
413 // Левая анимация => меняем смещение относительно центра:
414 if (GameDirection = TDirection.D_LEFT) and (MonsterType <> MONSTER_BARREL) then
415 begin
416 dx := MONSTER_ANIMTABLE[MonsterType].AnimDeltaLeft[MonsterAnim].X;
417 dy := MONSTER_ANIMTABLE[MonsterType].AnimDeltaLeft[MonsterAnim].Y;
419 if m = TMirrorType.Horizontal then
420 begin
421 // Нет отдельной левой анимации
422 // Расстояние от края текстуры до края визуального положения объекта на текстуре:
423 c := (MONSTERTABLE[MonsterType].Rect.X - dx) + MONSTERTABLE[MonsterType].Rect.Width;
424 // Расстояние от края хит бокса до края визуального положения объекта на текстуре:
425 //dx := DirAnim[MonsterAnim, GameDirection].Width - c - MONSTERTABLE[MonsterType].Rect.X;
426 dx := 64 - c - MONSTERTABLE[MonsterType].Rect.X; // !!! ^^^
427 // Т.к. двигать текстуру нужно будет в противоположном направлении:
428 dx := -dx;
429 // Это значит: dX := -frameWidth - animDeltaX + hitX + hitWidth + hitX
430 end
431 end
432 else // Правая анимация
433 begin
434 dx := MONSTER_ANIMTABLE[MonsterType].AnimDeltaRight[MonsterAnim].X;
435 dy := MONSTER_ANIMTABLE[MonsterType].AnimDeltaRight[MonsterAnim].Y;
436 end;
438 r_AnimationState_Draw(monFrames[MonsterType, MonsterAnim, GameDirection], DirAnim[MonsterAnim, GameDirection], fX + dx, fY + dy, m);
439 end;
441 if g_debug_Frames then
442 begin
443 e_DrawQuad(Obj.X + Obj.Rect.X, Obj.Y + Obj.Rect.Y, Obj.X + Obj.Rect.X + Obj.Rect.Width - 1, Obj.Y + Obj.Rect.Y + Obj.Rect.Height - 1, 0, 255, 0);
444 end
445 end
446 end;
448 procedure r_Monsters_Draw;
449 var a: Integer;
450 begin
451 if gMonsters <> nil then
452 for a := 0 to High(gMonsters) do
453 if (gMonsters[a] <> nil) then r_Monsters_Draw(gMonsters[a]);
454 end;
456 procedure r_Monsters_DrawHealth;
457 var a: Integer; fW, fH: Byte;
458 begin
459 if gMonsters = nil then Exit;
460 e_TextureFontGetSize(gStdFont, fW, fH);
461 for a := 0 to High(gMonsters) do
462 begin
463 if gMonsters[a] <> nil then
464 begin
465 e_TextureFontPrint(gMonsters[a].Obj.X + gMonsters[a].Obj.Rect.X,
466 gMonsters[a].Obj.Y + gMonsters[a].Obj.Rect.Y + gMonsters[a].Obj.Rect.Height - fH,
467 IntToStr(gMonsters[a].MonsterHealth), gStdFont);
468 end
469 end
470 end;
472 end.