summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d63f1f5)
raw | patch | inline | side by side (parent: d63f1f5)
author | Stas'M <x86corez@gmail.com> | |
Sun, 21 Jan 2018 13:11:56 +0000 (16:11 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Sun, 21 Jan 2018 13:19:30 +0000 (16:19 +0300) |
http://doom2d.org/forum/viewtopic.php?f=12&t=2562
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 6cbd3e4eddfab3d676657a20e6e71619ce551f12..29348b28c45600e074df7fe18b3dced0bbaa2b61 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
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_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');
g_Texture_Delete('TEXTURE_PLAYER_TALKBUBBLE');
g_Texture_Delete('TEXTURE_PLAYER_INVULPENTA');
g_Frames_DeleteByName('FRAMES_TELEPORT');
+ g_Frames_DeleteByName('FRAMES_PUNCH');
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 ffb5ce93e6aa5eb070dce8dfe2b5aa5c1735d484..a088f2851d2b03c2c3e702f2b83feeb0d6e99cd1 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
FSavedState: TPlayerSavedState;
FModel: TPlayerModel;
+ FPunchAnim: TAnimation;
FActionPrior: Byte;
FActionAnim: Byte;
FActionForce: Boolean;
procedure SetAction(Action: Byte; Force: Boolean = False);
procedure OnDamage(Angle: SmallInt); virtual;
function firediry(): Integer;
+ procedure DoPunch();
procedure Run(Direction: TDirection);
procedure NextWeapon();
FJetSoundOn.Free();
FJetSoundOff.Free();
FModel.Free();
+ if FPunchAnim <> nil then
+ FPunchAnim.Free();
inherited;
end;
ID: DWORD;
w, h: Word;
dr: Boolean;
+ Mirror: TMirrorType;
begin
if FAlive then
begin
+ if Direction = TDirection.D_RIGHT then
+ Mirror := TMirrorType.None
+ else
+ Mirror := TMirrorType.Horizontal;
+
+ if FPunchAnim <> nil then
+ 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 (FMegaRulez[MR_INVUL] > gTime) and (gPlayerDrawn <> Self) then
if g_Texture_Get('TEXTURE_PLAYER_INVULPENTA', ID) then
begin
e_DrawFillQuad(0, 0, gPlayerScreenSize.X-1, gPlayerScreenSize.Y-1, 150, 200, 150, 255-h*50);
end;
+procedure TPlayer.DoPunch();
+var
+ id: DWORD;
+begin
+ if FPunchAnim = nil then begin
+ g_Frames_Get(id, 'FRAMES_PUNCH');
+ FPunchAnim := TAnimation.Create(id, False, 1);
+ end else
+ FPunchAnim.reset();
+end;
+
procedure TPlayer.Fire();
var
f, DidFire: Boolean;
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
FLoss := 0;
end;
+ if FAlive and (FPunchAnim <> nil) then
+ FPunchAnim.Update();
+
if FAlive and (gFly or FJetpack) then
FlySmoke();
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