X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame%2Fg_game.pas;h=71eb6095d6ee5ef232245707315b9c1e2e347798;hb=bc73e6c570ea4dc04ecbb501a90bfc670141e161;hp=ebe014424a6183f8ae20d93dc30bb924f0d2a76f;hpb=d89c8f47a07275c25006502fe98e9428be12d788;p=d2df-sdl.git diff --git a/src/game/g_game.pas b/src/game/g_game.pas index ebe0144..71eb609 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -728,6 +728,17 @@ begin 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 := ''; @@ -4673,6 +4684,8 @@ begin g_Game_ClearLoading(); + ClearDebugCvars(); + // Íàñòðîéêè èãðû: gGameSettings.GameType := GT_SERVER; gGameSettings.GameMode := GameMode; @@ -4806,6 +4819,8 @@ begin g_Game_ClearLoading(); + ClearDebugCvars(); + // Íàñòðîéêè èãðû: gGameSettings.GameType := GT_CLIENT; @@ -5767,15 +5782,43 @@ begin 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 + end else if cmd = 'g_force_model_name' then begin if (Length(P) > 1) 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 @@ -6516,6 +6559,7 @@ var nm: Boolean; listen: LongWord; found: Boolean; + t: Byte; begin // Îáùèå êîìàíäû: cmd := LowerCase(P[0]); @@ -6560,7 +6604,7 @@ begin 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(); @@ -6604,7 +6648,7 @@ begin 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(); @@ -6633,7 +6677,7 @@ begin 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(); @@ -6661,7 +6705,7 @@ begin 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(); @@ -6691,7 +6735,7 @@ begin 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(); @@ -6720,7 +6764,7 @@ begin 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(); @@ -6748,7 +6792,7 @@ begin 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); @@ -6779,7 +6823,7 @@ begin 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); @@ -6809,7 +6853,7 @@ begin 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); @@ -6934,23 +6978,29 @@ begin else if (cmd = 'addbot') or (cmd = 'bot_add') then begin - if Length(P) > 2 then - g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2), StrToIntDef(P[2], 100)) - else if Length(P) > 1 then - g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2)) + case Length(P) of + 1: g_Bot_Add(TEAM_NONE, 2); + 2: g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2)); else - g_Bot_Add(TEAM_NONE, 2); + g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2), StrToIntDef(P[2], 100)); + end; end else if cmd = 'bot_addlist' then begin - if Length(P) > 1 then - 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)); + case Length(P) of + 1: g_Bot_AddList(TEAM_NONE, ''); + 2: g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1)); + else + 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 else if cmd = 'bot_removeall' then @@ -7168,6 +7218,10 @@ begin 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 @@ -7295,6 +7349,10 @@ begin 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;