index b8d0ec6c7ef4b74d3f1c54c6a7297af846029d88..e2148e8ec204f35ae225ab656751a550235bd2b0 100644 (file)
-(* Copyright (C) DooM 2D:Forever Developers
+(* Copyright (C) Doom 2D: Forever Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
interface
uses
interface
uses
- mempool,
- MAPDEF, g_textures, g_basic, g_weapons, e_graphics, wadreader;
+ {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
+ MAPDEF, g_textures, g_basic, g_weapons, e_graphics, utils, g_gfx,
+ ImagingTypes, Imaging, ImagingUtility;
const
A_STAND = 0;
const
A_STAND = 0;
HaveWeapon: Boolean;
end;
HaveWeapon: Boolean;
end;
+ TModelBlood = record
+ R, G, B, Kind: Byte;
+ end;
+
TModelSound = record
ID: DWORD;
Level: Byte;
TModelSound = record
ID: DWORD;
Level: Byte;
TGibsArray = Array of TGibSprite;
TWeaponPoints = Array [WP_FIRST + 1..WP_LAST] of
Array [A_STAND..A_LAST] of
TGibsArray = Array of TGibSprite;
TWeaponPoints = Array [WP_FIRST + 1..WP_LAST] of
Array [A_STAND..A_LAST] of
- Array [D_LEFT..D_RIGHT] of Array of TDFPoint;
+ Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array of TDFPoint;
- TPlayerModel = class(TPoolObject)
+ TPlayerModel = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF}
private
FName: String;
FDirection: TDirection;
FColor: TRGB;
private
FName: String;
FDirection: TDirection;
FColor: TRGB;
+ FBlood: TModelBlood;
FCurrentAnimation: Byte;
FCurrentAnimation: Byte;
- FAnim: Array [D_LEFT..D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
- FMaskAnim: Array [D_LEFT..D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
+ FAnim: Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
+ FMaskAnim: Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
FWeaponPoints: TWeaponPoints;
FPainSounds: TModelSoundArray;
FDieSounds: TModelSoundArray;
FWeaponPoints: TWeaponPoints;
FPainSounds: TModelSoundArray;
FDieSounds: TModelSoundArray;
public
property Color: TRGB read FColor write FColor;
public
property Color: TRGB read FColor write FColor;
+ property Blood: TModelBlood read FBlood;
end;
procedure g_PlayerModel_LoadData();
procedure g_PlayerModel_FreeData();
function g_PlayerModel_Load(FileName: String): Boolean;
end;
procedure g_PlayerModel_LoadData();
procedure g_PlayerModel_FreeData();
function g_PlayerModel_Load(FileName: String): Boolean;
-function g_PlayerModel_GetNames(): SArray;
+function g_PlayerModel_GetNames(): SSArray;
function g_PlayerModel_GetInfo(ModelName: String): TModelInfo;
function g_PlayerModel_GetInfo(ModelName: String): TModelInfo;
+function g_PlayerModel_GetBlood(ModelName: String): TModelBlood;
function g_PlayerModel_Get(ModelName: String): TPlayerModel;
function g_PlayerModel_GetAnim(ModelName: String; Anim: Byte; var _Anim, _Mask: TAnimation): Boolean;
function g_PlayerModel_GetGibs(ModelName: String; var Gibs: TGibsArray): Boolean;
function g_PlayerModel_Get(ModelName: String): TPlayerModel;
function g_PlayerModel_GetAnim(ModelName: String; Anim: Byte; var _Anim, _Mask: TAnimation): Boolean;
function g_PlayerModel_GetGibs(ModelName: String; var Gibs: TGibsArray): Boolean;
+
implementation
uses
implementation
uses
+ {$INCLUDE ../nogl/noGLuses.inc}
g_main, g_sound, g_console, SysUtils, g_player, CONFIG,
g_main, g_sound, g_console, SysUtils, g_player, CONFIG,
- GL, GLExt, e_sound, g_options, g_map, Math, e_log;
+ e_sound, g_options, g_map, Math, e_log, wadreader;
type
TPlayerModelInfo = record
type
TPlayerModelInfo = record
PainSounds: TModelSoundArray;
DieSounds: TModelSoundArray;
SlopSound: Byte;
PainSounds: TModelSoundArray;
DieSounds: TModelSoundArray;
SlopSound: Byte;
+ Blood: TModelBlood;
end;
const
end;
const
begin
X := X - WEAPONBASE[weapon].X;
Y := Y - WEAPONBASE[weapon].Y;
begin
X := X - WEAPONBASE[weapon].X;
Y := Y - WEAPONBASE[weapon].Y;
- if dir = D_LEFT then
+ if dir = TDirection.D_LEFT then
X := -X;
end;
end;
X := -X;
end;
end;
begin
for W := WP_FIRST + 1 to WP_LAST do
begin
begin
for W := WP_FIRST + 1 to WP_LAST do
begin
- for D := D_LEFT to D_RIGHT do
+ for D := TDirection.D_LEFT to TDirection.D_RIGHT do
begin
SetLength(WeaponPoints[W, AIdx, D], Length(WeaponPoints[W, OIdx, D]));
for I := 0 to High(WeaponPoints[W, AIdx, D]) do
begin
SetLength(WeaponPoints[W, AIdx, D], Length(WeaponPoints[W, OIdx, D]));
for I := 0 to High(WeaponPoints[W, AIdx, D]) do
end;
end;
end;
end;
+function g_PlayerModel_CalcGibSize (pData: Pointer; dataSize, x, y, w, h: Integer): TRectWH;
+ var i, j: Integer; done: Boolean; img: TImageData;
+
+ function IsVoid (i, j: Integer): Boolean;
+ begin
+ result := Byte((PByte(img.bits) + (y+j)*img.width*4 + (x+i)*4 + 3)^) = 0
+ end;
+
+begin
+ InitImage(img);
+ assert(LoadImageFromMemory(pData, dataSize, img));
+
+ (* trace x from right to left *)
+ done := false; i := 0;
+ while not done and (i < w) do
+ begin
+ j := 0;
+ while (j < h) and IsVoid(i, j) do inc(j);
+ done := (j < h) and (IsVoid(i, j) = false);
+ result.x := i;
+ inc(i);
+ end;
+
+ (* trace y from up to down *)
+ done := false; j := 0;
+ while not done and (j < h) do
+ begin
+ i := 0;
+ while (i < w) and IsVoid(i, j) do inc(i);
+ done := (i < w) and (IsVoid(i, j) = false);
+ result.y := j;
+ inc(j);
+ end;
+
+ (* trace x from right to left *)
+ done := false; i := w - 1;
+ while not done and (i >= 0) do
+ begin
+ j := 0;
+ while (j < h) and IsVoid(i, j) do inc(j);
+ done := (j < h) and (IsVoid(i, j) = false);
+ result.width := i - result.x + 1;
+ dec(i);
+ end;
+
+ (* trace y from down to up *)
+ done := false; j := h - 1;
+ while not done and (j >= 0) do
+ begin
+ i := 0;
+ while (i < w) and IsVoid(i, j) do inc(i);
+ done := (i < w) and (IsVoid(i, j) = false);
+ result.height := j - result.y + 1;
+ dec(j);
+ end;
+
+ FreeImage(img);
+end;
+
function g_PlayerModel_Load(FileName: string): Boolean;
var
ID: DWORD;
function g_PlayerModel_Load(FileName: string): Boolean;
var
ID: DWORD;
prefix: string;
ok, chk: Boolean;
begin
prefix: string;
ok, chk: Boolean;
begin
- e_WriteLog(Format('Loading player model: %s', [ExtractFileName(FileName)]), MSG_NOTIFY);
+ e_WriteLog(Format('Loading player model: %s', [ExtractFileName(FileName)]), TMsgType.Notify);
Result := False;
Result := False;
Description := config.ReadStr('Model', 'description', '');
end;
Description := config.ReadStr('Model', 'description', '');
end;
+ with PlayerModelsArray[ID] do
+ begin
+ Blood.R := MAX(0, MIN(255, config.ReadInt('Blood', 'R', 150)));
+ Blood.G := MAX(0, MIN(255, config.ReadInt('Blood', 'G', 0)));
+ Blood.B := MAX(0, MIN(255, config.ReadInt('Blood', 'B', 0)));
+ case config.ReadStr('Blood', 'Kind', 'NORMAL') of
+ 'NORMAL': Blood.Kind := BLOOD_NORMAL;
+ 'SPARKS': Blood.Kind := BLOOD_CSPARKS;
+ 'COMBINE': Blood.Kind := BLOOD_COMBINE;
+ else
+ Blood.Kind := BLOOD_NORMAL
+ end
+ end;
+
for b := A_STAND to A_LAST do
begin
aname := s+'_RIGHTANIM'+IntToStr(b);
for b := A_STAND to A_LAST do
begin
aname := s+'_RIGHTANIM'+IntToStr(b);
for aa := WP_FIRST + 1 to WP_LAST do
for bb := A_STAND to A_LAST do
for aa := WP_FIRST + 1 to WP_LAST do
for bb := A_STAND to A_LAST do
- for cc := D_LEFT to D_RIGHT do
+ for cc := TDirection.D_LEFT to TDirection.D_RIGHT do
begin
f := config.ReadInt(AnimNames[bb], 'frames', 1);
if config.ReadBool(AnimNames[bb], 'backanim', False) then
begin
f := config.ReadInt(AnimNames[bb], 'frames', 1);
if config.ReadBool(AnimNames[bb], 'backanim', False) then
if e_CreateTextureMemEx(pData, lenpd, Gibs[a].ID, a*32, 0, 32, 32) and
e_CreateTextureMemEx(pData2, lenpd2, Gibs[a].MaskID, a*32, 0, 32, 32) then
begin
if e_CreateTextureMemEx(pData, lenpd, Gibs[a].ID, a*32, 0, 32, 32) and
e_CreateTextureMemEx(pData2, lenpd2, Gibs[a].MaskID, a*32, 0, 32, 32) then
begin
- Gibs[a].Rect := e_GetTextureSize2(Gibs[a].ID);
+ //Gibs[a].Rect := e_GetTextureSize2(Gibs[a].ID);
+ Gibs[a].Rect := g_PlayerModel_CalcGibSize(pData, lenpd, a*32, 0, 32, 32);
with Gibs[a].Rect do
if Height > 3 then Height := Height-1-Random(2);
Gibs[a].OnlyOne := config.ReadInt('Gibs', 'once', -1) = a+1;
with Gibs[a].Rect do
if Height > 3 then Height := Height-1-Random(2);
Gibs[a].OnlyOne := config.ReadInt('Gibs', 'once', -1) = a+1;
for bb := A_STAND to A_LAST do
if not (bb in [A_DIE1, A_DIE2, A_PAIN]) then
begin
for bb := A_STAND to A_LAST do
if not (bb in [A_DIE1, A_DIE2, A_PAIN]) then
begin
- chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'_points', ''), aa, bb, D_RIGHT,
+ chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'_points', ''), aa, bb, TDirection.D_RIGHT,
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints);
if ok and (not chk) and (aa = WEAPON_FLAMETHROWER) then
begin
// workaround for flamethrower
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints);
if ok and (not chk) and (aa = WEAPON_FLAMETHROWER) then
begin
// workaround for flamethrower
- chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[WEAPON_PLASMA]+'_points', ''), aa, bb, D_RIGHT,
+ chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[WEAPON_PLASMA]+'_points', ''), aa, bb, TDirection.D_RIGHT,
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints);
if chk then
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints);
if chk then
- for f := 0 to High(WeaponPoints[aa, bb, D_RIGHT]) do
+ for f := 0 to High(WeaponPoints[aa, bb, TDirection.D_RIGHT]) do
begin
case bb of
A_STAND, A_PAIN:
begin
begin
case bb of
A_STAND, A_PAIN:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 8);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 6);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 8);
end;
A_WALKATTACK, A_WALK:
begin
end;
A_WALKATTACK, A_WALK:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 9);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 9);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 9);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 9);
end;
A_ATTACK:
begin
end;
A_ATTACK:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 8);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 8);
end;
A_WALKSEEUP, A_SEEUP:
begin
end;
A_WALKSEEUP, A_SEEUP:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 16);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 16);
end;
A_WALKSEEDOWN, A_SEEDOWN:
begin
end;
A_WALKSEEDOWN, A_SEEDOWN:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 6);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 5);
end;
A_WALKATTACKUP, A_ATTACKUP:
begin
end;
A_WALKATTACKUP, A_ATTACKUP:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 16);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 16);
end;
A_WALKATTACKDOWN, A_ATTACKDOWN:
begin
end;
A_WALKATTACKDOWN, A_ATTACKDOWN:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 4);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 6);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 4);
end;
end;
end;
end;
ok := ok and (chk or (bb > A_LASTBASE));
end;
end;
end;
end;
ok := ok and (chk or (bb > A_LASTBASE));
- if not GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'2_points', ''), aa, bb, D_LEFT,
+ if not GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'2_points', ''), aa, bb, TDirection.D_LEFT,
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints) then
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints) then
- for f := 0 to High(WeaponPoints[aa, bb, D_RIGHT]) do
+ for f := 0 to High(WeaponPoints[aa, bb, TDirection.D_RIGHT]) do
begin
begin
- WeaponPoints[aa, bb, D_LEFT, f].X := -WeaponPoints[aa, bb, D_RIGHT, f].X;
- WeaponPoints[aa, bb, D_LEFT, f].Y := WeaponPoints[aa, bb, D_RIGHT, f].Y;
+ WeaponPoints[aa, bb, TDirection.D_LEFT, f].X := -WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X;
+ WeaponPoints[aa, bb, TDirection.D_LEFT, f].Y := WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y;
end;
if not ok then Break;
end;
if not ok then Break;
with PlayerModelsArray[a] do
begin
Result.FName := Info.Name;
with PlayerModelsArray[a] do
begin
Result.FName := Info.Name;
+ Result.FBlood := Blood;
for b := A_STAND to A_LAST do
begin
for b := A_STAND to A_LAST do
begin
Exit;
end;
Exit;
end;
- Result.FAnim[D_RIGHT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FAnim[TDirection.D_RIGHT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
- Result.FMaskAnim[D_RIGHT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FMaskAnim[TDirection.D_RIGHT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
if g_Frames_Exists(Info.Name+'_LEFTANIM'+IntToStr(b)) and
g_Frames_Exists(Info.Name+'_LEFTANIM'+IntToStr(b)+'_MASK') then
if g_Frames_Get(ID, Info.Name+'_LEFTANIM'+IntToStr(b)) and
g_Frames_Get(ID2, Info.Name+'_LEFTANIM'+IntToStr(b)+'_MASK') then
begin
if g_Frames_Exists(Info.Name+'_LEFTANIM'+IntToStr(b)) and
g_Frames_Exists(Info.Name+'_LEFTANIM'+IntToStr(b)+'_MASK') then
if g_Frames_Get(ID, Info.Name+'_LEFTANIM'+IntToStr(b)) and
g_Frames_Get(ID2, Info.Name+'_LEFTANIM'+IntToStr(b)+'_MASK') then
begin
- Result.FAnim[D_LEFT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FAnim[TDirection.D_LEFT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
- Result.FMaskAnim[D_LEFT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FMaskAnim[TDirection.D_LEFT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
end;
end;
end;
end;
end;
end;
end;
end;
-function g_PlayerModel_GetNames(): SArray;
+function g_PlayerModel_GetNames(): SSArray;
var
i: DWORD;
begin
var
i: DWORD;
begin
end;
end;
end;
end;
+function g_PlayerModel_GetBlood(ModelName: string): TModelBlood;
+var
+ a: Integer;
+begin
+ Result.R := 150;
+ Result.G := 0;
+ Result.B := 0;
+ Result.Kind := BLOOD_NORMAL;
+ if PlayerModelsArray = nil then Exit;
+
+ for a := 0 to High(PlayerModelsArray) do
+ if PlayerModelsArray[a].Info.Name = ModelName then
+ begin
+ Result := PlayerModelsArray[a].Blood;
+ Break;
+ end;
+end;
+
procedure g_PlayerModel_FreeData();
var
i: DWORD;
procedure g_PlayerModel_FreeData();
var
i: DWORD;
for c := W_ACT_NORMAL to W_ACT_FIRE do
e_DeleteTexture(WeaponID[a][b][c]);
for c := W_ACT_NORMAL to W_ACT_FIRE do
e_DeleteTexture(WeaponID[a][b][c]);
- e_WriteLog('Releasing models...', MSG_NOTIFY);
+ e_WriteLog('Releasing models...', TMsgType.Notify);
if PlayerModelsArray = nil then Exit;
if PlayerModelsArray = nil then Exit;
FCurrentAnimation := Animation;
FCurrentAnimation := Animation;
- if (FDirection = D_LEFT) and
- (FAnim[D_LEFT][FCurrentAnimation] <> nil) and
- (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
+ if (FDirection = TDirection.D_LEFT) and
+ (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) and
+ (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
begin
begin
- FAnim[D_LEFT][FCurrentAnimation].Reset;
- FMaskAnim[D_LEFT][FCurrentAnimation].Reset;
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Reset;
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Reset;
end
else
begin
end
else
begin
- FAnim[D_RIGHT][FCurrentAnimation].Reset;
- FMaskAnim[D_RIGHT][FCurrentAnimation].Reset;
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].Reset;
+ FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Reset;
end;
end;
end;
end;
begin
for a := A_STAND to A_LAST do
begin
begin
for a := A_STAND to A_LAST do
begin
- FAnim[D_LEFT][a].Free();
- FMaskAnim[D_LEFT][a].Free();
- FAnim[D_RIGHT][a].Free();
- FMaskAnim[D_RIGHT][a].Free();
+ FAnim[TDirection.D_LEFT][a].Free();
+ FMaskAnim[TDirection.D_LEFT][a].Free();
+ FAnim[TDirection.D_RIGHT][a].Free();
+ FMaskAnim[TDirection.D_RIGHT][a].Free();
end;
inherited;
end;
inherited;
p: TDFPoint;
begin
// Ôëàãè:
p: TDFPoint;
begin
// Ôëàãè:
- if Direction = D_LEFT then
- Mirror := M_NONE
+ if Direction = TDirection.D_LEFT then
+ Mirror := TMirrorType.None
else
else
- Mirror := M_HORIZONTAL;
+ Mirror := TMirrorType.Horizontal;
if (FFlag <> FLAG_NONE) and (FFlagAnim <> nil) and
(not (FCurrentAnimation in [A_DIE1, A_DIE2])) then
begin
if (FFlag <> FLAG_NONE) and (FFlagAnim <> nil) and
(not (FCurrentAnimation in [A_DIE1, A_DIE2])) then
begin
- p.X := IfThen(Direction = D_LEFT,
+ p.X := IfThen(Direction = TDirection.D_LEFT,
FLAG_BASEPOINT.X,
64-FLAG_BASEPOINT.X);
p.Y := FLAG_BASEPOINT.Y;
FLAG_BASEPOINT.X,
64-FLAG_BASEPOINT.X);
p.Y := FLAG_BASEPOINT.Y;
- FFlagAnim.DrawEx(X+IfThen(Direction = D_LEFT, FFlagPoint.X-1, 2*FLAG_BASEPOINT.X-FFlagPoint.X+1)-FLAG_BASEPOINT.X,
+ FFlagAnim.DrawEx(X+IfThen(Direction = TDirection.D_LEFT, FFlagPoint.X-1, 2*FLAG_BASEPOINT.X-FFlagPoint.X+1)-FLAG_BASEPOINT.X,
Y+FFlagPoint.Y-FLAG_BASEPOINT.Y+1, Mirror, p,
Y+FFlagPoint.Y-FLAG_BASEPOINT.Y+1, Mirror, p,
- IfThen(FDirection = D_RIGHT, FFlagAngle, -FFlagAngle));
+ IfThen(FDirection = TDirection.D_RIGHT, FFlagAngle, -FFlagAngle));
end;
// Îðóæèå:
end;
// Îðóæèå:
- if Direction = D_RIGHT then
- Mirror := M_NONE
+ if Direction = TDirection.D_RIGHT then
+ Mirror := TMirrorType.None
else
else
- Mirror := M_HORIZONTAL;
+ Mirror := TMirrorType.Horizontal;
if FDrawWeapon and
(not (FCurrentAnimation in [A_DIE1, A_DIE2, A_PAIN])) and
if FDrawWeapon and
(not (FCurrentAnimation in [A_DIE1, A_DIE2, A_PAIN])) and
if Alpha < 201 then
e_Draw(WeaponID[FCurrentWeapon][pos][act],
X+FWeaponPoints[FCurrentWeapon, FCurrentAnimation, FDirection,
if Alpha < 201 then
e_Draw(WeaponID[FCurrentWeapon][pos][act],
X+FWeaponPoints[FCurrentWeapon, FCurrentAnimation, FDirection,
- FAnim[D_RIGHT][FCurrentAnimation].CurrentFrame].X,
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].CurrentFrame].X,
Y+FWeaponPoints[FCurrentWeapon, FCurrentAnimation, FDirection,
Y+FWeaponPoints[FCurrentWeapon, FCurrentAnimation, FDirection,
- FAnim[D_RIGHT][FCurrentAnimation].CurrentFrame].Y,
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].CurrentFrame].Y,
0, True, False, Mirror);
end;
// Ìîäåëü:
0, True, False, Mirror);
end;
// Ìîäåëü:
- if (FDirection = D_LEFT) and
- (FAnim[D_LEFT][FCurrentAnimation] <> nil) then
+ if (FDirection = TDirection.D_LEFT) and
+ (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
begin
begin
- FAnim[D_LEFT][FCurrentAnimation].Alpha := Alpha;
- FAnim[D_LEFT][FCurrentAnimation].Draw(X, Y, M_NONE);
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Alpha := Alpha;
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Draw(X, Y, TMirrorType.None);
end
else
begin
end
else
begin
- FAnim[D_RIGHT][FCurrentAnimation].Alpha := Alpha;
- FAnim[D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].Alpha := Alpha;
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
end;
// Ìàñêà ìîäåëè:
e_Colors := FColor;
end;
// Ìàñêà ìîäåëè:
e_Colors := FColor;
- if (FDirection = D_LEFT) and
- (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
+ if (FDirection = TDirection.D_LEFT) and
+ (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
begin
begin
- FMaskAnim[D_LEFT][FCurrentAnimation].Alpha := Alpha;
- FMaskAnim[D_LEFT][FCurrentAnimation].Draw(X, Y, M_NONE);
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Alpha := Alpha;
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Draw(X, Y, TMirrorType.None);
end
else
begin
end
else
begin
- FMaskAnim[D_RIGHT][FCurrentAnimation].Alpha := Alpha;
- FMaskAnim[D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
+ FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Alpha := Alpha;
+ FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
end;
e_Colors.R := 255;
end;
e_Colors.R := 255;
function TPlayerModel.GetCurrentAnimation: TAnimation;
begin
function TPlayerModel.GetCurrentAnimation: TAnimation;
begin
- if (FDirection = D_LEFT) and (FAnim[D_LEFT][FCurrentAnimation] <> nil) then
- Result := FAnim[D_LEFT][FCurrentAnimation]
+ if (FDirection = TDirection.D_LEFT) and (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ Result := FAnim[TDirection.D_LEFT][FCurrentAnimation]
else
else
- Result := FAnim[D_RIGHT][FCurrentAnimation];
+ Result := FAnim[TDirection.D_RIGHT][FCurrentAnimation];
end;
function TPlayerModel.GetCurrentAnimationMask: TAnimation;
begin
end;
function TPlayerModel.GetCurrentAnimationMask: TAnimation;
begin
- if (FDirection = D_LEFT) and (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
- Result := FMaskAnim[D_LEFT][FCurrentAnimation]
+ if (FDirection = TDirection.D_LEFT) and (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ Result := FMaskAnim[TDirection.D_LEFT][FCurrentAnimation]
else
else
- Result := FMaskAnim[D_RIGHT][FCurrentAnimation];
+ Result := FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation];
end;
function TPlayerModel.PlaySound(SoundType, Level: Byte; X, Y: Integer): Boolean;
end;
function TPlayerModel.PlaySound(SoundType, Level: Byte; X, Y: Integer): Boolean;
begin
FFire := Fire;
begin
FFire := Fire;
- if FFire then FFireCounter := FAnim[D_RIGHT, A_ATTACK].Speed*FAnim[D_RIGHT, A_ATTACK].TotalFrames
+ if FFire then FFireCounter := FAnim[TDirection.D_RIGHT, A_ATTACK].Speed*FAnim[TDirection.D_RIGHT, A_ATTACK].TotalFrames
else FFireCounter := 0;
end;
else FFireCounter := 0;
end;
procedure TPlayerModel.Update();
begin
procedure TPlayerModel.Update();
begin
- if (FDirection = D_LEFT) and (FAnim[D_LEFT][FCurrentAnimation] <> nil) then
- FAnim[D_LEFT][FCurrentAnimation].Update else FAnim[D_RIGHT][FCurrentAnimation].Update;
+ if (FDirection = TDirection.D_LEFT) and (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Update else FAnim[TDirection.D_RIGHT][FCurrentAnimation].Update;
- if (FDirection = D_LEFT) and (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
- FMaskAnim[D_LEFT][FCurrentAnimation].Update else FMaskAnim[D_RIGHT][FCurrentAnimation].Update;
+ if (FDirection = TDirection.D_LEFT) and (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Update else FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Update;
if FFlagAnim <> nil then FFlagAnim.Update;
if FFlagAnim <> nil then FFlagAnim.Update;