DEADSOFTWARE

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