Commit 5a6541f6 authored by Steven Fuller's avatar Steven Fuller

Added a check to clip sprites so they do not draw outside the viewarea

parent 4c8935b5
...@@ -25,8 +25,10 @@ work the same, let the input handler do it all instead ...@@ -25,8 +25,10 @@ work the same, let the input handler do it all instead
i think its safe for now to go with the scancodes as being the "universal" i think its safe for now to go with the scancodes as being the "universal"
key type, and for everything not scancode-based, have a function to key type, and for everything not scancode-based, have a function to
translate translate
* maybe there are sprite drawing/clipping bugs that will cause it to draw * fix BuildCompScale so that the clipping code is not neccessary in
outside the viewarea, leaving artifacts BuildCompScale, so you can remove if ((ny+ys) >= viewheight)) ...
else there are sprite drawing/clipping bugs that will cause it to draw
outside the viewarea (at least at the bottom), leaving artifacts
* remove GOODTIMES? * remove GOODTIMES?
* Consider removing the SOD manual check * Consider removing the SOD manual check
* perhaps rename UPLOAD * perhaps rename UPLOAD
...@@ -88,3 +90,4 @@ at a time ...@@ -88,3 +90,4 @@ at a time
* beos is c++ (and uses gcc as a compiler i think) but wolf3d will need many * beos is c++ (and uses gcc as a compiler i think) but wolf3d will need many
cleanups for c++ cleanups for c++
either that or use extern "C" { ... } in the header files either that or use extern "C" { ... } in the header files
* change wl_scale to use mac wolf3d's version of scaling
...@@ -786,18 +786,6 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2) ...@@ -786,18 +786,6 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2)
XSetForeground(dpy, gc, *(gfxbuf + x1 + y1 * 320)); XSetForeground(dpy, gc, *(gfxbuf + x1 + y1 * 320));
XDrawPoint(dpy, win, gc, x2, y2); XDrawPoint(dpy, win, gc, x2, y2);
} else { } else {
#if 0
unsigned char pix = *(gfxbuf + x1 + y1 * 320);
XColor c;
c.pixel = 0;
c.flags = DoRed|DoGreen|DoBlue;
c.red = mypal[pix*3+0] << 10;
c.green = mypal[pix*3+1] << 10;
c.blue = mypal[pix*3+2] << 10;
XStoreColor(dpy, cmap, &c);
XSetForeground(dpy, gc, 0);
XDrawPoint(dpy, win, gc, x2, y2);
#endif
#if 0 #if 0
unsigned char pix = *(gfxbuf + x1 + y1 * 320); unsigned char pix = *(gfxbuf + x1 + y1 * 320);
XColor c; XColor c;
...@@ -807,7 +795,6 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2) ...@@ -807,7 +795,6 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2)
c.green = mypal[pix*3+1] << 10; c.green = mypal[pix*3+1] << 10;
c.blue = mypal[pix*3+2] << 10; c.blue = mypal[pix*3+2] << 10;
XAllocColor(dpy, cmap, &c); XAllocColor(dpy, cmap, &c);
//XStoreColor(dpy, cmap, &c);
XSetForeground(dpy, gc, c.pixel); XSetForeground(dpy, gc, c.pixel);
XDrawPoint(dpy, win, gc, x2, y2); XDrawPoint(dpy, win, gc, x2, y2);
#endif #endif
......
...@@ -94,13 +94,6 @@ void SetupScaling(int maxscaleheight) ...@@ -94,13 +94,6 @@ void SetupScaling(int maxscaleheight)
= =
= height should be even = height should be even
= =
= Call with
= ---------
= DS:SI Source for scale
= ES:DI Dest for scale
=
= Calling the compiled scaler only destroys AL
=
======================== ========================
*/ */
...@@ -150,8 +143,6 @@ void xBuildCompScale(int height, byte *source, int x) ...@@ -150,8 +143,6 @@ void xBuildCompScale(int height, byte *source, int x)
= =
= ScaleLine = ScaleLine
= =
= linescale should have the high word set to the segment of the scaler
=
======================= =======================
*/ */
...@@ -166,34 +157,26 @@ t_compshape *shapeptr; ...@@ -166,34 +157,26 @@ t_compshape *shapeptr;
slinex - screen coord of first column slinex - screen coord of first column
*/ */
void ScaleLine (void) void ScaleLine()
{ {
int x, y, ys; int x, y, ys;
int n, ny; int n, ny;
int y0, y1; int y0, y1;
unsigned char *pixels; unsigned char *pixels;
unsigned char color; unsigned char color;
#ifdef DEBUGx
printf ("ScaleLine\n");
printf (" slinex = %d, slinewidth = %d\n", slinex, slinewidth);
#endif
while (linecmds[0]) { while (linecmds[0]) {
y0 = linecmds[2]/2; y0 = linecmds[2]/2;
y1 = linecmds[0]/2 - 1; y1 = linecmds[0]/2 - 1;
pixels = (unsigned char *) shapeptr + y0 + linecmds[1]; pixels = (unsigned char *) shapeptr + y0 + linecmds[1];
#ifdef DEBUGx
printf (" y0,y1 = %d,%d pixels = 0x%8x\n", y0, y1, pixels);
#endif
for (y=y0; y<=y1; y++) { for (y=y0; y<=y1; y++) {
ys = scaledata[linescale].desty[y]; ys = scaledata[linescale].desty[y];
color = *pixels++; color = *pixels++;
if (ys >= 0) { if (ys >= 0) {
//color = *pixels++;
for (ny=0; ny<scaledata[linescale].count[y]; ny++) { for (ny=0; ny<scaledata[linescale].count[y]; ny++) {
for (n=0,x=slinex; n<slinewidth; n++, x++) { if ( (ys+ny) >= viewheight ) break; /* TODO: fix BuildCompScale so this isn't necessary */
// fprintf(stderr, " (%d,%d)\n", x, ys+ny); for (n = 0, x = slinex; n < slinewidth; n++, x++) {
//if (ys < 0) continue;
VL_Plot(x+xoffset, ys+ny+yoffset, color); VL_Plot(x+xoffset, ys+ny+yoffset, color);
} }
} }
...@@ -216,12 +199,6 @@ void ScaleLine (void) ...@@ -216,12 +199,6 @@ void ScaleLine (void)
= start of segment pixel*2, used to jsl into compiled scaler = start of segment pixel*2, used to jsl into compiled scaler
= <repeat> = <repeat>
= =
= Setup for call
= --------------
= GC_MODE read mode 1, write mode 2
= GC_COLORDONTCARE set to 0, so all reads from video memory return 0xff
= GC_INDEX pointing at GC_BITMASK
=
======================= =======================
*/ */
...@@ -416,12 +393,6 @@ void ScaleShape(int xcenter, int shapenum, unsigned height) ...@@ -416,12 +393,6 @@ void ScaleShape(int xcenter, int shapenum, unsigned height)
= start of segment pixel*2, used to jsl into compiled scaler = start of segment pixel*2, used to jsl into compiled scaler
= <repeat> = <repeat>
= =
= Setup for call
= --------------
= GC_MODE read mode 1, write mode 2
= GC_COLORDONTCARE set to 0, so all reads from video memory return 0xff
= GC_INDEX pointing at GC_BITMASK
=
======================= =======================
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment