Commit aa014f57 authored by Steven Fuller's avatar Steven Fuller

Fixed sprite clipping in BuildCompScale, and changed wall drawing to mac

version's
parent 16a98a20
...@@ -16,7 +16,7 @@ to/from just for reading, so only not-packed structures are used during ...@@ -16,7 +16,7 @@ to/from just for reading, so only not-packed structures are used during
actual gameplay/etc. actual gameplay/etc.
* is that memory intro screen needed anymore? probably not, although it * is that memory intro screen needed anymore? probably not, although it
would be nice to show what version is loaded, but doom just printed text would be nice to show what version is loaded, but doom just printed text
and the intro screen which came with wolf3d has copyrighted images and the intro screen which came with wolf3d has copyrighted/trademarked images
maybe make a new intro screen... maybe make a new intro screen...
* then, what about PG13? OH NO!!!! -- people would probably want the first * then, what about PG13? OH NO!!!! -- people would probably want the first
two screens for nostalga two screens for nostalga
...@@ -25,10 +25,6 @@ work the same, let the input handler do it all instead ...@@ -25,10 +25,6 @@ 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
* fix BuildCompScale so that the clipping code is not neccessary in
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
...@@ -75,7 +71,7 @@ but palette fades will still need it! damnit ...@@ -75,7 +71,7 @@ but palette fades will still need it! damnit
for every byte when transferring to the pixmap, palette fades require a for every byte when transferring to the pixmap, palette fades require a
screen update screen update
* make sure none of the code tries to handle gfx/sound data directly * make sure none of the code tries to handle gfx/sound data directly
* GL_shared_texture_palette for opengl * GL_EXT_shared_texture_palette for opengl
* if window looses focus, should it clear the keys ? * if window looses focus, should it clear the keys ?
* clean up vi_xlib.c: fix vid mode changing, fix dga for non8bit modes and * clean up vi_xlib.c: fix vid mode changing, fix dga for non8bit modes and
the nonpalette setting stuff... lots of if statements the nonpalette setting stuff... lots of if statements
...@@ -91,7 +87,9 @@ at a time ...@@ -91,7 +87,9 @@ at a time
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 * change wl_scale to use mac wolf3d's version of scaling
wall drawing is done, just needed to fix sprite code
* check in wolftools and add mac wolftools (currently the res dumping stuff) * check in wolftools and add mac wolftools (currently the res dumping stuff)
* have vi_xlib.c compile without the extensions
Things to try: Things to try:
* Any speed gain with comparing values in screen before writing? * Any speed gain with comparing values in screen before writing?
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
/* SDM = 2 */ /* SDM = 2 */
/* SOD = 3 */ /* SOD = 3 */
#ifndef WMODE #ifndef WMODE
#define WMODE 3 #define WMODE 1
#endif #endif
#if WMODE == 0 #if WMODE == 0
......
...@@ -227,6 +227,7 @@ int CalcHeight (void) ...@@ -227,6 +227,7 @@ int CalcHeight (void)
unsigned postx; unsigned postx;
#if 0
void ScalePost(byte *wall, int texture) void ScalePost(byte *wall, int texture)
{ {
int height; int height;
...@@ -239,7 +240,22 @@ void ScalePost(byte *wall, int texture) ...@@ -239,7 +240,22 @@ void ScalePost(byte *wall, int texture)
source = wall+texture; source = wall+texture;
xBuildCompScale (height/2, source, postx); xBuildCompScale (height/2, source, postx);
} }
#endif
/* TODO: this is new ScalePost for new scaling routine */
void ScalePost(byte *wall, int texture)
{
int height;
byte *source;
height = (wallheight [postx] & 0xfff8) >> 1;
/* TODO: i can remove maxscaleshl2 now */
//if (height > maxscaleshl2)
// height = maxscaleshl2;
source = wall+texture;
xBuildCompScale (height/2, source, postx);
}
/* /*
==================== ====================
......
...@@ -50,9 +50,13 @@ void BuildCompScale(int height) ...@@ -50,9 +50,13 @@ void BuildCompScale(int height)
if (startpix == endpix || endpix < 0 || startpix >= viewheight || src == 64) if (startpix == endpix || endpix < 0 || startpix >= viewheight || src == 64)
/* source pixel goes off screen */ /* source pixel goes off screen */
scaledata [height].desty [src] = -1; scaledata [height].desty[src] = -1;
else else
scaledata [height].desty [src] = startpix; scaledata [height].desty[src] = startpix;
/* Clip if needed */
if ( ((signed)scaledata [height].count[src] + (signed)scaledata [height].desty[src]) > viewheight)
scaledata [height].count[src] = viewheight - scaledata [height].desty[src];
} }
} }
...@@ -96,7 +100,7 @@ void SetupScaling(int maxscaleheight) ...@@ -96,7 +100,7 @@ void SetupScaling(int maxscaleheight)
= =
======================== ========================
*/ */
#if 0
void xBuildCompScale(int height, byte *source, int x) void xBuildCompScale(int height, byte *source, int x)
{ {
...@@ -136,7 +140,54 @@ void xBuildCompScale(int height, byte *source, int x) ...@@ -136,7 +140,54 @@ void xBuildCompScale(int height, byte *source, int x)
} }
} }
#endif
/* TODO: this accesses gfxbuf directly! */
void ScaledDraw(byte *gfx, int scale, byte *vid, unsigned long tfrac, unsigned long tint, unsigned long delta)
{
fixed OldDelta;
while (scale--) {
*vid = *gfx;
vid += 320; /* TODO: compiled in constant! */
OldDelta = delta;
delta += tfrac;
gfx += tint;
if (OldDelta > delta)
gfx += 1;
}
}
void xBuildCompScale(unsigned int height, byte *source, int x)
{
unsigned long TheFrac;
unsigned long TheInt;
unsigned long y;
if (height) {
TheFrac = 0x40000000UL / height;
if (height < viewheight) {
y = yoffset + (viewheight - height) / 2;
TheInt = TheFrac >> 24;
TheFrac <<= 8;
ScaledDraw(source, height, gfxbuf + (y * 320) + x + xoffset,
TheFrac, TheInt, 0);
return;
}
y = (height - viewheight) / 2;
y *= TheFrac;
TheInt = TheFrac >> 24;
TheFrac <<= 8;
ScaledDraw(&source[y >> 24], viewheight, gfxbuf + (yoffset * 320) + x + xoffset,
TheFrac, TheInt, y << 8);
}
}
/* /*
======================= =======================
...@@ -175,7 +226,6 @@ void ScaleLine() ...@@ -175,7 +226,6 @@ void ScaleLine()
color = *pixels++; color = *pixels++;
if (ys >= 0) { if (ys >= 0) {
for (ny=0; ny<scaledata[linescale].count[y]; ny++) { for (ny=0; ny<scaledata[linescale].count[y]; ny++) {
if ( (ys+ny) >= viewheight ) break; /* TODO: fix BuildCompScale so this isn't necessary */
for (n = 0, x = slinex; n < slinewidth; n++, x++) { for (n = 0, x = slinex; n < slinewidth; n++, x++) {
VL_Plot(x+xoffset, ys+ny+yoffset, color); VL_Plot(x+xoffset, ys+ny+yoffset, color);
} }
......
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