summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7a30bc0)
raw | patch | inline | side by side (parent: 7a30bc0)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 16 Jan 2022 19:28:16 +0000 (22:28 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 16 Jan 2022 19:28:16 +0000 (22:28 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history | |
src/game/opengl/r_player.pas | patch | blob | history | |
src/game/opengl/r_render.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 48b713c6a645f0a2fd997e839636f9bfcbf933ba..539cf2c25f46a691ce730a68d9ffa80edd4f7a6b 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
end;
end;
- g_Frames_CreateWAD(nil, 'FRAMES_PUNCH', GameWAD+':WEAPONS\PUNCH', 64, 64, 4, False);
- g_Frames_CreateWAD(nil, 'FRAMES_PUNCH_UP', GameWAD+':WEAPONS\PUNCH_UP', 64, 64, 4, False);
- g_Frames_CreateWAD(nil, 'FRAMES_PUNCH_DN', GameWAD+':WEAPONS\PUNCH_DN', 64, 64, 4, False);
- g_Frames_CreateWAD(nil, 'FRAMES_PUNCH_BERSERK', GameWAD+':WEAPONS\PUNCHB', 64, 64, 4, False);
- g_Frames_CreateWAD(nil, 'FRAMES_PUNCH_BERSERK_UP', GameWAD+':WEAPONS\PUNCHB_UP', 64, 64, 4, False);
- g_Frames_CreateWAD(nil, 'FRAMES_PUNCH_BERSERK_DN', GameWAD+':WEAPONS\PUNCHB_DN', 64, 64, 4, False);
g_Sound_CreateWADEx('SOUND_GAME_TELEPORT', GameWAD+':SOUNDS\TELEPORT');
g_Sound_CreateWADEx('SOUND_GAME_NOTELEPORT', GameWAD+':SOUNDS\NOTELEPORT');
g_Sound_CreateWADEx('SOUND_GAME_SECRET', GameWAD+':SOUNDS\SECRET');
g_Texture_Delete('TEXTURE_PLAYER_BLUEFLAG_D');
g_Texture_Delete('TEXTURE_PLAYER_TALKBUBBLE');
g_Texture_Delete('TEXTURE_PLAYER_INVULPENTA');
- g_Frames_DeleteByName('FRAMES_PUNCH');
- g_Frames_DeleteByName('FRAMES_PUNCH_UP');
- g_Frames_DeleteByName('FRAMES_PUNCH_DN');
- g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK');
- g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_UP');
- g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_DN');
g_Sound_Delete('SOUND_GAME_TELEPORT');
g_Sound_Delete('SOUND_GAME_NOTELEPORT');
g_Sound_Delete('SOUND_GAME_SECRET');
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 7c73eb7e5754a68adf1831829d273a22c7b04fba..5478180bf23ed93ddf84d425087edbd16e20f605 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
FSavedStateNum: Integer;
FModel: TPlayerModel;
- FPunchAnim: TAnimation;
+ FPunchAnim: TAnimationState;
FActionPrior: Byte;
FActionAnim: Byte;
FActionForce: Boolean;
property Berserk: Integer read FBerserk;
property Pain: Integer read FPain;
property Pickup: Integer read FPickup;
- property PunchAnim: TAnimation read FPunchAnim write FPunchAnim;
+ property PunchAnim: TAnimationState read FPunchAnim write FPunchAnim;
property SpawnInvul: Integer read FSpawnInvul;
property Ghost: Boolean read FGhost;
FNetTime := 0;
FWaitForFirstSpawn := false;
+ FPunchAnim := TAnimationState.Create(False, 1, 4);
+ FPunchAnim.Disable;
resetWeaponQueue();
end;
FJetSoundOn.Free();
FJetSoundOff.Free();
FModel.Free();
- if FPunchAnim <> nil then
- FPunchAnim.Free();
+ FPunchAnim.Free();
inherited;
end;
procedure TPlayer.DoPunch();
-var
- id: DWORD;
- st: String;
begin
- if FPunchAnim <> nil then begin
- FPunchAnim.reset();
- FPunchAnim.Free;
- FPunchAnim := nil;
- end;
- st := 'FRAMES_PUNCH';
- if R_BERSERK in FRulez then
- st := st + '_BERSERK';
- if FKeys[KEY_UP].Pressed then
- st := st + '_UP'
- else if FKeys[KEY_DOWN].Pressed then
- st := st + '_DN';
- g_Frames_Get(id, st);
- FPunchAnim := TAnimation.Create(id, False, 1);
+ FPunchAnim.Reset;
+ FPunchAnim.Enable;
end;
procedure TPlayer.Fire();
FLoss := 0;
end;
- if FAlive and (FPunchAnim <> nil) then
- FPunchAnim.Update();
+ if FAlive then
+ FPunchAnim.Update;
+ if FPunchAnim.played then
+ FPunchAnim.Disable;
if FAlive and (gFly or FJetpack) then
FlySmoke();
index 28eaf3d8af3810ce0d6961110b4fe87d2e9aae6c..8b25eb491187301e6dd06a2972bb58a39b0cb9bc 100644 (file)
uses g_player, g_base; // TPlayer, TRGB
+ procedure r_Player_Load;
+ procedure r_Player_Free;
+
procedure r_Player_DrawAll;
procedure r_Player_DrawDebug (p: TPlayer);
procedure r_Player_DrawHealth;
r_playermodel, r_graphics, r_animations, r_textures, r_items
;
+ var
+ PunchFrames: array [Boolean, 0..2] of DWORD;
+
+ procedure r_Player_Load;
+ begin
+ g_Frames_CreateWAD(@PunchFrames[False, 0], 'FRAMES_PUNCH', GameWAD + ':WEAPONS\PUNCH', 64, 64, 4, False);
+ g_Frames_CreateWAD(@PunchFrames[False, 1], 'FRAMES_PUNCH_UP', GameWAD + ':WEAPONS\PUNCH_UP', 64, 64, 4, False);
+ g_Frames_CreateWAD(@PunchFrames[False, 2], 'FRAMES_PUNCH_DN', GameWAD + ':WEAPONS\PUNCH_DN', 64, 64, 4, False);
+ g_Frames_CreateWAD(@PunchFrames[True, 0], 'FRAMES_PUNCH_BERSERK', GameWAD + ':WEAPONS\PUNCHB', 64, 64, 4, False);
+ g_Frames_CreateWAD(@PunchFrames[True, 1], 'FRAMES_PUNCH_BERSERK_UP', GameWAD + ':WEAPONS\PUNCHB_UP', 64, 64, 4, False);
+ g_Frames_CreateWAD(@PunchFrames[True, 2], 'FRAMES_PUNCH_BERSERK_DN', GameWAD + ':WEAPONS\PUNCHB_DN', 64, 64, 4, False);
+ end;
+
+ procedure r_Player_Free;
+ begin
+ g_Frames_DeleteByName('FRAMES_PUNCH');
+ g_Frames_DeleteByName('FRAMES_PUNCH_UP');
+ g_Frames_DeleteByName('FRAMES_PUNCH_DN');
+ g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK');
+ g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_UP');
+ g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_DN');
+ end;
+
procedure r_Player_DrawAll;
var i: Integer;
begin
else
Mirror := TMirrorType.Horizontal;
- if p.PunchAnim <> nil then
+ if p.PunchAnim.enabled then
begin
- r_Animation_Draw(p.PunchAnim, fX + IfThen(p.Direction = TDirection.D_LEFT, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15), fY + fSlope + p.Obj.Rect.Y - 11, Mirror);
- if p.PunchAnim.played then
- begin
- p.PunchAnim.Free;
- p.PunchAnim := nil;
- end;
+ if p.FKeys[KEY_DOWN].Pressed then ID := PunchFrames[R_BERSERK in p.FRulez, 2]
+ else if p.FKeys[KEY_UP].Pressed then ID := PunchFrames[R_BERSERK in p.FRulez, 1]
+ else ID := PunchFrames[R_BERSERK in p.FRulez, 0];
+ r_AnimationState_Draw(ID, p.PunchAnim, fX + IfThen(p.Direction = TDirection.D_LEFT, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15), fY + fSlope + p.Obj.Rect.Y - 11, Mirror);
end;
if (p.FMegaRulez[MR_INVUL] > gTime) and ((gPlayerDrawn <> p) or (p.SpawnInvul >= gTime)) then
index 50e5892e9ee0366ce0f9359cafd67f66e4b408be..b6bb016f74410f1cf5dd53fa0e57c355ccd35720 100644 (file)
e_log, g_system,
g_game, g_options, g_console,
r_window, r_graphics, r_console, r_playermodel,
- r_weapons, r_items, r_gfx, r_monsters, r_map
+ r_weapons, r_items, r_gfx, r_monsters, r_map, r_player
;
var
procedure r_Render_Load;
begin
+ r_Player_Load;
r_Map_Load;
r_PlayerModel_Load;
r_Monsters_Load;
r_Monsters_Free;
r_PlayerModel_Free;
r_Map_Free;
+ r_Player_Free;
end;
procedure r_Render_Initialize;