summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d8e15c7)
raw | patch | inline | side by side (parent: d8e15c7)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 17 Aug 2017 10:15:24 +0000 (13:15 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 17 Aug 2017 14:41:07 +0000 (17:41 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_game.pas | patch | blob | history | |
src/game/g_map.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 9a790820d34708265d1c7d5f87e90ee661cbbf6b..694a9fad058ad34ca3da9cfc42ec9e69d9f2213c 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
AddCommand('dpp', ProfilerCommands);
AddCommand('dpu', ProfilerCommands);
+ AddCommand('r_draw_grid', ProfilerCommands);
+ AddCommand('dbg_coldet_grid', ProfilerCommands);
AddCommand('p1_name', GameCVars);
AddCommand('p2_name', GameCVars);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 14819e284ce75d894275691a2df17ee83f2f15a9..f966e26229eeac837a2e2536655b547d2a8a10f2 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
P2MoveButton: Byte = 0;
g_profile_frame_update: Boolean = false;
- g_profile_frame_draw: Boolean = true;
+ g_profile_frame_draw: Boolean = false;
procedure g_ResetDynlights ();
procedure g_AddDynLight (x, y, radius: Integer; r, g, b, a: Single);
procedure ProfilerCommands (P: SArray);
var
cmd: string;
+
+ function getBool (idx: Integer): Integer;
+ begin
+ if (idx < 0) or (idx > High(P)) then begin result := -1; exit; end;
+ result := 0;
+ if (P[idx] = '1') or (P[idx] = 'on') or (P[idx] = 'true') or (P[idx] = 'tan') then result := 1;
+ end;
+
begin
//if not gDebugMode then exit;
cmd := LowerCase(P[0]);
g_profile_frame_update := not g_profile_frame_update;
exit;
end;
+ if cmd = 'r_draw_grid' then
+ begin
+ case getBool(1) of
+ -1: begin end;
+ 0: gdbg_map_use_grid_render := false;
+ 1: gdbg_map_use_grid_render := true;
+ end;
+ if gdbg_map_use_grid_render then g_Console_Add('grid rendering: tan') else g_Console_Add('grid rendering: ona');
+ exit;
+ end;
+ if cmd = 'dbg_coldet_grid' then
+ begin
+ case getBool(1) of
+ -1: begin end;
+ 0: gdbg_map_use_grid_coldet := false;
+ 1: gdbg_map_use_grid_coldet := true;
+ end;
+ if gdbg_map_use_grid_coldet then g_Console_Add('grid coldet: tan') else g_Console_Add('grid coldet: ona');
+ exit;
+ end;
end;
procedure DebugCommands(P: SArray);
begin
Parse_Params(pars);
+ s := Find_Param_Value(pars, '--profile-frame');
+ if (s <> '') then g_profile_frame_draw := true;
+
// Debug mode:
s := Find_Param_Value(pars, '--debug');
if (s <> '') then
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 54d3763290be72f4d486f905a6d08265f5f18af1..42831447a301bf9409e28a2eb38bd66590b9f4a5 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
BackID: DWORD = DWORD(-1);
gExternalResources: TStringList;
+ gdbg_map_use_grid_render: Boolean = true;
+ gdbg_map_use_grid_coldet: Boolean = true;
+
implementation
uses
if not (drawDoors xor panels[idx].Door) then
begin
pan := panels[idx];
+ {
if (pan.Width < 1) or (pan.Height < 1) then continue;
if (pan.X+pan.Width <= x0) or (pan.Y+pan.Height <= y0) then continue;
if (pan.X >= x0+wdt) or (pan.Y >= y0+hgt) then continue;
- e_WriteLog(Format(' *body hit: (%d,%d)-(%dx%d) tag: %d; qtag:%d', [pan.X, pan.Y, pan.Width, pan.Height, PanelType, PanelType]), MSG_NOTIFY);
+ }
+ pan.Draw();
+ //e_WriteLog(Format(' *body hit: (%d,%d)-(%dx%d) tag: %d; qtag:%d', [pan.X, pan.Y, pan.Width, pan.Height, PanelType, PanelType]), MSG_NOTIFY);
end;
end;
end;
//e_WriteLog(Format('***QQQ: qtag:%d', [PanelType]), MSG_NOTIFY);
dplClear();
ptag := panelTypeToTag(PanelType);
- gMapGrid.forEachInAABB(x0, y0, wdt, hgt, checker);
-
- // debug
- {
- e_WriteLog(Format('+++QQQ: qtag:%d', [PanelType]), MSG_NOTIFY);
- case PanelType of
- PANEL_WALL: DrawPanels(0, gWalls);
- PANEL_CLOSEDOOR: DrawPanels(0, gWalls, True);
- PANEL_BACK: DrawPanels(1, gRenderBackgrounds);
- PANEL_FORE: DrawPanels(2, gRenderForegrounds);
- PANEL_WATER: DrawPanels(3, gWater);
- PANEL_ACID1: DrawPanels(4, gAcid1);
- PANEL_ACID2: DrawPanels(5, gAcid2);
- PANEL_STEP: DrawPanels(6, gSteps);
- end;
- e_WriteLog('==================', MSG_NOTIFY);
- }
- // sort and draw the list (we need to sort it, or rendering is fucked)
- while gDrawPanelList.count > 0 do
+ if gdbg_map_use_grid_render then
begin
- (gDrawPanelList.front() as TPanel).Draw();
- gDrawPanelList.popFront();
+ gMapGrid.forEachInAABB(x0, y0, wdt, hgt, checker);
+ // sort and draw the list (we need to sort it, or rendering is fucked)
+ while gDrawPanelList.count > 0 do
+ begin
+ (gDrawPanelList.front() as TPanel).Draw();
+ gDrawPanelList.popFront();
+ end;
+ end
+ else
+ begin
+ //e_WriteLog(Format('+++QQQ: qtag:%d', [PanelType]), MSG_NOTIFY);
+ case PanelType of
+ PANEL_WALL: DrawPanels(0, gWalls);
+ PANEL_CLOSEDOOR: DrawPanels(0, gWalls, True);
+ PANEL_BACK: DrawPanels(1, gRenderBackgrounds);
+ PANEL_FORE: DrawPanels(2, gRenderForegrounds);
+ PANEL_WATER: DrawPanels(3, gWater);
+ PANEL_ACID1: DrawPanels(4, gAcid1);
+ PANEL_ACID2: DrawPanels(5, gAcid2);
+ PANEL_STEP: DrawPanels(6, gSteps);
+ end;
end;
+
+ //e_WriteLog('==================', MSG_NOTIFY);
end;
e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
end;
-(*
function g_Map_CollidePanelOld(X, Y: Integer; Width, Height: Word;
PanelType: Word; b1x3: Boolean): Boolean;
var
end;
end;
end;
-*)
+
+function g_Map_CollideLiquid_TextureOld(X, Y: Integer; Width, Height: Word): DWORD;
+var
+ texid: DWORD;
+
+ function checkPanels (var panels: TPanelArray): Boolean;
+ var
+ a: Integer;
+ begin
+ result := false;
+ if panels = nil then exit;
+ for a := 0 to High(panels) do
+ begin
+ if g_Collide(X, Y, Width, Height, panels[a].X, panels[a].Y, panels[a].Width, panels[a].Height) then
+ begin
+ result := true;
+ texid := panels[a].GetTextureID();
+ exit;
+ end;
+ end;
+ end;
+
+begin
+ texid := TEXTURE_NONE;
+ result := texid;
+ if not checkPanels(gWater) then
+ if not checkPanels(gAcid1) then
+ if not checkPanels(gAcid2) then exit;
+ result := texid;
+end;
+
function g_Map_CollidePanel(X, Y: Integer; Width, Height: Word; PanelType: Word; b1x3: Boolean): Boolean;
@@ -2139,7 +2177,7 @@ function g_Map_CollidePanel(X, Y: Integer; Width, Height: Word; PanelType: Word;
end;
end;
- if WordBool(PanelType and PANEL_BLOCKMON)and (tag = GridTagBlockMon) then
+ if WordBool(PanelType and PANEL_BLOCKMON) and (tag = GridTagBlockMon) then
begin
if ((not b1x3) or ((gBlockMon[a].Width + gBlockMon[a].Height) >= 64)) and
g_Collide(X, Y, Width, Height, gBlockMon[a].X, gBlockMon[a].Y, gBlockMon[a].Width, gBlockMon[a].Height) then
@@ -2151,7 +2189,14 @@ function g_Map_CollidePanel(X, Y: Integer; Width, Height: Word; PanelType: Word;
end;
begin
- result := gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
+ if gdbg_map_use_grid_coldet then
+ begin
+ result := gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
+ end
+ else
+ begin
+ result := g_Map_CollidePanelOld(X, Y, Width, Height, PanelType, b1x3);
+ end;
end;
end;
begin
- texid := TEXTURE_NONE;
- gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
- result := texid;
+ if not gdbg_map_use_grid_coldet then
+ begin
+ result := g_Map_CollideLiquid_TextureOld(X, Y, Width, Height);
+ end
+ else
+ begin
+ texid := TEXTURE_NONE;
+ gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
+ result := texid;
+ end;
end;
procedure g_Map_EnableWall(ID: DWORD);