summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2c71e27)
raw | patch | inline | side by side (parent: 2c71e27)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 7 Sep 2017 01:57:22 +0000 (04:57 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 7 Sep 2017 01:57:56 +0000 (04:57 +0300) |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index b62a7e186c920d98b873e8c6eaebcd6f26d0292c..3bceba1c742bcdf4a8fbb877e38a1ebe170a9a5f 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
procedure g_Console_Chat_Switch (team: Boolean=false);
-procedure conRegVar (const conname: AnsiString; pvar: PBoolean; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false); overload;
-procedure conRegVar (const conname: AnsiString; pvar: PSingle; amin, amax: Single; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false); overload;
+procedure conRegVar (const conname: AnsiString; pvar: PBoolean; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
+procedure conRegVar (const conname: AnsiString; pvar: PSingle; amin, amax: Single; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
// poor man's floating literal parser; i'm sorry, but `StrToFloat()` sux cocks
function conParseFloat (var res: Single; const s: AnsiString): Boolean;
1: if not me.cheat or conIsCheatsEnabled then flag := true else begin conwriteln('not available'); exit; end;
666: if not me.cheat or conIsCheatsEnabled then flag := not flag else begin conwriteln('not available'); exit; end;
end;
- if flag then conwritefln('%s: tan', [msg]) else conwritefln('%s: ona', [msg]);
+ if (Length(msg) = 0) then msg := p[0] else msg += ':';
+ if flag then conwritefln('%s tan', [msg]) else conwritefln('%s ona', [msg]);
end;
end;
begin
end;
-procedure conRegVar (const conname: AnsiString; pvar: PBoolean; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false); overload;
+procedure conRegVar (const conname: AnsiString; pvar: PBoolean; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
var
f: Integer;
cp: PCommand;
cp.proc := nil;
cp.procEx := boolVarHandler;
cp.help := ahelp;
- cp.hidden := false;
+ cp.hidden := ahidden;
cp.ptr := pvar;
cp.msg := amsg;
cp.cheat := acheat;
begin
if (Length(p) > 2) then
begin
- conwritefln('too many arguments to ''%s''', [p[0]]);
+ conwritefln('too many arguments to ''%s''', [me.cmd]);
exit;
end;
pv := PVarSingle(me.ptr);
begin
if not conParseFloat(nv, p[1]) then
begin
- conwritefln('%s: ''%s'' doesn''t look like a floating number', [p[0], p[1]]);
+ conwritefln('%s: ''%s'' doesn''t look like a floating number', [me.cmd, p[1]]);
exit;
end;
if (nv < pv.min) then nv := pv.min;
end;
end;
msg := me.msg;
- if (Length(msg) = 0) then msg := p[0] else msg += ':';
+ if (Length(msg) = 0) then msg := me.cmd else msg += ':';
conwritefln('%s %s', [msg, pv.val^]);
end;
-procedure conRegVar (const conname: AnsiString; pvar: PSingle; amin, amax: Single; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false); overload;
+procedure conRegVar (const conname: AnsiString; pvar: PSingle; amin, amax: Single; const ahelp: AnsiString; const amsg: AnsiString; acheat: Boolean=false; ahidden: Boolean=false); overload;
var
f: Integer;
cp: PCommand;
cp.proc := nil;
cp.procEx := singleVarHandler;
cp.help := ahelp;
- cp.hidden := false;
+ cp.hidden := ahidden;
cp.ptr := pv;
cp.msg := amsg;
cp.cheat := acheat;
g_Console_Add('');
for i := 0 to High(commands) do
begin
- if not commands[i].hidden then
+ // hidden commands are hidden when cheats aren't enabled
+ if commands[i].hidden and not conIsCheatsEnabled then continue;
+ if (Length(commands[i].help) > 0) then
begin
- if (Length(commands[i].help) > 0) then
- begin
- g_Console_Add(' '+commands[i].cmd+' -- '+commands[i].help);
- end
- else
- begin
- g_Console_Add(' '+commands[i].cmd);
- end;
+ g_Console_Add(' '+commands[i].cmd+' -- '+commands[i].help);
+ end
+ else
+ begin
+ g_Console_Add(' '+commands[i].cmd);
end;
end;
exit;
ll := Copy(ll, 0, Length(ll)-1);
for i := 0 to High(commands) do
begin
- if commands[i].hidden then continue;
+ // hidden commands are hidden when cheats aren't enabled
+ if commands[i].hidden and not conIsCheatsEnabled then continue;
if (commands[i].cmd = ll) then
begin
if (Length(commands[i].help) > 0) then
tused := 0;
for i := 0 to High(commands) do
begin
- if commands[i].hidden then continue;
+ // hidden commands are hidden when cheats aren't enabled
+ if commands[i].hidden and not conIsCheatsEnabled then continue;
cmd := commands[i].cmd;
if (Length(cmd) >= Length(ll)) and (ll = Copy(cmd, 0, Length(ll))) then
begin
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 5f56a7439ce5199130240b02ffa0e188c3f2e7ee..467c13f1dcef4fabbfc06d6ddf07acaf08e23fd9 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,
diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index ff7089b46f31177abfc89971a3f66a28b8838e36..52c3b24890adb90e6ab452556ad93b65f220a654 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
procedure g_GFX_Draw ();
var
a, len: Integer;
- scaled: Boolean;
begin
if not gpart_dbg_enabled then exit;
glBegin(GL_POINTS);
- scaled := (g_dbg_scale <> 1.0);
-
len := High(Particles);
for a := 0 to len do
begin
with Particles[a] do
begin
if not alive then continue;
- if scaled or ((x >= sX) and (y >= sY) and (x <= sX+sWidth) and (sY <= sY+sHeight)) then
+ if (x >= sX) and (y >= sY) and (x <= sX+sWidth) and (sY <= sY+sHeight) then
begin
glColor4ub(red, green, blue, alpha);
glVertex2f(x+0.37, y+0.37);
diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas
index 82f2be14f94a8b48690bc135734901d91b018b48..9d215455e8fbbafe8c72f0ed67d3e9c1042fae61 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
function g_Holmes_KeyEvent (var ev: THKeyEvent): Boolean; // returns `true` if event was eaten
// hooks for player
-procedure g_Holmes_plrView (viewPortX, viewPortY, viewPortW, viewPortH: Integer);
+procedure g_Holmes_plrViewPos (viewPortX, viewPortY: Integer);
+procedure g_Holmes_plrViewSize (viewPortW, viewPortH: Integer);
procedure g_Holmes_plrLaser (ax0, ay0, ax1, ay1: Integer);
platMarkedGUID: Integer = -1;
-procedure g_Holmes_plrView (viewPortX, viewPortY, viewPortW, viewPortH: Integer);
+procedure g_Holmes_plrViewPos (viewPortX, viewPortY: Integer);
begin
vpSet := true;
vpx := viewPortX;
vpy := viewPortY;
+end;
+
+procedure g_Holmes_plrViewSize (viewPortW, viewPortH: Integer);
+begin
+ vpSet := true;
vpw := viewPortW;
vph := viewPortH;
end;
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index c7565417c799ce2952c103a6c881e3cc53506d0a..6365d7bbe2bee8fe88233355921860a0dec509fa 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
with ggItems[i] do
begin
- if (g_dbg_scale <> 1.0) or g_Collide(Obj.X, Obj.Y, Obj.Rect.Width, Obj.Rect.Height, sX, sY, sWidth, sHeight) then
+ if g_Collide(Obj.X, Obj.Y, Obj.Rect.Width, Obj.Rect.Height, sX, sY, sWidth, sHeight) then
begin
if (Animation = nil) then
begin
index d982204b256927b22a1f2c24666397c5739d7a87..71619512a3648a3d69e88eb390f5a5f2f8941a20 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
o.Y+o.Rect.Y+o.Rect.Height-128, M_NONE);
// Íå â îáëàñòè ðèñîâàíèÿ íå ðåñóåì:
+//FIXME!
if (g_dbg_scale = 1.0) then
begin
if not g_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y, FObj.Rect.Width, FObj.Rect.Height,
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index b43a6683f751e828b9d7d2e94f21918af4fe402e..5e2988572ad5e129746b5caf8b546a9bb36e4e99 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
NW, NH: Word;
begin
if {Enabled and} (FCurTexture >= 0) and
- (Width > 0) and (Height > 0) and (FAlpha < 255) and
- ((g_dbg_scale <> 1.0) or g_Collide(X, Y, Width, Height, sX, sY, sWidth, sHeight)) then
+ (Width > 0) and (Height > 0) and (FAlpha < 255) {and
+ g_Collide(X, Y, Width, Height, sX, sY, sWidth, sHeight)} then
begin
if FTextureIDs[FCurTexture].Anim then
begin // Àíèìèðîâàííàÿ òåêñòóðà
@@ -493,8 +493,8 @@ procedure TPanel.DrawShadowVolume(lightX: Integer; lightY: Integer; radius: Inte
begin
if radius < 4 then exit;
- if Enabled and (FCurTexture >= 0) and (Width > 0) and (Height > 0) and (FAlpha < 255) and
- ((g_dbg_scale <> 1.0) or g_Collide(X, Y, Width, Height, sX, sY, sWidth, sHeight)) then
+ if Enabled and (FCurTexture >= 0) and (Width > 0) and (Height > 0) and (FAlpha < 255) {and
+ g_Collide(X, Y, Width, Height, sX, sY, sWidth, sHeight)} then
begin
if not FTextureIDs[FCurTexture].Anim then
begin
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 300979a87de4011a595a4d59af4704d9132f74a3..98535cc9ef2f36220f98ba05b4cbb0a401598cac 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
if not (R_BERSERK in FRulez) then
begin
Include(FRulez, R_BERSERK);
- if gBerserkAutoswitch and (FBFGFireCounter = -1) then
+ if gBerserkAutoswitch and (gDebugMode or gCheats) and (FBFGFireCounter = -1) then
begin
FCurrWeap := WEAPON_KASTET;
resetWeaponQueue();
FDifficult := TDifficult(p^);
end;
+
+begin
+ conRegVar('cheat_berserk_autoswitch', @gBerserkAutoswitch, 'autoswitch to fist when berserk pack taken', '', true, true);
end.