diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 4f6f82a0066413bcc989c3d57d915c0add00b696..4fbede48721b20714b43ca74026b6d2683a21efc 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
CloseFile(s);
end;
+procedure ClearDebugCvars();
+begin
+ g_debug_Sounds := False;
+ g_debug_Frames := False;
+ g_debug_WinMsgs := False;
+ g_debug_MonsterOff := False;
+ g_debug_BotAIOff := 0;
+ g_debug_HealthBar := False;
+ g_Debug_Player := False;
+end;
+
function g_Game_ModeToText(Mode: Byte): string;
begin
Result := '';
function g_Game_IsNet(): Boolean;
begin
Result := (gGameSettings.GameType in [GT_SERVER, GT_CLIENT]);
-
- if gGameSettings.GameType in [GT_SERVER, GT_CLIENT] then
- begin
- // set debug options to false to avoid cheaters
- g_debug_Sounds := False;
- g_debug_Frames := False;
- g_debug_WinMsgs := False;
- g_debug_MonsterOff := False;
- g_debug_BotAIOff := 0;
- g_debug_HealthBar := False;
- g_Debug_Player := False;
- Exit;
- end;
end;
function g_Game_IsServer(): Boolean;
g_Game_ClearLoading();
+ ClearDebugCvars();
+
// Íàñòðîéêè èãðû:
gGameSettings.GameType := GT_SERVER;
gGameSettings.GameMode := GameMode;
g_Game_ClearLoading();
+ ClearDebugCvars();
+
// Íàñòðîéêè èãðû:
gGameSettings.GameType := GT_CLIENT;
begin
a := StrToIntDef(p[1], 0);
g_Force_Model_Set(a);
+ if (g_Force_Model_Get() <> 0) and (gPlayers <> nil) then
+ begin
+ for a := Low(gPlayers) to High(gPlayers) do
+ begin
+ if (gPlayers[a] <> nil) then
+ begin
+ if (gPlayers[a].UID = gPlayer1.UID) then
+ continue
+ else if (gPlayer2 <> nil) and (gPlayers[a].UID = gPlayer2.UID) then
+ continue;
+ gPlayers[a].setModel(g_Forced_Model_GetName());
+ end;
+ end
+ end
+ else if (g_Force_Model_Get() = 0) and (gPlayers <> nil) then
+ begin
+ for a := Low(gPlayers) to High(gPlayers) do
+ begin
+ if (gPlayers[a] <> nil) then
+ begin
+ if (gPlayers[a].UID = gPlayer1.UID) then
+ continue
+ else if (gPlayer2 <> nil) and (gPlayers[a].UID = gPlayer2.UID) then
+ continue;
+ gPlayers[a].setModel(gPlayers[a].FActualModelName);
+ end;
+ end
+ end
end
end
else if cmd = 'g_force_model_name' then
begin
cmd := b_Text_Unformat(P[1]);
g_Forced_Model_SetName(cmd);
- if (gGameSettings.GameType <> GT_SINGLE) and (g_Force_Model_Get() <> 0) and (gPlayers <> nil) then
+ if (g_Force_Model_Get() <> 0) and (gPlayers <> nil) then
begin
for a := Low(gPlayers) to High(gPlayers) do
begin
nm: Boolean;
listen: LongWord;
found: Boolean;
+ t: Byte;
begin
// Îáùèå êîìàíäû:
cmd := LowerCase(P[0]);
if (pl <> nil) then
begin
s := g_Net_ClientName_ByID(pl^.ID);
- enet_peer_disconnect(pl^.Peer, NET_DISC_KICK);
+ g_Net_Host_Kick(pl^.ID, NET_DISC_KICK);
g_Console_Add(Format(_lc[I_PLAYER_KICK], [s]));
MH_SEND_GameEvent(NET_EV_PLAYER_KICK, 0, s);
g_Net_Slist_ServerPlayerLeaves();
if NetClients[a].Used and (NetClients[a].Peer <> nil) then
begin
s := g_Net_ClientName_ByID(NetClients[a].ID);
- enet_peer_disconnect(NetClients[a].Peer, NET_DISC_KICK);
+ g_Net_Host_Kick(NetClients[a].ID, NET_DISC_KICK);
g_Console_Add(Format(_lc[I_PLAYER_KICK], [s]));
MH_SEND_GameEvent(NET_EV_PLAYER_KICK, 0, s);
g_Net_Slist_ServerPlayerLeaves();
if (pl <> nil) and pl^.Used and (pl^.Peer <> nil) then
begin
s := g_Net_ClientName_ByID(pl^.ID);
- enet_peer_disconnect(pl^.Peer, NET_DISC_KICK);
+ g_Net_Host_Kick(pl^.ID, NET_DISC_KICK);
g_Console_Add(Format(_lc[I_PLAYER_KICK], [s]));
MH_SEND_GameEvent(NET_EV_PLAYER_KICK, 0, s);
g_Net_Slist_ServerPlayerLeaves();
begin
s := g_Net_ClientName_ByID(pl^.ID);
g_Net_BanHost(pl^.Peer^.address.host, False);
- enet_peer_disconnect(pl^.Peer, NET_DISC_TEMPBAN);
+ 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();
begin
s := g_Net_ClientName_ByID(NetClients[a].ID);
g_Net_BanHost(NetClients[a].Peer^.address.host, False);
- enet_peer_disconnect(NetClients[a].Peer, NET_DISC_TEMPBAN);
+ 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();
begin
s := g_Net_ClientName_ByID(pl^.ID);
g_Net_BanHost(pl^.Peer^.address.host, False);
- enet_peer_disconnect(pl^.Peer, NET_DISC_TEMPBAN);
+ 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();
begin
s := g_Net_ClientName_ByID(pl^.ID);
g_Net_BanHost(pl^.Peer^.address.host);
- enet_peer_disconnect(pl^.Peer, NET_DISC_BAN);
+ 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);
begin
s := g_Net_ClientName_ByID(NetClients[a].ID);
g_Net_BanHost(NetClients[a].Peer^.address.host);
- enet_peer_disconnect(NetClients[a].Peer, NET_DISC_BAN);
+ 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);
begin
s := g_Net_ClientName_ByID(pl^.ID);
g_Net_BanHost(pl^.Peer^.address.host);
- enet_peer_disconnect(pl^.Peer, NET_DISC_BAN);
+ 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);
begin
if Length(P) = 2 then
g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1))
- else if Length(P) = 3 then
- g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1), StrToIntDef(P[2], 100))
else
- g_Bot_AddList(IfThen(P[2] = 'red', TEAM_RED, TEAM_BLUE), P[1], StrToIntDef(P[1], -1));
+ begin
+ if P[2] = 'red' then
+ t := TEAM_RED
+ else if P[2] = 'blue' then
+ t := TEAM_BLUE
+ else
+ t := TEAM_NONE;
+
+ if Length(P) = 3
+ then g_Bot_AddList(t, P[1], StrToIntDef(P[1], -1))
+ else g_Bot_AddList(t, P[1], StrToIntDef(P[1], -1), StrToIntDef(P[3], 100));
+ end;
end;
end
else if cmd = 'bot_removeall' then
g_Console_Add(_lc[I_MSG_GM_UNAVAIL])
end
end
+ else if not e_IsValidResourceName(P[1]) then
+ begin
+ g_Console_Add('wad name must not be absolute or relative');
+ end
else
begin
if g_Game_IsServer and (gGameSettings.GameType <> GT_SINGLE) then
g_Console_Add(_lc[I_MSG_GM_UNAVAIL]);
end;
end
+ else if not e_IsValidResourceName(P[1]) then
+ begin
+ g_Console_Add('wad name must not be absolute or relative');
+ end
else
begin
nm := False;