X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=932e081d6da0b56ef9dabac4c6e190b9ca2ceaa2;hb=31d174a428ef1235e1708b0738804b47e006cf5c;hp=300979a87de4011a595a4d59af4704d9132f74a3;hpb=ac11c0bdc792cb54cc54da011f80ecb0ae09392c;p=d2df-sdl.git diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 300979a..932e081 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -20,6 +20,7 @@ unit g_player; interface uses + mempool, e_graphics, g_playermodel, g_basic, g_textures, g_weapons, g_phys, g_sound, g_saveload, MAPDEF, BinEditor, g_panel; @@ -133,7 +134,7 @@ type Time: Word; end; - TPlayer = class (TObject) + TPlayer = class(TPoolObject) private FIamBot: Boolean; FUID: Word; @@ -195,34 +196,38 @@ type 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; @@ -327,7 +332,6 @@ type 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; @@ -358,6 +362,41 @@ type 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 @@ -377,7 +416,7 @@ type Value: String; end; - TBot = class (TPlayer) + TBot = class(TPlayer) private FSelectedWeapon: Byte; FTargetUID: Word; @@ -446,7 +485,7 @@ type 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; @@ -2056,6 +2095,7 @@ begin viewPortY := 0; viewPortW := 0; viewPortH := 0; + mEDamageType := HIT_SOME; FIamBot := False; FDummy := False; @@ -2103,6 +2143,13 @@ procedure TPlayer.positionChanged (); inline; 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; @@ -3638,6 +3685,16 @@ begin 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 @@ -3980,7 +4037,7 @@ begin if not (R_BERSERK in FRulez) then begin Include(FRulez, R_BERSERK); - if gBerserkAutoswitch and (FBFGFireCounter = -1) then + if allowBerserkSwitching then begin FCurrWeap := WEAPON_KASTET; resetWeaponQueue(); @@ -7614,4 +7671,7 @@ begin FDifficult := TDifficult(p^); end; + +begin + conRegVar('cheat_berserk_autoswitch', @gBerserkAutoswitch, 'autoswitch to fist when berserk pack taken', '', true, true); end.