diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 71eb6095d6ee5ef232245707315b9c1e2e347798..2d80b3aaa32ea394316d5b13bae7ca799bcde2f2 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
WarmupTime: Word;
SpawnInvul: Word;
ItemRespawnTime: Word;
+ ItemRespawnRandom: Word;
+ RulezRespawnTime: Word;
+ RulezRespawnRandom: Word;
MaxLives: Byte;
Options: LongWord;
WAD: String;
procedure g_Game_Announce_GoodShot(SpawnerUID: Word);
procedure g_Game_Announce_KillCombo(Param: Integer);
procedure g_Game_Announce_BodyKill(SpawnerUID: Word);
+procedure g_Game_Effect_Bubbles(fX, fY: Integer; count: Word; devX, devY: Byte; Silent: Boolean = False);
procedure g_Game_StartVote(Command, Initiator: string);
procedure g_Game_CheckVote;
procedure g_TakeScreenShot(Filename: string = '');
GAME_OPTION_TEAMABSORBDAMAGE = 1024;
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;
// saves a shitty CSV containing the game stats passed to it
procedure SaveGameStat(Stat: TEndCustomGameStat; Path: string);
-var
+var
s: TextFile;
dir, fname, map, mode, etime: String;
I: Integer;
// 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,
+ WriteLn(s,
Format('red_score,blue_score' + LineEnding + '%d,%d', [Stat.TeamStat[TEAM_RED].Score, Stat.TeamStat[TEAM_BLUE].Score]))
else if Stat.GameMode in [GM_COOP, GM_SINGLE] then
WriteLn(s,
gGameSettings.Options := gGameSettings.Options + GAME_OPTION_BOTVSMONSTER;
gGameSettings.Options := gGameSettings.Options + GAME_OPTION_TEAMHITPROJECTILE;
gGameSettings.Options := gGameSettings.Options + GAME_OPTION_TEAMHITTRACE;
+ gGameSettings.Options := gGameSettings.Options + GAME_OPTION_RULEZRANDOM;
+ 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;
end;
end;
- g_Net_UnbanNonPermHosts();
+ g_Net_UnbanNonPerm();
end;
if gLastMap then
a, b: Integer;
stat: TPlayerStatArray;
cmd: string;
+ it: PItem;
procedure ParseGameFlag(Flag: LongWord; OffMsg, OnMsg: TStrings_Locale; OnMapChange: Boolean = False);
var
begin
ParseGameFlag(GAME_OPTION_TEAMHITPROJECTILE, I_MSG_FRIENDLY_PROJECT_TRACE_OFF, I_MSG_FRIENDLY_PROJECT_TRACE_ON);
end
+ else if cmd = 'g_powerup_randomize_respawn' then
+ begin
+ ParseGameFlag(GAME_OPTION_RULEZRANDOM, I_MSG_RULEZ_RANDOM_OFF, I_MSG_RULEZ_RANDOM_ON, False);
+ end
else if cmd = 'g_weaponstay' then
begin
ParseGameFlag(GAME_OPTION_WEAPONSTAY, I_MSG_WEAPONSTAY_OFF, I_MSG_WEAPONSTAY_ON);
g_Console_Add(Format('%s %d', [cmd, Integer(gsItemRespawnTime)]));
if g_Game_IsServer then g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
end
+ else if cmd = 'g_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
+ begin
+ gsRulezRespawnTime := nclamp(StrToIntDef(P[1], gsRulezRespawnTime), 0, $FFFF);
+ if g_Game_IsServer then
+ begin
+ gGameSettings.RulezRespawnTime := gsRulezRespawnTime;
+ if g_Game_IsNet then MH_SEND_GameSettings;
+ end;
+ end;
+
+ 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
begin
if (Length(P) > 1) then
// if someone has a higher score, set it to that instead
gsScoreLimit := max(gsScoreLimit, b);
gGameSettings.ScoreLimit := gsScoreLimit;
-
+
if g_Game_IsNet then MH_SEND_GameSettings;
end;
end;
'p1_priority_kastet':
begin
if (Length(P) = 2) then
- gPlayer1Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ gPlayer1Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
end;
'p2_priority_kastet':
begin
if (Length(P) = 2) then
- gPlayer2Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
- end;
+ gPlayer2Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
'p1_priority_saw':
begin
if (Length(P) = 2) then
'p1_priority_pistol':
begin
if (Length(P) = 2) then
- gPlayer1Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ gPlayer1Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
end;
'p2_priority_pistol':
begin
if (Length(P) = 2) then
- gPlayer2Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
- end;
+ gPlayer2Settings.WeaponPreferences[WEAPON_KASTET] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
'p1_priority_shotgun1':
begin
if (Length(P) = 2) then
begin
if (Length(P) = 2) then
gPlayer2Settings.WeaponPreferences[WEAPON_FLAMETHROWER] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
- end;
+ end;
'p1_priority_berserk':
begin
if (Length(P) = 2) then
- gPlayer1Settings.WeaponPreferences[WP_LAST+1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ gPlayer1Settings.WeaponPreferences[WP_LAST+1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
end;
'p2_priority_berserk':
begin
if (Length(P) = 2) then
- gPlayer2Settings.WeaponPreferences[WP_LAST+1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
- end;
+ gPlayer2Settings.WeaponPreferences[WP_LAST+1] := EnsureRange(StrToIntDef(P[1], WP_FIRST), WP_FIRST, WP_LAST+1);
+ end;
end;
end;
if cmd = 'greenarmor' then begin plr.GiveItem(ITEM_ARMOR_GREEN); g_Console_Add('player got a security armor'); continue; end;
if cmd = 'bluearmor' then begin plr.GiveItem(ITEM_ARMOR_BLUE); g_Console_Add('player got a combat armor'); continue; end;
- if (cmd = 'megasphere') or (cmd = 'mega') then begin plr.GiveItem(ITEM_SPHERE_BLUE); g_Console_Add('player got a megasphere'); continue; end;
- if (cmd = 'soulsphere') or (cmd = 'soul')then begin plr.GiveItem(ITEM_SPHERE_WHITE); g_Console_Add('player got a soul sphere'); continue; end;
+ if (cmd = 'soulsphere') or (cmd = 'soul') then begin plr.GiveItem(ITEM_SPHERE_BLUE); g_Console_Add('player got a soul sphere'); continue; end;
+ if (cmd = 'megasphere') or (cmd = 'mega') then begin plr.GiveItem(ITEM_SPHERE_WHITE); g_Console_Add('player got a megasphere'); continue; end;
if (cmd = 'invul') or (cmd = 'invulnerability') then begin plr.GiveItem(ITEM_INVUL); g_Console_Add('player got invulnerability'); continue; end;
if (cmd = 'invis') or (cmd = 'invisibility') then begin plr.GiveItem(ITEM_INVIS); g_Console_Add('player got invisibility'); continue; end;
pl := g_Net_Client_ByName(P[1]);
if (pl <> nil) then
- begin
- s := g_Net_ClientName_ByID(pl^.ID);
- g_Net_BanHost(pl^.Peer^.address.host, False);
- g_Net_Host_Kick(pl^.ID, NET_DISC_TEMPBAN);
- g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
- MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
- g_Net_Slist_ServerPlayerLeaves();
- end else
+ g_Net_Host_Ban(pl, False)
+ else
g_Console_Add(Format(_lc[I_NET_ERR_NAME404], [P[1]]));
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
a := StrToIntDef(P[1], 0);
if (NetClients <> nil) and (a <= High(NetClients)) then
if NetClients[a].Used and (NetClients[a].Peer <> nil) then
- begin
- s := g_Net_ClientName_ByID(NetClients[a].ID);
- g_Net_BanHost(NetClients[a].Peer^.address.host, False);
- g_Net_Host_Kick(NetClients[a].ID, NET_DISC_TEMPBAN);
- g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
- MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
- g_Net_Slist_ServerPlayerLeaves();
- end;
+ g_Net_Host_Ban(pl, False);
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
a := StrToIntDef(P[1], 0);
pl := g_Net_Client_ByPlayer(a);
if (pl <> nil) and pl^.Used and (pl^.Peer <> nil) then
- begin
- s := g_Net_ClientName_ByID(pl^.ID);
- g_Net_BanHost(pl^.Peer^.address.host, False);
- g_Net_Host_Kick(pl^.ID, NET_DISC_TEMPBAN);
- g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
- MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
- g_Net_Slist_ServerPlayerLeaves();
- end;
+ g_Net_Host_Ban(pl, False);
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
pl := g_Net_Client_ByName(P[1]);
if (pl <> nil) then
- begin
- s := g_Net_ClientName_ByID(pl^.ID);
- g_Net_BanHost(pl^.Peer^.address.host);
- g_Net_Host_Kick(pl^.ID, NET_DISC_BAN);
- g_Net_SaveBanList();
- g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
- MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
- g_Net_Slist_ServerPlayerLeaves();
- end else
+ g_Net_Host_Ban(pl, True)
+ else
g_Console_Add(Format(_lc[I_NET_ERR_NAME404], [P[1]]));
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
a := StrToIntDef(P[1], 0);
if (NetClients <> nil) and (a <= High(NetClients)) then
if NetClients[a].Used and (NetClients[a].Peer <> nil) then
- begin
- s := g_Net_ClientName_ByID(NetClients[a].ID);
- g_Net_BanHost(NetClients[a].Peer^.address.host);
- g_Net_Host_Kick(NetClients[a].ID, NET_DISC_BAN);
- g_Net_SaveBanList();
- g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
- MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
- g_Net_Slist_ServerPlayerLeaves();
- end;
+ g_Net_Host_Ban(@NetClients[a], True);
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
a := StrToIntDef(P[1], 0);
pl := g_Net_Client_ByPlayer(a);
if (pl <> nil) and pl^.Used and (pl^.Peer <> nil) then
- begin
- s := g_Net_ClientName_ByID(pl^.ID);
- g_Net_BanHost(pl^.Peer^.address.host);
- g_Net_Host_Kick(pl^.ID, NET_DISC_TEMPBAN);
- g_Net_SaveBanList();
- g_Console_Add(Format(_lc[I_PLAYER_BAN], [s]));
- MH_SEND_GameEvent(NET_EV_PLAYER_BAN, 0, s);
- g_Net_Slist_ServerPlayerLeaves();
- end;
+ g_Net_Host_Ban(pl, True);
end else
g_Console_Add(_lc[I_MSG_SERVERONLY]);
end
Exit;
end;
- g_Net_BanHost(P[1]);
+ g_Net_BanAddress(P[1]);
g_Net_SaveBanList();
g_Console_Add(Format(_lc[I_PLAYER_BAN], [P[1]]));
end else
Exit;
end;
- if g_Net_UnbanHost(P[1]) then
+ if g_Net_UnbanAddress(P[1]) then
begin
g_Console_Add(Format(_lc[I_MSG_UNBAN_OK], [P[1]]));
g_Net_SaveBanList();
t := TEAM_RED
else if P[2] = 'blue' then
t := TEAM_BLUE
- else
+ else
t := TEAM_NONE;
if Length(P) = 3
DateTimeToString(date, 'yyyy-mm-dd-hh-nn-ss', t);
Filename := 'screenshot-' + date;
end;
-
+
name := e_CatPath(dir, Filename + '.png');
s := createDiskFile(name);
try
hahasnd[Random(3)].Play();
end;
+procedure g_Game_Effect_Bubbles (fX, fY: Integer; count: Word; devX, devY: Byte; Silent: Boolean);
+begin
+ g_GFX_Bubbles(fX, fY, count, devX, devY);
+ if not Silent then if Random(2) = 0
+ then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', fX, fY)
+ else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', fX, fY);
+end;
+
procedure g_Game_StartVote(Command, Initiator: string);
var
Need: Integer;