From: TerminalHash Date: Wed, 26 Apr 2023 10:44:48 +0000 (+0300) Subject: game: fix playermodel forcing X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=fededec33cfb9690510025c63def9e6fd972ac2d;p=d2df-sdl.git game: fix playermodel forcing picked from https://github.com/Challenge9/doom2d-forever/commit/9575d93ae18fb2e7295fe44376f3621959a6463b because the fork contains many changes that prevent the patch from being applied. --- diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 4f6f82a..34a387a 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -5780,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 @@ -5788,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