From: DeaDDooMER Date: Sun, 16 Jan 2022 17:22:21 +0000 (+0300) Subject: models: remove superfluous fire state X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=e2092b6a8f882af3489f48a662c81b56129f5fb0;p=d2df-sdl.git models: remove superfluous fire state --- diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 968c974..9552d30 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -4752,7 +4752,7 @@ begin if (FModel.AnimState.Played or ((not FActionChanged) and (FModel.Animation = A_WALK))) then SetAction(A_STAND, True); - if not ((FModel.Animation = A_WALK) and (Abs(FObj.Vel.X) < 4) and not FModel.Fire) then FModel.Update; + if not ((FModel.Animation = A_WALK) and (Abs(FObj.Vel.X) < 4) and not FModel.GetFire()) then FModel.Update; for b := Low(FKeys) to High(FKeys) do if FKeys[b].Time = 0 then FKeys[b].Pressed := False else Dec(FKeys[b].Time); diff --git a/src/game/g_playermodel.pas b/src/game/g_playermodel.pas index 34fc9e7..393e07d 100644 --- a/src/game/g_playermodel.pas +++ b/src/game/g_playermodel.pas @@ -110,7 +110,6 @@ type FAnimState: TAnimationState; FCurrentWeapon: Byte; FFlag: Byte; - FFire: Boolean; FFireCounter: Byte; FID: Integer; @@ -120,7 +119,8 @@ type procedure SetColor(Red, Green, Blue: Byte); procedure SetWeapon(Weapon: Byte); procedure SetFlag(Flag: Byte); - procedure SetFire(Fire: Boolean); + procedure SetFire (Fire: Boolean); + function GetFire (): Boolean; function PlaySound(SoundType, Level: Byte; X, Y: Integer): Boolean; procedure Update(); @@ -128,7 +128,6 @@ type function GetName (): String; published - property Fire: Boolean read FFire; property Direction: TDirection read FDirection write FDirection; property Animation: Byte read FCurrentAnimation; property Weapon: Byte read FCurrentWeapon; @@ -876,14 +875,18 @@ begin FColor.B := Blue; end; -procedure TPlayerModel.SetFire(Fire: Boolean); -begin - FFire := Fire; - if FFire then - FFireCounter := PlayerModelsArray[FID].ModelSpeed[A_ATTACK] * PlayerModelsArray[FID].Anim[TDirection.D_RIGHT, A_ATTACK].Frames - else - FFireCounter := 0 -end; + procedure TPlayerModel.SetFire (Fire: Boolean); + begin + if Fire then + FFireCounter := PlayerModelsArray[FID].ModelSpeed[A_ATTACK] * PlayerModelsArray[FID].Anim[TDirection.D_RIGHT, A_ATTACK].Frames + else + FFireCounter := 0 + end; + + function TPlayerModel.GetFire (): Boolean; + begin + Result := FFireCounter > 0 + end; procedure TPlayerModel.SetFlag (Flag: Byte); begin @@ -911,8 +914,6 @@ end; FAnimState.Update; if FFireCounter > 0 then Dec(FFireCounter) - else - FFire := False end; procedure g_PlayerModel_LoadAll; diff --git a/src/game/opengl/r_playermodel.pas b/src/game/opengl/r_playermodel.pas index b90ed05..0914bd0 100644 --- a/src/game/opengl/r_playermodel.pas +++ b/src/game/opengl/r_playermodel.pas @@ -242,7 +242,7 @@ begin else pos := W_POS_NORMAL; - if (pm.CurrentAnimation in [A_ATTACK, A_ATTACKUP, A_ATTACKDOWN]) or pm.Fire then + if (pm.CurrentAnimation in [A_ATTACK, A_ATTACKUP, A_ATTACKDOWN]) or pm.GetFire() then act := W_ACT_FIRE else act := W_ACT_NORMAL;