diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 3105360e1e8a675a3f9b59f30e2842522b283f38..b73d5adb17dce7a8051fdcacc0148a77cd8ae167 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
gRC_FullScreen, gRC_Maximized: Boolean;
gLanguageChange: Boolean = False;
gDebugMode: Boolean = False;
- g_debug_WinMsgs: Boolean = False;
g_debug_MonsterOff: Boolean = False;
g_debug_BotAIOff: Byte = 0;
g_Debug_Player: Boolean = False;
procedure ClearDebugCvars();
begin
- g_debug_WinMsgs := False;
g_debug_MonsterOff := False;
g_debug_BotAIOff := 0;
g_Debug_Player := False;
var
reliableUpdate: Boolean;
+ rSpectX0, rSpectY0: Integer;
+ rSpectX1, rSpectY1: Integer;
begin
g_ResetDynlights();
framePool.reset();
// process weapon switch queue
end; // if server
- // Наблюдатель
+ // Spectator
+
+ {$IFDEF ENABLE_RENDER}
+ r_Render_GetSpectatorLimits(rSpectX0, rSpectY0, rSpectX1, rSpectY1);
+ {$ELSE}
+ rSpectX0 := 0; rSpectY0 := 0;
+ rSpectX1 := gMapInfo.Width - 1; rSpectY1 := gMapInfo.Height - 1;
+ {$ENDIF}
+
if (gPlayer1 = nil) and (gPlayer2 = nil)
and (not gConsoleShow) and (not gChatShow)
{$IFDEF ENABLE_MENU}
if (gSpectMode = SPECT_MAPVIEW)
and (not gSpectAuto) then
begin
- if gPlayerAction[0, ACTION_MOVELEFT] then
- gSpectX := Max(gSpectX - gSpectStep, 0);
- if gPlayerAction[0, ACTION_MOVERIGHT] then
- gSpectX := Min(gSpectX + gSpectStep, gMapInfo.Width - gScreenWidth);
- if gPlayerAction[0, ACTION_LOOKUP] then
- gSpectY := Max(gSpectY - gSpectStep, 0);
- if gPlayerAction[0, ACTION_LOOKDOWN] then
- gSpectY := Min(gSpectY + gSpectStep, gMapInfo.Height - gScreenHeight);
+ if gPlayerAction[0, ACTION_MOVELEFT] then gSpectX := gSpectX - gSpectStep;
+ if gPlayerAction[0, ACTION_MOVERIGHT] then gSpectX := gSpectX + gSpectStep;
+ if gPlayerAction[0, ACTION_LOOKUP] then gSpectY := gSpectY - gSpectStep;
+ if gPlayerAction[0, ACTION_LOOKDOWN] then gSpectY := gSpectY + gSpectStep;
if gWeaponAction[0, WP_PREV] then
begin
// decrease step
begin
if gSpectMode = SPECT_MAPVIEW then
begin
- i := Min(Max(gSpectX + gSpectAutoStepX, 0), gMapInfo.Width - gScreenWidth);
+ i := Min(Max(gSpectX + gSpectAutoStepX, rSpectX0), rSpectX1);
if i = gSpectX then
gSpectAutoNext := gTime
else
gSpectX := i;
- i := Min(Max(gSpectY + gSpectAutoStepY, 0), gMapInfo.Height - gScreenHeight);
+ i := Min(Max(gSpectY + gSpectAutoStepY, rSpectY0), rSpectY1);
if i = gSpectY then
gSpectAutoNext := gTime
else
case gSpectMode of
SPECT_MAPVIEW:
begin
- gSpectX := Random(gMapInfo.Width - gScreenWidth);
- gSpectY := Random(gMapInfo.Height - gScreenHeight);
+ gSpectX := rSpectX0 + Random(rSpectX1 - rSpectX0);
+ gSpectY := rSpectY0 + Random(rSpectY1 - rSpectY0);
gSpectAutoStepX := Random(9) - 4;
gSpectAutoStepY := Random(9) - 4;
- if ((gSpectX < 800) and (gSpectAutoStepX < 0)) or
- ((gSpectX > gMapInfo.Width - gScreenWidth - 800) and (gSpectAutoStepX > 0)) then
+ if ((gSpectX < rSpectX0) and (gSpectAutoStepX < 0)) or
+ ((gSpectX > rSpectX1) and (gSpectAutoStepX > 0)) then
gSpectAutoStepX := gSpectAutoStepX * -1;
- if ((gSpectY < 800) and (gSpectAutoStepY < 0)) or
- ((gSpectY > gMapInfo.Height - gScreenHeight - 800) and (gSpectAutoStepY > 0)) then
+ if ((gSpectY < rSpectY0) and (gSpectAutoStepY < 0)) or
+ ((gSpectY > rSpectY1) and (gSpectAutoStepY > 0)) then
gSpectAutoStepY := gSpectAutoStepY * -1;
end;
SPECT_PLAYERS:
end;
end;
end;
+
+ if gSpectMode = SPECT_MAPVIEW then
+ begin
+ gSpectX := Max(gSpectX, rSpectX0);
+ gSpectX := Min(gSpectX, rSpectX1);
+ gSpectY := Max(gSpectY, rSpectY0);
+ gSpectY := Min(gSpectY, rSpectY1);
+ end;
end;
(* spectator state check from render *)
g_Console_Add(Format('gScreenWidth = %d, gScreenHeight = %d', [gScreenWidth, gScreenHeight]));
g_Console_Add(Format('gScreenWidth = %d, gScreenHeight = %d', [gScreenWidth, gScreenHeight]));
end
- else if cmd = 'd_winmsg' then
- begin
- if (Length(P) > 1) and
- ((P[1] = '1') or (P[1] = '0')) then
- g_Debug_WinMsgs := (P[1][1] = '1');
-
- g_Console_Add(Format('d_winmsg is %d', [Byte(g_Debug_WinMsgs)]));
- end
else if (cmd = 'd_monoff') and not g_Game_IsNet then
begin
if (Length(P) > 1) and