summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bacfe44)
raw | patch | inline | side by side (parent: bacfe44)
author | TerminalHash <lyashuk.voxx@gmail.com> | |
Mon, 7 Jun 2021 18:36:38 +0000 (21:36 +0300) | ||
committer | TerminalHash <lyashuk.voxx@gmail.com> | |
Mon, 7 Jun 2021 18:36:38 +0000 (21:36 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_game.pas | patch | blob | history | |
src/game/g_weapons.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index a6fa9c42e78673a7434f7cf500d22a601a5a5ee0..15497d913a59a0beb136e3909bd3a64e930d9d39 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('g_friendlyfire', GameCVars);
AddCommand('g_friendly_hit_trace', GameCVars);
AddCommand('g_friendly_hit_projectile', GameCVars);
+ AddCommand('g_friendly_absorb_damage', GameCVars);
AddCommand('g_weaponstay', GameCVars);
AddCommand('g_allow_exit', GameCVars);
AddCommand('g_dm_keys', GameCVars);
WhitelistCommand('g_friendlyfire');
WhitelistCommand('g_friendly_hit_trace');
WhitelistCommand('g_friendly_hit_projectile');
+ WhitelistCommand('g_friendly_absorb_damage');
WhitelistCommand('g_weaponstay');
WhitelistCommand('g_allow_exit');
WhitelistCommand('g_dm_keys');
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 8271428fc1389de5deabaedb962b6742e64dd8ee..fefa3c02080d73ec8e361df0b58be05380fcdae6 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
GAME_OPTION_DMKEYS = 128;
GAME_OPTION_TEAMHITTRACE = 256;
GAME_OPTION_TEAMHITPROJECTILE = 512;
+ GAME_OPTION_TEAMABSORBDAMAGE = 1024;
STATE_NONE = 0;
STATE_MENU = 1;
begin
ParseGameFlag(GAME_OPTION_TEAMDAMAGE, I_MSG_FRIENDLY_FIRE_OFF, I_MSG_FRIENDLY_FIRE_ON);
end
+ else if cmd = 'g_friendly_absorb_damage' then
+ begin
+ ParseGameFlag(GAME_OPTION_TEAMABSORBDAMAGE, I_MSG_FRIENDLY_FIRE_OFF, I_MSG_FRIENDLY_FIRE_ON);
+ end
else if cmd = 'g_friendly_hit_trace' then
begin
ParseGameFlag(GAME_OPTION_TEAMHITTRACE, I_MSG_FRIENDLY_FIRE_OFF, I_MSG_FRIENDLY_FIRE_ON);
diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index 4f91b9fc7acc5c5e16e6a9138ac777793a97b471..1dd468824ba1b023ad7e514c86ac166654a45a9f 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
function g_Weapon_HitUID(UID: Word; d: Integer; SpawnerUID: Word; t: Byte): Boolean;
function g_Weapon_CreateShot(I: Integer; ShotType: Byte; Spawner, TargetUID: Word; X, Y, XV, YV: Integer): LongWord;
-procedure g_Weapon_gun(const x, y, xd, yd, v, dmg: Integer; SpawnerUID: Word; CheckTrigger: Boolean);
+procedure g_Weapon_gun(const x, y, xd, yd, v, indmg: Integer; SpawnerUID: Word; CheckTrigger: Boolean);
procedure g_Weapon_punch(x, y: Integer; d, SpawnerUID: Word);
function g_Weapon_chainsaw(x, y: Integer; d, SpawnerUID: Word): Integer;
procedure g_Weapon_rocket(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1; Silent: Boolean = False);
//!!!FIXME!!!
-procedure g_Weapon_gun (const x, y, xd, yd, v, dmg: Integer; SpawnerUID: Word; CheckTrigger: Boolean);
+procedure g_Weapon_gun (const x, y, xd, yd, v, indmg: Integer; SpawnerUID: Word; CheckTrigger: Boolean);
var
x0, y0: Integer;
x2, y2: Integer;
xi, yi: Integer;
wallDistSq: Integer = $3fffffff;
spawnerPlr: TPlayer = nil;
+ dmg: Integer;
function doPlayerHit (idx: Integer; hx, hy: Integer): Boolean;
begin
begin
if ((gGameSettings.Options and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMDAMAGE)) = 0) and
(spawnerPlr.Team <> TEAM_NONE) and (spawnerPlr.Team = gPlayers[idx].Team) then
- exit;
+ begin
+ if (spawnerPlr <> gPlayers[idx]) and ((gGameSettings.Options and GAME_OPTION_TEAMABSORBDAMAGE) = 0) then
+ dmg := Max(1, dmg div 2);
+ exit;
+ end;
end;
result := HitPlayer(gPlayers[idx], dmg, (xi*v)*10, (yi*v)*10-3, SpawnerUID, HIT_SOME);
if result and (v <> 0) then gPlayers[idx].Push((xi*v), (yi*v));
if (g_GetUIDType(SpawnerUID) = UID_PLAYER) then
spawnerPlr := g_Player_Get(SpawnerUID);
+ dmg := indmg;
+
//wgunMonHash.reset(); //FIXME: clear hash on level change
wgunHitHeap.clear();
wgunHitTimeUsed := 0;