Commit 847eeadc authored by Steven Fuller's avatar Steven Fuller

wl_draw.c: removed older scaling code (the newer code was added last update)

wl_draw.c: don't draw borders every frame (for now -- this slows things down
greatly currently with new code at higher resolutions)

vi_sdl.c: now can use parameters -x2 (for 640x400) or -x3 (for 960x600).
parent d7208f64
...@@ -15,9 +15,6 @@ SDL_Surface *surface; ...@@ -15,9 +15,6 @@ SDL_Surface *surface;
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
vwidth = 320;
vheight = 200;
return WolfMain(argc, argv); return WolfMain(argc, argv);
} }
...@@ -72,6 +69,17 @@ void VW_UpdateScreen() ...@@ -72,6 +69,17 @@ void VW_UpdateScreen()
void VL_Startup() void VL_Startup()
{ {
vwidth = 320;
vheight = 200;
if (MS_CheckParm("x2")) {
vwidth *= 2;
vheight *= 2;
} else if (MS_CheckParm("x3")) {
vwidth *= 3;
vheight *= 3;
}
if (gfxbuf == NULL) if (gfxbuf == NULL)
gfxbuf = malloc(vwidth * vheight * 1); gfxbuf = malloc(vwidth * vheight * 1);
......
...@@ -461,7 +461,7 @@ static void WallRefresh() ...@@ -461,7 +461,7 @@ static void WallRefresh()
/* ======================================================================== */ /* ======================================================================== */
#define MAXVIEWHEIGHT 200 #define MAXVIEWHEIGHT (MAXVIEWWIDTH/2)
static int spanstart[MAXVIEWHEIGHT/2]; static int spanstart[MAXVIEWHEIGHT/2];
...@@ -651,7 +651,7 @@ void ThreeDRefresh() ...@@ -651,7 +651,7 @@ void ThreeDRefresh()
// //
// follow the walls from there to the right, drawwing as we go // follow the walls from there to the right, drawwing as we go
// //
DrawPlayBorder(); //DrawPlayBorder();
#ifndef DRAWCEIL #ifndef DRAWCEIL
ClearScreen(); ClearScreen();
#endif #endif
...@@ -684,103 +684,6 @@ void ThreeDRefresh() ...@@ -684,103 +684,6 @@ void ThreeDRefresh()
/* ======================================================================== */ /* ======================================================================== */
#if 0
static void ScaledDraw(byte *gfx, int scale, byte *vid, unsigned long tfrac, unsigned long tint, unsigned long delta)
{
unsigned long OldDelta;
while (scale--) {
*vid = *gfx;
vid += vwidth;
OldDelta = delta;
delta += tfrac;
gfx += tint;
if (OldDelta > delta)
gfx += 1;
}
}
static void ScaledDrawTrans(byte *gfx, int scale, byte *vid, unsigned long tfrac, unsigned long tint, unsigned long delta)
{
unsigned long OldDelta;
while (scale--) {
if (*gfx != 255)
*vid = *gfx;
vid += vwidth;
OldDelta = delta;
delta += tfrac;
gfx += tint;
if (OldDelta > delta)
gfx += 1;
}
}
static void ScaleLine(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 * vwidth) + x + xoffset,
TheFrac, TheInt, 0);
return;
}
y = (height - viewheight) / 2;
y *= TheFrac;
TheInt = TheFrac >> 24;
TheFrac <<= 8;
ScaledDraw(&source[y >> 24], viewheight, gfxbuf + (yoffset * vwidth) + x + xoffset,
TheFrac, TheInt, y << 8);
}
}
static void ScaleLineTrans(unsigned int height, byte *source, int x)
{
unsigned long TheFrac;
unsigned long TheInt;
unsigned long y;
if (height) {
TheFrac = (64 << 16) / height;
if (height < viewheight) {
y = yoffset + (viewheight - height) / 2;
TheInt = TheFrac >> 24;
TheFrac <<= 8;
ScaledDrawTrans(source, height, gfxbuf + (y * vwidth) + x + xoffset,
TheFrac, TheInt, 0);
return;
}
y = (height - viewheight) / 2;
y *= TheFrac;
TheInt = TheFrac >> 24;
TheFrac <<= 8;
ScaledDrawTrans(&source[y >> 24], viewheight, gfxbuf + (yoffset * vwidth) + x + xoffset,
TheFrac, TheInt, y << 8);
}
}
#endif
static void ScaledDraw(byte *gfx, int count, byte *vid, unsigned int frac, unsigned int delta) static void ScaledDraw(byte *gfx, int count, byte *vid, unsigned int frac, unsigned int delta)
{ {
while (count--) { while (count--) {
...@@ -790,9 +693,9 @@ static void ScaledDraw(byte *gfx, int count, byte *vid, unsigned int frac, unsig ...@@ -790,9 +693,9 @@ static void ScaledDraw(byte *gfx, int count, byte *vid, unsigned int frac, unsig
} }
} }
static void ScaledDrawTrans(byte *gfx, int scale, byte *vid, unsigned int frac, unsigned int delta) static void ScaledDrawTrans(byte *gfx, int count, byte *vid, unsigned int frac, unsigned int delta)
{ {
while (scale--) { while (count--) {
if (gfx[frac >> 16] != 255) if (gfx[frac >> 16] != 255)
*vid = gfx[frac >> 16]; *vid = gfx[frac >> 16];
vid += vwidth; vid += vwidth;
...@@ -831,7 +734,7 @@ static void ScaleLineTrans(unsigned int height, byte *source, int x) ...@@ -831,7 +734,7 @@ static void ScaleLineTrans(unsigned int height, byte *source, int x)
unsigned long y; unsigned long y;
if (height) { if (height) {
TheFrac = 0x00400000UL / height; TheFrac = (64 << 16) / height;
if (height < viewheight) { if (height < viewheight) {
y = yoffset + (viewheight - height) / 2; y = yoffset + (viewheight - height) / 2;
......
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