summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6af04fe)
raw | patch | inline | side by side (parent: 6af04fe)
author | TerminalHash <lyashuk.voxx@gmail.com> | |
Fri, 1 Sep 2023 14:50:12 +0000 (17:50 +0300) | ||
committer | TerminalHash <lyashuk.voxx@gmail.com> | |
Fri, 1 Sep 2023 14:50:12 +0000 (17:50 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index febe7e96b6fd155dcaafbb58a23ba882606248b0..9ea80513eaecd98cbc7e75042fbbe87534f27da1 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('g_spawn_invul', GameCVars);
AddCommand('g_item_respawn_time', GameCVars);
AddCommand('g_powerup_randomize_respawn', GameCVars);
- AddCommand('g_powerup_time_multiplier', GameCVars);
+ AddCommand('g_powerup_respawn_time', GameCVars);
+ AddCommand('g_powerup_time_random', GameCVars);
AddCommand('sv_intertime', GameCVars);
AddCommand('sv_name', NetServerCVars);
WhitelistCommand('g_spawn_invul');
WhitelistCommand('g_item_respawn_time');
WhitelistCommand('g_powerup_randomize_respawn');
- WhitelistCommand('g_powerup_time_multiplier');
+ WhitelistCommand('g_powerup_respawn_time');
+ WhitelistCommand('g_powerup_time_random');
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_powerup_time_multiplier ', gsRulezTimeMultiplier);
+ WriteLn(f, 'g_powerup_respawn_time ', gsRulezRespawnTime);
+ WriteLn(f, 'g_powerup_time_random ', gsRulezRespawnRandom);
WriteLn(f, 'g_spawn_invul ', gsSpawnInvul);
WriteLn(f, 'g_warmup_time ', gsWarmupTime);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 7c499d4958f690958daecda3d5fd070d97fd67c3..9f399b6546609ef1568a5bf6f957e0f1f98d6f46 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
WarmupTime: Word;
SpawnInvul: Word;
ItemRespawnTime: Word;
- RulezTimeMultiplier: Word;
+ RulezRespawnTime: Word;
+ RulezRespawnRandom: Word;
MaxLives: Byte;
Options: LongWord;
WAD: String;
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_powerup_time_multiplier' then
+ else if cmd = 'g_powerup_respawn_time' then
begin
if Length(P) > 1 then
begin
- gsRulezTimeMultiplier := nclamp(StrToIntDef(P[1], gsRulezTimeMultiplier), 0, $FFFF);
+ gsRulezRespawnTime := nclamp(StrToIntDef(P[1], gsRulezRespawnTime), 0, $FFFF);
if g_Game_IsServer then
begin
- gGameSettings.RulezTimeMultiplier := gsRulezTimeMultiplier;
+ gGameSettings.RulezRespawnTime := gsRulezRespawnTime;
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end;
- g_Console_Add(Format('%s %d', [cmd, Integer(gsRulezTimeMultiplier)]));
+ g_Console_Add(Format('%s %d', [cmd, Integer(gsRulezRespawnTime)]));
+ if g_Game_IsServer then g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
+ end
+ else if cmd = 'g_powerup_time_random' then
+ begin
+ if Length(P) > 1 then
+ begin
+ gsRulezRespawnRandom := nclamp(StrToIntDef(P[1], gsRulezRespawnRandom), 0, $FFFF);
+ if g_Game_IsServer then
+ begin
+ gGameSettings.RulezRespawnRandom := gsRulezRespawnRandom;
+ if g_Game_IsNet then MH_SEND_GameSettings;
+ end;
+ end;
+
+ g_Console_Add(Format('%s %d', [cmd, Integer(gsRulezRespawnRandom)]));
if g_Game_IsServer then g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end
else if cmd = 'sv_intertime' then
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index a7cbe4a8c846d7fd5ff54309f353d16fd6a6e57a..30e8db912cdf2c89c1099e04c4706de8e1f615b2 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
i, j, k: Integer;
ID: DWord;
Anim: TAnimation;
- m, ItemRespawnTime: Word;
+ m, ItemRespawnTime, RulezRespawnTime: Word;
r, nxt: Boolean;
begin
if (ggItems = nil) then exit;
// respawn items in 15 seconds regardless of settings during warmup
ItemRespawnTime := IfThen(gLMSRespawn = LMS_RESPAWN_NONE, gGameSettings.ItemRespawnTime, 15);
+ RulezRespawnTime := IfThen(gLMSRespawn = LMS_RESPAWN_NONE, gGameSettings.RulezRespawnTime, 15);
for i := 0 to High(ggItems) do
begin
ggItems[ID].Obj.oldX := ggItems[ID].Obj.X;
ggItems[ID].Obj.oldY := ggItems[ID].Obj.Y;
ggItems[ID].alive := false;
+
+ // Items respawn timer
ggItems[ID].RespawnTime := IfThen(gLMSRespawn = LMS_RESPAWN_NONE, gGameSettings.ItemRespawnTime, 15) * 36;
+ // Rulez respawn timer
+ if ggItems[ID].ItemType in [ITEM_SPHERE_BLUE, ITEM_SPHERE_WHITE, ITEM_INVUL,
+ ITEM_INVIS, ITEM_MEDKIT_BLACK, ITEM_JETPACK, ITEM_SUIT] then
+ begin
+ ggItems[ID].RespawnTime := IfThen(gLMSRespawn = LMS_RESPAWN_NONE, gGameSettings.RulezRespawnTime, 15) * 36;
+ end;
+
if LongBool(gGameSettings.Options and GAME_OPTION_RULEZRANDOM) 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, ITEM_SUIT] then
+ ITEM_INVIS, ITEM_MEDKIT_BLACK, ITEM_JETPACK, ITEM_SUIT] then
begin
- ggItems[ID].RespawnTime := Random(gGameSettings.RulezTimeMultiplier) * 36;
- e_logwritefln ('Randomized number', []);
+ ggItems[ID].RespawnTime := Max(1, (gGameSettings.RulezRespawnTime + RandomRange(-gGameSettings.RulezRespawnRandom, gGameSettings.RulezRespawnRandom + 1)) * 36);
+ //e_logwritefln ('Randomized number: %s', [ggItems[ID].RespawnTime]);
end;
end;
end;
index 22b589a58252e874b462e698928fba47a535c470..1d6734776178bdc7935ccb9fd020302815dcc4d9 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_MENU_ENABLE_TEAM_DAMAGE_ABSOBR,
I_MENU_ENABLE_MONSTERS,
I_MENU_ENABLE_RULEZ_RANDOM,
- I_MENU_RULEZ_RESPAWN_MULTIPLIER,
+ I_MENU_RULEZ_RESPAWN_TIME,
+ I_MENU_RULEZ_RESPAWN_RANDOM,
I_MENU_BOTS_VS,
I_MENU_BOTS_VS_PLAYERS,
I_MENU_BOTS_VS_MONSTERS,
'Ìîíñòðû:'),
('MENU ENABLE RULEZ RANDOM', 'Enable random powerup respawn:',
'Ðàíäîìíûé ðåñïàóí ïîâåðàïîâ:'),
- ('MENU RULEZ RESPAWN MULTIPLIER', 'Time multiplier for powerup respawn:',
- 'Ìíîæèòåëü âðåìåíè äëÿ ðåñïàóíà ïîâåðàïîâ:'),
+ ('MENU RULEZ RESPAWN TIME', 'Powerup respawn time:',
+ 'Âðåìÿ ðåñïàóíà ïîâåðàïîâ:'),
+ ('MENU RULEZ RESPAWN RANDOM', 'Additive time for powerup timer:',
+ 'Äîïîëíèòåëüíîå ÷èñëî ê òàéìåðó ïàâåðàïîâ:'),
('MENU BOTS VS', 'Bots fight with:',
'Áîòû ïðîòèâ:'),
('MENU BOTS VS PLAYERS', 'Players',
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index b4a4dfd4095fa077ebe7f4ef9b6e80d183abaa48..d9a8c6d7a16d39be58481ba48c93467af4a5d7e9 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);
+ gsRulezRespawnTime := StrToIntDef(TGUIEdit(GetControl('edRulezRespawnTime')).Text, 0);
+ gsRulezRespawnRandom := StrToIntDef(TGUIEdit(GetControl('edRulezRespawnRandom')).Text, 0);
gsPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex;
gsMap := Map;
// TODO: get this crap out of here
gGameSettings.ItemRespawnTime := gsItemRespawnTime;
- gGameSettings.RulezTimeMultiplier := gsRulezTimeMultiplier;
+ gGameSettings.RulezRespawnTime := gsRulezRespawnTime;
+ gGameSettings.RulezRespawnRandom := gsRulezRespawnRandom;
gGameSettings.WarmupTime := gsWarmupTime;
gGameSettings.SpawnInvul := gsSpawnInvul;
end;
if gsItemRespawnTime > 0 then
Text := IntToStr(gsItemRespawnTime);
end;
- with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_MULTIPLIER]) do
+ AddSpace(); // Rulez Respawn block
+ with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_TIME]) do
begin
- Name := 'edRulezTimeMultiplier';
+ Name := 'edRulezRespawnTime';
OnlyDigits := True;
Width := 4;
MaxLength := 5;
- if gsRulezTimeMultiplier > 0 then
- Text := IntToStr(gsRulezTimeMultiplier);
+ if gsRulezRespawnTime > 0 then
+ Text := IntToStr(gsRulezRespawnTime);
end;
+ with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_RANDOM]) do
+ begin
+ Name := 'edRulezRespawnRandom';
+ OnlyDigits := True;
+ Width := 4;
+ MaxLength := 5;
+ if gsRulezRespawnRandom > 0 then
+ Text := IntToStr(gsRulezRespawnRandom);
+ end;
+ with AddSwitch(_lc[I_MENU_ENABLE_RULEZ_RANDOM]) do
+ begin
+ Name := 'swRulezRandom';
+ AddItem(_lc[I_MENU_YES]);
+ AddItem(_lc[I_MENU_NO]);
+ if LongBool(gsGameFlags and GAME_OPTION_RULEZRANDOM) then
+ ItemIndex := 0
+ else
+ ItemIndex := 1;
+ end;
+ AddSpace();
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_YES]);
- AddItem(_lc[I_MENU_NO]);
- 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
+ AddSpace(); // Rulez Respawn block
+ with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_TIME]) do
begin
- Name := 'edRulezTimeMultiplier';
+ Name := 'edRulezRespawnTime';
OnlyDigits := True;
Width := 4;
MaxLength := 5;
- if gsRulezTimeMultiplier > 0 then
- Text := IntToStr(gsRulezTimeMultiplier);
+ if gsRulezRespawnTime > 0 then
+ Text := IntToStr(gsRulezRespawnTime);
end;
+ with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_RANDOM]) do
+ begin
+ Name := 'edRulezRespawnRandom';
+ OnlyDigits := True;
+ Width := 4;
+ MaxLength := 5;
+ if gsRulezRespawnRandom > 0 then
+ Text := IntToStr(gsRulezRespawnRandom);
+ end;
+ with AddSwitch(_lc[I_MENU_ENABLE_RULEZ_RANDOM]) do
+ begin
+ Name := 'swRulezRandom';
+ AddItem(_lc[I_MENU_YES]);
+ AddItem(_lc[I_MENU_NO]);
+ if LongBool(gsGameFlags and GAME_OPTION_RULEZRANDOM) then
+ ItemIndex := 0
+ else
+ ItemIndex := 1;
+ end;
+ AddSpace();
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_YES]);
- AddItem(_lc[I_MENU_NO]);
- 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 40249435823f84d3693ad06249082e669eefcc1f..b0153192dc5c2c6995922ab13424c190c06f7073 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;
+ gsRulezRespawnTime: Word = 60;
+ gsRulezRespawnRandom: Word = 0;
gsWarmupTime: Word = 30;
implementation
gsPlayers := 1;
gsSpawnInvul := 0;
gsItemRespawnTime := 60;
- gsRulezTimeMultiplier := 60;
+ gsRulezRespawnTime := 60;
+ gsRulezRespawnRandom := 0;
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
MaxLives := gsMaxLives;
SpawnInvul := gsSpawnInvul;
ItemRespawnTime := gsItemRespawnTime;
- RulezTimeMultiplier := gsRulezTimeMultiplier;
+ RulezRespawnTime := gsRulezRespawnTime;
+ RulezRespawnRandom := gsRulezRespawnRandom;
WarmupTime := gsWarmupTime;
Options := gsGameFlags;
end;