index c2c7d4eb8557e2aadf0a8eee1c032b245baabcdd..7a55bf758b8b9744c5a7883c43fbcb0659d23351 100644 (file)
interface
interface
- uses MAPDEF, g_textures, g_base, g_basic, g_weapons, utils;
+ uses MAPDEF, g_animations, g_base, g_basic, g_weapons, utils;
const
A_STAND = 0;
const
A_STAND = 0;
W_POS_NORMAL = 0;
W_POS_UP = 1;
W_POS_DOWN = 2;
W_POS_NORMAL = 0;
W_POS_UP = 1;
W_POS_DOWN = 2;
+ W_POS_LAST = W_POS_DOWN;
W_ACT_NORMAL = 0;
W_ACT_FIRE = 1;
W_ACT_NORMAL = 0;
W_ACT_FIRE = 1;
+ W_ACT_LAST = W_ACT_FIRE;
FLAG_BASEPOINT: TDFPoint = (X:16; Y:43);
type
TWeaponPoints = Array [WP_FIRST + 1..WP_LAST, A_STAND..A_LAST, TDirection.D_LEFT..TDirection.D_RIGHT] of Array of TDFPoint;
FLAG_BASEPOINT: TDFPoint = (X:16; Y:43);
type
TWeaponPoints = Array [WP_FIRST + 1..WP_LAST, A_STAND..A_LAST, TDirection.D_LEFT..TDirection.D_RIGHT] of Array of TDFPoint;
- TModelMatrix = Array [TDirection.D_LEFT..TDirection.D_RIGHT, A_STAND..A_LAST] of TAnimationState;
-
TModelTextures = Array [TDirection.D_LEFT..TDirection.D_RIGHT, A_STAND..A_LAST] of record
Resource: String;
Mask: String;
TModelTextures = Array [TDirection.D_LEFT..TDirection.D_RIGHT, A_STAND..A_LAST] of record
Resource: String;
Mask: String;
FDirection: TDirection;
FColor: TRGB;
FCurrentAnimation: Byte;
FDirection: TDirection;
FColor: TRGB;
FCurrentAnimation: Byte;
- FAnimState: TAnimationState;
+ FAnimState: TAnimState;
FCurrentWeapon: Byte;
FFlag: Byte;
FFireCounter: Byte;
FCurrentWeapon: Byte;
FFlag: Byte;
FFireCounter: Byte;
public
property Color: TRGB read FColor write FColor;
public
property Color: TRGB read FColor write FColor;
- property AnimState: TAnimationState read FAnimState;
+ property AnimState: TAnimState read FAnimState;
property CurrentAnimation: Byte read FCurrentAnimation;
property CurrentWeapon: Byte read FCurrentWeapon;
property Flag: Byte read FFlag;
property CurrentAnimation: Byte read FCurrentAnimation;
property CurrentWeapon: Byte read FCurrentWeapon;
property Flag: Byte read FFlag;
{ TPlayerModel }
procedure TPlayerModel.ChangeAnimation (Animation: Byte; Force: Boolean = False);
{ TPlayerModel }
procedure TPlayerModel.ChangeAnimation (Animation: Byte; Force: Boolean = False);
- var once: Boolean; speed, count: Integer;
+ var loop: Boolean; speed, count: Integer;
begin
if not Force then
if FCurrentAnimation = Animation then
Exit;
FCurrentAnimation := Animation;
begin
if not Force then
if FCurrentAnimation = Animation then
Exit;
FCurrentAnimation := Animation;
- once := FCurrentAnimation in [A_STAND, A_WALK];
+ loop := FCurrentAnimation in [A_STAND, A_WALK];
speed := PlayerModelsArray[FID].ModelSpeed[FCurrentAnimation];
count := PlayerModelsArray[FID].Anim[FDirection, FCurrentAnimation].Frames;
speed := PlayerModelsArray[FID].ModelSpeed[FCurrentAnimation];
count := PlayerModelsArray[FID].Anim[FDirection, FCurrentAnimation].Frames;
- FAnimState := TAnimationState.Create(once, speed, count);
+ FAnimState := TAnimState.Create(loop, speed, count);
end;
destructor TPlayerModel.Destroy();
begin
end;
destructor TPlayerModel.Destroy();
begin
- FAnimState.Free;
+ FAnimState.Invalidate;
inherited;
end;
inherited;
end;
procedure TPlayerModel.Update;
begin
procedure TPlayerModel.Update;
begin
- if FAnimState <> nil then
+ if FAnimState.IsValid() then
FAnimState.Update;
if FFireCounter > 0 then
Dec(FFireCounter)
FAnimState.Update;
if FFireCounter > 0 then
Dec(FFireCounter)