X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=b6a6bc16f507b818f7b7ffc6491cfff79b3adb1a;hb=6bf25c191cff05ba65bd1aaf28f63f105590a895;hp=d03247cdc5e4e3f2505078aa28ccd5f165f70f55;hpb=f0c98dc86657bdc08f6049872f12b554e1654fa4;p=d2df-sdl.git diff --git a/src/game/g_player.pas b/src/game/g_player.pas index d03247c..b6a6bc1 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -167,6 +167,8 @@ type FObj: TObj; FXTo, FYTo: Integer; FSpectatePlayer: Integer; + FFirePainTime: Integer; + FFireAttacker: Word; FSavedState: TPlayerSavedState; @@ -201,6 +203,7 @@ type function FullInLift(XInc, YInc: Integer): Integer; {procedure CollideItem();} procedure FlySmoke(Times: DWORD = 1); + procedure OnFireFlame(Times: DWORD = 1); function GetAmmoByWeapon(Weapon: Byte): Word; procedure SetAction(Action: Byte; Force: Boolean = False); procedure OnDamage(Angle: SmallInt); virtual; @@ -244,6 +247,7 @@ type FPing: Word; FLoss: Byte; FDummy: Boolean; + FFireTime: Integer; constructor Create(); virtual; destructor Destroy(); override; @@ -305,6 +309,7 @@ type procedure RealizeCurrentWeapon(); procedure JetpackOn; procedure JetpackOff; + procedure CatchFire(Attacker: Word); property Name: String read FName write FName; property Model: TPlayerModel read FModel; @@ -571,7 +576,7 @@ const // WEAPON_CHAINGUN, WEAPON_SHOTGUN1, WEAPON_SAW, // WEAPON_ROCKETLAUNCHER, WEAPON_PISTOL, WEAPON_KASTET); WEAPON_RELOAD: Array [WP_FIRST..WP_LAST] of Byte = - (5, 2, 6, 18, 36, 2, 12, 2, 14, 2, 0); + (5, 2, 6, 18, 36, 2, 12, 2, 14, 2, 2); PLAYER_SIGNATURE = $52594C50; // 'PLYR' CORPSE_SIGNATURE = $50524F43; // 'CORP' @@ -1987,6 +1992,9 @@ begin FLoss := 0; FSavedState.WaitRecall := False; FShellTimer := -1; + FFireTime := 0; + FFirePainTime := 0; + FFireAttacker := 0; FActualModelName := 'doomer'; @@ -2808,6 +2816,7 @@ begin WEAPON_FLAMETHROWER: if FAmmo[A_FUEL] > 0 then begin + g_Weapon_flame(wx, wy, xd, yd, FUID); FReloading[FCurrWeap] := WEAPON_RELOAD[FCurrWeap]; Dec(FAmmo[A_FUEL]); FFireAngle := FAngle; @@ -2873,6 +2882,14 @@ begin FJetSoundOff.PlayAt(FObj.X, FObj.Y); end; +procedure TPlayer.CatchFire(Attacker: Word); +begin + FFireTime := 100; + FFireAttacker := Attacker; + if g_Game_IsNet and g_Game_IsServer then + MH_SEND_PlayerStats(FUID); +end; + procedure TPlayer.Jump(); begin if gFly or FJetpack then @@ -3484,6 +3501,7 @@ begin IncMax(FHealth, 10, PLAYER_HP_SOFT); Result := True; remove := True; + FFireTime := 0; if gFlash = 2 then Inc(FPickup, 5); end; @@ -3493,6 +3511,7 @@ begin IncMax(FHealth, 25, PLAYER_HP_SOFT); Result := True; remove := True; + FFireTime := 0; if gFlash = 2 then Inc(FPickup, 5); end; @@ -3520,6 +3539,7 @@ begin IncMax(FHealth, 100, PLAYER_HP_LIMIT); Result := True; remove := True; + FFireTime := 0; if gFlash = 2 then Inc(FPickup, 5); end; @@ -3532,6 +3552,7 @@ begin FArmor := PLAYER_AP_LIMIT; Result := True; remove := True; + FFireTime := 0; if gFlash = 2 then Inc(FPickup, 5); end; @@ -3787,6 +3808,7 @@ begin FMegaRulez[MR_SUIT] := gTime+PLAYER_SUIT_TIME; Result := True; remove := True; + FFireTime := 0; if gFlash = 2 then Inc(FPickup, 5); end; @@ -3816,6 +3838,7 @@ begin FBerserk := gTime+30000; Result := True; remove := True; + FFireTime := 0; end; if FHealth < PLAYER_HP_SOFT then begin @@ -3823,6 +3846,7 @@ begin FBerserk := gTime+30000; Result := True; remove := True; + FFireTime := 0; end; end; @@ -3841,6 +3865,7 @@ begin IncMax(FHealth, 4, PLAYER_HP_LIMIT); Result := True; remove := True; + FFireTime := 0; if gFlash = 2 then Inc(FPickup, 5); end; @@ -4222,6 +4247,9 @@ begin FDamageBuffer := 0; FJetpack := False; FCanJetpack := False; + FFireTime := 0; + FFirePainTime := 0; + FFireAttacker := 0; // Àíèìàöèÿ âîçðîæäåíèÿ: if (not gLoadGameMode) and (not Silent) then @@ -4813,6 +4841,35 @@ begin end else if FAir < AIR_DEF then FAir := AIR_DEF; + if FFireTime > 0 then + begin + if BodyInLiquid(0, 0) then + begin + FFireTime := 0; + FFirePainTime := 0; + end + else if FMegaRulez[MR_SUIT] >= gTime then + begin + if FMegaRulez[MR_SUIT] = gTime then + FFireTime := 1; + FFirePainTime := 0; + end + else + begin + OnFireFlame(1); + if FFirePainTime <= 0 then + begin + if g_Game_IsServer then + Damage(5, FFireAttacker, 0, 0, HIT_FLAME); + FFirePainTime := 18; + end; + FFirePainTime := FFirePainTime - 1; + FFireTime := FFireTime - 1; + if (FFireTime = 0) and g_Game_IsNet and g_Game_IsServer then + MH_SEND_PlayerStats(FUID); + end; + end; + if FDamageBuffer > 0 then begin if FDamageBuffer >= 9 then @@ -5087,6 +5144,7 @@ begin WEAPON_FLAMETHROWER: begin + g_Weapon_flame(wx, wy, xd, yd, FUID, WID); FFireAngle := FAngle; f := True; end; @@ -5853,6 +5911,27 @@ begin end; end; +procedure TPlayer.OnFireFlame(Times: DWORD = 1); +var + id, i: DWORD; + Anim: TAnimation; +begin + if (Random(10) = 1) and (Times = 1) then + Exit; + + if g_Frames_Get(id, 'FRAMES_FLAME') then + begin + for i := 1 to Times do + begin + Anim := TAnimation.Create(id, False, 3); + Anim.Alpha := 0; + g_GFX_OnceAnim(Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(Anim.Width div 2), + Obj.Y+8+Random(8+Times*2), Anim, ONCEANIM_SMOKE); + Anim.Free(); + end; + end; +end; + procedure TPlayer.PauseSounds(Enable: Boolean); begin FSawSound.Pause(Enable); @@ -6145,7 +6224,7 @@ var firew, fireh: Integer; angle: SmallInt; mon: TMonster; - pla: TPlayer; + pla, tpla: TPlayer; vsPlayer, vsMonster, ok: Boolean; begin vsPlayer := LongBool(gGameSettings.Options and GAME_OPTION_BOTVSPLAYER); @@ -6179,14 +6258,16 @@ begin if (g_GetUIDType(Target.UID) = UID_PLAYER) and vsPlayer then begin // Èãðîê - with g_Player_Get(Target.UID) do - begin - if (@FObj) <> nil then + tpla := g_Player_Get(Target.UID); + if tpla <> nil then + with tpla do begin - Target.X := FObj.X; - Target.Y := FObj.Y; + if (@FObj) <> nil then + begin + Target.X := FObj.X; + Target.Y := FObj.Y; + end; end; - end; Target.cX := Target.X + PLAYER_RECT_CX; Target.cY := Target.Y + PLAYER_RECT_CY;