summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 38f37ff)
raw | patch | inline | side by side (parent: 38f37ff)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 13 Jun 2022 18:18:27 +0000 (21:18 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 08:53:06 +0000 (11:53 +0300) |
src/game/g_player.pas | patch | blob | history | |
src/game/renders/opengl/r_map.pas | patch | blob | history |
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index b3c8fecedec8c6e6a3e08f3e57fe83dea84837eb..75d1f403075ba293b9e629c0697b097285ff3805 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
uses
SysUtils, Classes,
{$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
- g_base, g_playermodel, g_basic, g_animations,
+ g_base, g_playermodel, g_basic,
g_weapons, g_phys, g_sound, g_saveload, MAPDEF,
g_panel;
FSavedStateNum: Integer;
FModel: TPlayerModel;
- FPunchAnim: TAnimState;
+ FPunchTime: LongWord;
FActionPrior: Byte;
FActionAnim: Byte;
FActionForce: Boolean;
property Berserk: Integer read FBerserk;
property Pain: Integer read FPain;
property Pickup: Integer read FPickup;
- property PunchAnim: TAnimState read FPunchAnim write FPunchAnim;
+ property PunchTime: LongWord read FPunchTime;
property SpawnInvul: Integer read FSpawnInvul;
property Ghost: Boolean read FGhost;
FNetTime := 0;
FWaitForFirstSpawn := false;
- FPunchAnim := TAnimState.Create(False, 1, 4);
- FPunchAnim.Disable;
+ FPunchTime := 0;
resetWeaponQueue();
end;
FJetSoundOn.Free();
FJetSoundOff.Free();
FModel.Free();
- FPunchAnim.Invalidate;
+ FPunchTime := 0;
inherited;
end;
procedure TPlayer.DoPunch();
begin
- FPunchAnim.Reset;
- FPunchAnim.Enable;
+ FPunchTime := gTime;
end;
procedure TPlayer.Fire();
FLoss := 0;
end;
- if FAlive then
- FPunchAnim.Update;
- if FPunchAnim.played then
- FPunchAnim.Disable;
-
if FAlive and (gFly or FJetpack) then
FlySmoke();
index 07028727cabe135dfabf24efd119bad1868fe4bc..f9ac5dc08648eb151615af14be70b31991d30058 100644 (file)
implementation
uses
- Math,
+ Math, SysUtils,
{$IFDEF USE_GLES1}
GLES11,
{$ELSE}
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
- r_textures, r_draw
+ r_textures, r_draw, r_common
;
const
);
{$ENDIF}
+ PunchAnim: TAnimInfo = (loop: false; delay: 1; frames: 4; back: false);
FlagAnim: TAnimInfo = (loop: true; delay: 8; frames: 5; back: false);
type
for b := false to true do
begin
for i := 0 to 2 do
- PunchTextures[b, i] := r_Textures_LoadMultiFromFileAndInfo(GameWad + ':WEAPONS/' + PunchName[b] + WeapPos[i], 64, 64, 4, false);
+ PunchTextures[b, i] := r_Textures_LoadMultiFromFileAndInfo(GameWad + ':WEAPONS/' + PunchName[b] + WeapPos[i], 64, 64, PunchAnim.frames, PunchAnim.back);
end;
// --------- other --------- //
InvulPenta := r_Textures_LoadFromFile(GameWad + ':TEXTURES/PENTA');
end;
procedure r_Map_DrawPlayer (p, drawed: TPlayer);
- var fX, fY, fSlope, ax, ay, w, h: Integer; b, flip: Boolean; t: TGLMultiTexture; alpha: Byte;
+ var fX, fY, fSlope, ax, ay, w, h: Integer; b, flip: Boolean; t: TGLMultiTexture; tex: TGLTexture; alpha: Byte; count, frame: LongInt;
begin
if p.alive then
begin
fSlope := nlerp(p.SlopeOld, p.obj.slopeUpLeft, gLerpFactor);
(* punch effect *)
- if p.PunchAnim.IsValid() and p.PunchAnim.enabled then
+ if p.PunchTime <= gTime then
begin
- b := R_BERSERK in p.FRulez;
- if p.FKeys[KEY_DOWN].pressed then
- t := PunchTextures[b, 2]
- else if p.FKeys[KEY_UP].pressed then
- t := PunchTextures[b, 1]
- else
- t := PunchTextures[b, 0];
- if t <> nil then
+ g_Anim_GetFrameByTime(PunchAnim, (gTime - p.PunchTime) DIV GAME_TICK, count, frame);
+ if count < 1 then
begin
- flip := p.Direction = TDirection.D_LEFT;
- ax := IfThen(flip, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15); // ???
- ay := p.Obj.Rect.Y - 11;
- r_Draw_MultiTextureRepeat(t, p.PunchAnim, fx + ax, fy + fSlope + ay, t.width, t.height, flip, 255, 255, 255, 255, false)
+ b := R_BERSERK in p.FRulez;
+ if p.FKeys[KEY_DOWN].pressed then
+ t := PunchTextures[b, 2]
+ else if p.FKeys[KEY_UP].pressed then
+ t := PunchTextures[b, 1]
+ else
+ t := PunchTextures[b, 0];
+ if t <> nil then
+ begin
+ flip := p.Direction = TDirection.D_LEFT;
+ ax := IfThen(flip, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15); // ???
+ ay := p.Obj.Rect.Y - 11;
+ tex := t.GetTexture(frame);
+ r_Draw_TextureRepeat(tex, fx + ax, fy + fSlope + ay, tex.width, tex.height, flip, 255, 255, 255, 255, false)
+ end;
end;
end;