diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index b34e2ef0c57ad0ff74121bb5cf99997ed7a8230d..23c09434500a78b91de1423888484296164d8a95 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
TimeLimit: Word;
GoalLimit: Word;
WarmupTime: Word;
TimeLimit: Word;
GoalLimit: Word;
WarmupTime: Word;
+ SpawnInvul: Word;
MaxLives: Byte;
Options: LongWord;
WAD: String;
MaxLives: Byte;
Options: LongWord;
WAD: String;
GAME_OPTION_MONSTERS = 16;
GAME_OPTION_BOTVSPLAYER = 32;
GAME_OPTION_BOTVSMONSTER = 64;
GAME_OPTION_MONSTERS = 16;
GAME_OPTION_BOTVSPLAYER = 32;
GAME_OPTION_BOTVSMONSTER = 64;
+ GAME_OPTION_DMKEYS = 128;
STATE_NONE = 0;
STATE_MENU = 1;
STATE_NONE = 0;
STATE_MENU = 1;
AssignFile(s, fname);
try
Rewrite(s);
AssignFile(s, fname);
try
Rewrite(s);
- // line 1: stats version, datetime, server name, map name, game mode, time limit, score limit, dmflags, game time, number of players
+ // line 1: stats ver, datetime, server name, map name, game mode, time limit, score limit, dmflags, game time, num players
if g_Game_IsNet then fname := NetServerName else fname := '';
map := g_ExtractWadNameNoPath(gMapInfo.Map) + ':/' + g_ExtractFileName(gMapInfo.Map);
mode := g_Game_ModeToText(Stat.GameMode);
if g_Game_IsNet then fname := NetServerName else fname := '';
map := g_ExtractWadNameNoPath(gMapInfo.Map) + ':/' + g_ExtractFileName(gMapInfo.Map);
mode := g_Game_ModeToText(Stat.GameMode);
- etime := Format('%d:%.2d:%.2d', [Stat.GameTime div 1000 div 3600,
- (Stat.GameTime div 1000 div 60) mod 60,
- Stat.GameTime div 1000 mod 60]);
+ etime := Format('%d:%.2d:%.2d', [
+ Stat.GameTime div 1000 div 3600,
+ (Stat.GameTime div 1000 div 60) mod 60,
+ Stat.GameTime div 1000 mod 60
+ ]);
WriteLn(s, 'stats_ver,datetime,server,map,mode,timelimit,scorelimit,dmflags,time,num_players');
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',
- [STATFILE_VERSION, StatDate, fname, map, mode, gGameSettings.TimeLimit, gGameSettings.GoalLimit, gGameSettings.Options, etime, Length(Stat.PlayerStat)]));
+ WriteLn(s, Format('%d,%s,%s,%s,%s,%u,%u,%u,%s,%d', [
+ STATFILE_VERSION,
+ StatDate,
+ dquoteStr(fname),
+ dquoteStr(map),
+ mode,
+ gGameSettings.TimeLimit,
+ gGameSettings.GoalLimit,
+ gGameSettings.Options,
+ etime,
+ Length(Stat.PlayerStat)
+ ]));
// line 2: game specific shit
// if it's a team game: red score, blue score
// if it's a coop game: monsters killed, monsters total, secrets found, secrets total
// otherwise nothing
if Stat.GameMode in [GM_TDM, GM_CTF] then
// line 2: game specific shit
// if it's a team game: red score, blue score
// if it's a coop game: monsters killed, monsters total, secrets found, secrets total
// otherwise nothing
if Stat.GameMode in [GM_TDM, GM_CTF] then
- WriteLn(s, Format('red_score,blue_score' + LineEnding + '%d,%d', [Stat.TeamStat[TEAM_RED].Goals, Stat.TeamStat[TEAM_BLUE].Goals]))
+ WriteLn(s,
+ Format('red_score,blue_score' + LineEnding + '%d,%d', [Stat.TeamStat[TEAM_RED].Goals, Stat.TeamStat[TEAM_BLUE].Goals]))
else if Stat.GameMode in [GM_COOP, GM_SINGLE] then
else if Stat.GameMode in [GM_COOP, GM_SINGLE] then
- WriteLn(s, Format('mon_killed,mon_total,secrets_found,secrets_total' + LineEnding + '%d,%d,%d,%d', [gCoopMonstersKilled, gTotalMonsters, gCoopSecretsFound, gSecretsCount]));
+ WriteLn(s,
+ Format('mon_killed,mon_total,secrets_found,secrets_total' + LineEnding + '%d,%d,%d,%d',[gCoopMonstersKilled, gTotalMonsters, gCoopSecretsFound, gSecretsCount]));
// lines 3-...: team, player name, frags, deaths
WriteLn(s, 'team,name,frags,deaths');
for I := Low(Stat.PlayerStat) to High(Stat.PlayerStat) do
with Stat.PlayerStat[I] do
// lines 3-...: team, player name, frags, deaths
WriteLn(s, 'team,name,frags,deaths');
for I := Low(Stat.PlayerStat) to High(Stat.PlayerStat) do
with Stat.PlayerStat[I] do
- WriteLn(s, Format('%d,%s,%d,%d', [Team, Name, Frags, Deaths]));
+ WriteLn(s, Format('%d,%s,%d,%d', [Team, dquoteStr(Name), Frags, Deaths]));
except
g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [fname]));
end;
except
g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [fname]));
end;
SortGameStat(CustomStat.PlayerStat);
SortGameStat(CustomStat.PlayerStat);
- if gSaveStats or gScreenshotStats then
+ if (gSaveStats or gScreenshotStats) and (Length(gPlayers) > 1) then
begin
t := Now;
if g_Game_IsNet then StatFilename := NetServerName else StatFilename := 'local';
StatDate := FormatDateTime('yymmdd_hhnnss', t);
StatFilename := StatFilename + '_' + CustomStat.Map + '_' + g_Game_ModeToText(CustomStat.GameMode);
StatFilename := sanitizeFilename(StatFilename) + '_' + StatDate;
begin
t := Now;
if g_Game_IsNet then StatFilename := NetServerName else StatFilename := 'local';
StatDate := FormatDateTime('yymmdd_hhnnss', t);
StatFilename := StatFilename + '_' + CustomStat.Map + '_' + g_Game_ModeToText(CustomStat.GameMode);
StatFilename := sanitizeFilename(StatFilename) + '_' + StatDate;
- if gSaveStats then SaveGameStat(CustomStat, FormatDateTime('yyyy"/"mm"/"dd', t));
+ if gSaveStats then
+ SaveGameStat(CustomStat, FormatDateTime('yyyy"/"mm"/"dd', t));
end;
StatShotDone := False;
end;
StatShotDone := False;
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end
+ else if (cmd = 'g_dm_keys') and not g_Game_IsClient then
+ begin
+ with gGameSettings do
+ begin
+ if (Length(P) > 1) and
+ ((P[1] = '1') or (P[1] = '0')) then
+ begin
+ if (P[1][1] = '1') then
+ Options := Options or GAME_OPTION_DMKEYS
+ else
+ Options := Options and (not GAME_OPTION_DMKEYS);
+ end;
+
+ if (LongBool(Options and GAME_OPTION_DMKEYS)) then
+ g_Console_Add(_lc[I_MSG_DMKEYS_ON])
+ else
+ g_Console_Add(_lc[I_MSG_DMKEYS_OFF]);
+ g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
+
+ if g_Game_IsNet then MH_SEND_GameSettings;
+ end;
+ end
else if (cmd = 'g_warmuptime') and not g_Game_IsClient then
begin
if Length(P) > 1 then
else if (cmd = 'g_warmuptime') and not g_Game_IsClient then
begin
if Length(P) > 1 then
[gGameSettings.WarmupTime]));
g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end
[gGameSettings.WarmupTime]));
g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end
+ else if (cmd = 'g_spawn_invul') and not g_Game_IsClient then
+ begin
+ if Length(P) > 1 then
+ begin
+ if StrToIntDef(P[1], gGameSettings.SpawnInvul) = 0 then
+ gGameSettings.SpawnInvul := 0
+ else
+ gGameSettings.SpawnInvul := StrToIntDef(P[1], gGameSettings.SpawnInvul);
+ end;
+
+ g_Console_Add(Format(_lc[I_MSG_SPAWNINVUL],
+ [gGameSettings.SpawnInvul]));
+ g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
+ end
else if cmd = 'net_interp' then
begin
if (Length(P) > 1) then
else if cmd = 'net_interp' then
begin
if (Length(P) > 1) then
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
+ else if cmd = 'centerprint' then
+ begin
+ if (Length(P) > 2) and (P[1] <> '') then
+ begin
+ chstr := '';
+ for a := 2 to High(P) do
+ chstr := chstr + P[a] + ' ';
+
+ if Length(chstr) > 200 then SetLength(chstr, 200);
+
+ if Length(chstr) < 1 then
+ begin
+ g_Console_Add('centerprint <timeout> <text>');
+ Exit;
+ end;
+
+ a := StrToIntDef(P[1], 100);
+ chstr := b_Text_Format(chstr);
+ g_Game_Message(chstr, a);
+ if g_Game_IsNet and g_Game_IsServer then
+ MH_SEND_GameEvent(NET_EV_BIGTEXT, a, chstr);
+ end
+ else g_Console_Add('centerprint <timeout> <text>');
+ end
else if (cmd = 'overtime') and not g_Game_IsClient then
begin
if (Length(P) = 1) or (StrToIntDef(P[1], -1) <= 0) then
else if (cmd = 'overtime') and not g_Game_IsClient then
begin
if (Length(P) = 1) or (StrToIntDef(P[1], -1) <= 0) then