X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=355ecf323985108f69d23d047c3a34399fb77dcc;hb=92c7868df227201d6914f9f07c9a29ba0e2863cb;hp=b03214f79289ddf17b1d59b3302ee25bdf56844c;hpb=8aa3b888af2fecd61de66106bc2b027fda93914d;p=d2df-sdl.git diff --git a/src/game/g_player.pas b/src/game/g_player.pas index b03214f..355ecf3 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -1,4 +1,4 @@ -(* Copyright (C) DooM 2D:Forever Developers +(* Copyright (C) Doom 2D: Forever Developers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -176,6 +176,7 @@ type FSavedState: TPlayerSavedState; FModel: TPlayerModel; + FPunchAnim: TAnimation; FActionPrior: Byte; FActionAnim: Byte; FActionForce: Boolean; @@ -213,6 +214,7 @@ type procedure SetAction(Action: Byte; Force: Boolean = False); procedure OnDamage(Angle: SmallInt); virtual; function firediry(): Integer; + procedure DoPunch(); procedure Run(Direction: TDirection); procedure NextWeapon(); @@ -586,10 +588,14 @@ procedure g_Bot_RemoveAll(); implementation uses +{$INCLUDE ../nogl/noGLuses.inc} +{$IFDEF ENABLE_HOLMES} + g_holmes, +{$ENDIF} e_log, g_map, g_items, g_console, g_gfx, Math, g_options, g_triggers, g_menu, g_game, g_grid, wadreader, g_main, g_monsters, CONFIG, g_language, - g_net, g_netmsg, g_window, GL, g_holmes, + g_net, g_netmsg, g_window, utils, xstreams; const PLR_SAVE_VERSION = 0; @@ -2246,6 +2252,8 @@ begin FJetSoundOn.Free(); FJetSoundOff.Free(); FModel.Free(); + if FPunchAnim <> nil then + FPunchAnim.Free(); inherited; end; @@ -2336,9 +2344,19 @@ var 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 @@ -2395,10 +2413,13 @@ procedure TPlayer.DrawAim(); var ex, ey: Integer; begin + +{$IFDEF ENABLE_HOLMES} if isValidViewPort and (self = gPlayer1) then begin g_Holmes_plrLaser(ax0, ay0, ax1, ay1); end; +{$ENDIF} e_DrawLine(sz, ax0, ay0, ax1, ay1, 255, 0, 0, 96); if (g_Map_traceToNearestWall(ax0, ay0, ax1, ay1, @ex, @ey) <> nil) then @@ -2773,6 +2794,17 @@ 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; @@ -2816,6 +2848,8 @@ 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 @@ -4310,6 +4344,12 @@ var Anim: TAnimation; ID: DWORD; begin + FIncCam := 0; + FBFGFireCounter := -1; + FShellTimer := -1; + FPain := 0; + FLastHit := 0; + if not g_Game_IsServer then Exit; if FDummy then @@ -4414,12 +4454,6 @@ begin else FAngle := 0; - FIncCam := 0; - FBFGFireCounter := -1; - FShellTimer := -1; - FPain := 0; - FLastHit := 0; - SetAction(A_STAND, True); FModel.Direction := FDirection; @@ -4452,6 +4486,11 @@ begin FSpectatePlayer := -1; FSpawned := True; + if (gPlayer1 = nil) and (gLMSPID1 = FUID) then + gPlayer1 := self; + if (gPlayer2 = nil) and (gLMSPID2 = FUID) then + gPlayer2 := self; + if g_Game_IsNet then begin MH_SEND_PlayerPos(True, FUID, NET_EVERYONE); @@ -4743,6 +4782,9 @@ begin FLoss := 0; end; + if FAlive and (FPunchAnim <> nil) then + FPunchAnim.Update(); + if FAlive and (gFly or FJetpack) then FlySmoke(); @@ -5268,6 +5310,8 @@ 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