diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index d03247cdc5e4e3f2505078aa28ccd5f165f70f55..b25ef0c59112b5db47fa5258f3b799bb01615735 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
-{$MODE DELPHI}
+{$INCLUDE ../shared/a_modes.inc}
unit g_player;
interface
FObj: TObj;
FXTo, FYTo: Integer;
FSpectatePlayer: Integer;
+ FFirePainTime: Integer;
+ FFireAttacker: Word;
FSavedState: TPlayerSavedState;
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;
FPing: Word;
FLoss: Byte;
FDummy: Boolean;
+ FFireTime: Integer;
constructor Create(); virtual;
destructor Destroy(); override;
procedure RealizeCurrentWeapon();
procedure JetpackOn;
procedure JetpackOff;
+ procedure CatchFire(Attacker: Word);
property Name: String read FName write FName;
property Model: TPlayerModel read FModel;
// 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'
FLoss := 0;
FSavedState.WaitRecall := False;
FShellTimer := -1;
+ FFireTime := 0;
+ FFirePainTime := 0;
+ FFireAttacker := 0;
FActualModelName := 'doomer';
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;
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
begin
result := 255; // default result: "no switch"
// had weapon cycling on previous frame? remove that flag
- if (FNextWeap and $2000) <> 0 then begin FNextWeap := FNextWeap and $1FFF; FNextWeapDelay := 0; end;
+ if (FNextWeap and $2000) <> 0 then
+ begin
+ FNextWeap := FNextWeap and $1FFF;
+ FNextWeapDelay := 0;
+ end;
// cycling has priority
if (FNextWeap and $C000) <> 0 then
begin
- if (FNextWeap and $8000) <> 0 then dir := 1 else dir := -1;
+ if (FNextWeap and $8000) <> 0 then
+ dir := 1
+ else
+ dir := -1;
FNextWeap := FNextWeap or $2000; // we need this
- if FNextWeapDelay > 0 then exit; // cooldown time
+ if FNextWeapDelay > 0 then
+ exit; // cooldown time
cwi := FCurrWeap;
for i := 0 to High(FWeapon) do
begin
exit;
end;
// no cycling
- for i := 0 to High(wantThisWeapon) do wantThisWeapon[i] := false;
- for i := 0 to High(FWeapon) do if (FNextWeap and (1 shl i)) <> 0 then begin wantThisWeapon[i] := true; Inc(wwc); end;
+ for i := 0 to High(wantThisWeapon) do
+ wantThisWeapon[i] := false;
+ for i := 0 to High(FWeapon) do
+ if (FNextWeap and (1 shl i)) <> 0 then
+ begin
+ wantThisWeapon[i] := true;
+ Inc(wwc);
+ end;
// exclude currently selected weapon from the set
wantThisWeapon[FCurrWeap] := false;
// slow down alterations a little
begin
//e_WriteLog(Format(' FNextWeap=%x; delay=%d', [FNextWeap, FNextWeapDelay]), MSG_WARNING);
// more than one weapon requested, assume "alteration" and check alteration delay
- if FNextWeapDelay > 0 then begin FNextWeap := 0; exit; end; // yeah
+ if FNextWeapDelay > 0 then
+ begin
+ FNextWeap := 0;
+ exit;
+ end; // yeah
end;
// do not reset weapon queue, it will be done in `RealizeCurrentWeapon()`
// but clear all counters if no weapon should be switched
- if wwc < 1 then begin resetWeaponQueue(); exit; end;
+ if wwc < 1 then
+ begin
+ resetWeaponQueue();
+ exit;
+ end;
//e_WriteLog(Format('wwc=%d', [wwc]), MSG_WARNING);
// try weapons in descending order
for i := High(FWeapon) downto 0 do
IncMax(FHealth, 10, PLAYER_HP_SOFT);
Result := True;
remove := True;
+ FFireTime := 0;
if gFlash = 2 then Inc(FPickup, 5);
end;
IncMax(FHealth, 25, PLAYER_HP_SOFT);
Result := True;
remove := True;
+ FFireTime := 0;
if gFlash = 2 then Inc(FPickup, 5);
end;
IncMax(FHealth, 100, PLAYER_HP_LIMIT);
Result := True;
remove := True;
+ FFireTime := 0;
if gFlash = 2 then Inc(FPickup, 5);
end;
FArmor := PLAYER_AP_LIMIT;
Result := True;
remove := True;
+ FFireTime := 0;
if gFlash = 2 then Inc(FPickup, 5);
end;
FMegaRulez[MR_SUIT] := gTime+PLAYER_SUIT_TIME;
Result := True;
remove := True;
+ FFireTime := 0;
if gFlash = 2 then Inc(FPickup, 5);
end;
FBerserk := gTime+30000;
Result := True;
remove := True;
+ FFireTime := 0;
end;
if FHealth < PLAYER_HP_SOFT then
begin
FBerserk := gTime+30000;
Result := True;
remove := True;
+ FFireTime := 0;
end;
end;
IncMax(FHealth, 4, PLAYER_HP_LIMIT);
Result := True;
remove := True;
+ FFireTime := 0;
if gFlash = 2 then Inc(FPickup, 5);
end;
FDamageBuffer := 0;
FJetpack := False;
FCanJetpack := False;
+ FFireTime := 0;
+ FFirePainTime := 0;
+ FFireAttacker := 0;
// Àíèìàöèÿ âîçðîæäåíèÿ:
if (not gLoadGameMode) and (not Silent) then
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
WEAPON_FLAMETHROWER:
begin
+ g_Weapon_flame(wx, wy, xd, yd, FUID, WID);
FFireAngle := FAngle;
f := True;
end;
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);
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);
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;