summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67d37ea)
raw | patch | inline | side by side (parent: 67d37ea)
author | Dmitry D. Chernov <blackdoomer@yandex.ru> | |
Sun, 12 Nov 2023 22:10:01 +0000 (08:10 +1000) | ||
committer | Dmitry D. Chernov <blackdoomer@yandex.ru> | |
Sun, 12 Nov 2023 22:10:01 +0000 (08:10 +1000) |
12 files changed:
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 20b2b539d4757270aac580bf7bf4e51709ed7530..f7998c78544fed57150e8bebd5d64513c5900d32 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
procedure g_Console_WriteConfig (filename: String);
var f: TextFile; i, j: Integer;
- procedure WriteFlag(name: string; flag: LongWord);
+ procedure WriteFlag(name: string; flag: TGameOption);
begin
- WriteLn(f, name, IfThen(LongBool(gsGameFlags and flag), 1, 0));
+ WriteLn(f, name, Ord(flag in gsGameFlags));
end;
function FormatTeam(team: Byte): string;
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_powerup_randomize_respawn ', GAME_OPTION_POWERUPRANDOM);
- WriteFlag('g_items_all_respawn_random ', GAME_OPTION_ITEMALLRANDOM);
- WriteFlag('g_items_help_respawn_random ', GAME_OPTION_ITEMHELPRANDOM);
- WriteFlag('g_items_ammo_respawn_random ', GAME_OPTION_ITEMAMMORANDOM);
- WriteFlag('g_items_weapon_respawn_random ', GAME_OPTION_ITEMWEAPONRANDOM);
- WriteFlag('g_allow_exit ', GAME_OPTION_ALLOWEXIT);
- WriteFlag('g_allow_monsters ', GAME_OPTION_MONSTERS);
- WriteFlag('g_allow_dropflag ', GAME_OPTION_ALLOWDROPFLAG);
- WriteFlag('g_throw_flag ', GAME_OPTION_THROWFLAG);
- WriteFlag('g_dm_keys ', GAME_OPTION_DMKEYS);
- WriteFlag('g_weaponstay ', GAME_OPTION_WEAPONSTAY);
- WriteFlag('g_bot_vsmonsters ', GAME_OPTION_BOTVSMONSTER);
- WriteFlag('g_bot_vsplayers ', GAME_OPTION_BOTVSPLAYER);
+ WriteFlag('g_friendlyfire ', TGameOption.TEAM_DAMAGE);
+ WriteFlag('g_friendly_hit_trace ', TGameOption.TEAM_HIT_TRACE);
+ WriteFlag('g_friendly_hit_projectile ', TGameOption.TEAM_HIT_PROJECTILE);
+ WriteFlag('g_powerup_randomize_respawn ', TGameOption.POWERUP_RANDOM);
+ WriteFlag('g_items_all_respawn_random ', TGameOption.ITEM_ALL_RANDOM);
+ WriteFlag('g_items_help_respawn_random ', TGameOption.ITEM_LIFE_RANDOM);
+ WriteFlag('g_items_ammo_respawn_random ', TGameOption.ITEM_AMMO_RANDOM);
+ WriteFlag('g_items_weapon_respawn_random ', TGameOption.ITEM_WEAPON_RANDOM);
+ WriteFlag('g_allow_exit ', TGameOption.ALLOW_EXIT);
+ WriteFlag('g_allow_monsters ', TGameOption.MONSTERS);
+ WriteFlag('g_allow_dropflag ', TGameOption.ALLOW_DROP_FLAG);
+ WriteFlag('g_throw_flag ', TGameOption.THROW_FLAG);
+ WriteFlag('g_dm_keys ', TGameOption.DM_KEYS);
+ WriteFlag('g_weaponstay ', TGameOption.WEAPONS_STAY);
+ WriteFlag('g_bot_vsmonsters ', TGameOption.BOTS_VS_MONSTERS);
+ WriteFlag('g_bot_vsplayers ', TGameOption.BOTS_VS_PLAYERS);
// players
with gPlayer1Settings do
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 110fbe47c7e7435e82d8b5bede3ca16572e5f73f..824595b850be4297c8199295f4f1d7b8c9f73cc0 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
g_touch, g_weapons;
type
+ TGameOption = (
+ //RESERVED = 0, // FIXME: reuse for something
+ TEAM_DAMAGE = 1,
+ ALLOW_EXIT,
+ WEAPONS_STAY,
+ MONSTERS,
+ BOTS_VS_PLAYERS,
+ BOTS_VS_MONSTERS,
+ DM_KEYS,
+ TEAM_HIT_TRACE,
+ TEAM_HIT_PROJECTILE,
+ TEAM_ABSORB_DAMAGE,
+ ALLOW_DROP_FLAG,
+ THROW_FLAG,
+ POWERUP_RANDOM,
+ ITEM_ALL_RANDOM,
+ ITEM_LIFE_RANDOM,
+ ITEM_AMMO_RANDOM,
+ ITEM_WEAPON_RANDOM
+ );
+ TGameOptions = set of TGameOption;
+
TGameSettings = record
GameType: Byte;
GameMode: Byte;
PowerupRespawnTime: Word;
PowerupRespawnRandom: Word;
MaxLives: Byte;
- Options: LongWord;
+ Options: TGameOptions;
WAD: String;
end;
procedure g_Game_Spectate();
procedure g_Game_SpectateCenterView();
procedure g_Game_StartSingle(Map: String; TwoPlayers: Boolean; nPlayers: Byte);
-procedure g_Game_StartCustom(Map: String; GameMode: Byte; TimeLimit, ScoreLimit: Word; MaxLives: Byte; Options: LongWord; nPlayers: Byte);
-procedure g_Game_StartServer(Map: String; GameMode: Byte; TimeLimit, ScoreLimit: Word; MaxLives: Byte; Options: LongWord; nPlayers: Byte; IPAddr: LongWord; Port: Word);
+procedure g_Game_StartCustom(Map: String; GameMode: Byte; TimeLimit, ScoreLimit: Word; MaxLives: Byte; Options: TGameOptions; nPlayers: Byte);
+procedure g_Game_StartServer(Map: String; GameMode: Byte; TimeLimit, ScoreLimit: Word; MaxLives: Byte; Options: TGameOptions; nPlayers: Byte; IPAddr: LongWord; Port: Word);
procedure g_Game_StartClient(Addr: String; Port: Word; PW: String);
procedure g_Game_Restart();
procedure g_Game_RestartLevel();
EXIT_ENDLEVELSINGLE = 4;
EXIT_ENDLEVELCUSTOM = 5;
- GAME_OPTION_RESERVED = 1 shl 0;
- GAME_OPTION_TEAMDAMAGE = 1 shl 1;
- GAME_OPTION_ALLOWEXIT = 1 shl 2;
- GAME_OPTION_WEAPONSTAY = 1 shl 3;
- GAME_OPTION_MONSTERS = 1 shl 4;
- GAME_OPTION_BOTVSPLAYER = 1 shl 5;
- GAME_OPTION_BOTVSMONSTER = 1 shl 6;
- GAME_OPTION_DMKEYS = 1 shl 7;
- GAME_OPTION_TEAMHITTRACE = 1 shl 8;
- GAME_OPTION_TEAMHITPROJECTILE = 1 shl 9;
- GAME_OPTION_TEAMABSORBDAMAGE = 1 shl 10;
- GAME_OPTION_ALLOWDROPFLAG = 1 shl 11;
- GAME_OPTION_THROWFLAG = 1 shl 12;
- GAME_OPTION_POWERUPRANDOM = 1 shl 13;
- GAME_OPTION_ITEMALLRANDOM = 1 shl 14;
- GAME_OPTION_ITEMHELPRANDOM = 1 shl 15;
- GAME_OPTION_ITEMAMMORANDOM = 1 shl 16;
- GAME_OPTION_ITEMWEAPONRANDOM = 1 shl 17;
-
STATE_NONE = 0;
STATE_MENU = 1;
STATE_FOLD = 2;
procedure SaveGameStat(Stat: TEndCustomGameStat; Path: string);
var
s: TextFile;
- dir, fname, map, mode, etime: String;
+ dir, fname, map, mode, etime, flags, strf: String;
+ flag: TGameOption;
I: Integer;
begin
try
(Stat.GameTime div 1000 div 60) mod 60,
Stat.GameTime div 1000 mod 60
]);
+ flags := '';
+ strf := '';
+ for flag in gGameSettings.Options do
+ begin
+ flags += strf;
+ System.WriteStr(strf, flag); // FIXME: rename our utils.WriteStr()
+ flags += strf;
+ strf := ', ';
+ end;
WriteLn(s, 'stats_ver,datetime,server,map,mode,timelimit,scorelimit,dmflags,time,num_players');
- WriteLn(s, Format('%d,%s,%s,%s,%s,%u,%u,%u,%s,%d', [
+ WriteLn(s, Format('%d,%s,%s,%s,%s,%u,%u,"%s",%s,%d', [
STATFILE_VERSION,
StatDate,
dquoteStr(fname),
mode,
gGameSettings.TimeLimit,
gGameSettings.ScoreLimit,
- gGameSettings.Options,
+ flags,
etime,
Length(Stat.PlayerStat)
]));
gShowMap := False;
gGameSettings.GameType := GT_SINGLE;
gGameSettings.MaxLives := 0;
- gGameSettings.Options := GAME_OPTION_ALLOWEXIT
- or GAME_OPTION_MONSTERS
- or GAME_OPTION_BOTVSMONSTER
- or GAME_OPTION_TEAMHITPROJECTILE
- or GAME_OPTION_TEAMHITTRACE
- or GAME_OPTION_POWERUPRANDOM
- or GAME_OPTION_ITEMALLRANDOM
- or GAME_OPTION_ITEMHELPRANDOM
- or GAME_OPTION_ITEMAMMORANDOM
- or GAME_OPTION_ITEMWEAPONRANDOM;
+ gGameSettings.Options := [TGameOption.ALLOW_EXIT, TGameOption.MONSTERS,
+ TGameOption.BOTS_VS_MONSTERS, TGameOption.TEAM_HIT_PROJECTILE, TGameOption.TEAM_HIT_TRACE,
+ TGameOption.POWERUP_RANDOM, TGameOption.ITEM_ALL_RANDOM, TGameOption.ITEM_LIFE_RANDOM,
+ TGameOption.ITEM_AMMO_RANDOM, TGameOption.ITEM_WEAPON_RANDOM];
gSwitchGameMode := GM_SINGLE;
gLMSRespawn := LMS_RESPAWN_NONE;
procedure g_Game_StartCustom(Map: String; GameMode: Byte;
TimeLimit, ScoreLimit: Word;
MaxLives: Byte;
- Options: LongWord; nPlayers: Byte);
+ Options: TGameOptions; nPlayers: Byte);
var
i, nPl: Integer;
begin
procedure g_Game_StartServer(Map: String; GameMode: Byte;
TimeLimit, ScoreLimit: Word; MaxLives: Byte;
- Options: LongWord; nPlayers: Byte;
+ Options: TGameOptions; nPlayers: Byte;
IPAddr: LongWord; Port: Word);
begin
g_Game_Free();
gGameSettings.ScoreLimit := InMsg.ReadWord();
gGameSettings.TimeLimit := InMsg.ReadWord();
gGameSettings.MaxLives := InMsg.ReadByte();
- gGameSettings.Options := InMsg.ReadLongWord();
+ gGameSettings.Options := TGameOptions(InMsg.ReadLongWord());
T := InMsg.ReadLongWord();
//newResPath := g_Res_SearchSameWAD(MapsDir, WadName, gWADHash);
cmd: string;
it: PItem;
- procedure ParseGameFlag(Flag: LongWord; OffMsg, OnMsg: TStrings_Locale; OnMapChange: Boolean = False);
+ procedure ParseGameFlag(Flag: TGameOption; OffMsg, OnMsg: TStrings_Locale; OnMapChange: Boolean = False);
var
x: Boolean;
begin
- if Length(P) > 1 then
+ if Length(P) <= 1 then
+ x := Flag in gsGameFlags
+ else
begin
x := P[1] = '1';
- if x then
- gsGameFlags := gsGameFlags or Flag
- else
- gsGameFlags := gsGameFlags and (not Flag);
+ if x
+ then gsGameFlags += [Flag]
+ else gsGameFlags -= [Flag];
if g_Game_IsServer then
begin
- if x then
- gGameSettings.Options := gGameSettings.Options or Flag
- else
- gGameSettings.Options := gGameSettings.Options and (not Flag);
+ if x
+ then gGameSettings.Options += [Flag]
+ else gGameSettings.Options -= [Flag];
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end;
- if LongBool(gsGameFlags and Flag) then
- g_Console_Add(_lc[OnMsg])
- else
- g_Console_Add(_lc[OffMsg]);
+ if x
+ then g_Console_Add(_lc[OnMsg])
+ else g_Console_Add(_lc[OffMsg]);
if OnMapChange and g_Game_IsServer then
g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end;
'g_friendlyfire':
- ParseGameFlag(GAME_OPTION_TEAMDAMAGE, I_MSG_FRIENDLY_FIRE_OFF, I_MSG_FRIENDLY_FIRE_ON);
+ ParseGameFlag(TGameOption.TEAM_DAMAGE, I_MSG_FRIENDLY_FIRE_OFF, I_MSG_FRIENDLY_FIRE_ON);
'g_friendly_absorb_damage':
- ParseGameFlag(GAME_OPTION_TEAMABSORBDAMAGE, I_MSG_FRIENDLY_ABSORB_DAMAGE_OFF, I_MSG_FRIENDLY_ABSORB_DAMAGE_ON);
+ ParseGameFlag(TGameOption.TEAM_ABSORB_DAMAGE, I_MSG_FRIENDLY_ABSORB_DAMAGE_OFF, I_MSG_FRIENDLY_ABSORB_DAMAGE_ON);
'g_friendly_hit_trace':
- ParseGameFlag(GAME_OPTION_TEAMHITTRACE, I_MSG_FRIENDLY_HIT_TRACE_OFF, I_MSG_FRIENDLY_HIT_TRACE_ON);
+ ParseGameFlag(TGameOption.TEAM_HIT_TRACE, I_MSG_FRIENDLY_HIT_TRACE_OFF, I_MSG_FRIENDLY_HIT_TRACE_ON);
'g_friendly_hit_projectile':
- ParseGameFlag(GAME_OPTION_TEAMHITPROJECTILE, I_MSG_FRIENDLY_PROJECT_TRACE_OFF, I_MSG_FRIENDLY_PROJECT_TRACE_ON);
+ ParseGameFlag(TGameOption.TEAM_HIT_PROJECTILE, I_MSG_FRIENDLY_PROJECT_TRACE_OFF, I_MSG_FRIENDLY_PROJECT_TRACE_ON);
'g_items_all_respawn_random':
- ParseGameFlag(GAME_OPTION_ITEMALLRANDOM, I_MSG_ITEM_ALL_RANDOM_OFF, I_MSG_ITEM_ALL_RANDOM_ON, False);
+ ParseGameFlag(TGameOption.ITEM_ALL_RANDOM, I_MSG_ITEM_ALL_RANDOM_OFF, I_MSG_ITEM_ALL_RANDOM_ON, False);
'g_items_help_respawn_random':
- ParseGameFlag(GAME_OPTION_ITEMHELPRANDOM, I_MSG_ITEM_HELP_RANDOM_OFF, I_MSG_ITEM_HELP_RANDOM_ON, False);
+ ParseGameFlag(TGameOption.ITEM_LIFE_RANDOM, I_MSG_ITEM_LIFE_RANDOM_OFF, I_MSG_ITEM_LIFE_RANDOM_ON, False);
'g_items_ammo_respawn_random':
- ParseGameFlag(GAME_OPTION_ITEMAMMORANDOM, I_MSG_ITEM_AMMO_RANDOM_OFF, I_MSG_ITEM_AMMO_RANDOM_ON, False);
+ ParseGameFlag(TGameOption.ITEM_AMMO_RANDOM, I_MSG_ITEM_AMMO_RANDOM_OFF, I_MSG_ITEM_AMMO_RANDOM_ON, False);
'g_items_weapon_respawn_random':
- ParseGameFlag(GAME_OPTION_ITEMWEAPONRANDOM, I_MSG_ITEM_WEAPON_RANDOM_OFF, I_MSG_ITEM_WEAPON_RANDOM_ON);
+ ParseGameFlag(TGameOption.ITEM_WEAPON_RANDOM, I_MSG_ITEM_WEAPON_RANDOM_OFF, I_MSG_ITEM_WEAPON_RANDOM_ON);
'g_powerup_randomize_respawn':
- ParseGameFlag(GAME_OPTION_POWERUPRANDOM, I_MSG_POWERUP_RANDOM_OFF, I_MSG_POWERUP_RANDOM_ON, False);
+ ParseGameFlag(TGameOption.POWERUP_RANDOM, I_MSG_POWERUP_RANDOM_OFF, I_MSG_POWERUP_RANDOM_ON, False);
'g_weaponstay':
- ParseGameFlag(GAME_OPTION_WEAPONSTAY, I_MSG_WEAPONSTAY_OFF, I_MSG_WEAPONSTAY_ON);
+ ParseGameFlag(TGameOption.WEAPONS_STAY, I_MSG_WEAPONSTAY_OFF, I_MSG_WEAPONSTAY_ON);
'g_allow_exit':
- ParseGameFlag(GAME_OPTION_ALLOWEXIT, I_MSG_ALLOWEXIT_OFF, I_MSG_ALLOWEXIT_ON, True);
+ ParseGameFlag(TGameOption.ALLOW_EXIT, I_MSG_ALLOWEXIT_OFF, I_MSG_ALLOWEXIT_ON, True);
'g_allow_monsters':
- ParseGameFlag(GAME_OPTION_MONSTERS, I_MSG_ALLOWMON_OFF, I_MSG_ALLOWMON_ON, True);
+ ParseGameFlag(TGameOption.MONSTERS, I_MSG_ALLOWMON_OFF, I_MSG_ALLOWMON_ON, True);
'g_allow_dropflag':
- ParseGameFlag(GAME_OPTION_ALLOWDROPFLAG, I_MSG_ALLOWDROPFLAG_OFF, I_MSG_ALLOWDROPFLAG_ON);
+ ParseGameFlag(TGameOption.ALLOW_DROP_FLAG, I_MSG_ALLOWDROPFLAG_OFF, I_MSG_ALLOWDROPFLAG_ON);
'g_throw_flag':
- ParseGameFlag(GAME_OPTION_THROWFLAG, I_MSG_THROWFLAG_OFF, I_MSG_THROWFLAG_ON);
+ ParseGameFlag(TGameOption.THROW_FLAG, I_MSG_THROWFLAG_OFF, I_MSG_THROWFLAG_ON);
'g_bot_vsplayers':
- ParseGameFlag(GAME_OPTION_BOTVSPLAYER, I_MSG_BOTSVSPLAYERS_OFF, I_MSG_BOTSVSPLAYERS_ON);
+ ParseGameFlag(TGameOption.BOTS_VS_PLAYERS, I_MSG_BOTSVSPLAYERS_OFF, I_MSG_BOTSVSPLAYERS_ON);
'g_bot_vsmonsters':
- ParseGameFlag(GAME_OPTION_BOTVSMONSTER, I_MSG_BOTSVSMONSTERS_OFF, I_MSG_BOTSVSMONSTERS_ON);
+ ParseGameFlag(TGameOption.BOTS_VS_MONSTERS, I_MSG_BOTSVSMONSTERS_OFF, I_MSG_BOTSVSMONSTERS_ON);
'g_dm_keys':
- ParseGameFlag(GAME_OPTION_DMKEYS, I_MSG_DMKEYS_OFF, I_MSG_DMKEYS_ON, True);
+ ParseGameFlag(TGameOption.DM_KEYS, I_MSG_DMKEYS_OFF, I_MSG_DMKEYS_ON, True);
'g_gameflags': begin
if Length(P) > 1 then
begin
- gsGameFlags := StrToDWordDef(P[1], gsGameFlags);
+ gsGameFlags := TGameOptions(StrToDWordDef(P[1], LongWord(gsGameFlags)));
if g_Game_IsServer then
begin
gGameSettings.Options := gsGameFlags;
end;
end;
- g_Console_Add(Format('%s %u', [cmd, gsGameFlags]));
+ g_Console_Add(Format('%s %u', [cmd, LongWord(gsGameFlags)]));
end;
'g_warmup_time': begin
map: String;
GMode, n: Byte;
LimT, LimS: Integer;
- Opt: LongWord;
+ Opt: TGameOptions;
Lives: Integer;
s: String;
Port: Integer;
// Options:
s := Find_Param_Value(pars, '-opt');
- if (s = '') then
- Opt := gsGameFlags
- else
- Opt := StrToIntDef(s, 0);
+ if (s = '')
+ then Opt := gsGameFlags
+ else Opt := TGameOptions(StrToIntDef(s, 0));
// Close after map:
s := Find_Param_Value(pars, '--close');
// Start:
s := Find_Param_Value(pars, '-port');
- if (s = '') or not TryStrToInt(s, Port) then
- g_Game_StartCustom(map, GMode, LimT, LimS, Lives, Opt, n)
- else
- g_Game_StartServer(map, GMode, LimT, LimS, Lives, Opt, n, 0, Port);
+ if (s = '') or not TryStrToInt(s, Port)
+ then g_Game_StartCustom(map, GMode, LimT, LimS, Lives, Opt, n)
+ else g_Game_StartServer(map, GMode, LimT, LimS, Lives, Opt, n, 0, Port);
end;
// Execute script when game loads:
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index 9784d39d5384ba29959e89b7daad1397b5feba6f..b3d8522465bc8b6da4c182b4ef7586e2a1130020 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
procedure g_Items_Pick (ID: DWORD);
begin
- if (ID < Length(ggItems)) then
- begin
- ggItems[ID].Obj.oldX := ggItems[ID].Obj.X;
- ggItems[ID].Obj.oldY := ggItems[ID].Obj.Y;
- ggItems[ID].alive := false;
+ if ID >= Length(ggItems) then exit;
- // Items respawn timer
- ggItems[ID].RespawnTime := IfThen(gLMSRespawn = LMS_RESPAWN_NONE, gGameSettings.ItemRespawnTime, 15) * 36;
+ ggItems[ID].Obj.oldX := ggItems[ID].Obj.X;
+ ggItems[ID].Obj.oldY := ggItems[ID].Obj.Y;
+ ggItems[ID].alive := false;
- // Powerup 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.PowerupRespawnTime, 15) * 36;
- end;
+ // Items respawn timer
+ ggItems[ID].RespawnTime := IfThen(gLMSRespawn = LMS_RESPAWN_NONE, gGameSettings.ItemRespawnTime, 15) * 36;
- // #### Random powerup respawn ####
- if LongBool(gGameSettings.Options and GAME_OPTION_POWERUPRANDOM) 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.PowerupRespawnTime +
- RandomRange(-gGameSettings.PowerupRespawnRandom, gGameSettings.PowerupRespawnRandom + 1)) * 36);
- //e_logwritefln ('Randomized powerup %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
- end;
- end;
+ // Powerup 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.PowerupRespawnTime, 15) * 36;
+ end;
- // #### Random item respawn ####
- // Randomize respawn for all items (excluding powerups)
- 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_SUPERCHAINGUN,
- ITEM_WEAPON_FLAMETHROWER] then
- begin
- ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime + RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36);
- //e_logwritefln ('Randomized item %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
- end;
- end;
+ // #### Random powerup respawn ####
+ if (TGameOption.POWERUP_RANDOM in gGameSettings.Options) and (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.PowerupRespawnTime +
+ RandomRange(-gGameSettings.PowerupRespawnRandom, gGameSettings.PowerupRespawnRandom + 1)) * 36);
+ //e_logwritefln ('Randomized powerup %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
+ 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 %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
- end;
- end;
+ // #### Random item respawn ####
+ // Randomize respawn for all items (excluding powerups)
+ if (TGameOption.ITEM_ALL_RANDOM in gGameSettings.Options) and (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_SUPERCHAINGUN, ITEM_WEAPON_FLAMETHROWER
+ ]) then
+ begin
+ ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime +
+ RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36);
+ //e_logwritefln ('Randomized item %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
+ 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 %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
- end;
- end;
+ // Randomize respawn for heal/armor
+ if (TGameOption.ITEM_LIFE_RANDOM in gGameSettings.Options) and (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 %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
+ 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_SUPERCHAINGUN, ITEM_WEAPON_FLAMETHROWER] then
- begin
- ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime + RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36);
- //e_logwritefln ('Randomized weapon %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
- end;
- end;
+ // Randomize respawn for ammo
+ if (TGameOption.ITEM_AMMO_RANDOM in gGameSettings.Options) and (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 %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
+ end;
+
+ // Randomize respawn for weapons
+ if (TGameOption.ITEM_WEAPON_RANDOM in gGameSettings.Options) and (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_SUPERCHAINGUN,
+ ITEM_WEAPON_FLAMETHROWER
+ ]) then
+ begin
+ ggItems[ID].RespawnTime := Max(1, (gGameSettings.ItemRespawnTime +
+ RandomRange(-gGameSettings.ItemRespawnRandom, gGameSettings.ItemRespawnRandom + 1)) * 36);
+ //e_logwritefln ('Randomized weapon %s time: %s', [ggItems[ID].ItemType, ggItems[ID].RespawnTime]);
end;
end;
index 424e553cc7beb593ef8b8d4d5c53c1bfb830d91f..8e8c5dd5e8d9f82061c7f0e903172dfb581f60d0 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
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_LIFE_ONLY,
I_MENU_ITEM_RANDOM_AMMO_ONLY,
I_MENU_ITEM_RANDOM_WEAPON_ONLY,
- I_MENU_ITEM_RANDOM_HELP_AMMO,
- I_MENU_ITEM_RANDOM_HELP_WEAPON,
+ I_MENU_ITEM_RANDOM_LIFE_AMMO,
+ I_MENU_ITEM_RANDOM_LIFE_WEAPON,
I_MENU_ITEM_RANDOM_WEAPON_AMMO,
I_MENU_ITEM_RANDOM_NOTHING,
I_MENU_DEATHMATCH_KEYS,
I_MSG_POWERUP_RANDOM_OFF,
I_MSG_ITEM_ALL_RANDOM_ON,
I_MSG_ITEM_ALL_RANDOM_OFF,
- I_MSG_ITEM_HELP_RANDOM_ON,
- I_MSG_ITEM_HELP_RANDOM_OFF,
+ I_MSG_ITEM_LIFE_RANDOM_ON,
+ I_MSG_ITEM_LIFE_RANDOM_OFF,
I_MSG_ITEM_AMMO_RANDOM_ON,
I_MSG_ITEM_AMMO_RANDOM_OFF,
I_MSG_ITEM_WEAPON_RANDOM_ON,
'Ðàçáðîñ îòñ÷¸òà äëÿ ïðåäìåòîâ:'),
('MENU ITEM RESPAWN ALL', 'For all items',
'Âñå ðàçëîæåííûå'),
- ('MENU ITEM RESPAWN HELP ONLY', 'For life-saving items only',
+ ('MENU ITEM RESPAWN LIFE ONLY', 'For life-saving items only',
'Òîëüêî ïîäêðåïëåíèÿ'),
('MENU ITEM RESPAWN AMMO ONLY', 'For ammo only',
'Òîëüêî áîåïðèïàñû'),
('MENU ITEM RESPAWN WEAPON ONLY', 'For weapons only',
'Òîëüêî îðóæèå'),
- ('MENU ITEM RESPAWN HELP AMMO', 'For life-saving items and ammo',
+ ('MENU ITEM RESPAWN LIFE AMMO', 'For life-saving items and ammo',
'Ïîäêðåïëåíèÿ è áîåïðèïàñû'),
- ('MENU ITEM RESPAWN HELP WEAPON', 'For life-saving items and weapons',
+ ('MENU ITEM RESPAWN LIFE WEAPON', 'For life-saving items and weapons',
'Ïîäêðåïëåíèÿ è îðóæèå'),
('MENU ITEM RESPAWN WEAPON AMMO', 'For weapons and ammo',
'Îðóæèå è áîåïðèïàñû'),
'Ñëó÷àéíîå âîñïîëíåíèå âêëþ÷åíî äëÿ âñåõ ïðåäìåòîâ'),
('MSG ITEM ALL RANDOM OFF', 'Random respawn for all items disabled',
'Ñëó÷àéíîå âîñïîëíåíèå äëÿ âñåõ ïðåäìåòîâ âûêëþ÷åíî'),
- ('MSG ITEM HELP RANDOM ON', 'Random respawn enabled for life-saving items',
+ ('MSG ITEM LIFE RANDOM ON', 'Random respawn enabled for life-saving items',
'Ñëó÷àéíîå âîñïîëíåíèå âêëþ÷åíî äëÿ ïîäêðåïëÿþùèõ ïðåäìåòîâ'),
- ('MSG ITEM HELP RANDOM OFF', 'Random respawn for life-saving items disabled',
+ ('MSG ITEM LIFE RANDOM OFF', 'Random respawn for life-saving items disabled',
'Ñëó÷àéíîå âîñïîëíåíèå äëÿ ïîäêðåïëÿþùèõ ïðåäìåòîâ âûêëþ÷åíî'),
('MSG ITEM AMMO RANDOM ON', 'Random respawn enabled for ammo',
'Ñëó÷àéíîå âîñïîëíåíèå âêëþ÷åíî äëÿ áîåïðèïàñîâ'),
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index f87e6b7ef8f42454a0e464d07f18adbb738a08d9..722bd9bb1cdc2a8cf6625a9399795176a29979ea 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
if g_Game_IsClient then Exit;
if (gGameSettings.GameType = GT_SINGLE)
- or LongBool(gGameSettings.Options and GAME_OPTION_MONSTERS) then
+ or (TGameOption.MONSTERS in gGameSettings.Options) then
begin
mon := g_Monsters_Create(monster.MonsterType, monster.X, monster.Y, TDirection(monster.Direction));
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index fac3ca78f40f161031fbcd68254909343f475a64..8fe06a3f8e5d8ac952ef6ae2a80bc8cb638d844a 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
gsPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex;
gsMap := Map;
- gsGameFlags := 0;
+ gsGameFlags := [];
if TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0 then
- gsGameFlags := gsGameFlags or GAME_OPTION_TEAMDAMAGE;
+ gsGameFlags += [TGameOption.TEAM_DAMAGE];
if TGUISwitch(GetControl('swTeamAbsorbDamage')).ItemIndex = 0 then
- gsGameFlags := gsGameFlags or GAME_OPTION_TEAMABSORBDAMAGE;
+ gsGameFlags += [TGameOption.TEAM_ABSORB_DAMAGE];
if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex = 0 then
- gsGameFlags := gsGameFlags or GAME_OPTION_DMKEYS;
+ gsGameFlags += [TGameOption.DM_KEYS];
if TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0 then
- gsGameFlags := gsGameFlags or GAME_OPTION_ALLOWEXIT;
+ gsGameFlags += [TGameOption.ALLOW_EXIT];
if TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0 then
- gsGameFlags := gsGameFlags or GAME_OPTION_WEAPONSTAY;
+ gsGameFlags += [TGameOption.WEAPONS_STAY];
if TGUISwitch(GetControl('swMonsters')).ItemIndex = 0 then
- gsGameFlags := gsGameFlags or GAME_OPTION_MONSTERS;
+ gsGameFlags += [TGameOption.MONSTERS];
case TGUISwitch(GetControl('swTeamHit')).ItemIndex of
- 1: gsGameFlags := gsGameFlags or GAME_OPTION_TEAMHITTRACE;
- 2: gsGameFlags := gsGameFlags or GAME_OPTION_TEAMHITPROJECTILE;
- 0: gsGameFlags := gsGameFlags or GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE;
+ 1: gsGameFlags += [TGameOption.TEAM_HIT_TRACE];
+ 2: gsGameFlags += [TGameOption.TEAM_HIT_PROJECTILE];
+ 0: gsGameFlags += [TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_HIT_PROJECTILE];
end;
case TGUISwitch(GetControl('swBotsVS')).ItemIndex of
- 1: gsGameFlags := gsGameFlags or GAME_OPTION_BOTVSMONSTER;
- 2: gsGameFlags := gsGameFlags or GAME_OPTION_BOTVSPLAYER or GAME_OPTION_BOTVSMONSTER;
- else gsGameFlags := gsGameFlags or GAME_OPTION_BOTVSPLAYER;
+ 1: gsGameFlags += [TGameOption.BOTS_VS_MONSTERS];
+ 2: gsGameFlags += [TGameOption.BOTS_VS_PLAYERS, TGameOption.BOTS_VS_MONSTERS];
+ else gsGameFlags += [TGameOption.BOTS_VS_PLAYERS];
end;
case TGUISwitch(GetControl('swFlagDrop')).ItemIndex of
- 0: gsGameFlags := gsGameFlags or GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG;
- 1: gsGameFlags := gsGameFlags or GAME_OPTION_ALLOWDROPFLAG;
- else gsGameFlags := gsGameFlags and not (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG);
+ 0: gsGameFlags += [TGameOption.ALLOW_DROP_FLAG, TGameOption.THROW_FLAG];
+ 1: gsGameFlags += [TGameOption.ALLOW_DROP_FLAG];
+ else gsGameFlags -= [TGameOption.ALLOW_DROP_FLAG, TGameOption.THROW_FLAG];
end;
// TODO: get this crap out of here
gsPowerupRespawnRandom := StrToIntDef(TGUIEdit(GetControl('edPowerupRespawnRandom')).Text, 0);
if TGUISwitch(GetControl('swPowerupRandom')).ItemIndex = 0 then
- gsGameFlags := gsGameFlags or GAME_OPTION_POWERUPRANDOM;
+ gsGameFlags += [TGameOption.POWERUP_RANDOM];
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;
- 4: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMHELPRANDOM or GAME_OPTION_ITEMAMMORANDOM;
- 5: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMHELPRANDOM or GAME_OPTION_ITEMWEAPONRANDOM;
- 6: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMAMMORANDOM or GAME_OPTION_ITEMWEAPONRANDOM;
- 0: gsGameFlags := gsGameFlags or GAME_OPTION_ITEMALLRANDOM;
+ 1: gsGameFlags += [TGameOption.ITEM_LIFE_RANDOM];
+ 2: gsGameFlags += [TGameOption.ITEM_AMMO_RANDOM];
+ 3: gsGameFlags += [TGameOption.ITEM_WEAPON_RANDOM];
+ 4: gsGameFlags += [TGameOption.ITEM_LIFE_RANDOM, TGameOption.ITEM_AMMO_RANDOM];
+ 5: gsGameFlags += [TGameOption.ITEM_LIFE_RANDOM, TGameOption.ITEM_WEAPON_RANDOM];
+ 6: gsGameFlags += [TGameOption.ITEM_AMMO_RANDOM, TGameOption.ITEM_WEAPON_RANDOM];
+ 0: gsGameFlags += [TGameOption.ITEM_ALL_RANDOM];
end;
// TODO: get this crap out of here
with gGameSettings do
begin
with TGUISwitch(menu.GetControl('swTeamDamage')) do
- if LongBool(Options and GAME_OPTION_TEAMDAMAGE) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.TEAM_DAMAGE in Options
+ then ItemIndex := 0
+ else ItemIndex := 1;
with TGUISwitch(menu.GetControl('swTeamHit')) do
- if (Options and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE)) = (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE) then
+ if [TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_HIT_PROJECTILE] <= Options then
ItemIndex := 0
- else if LongBool(Options and GAME_OPTION_TEAMHITTRACE) then
+ else if TGameOption.TEAM_HIT_TRACE in Options then
ItemIndex := 1
- else if LongBool(Options and GAME_OPTION_TEAMHITPROJECTILE) then
+ else if TGameOption.TEAM_HIT_PROJECTILE in Options then
ItemIndex := 2
else
ItemIndex := 3;
with TGUISwitch(menu.GetControl('swDeathmatchKeys')) do
- if LongBool(Options and GAME_OPTION_DMKEYS) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.DM_KEYS in Options
+ then ItemIndex := 0
+ else ItemIndex := 1;
with TGUISwitch(menu.GetControl('swFlagDrop')) do
- if LongBool(Options and GAME_OPTION_ALLOWDROPFLAG) and LongBool(Options and GAME_OPTION_THROWFLAG) then
+ if [TGameOption.ALLOW_DROP_FLAG, TGameOption.THROW_FLAG] <= Options then
ItemIndex := 0
- else if LongBool(Options and GAME_OPTION_ALLOWDROPFLAG) then
+ else if TGameOption.ALLOW_DROP_FLAG in Options then
ItemIndex := 1
else
ItemIndex := 2;
TGUIEdit(menu.GetControl('edMaxLives')).Text := IntToStr(MaxLives);
with TGUISwitch(menu.GetControl('swBotsVS')) do
- if LongBool(Options and GAME_OPTION_BOTVSPLAYER) and
- LongBool(Options and GAME_OPTION_BOTVSMONSTER) then
+ if [TGameOption.BOTS_VS_PLAYERS, TGameOption.BOTS_VS_MONSTERS] <= Options then
ItemIndex := 2
+ else if TGameOption.BOTS_VS_MONSTERS in Options then
+ ItemIndex := 1
else
- if LongBool(Options and GAME_OPTION_BOTVSMONSTER) then
- ItemIndex := 1
- else
- ItemIndex := 0;
+ ItemIndex := 0;
if GameType in [GT_CUSTOM, GT_SERVER] then
+ begin
+ TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
+ TGUISwitch(menu.GetControl('swTeamHit')).Enabled := True;
+ if (GameMode in [GM_DM, GM_TDM, GM_CTF]) then
begin
- TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
- TGUISwitch(menu.GetControl('swTeamHit')).Enabled := True;
- if (GameMode in [GM_DM, GM_TDM, GM_CTF]) then
- begin
- TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := True;
- TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_ITEMSTEXT_COLOR;
- end
- else
- begin
- TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := False;
- TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_UNACTIVEITEMS_COLOR;
- end;
- TGUIEdit(menu.GetControl('edTimeLimit')).Enabled := True;
- TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_ITEMSTEXT_COLOR;
- TGUIEdit(menu.GetControl('edScoreLimit')).Enabled := True;
- TGUILabel(menu.GetControlsText('edScoreLimit')).Color := MENU_ITEMSTEXT_COLOR;
- TGUIEdit(menu.GetControl('edMaxLives')).Enabled := True;
- TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_ITEMSTEXT_COLOR;
- TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
- TGUISwitch(menu.GetControl('swFlagDrop')).Enabled := True;
+ TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := True;
+ TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_ITEMSTEXT_COLOR;
end
- else
+ else
begin
- TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
- TGUISwitch(menu.GetControl('swTeamHit')).Enabled := True;
TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := False;
TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_UNACTIVEITEMS_COLOR;
- with TGUIEdit(menu.GetControl('edTimeLimit')) do
- begin
- Enabled := False;
- Text := '';
- end;
- TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
- with TGUIEdit(menu.GetControl('edScoreLimit')) do
- begin
- Enabled := False;
- Text := '';
- end;
- TGUILabel(menu.GetControlsText('edScoreLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
- with TGUIEdit(menu.GetControl('edMaxLives')) do
- begin
- Enabled := False;
- Text := '';
- end;
- TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_UNACTIVEITEMS_COLOR;
- TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
- TGUISwitch(menu.GetControl('swFlagDrop')).Enabled := False;
end;
+ TGUIEdit(menu.GetControl('edTimeLimit')).Enabled := True;
+ TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_ITEMSTEXT_COLOR;
+ TGUIEdit(menu.GetControl('edScoreLimit')).Enabled := True;
+ TGUILabel(menu.GetControlsText('edScoreLimit')).Color := MENU_ITEMSTEXT_COLOR;
+ TGUIEdit(menu.GetControl('edMaxLives')).Enabled := True;
+ TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_ITEMSTEXT_COLOR;
+ TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
+ TGUISwitch(menu.GetControl('swFlagDrop')).Enabled := True;
+ end
+ else
+ begin
+ TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
+ TGUISwitch(menu.GetControl('swTeamHit')).Enabled := True;
+ TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := False;
+ TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_UNACTIVEITEMS_COLOR;
+ with TGUIEdit(menu.GetControl('edTimeLimit')) do
+ begin
+ Enabled := False;
+ Text := '';
+ end;
+ TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
+ with TGUIEdit(menu.GetControl('edScoreLimit')) do
+ begin
+ Enabled := False;
+ Text := '';
+ end;
+ TGUILabel(menu.GetControlsText('edScoreLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
+ with TGUIEdit(menu.GetControl('edMaxLives')) do
+ begin
+ Enabled := False;
+ Text := '';
+ end;
+ TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_UNACTIVEITEMS_COLOR;
+ TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
+ TGUISwitch(menu.GetControl('swFlagDrop')).Enabled := False;
+ end;
end;
end;
begin
if TGUISwitch(menu.GetControl('swTeamDamage')).Enabled then
begin
- if TGUISwitch(menu.GetControl('swTeamDamage')).ItemIndex = 0 then
- Options := Options or GAME_OPTION_TEAMDAMAGE
- else
- Options := Options and (not GAME_OPTION_TEAMDAMAGE);
+ if TGUISwitch(menu.GetControl('swTeamDamage')).ItemIndex = 0
+ then Options += [TGameOption.TEAM_DAMAGE]
+ else Options -= [TGameOption.TEAM_DAMAGE];
end;
if TGUISwitch(menu.GetControl('swTeamHit')).Enabled then
begin
- Options := Options and not (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE);
+ Options -= [TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_HIT_PROJECTILE];
case TGUISwitch(menu.GetControl('swTeamHit')).ItemIndex of
- 1: Options := Options or GAME_OPTION_TEAMHITTRACE;
- 2: Options := Options or GAME_OPTION_TEAMHITPROJECTILE;
- 0: Options := Options or GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE;
+ 1: Options += [TGameOption.TEAM_HIT_TRACE];
+ 2: Options += [TGameOption.TEAM_HIT_PROJECTILE];
+ 0: Options += [TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_HIT_PROJECTILE];
end;
end;
if TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled then
begin
- if TGUISwitch(menu.GetControl('swDeathmatchKeys')).ItemIndex = 0 then
- Options := Options or GAME_OPTION_DMKEYS
- else
- Options := Options and (not GAME_OPTION_DMKEYS);
+ if TGUISwitch(menu.GetControl('swDeathmatchKeys')).ItemIndex = 0
+ then Options += [TGameOption.DM_KEYS]
+ else Options -= [TGameOption.DM_KEYS];
end;
if TGUIEdit(menu.GetControl('edTimeLimit')).Enabled then
if TGUISwitch(menu.GetControl('swBotsVS')).Enabled then
begin
case TGUISwitch(menu.GetControl('swBotsVS')).ItemIndex of
- 1:
- begin
- Options := Options and (not GAME_OPTION_BOTVSPLAYER);
- Options := Options or GAME_OPTION_BOTVSMONSTER;
- end;
- 2:
- begin
- Options := Options or GAME_OPTION_BOTVSPLAYER;
- Options := Options or GAME_OPTION_BOTVSMONSTER;
- end;
+ 1: begin
+ Options -= [TGameOption.BOTS_VS_PLAYERS];
+ Options += [TGameOption.BOTS_VS_MONSTERS];
+ end;
+
+ 2: Options += [TGameOption.BOTS_VS_PLAYERS, TGameOption.BOTS_VS_MONSTERS];
+
else
- begin
- Options := Options or GAME_OPTION_BOTVSPLAYER;
- Options := Options and (not GAME_OPTION_BOTVSMONSTER);
- end;
+ Options -= [TGameOption.BOTS_VS_MONSTERS];
+ Options += [TGameOption.BOTS_VS_PLAYERS];
end;
end;
if TGUISwitch(menu.GetControl('swFlagDrop')).Enabled then
begin
case TGUISwitch(menu.GetControl('swFlagDrop')).ItemIndex of
- 0: Options := Options or GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG;
- 1: Options := Options or GAME_OPTION_ALLOWDROPFLAG;
- else Options := Options and not (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG);
+ 0: Options += [TGameOption.ALLOW_DROP_FLAG, TGameOption.THROW_FLAG];
+ 1: Options += [TGameOption.ALLOW_DROP_FLAG];
+ else Options -= [TGameOption.ALLOW_DROP_FLAG, TGameOption.THROW_FLAG];
end;
end;
Name := 'swTeamDamage';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_TEAMDAMAGE) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.TEAM_DAMAGE in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_TEAM_HIT]) do
begin
AddItem(_lc[I_MENU_TEAM_HIT_TRACE]);
AddItem(_lc[I_MENU_TEAM_HIT_PROJECTILE]);
AddItem(_lc[I_MENU_TEAM_HIT_NOTHING]);
- if (gsGameFlags and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE)) = (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE) then
+ if [TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_HIT_PROJECTILE] <= gsGameFlags then
ItemIndex := 0
- else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITTRACE) then
+ else if TGameOption.TEAM_HIT_TRACE in gsGameFlags then
ItemIndex := 1
- else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITPROJECTILE) then
+ else if TGameOption.TEAM_HIT_PROJECTILE in gsGameFlags then
ItemIndex := 2
else
ItemIndex := 3;
Name := 'swTeamAbsorbDamage';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_TEAMABSORBDAMAGE) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.TEAM_ABSORB_DAMAGE in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_DEATHMATCH_KEYS]) do
begin
Name := 'swDeathmatchKeys';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_DMKEYS) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.DM_KEYS in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
begin
Name := 'swEnableExits';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_ALLOWEXIT) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.ALLOW_EXIT in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_WEAPONS_STAY]) do
begin
Name := 'swWeaponStay';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_WEAPONSTAY) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.WEAPONS_STAY in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_ENABLE_MONSTERS]) do
begin
Name := 'swMonsters';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_MONSTERS) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.MONSTERS in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_BOTS_VS]) do
begin
AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
AddItem(_lc[I_MENU_BOTS_VS_ALL]);
ItemIndex := 2;
- if not LongBool(gsGameFlags and GAME_OPTION_BOTVSMONSTER) then
+ if not (TGameOption.BOTS_VS_MONSTERS in gsGameFlags) then
ItemIndex := 0;
- if not LongBool(gsGameFlags and GAME_OPTION_BOTVSPLAYER) then
+ if not (TGameOption.BOTS_VS_PLAYERS in gsGameFlags) then
ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_FLAG_DROP]) do
AddItem(_lc[I_MENU_FLAG_THROW]);
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if (gsGameFlags and (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG)) = (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG) then
+ if [TGameOption.ALLOW_DROP_FLAG, TGameOption.THROW_FLAG] <= gsGameFlags then
ItemIndex := 0
- else if LongBool(gsGameFlags and GAME_OPTION_ALLOWDROPFLAG) then
+ else if TGameOption.ALLOW_DROP_FLAG in gsGameFlags then
ItemIndex := 1
else
ItemIndex := 2;
with AddEdit(_lc[I_NET_ADDRESS]) do
begin
Name := 'edIP';
- OnlyDigits :=False;
+ OnlyDigits := False;
Width := 12;
MaxLength := 64;
Text := 'localhost';
Name := 'swTeamDamage';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_TEAMDAMAGE) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.TEAM_DAMAGE in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_TEAM_HIT]) do
begin
AddItem(_lc[I_MENU_TEAM_HIT_TRACE]);
AddItem(_lc[I_MENU_TEAM_HIT_PROJECTILE]);
AddItem(_lc[I_MENU_TEAM_HIT_NOTHING]);
- if (gsGameFlags and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE)) = (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE) then
+ if [TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_HIT_PROJECTILE] <= gsGameFlags then
ItemIndex := 0
- else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITTRACE) then
+ else if TGameOption.TEAM_HIT_TRACE in gsGameFlags then
ItemIndex := 1
- else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITPROJECTILE) then
+ else if TGameOption.TEAM_HIT_PROJECTILE in gsGameFlags then
ItemIndex := 2
else
ItemIndex := 3;
Name := 'swTeamAbsorbDamage';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_TEAMABSORBDAMAGE) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.TEAM_ABSORB_DAMAGE in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_DEATHMATCH_KEYS]) do
begin
Name := 'swDeathmatchKeys';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_DMKEYS) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.DM_KEYS in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
begin
Name := 'swEnableExits';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_ALLOWEXIT) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.ALLOW_EXIT in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_WEAPONS_STAY]) do
begin
Name := 'swWeaponStay';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_WEAPONSTAY) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.WEAPONS_STAY in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_ENABLE_MONSTERS]) do
begin
Name := 'swMonsters';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_MONSTERS) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.MONSTERS in gsGameFlags
+ then ItemIndex := 0
+ else ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_BOTS_VS]) do
begin
AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
AddItem(_lc[I_MENU_BOTS_VS_ALL]);
ItemIndex := 2;
- if not LongBool(gsGameFlags and GAME_OPTION_BOTVSMONSTER) then
+ if not (TGameOption.BOTS_VS_MONSTERS in gsGameFlags) then
ItemIndex := 0;
- if not LongBool(gsGameFlags and GAME_OPTION_BOTVSPLAYER) then
+ if not (TGameOption.BOTS_VS_PLAYERS in gsGameFlags) then
ItemIndex := 1;
end;
with AddSwitch(_lc[I_MENU_FLAG_DROP]) do
AddItem(_lc[I_MENU_FLAG_THROW]);
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if (gsGameFlags and (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG)) = (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG) then
+ if [TGameOption.ALLOW_DROP_FLAG, TGameOption.THROW_FLAG] <= gsGameFlags then
ItemIndex := 0
- else if LongBool(gsGameFlags and GAME_OPTION_ALLOWDROPFLAG) then
+ else if TGameOption.ALLOW_DROP_FLAG in gsGameFlags then
ItemIndex := 1
else
ItemIndex := 2;
Name := 'swPowerupRandom';
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
- if LongBool(gsGameFlags and GAME_OPTION_POWERUPRANDOM) then
- ItemIndex := 0
- else
- ItemIndex := 1;
+ if TGameOption.POWERUP_RANDOM in gsGameFlags
+ 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_LIFE_ONLY]);
AddItem(_lc[I_MENU_ITEM_RANDOM_AMMO_ONLY]);
AddItem(_lc[I_MENU_ITEM_RANDOM_WEAPON_ONLY]);
- AddItem(_lc[I_MENU_ITEM_RANDOM_HELP_AMMO]);
- AddItem(_lc[I_MENU_ITEM_RANDOM_HELP_WEAPON]);
+ AddItem(_lc[I_MENU_ITEM_RANDOM_LIFE_AMMO]);
+ AddItem(_lc[I_MENU_ITEM_RANDOM_LIFE_WEAPON]);
AddItem(_lc[I_MENU_ITEM_RANDOM_WEAPON_AMMO]);
AddItem(_lc[I_MENU_ITEM_RANDOM_NOTHING]);
- if LongBool(gsGameFlags and GAME_OPTION_ITEMALLRANDOM) then
+ if TGameOption.ITEM_ALL_RANDOM in gsGameFlags then
ItemIndex := 0
- else if LongBool(gsGameFlags and GAME_OPTION_ITEMHELPRANDOM) then
+ else if TGameOption.ITEM_LIFE_RANDOM in gsGameFlags then
ItemIndex := 1
- else if LongBool(gsGameFlags and GAME_OPTION_ITEMAMMORANDOM) then
+ else if TGameOption.ITEM_AMMO_RANDOM in gsGameFlags then
ItemIndex := 2
- else if LongBool(gsGameFlags and GAME_OPTION_ITEMWEAPONRANDOM) then
+ else if TGameOption.ITEM_WEAPON_RANDOM in gsGameFlags then
ItemIndex := 3
- else if (gsGameFlags and (GAME_OPTION_ITEMHELPRANDOM or GAME_OPTION_ITEMAMMORANDOM)) = (GAME_OPTION_ITEMHELPRANDOM or GAME_OPTION_ITEMAMMORANDOM) then
+ else if [TGameOption.ITEM_LIFE_RANDOM, TGameOption.ITEM_AMMO_RANDOM] <= gsGameFlags then
ItemIndex := 4
- else if (gsGameFlags and (GAME_OPTION_ITEMHELPRANDOM or GAME_OPTION_ITEMWEAPONRANDOM)) = (GAME_OPTION_ITEMHELPRANDOM or GAME_OPTION_ITEMWEAPONRANDOM) then
+ else if [TGameOption.ITEM_LIFE_RANDOM, TGameOption.ITEM_WEAPON_RANDOM] <= gsGameFlags then
ItemIndex := 5
- else if (gsGameFlags and (GAME_OPTION_ITEMAMMORANDOM or GAME_OPTION_ITEMWEAPONRANDOM)) = (GAME_OPTION_ITEMAMMORANDOM or GAME_OPTION_ITEMWEAPONRANDOM) then
+ else if [TGameOption.ITEM_AMMO_RANDOM, TGameOption.ITEM_WEAPON_RANDOM] <= gsGameFlags then
ItemIndex := 6
else
ItemIndex := 7;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 15da1c62189407cd450f4673a0432427273d0826..a55a8a849d153a29ff46afd7b62f1b95f362d69f 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
NetOut.Write(gGameSettings.ScoreLimit);
NetOut.Write(gGameSettings.TimeLimit);
NetOut.Write(gGameSettings.MaxLives);
- NetOut.Write(gGameSettings.Options);
+ NetOut.Write(LongWord(gGameSettings.Options));
NetOut.Write(gTime);
g_Net_Host_Send(ID, True);
NetOut.Write(gGameSettings.ScoreLimit);
NetOut.Write(gGameSettings.TimeLimit);
NetOut.Write(gGameSettings.MaxLives);
- NetOut.Write(gGameSettings.Options);
+ NetOut.Write(LongWord(gGameSettings.Options));
g_Net_Host_Send(ID, True);
end;
gGameSettings.ScoreLimit := M.ReadWord();
gGameSettings.TimeLimit := M.ReadWord();
gGameSettings.MaxLives := M.ReadByte();
- gGameSettings.Options := M.ReadLongWord();
+ gGameSettings.Options := TGameOptions(M.ReadLongWord());
end;
// PLAYER
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 22ebe3e26e0da9f644d2bf142a33159a34350ec1..79da12ec4439c1e57f490e504481e15ce2bf730a 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
interface
uses
- g_language, g_weapons, utils;
+ g_language, g_game, g_weapons, utils;
function GenPlayerName (n: Integer): String;
gsScoreLimit: Word;
gsMaxLives: Byte;
gsPlayers: Byte;
- gsGameFlags: LongWord;
+ gsGameFlags: TGameOptions;
gsSpawnInvul: Integer = 0;
gsItemRespawnTime: Word = 60;
gsItemRespawnRandom: Word = 0;
SDL2,
{$ENDIF}
e_log, e_input, g_console, g_window, g_sound, g_gfx, g_player, Math,
- g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game, g_main, e_texture,
+ g_map, g_net, g_netmaster, SysUtils, CONFIG, g_main, e_texture,
g_items, wadreader, e_graphics, g_touch, envvars, g_system;
var
gsItemRespawnRandom := 0;
gsPowerupRespawnTime := 60;
gsPowerupRespawnRandom := 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
- GAME_OPTION_ALLOWDROPFLAG;
+ gsGameFlags := [TGameOption.ALLOW_EXIT, TGameOption.DM_KEYS, TGameOption.BOTS_VS_PLAYERS,
+ TGameOption.BOTS_VS_MONSTERS, TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_HIT_PROJECTILE,
+ TGameOption.ALLOW_DROP_FLAG];
gsPlayers := 1;
if not gGameOn then
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 6b0c4f5bd75028389a8c06772ccdd32f5acb1d5c..a97b4ff5a50f911853570883bf99b190b9851573 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
Exit;
// Åñëè åñòü óðîí ñâîèì, èëè ðàíèë ñàì ñåáÿ, èëè òåáÿ ðàíèë ïðîòèâíèê:
- if LongBool(gGameSettings.Options and GAME_OPTION_TEAMDAMAGE) or
+ if (TGameOption.TEAM_DAMAGE in gGameSettings.Options) or
(SpawnerUID = FUID) or
(not SameTeam(FUID, SpawnerUID)) then
begin
// Âûáðîñ êëþ÷åé:
if (not (gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF])) or
- (not LongBool(gGameSettings.Options and GAME_OPTION_DMKEYS)) then
+ (not (TGameOption.DM_KEYS in gGameSettings.Options)) then
begin
if R_KEY_RED in FInventory then
PushItem(ITEM_KEY_RED);
if g_Game_IsClient then Exit;
// a = true - ìåñòî ñïàâíà ïðåäìåòà:
- a := LongBool(gGameSettings.Options and GAME_OPTION_WEAPONSTAY) and arespawn;
+ a := (TGameOption.WEAPONS_STAY in gGameSettings.Options) and arespawn;
remove := not a;
case ItemType of
ITEM_MEDKIT_SMALL:
FMaxAmmo[A_FUEL] := AmmoLimits[0, A_FUEL];
if (gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF]) and
- LongBool(gGameSettings.Options and GAME_OPTION_DMKEYS) then
+ (TGameOption.DM_KEYS in gGameSettings.Options) then
FInventory := [R_KEY_RED, R_KEY_GREEN, R_KEY_BLUE]
else
FInventory := [];
function TPlayer.TryDropFlag(): Boolean;
begin
- if LongBool(gGameSettings.Options and GAME_OPTION_ALLOWDROPFLAG) then
- Result := DropFlag(False, LongBool(gGameSettings.Options and GAME_OPTION_THROWFLAG))
- else
- Result := False;
+ if (TGameOption.ALLOW_DROP_FLAG in gGameSettings.Options)
+ then Result := DropFlag(False, TGameOption.THROW_FLAG in gGameSettings.Options)
+ else Result := False;
end;
function TPlayer.DropFlag(Silent: Boolean = True; DoThrow: Boolean = False): Boolean;
end;
begin
- vsPlayer := LongBool(gGameSettings.Options and GAME_OPTION_BOTVSPLAYER);
- vsMonster := LongBool(gGameSettings.Options and GAME_OPTION_BOTVSMONSTER);
+ vsPlayer := TGameOption.BOTS_VS_PLAYERS in gGameSettings.Options;
+ vsMonster := TGameOption.BOTS_VS_MONSTERS in gGameSettings.Options;
// Åñëè òåêóùåå îðóæèå íå òî, ÷òî íóæíî, òî ìåíÿåì:
if FCurrWeap <> FSelectedWeapon then
begin
ok := False;
if (g_GetUIDType(FLastSpawnerUID) = UID_PLAYER) and
- LongBool(gGameSettings.Options and GAME_OPTION_BOTVSPLAYER) then
+ (TGameOption.BOTS_VS_PLAYERS in gGameSettings.Options) then
begin // Èãðîê
pla := g_Player_Get(FLastSpawnerUID);
ok := not TargetOnScreen(pla.FObj.X + PLAYER_RECT.X,
end
else
if (g_GetUIDType(FLastSpawnerUID) = UID_MONSTER) and
- LongBool(gGameSettings.Options and GAME_OPTION_BOTVSMONSTER) then
+ (TGameOption.BOTS_VS_MONSTERS in gGameSettings.Options) then
begin // Ìîíñòð
mon := g_Monsters_ByUID(FLastSpawnerUID);
ok := not TargetOnScreen(mon.Obj.X + mon.Obj.Rect.X,
index f311bb8f5a89ad8429c34646818c1d32d4ec1b87..2d91494b1e50b13806bb4c193b319b0ed7e7c2af 100644 (file)
--- a/src/game/g_saveload.pas
+++ b/src/game/g_saveload.pas
gGameSettings.TimeLimit := Game_TimeLimit;
gGameSettings.ScoreLimit := Game_ScoreLimit;
gGameSettings.MaxLives := Game_MaxLives;
- gGameSettings.Options := Game_Options;
+ gGameSettings.Options := TGameOptions(Game_Options);
gSwitchGameMode := Game_Mode;
g_Game_ExecuteEvent('ongamestart');
index 8c11a474ff3928ea8466b19897f375993a360b49..3a1bec2ccbf37a95c84c49de76b6da6bc45c10c0 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
// Íå ñîçäàâàòü âûõîä, åñëè èãðà áåç âûõîäà
if (aTrigger.TriggerType = TRIGGER_EXIT) and
- (not LongBool(gGameSettings.Options and GAME_OPTION_ALLOWEXIT)) then
+ (not (TGameOption.ALLOW_EXIT in gGameSettings.Options)) then
begin
aTrigger.TriggerType := TRIGGER_NONE;
end;
// Åñëè ìîíñòðû çàïðåùåíû, îòìåíÿåì òðèããåð
if (aTrigger.TriggerType = TRIGGER_SPAWNMONSTER) and
- (not LongBool(gGameSettings.Options and GAME_OPTION_MONSTERS)) and
+ (not (TGameOption.MONSTERS in gGameSettings.Options)) and
(gGameSettings.GameType <> GT_SINGLE) then
begin
aTrigger.TriggerType := TRIGGER_NONE;
diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index 23898af54c2cd8dc5ceb1bec423edcbec626d448..9b0952edbb1652aa1a28ca09fb948d5a23527471 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
// È â êîíöå èãðîêîâ, íî òîëüêî åñëè ïîëîæåíî
// (èëè ñíàðÿä îò ìîíñòðà, èëè friendlyfire, èëè friendly_hit_projectile)
if (g_GetUIDType(SpawnerUID) <> UID_PLAYER) or
- LongBool(gGameSettings.Options and (GAME_OPTION_TEAMDAMAGE or GAME_OPTION_TEAMHITPROJECTILE)) then
+ ([TGameOption.TEAM_DAMAGE, TGameOption.TEAM_HIT_PROJECTILE] <= gGameSettings.Options) then
begin
if PlayerHit() then
begin
// È â êîíöå ñâîèõ èãðîêîâ, íî òîëüêî åñëè ïîëîæåíî
// (èëè friendlyfire, èëè friendly_hit_projectile)
- if LongBool(gGameSettings.Options and (GAME_OPTION_TEAMDAMAGE or GAME_OPTION_TEAMHITPROJECTILE)) then
+ if [TGameOption.TEAM_DAMAGE, TGameOption.TEAM_HIT_PROJECTILE] <= gGameSettings.Options then
begin
if PlayerHit(1) then
begin
if (gPlayers[idx] = nil) or not gPlayers[idx].alive then exit;
if (spawnerPlr <> nil) then
begin
- if ((gGameSettings.Options and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMDAMAGE)) = 0) and
+ if (not ([TGameOption.TEAM_HIT_TRACE, TGameOption.TEAM_DAMAGE] <= gGameSettings.Options)) and
(spawnerPlr.Team <> TEAM_NONE) and (spawnerPlr.Team = gPlayers[idx].Team) then
begin
- if (spawnerPlr <> gPlayers[idx]) and ((gGameSettings.Options and GAME_OPTION_TEAMABSORBDAMAGE) = 0) then
+ if (spawnerPlr <> gPlayers[idx]) and not (TGameOption.TEAM_ABSORB_DAMAGE in gGameSettings.Options) then
dmg := Max(1, dmg div 2);
exit;
end;