diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 7f77a41a3194d89279f537bdd2d656cc92030b85..73c8ddf3a8c60127b66c8c7a37349a50b52abad2 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
end;
+function fixViewportForScale (): Boolean;
+var
+ nx0, ny0, nw, nh: Integer;
+begin
+ result := false;
+ if (g_dbg_scale <> 1.0) then
+ begin
+ result := true;
+ nx0 := round(sX-(gPlayerScreenSize.X-(sWidth*g_dbg_scale))/2/g_dbg_scale);
+ ny0 := round(sY-(gPlayerScreenSize.Y-(sHeight*g_dbg_scale))/2/g_dbg_scale);
+ nw := round(sWidth/g_dbg_scale);
+ nh := round(sHeight/g_dbg_scale);
+ sX := nx0;
+ sY := ny0;
+ sWidth := nw;
+ sHeight := nh;
+ end;
+end;
+
+
// setup sX, sY, sWidth, sHeight, and transformation matrix before calling this!
// WARNING! this WILL CALL `glTranslatef()`, but won't restore matrices!
-procedure renderMapInternal (backXOfs, backYOfs: Integer; transX, transY: Integer; setTransMatrix: Boolean);
+procedure renderMapInternal (backXOfs, backYOfs: Integer; setTransMatrix: Boolean);
type
TDrawCB = procedure ();
profileFrameDraw.sectionBegin('collect');
if gdbg_map_use_accel_render then
begin
- if (g_dbg_scale <> 1.0) then
- begin
- g_Map_CollectDrawPanels(sX, sY, round(sWidth/g_dbg_scale)+1, round(sHeight/g_dbg_scale)+1);
- end
- else
- begin
- g_Map_CollectDrawPanels(sX, sY, sWidth, sHeight);
- end;
+ g_Map_CollectDrawPanels(sX, sY, sWidth, sHeight);
end;
profileFrameDraw.sectionEnd();
if setTransMatrix then
begin
glScalef(g_dbg_scale, g_dbg_scale, 1.0);
- glTranslatef(transX, transY, 0);
+ glTranslatef(-sX, -sY, 0);
end;
drawPanelType('*back', PANEL_BACK, g_rlayer_back);
sWidth := w;
sHeight := h;
- renderMapInternal(-bx, -by, -x, -y, true);
+ fixViewportForScale();
+ renderMapInternal(-bx, -by, true);
glPopMatrix();
end;
px := p.GameX + PLAYER_RECT_CX;
py := p.GameY + PLAYER_RECT_CY+p.Obj.slopeUpLeft;
- if px > (gPlayerScreenSize.X div 2) then a := -px+(gPlayerScreenSize.X div 2) else a := 0;
- if py > (gPlayerScreenSize.Y div 2) then b := -py+(gPlayerScreenSize.Y div 2) else b := 0;
+ if (g_dbg_scale = 1.0) then
+ begin
+ if (px > (gPlayerScreenSize.X div 2)) then a := -px+(gPlayerScreenSize.X div 2) else a := 0;
+ if (py > (gPlayerScreenSize.Y div 2)) then b := -py+(gPlayerScreenSize.Y div 2) else b := 0;
- if px > gMapInfo.Width-(gPlayerScreenSize.X div 2) then a := -gMapInfo.Width+gPlayerScreenSize.X;
- if py > gMapInfo.Height-(gPlayerScreenSize.Y div 2) then b := -gMapInfo.Height+gPlayerScreenSize.Y;
+ if (px > gMapInfo.Width-(gPlayerScreenSize.X div 2)) then a := -gMapInfo.Width+gPlayerScreenSize.X;
+ if (py > gMapInfo.Height-(gPlayerScreenSize.Y div 2)) then b := -gMapInfo.Height+gPlayerScreenSize.Y;
- if (gMapInfo.Width = gPlayerScreenSize.X) then a := 0
- else if (gMapInfo.Width < gPlayerScreenSize.X) then
- begin
- // hcenter
- a := (gPlayerScreenSize.X-gMapInfo.Width) div 2;
- end;
+ if (gMapInfo.Width = gPlayerScreenSize.X) then a := 0
+ else if (gMapInfo.Width < gPlayerScreenSize.X) then
+ begin
+ // hcenter
+ a := (gPlayerScreenSize.X-gMapInfo.Width) div 2;
+ end;
- if (gMapInfo.Height = gPlayerScreenSize.Y) then b := 0
- else if (gMapInfo.Height < gPlayerScreenSize.Y) then
+ if (gMapInfo.Height = gPlayerScreenSize.Y) then b := 0
+ else if (gMapInfo.Height < gPlayerScreenSize.Y) then
+ begin
+ // vcenter
+ b := (gPlayerScreenSize.Y-gMapInfo.Height) div 2;
+ end;
+ end
+ else
begin
- // vcenter
- b := (gPlayerScreenSize.Y-gMapInfo.Height) div 2;
+ // scaled, ignore level bounds
+ a := -px+(gPlayerScreenSize.X div 2);
+ b := -py+(gPlayerScreenSize.Y div 2);
end;
if p.IncCam <> 0 then
//glTranslatef(a, b+p.IncCam, 0);
+ if (p = gPlayer1) then g_Holmes_plrViewSize(sWidth, sHeight);
+
+ fixViewportForScale();
p.viewPortX := sX;
p.viewPortY := sY;
p.viewPortW := sWidth;
p.viewPortH := sHeight;
- if (p = gPlayer1) then
- begin
- g_Holmes_plrView(p.viewPortX, p.viewPortY, p.viewPortW, p.viewPortH);
- end;
+ if (p = gPlayer1) then g_Holmes_plrViewPos(sX, sY);
- renderMapInternal(-c, -d, a, b+p.IncCam, true);
+ renderMapInternal(-c, -d, true);
if p.FSpectator then
e_TextureFontPrintEx(p.GameX + PLAYER_RECT_CX - 4,
g_Player_ResetTeams();
- if Pos(':\', Map) > 0 then
+ if isWadPath(Map) then
begin
NewWAD := g_ExtractWadName(Map);
ResName := g_ExtractFileName(Map);
time: Integer;
}
begin
- a := Pos('.wad:\', gMapToDelete);
+ a := Pos('.wad:\', toLowerCase1251(gMapToDelete));
+ if (a = 0) then a := Pos('.wad:/', toLowerCase1251(gMapToDelete));
if a = 0 then
Exit;
g_Console_Add('player left the map');
gExitByTrigger := True;
//g_Game_ExitLevel(gTriggers[a].Data.MapName);
- g_Game_ExitLevel(gTriggers[a].trigData.trigMap);
+ g_Game_ExitLevel(gTriggers[a].tgcMap);
break;
end;
end;
begin
gExitByTrigger := True;
//gNextMap := gTriggers[a].Data.MapName;
- gNextMap := gTriggers[a].trigData.trigMap;
+ gNextMap := gTriggers[a].tgcMap;
Break;
end;
// Èùåì ñëåäóþùóþ êàðòó â WAD ôàéëå
if gNextMap = '' then
gNextMap := g_Game_GetNextMap();
// Ïðîâåðÿåì, íå çàäàí ëè WAD ôàéë ðåñóðñíîé ñòðîêîé
- if Pos(':\', gNextMap) = 0 then
+ if not isWadPath(gNextMap) then
s := gGameSettings.WAD + ':\' + gNextMap
else
s := gNextMap;
with gTriggers[i] do
if (TriggerType = TRIGGER_SOUND) and
(Sound <> nil) and
- (trigData.trigLocal) and
+ (tgcLocal) and
Sound.IsPlaying() then
begin
if ((gPlayer1 <> nil) and g_CollidePoint(gPlayer1.GameX, gPlayer1.GameY, X, Y, Width, Height)) or
((gPlayer2 <> nil) and g_CollidePoint(gPlayer2.GameX, gPlayer2.GameY, X, Y, Width, Height)) then
begin
- Sound.SetPan(0.5 - trigData.trigPan/255.0);
- Sound.SetVolume(trigData.trigVolume/255.0);
+ Sound.SetPan(0.5 - tgcPan/255.0);
+ Sound.SetVolume(tgcVolume/255.0);
end
else
- Sound.SetCoords(X+(Width div 2), Y+(Height div 2), trigData.trigVolume/255.0);
+ Sound.SetCoords(X+(Width div 2), Y+(Height div 2), tgcVolume/255.0);
end;
end;
s := Find_Param_Value(pars, '-exec');
if s <> '' then
begin
- if Pos(':\', s) = 0 then
+ if not isWadPath(s) then
s := GameDir + '/' + s;
{$I-}