X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=0522063cc24e07670a0c095dc391e2fadc56b3b8;hb=385f70688f69aba255d1cdb9b7f0717bfe1b6945;hp=ffb5ce93e6aa5eb070dce8dfe2b5aa5c1735d484;hpb=563e770b462d67b2c8265b0e2b53384152afb7c1;p=d2df-sdl.git diff --git a/src/game/g_player.pas b/src/game/g_player.pas index ffb5ce9..0522063 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -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,15 @@ procedure g_Bot_RemoveAll(); implementation uses +{$IFDEF USE_NANOGL} + nanoGL, +{$ELSE} + GL, +{$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, g_holmes, utils, xstreams; const PLR_SAVE_VERSION = 0; @@ -2246,6 +2253,8 @@ begin FJetSoundOn.Free(); FJetSoundOff.Free(); FModel.Free(); + if FPunchAnim <> nil then + FPunchAnim.Free(); inherited; end; @@ -2336,9 +2345,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 @@ -2773,6 +2792,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 +2846,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 @@ -4452,6 +4484,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 +4780,9 @@ begin FLoss := 0; end; + if FAlive and (FPunchAnim <> nil) then + FPunchAnim.Update(); + if FAlive and (gFly or FJetpack) then FlySmoke(); @@ -5268,6 +5308,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