X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_playermodel.pas;h=4f4d709182bb491668c4f29f5de076ca4e0867e4;hb=3c260c01df8bc70a362bb76fb7c7a32a14b43b31;hp=c2c7d4eb8557e2aadf0a8eee1c032b245baabcdd;hpb=abed90e42988669146ac1f2ecf2f9eef74f336c1;p=d2df-sdl.git diff --git a/src/game/g_playermodel.pas b/src/game/g_playermodel.pas index c2c7d4e..4f4d709 100644 --- a/src/game/g_playermodel.pas +++ b/src/game/g_playermodel.pas @@ -56,16 +56,18 @@ const 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_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; - TModelMatrix = Array [TDirection.D_LEFT..TDirection.D_RIGHT, A_STAND..A_LAST] of TAnimationState; + TModelMatrix = Array [TDirection.D_LEFT..TDirection.D_RIGHT, A_STAND..A_LAST] of TAnimState; TModelTextures = Array [TDirection.D_LEFT..TDirection.D_RIGHT, A_STAND..A_LAST] of record Resource: String; @@ -92,7 +94,7 @@ type FDirection: TDirection; FColor: TRGB; FCurrentAnimation: Byte; - FAnimState: TAnimationState; + FAnimState: TAnimState; FCurrentWeapon: Byte; FFlag: Byte; FFireCounter: Byte; @@ -122,7 +124,7 @@ type 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; @@ -668,12 +670,12 @@ end; once := FCurrentAnimation in [A_STAND, A_WALK]; speed := PlayerModelsArray[FID].ModelSpeed[FCurrentAnimation]; count := PlayerModelsArray[FID].Anim[FDirection, FCurrentAnimation].Frames; - FAnimState := TAnimationState.Create(once, speed, count); + FAnimState := TAnimState.Create(once, speed, count); end; destructor TPlayerModel.Destroy(); begin - FAnimState.Free; + FAnimState.Invalidate; inherited; end; @@ -774,7 +776,7 @@ end; procedure TPlayerModel.Update; begin - if FAnimState <> nil then + if FAnimState.IsValid() then FAnimState.Update; if FFireCounter > 0 then Dec(FFireCounter)