Commit 6c4a1b6e authored by Steven Fuller's avatar Steven Fuller

id_vh.c: fixed some of the draw scaling

wl_main.c: removed the introscreen

vi_svga.c: added -x2 support
parent 554d5ba6
...@@ -43,13 +43,13 @@ $(DOBJS): version.h id_heads.h wl_def.h ...@@ -43,13 +43,13 @@ $(DOBJS): version.h id_heads.h wl_def.h
$(NASM) -f elf -o $@ $< $(NASM) -f elf -o $@ $<
swolf3d: $(SOBJS) swolf3d: $(SOBJS)
gcc -o swolf3d $(SOBJS) $(SLFLAGS) $(CC) -o swolf3d $(SOBJS) $(SLFLAGS)
xwolf3d: $(XOBJS) xwolf3d: $(XOBJS)
gcc -o xwolf3d $(XOBJS) $(XLFLAGS) $(CC) -o xwolf3d $(XOBJS) $(XLFLAGS)
sdlwolf3d: $(DOBJS) sdlwolf3d: $(DOBJS)
gcc -o sdlwolf3d $(DOBJS) $(DLFLAGS) $(CC) -o sdlwolf3d $(DOBJS) $(DLFLAGS)
clean: clean:
rm -rf swolf3d xwolf3d sdlwolf3d *.o rm -rf swolf3d xwolf3d sdlwolf3d *.o
......
...@@ -23,8 +23,10 @@ SD_StartMusic(chunk); ...@@ -23,8 +23,10 @@ SD_StartMusic(chunk);
* use int16_t, etc (stdint) * use int16_t, etc (stdint)
* finish serializing reads/writes, endian issues * finish serializing reads/writes, endian issues
* fix fix fix different size stuff * fix fix fix different size stuff
works alright at some res, but breaks on most others currently works alright at some res, but breaks on others currently
* add ylookup add support for resolution changing at any time?
probably will only support 320x200, 640x400, 960x600
* add ylookup?
* remove farmapylookup? * remove farmapylookup?
* would be nice if Quit() used vsnprintf, etc * would be nice if Quit() used vsnprintf, etc
* actor walking through door is drawn in front of door: near end of E1M1 for * actor walking through door is drawn in front of door: near end of E1M1 for
...@@ -38,15 +40,11 @@ code, it really needs to be cleaned up ...@@ -38,15 +40,11 @@ code, it really needs to be cleaned up
* rewrite id_ca.c: uniform memory handling system * rewrite id_ca.c: uniform memory handling system
* clean up header files, especially wl_def.h, where some declarations aren't * clean up header files, especially wl_def.h, where some declarations aren't
in the right place in the right place
* is that memory intro screen needed anymore?
no, will be removed soon
* fix the input code, everything is spread out... ideally everything should * fix the input code, everything is spread out... ideally everything should
work the same, let the input handler do it all instead 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
* wl_menu uses specific scancodes for names, config file will have to use
metaname like sc_Left etc or something
* add a ViewMap? (could be done similar to mac version) * add a ViewMap? (could be done similar to mac version)
* change the current parameter handling code to something like getopt * change the current parameter handling code to something like getopt
* remove check for debugmode? * remove check for debugmode?
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
** **
** Version 0.37 ** Version 0.37
** **
** Modified for Wolf 3D by Steven Fuller ** Modified for Wolfenstein 3D by Steven Fuller
*/ */
#include <stdio.h> #include <stdio.h>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "fmopl.h" #include "fmopl.h"
#define INLINE inline #define INLINE static /* inline */
void logerror(const char *text, ...); void logerror(const char *text, ...);
......
...@@ -14,7 +14,7 @@ typedef struct ...@@ -14,7 +14,7 @@ typedef struct
============================================================================= =============================================================================
*/ */
int RLEWtag; unsigned int RLEWtag;
int mapon; int mapon;
word *mapsegs[MAPPLANES]; word *mapsegs[MAPPLANES];
......
...@@ -27,8 +27,6 @@ extern char extension[5]; ...@@ -27,8 +27,6 @@ extern char extension[5];
/* ======================================================================== */ /* ======================================================================== */
boolean CA_FarRead(int handle, byte *dest, long length);
boolean CA_FarWrite(int handle, byte *source, long length);
boolean CA_LoadFile(char *filename, memptr *ptr); boolean CA_LoadFile(char *filename, memptr *ptr);
boolean CA_WriteFile(char *filename, void *ptr, long length); boolean CA_WriteFile(char *filename, void *ptr, long length);
......
...@@ -114,7 +114,6 @@ typedef struct { ...@@ -114,7 +114,6 @@ typedef struct {
#include "id_vh.h" #include "id_vh.h"
#include "id_us.h" #include "id_us.h"
extern const byte introscn[];
extern const byte gamepal[]; extern const byte gamepal[];
int MS_CheckParm(char *string); int MS_CheckParm(char *string);
......
...@@ -10,6 +10,8 @@ boolean screenfaded; ...@@ -10,6 +10,8 @@ boolean screenfaded;
static byte palette1[256][3], palette2[256][3]; static byte palette1[256][3], palette2[256][3];
int xfrac, yfrac;
/* ======================================================================== */ /* ======================================================================== */
/* /*
...@@ -152,7 +154,6 @@ void VL_FadeOut(int start, int end, int red, int green, int blue, int steps) ...@@ -152,7 +154,6 @@ void VL_FadeOut(int start, int end, int red, int green, int blue, int steps)
*newptr++ = orig + delta * i / steps; *newptr++ = orig + delta * i / steps;
} }
VL_WaitVBL(1);
VL_SetPalette(&palette2[0][0]); VL_SetPalette(&palette2[0][0]);
} }
...@@ -174,7 +175,7 @@ void VL_FadeOut(int start, int end, int red, int green, int blue, int steps) ...@@ -174,7 +175,7 @@ void VL_FadeOut(int start, int end, int red, int green, int blue, int steps)
void VL_FadeIn(int start, int end, const byte *palette, int steps) void VL_FadeIn(int start, int end, const byte *palette, int steps)
{ {
int i,j,delta; int i, j, delta;
VL_GetPalette(&palette1[0][0]); VL_GetPalette(&palette1[0][0]);
memcpy(&palette2[0][0],&palette1[0][0],sizeof(palette1)); memcpy(&palette2[0][0],&palette1[0][0],sizeof(palette1));
...@@ -185,15 +186,14 @@ void VL_FadeIn(int start, int end, const byte *palette, int steps) ...@@ -185,15 +186,14 @@ void VL_FadeIn(int start, int end, const byte *palette, int steps)
// //
// fade through intermediate frames // fade through intermediate frames
// //
for (i=0;i<steps;i++) for (i = 0; i < steps; i++)
{ {
for (j=start;j<=end;j++) for (j = start;j <= end; j++)
{ {
delta = palette[j]-palette1[0][j]; delta = palette[j]-palette1[0][j];
palette2[0][j] = palette1[0][j] + delta * i / steps; palette2[0][j] = palette1[0][j] + delta * i / steps;
} }
VL_WaitVBL(1);
VL_SetPalette(&palette2[0][0]); VL_SetPalette(&palette2[0][0]);
} }
...@@ -221,7 +221,8 @@ void VL_DeModeXize(byte *buf, int width, int height) ...@@ -221,7 +221,8 @@ void VL_DeModeXize(byte *buf, int width, int height)
return; return;
} }
mem = malloc(width * height); MM_GetPtr((memptr)&mem, width *height);
ptr = buf; ptr = buf;
for (plane = 0; plane < 4; plane++) { for (plane = 0; plane < 4; plane++) {
...@@ -234,7 +235,8 @@ void VL_DeModeXize(byte *buf, int width, int height) ...@@ -234,7 +235,8 @@ void VL_DeModeXize(byte *buf, int width, int height)
} }
memcpy(buf, mem, width * height); memcpy(buf, mem, width * height);
free(mem);
MM_FreePtr((memptr)&mem);
} }
/* /*
...@@ -247,52 +249,29 @@ void VL_DeModeXize(byte *buf, int width, int height) ...@@ -247,52 +249,29 @@ void VL_DeModeXize(byte *buf, int width, int height)
static void VL_Plot(int x, int y, int color) static void VL_Plot(int x, int y, int color)
{ {
int xend, yend, xfrac, yfrac, xs, ys; int xend, yend, xs, ys;
xend = x + 1; xend = x + 1;
yend = y + 1; yend = y + 1;
xfrac = (vwidth << 16) / 320;
yfrac = (vheight << 16) / 200;
x *= xfrac; x *= xfrac;
y *= yfrac; y *= yfrac;
xend *= xfrac; xend *= xfrac;
yend *= yfrac; yend *= yfrac;
xfrac = (320 << 16) / vwidth;
yfrac = (200 << 16) / vheight;
for (xs = x; xs < xend; xs += xfrac) x >>= 16;
for (ys = y; ys < yend; ys += yfrac) y >>= 16;
*(gfxbuf + (ys >> 16) * vwidth + (xs >> 16)) = color; xend >>= 16;
/* yend >>= 16;
*(gfxbuf + vwidth * y + x) = color;
*/ for (xs = x; xs < xend; xs++)
for (ys = y; ys < yend; ys++)
*(gfxbuf + ys * vwidth + xs) = color;
} }
void VW_Plot(int x, int y, int color) void VW_Plot(int x, int y, int color)
{ {
int xend, yend, xfrac, yfrac, xs, ys; VL_Plot(x, y, color);
xend = x + 1;
yend = y + 1;
xfrac = (vwidth << 16) / 320;
yfrac = (vheight << 16) / 200;
x *= xfrac;
y *= yfrac;
xend *= xfrac;
yend *= yfrac;
xfrac = (320 << 16) / vwidth;
yfrac = (200 << 16) / vheight;
for (xs = x; xs < xend; xs += xfrac)
for (ys = y; ys < yend; ys += yfrac)
*(gfxbuf + (ys >> 16) * vwidth + (xs >> 16)) = color;
/*
*(gfxbuf + vwidth * y + x) = color;
*/
} }
void VW_DrawPropString(char *string) void VW_DrawPropString(char *string)
...@@ -387,16 +366,14 @@ void VWB_DrawPic(int x, int y, int chunknum) ...@@ -387,16 +366,14 @@ void VWB_DrawPic(int x, int y, int chunknum)
void VL_Hlin(unsigned x, unsigned y, unsigned width, unsigned color) void VL_Hlin(unsigned x, unsigned y, unsigned width, unsigned color)
{ {
int xend, yend, xfrac, yfrac; /*
int xend, yend;
int w, h; int w, h;
byte *ptr; byte *ptr;
xend = x + width; xend = x + width;
yend = y + 1; yend = y + 1;
xfrac = (vwidth << 16) / 320;
yfrac = (vheight << 16) / 200;
x *= xfrac; x *= xfrac;
y *= yfrac; y *= yfrac;
xend *= xfrac; xend *= xfrac;
...@@ -411,15 +388,13 @@ void VL_Hlin(unsigned x, unsigned y, unsigned width, unsigned color) ...@@ -411,15 +388,13 @@ void VL_Hlin(unsigned x, unsigned y, unsigned width, unsigned color)
memset(ptr, color, w); memset(ptr, color, w);
ptr += vwidth; ptr += vwidth;
} }
/* */
int w; int w;
for (w = 0; w < width; w++) for (w = 0; w < width; w++)
VL_Plot(x+w, y, color); VL_Plot(x+w, y, color);
*/
/*
memset(gfxbuf + vwidth * y + x, color, width);
*/
} }
/* /*
...@@ -432,16 +407,14 @@ void VL_Hlin(unsigned x, unsigned y, unsigned width, unsigned color) ...@@ -432,16 +407,14 @@ void VL_Hlin(unsigned x, unsigned y, unsigned width, unsigned color)
void VL_Vlin(int x, int y, int height, int color) void VL_Vlin(int x, int y, int height, int color)
{ {
int xend, yend, xfrac, yfrac; /*
int xend, yend;
int w, h; int w, h;
byte *ptr; byte *ptr;
xend = x + 1; xend = x + 1;
yend = y + height; yend = y + height;
xfrac = (vwidth << 16) / 320;
yfrac = (vheight << 16) / 200;
x *= xfrac; x *= xfrac;
y *= yfrac; y *= yfrac;
xend *= xfrac; xend *= xfrac;
...@@ -456,19 +429,11 @@ void VL_Vlin(int x, int y, int height, int color) ...@@ -456,19 +429,11 @@ void VL_Vlin(int x, int y, int height, int color)
memset(ptr, color, w); memset(ptr, color, w);
ptr += vwidth; ptr += vwidth;
} }
/* */
int h; int h;
for (h = 0; h < height; h++) for (h = 0; h < height; h++)
VL_Plot(x, y+h, color); VL_Plot(x, y+h, color);
*/
/*
byte *ptr = gfxbuf + vwidth * y + x;
while (height--) {
*ptr = color;
ptr += vwidth;
}
*/
} }
/* /*
...@@ -481,60 +446,21 @@ void VL_Vlin(int x, int y, int height, int color) ...@@ -481,60 +446,21 @@ void VL_Vlin(int x, int y, int height, int color)
void VW_Bar(int x, int y, int width, int height, int color) void VW_Bar(int x, int y, int width, int height, int color)
{ {
//int xend, yend;
int xfrac, yfrac;
int w, h; int w, h;
byte *ptr; byte *ptr;
//xend = x + width;
//yend = y + height;
xfrac = (vwidth << 16) / 320;
yfrac = (vheight << 16) / 200;
x *= xfrac; x *= xfrac;
y *= yfrac; y *= yfrac;
//xend *= xfrac;
//yend *= yfrac;
//w = (xend - x) >> 16;
//h = (yend - y) >> 16;
w = (width * xfrac) >> 16; w = (width * xfrac) >> 16;
h = (height * yfrac) >> 16; h = (height * yfrac) >> 16;
//if ((w != ((width * xfrac) >> 16)) || (h != ((height * yfrac) >> 16)))
// printf("test\n");
ptr = gfxbuf + vwidth * (y >> 16) + (x >> 16); ptr = gfxbuf + vwidth * (y >> 16) + (x >> 16);
while (h--) { while (h--) {
memset(ptr, color, w); memset(ptr, color, w);
ptr += vwidth; ptr += vwidth;
} }
/*
int w, h;
for (w = 0; w < width; w++)
for (h = 0; h < height; h++)
VL_Plot(x+w, y+h, color);
*/
/*
byte *ptr;
width *= vwidth / 320;
height *= vheight / 200;
x *= vwidth / 320;
y *= vheight / 200;
ptr = gfxbuf + vwidth * y + x;
while (height--) {
memset(ptr, color, width);
ptr += vwidth;
}
*/
} }
void VL_Bar(int x, int y, int width, int height, int color) void VL_Bar(int x, int y, int width, int height, int color)
...@@ -563,12 +489,17 @@ void VL_MemToScreen(const byte *source, int width, int height, int x, int y) ...@@ -563,12 +489,17 @@ void VL_MemToScreen(const byte *source, int width, int height, int x, int y)
for (w = 0; w < width; w++) for (w = 0; w < width; w++)
for (h = 0; h < height; h++) for (h = 0; h < height; h++)
VL_Plot(x+w, y+h, source[h*width+w]); VL_Plot(x+w, y+h, source[h*width+w]);
/* }
byte *ptr = gfxbuf + vwidth * y + x;
while(height--) { void VW_Startup()
memcpy(ptr, source, width); {
source += width; VL_Startup();
ptr += vwidth;
} xfrac = (vwidth << 16) / 320;
*/ yfrac = (vheight << 16) / 200;
}
void VW_Shutdown()
{
VL_Shutdown();
} }
...@@ -33,8 +33,6 @@ void VWB_DrawPic(int x, int y, int chunknum); ...@@ -33,8 +33,6 @@ void VWB_DrawPic(int x, int y, int chunknum);
extern boolean screenfaded; extern boolean screenfaded;
#define VW_Startup VL_Startup
#define VW_Shutdown VL_Shutdown
#define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c) #define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c)
#define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c) #define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c)
#define VW_WaitVBL VL_WaitVBL #define VW_WaitVBL VL_WaitVBL
...@@ -55,4 +53,7 @@ void VL_CacheScreen(int chunk); ...@@ -55,4 +53,7 @@ void VL_CacheScreen(int chunk);
void VW_Bar(int x, int y, int width, int height, int color); void VW_Bar(int x, int y, int width, int height, int color);
void VW_Startup();
void VW_Shutdown();
#endif #endif
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -134,6 +134,8 @@ void VL_SetPalette(const byte *palette) ...@@ -134,6 +134,8 @@ void VL_SetPalette(const byte *palette)
SDL_Color colors[256]; SDL_Color colors[256];
int i; int i;
VL_WaitVBL(1);
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
colors[i].r = palette[i*3+0] << 2; colors[i].r = palette[i*3+0] << 2;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <vgakeyboard.h> #include <vgakeyboard.h>
byte *gfxbuf = NULL; byte *gfxbuf = NULL;
byte *graphmem = NULL;
/* /*
========================== ==========================
...@@ -58,7 +59,7 @@ void VL_WaitVBL(int vbls) ...@@ -58,7 +59,7 @@ void VL_WaitVBL(int vbls)
void VW_UpdateScreen() void VW_UpdateScreen()
{ {
VL_WaitVBL(1); VL_WaitVBL(1);
memcpy(graph_mem, gfxbuf, 64000); memcpy(graphmem, gfxbuf, vwidth*vheight);
} }
/* /*
...@@ -71,16 +72,33 @@ void VW_UpdateScreen() ...@@ -71,16 +72,33 @@ void VW_UpdateScreen()
void VL_Startup() void VL_Startup()
{ {
if (gfxbuf == NULL) int mode;
gfxbuf = malloc(320 * 200 * 1);
vga_init(); /* TODO: maybe move into main or such? */ vga_init(); /* TODO: maybe move into main or such? */
if (vga_hasmode(G320x200x256) == 0) if (MS_CheckParm("x2")) {
mode = G640x400x256;
vwidth = 640;
vheight = 400;
} else {
mode = G320x200x256;
vwidth = 320;
vheight = 200;
}
if (gfxbuf == NULL)
gfxbuf = malloc(vwidth * vheight * 1);
if (vga_hasmode(mode) == 0)
Quit("vga_hasmode failed!"); Quit("vga_hasmode failed!");
if (vga_setmode(G320x200x256) != 0) if (vga_setmode(mode) != 0)
Quit("vga_setmode failed!"); Quit("vga_setmode failed!");
if ((mode != G320x200x256) && (vga_setlinearaddressing() == -1))
Quit("vga_setlinearaddressing failed!");
graphmem = vga_getgraphmem();
} }
/* /*
...@@ -114,6 +132,8 @@ void VL_SetPalette(const byte *palette) ...@@ -114,6 +132,8 @@ void VL_SetPalette(const byte *palette)
{ {
int i; int i;
VL_WaitVBL(1);
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
vga_setpalette(i, palette[i*3+0], palette[i*3+1], palette[i*3+2]); vga_setpalette(i, palette[i*3+0], palette[i*3+1], palette[i*3+2]);
} }
...@@ -140,7 +160,7 @@ void VL_GetPalette(byte *palette) ...@@ -140,7 +160,7 @@ void VL_GetPalette(byte *palette)
void VL_DirectPlot(int x1, int y1, int x2, int y2) void VL_DirectPlot(int x1, int y1, int x2, int y2)
{ {
*(graph_mem + x1 + y1 * 320) = *(gfxbuf + x2 + y2 * 320); *(graphmem + x1 + y1 * vwidth) = *(gfxbuf + x2 + y2 * vwidth);
} }
void VL_DirectPlotFlush() void VL_DirectPlotFlush()
......
...@@ -406,6 +406,8 @@ void VL_SetPalette(const byte *palette) ...@@ -406,6 +406,8 @@ void VL_SetPalette(const byte *palette)
{ {
int i; int i;
VL_WaitVBL(1);
if (indexmode) { if (indexmode) {
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
clr[i].red = palette[i*3+0] << 10; clr[i].red = palette[i*3+0] << 10;
......
...@@ -1207,63 +1207,6 @@ void DoJukebox() ...@@ -1207,63 +1207,6 @@ void DoJukebox()
/* ======================================================================== */ /* ======================================================================== */
/*
==========================
=
= SignonScreen
=
==========================
*/
void SignonScreen()
{
VL_SetPalette(gamepal);
VL_MemToScreen(introscn, 320, 200, 0, 0);
VW_UpdateScreen();
}
/*
==========================
=
= FinishSignon
=
==========================
*/
void FinishSignon()
{
#ifndef SPEAR
VW_Bar(0, 189, 300, 11, introscn[0]);
WindowX = 0;
WindowW = 320;
PrintY = 190;
SETFONTCOLOR(14,4);
US_CPrint("Press a key");
VW_UpdateScreen();
if (!NoWait)
IN_Ack ();
VW_Bar(0, 189, 300, 11, introscn[0]);
PrintY = 190;
SETFONTCOLOR(10,4);
US_CPrint("Working...");
VW_UpdateScreen();
SETFONTCOLOR(0,15);
#else
if (!NoWait)
VW_WaitVBL(3*70);
#endif
}
/* ======================================================================== */
/* /*
========================== ==========================
= =
...@@ -1333,8 +1276,6 @@ void InitGame() ...@@ -1333,8 +1276,6 @@ void InitGame()
SD_Startup(); SD_Startup();
US_Startup(); US_Startup();
// SignonScreen();
// //
// build some tables // build some tables
// //
...@@ -1373,8 +1314,6 @@ void InitGame() ...@@ -1373,8 +1314,6 @@ void InitGame()
if (IN_KeyDown(sc_M)) if (IN_KeyDown(sc_M))
DoJukebox(); DoJukebox();
#endif #endif
// FinishSignon();
} }
/* /*
......
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