From: Stas'M Date: Wed, 12 Sep 2018 20:32:12 +0000 (+0300) Subject: Player: Always display punch animation X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=4df4eb483aa0a0abd74164d7f49c173743f6c84b;p=d2df-sdl.git Player: Always display punch animation Plus add separate animation for berserk --- diff --git a/src/game/g_game.pas b/src/game/g_game.pas index fec21e4..c38572b 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -2310,7 +2310,12 @@ begin end; g_Frames_CreateWAD(nil, 'FRAMES_TELEPORT', GameWAD+':TEXTURES\TELEPORT', 64, 64, 10, False); - g_Frames_CreateWAD(nil, 'FRAMES_PUNCH', GameWAD+':TEXTURES\PUNCH', 64, 64, 4, False); + 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_DOOROPEN', GameWAD+':SOUNDS\DOOROPEN'); @@ -2388,6 +2393,11 @@ begin g_Texture_Delete('TEXTURE_PLAYER_INVULPENTA'); g_Frames_DeleteByName('FRAMES_TELEPORT'); 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_DOOROPEN'); diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 355ecf3..736d22e 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -2354,8 +2354,15 @@ begin Mirror := TMirrorType.Horizontal; if FPunchAnim <> nil then + begin FPunchAnim.Draw(FObj.X+IfThen(Direction = TDirection.D_LEFT, 15-FObj.Rect.X, FObj.Rect.X-15), FObj.Y+FObj.Rect.Y-11, Mirror); + if FPunchAnim.played then + begin + FPunchAnim.Free; + FPunchAnim := nil; + end; + end; if (FMegaRulez[MR_INVUL] > gTime) and (gPlayerDrawn <> Self) then if g_Texture_Get('TEXTURE_PLAYER_INVULPENTA', ID) then @@ -2797,12 +2804,22 @@ end; procedure TPlayer.DoPunch(); var id: DWORD; + st: String; begin - if FPunchAnim = nil then begin - g_Frames_Get(id, 'FRAMES_PUNCH'); - FPunchAnim := TAnimation.Create(id, False, 1); - end else + 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); end; procedure TPlayer.Fire(); @@ -2834,6 +2851,7 @@ begin case FCurrWeap of WEAPON_KASTET: begin + DoPunch(); if R_BERSERK in FRulez then begin //g_Weapon_punch(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y, 75, FUID); @@ -2848,8 +2866,6 @@ begin locobj.Accel.X := xd-wx; locobj.Accel.y := yd-wy; - DoPunch(); - if g_Weapon_Hit(@locobj, 50, FUID, HIT_SOME) <> 0 then g_Sound_PlayExAt('SOUND_WEAPON_HITBERSERK', FObj.X, FObj.Y) else @@ -5296,6 +5312,7 @@ begin case FCurrWeap of WEAPON_KASTET: begin + DoPunch(); if R_BERSERK in FRulez then begin //g_Weapon_punch(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y, 75, FUID); @@ -5310,8 +5327,6 @@ begin locobj.Accel.X := xd-wx; locobj.Accel.y := yd-wy; - DoPunch(); - if g_Weapon_Hit(@locobj, 50, FUID, HIT_SOME) <> 0 then g_Sound_PlayExAt('SOUND_WEAPON_HITBERSERK', FObj.X, FObj.Y) else