summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80a5bd6)
raw | patch | inline | side by side (parent: 80a5bd6)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Sat, 8 Feb 2020 23:02:30 +0000 (02:02 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Sat, 8 Feb 2020 23:02:30 +0000 (02:02 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 92e86c69bf220c9b4821515841f758d1e4023ab5..3f285b4badce5fe4d574e455d8715f9333e35ec0 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('g_friendlyfire', GameCVars);
AddCommand('g_weaponstay', GameCVars);
AddCommand('g_allow_exit', GameCVars);
+ AddCommand('g_dm_keys', GameCVars);
AddCommand('g_allow_monsters', GameCVars);
AddCommand('g_bot_vsmonsters', GameCVars);
AddCommand('g_bot_vsplayers', GameCVars);
AddCommand('g_timelimit', GameCVars);
AddCommand('g_maxlives', GameCVars);
AddCommand('g_warmuptime', GameCVars);
+ AddCommand('g_spawn_invul', GameCVars);
AddCommand('net_interp', GameCVars);
AddCommand('net_forceplayerupdate', GameCVars);
AddCommand('net_predictself', GameCVars);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index ef256d18c597441246b1fd81e115d67b259a1c77..d03d02a47f13494d22353492dc80ba35676346ce 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
TimeLimit: Word;
GoalLimit: Word;
WarmupTime: Word;
+ SpawnInvul: Word;
MaxLives: Byte;
Options: LongWord;
WAD: String;
GAME_OPTION_MONSTERS = 16;
GAME_OPTION_BOTVSPLAYER = 32;
GAME_OPTION_BOTVSMONSTER = 64;
+ GAME_OPTION_DMKEYS = 128;
STATE_NONE = 0;
STATE_MENU = 1;
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end
+ else if (cmd = 'g_dm_keys') and not g_Game_IsClient then
+ begin
+ with gGameSettings do
+ begin
+ if (Length(P) > 1) and
+ ((P[1] = '1') or (P[1] = '0')) then
+ begin
+ if (P[1][1] = '1') then
+ Options := Options or GAME_OPTION_DMKEYS
+ else
+ Options := Options and (not GAME_OPTION_DMKEYS);
+ end;
+
+ if (LongBool(Options and GAME_OPTION_DMKEYS)) then
+ g_Console_Add(_lc[I_MSG_DMKEYS_ON])
+ else
+ g_Console_Add(_lc[I_MSG_DMKEYS_OFF]);
+ g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
+
+ if g_Game_IsNet then MH_SEND_GameSettings;
+ end;
+ end
else if (cmd = 'g_warmuptime') and not g_Game_IsClient then
begin
if Length(P) > 1 then
[gGameSettings.WarmupTime]));
g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end
+ else if (cmd = 'g_spawn_invul') and not g_Game_IsClient then
+ begin
+ if Length(P) > 1 then
+ begin
+ if StrToIntDef(P[1], gGameSettings.SpawnInvul) = 0 then
+ gGameSettings.SpawnInvul := 0
+ else
+ gGameSettings.SpawnInvul := StrToIntDef(P[1], gGameSettings.SpawnInvul);
+ end;
+
+ g_Console_Add(Format(_lc[I_MSG_SPAWNINVUL],
+ [gGameSettings.SpawnInvul]));
+ g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
+ end
else if cmd = 'net_interp' then
begin
if (Length(P) > 1) then
index 6f613826ecbe3f8fa2bb2a218c4e0a16e87b8f49..8ccc8ea8a70e2eb9229530e659de6f7e7cb8af29 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_MSG_ALLOWEXIT_OFF,
I_MSG_ALLOWMON_ON,
I_MSG_ALLOWMON_OFF,
+ I_MSG_DMKEYS_ON,
+ I_MSG_DMKEYS_OFF,
I_MSG_BOTSVSPLAYERS_ON,
I_MSG_BOTSVSPLAYERS_OFF,
I_MSG_BOTSVSMONSTERS_ON,
I_MSG_TIME_LIMIT,
I_MSG_LIVES,
I_MSG_WARMUP,
+ I_MSG_SPAWNINVUL,
I_MSG_WARMUP_START,
I_MSG_NEXTMAP_SET,
I_MSG_NEXTMAP_UNSET,
'Ïîäîæäèòå, ïîêà ñìåíèòñÿ êàðòà íà ñåðâåðå'),
('MENU INTER NOTICE SPACE', 'Press [SPACE] to continue',
'Íàæìèòå [ÏÐÎÁÅË], ÷òîáû ïðîäîëæèòü'),
- ('MENU INTER NOTICE TIME', '%d seconds till the next round',
- 'Îñòàëîñü %d ñåêóíä äî ñëåäóþùåãî ðàóíäà'),
+ ('MENU INTER NOTICE TIME', '%d sec till the next round',
+ 'Îñòàëîñü %d ñåê äî ñëåäóþùåãî ðàóíäà'),
('MENU LOADING', 'Loading...',
'Çàãðóçêà...'),
('MENU PLAYER 1', 'Player 1',
'Ìîíñòðû â DM âêëþ÷åíû*'),
('MSG ALLOWMON OFF', 'Monsters in DM disabled*',
'Ìîíñòðû â DM âûêëþ÷åíû*'),
+ ('MSG DMKEYS ON', 'Spawning with all keys in DM enabled*',
+ 'Ðåñïàâí ñî âñåìè êëþ÷àìè â DM âêëþ÷åí*'),
+ ('MSG DMKEYS OFF', 'Spawning with all keys in DM disabled*',
+ 'Ðåñïàâí ñî âñåìè êëþ÷àìè â DM âûêëþ÷åí*'),
('MSG BOTSVSPLAYERS ON', 'Bots attack players',
'Áîòû ïðîòèâ èãðîêîâ'),
('MSG BOTSVSPLAYERS OFF', 'Bots ignore players',
'Ëèìèò âðåìåíè - %d:%.2d:%.2d'),
('MSG LIVES', 'Max lives: %d',
'Ìàêñ. æèçíåé ó èãðîêîâ: %d'),
- ('MSG WARMUP', 'Warmup time: %d seconds*',
- 'Âðåìÿ íà ïîäãîòîâêó ê èãðå: %d ñåêóíä*'),
- ('MSG WARMUP START', '%d seconds until round start.',
- '%d ñåêóíä äî íà÷àëà ðàóíäà.'),
+ ('MSG WARMUP', 'Warmup time: %d sec*',
+ 'Âðåìÿ íà ïîäãîòîâêó ê èãðå: %d ñåê*'),
+ ('MSG SPAWNINVUL', 'Spawn invulnerability time: %d sec*',
+ 'Íåóÿçâèìîñòü ïîñëå ðåñïàóíà: %d ñåê*'),
+ ('MSG WARMUP START', '%d sec until round start.',
+ '%d ñåê äî íà÷àëà ðàóíäà.'),
('MSG NEXTMAP SET', 'Next map: %s',
'Ñëåäóþùàÿ êàðòà: %s'),
('MSG NEXTMAP UNSET', 'Next map is not set.',
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 6388eebbb6400aff322b7caebd36638f427986e9..0f1cf30a8c346c705b6e57280001f7a5b6c0b1b7 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
e_log, e_msg, ENet, Classes, md5, MAPDEF{$IFDEF USE_MINIUPNPC}, miniupnpc;{$ELSE};{$ENDIF}
const
- NET_PROTOCOL_VER = 182;
+ NET_PROTOCOL_VER = 183;
NET_MAXCLIENTS = 24;
NET_CHANS = 12;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 52e7ae64e0fa0d563a40b52ca1e1fb076e9b89b3..235cbb1b280b1ebb1c821f508f1cd3fc2bcbdc5d 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
NetOut.Write(Byte(FJetpack));
NetOut.Write(FFireTime);
NetOut.Write(Byte(FFlaming));
+ NetOut.Write(FSpawnInvul);
end;
g_Net_Host_Send(ID, True, NET_CHAN_PLAYER);
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index d4f92e86617af3c35036b96df4f798c117de4c68..c923a6771fdb120124f71ef6a778720633af8ffc 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
gcWeaponStay: Boolean;
gcMonsters: Boolean;
gcBotsVS: String;
+ gcDeathmatchKeys: Boolean = True;
+ gcSpawnInvul: Integer = 0;
gnMap: String;
gnGameMode: String;
gnTimeLimit: Word;
gnWeaponStay: Boolean;
gnMonsters: Boolean;
gnBotsVS: String;
+ gnDeathmatchKeys: Boolean = True;
+ gnSpawnInvul: Integer = 0;
gsSDLSampleRate: Integer;
gsSDLBufferSize: Integer;
gDefaultMegawadStart: AnsiString;
gcWeaponStay := False;
gcMonsters := False;
gcBotsVS := 'Everybody';
+ gcDeathmatchKeys := True;
+ gcSpawnInvul := 0;
(* section GameplayNetwork *)
gnMap := '';
gnWeaponStay := False;
gnMonsters := False;
gnBotsVS := 'Everybody';
+ gnDeathmatchKeys := True;
+ gnSpawnInvul := 0;
(* section MasterServer *)
NetSlistIP := 'mpms.doom2d.org';
ReadBoolean(gcWeaponStay, 'WeaponStay');
ReadBoolean(gcMonsters, 'Monsters');
ReadString(gcBotsVS, 'BotsVS');
+ ReadBoolean(gcDeathmatchKeys, 'DeathmatchKeys');
+ ReadInteger(gcSpawnInvul, 'SpawnInvul');
with gGameSettings do
begin
Options := Options or GAME_OPTION_BOTVSPLAYER;
if gcBotsVS = 'Monsters' then
Options := Options or GAME_OPTION_BOTVSMONSTER;
+ if gcDeathmatchKeys then
+ Options := Options or GAME_OPTION_DMKEYS;
end;
section := 'GameplayNetwork';
ReadBoolean(gnWeaponStay, 'WeaponStay');
ReadBoolean(gnMonsters, 'Monsters');
ReadString(gnBotsVS, 'BotsVS');
+ ReadBoolean(gnDeathmatchKeys, 'DeathmatchKeys');
+ ReadInteger(gnSpawnInvul, 'SpawnInvul');
section := 'MasterServer';
ReadString(NetSlistIP, 'IP');
config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay);
config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
+ config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys);
+ config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul);
config.WriteStr ('GameplayNetwork', 'Map', gnMap);
config.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode);
config.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay);
config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
+ config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys);
+ config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul);
config.WriteStr('MasterServer', 'IP', NetSlistIP);
config.WriteInt('MasterServer', 'Port', NetSlistPort);
config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay);
config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
+ config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys);
+ config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul);
config.SaveFile(FileName);
config.Free();
config.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay);
config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
+ config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys);
+ config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul);
config.SaveFile(FileName);
config.Free();
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 0cde3c089c1dfe4d0a5d9098721c4e4717d07e4e..b8a77bd44fa2f02aab7ce19e624048a1a2533f2f 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
FReady: Boolean;
FDummy: Boolean;
FFireTime: Integer;
+ FSpawnInvul: Integer;
FHandicap: Integer;
FWaitForFirstSpawn: Boolean; // set to `true` in server, used to spawn a player on first full state request
FMegaRulez[MR_SUIT] := 0;
FMegaRulez[MR_INVUL] := 0;
FMegaRulez[MR_INVIS] := 0;
+ FSpawnInvul := 0;
FBerserk := 0;
end;
end;
end;
- if (FMegaRulez[MR_INVUL] > gTime) and (gPlayerDrawn <> Self) then
+ if (FMegaRulez[MR_INVUL] > gTime) and ((gPlayerDrawn <> Self) or (FSpawnInvul >= gTime)) then
if g_Texture_Get('TEXTURE_PLAYER_INVULPENTA', ID) then
begin
e_GetTextureSize(ID, @w, @h);
dr: Boolean;
begin
// Ïðè âçÿòèè íåóÿçâèìîñòè ðèñóåòñÿ èíâåðñèîííûé áåëûé ôîí
- if FMegaRulez[MR_INVUL] >= gTime then
+ if (FMegaRulez[MR_INVUL] >= gTime) and (FSpawnInvul < gTime) then
begin
if (FMegaRulez[MR_INVUL]-gTime) <= 2100 then
dr := not Odd((FMegaRulez[MR_INVUL]-gTime) div 300)
PushItem(ITEM_JETPACK);
// Âûáðîñ êëþ÷åé:
- if not (gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF]) then
+ if (not (gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF])) or
+ LongBool(gGameSettings.Options and GAME_OPTION_DMKEYS) then
begin
if R_KEY_RED in FRulez then
PushItem(ITEM_KEY_RED);
if FMegaRulez[MR_INVUL] < gTime+PLAYER_INVUL_TIME then
begin
FMegaRulez[MR_INVUL] := gTime+PLAYER_INVUL_TIME;
+ FSpawnInvul := 0;
Result := True;
remove := True;
if gFlash = 2 then Inc(FPickup, 5);
FMaxAmmo[A_CELLS] := AmmoLimits[0, A_CELLS];
FMaxAmmo[A_FUEL] := AmmoLimits[0, A_FUEL];
- if gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF] then
+ if (gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF]) and
+ LongBool(gGameSettings.Options and GAME_OPTION_DMKEYS) then
FRulez := [R_KEY_RED, R_KEY_GREEN, R_KEY_BLUE]
else
FRulez := [];
for a := Low(FMegaRulez) to High(FMegaRulez) do
FMegaRulez[a] := 0;
+// Respawn invulnerability
+ if (gGameSettings.GameType <> GT_SINGLE) and (gGameSettings.SpawnInvul > 0) then
+ begin
+ FMegaRulez[MR_INVUL] := gTime + gGameSettings.SpawnInvul * 1000;
+ FSpawnInvul := FMegaRulez[MR_INVUL];
+ end;
+
FDamageBuffer := 0;
FJetpack := False;
FCanJetpack := False;