From: Ketmar Dark Date: Mon, 28 Aug 2017 10:38:00 +0000 (+0300) Subject: Holmes cursor shadow cosmetix X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=b4a2614636a9cc12ce9766ec1e2bf04cd5bec0ea;p=d2df-sdl.git Holmes cursor shadow cosmetix --- diff --git a/src/game/g_holmes.inc b/src/game/g_holmes.inc index 6ebe034..d103cdb 100644 --- a/src/game/g_holmes.inc +++ b/src/game/g_holmes.inc @@ -21,29 +21,29 @@ const curWidth = 17; const curHeight = 23; const cursorImg: array[0..curWidth*curHeight-1] of Byte = ( - 0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,0,3,2,2,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,3,3,2,2,0,0,0,0,0,0,0,0,0,0,0, - 1,1,3,3,4,2,2,0,0,0,0,0,0,0,0,0,0, - 1,1,3,3,4,4,2,2,0,0,0,0,0,0,0,0,0, - 1,1,3,3,4,4,4,2,2,0,0,0,0,0,0,0,0, - 1,1,3,3,4,4,4,4,2,2,0,0,0,0,0,0,0, - 1,1,3,3,4,4,4,5,6,2,2,0,0,0,0,0,0, - 1,1,3,3,4,4,5,6,7,5,2,2,0,0,0,0,0, - 1,1,3,3,4,5,6,7,5,4,5,2,2,0,0,0,0, - 1,1,3,3,5,6,7,5,4,5,6,7,2,2,0,0,0, - 1,1,3,3,6,7,5,4,5,6,7,7,7,2,2,0,0, - 1,1,3,3,7,5,4,5,6,7,7,7,7,7,2,2,0, - 1,1,3,3,5,4,5,6,8,8,8,8,8,8,8,8,2, - 1,1,3,3,4,5,6,3,8,8,8,8,8,8,8,8,8, - 1,1,3,3,5,6,3,3,1,1,1,1,1,1,1,0,0, - 1,1,3,3,6,3,3,1,1,1,1,1,1,1,1,0,0, - 1,1,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0, - 1,1,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0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^, curTexWidth*curTexHeight*4, 0); - tpp := tex; + // draw shadow + for y := 0 to curHeight-1 do + begin + for x := 0 to curWidth-1 do + begin + if (cursorImg[y*curWidth+x] <> 0) then + begin + c := 1*4; + tpp := tex+((y+1)*(curTexWidth*4)+(x+3)*4); + tpp^ := cursorPal[c+0]; Inc(tpp); + tpp^ := cursorPal[c+1]; Inc(tpp); + tpp^ := cursorPal[c+2]; Inc(tpp); + tpp^ := cursorPal[c+3]; Inc(tpp); + tpp^ := cursorPal[c+0]; Inc(tpp); + tpp^ := cursorPal[c+1]; Inc(tpp); + tpp^ := cursorPal[c+2]; Inc(tpp); + tpp^ := cursorPal[c+3]; Inc(tpp); + end; + end; + end; + + // draw cursor 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; - tpp^ := cursorPal[c+0]; Inc(tpp); - tpp^ := cursorPal[c+1]; Inc(tpp); - tpp^ := cursorPal[c+2]; Inc(tpp); - tpp^ := cursorPal[c+3]; Inc(tpp); + if (c <> 0) then + begin + tpp := tex+(y*(curTexWidth*4)+x*4); + tpp^ := cursorPal[c+0]; Inc(tpp); + tpp^ := cursorPal[c+1]; Inc(tpp); + tpp^ := cursorPal[c+2]; Inc(tpp); + tpp^ := cursorPal[c+3]; Inc(tpp); + end; end; end; @@ -114,14 +138,14 @@ begin glEnable(GL_TEXTURE_2D); // color and opacity glColor4f(1, 1, 1, 0.9); - Dec(msX, 2); + //Dec(msX, 2); glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex2i(msX, msY); // top-left glTexCoord2f(1.0, 0.0); glVertex2i(msX+curTexWidth, msY); // top-right glTexCoord2f(1.0, 1.0); glVertex2i(msX+curTexWidth, msY+curTexHeight); // bottom-right glTexCoord2f(0.0, 1.0); glVertex2i(msX, msY+curTexHeight); // bottom-left glEnd(); - Inc(msX, 2); + //Inc(msX, 2); glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glColor4f(1, 1, 1, 1);