From: TerminalHash Date: Thu, 7 Sep 2023 22:34:05 +0000 (+0300) Subject: game: added random for item respawn time (default off) X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=cdade5490e36128b921033b93777e29be803a0dd;p=d2df-sdl.git game: added random for item respawn time (default off) --- diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 9ea8051..aece4fe 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -1117,6 +1117,7 @@ begin AddCommand('g_warmup_time', GameCVars); AddCommand('g_spawn_invul', GameCVars); AddCommand('g_item_respawn_time', GameCVars); + AddCommand('g_item_time_random', GameCVars); AddCommand('g_powerup_randomize_respawn', GameCVars); AddCommand('g_powerup_respawn_time', GameCVars); AddCommand('g_powerup_time_random', GameCVars); @@ -1249,6 +1250,7 @@ begin WhitelistCommand('g_warmup_time'); WhitelistCommand('g_spawn_invul'); WhitelistCommand('g_item_respawn_time'); + WhitelistCommand('g_item_time_random'); WhitelistCommand('g_powerup_randomize_respawn'); WhitelistCommand('g_powerup_respawn_time'); WhitelistCommand('g_powerup_time_random'); @@ -2240,6 +2242,7 @@ begin WriteLn(f, 'g_timelimit ', gsTimeLimit); WriteLn(f, 'g_maxlives ', gsMaxLives); WriteLn(f, 'g_item_respawn_time ', gsItemRespawnTime); + WriteLn(f, 'g_item_time_random ', gsItemRespawnRandom); WriteLn(f, 'g_powerup_respawn_time ', gsRulezRespawnTime); WriteLn(f, 'g_powerup_time_random ', gsRulezRespawnRandom); WriteLn(f, 'g_spawn_invul ', gsSpawnInvul); diff --git a/src/game/g_game.pas b/src/game/g_game.pas index b675eb4..2d80b3a 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -33,6 +33,7 @@ type WarmupTime: Word; SpawnInvul: Word; ItemRespawnTime: Word; + ItemRespawnRandom: Word; RulezRespawnTime: Word; RulezRespawnRandom: Word; MaxLives: Byte; @@ -198,6 +199,10 @@ const GAME_OPTION_ALLOWDROPFLAG = 2048; GAME_OPTION_THROWFLAG = 4096; GAME_OPTION_RULEZRANDOM = 8192; + GAME_OPTION_ITEMALLRANDOM = 16384; + GAME_OPTION_ITEMHELPRANDOM = 32768; + GAME_OPTION_ITEMAMMORANDOM = 65536; + GAME_OPTION_ITEMWEAPONRANDOM = 131072; STATE_NONE = 0; STATE_MENU = 1; @@ -4499,6 +4504,10 @@ begin gGameSettings.Options := gGameSettings.Options + GAME_OPTION_TEAMHITPROJECTILE; gGameSettings.Options := gGameSettings.Options + GAME_OPTION_TEAMHITTRACE; gGameSettings.Options := gGameSettings.Options + GAME_OPTION_RULEZRANDOM; + gGameSettings.Options := gGameSettings.Options + GAME_OPTION_ITEMALLRANDOM; + gGameSettings.Options := gGameSettings.Options + GAME_OPTION_ITEMHELPRANDOM; + gGameSettings.Options := gGameSettings.Options + GAME_OPTION_ITEMAMMORANDOM; + gGameSettings.Options := gGameSettings.Options + GAME_OPTION_ITEMWEAPONRANDOM; gSwitchGameMode := GM_SINGLE; gLMSRespawn := LMS_RESPAWN_NONE; @@ -5715,6 +5724,21 @@ begin 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_item_time_random' then + begin + if Length(P) > 1 then + begin + gsItemRespawnRandom := nclamp(StrToIntDef(P[1], gsItemRespawnRandom), 0, $FFFF); + if g_Game_IsServer then + begin + gGameSettings.ItemRespawnRandom := gsItemRespawnRandom; + if g_Game_IsNet then MH_SEND_GameSettings; + end; + end; + + g_Console_Add(Format('%s %d', [cmd, Integer(gsItemRespawnRandom)])); + if g_Game_IsServer then g_Console_Add(_lc[I_MSG_ONMAPCHANGE]); + end else if cmd = 'g_powerup_respawn_time' then begin if Length(P) > 1 then diff --git a/src/game/g_items.pas b/src/game/g_items.pas index 30e8db9..92bfca2 100644 --- a/src/game/g_items.pas +++ b/src/game/g_items.pas @@ -751,13 +751,69 @@ 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 + // #### Random powerup respawn #### + if LongBool(gGameSettings.Options and GAME_OPTION_RULEZRANDOM) then begin 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 := Max(1, (gGameSettings.RulezRespawnTime + RandomRange(-gGameSettings.RulezRespawnRandom, gGameSettings.RulezRespawnRandom + 1)) * 36); - //e_logwritefln ('Randomized number: %s', [ggItems[ID].RespawnTime]); + e_logwritefln ('Randomized rulez time: %s', [ggItems[ID].RespawnTime]); + end; + end; + + // #### Random item respawn #### + // Randomize respawn for all items (excluding rulez) + if LongBool(gGameSettings.Options and GAME_OPTION_ITEMALLRANDOM) then + begin + if ggItems[ID].ItemType in [ITEM_MEDKIT_SMALL, ITEM_MEDKIT_LARGE, ITEM_ARMOR_GREEN, + ITEM_ARMOR_BLUE, ITEM_BOTTLE, ITEM_HELMET, ITEM_OXYGEN, + ITEM_AMMO_BULLETS, ITEM_AMMO_BULLETS_BOX, ITEM_AMMO_SHELLS, + ITEM_AMMO_SHELLS_BOX, ITEM_AMMO_ROCKET, ITEM_AMMO_ROCKET_BOX, + ITEM_AMMO_CELL, ITEM_AMMO_CELL_BIG, ITEM_AMMO_FUELCAN, + ITEM_AMMO_BACKPACK, ITEM_WEAPON_SAW, ITEM_WEAPON_SHOTGUN1, + ITEM_WEAPON_SHOTGUN2, ITEM_WEAPON_CHAINGUN, ITEM_WEAPON_ROCKETLAUNCHER, + ITEM_WEAPON_PLASMA, ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, + ITEM_WEAPON_FLAMETHROWER] then + begin + ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime + RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36); + e_logwritefln ('Randomized item time: %s', [ggItems[ID].RespawnTime]); + end; + end; + + // Randomize respawn for heal/armor + if LongBool(gGameSettings.Options and GAME_OPTION_ITEMHELPRANDOM) then + begin + if ggItems[ID].ItemType in [ITEM_MEDKIT_SMALL, ITEM_MEDKIT_LARGE, ITEM_ARMOR_GREEN, + ITEM_ARMOR_BLUE, ITEM_BOTTLE, ITEM_HELMET, ITEM_OXYGEN, + ITEM_AMMO_BACKPACK] then + begin + ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime + RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36); + e_logwritefln ('Randomized help item time: %s', [ggItems[ID].RespawnTime]); + end; + end; + + // Randomize respawn for ammo + if LongBool(gGameSettings.Options and GAME_OPTION_ITEMAMMORANDOM) then + begin + if ggItems[ID].ItemType in [ITEM_AMMO_BULLETS, ITEM_AMMO_BULLETS_BOX, ITEM_AMMO_SHELLS, + ITEM_AMMO_SHELLS_BOX, ITEM_AMMO_ROCKET, ITEM_AMMO_ROCKET_BOX, + ITEM_AMMO_CELL, ITEM_AMMO_CELL_BIG, ITEM_AMMO_FUELCAN] then + begin + ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime + RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36); + e_logwritefln ('Randomized ammo time: %s', [ggItems[ID].RespawnTime]); + end; + end; + + // Randomize respawn for weapons + if LongBool(gGameSettings.Options and GAME_OPTION_ITEMWEAPONRANDOM) then + begin + if ggItems[ID].ItemType in [ITEM_WEAPON_SAW, ITEM_WEAPON_SHOTGUN1, ITEM_WEAPON_SHOTGUN2, + ITEM_WEAPON_CHAINGUN, ITEM_WEAPON_ROCKETLAUNCHER, ITEM_WEAPON_PLASMA, + ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, ITEM_WEAPON_FLAMETHROWER] then + begin + ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime + RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36); + e_logwritefln ('Randomized weapons time: %s', [ggItems[ID].RespawnTime]); end; end; end; diff --git a/src/game/g_language.pas b/src/game/g_language.pas index 1d67347..778d436 100644 --- a/src/game/g_language.pas +++ b/src/game/g_language.pas @@ -130,6 +130,8 @@ type I_MENU_START_CLIENT, I_MENU_CLIENT_CONNECT, I_MENU_SELECT_MAP, + I_MENU_SELECT_ITEM_RESPAWN, + I_MENU_ITEM_RESPAWN, I_MENU_VIDEO_OPTIONS, I_MENU_SOUND_OPTIONS, I_MENU_SAVED_OPTIONS, @@ -170,12 +172,19 @@ type I_MENU_TEAM_HIT_PROJECTILE, I_MENU_TEAM_HIT_NOTHING, I_MENU_ITEM_RESPAWN_TIME, + I_MENU_ITEM_RESPAWN_RANDOM, + I_MENU_ITEM_RANDOM_ALL, + I_MENU_ITEM_RANDOM_HELP_ONLY, + I_MENU_ITEM_RANDOM_AMMO_ONLY, + I_MENU_ITEM_RANDOM_WEAPON_ONLY, + I_MENU_ITEM_RANDOM_NOTHING, I_MENU_DEATHMATCH_KEYS, I_MENU_ENABLE_EXITS, I_MENU_WEAPONS_STAY, I_MENU_ENABLE_TEAM_DAMAGE_ABSOBR, I_MENU_ENABLE_MONSTERS, I_MENU_ENABLE_RULEZ_RANDOM, + I_MENU_ENABLE_ITEM_RANDOM, I_MENU_RULEZ_RESPAWN_TIME, I_MENU_RULEZ_RESPAWN_RANDOM, I_MENU_BOTS_VS, @@ -901,6 +910,10 @@ const 'Ïðèñîåäèíèòüñÿ'), ('MENU SELECT MAP', 'Map', 'ÊÀÐÒÀ'), + ('MENU SELECT ITEM RESPAWN', 'Items Respawn Settings', + 'Íàñòðîèòü ðåñïàóí ïðåäìåòîâ'), + ('MENU ITEM RESPAWN', 'Items Respawn Settings', + 'Íàñòðîéêà ðåñïàóíà ïðåäìåòîâ'), ('MENU VIDEO OPTIONS', 'Video', 'ÂÈÄÅÎ'), ('MENU SOUND OPTIONS', 'Sound', @@ -979,6 +992,18 @@ const 'Íè÷åì'), ('MENU ITEM RESPAWN TIME', 'Item respawn time:', 'Âðåìÿ ðåñïàâíà ïðåäìåòîâ:'), + ('MENU ITEM RESPAWN RANDOM', 'Additive time for item timer:', + 'Äîïîëíèòåëüíûé ÷èñëî ê òàéìåðó ïðåäìåòîâ:'), + ('MENU ITEM RESPAWN ALL', 'For all items', + 'Âñå ïðåäìåòû'), + ('MENU ITEM RESPAWN HELP ONLY', 'For help items only', + 'Òîëüêî âñïîìîãàòåëüíîå'), + ('MENU ITEM RESPAWN AMMO ONLY', 'For ammo only', + 'Òîëüêî áîåïðèïàñû'), + ('MENU ITEM RESPAWN WEAPON ONLY', 'For weapons only', + 'Òîëüêî îðóæèå'), + ('MENU ITEM RESPAWN NOTHING', 'Nothing', + 'Íè÷åãî'), ('MENU DEATHMATCH KEYS', 'Give all keys in DM:', 'Âñå êëþ÷è â DM:'), ('MENU ENABLE EXITS', 'Enable Exit:', @@ -991,6 +1016,8 @@ const 'Ìîíñòðû:'), ('MENU ENABLE RULEZ RANDOM', 'Enable random powerup respawn:', 'Ðàíäîìíûé ðåñïàóí ïîâåðàïîâ:'), + ('MENU ENABLE ITEM RANDOM', 'Enable item powerup respawn:', + 'Ðàíäîìíûé ðåñïàóí ïðåäìåòîâ:'), ('MENU RULEZ RESPAWN TIME', 'Powerup respawn time:', 'Âðåìÿ ðåñïàóíà ïîâåðàïîâ:'), ('MENU RULEZ RESPAWN RANDOM', 'Additive time for powerup timer:', diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index d9a8c6d..8cd9363 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -735,9 +735,6 @@ begin gsTimeLimit := StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0); gsScoreLimit := StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0); gsMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0); - gsItemRespawnTime := StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0); - gsRulezRespawnTime := StrToIntDef(TGUIEdit(GetControl('edRulezRespawnTime')).Text, 0); - gsRulezRespawnRandom := StrToIntDef(TGUIEdit(GetControl('edRulezRespawnRandom')).Text, 0); gsPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex; gsMap := Map; @@ -754,8 +751,6 @@ begin 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; @@ -775,12 +770,34 @@ begin else gsGameFlags := gsGameFlags and not (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG); end; + // TODO: get this crap out of here + gGameSettings.WarmupTime := gsWarmupTime; + gGameSettings.SpawnInvul := gsSpawnInvul; + end; + + // HACK: We keep the variables for the items in a different menu + with TGUIMenu(g_GUI_GetWindow('ItemsRespawnMenu').GetControl('mItemsRespawnMenu')) do + begin + gsItemRespawnTime := StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0); + gsItemRespawnRandom := StrToIntDef(TGUIEdit(GetControl('edItemRespawnRandom')).Text, 0); + gsRulezRespawnTime := StrToIntDef(TGUIEdit(GetControl('edRulezRespawnTime')).Text, 0); + gsRulezRespawnRandom := StrToIntDef(TGUIEdit(GetControl('edRulezRespawnRandom')).Text, 0); + + if TGUISwitch(GetControl('swRulezRandom')).ItemIndex = 0 then + gsGameFlags := gsGameFlags or GAME_OPTION_RULEZRANDOM; + + case TGUISwitch(GetControl('swItemsRandom')).ItemIndex of + 1: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMHELPRANDOM; + 2: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMAMMORANDOM; + 3: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMWEAPONRANDOM; + 0: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMALLRANDOM; + end; + // TODO: get this crap out of here gGameSettings.ItemRespawnTime := gsItemRespawnTime; + gGameSettings.ItemRespawnRandom := gsItemRespawnRandom; gGameSettings.RulezRespawnTime := gsRulezRespawnTime; gGameSettings.RulezRespawnRandom := gsRulezRespawnRandom; - gGameSettings.WarmupTime := gsWarmupTime; - gGameSettings.SpawnInvul := gsSpawnInvul; end; end; @@ -1740,6 +1757,15 @@ begin end; end; +procedure ProcItemsRespawnMenu(); +var + menu: TGUIMenu; +begin + menu := TGUIMenu(g_GUI_GetWindow('ItemsRespawnMenu').GetControl('mItemsRespawnMenu')); + + g_GUI_ShowWindow('ItemsRespawnMenu'); +end; + procedure ReadGameSettings(); var menu: TGUIMenu; @@ -2324,43 +2350,11 @@ begin if gsMaxLives > 0 then Text := IntToStr(gsMaxLives); end; - with AddEdit(_lc[I_MENU_ITEM_RESPAWN_TIME]) do - begin - Name := 'edItemRespawnTime'; - OnlyDigits := True; - Width := 4; - MaxLength := 5; - if gsItemRespawnTime > 0 then - Text := IntToStr(gsItemRespawnTime); - end; - AddSpace(); // Rulez Respawn block - with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_TIME]) do - begin - Name := 'edRulezRespawnTime'; - OnlyDigits := True; - Width := 4; - MaxLength := 5; - 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 + with AddLabel(_lc[I_MENU_SELECT_ITEM_RESPAWN]) 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; + Name := 'lbItemsRespawn'; + FixedLength := 16; + OnClick := @ProcItemsRespawnMenu; end; AddSpace(); with AddSwitch(_lc[I_MENU_PLAYERS]) do @@ -2612,43 +2606,11 @@ begin if gsMaxLives > 0 then Text := IntToStr(gsMaxLives); end; - with AddEdit(_lc[I_MENU_ITEM_RESPAWN_TIME]) do + with AddLabel(_lc[I_MENU_SELECT_ITEM_RESPAWN]) do begin - Name := 'edItemRespawnTime'; - OnlyDigits := True; - Width := 4; - MaxLength := 5; - if gsItemRespawnTime > 0 then - Text := IntToStr(gsItemRespawnTime); - end; - AddSpace(); // Rulez Respawn block - with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_TIME]) do - begin - Name := 'edRulezRespawnTime'; - OnlyDigits := True; - Width := 4; - MaxLength := 5; - 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; + Name := 'lbItemsRespawn'; + FixedLength := 16; + OnClick := @ProcItemsRespawnMenu; end; AddSpace(); with AddSwitch(_lc[I_MENU_PLAYERS]) do @@ -2899,6 +2861,84 @@ begin Menu.DefControl := 'mSelectMapMenu'; g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('ItemsRespawnMenu'); + with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_ITEM_RESPAWN]))) do + begin + Name := 'mItemsRespawnMenu'; + + // Switches separate from the time entry fields + 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_ENABLE_ITEM_RANDOM]) do + begin + Name := 'swItemsRandom'; + AddItem(_lc[I_MENU_ITEM_RANDOM_ALL]); + AddItem(_lc[I_MENU_ITEM_RANDOM_HELP_ONLY]); + AddItem(_lc[I_MENU_ITEM_RANDOM_AMMO_ONLY]); + AddItem(_lc[I_MENU_ITEM_RANDOM_WEAPON_ONLY]); + AddItem(_lc[I_MENU_ITEM_RANDOM_NOTHING]); + if LongBool(gsGameFlags and GAME_OPTION_ITEMALLRANDOM) then + ItemIndex := 0 + else if LongBool(gsGameFlags and GAME_OPTION_ITEMHELPRANDOM) then + ItemIndex := 1 + else if LongBool(gsGameFlags and GAME_OPTION_ITEMAMMORANDOM) then + ItemIndex := 2 + else if LongBool(gsGameFlags and GAME_OPTION_ITEMWEAPONRANDOM) then + ItemIndex := 3 + else + ItemIndex := 4; + end; + AddSpace();// Items Respawn block + with AddEdit(_lc[I_MENU_ITEM_RESPAWN_TIME]) do + begin + Name := 'edItemRespawnTime'; + OnlyDigits := True; + Width := 4; + MaxLength := 5; + if gsItemRespawnTime > 0 then + Text := IntToStr(gsItemRespawnTime); + end; + with AddEdit(_lc[I_MENU_ITEM_RESPAWN_RANDOM]) do + begin + Name := 'edItemRespawnRandom'; + OnlyDigits := True; + Width := 4; + MaxLength := 5; + if gsItemRespawnTime > 0 then + Text := IntToStr(gsItemRespawnRandom); + end; + // Rulez Respawn block + with AddEdit(_lc[I_MENU_RULEZ_RESPAWN_TIME]) do + begin + Name := 'edRulezRespawnTime'; + OnlyDigits := True; + Width := 4; + MaxLength := 5; + 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; + AddSpace(); + end; + Menu.DefControl := 'mItemsRespawnMenu'; + g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('OptionsMenu'); with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_OPTIONS]))) do begin diff --git a/src/game/g_options.pas b/src/game/g_options.pas index b015319..13033d2 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -74,6 +74,7 @@ var gsGameFlags: LongWord; gsSpawnInvul: Integer = 0; gsItemRespawnTime: Word = 60; + gsItemRespawnRandom: Word = 0; gsRulezRespawnTime: Word = 60; gsRulezRespawnRandom: Word = 0; gsWarmupTime: Word = 30; @@ -269,6 +270,7 @@ begin gsPlayers := 1; gsSpawnInvul := 0; gsItemRespawnTime := 60; + gsItemRespawnRandom := 0; gsRulezRespawnTime := 60; gsRulezRespawnRandom := 0; gsGameFlags := GAME_OPTION_ALLOWEXIT or GAME_OPTION_DMKEYS or @@ -319,6 +321,7 @@ begin MaxLives := gsMaxLives; SpawnInvul := gsSpawnInvul; ItemRespawnTime := gsItemRespawnTime; + ItemRespawnRandom := gsItemRespawnRandom; RulezRespawnTime := gsRulezRespawnTime; RulezRespawnRandom := gsRulezRespawnRandom; WarmupTime := gsWarmupTime;