diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 98535cc9ef2f36220f98ba05b4cbb0a401598cac..932e081d6da0b56ef9dabac4c6e190b9ca2ceaa2 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
interface
uses
+ mempool,
e_graphics, g_playermodel, g_basic, g_textures,
g_weapons, g_phys, g_sound, g_saveload, MAPDEF,
BinEditor, g_panel;
Time: Word;
end;
- TPlayer = class (TObject)
+ TPlayer = class(TPoolObject)
private
FIamBot: Boolean;
FUID: Word;
FNoReload: Boolean;
FJustTeleported: Boolean;
FNetTime: LongWord;
-
- function CollideLevel(XInc, YInc: Integer): Boolean;
- function StayOnStep(XInc, YInc: Integer): Boolean;
- function HeadInLiquid(XInc, YInc: Integer): Boolean;
- function BodyInLiquid(XInc, YInc: Integer): Boolean;
- function BodyInAcid(XInc, YInc: Integer): Boolean;
- 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;
- function firediry(): Integer;
-
- procedure Run(Direction: TDirection);
- procedure NextWeapon();
- procedure PrevWeapon();
- procedure SeeUp();
- procedure SeeDown();
- procedure Fire();
- procedure Jump();
- procedure Use();
+ mEDamageType: Integer;
+
+
+ function CollideLevel(XInc, YInc: Integer): Boolean;
+ function StayOnStep(XInc, YInc: Integer): Boolean;
+ function HeadInLiquid(XInc, YInc: Integer): Boolean;
+ function BodyInLiquid(XInc, YInc: Integer): Boolean;
+ function BodyInAcid(XInc, YInc: Integer): Boolean;
+ 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;
+ function firediry(): Integer;
+
+ procedure Run(Direction: TDirection);
+ procedure NextWeapon();
+ procedure PrevWeapon();
+ procedure SeeUp();
+ procedure SeeDown();
+ procedure Fire();
+ procedure Jump();
+ procedure Use();
function getNextWeaponIndex (): Byte; // return 255 for "no switch"
procedure resetWeaponQueue ();
function hasAmmoForWeapon (weapon: Byte): Boolean;
+ procedure doDamage (v: Integer);
+
public
FDamageBuffer: Integer;
property Vel: TPoint2i read FObj.Vel;
property Obj: TObj read FObj;
- published
property Name: String read FName write FName;
property Model: TPlayerModel read FModel;
property Health: Integer read FHealth write FHealth;
property UID: Word read FUID write FUID;
property JustTeleported: Boolean read FJustTeleported write FJustTeleported;
property NetTime: LongWord read FNetTime write FNetTime;
+
+ published
+ property eName: String read FName write FName;
+ property eHealth: Integer read FHealth write FHealth;
+ property eLives: Byte read FLives write FLives;
+ property eArmor: Integer read FArmor write FArmor;
+ property eAir: Integer read FAir write FAir;
+ property eJetFuel: Integer read FJetFuel write FJetFuel;
+ property eFrags: Integer read FFrags write FFrags;
+ property eDeath: Integer read FDeath write FDeath;
+ property eKills: Integer read FKills write FKills;
+ property eCurrWeap: Byte read FCurrWeap write FCurrWeap;
+ property eMonsterKills: Integer read FMonsterKills write FMonsterKills;
+ property eSecrets: Integer read FSecrets write FSecrets;
+ property eGodMode: Boolean read FGodMode write FGodMode;
+ property eNoTarget: Boolean read FNoTarget write FNoTarget;
+ property eNoReload: Boolean read FNoReload write FNoReload;
+ property eAlive: Boolean read FAlive write FAlive;
+ property eFlag: Byte read FFlag;
+ property eTeam: Byte read FTeam write FTeam;
+ property eDirection: TDirection read FDirection;
+ property eGameX: Integer read FObj.X write FObj.X;
+ property eGameY: Integer read FObj.Y write FObj.Y;
+ property eGameVelX: Integer read FObj.Vel.X write FObj.Vel.X;
+ property eGameVelY: Integer read FObj.Vel.Y write FObj.Vel.Y;
+ property eGameAccelX: Integer read FObj.Accel.X write FObj.Accel.X;
+ property eGameAccelY: Integer read FObj.Accel.Y write FObj.Accel.Y;
+ property eIncCam: Integer read FIncCam write FIncCam;
+ property eUID: Word read FUID;
+ property eJustTeleported: Boolean read FJustTeleported;
+ property eNetTime: LongWord read FNetTime;
+
+ // set this before assigning something to `eDamage`
+ property eDamageType: Integer read mEDamageType write mEDamageType;
+ property eDamage: Integer write doDamage;
end;
TDifficult = record
Value: String;
end;
- TBot = class (TPlayer)
+ TBot = class(TPlayer)
private
FSelectedWeapon: Byte;
FTargetUID: Word;
procedure positionChanged (); inline; //WARNING! call this after entity position was changed, or coldet will not work right!
end;
- TCorpse = class (TObject)
+ TCorpse = class(TPoolObject)
private
FModelName: String;
FMess: Boolean;
viewPortY := 0;
viewPortW := 0;
viewPortH := 0;
+ mEDamageType := HIT_SOME;
FIamBot := False;
FDummy := False;
begin
end;
+procedure TPlayer.doDamage (v: Integer);
+begin
+ if (v <= 0) then exit;
+ if (v > 32767) then v := 32767;
+ Damage(v, 0, 0, 0, mEDamageType);
+end;
+
procedure TPlayer.Damage(value: Word; SpawnerUID: Word; vx, vy: Integer; t: Byte);
var
c: Word;
end;
function TPlayer.PickItem(ItemType: Byte; arespawn: Boolean; var remove: Boolean): Boolean;
+
+ function allowBerserkSwitching (): Boolean;
+ begin
+ if (FBFGFireCounter <> -1) then begin result := false; exit; end;
+ result := true;
+ if gBerserkAutoswitch then exit;
+ if not (gDebugMode or gCheats) then exit;
+ result := false;
+ end;
+
var
a: Boolean;
begin
if not (R_BERSERK in FRulez) then
begin
Include(FRulez, R_BERSERK);
- if gBerserkAutoswitch and (gDebugMode or gCheats) and (FBFGFireCounter = -1) then
+ if allowBerserkSwitching then
begin
FCurrWeap := WEAPON_KASTET;
resetWeaponQueue();