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}
18 interface
29 {$IFDEF ENABLE_GIBS}
32 {$ENDIF}
34 implementation
36 uses
37 {$IFDEF ENABLE_GIBS}
38 g_gibs,
39 {$ENDIF}
45 ;
47 const
48 WeapNames: Array [WP_FIRST + 1..WP_LAST] of String = ('csaw', 'hgun', 'sg', 'ssg', 'mgun', 'rkt', 'plz', 'bfg', 'spl', 'flm');
50 type
54 var
55 WeaponID: Array [WP_FIRST + 1..WP_LAST, W_POS_NORMAL..W_POS_DOWN, W_ACT_NORMAL..W_ACT_FIRE] of DWORD;
61 {$IFDEF ENABLE_GIBS}
67 {$ENDIF}
73 {$IFDEF ENABLE_GIBS}
75 begin
78 {$ENDIF}
81 begin
86 begin
92 const
96 A_ATTACKUP, A_ATTACKDOWN
97 );
98 var
101 begin
102 // HACK: shitty workaround to duplicate base animations
103 // in place of extended, replace with something better later
115 begin
121 procedure r_PlayerModel_LoadResource (resource: AnsiString; var pData: Pointer; var len: Integer);
123 begin
136 begin
140 begin
144 (* trace x from right to left *)
147 begin
155 (* trace y from up to down *)
158 begin
166 (* trace x from right to left *)
169 begin
177 (* trace y from down to up *)
180 begin
192 {$IFDEF ENABLE_GIBS}
194 {$ENDIF}
196 begin
197 g_Frames_CreateWAD(@RedFlagFrames, 'FRAMES_FLAG_RED', GameWAD + ':TEXTURES\FLAGRED', 64, 64, 5, False);
198 g_Frames_CreateWAD(@BlueFlagFrames, 'FRAMES_FLAG_BLUE', GameWAD + ':TEXTURES\FLAGBLUE', 64, 64, 5, False);
200 begin
201 g_Texture_CreateWAD(WeaponID[a][W_POS_NORMAL][W_ACT_NORMAL], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a]));
202 g_Texture_CreateWAD(WeaponID[a][W_POS_NORMAL][W_ACT_FIRE], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_FIRE');
203 g_Texture_CreateWAD(WeaponID[a][W_POS_UP][W_ACT_NORMAL], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_UP');
204 g_Texture_CreateWAD(WeaponID[a][W_POS_UP][W_ACT_FIRE], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_UP_FIRE');
205 g_Texture_CreateWAD(WeaponID[a][W_POS_DOWN][W_ACT_NORMAL], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_DN');
206 g_Texture_CreateWAD(WeaponID[a][W_POS_DOWN][W_ACT_FIRE], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_DN_FIRE');
210 begin
213 begin
216 begin
219 begin
222 begin
224 begin
226 continue
227 end
233 begin
235 begin
241 end
242 end
244 {$IFDEF ENABLE_GIBS}
247 begin
251 begin
253 begin
256 begin
261 end
262 end
266 end
267 {$ENDIF}
268 end
269 end
274 begin
279 begin
281 begin
283 begin
289 end
290 // !!! delete gibs textures here
299 begin
300 FlagAnimState.Update
304 var
310 begin
311 // Флаги:
314 else
323 begin
329 FramesID,
330 FlagAnimState,
331 X + IfThen(pm.Direction = TDirection.D_LEFT, fp.X - 1, 2 * FLAG_BASEPOINT.X - fp.X + 1) - FLAG_BASEPOINT.X,
334 Mirror,
336 p,
338 );
341 // Оружие:
344 else
347 if PlayerModelsArray[pm.id].HaveWeapon and (not (pm.CurrentAnimation in [A_DIE1, A_DIE2, A_PAIN])) and (pm.CurrentWeapon in [WP_FIRST + 1..WP_LAST]) then
348 begin
350 pos := W_POS_UP
351 else
353 pos := W_POS_DOWN
354 else
358 act := W_ACT_FIRE
359 else
365 X + PlayerModelsArray[pm.id].WeaponPoints[pm.CurrentWeapon, pm.CurrentAnimation, pm.Direction, pm.AnimState.CurrentFrame].X,
366 Y + PlayerModelsArray[pm.id].WeaponPoints[pm.CurrentWeapon, pm.CurrentAnimation, pm.Direction, pm.AnimState.CurrentFrame].Y,
370 Mirror
371 );
374 // Модель:
375 if (pm.Direction = TDirection.D_LEFT) and (Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].base <> 0) then
376 begin
379 end
380 else
381 begin
386 // Маска модели:
389 if (pm.Direction = TDirection.D_LEFT) and (Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].mask <> 0) then
390 begin
393 end
394 else
395 begin
405 {$IFDEF ENABLE_GIBS}
408 begin
410 begin
412 begin
414 begin
417 Continue;
423 e_DrawAdv(Models[m].Gibs[id].base, fX, fY, 0, True, False, gGibs[i].RAngle, @a, TMirrorType.None);
425 e_DrawAdv(Models[m].Gibs[id].mask, fX, fY, 0, True, False, gGibs[i].RAngle, @a, TMirrorType.None);
429 end
430 end
431 end
433 {$ENDIF}