DEADSOFTWARE

game: fix playermodel forcing
[d2df-sdl.git] / src / game / g_game.pas
index b8c69a1cf396b26dd41d88dd9625393cd6b2afdf..34a387ab255c4a9fb8eefee58216c06dfca0a291 100644 (file)
@@ -774,6 +774,19 @@ end;
 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;
@@ -4821,15 +4834,6 @@ begin
 // Óñòàíîâêà ðàçìåðîâ îêîí èãðîêîâ:
   g_Game_SetupScreenSize();
 
-// 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;
-
   NetState := NET_STATE_AUTH;
 
   g_Game_SetLoadingText(_lc[I_LOAD_CONNECT], 0, False);
@@ -5776,6 +5780,34 @@ 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
   else if cmd = 'g_force_model_name' then
@@ -5784,7 +5816,7 @@ begin
     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