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
91 const
95 A_ATTACKUP, A_ATTACKDOWN
96 );
97 var
100 begin
101 // HACK: shitty workaround to duplicate base animations
102 // in place of extended, replace with something better later
114 begin
120 procedure r_PlayerModel_LoadResource (resource: AnsiString; var pData: Pointer; var len: Integer);
122 begin
135 begin
139 begin
143 (* trace x from right to left *)
146 begin
154 (* trace y from up to down *)
157 begin
165 (* trace x from right to left *)
168 begin
176 (* trace y from down to up *)
179 begin
191 {$IFDEF ENABLE_GIBS}
193 {$ENDIF}
195 begin
196 g_Frames_CreateWAD(@RedFlagFrames, 'FRAMES_FLAG_RED', GameWAD + ':TEXTURES\FLAGRED', 64, 64, 5, False);
197 g_Frames_CreateWAD(@BlueFlagFrames, 'FRAMES_FLAG_BLUE', GameWAD + ':TEXTURES\FLAGBLUE', 64, 64, 5, False);
199 begin
200 g_Texture_CreateWAD(WeaponID[a][W_POS_NORMAL][W_ACT_NORMAL], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a]));
201 g_Texture_CreateWAD(WeaponID[a][W_POS_NORMAL][W_ACT_FIRE], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_FIRE');
202 g_Texture_CreateWAD(WeaponID[a][W_POS_UP][W_ACT_NORMAL], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_UP');
203 g_Texture_CreateWAD(WeaponID[a][W_POS_UP][W_ACT_FIRE], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_UP_FIRE');
204 g_Texture_CreateWAD(WeaponID[a][W_POS_DOWN][W_ACT_NORMAL], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_DN');
205 g_Texture_CreateWAD(WeaponID[a][W_POS_DOWN][W_ACT_FIRE], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a])+'_DN_FIRE');
209 begin
212 begin
215 begin
218 begin
221 begin
223 begin
225 continue
226 end
232 begin
234 begin
240 end
241 end
243 {$IFDEF ENABLE_GIBS}
246 begin
250 begin
252 begin
255 begin
260 end
261 end
265 end
266 {$ENDIF}
267 end
268 end
273 begin
278 begin
280 begin
282 begin
288 end
289 // !!! delete gibs textures here
298 begin
299 FlagAnimState.Update
303 var
309 begin
310 // Флаги:
313 else
322 begin
328 FramesID,
329 FlagAnimState,
330 X + IfThen(pm.Direction = TDirection.D_LEFT, fp.X - 1, 2 * FLAG_BASEPOINT.X - fp.X + 1) - FLAG_BASEPOINT.X,
333 Mirror,
335 p,
337 );
340 // Оружие:
343 else
346 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
347 begin
349 pos := W_POS_UP
350 else
352 pos := W_POS_DOWN
353 else
357 act := W_ACT_FIRE
358 else
364 X + PlayerModelsArray[pm.id].WeaponPoints[pm.CurrentWeapon, pm.CurrentAnimation, pm.Direction, pm.AnimState.CurrentFrame].X,
365 Y + PlayerModelsArray[pm.id].WeaponPoints[pm.CurrentWeapon, pm.CurrentAnimation, pm.Direction, pm.AnimState.CurrentFrame].Y,
369 Mirror
370 );
373 // Модель:
374 if (pm.Direction = TDirection.D_LEFT) and (Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].base <> 0) then
375 begin
378 end
379 else
380 begin
385 // Маска модели:
388 if (pm.Direction = TDirection.D_LEFT) and (Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].mask <> 0) then
389 begin
392 end
393 else
394 begin
404 {$IFDEF ENABLE_GIBS}
407 begin
409 begin
411 begin
413 begin
416 Continue;
422 e_DrawAdv(Models[m].Gibs[id].base, fX, fY, 0, True, False, gGibs[i].RAngle, @a, TMirrorType.None);
424 e_DrawAdv(Models[m].Gibs[id].mask, fX, fY, 0, True, False, gGibs[i].RAngle, @a, TMirrorType.None);
428 end
429 end
430 end
432 {$ENDIF}