summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5d01abb)
raw | patch | inline | side by side (parent: 5d01abb)
author | TerminalHash <lyashuk.voxx@gmail.com> | |
Thu, 31 Aug 2023 21:19:35 +0000 (00:19 +0300) | ||
committer | TerminalHash <lyashuk.voxx@gmail.com> | |
Thu, 31 Aug 2023 21:21:49 +0000 (00:21 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 1caeaf87b99ef93936c42993d7916567e3fab5d8..6ff8ec3fc1be9fe084b6c965abd7dd32d4b2a874 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('g_warmup_time', GameCVars);
AddCommand('g_spawn_invul', GameCVars);
AddCommand('g_item_respawn_time', GameCVars);
+ AddCommand('g_rulez_randomize_respawn', GameCVars);
+ AddCommand('g_rulez_time_multiplier', GameCVars);
AddCommand('sv_intertime', GameCVars);
AddCommand('sv_name', NetServerCVars);
WhitelistCommand('g_warmup_time');
WhitelistCommand('g_spawn_invul');
WhitelistCommand('g_item_respawn_time');
+ WhitelistCommand('g_rulez_randomize_respawn');
+ WhitelistCommand('g_rulez_time_multiplier');
g_Console_ResetBinds;
g_Console_ReadConfig(gConfigScript);
WriteLn(f, 'g_timelimit ', gsTimeLimit);
WriteLn(f, 'g_maxlives ', gsMaxLives);
WriteLn(f, 'g_item_respawn_time ', gsItemRespawnTime);
+ WriteLn(f, 'g_rulez_time_multiplier ', gsRulezTimeMultiplier);
WriteLn(f, 'g_spawn_invul ', gsSpawnInvul);
WriteLn(f, 'g_warmup_time ', gsWarmupTime);
WriteFlag('g_friendlyfire ', GAME_OPTION_TEAMDAMAGE);
WriteFlag('g_friendly_hit_trace ', GAME_OPTION_TEAMHITTRACE);
WriteFlag('g_friendly_hit_projectile ', GAME_OPTION_TEAMHITPROJECTILE);
+ WriteFlag('g_rulez_randomize_respawn ', GAME_OPTION_RULEZRANDOM);
WriteFlag('g_allow_exit ', GAME_OPTION_ALLOWEXIT);
WriteFlag('g_allow_monsters ', GAME_OPTION_MONSTERS);
WriteFlag('g_allow_dropflag ', GAME_OPTION_ALLOWDROPFLAG);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 0cca55387e1b518016faab9f0925fbc2b88c2b41..303d036f53c62ee319e56b1d862929065dce0614 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
WarmupTime: Word;
SpawnInvul: Word;
ItemRespawnTime: Word;
+ RulezTimeMultiplier: Word;
MaxLives: Byte;
Options: LongWord;
WAD: String;
GAME_OPTION_TEAMABSORBDAMAGE = 1024;
GAME_OPTION_ALLOWDROPFLAG = 2048;
GAME_OPTION_THROWFLAG = 4096;
+ GAME_OPTION_RULEZRANDOM = 8192;
STATE_NONE = 0;
STATE_MENU = 1;
gGameSettings.Options := gGameSettings.Options + GAME_OPTION_BOTVSMONSTER;
gGameSettings.Options := gGameSettings.Options + GAME_OPTION_TEAMHITPROJECTILE;
gGameSettings.Options := gGameSettings.Options + GAME_OPTION_TEAMHITTRACE;
+ gGameSettings.Options := gGameSettings.Options + GAME_OPTION_RULEZRANDOM;
gSwitchGameMode := GM_SINGLE;
gLMSRespawn := LMS_RESPAWN_NONE;
a, b: Integer;
stat: TPlayerStatArray;
cmd: string;
+ it: PItem;
procedure ParseGameFlag(Flag: LongWord; OffMsg, OnMsg: TStrings_Locale; OnMapChange: Boolean = False);
var
begin
ParseGameFlag(GAME_OPTION_TEAMHITPROJECTILE, I_MSG_FRIENDLY_PROJECT_TRACE_OFF, I_MSG_FRIENDLY_PROJECT_TRACE_ON);
end
+ else if cmd = 'g_rulez_randomize_respawn' then
+ begin
+ ParseGameFlag(GAME_OPTION_RULEZRANDOM, I_MSG_RULEZ_RANDOM_ON, I_MSG_RULEZ_RANDOM_OFF);
+ end
else if cmd = 'g_weaponstay' then
begin
ParseGameFlag(GAME_OPTION_WEAPONSTAY, I_MSG_WEAPONSTAY_OFF, I_MSG_WEAPONSTAY_ON);
g_Console_Add(Format('%s %d', [cmd, Integer(gsItemRespawnTime)]));
if g_Game_IsServer then g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end
+ else if cmd = 'g_rulez_time_multiplier' then
+ begin
+ if Length(P) > 1 then
+ begin
+ gsRulezTimeMultiplier := nclamp(StrToIntDef(P[1], gsRulezTimeMultiplier), 0, $FFFF);
+ if g_Game_IsServer then
+ begin
+ gGameSettings.RulezTimeMultiplier := gsRulezTimeMultiplier;
+ if g_Game_IsNet then MH_SEND_GameSettings;
+ end;
+ end;
+
+ g_Console_Add(Format('%s %d', [cmd, Integer(gsRulezTimeMultiplier)]));
+ if g_Game_IsServer then g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
+ end
else if cmd = 'sv_intertime' then
begin
if (Length(P) > 1) then
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index a69ceaaf811bd9f84f5b07ec41b0e6e2fcf11537..b0cd320c96f5258e40052c5dbf98b904e99c9408 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
ggItems[ID].Obj.oldY := ggItems[ID].Obj.Y;
ggItems[ID].alive := false;
ggItems[ID].RespawnTime := IfThen(gLMSRespawn = LMS_RESPAWN_NONE, gGameSettings.ItemRespawnTime, 15) * 36;
+
+ if ((gGameSettings.Options and GAME_OPTION_RULEZRANDOM) = 0) then // Random powerup respawn
+ begin
+ if ggItems[ID].ItemType in [ITEM_SPHERE_BLUE, ITEM_SPHERE_WHITE, ITEM_INVUL,
+ ITEM_INVIS, ITEM_MEDKIT_BLACK, ITEM_JETPACK] then
+ begin
+ ggItems[ID].RespawnTime := Random(gGameSettings.RulezTimeMultiplier) * 36;
+ //e_logwritefln ('Randomized number', []);
+ end;
+ end;
end;
end;
-
procedure g_Items_Remove (ID: DWORD);
var
it: PItem;
index 975360b21de44c10402b978f31baa6f56c055e3d..341a4577299dde8c97cdc8cb4e9456587f583ba8 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_MENU_ENABLE_EXITS,
I_MENU_WEAPONS_STAY,
I_MENU_ENABLE_MONSTERS,
+ I_MENU_ENABLE_RULEZ_RANDOM,
+ I_MENU_RULEZ_RESPAWN_MULTIPLIER,
I_MENU_BOTS_VS,
I_MENU_BOTS_VS_PLAYERS,
I_MENU_BOTS_VS_MONSTERS,
I_MSG_SPECT_HUD_OFF,
I_MSG_PING_ON,
I_MSG_PING_OFF,
+ I_MSG_RULEZ_RANDOM_ON,
+ I_MSG_RULEZ_RANDOM_OFF,
I_MSG_NO_WAD,
I_MSG_NO_MAPS,
I_MSG_NO_MAP,
'Îðóæèå îñòà¸òñÿ:'),
('MENU ENABLE MONSTERS', 'Enable monsters:',
'Ìîíñòðû:'),
+ ('MENU ENABLE RULEZ RANDOM', 'Enable random powerup respawn:',
+ 'Ðàíäîìíûé ðåñïàóí ïîâåðàïîâ:'),
+ ('MENU RULEZ RESPAWN MULTIPLIER', 'Time multiplier for powerup respawn:',
+ 'Ìíîæèòåëü âðåìåíè äëÿ ðåñïàóíà ïîâåðàïîâ:'),
('MENU BOTS VS', 'Bots fight with:',
'Áîòû ïðîòèâ:'),
('MENU BOTS VS PLAYERS', 'Players',
'Ïèíã êëèåíòà ïîêàçûâàåòñÿ'),
('MSG PING OFF', 'Client ping display off',
'Ïèíã êëèåíòà íå ïîêàçûâàåòñÿ'),
+ ('MSG RULEZ RANDOM ON', 'Random respawn for powerups on',
+ 'Ðàíäîìíûé ðåñïàóí äëÿ ïîâåðàïîâ âêëþ÷¸í'),
+ ('MSG RULEZ RANDOM OFF', 'Random respawn for powerups off',
+ 'Ðàíäîìíûé ðåñïàóí äëÿ ïîâåðàïîâ âûêëþ÷åí'),
('MSG NO WAD', 'WAD "%s" doesn''t exist!',
'WAD ôàéë "%s" íå íàéäåí!'),
('MSG NO MAPS', 'WAD "%s" doesn''t contain any maps!',
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index ff6757f659ffcb5a4484f2d45588370a6591fcb1..ed4e25dc7b89ab84452ae47b199b02164aa80384 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
gsScoreLimit := StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
gsMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
gsItemRespawnTime := StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
+ gsRulezTimeMultiplier := StrToIntDef(TGUIEdit(GetControl('edRulezTimeMultiplier')).Text, 0);
gsPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex;
gsMap := Map;
gsGameFlags := gsGameFlags or GAME_OPTION_WEAPONSTAY;
if TGUISwitch(GetControl('swMonsters')).ItemIndex = 0 then
gsGameFlags := gsGameFlags or GAME_OPTION_MONSTERS;
+ if TGUISwitch(GetControl('swRulezRandom')).ItemIndex = 0 then
+ gsGameFlags := gsGameFlags or GAME_OPTION_RULEZRANDOM;
case TGUISwitch(GetControl('swTeamHit')).ItemIndex of
1: gsGameFlags := gsGameFlags or GAME_OPTION_TEAMHITTRACE;
// TODO: get this crap out of here
gGameSettings.ItemRespawnTime := gsItemRespawnTime;
+ gGameSettings.RulezTimeMultiplier := gsRulezTimeMultiplier;
gGameSettings.WarmupTime := gsWarmupTime;
gGameSettings.SpawnInvul := gsSpawnInvul;
end;
if gsItemRespawnTime > 0 then
Text := IntToStr(gsItemRespawnTime);
end;
+ with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_MULTIPLIER]) do
+ begin
+ Name := 'edRulezTimeMultiplier';
+ OnlyDigits := True;
+ Width := 4;
+ MaxLength := 5;
+ if gsRulezTimeMultiplier > 0 then
+ Text := IntToStr(gsRulezTimeMultiplier);
+ end;
with AddSwitch(_lc[I_MENU_PLAYERS]) do
begin
Name := 'swPlayers';
else
ItemIndex := 1;
end;
+ with AddSwitch(_lc[I_MENU_ENABLE_RULEZ_RANDOM]) do
+ begin
+ Name := 'swRulezRandom';
+ AddItem(_lc[I_MENU_NO]);
+ AddItem(_lc[I_MENU_YES]);
+ if LongBool(gsGameFlags and GAME_OPTION_RULEZRANDOM) then
+ ItemIndex := 0
+ else
+ ItemIndex := 1;
+ end;
with AddSwitch(_lc[I_MENU_BOTS_VS]) do
begin
Name := 'swBotsVS';
if gsItemRespawnTime > 0 then
Text := IntToStr(gsItemRespawnTime);
end;
+ with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_MULTIPLIER]) do
+ begin
+ Name := 'edRulezTimeMultiplier';
+ OnlyDigits := True;
+ Width := 4;
+ MaxLength := 5;
+ if gsRulezTimeMultiplier > 0 then
+ Text := IntToStr(gsRulezTimeMultiplier);
+ end;
with AddSwitch(_lc[I_MENU_PLAYERS]) do
begin
Name := 'swPlayers';
else
ItemIndex := 1;
end;
+ with AddSwitch(_lc[I_MENU_ENABLE_RULEZ_RANDOM]) do
+ begin
+ Name := 'swRulezRandom';
+ AddItem(_lc[I_MENU_NO]);
+ AddItem(_lc[I_MENU_YES]);
+ if LongBool(gsGameFlags and GAME_OPTION_RULEZRANDOM) then
+ ItemIndex := 0
+ else
+ ItemIndex := 1;
+ end;
with AddSwitch(_lc[I_MENU_BOTS_VS]) do
begin
Name := 'swBotsVS';
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index ace71914663e7a139ae5f705149984909cec83cc..40249435823f84d3693ad06249082e669eefcc1f 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
gsGameFlags: LongWord;
gsSpawnInvul: Integer = 0;
gsItemRespawnTime: Word = 60;
+ gsRulezTimeMultiplier: Word = 60;
gsWarmupTime: Word = 30;
implementation
gsPlayers := 1;
gsSpawnInvul := 0;
gsItemRespawnTime := 60;
+ gsRulezTimeMultiplier := 60;
gsGameFlags := GAME_OPTION_ALLOWEXIT or GAME_OPTION_DMKEYS or
GAME_OPTION_BOTVSPLAYER or GAME_OPTION_BOTVSMONSTER or
GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE or
- GAME_OPTION_ALLOWDROPFLAG;
+ GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_RULEZRANDOM;
gsPlayers := 1;
if not gGameOn then
MaxLives := gsMaxLives;
SpawnInvul := gsSpawnInvul;
ItemRespawnTime := gsItemRespawnTime;
+ RulezTimeMultiplier := gsRulezTimeMultiplier;
WarmupTime := gsWarmupTime;
Options := gsGameFlags;
end;