summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2bdaa61)
raw | patch | inline | side by side (parent: 2bdaa61)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 27 Aug 2017 16:46:31 +0000 (19:46 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 27 Aug 2017 16:46:50 +0000 (19:46 +0300) |
src/game/g_holmes.inc | patch | blob | history | |
src/game/g_holmes.pas | patch | blob | history | |
src/game/g_holmes_ui.inc | patch | blob | history |
diff --git a/src/game/g_holmes.inc b/src/game/g_holmes.inc
index c8f2ace0c6dd83b805e28d9366334d587b04434d..a6d38f47873fcc2683c18e8a6b605529d2b1fd5b 100644 (file)
--- a/src/game/g_holmes.inc
+++ b/src/game/g_holmes.inc
*)
// ////////////////////////////////////////////////////////////////////////// //
// cursor (hi, Death Track!)
+const curTexWidth = 32;
+const curTexHeight = 32;
const curWidth = 17;
const curHeight = 23;
begin
if (curtexid <> 0) then exit; //begin glDeleteTextures(1, @curtexid); curtexid := 0; end;
- GetMem(tex, curWidth*curHeight*4);
+ GetMem(tex, curTexWidth*curTexHeight*4);
+ FillChar(tex^, curTexWidth*curTexHeight*4, 0);
tpp := tex;
for y := 0 to curHeight-1 do
begin
+ tpp := tex+(y*(curTexWidth*4));
for x := 0 to curWidth-1 do
begin
c := cursorImg[y*curWidth+x]*4;
//GLfloat[4] bclr = 0.0;
//glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, bclr.ptr);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, curWidth, curHeight, 0, GL_RGBA{gltt}, GL_UNSIGNED_BYTE, tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, curTexWidth, curTexHeight, 0, GL_RGBA{gltt}, GL_UNSIGNED_BYTE, tex);
glFlush();
//FreeMem(tex);
Dec(msX, 2);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2i(msX, msY); // top-left
- glTexCoord2f(1.0, 0.0); glVertex2i(msX+curWidth, msY); // top-right
- glTexCoord2f(1.0, 1.0); glVertex2i(msX+curWidth, msY+curHeight); // bottom-right
+ glTexCoord2f(1.0, 0.0); glVertex2i(msX+curTexWidth, msY); // top-right
+ glTexCoord2f(1.0, 1.0); glVertex2i(msX+curTexWidth, msY+curHeight); // bottom-right
glTexCoord2f(0.0, 1.0); glVertex2i(msX, msY+curHeight); // bottom-left
glEnd();
Inc(msX, 2);
diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas
index 1f68911b260c4c44994f6b1b982779dcec03a057..82a36e77d01bcc8aecca718b0d6539a875976a7a 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
// ////////////////////////////////////////////////////////////////////////// //
var
g_ol_nice: Boolean = false;
+ g_ol_fill_walls: Boolean = false;
g_ol_rlayer_back: Boolean = false;
g_ol_rlayer_step: Boolean = false;
g_ol_rlayer_wall: Boolean = false;
llb.appendItem('water', @g_ol_rlayer_water);
llb.appendItem('foreground', @g_ol_rlayer_fore);
llb.appendItem('', nil);
+ llb.appendItem('fill walls', @g_ol_fill_walls);
+ llb.appendItem('', nil);
llb.appendItem('slow''n''nice', @g_ol_nice);
winOutlines := THTopWindow.Create('outlines', 100, 10);
winOutlines.escClose := true;
procedure drawOutlines ();
+var
+ r, g, b: Integer;
+
procedure clearEdgeBmp ();
begin
SetLength(edgeBmp, (gWinSizeX+4)*(gWinSizeY+4));
sx, len, y0, y1: Integer;
begin
if (pan = nil) or (pan.Width < 1) or (pan.Height < 1) then exit;
- if (pan.X+pan.Width <= vpx-1) or (pan.Y+pan.Height <= vpy-1) or (pan.X >= vpx+vpw+1) or (pan.Y >= vpy+vph+1) then exit;
- if g_ol_nice then
+ if (pan.X+pan.Width <= vpx-1) or (pan.Y+pan.Height <= vpy-1) then exit;
+ if (pan.X >= vpx+vpw+1) or (pan.Y >= vpy+vph+1) then exit;
+ if g_ol_nice or g_ol_fill_walls then
begin
sx := pan.X-(vpx-1);
len := pan.Width;
- if (len > vpw+2) then len := vpw+2;
+ if (len > gWinSizeX+4) then len := gWinSizeX+4;
if (sx < 0) then begin len += sx; sx := 0; end;
- if (sx+len > vpw+2) then len := vpw+2-sx;
+ if (sx+len > gWinSizeX+4) then len := gWinSizeX+4-sx;
if (len < 1) then exit;
assert(sx >= 0);
- assert(sx+len <= vpw+2);
+ assert(sx+len <= gWinSizeX+4);
y0 := pan.Y-(vpy-1);
y1 := y0+pan.Height;
if (y0 < 0) then y0 := 0;
- if (y1 > vph+2) then y1 := vph+2;
+ if (y1 > gWinSizeY+4) then y1 := gWinSizeY+4;
while (y0 < y1) do
begin
FillChar(edgeBmp[y0*(gWinSizeX+4)+sx], len*sizeof(edgeBmp[0]), 1);
end
else
begin
- drawRect(pan.X, pan.Y, pan.Width, pan.Height, 255, 255, 255);
+ drawRect(pan.X, pan.Y, pan.Width, pan.Height, r, g, b);
end;
end;
glPointSize(1);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_POLYGON_SMOOTH);
- glColor4f(1.0, 1.0, 1.0, 1.0);
+ glColor4f(r/255.0, g/255.0, b/255.0, 1.0);
glBegin(GL_POINTS);
for y := 1 to vph do
begin
glEnd();
end;
- procedure doWallsOld (parr: array of TPanel; ptype: Word);
+ procedure drawFilledWalls ();
+ var
+ x, y, sx, ex: Integer;
+ a: PByte;
+ procedure drawLine ();
+ begin
+ if (sx >= 0) then
+ begin
+ glVertex2f(sx-1+vpx+0.37, y-1+vpy+0.37);
+ glVertex2f(ex+vpx+0.37, y-1+vpy+0.37);
+ end;
+ sx := -1;
+ ex := -1;
+ end;
+ begin
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glLineWidth(1);
+ glPointSize(1);
+ glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_POLYGON_SMOOTH);
+ glColor4f(r/255.0, g/255.0, b/255.0, 1.0);
+ glBegin(GL_LINES);
+ for y := 1 to vph do
+ begin
+ a := @edgeBmp[y*(gWinSizeX+4)+1];
+ sx := -1;
+ ex := -1;
+ for x := 1 to vpw do
+ begin
+ if (a[0] <> 0) then
+ begin
+ if (ex+1 <> x) then drawLine();
+ if (sx < 0) then
+ begin
+ sx := x;
+ ex := x;
+ end
+ else
+ begin
+ ex := x;
+ end;
+ end;
+ Inc(a);
+ end;
+ drawLine();
+ end;
+ glEnd();
+ end;
+
+ procedure doWallsOld (parr: array of TPanel; ptype: Word; ar, ag, ab: Integer);
var
f: Integer;
pan: TPanel;
begin
- if g_ol_nice then clearEdgeBmp();
+ r := ar;
+ g := ag;
+ b := ab;
+ if g_ol_nice or g_ol_fill_walls then clearEdgeBmp();
for f := 0 to High(parr) do
begin
pan := parr[f];
drawPanel(pan);
end;
if g_ol_nice then drawEdges();
+ if g_ol_fill_walls then drawFilledWalls();
end;
+var
+ xptag: Word;
+
function doWallCB (pan: TPanel; tag: Integer): Boolean;
begin
result := false; // don't stop
//if (pan = nil) or not pan.Enabled or (pan.Width < 1) or (pan.Height < 1) then exit;
+ if ((pan.PanelType and xptag) = 0) then exit;
drawPanel(pan);
end;
- procedure doWalls (parr: array of TPanel; ptype: Word);
+ procedure doWalls (parr: array of TPanel; ptype: Word; ar, ag, ab: Integer);
begin
- if g_ol_nice then clearEdgeBmp();
- mapGrid.forEachInAABB(vpx-1, vpy-1, vpw+2, vph+2, doWallCB, panelTypeToTag(ptype));
+ r := ar;
+ g := ag;
+ b := ab;
+ xptag := ptype;
+ if ((ptype and (PANEL_WALL or PANEL_OPENDOOR or PANEL_CLOSEDOOR)) <> 0) then ptype := GridTagWall or GridTagDoor
+ else panelTypeToTag(ptype);
+ if g_ol_nice or g_ol_fill_walls then clearEdgeBmp();
+ mapGrid.forEachInAABB(vpx-1, vpy-1, vpw+2, vph+2, doWallCB, ptype);
if g_ol_nice then drawEdges();
+ if g_ol_fill_walls then drawFilledWalls();
end;
begin
- if g_ol_rlayer_back then doWalls(gRenderBackgrounds, PANEL_BACK);
- if g_ol_rlayer_step then doWalls(gSteps, PANEL_STEP);
- if g_ol_rlayer_wall then doWalls(gWalls, PANEL_WALL);
- if g_ol_rlayer_door then doWalls(gWalls, PANEL_OPENDOOR or PANEL_CLOSEDOOR);
- if g_ol_rlayer_acid1 then doWalls(gAcid1, PANEL_ACID1);
- if g_ol_rlayer_acid2 then doWalls(gAcid2, PANEL_ACID2);
- if g_ol_rlayer_water then doWalls(gWater, PANEL_WATER);
- if g_ol_rlayer_fore then doWalls(gRenderForegrounds, PANEL_FORE);
+ if g_ol_rlayer_back then doWallsOld(gRenderBackgrounds, PANEL_BACK, 255, 127, 0);
+ if g_ol_rlayer_step then doWallsOld(gSteps, PANEL_STEP, 192, 192, 192);
+ if g_ol_rlayer_wall then doWallsOld(gWalls, PANEL_WALL, 255, 255, 255);
+ if g_ol_rlayer_door then doWallsOld(gWalls, PANEL_OPENDOOR or PANEL_CLOSEDOOR, 0, 255, 0);
+ if g_ol_rlayer_acid1 then doWallsOld(gAcid1, PANEL_ACID1, 255, 0, 0);
+ if g_ol_rlayer_acid2 then doWallsOld(gAcid2, PANEL_ACID2, 198, 198, 0);
+ if g_ol_rlayer_water then doWallsOld(gWater, PANEL_WATER, 0, 255, 255);
+ if g_ol_rlayer_fore then doWallsOld(gRenderForegrounds, PANEL_FORE, 210, 210, 210);
end;
index 4f372842ff369a7c8a598207b044152c1299188e..aaf304db0ada4f121e5b291fbe856203cd7e6f74 100644 (file)
--- a/src/game/g_holmes_ui.inc
+++ b/src/game/g_holmes_ui.inc
for f := 0 to High(mItems) do
begin
if (mCurIndex = f) then fillRect(sx-2, sy, mWidth, 8, 0, 128, 0);
- drawText8(sx, sy, '[ ]', 255, 255, 255);
- if (mChecks[f] <> nil) and (mChecks[f]^) then drawText8(sx+6, sy, 'x', 255, 255, 255);
- drawText8(sx+3*8+2, sy, mItems[f], 255, 255, 0);
+ if (mChecks[f] <> nil) then
+ begin
+ drawText8(sx, sy, '[ ]', 255, 255, 255);
+ if mChecks[f]^ then drawText8(sx+6, sy, 'x', 255, 255, 255);
+ drawText8(sx+3*8+2, sy, mItems[f], 255, 255, 0);
+ end;
Inc(sy, 8);
end;
end;