Commit 753697b6 authored by Steven Fuller's avatar Steven Fuller

Even more cleanups!

parent a95bbccf
...@@ -33,7 +33,7 @@ typedef struct ...@@ -33,7 +33,7 @@ typedef struct
byte *tinf; byte *tinf;
int mapon; int mapon;
unsigned *mapsegs[MAPPLANES]; word *mapsegs[MAPPLANES];
maptype *mapheaderseg[NUMMAPS]; maptype *mapheaderseg[NUMMAPS];
byte *audiosegs[NUMSNDCHUNKS]; byte *audiosegs[NUMSNDCHUNKS];
void *grsegs[NUMCHUNKS]; void *grsegs[NUMCHUNKS];
......
...@@ -23,7 +23,7 @@ typedef struct ...@@ -23,7 +23,7 @@ typedef struct
extern byte *tinf; extern byte *tinf;
extern int mapon; extern int mapon;
extern unsigned *mapsegs[MAPPLANES]; extern word *mapsegs[MAPPLANES];
extern maptype *mapheaderseg[NUMMAPS]; extern maptype *mapheaderseg[NUMMAPS];
extern byte *audiosegs[NUMSNDCHUNKS]; extern byte *audiosegs[NUMSNDCHUNKS];
extern void *grsegs[NUMCHUNKS]; extern void *grsegs[NUMCHUNKS];
......
...@@ -11,7 +11,6 @@ pictabletype *pictable; ...@@ -11,7 +11,6 @@ pictabletype *pictable;
int px,py; int px,py;
byte fontcolor,backcolor; byte fontcolor,backcolor;
int fontnumber; int fontnumber;
int bufferwidth, bufferheight;
/* ======================================================================== */ /* ======================================================================== */
...@@ -19,107 +18,39 @@ void VW_DrawPropString(char *string) ...@@ -19,107 +18,39 @@ void VW_DrawPropString(char *string)
{ {
fontstruct *font; fontstruct *font;
int width, step, height, i; int width, step, height, i;
byte *source, *dest, *origdest; byte *source, *dest, *ptrs, *ptrd;
byte ch, mask; byte ch;
font = (fontstruct *)grsegs[STARTFONT+fontnumber]; font = (fontstruct *)grsegs[STARTFONT+fontnumber];
height = bufferheight = font->height; height = font->height;
dest = origdest = MK_FP(SCREENSEG,bufferofs+ylookup[py]+(px>>2)); dest = gfxbuf + py * 320 + px;
mask = 1<<(px&3);
while ((ch = *string++) != 0) {
while ((ch = *string++)!=0)
{
width = step = font->width[ch]; width = step = font->width[ch];
source = ((byte *)font)+font->location[ch]; source = ((byte *)font)+font->location[ch];
while (width--) while (width--) {
{ height = font->height;
VGAMAPMASK(mask); ptrs = source;
ptrd = dest;
asm mov ah,[BYTE PTR fontcolor] while (height--) {
asm mov bx,[step] if (*ptrs)
asm mov cx,[height] *ptrd = fontcolor;
asm mov dx,[linewidth] ptrs += step;
asm lds si,[source] ptrd += 320;
asm les di,[dest] }
vertloop:
asm mov al,[si]
asm or al,al
asm je next
asm mov [es:di],ah // draw color
next:
asm add si,bx
asm add di,dx
asm loop vertloop
asm mov ax,ss
asm mov ds,ax
source++; source++;
px++;
mask <<= 1;
if (mask == 16)
{
mask = 1;
dest++; dest++;
} }
} }
}
bufferheight = height;
bufferwidth = ((dest+1)-origdest)*4;
}
/*
=================
=
= VL_MungePic
=
=================
*/
void VL_MungePic (byte *source, unsigned width, unsigned height)
{
unsigned x,y,plane,size,pwidth;
byte *temp, *dest, *srcline;
size = width*height;
if (width&3)
Quit ("VL_MungePic: Not divisable by 4!");
//
// copy the pic to a temp buffer
//
MM_GetPtr (&(memptr)temp,size);
memcpy (temp,source,size);
//
// munge it back into the original buffer
//
dest = source;
pwidth = width/4;
for (plane=0;plane<4;plane++)
{
srcline = temp;
for (y=0;y<height;y++)
{
for (x=0;x<pwidth;x++)
*dest++ = *(srcline+x*4+plane);
srcline+=width;
}
}
MM_FreePtr (&(memptr)temp);
} }
void VWL_MeasureString (char *string, word *width, word *height, void VWL_MeasureString(char *string, word *width, word *height,
fontstruct *font) fontstruct *font)
{ {
/* proportional width */
*height = font->height; *height = font->height;
for (*width = 0;*string;string++) for (*width = 0;*string;string++)
*width += font->width[*((byte *)string)]; // proportional width *width += font->width[*((byte *)string)];
} }
void VW_MeasurePropString (char *string, word *width, word *height) void VW_MeasurePropString (char *string, word *width, word *height)
...@@ -135,66 +66,8 @@ void VW_MeasurePropString (char *string, word *width, word *height) ...@@ -135,66 +66,8 @@ void VW_MeasurePropString (char *string, word *width, word *height)
============================================================================= =============================================================================
*/ */
/*
=======================
=
= VW_MarkUpdateBlock
=
= Takes a pixel bounded block and marks the tiles in bufferblocks
= Returns 0 if the entire block is off the buffer screen
=
=======================
*/
int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2)
{
int x,y,xt1,yt1,xt2,yt2,nextline;
byte *mark;
xt1 = x1>>PIXTOBLOCK;
yt1 = y1>>PIXTOBLOCK;
xt2 = x2>>PIXTOBLOCK;
yt2 = y2>>PIXTOBLOCK;
if (xt1<0)
xt1=0;
else if (xt1>=UPDATEWIDE)
return 0;
if (yt1<0)
yt1=0;
else if (yt1>UPDATEHIGH)
return 0;
if (xt2<0)
return 0;
else if (xt2>=UPDATEWIDE)
xt2 = UPDATEWIDE-1;
if (yt2<0)
return 0;
else if (yt2>=UPDATEHIGH)
yt2 = UPDATEHIGH-1;
mark = updateptr + uwidthtable[yt1] + xt1;
nextline = UPDATEWIDE - (xt2-xt1) - 1;
for (y=yt1;y<=yt2;y++)
{
for (x=xt1;x<=xt2;x++)
*mark++ = 1; // this tile will need to be updated
mark += nextline;
}
return 1;
}
void VWB_DrawTile8 (int x, int y, int tile) void VWB_DrawTile8 (int x, int y, int tile)
{ {
if (VW_MarkUpdateBlock (x,y,x+7,y+7))
LatchDrawChar(x,y,tile); LatchDrawChar(x,y,tile);
} }
...@@ -208,44 +81,36 @@ void VWB_DrawPic (int x, int y, int chunknum) ...@@ -208,44 +81,36 @@ void VWB_DrawPic (int x, int y, int chunknum)
width = pictable[picnum].width; width = pictable[picnum].width;
height = pictable[picnum].height; height = pictable[picnum].height;
if (VW_MarkUpdateBlock (x,y,x+width-1,y+height-1))
VL_MemToScreen (grsegs[chunknum],width,height,x,y); VL_MemToScreen (grsegs[chunknum],width,height,x,y);
} }
void VWB_DrawPropString(char *string) void VWB_DrawPropString(char *string)
{ {
int x;
x=px;
VW_DrawPropString (string); VW_DrawPropString (string);
VW_MarkUpdateBlock(x,py,px-1,py+bufferheight-1);
} }
void VWB_Bar(int x, int y, int width, int height, int color) void VWB_Bar(int x, int y, int width, int height, int color)
{ {
if (VW_MarkUpdateBlock (x,y,x+width,y+height-1) )
VW_Bar (x,y,width,height,color); VW_Bar (x,y,width,height,color);
} }
void VWB_Plot(int x, int y, int color) void VWB_Plot(int x, int y, int color)
{ {
if (VW_MarkUpdateBlock (x,y,x,y))
VW_Plot(x,y,color); VW_Plot(x,y,color);
} }
void VWB_Hlin(int x1, int x2, int y, int color) void VWB_Hlin(int x1, int x2, int y, int color)
{ {
if (VW_MarkUpdateBlock (x1,y,x2,y))
VW_Hlin(x1,x2,y,color); VW_Hlin(x1,x2,y,color);
} }
void VWB_Vlin(int y1, int y2, int x, int color) void VWB_Vlin(int y1, int y2, int x, int color)
{ {
if (VW_MarkUpdateBlock (x,y1,x,y2))
VW_Vlin(y1,y2,x,color); VW_Vlin(y1,y2,x,color);
} }
void VW_UpdateScreen (void) void VW_UpdateScreen(void)
{ {
VH_UpdateScreen (); VH_UpdateScreen ();
} }
...@@ -287,11 +152,11 @@ void LatchDrawPic (unsigned x, unsigned y, unsigned picnum) ...@@ -287,11 +152,11 @@ void LatchDrawPic (unsigned x, unsigned y, unsigned picnum)
=================== ===================
*/ */
void LoadLatchMem (void) void LoadLatchMem(void)
{ {
int i,j,p,m,width,height,start,end; int i,j,p,m,width,height,start,end;
byte *src; byte *src;
unsigned destoff; word destoff;
/* /*
tile 8s tile 8s
...@@ -344,7 +209,6 @@ void LoadLatchMem (void) ...@@ -344,7 +209,6 @@ void LoadLatchMem (void)
UNCACHEGRCHUNK(i); UNCACHEGRCHUNK(i);
} }
VGAMAPMASK(15);
} }
/* ======================================================================== */ /* ======================================================================== */
...@@ -376,15 +240,12 @@ boolean FizzleFade (unsigned source, unsigned dest, ...@@ -376,15 +240,12 @@ boolean FizzleFade (unsigned source, unsigned dest,
IN_StartAck (); IN_StartAck ();
TimeCount=frame=0; TimeCount=frame=0;
do // while (1) do {
{ if (abortable && IN_CheckAck ())
if (abortable && IN_CheckAck () )
return true; return true;
asm mov es,[screenseg] for (p=0;p<pixperframe;p++) {
#if 0
for (p=0;p<pixperframe;p++)
{
// //
// seperate random value into x/y pair // seperate random value into x/y pair
// //
...@@ -426,11 +287,13 @@ noxor: ...@@ -426,11 +287,13 @@ noxor:
asm add di,[pagedelta] asm add di,[pagedelta]
asm mov [es:di],al asm mov [es:di],al
if (rndval == 1) // entire sequence has been completed #endif
if (rndval == 1) /* entire sequence has been completed */
return false; return false;
} }
frame++; frame++;
while (TimeCount<frame) // don't go too fast while (TimeCount<frame)
; ;
} while (1); } while (1);
} }
...@@ -39,8 +39,6 @@ void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color); ...@@ -39,8 +39,6 @@ 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);
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);
void VL_MungePic (byte *source, unsigned width, unsigned height);
void VL_DrawPicBare (int x, int y, byte *pic, int width, int height);
void VL_MemToLatch (byte *source, int width, int height, word dest); void VL_MemToLatch (byte *source, int width, int height, word dest);
void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height); void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height);
void VL_MemToScreen (byte *source, int width, int height, int x, int y); void VL_MemToScreen (byte *source, int width, int height, int x, int y);
......
// WL_ACT1.C /* wl_act1.c */
#include "WL_DEF.H" #include "wl_def.h"
#pragma hdrstop
/* /*
============================================================================= =============================================================================
...@@ -275,7 +274,7 @@ int doornum; ...@@ -275,7 +274,7 @@ int doornum;
unsigned doorposition[MAXDOORS]; // leading edge of door 0=closed unsigned doorposition[MAXDOORS]; // leading edge of door 0=closed
// 0xffff = fully open // 0xffff = fully open
byte far areaconnect[NUMAREAS][NUMAREAS]; byte areaconnect[NUMAREAS][NUMAREAS];
boolean areabyplayer[NUMAREAS]; boolean areabyplayer[NUMAREAS];
...@@ -350,7 +349,7 @@ void InitDoorList (void) ...@@ -350,7 +349,7 @@ void InitDoorList (void)
void SpawnDoor (int tilex, int tiley, boolean vertical, int lock) void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
{ {
int areanumber; int areanumber;
unsigned far *map; word *map;
if (doornum==64) if (doornum==64)
Quit ("64+ doors on level!"); Quit ("64+ doors on level!");
...@@ -369,7 +368,7 @@ void SpawnDoor (int tilex, int tiley, boolean vertical, int lock) ...@@ -369,7 +368,7 @@ void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
// for door sides // for door sides
// //
tilemap[tilex][tiley] = doornum | 0x80; tilemap[tilex][tiley] = doornum | 0x80;
map = mapsegs[0] + farmapylookup[tiley]+tilex; map = (word *)(mapsegs[0] + farmapylookup[tiley]+tilex);
if (vertical) if (vertical)
{ {
*map = *(map-1); // set area number *map = *(map-1); // set area number
...@@ -554,7 +553,7 @@ void DoorOpen (int door) ...@@ -554,7 +553,7 @@ void DoorOpen (int door)
void DoorOpening (int door) void DoorOpening (int door)
{ {
int area1,area2; int area1,area2;
unsigned far *map; word *map;
long position; long position;
position = doorposition[door]; position = doorposition[door];
...@@ -563,8 +562,8 @@ void DoorOpening (int door) ...@@ -563,8 +562,8 @@ void DoorOpening (int door)
// //
// door is just starting to open, so connect the areas // door is just starting to open, so connect the areas
// //
map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley] map = (word *)(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex; +doorobjlist[door].tilex);
if (doorobjlist[door].vertical) if (doorobjlist[door].vertical)
{ {
...@@ -617,7 +616,7 @@ void DoorOpening (int door) ...@@ -617,7 +616,7 @@ void DoorOpening (int door)
void DoorClosing (int door) void DoorClosing (int door)
{ {
int area1,area2,move; int area1,area2,move;
unsigned far *map; word *map;
long position; long position;
int tilex,tiley; int tilex,tiley;
...@@ -646,8 +645,8 @@ void DoorClosing (int door) ...@@ -646,8 +645,8 @@ void DoorClosing (int door)
doorobjlist[door].action = dr_closed; doorobjlist[door].action = dr_closed;
map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley] map = (word *)(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex; +doorobjlist[door].tilex);
if (doorobjlist[door].vertical) if (doorobjlist[door].vertical)
{ {
......
...@@ -653,7 +653,7 @@ typedef enum { ...@@ -653,7 +653,7 @@ typedef enum {
} weapontype; } weapontype;
typedef enum { /* typedef */ enum {
gd_baby, gd_baby,
gd_easy, gd_easy,
gd_medium, gd_medium,
...@@ -1008,7 +1008,7 @@ typedef struct ...@@ -1008,7 +1008,7 @@ typedef struct
{ {
unsigned codeofs[65]; unsigned codeofs[65];
unsigned width[65]; unsigned width[65];
byte code[]; byte *code;
} t_compscale; } t_compscale;
typedef struct typedef struct
......
This diff is collapsed.
...@@ -61,6 +61,7 @@ int mouseadjustment; ...@@ -61,6 +61,7 @@ int mouseadjustment;
char configname[13]="config."; char configname[13]="config.";
unsigned xoffset, yoffset;
int _argc; int _argc;
char **argv; char **argv;
...@@ -690,7 +691,6 @@ void SignonScreen (void) // VGA version ...@@ -690,7 +691,6 @@ void SignonScreen (void) // VGA version
if (!virtualreality) if (!virtualreality)
{ {
VL_MungePic (&introscn,320,200);
VL_MemToScreen (&introscn,320,200,0,0); VL_MemToScreen (&introscn,320,200,0,0);
} }
} }
...@@ -1212,6 +1212,9 @@ boolean SetViewSize (unsigned width, unsigned height) ...@@ -1212,6 +1212,9 @@ boolean SetViewSize (unsigned width, unsigned height)
shootdelta = viewwidth/10; shootdelta = viewwidth/10;
screenofs = ((200-STATUSLINES-viewheight)/2*SCREENWIDTH+(320-viewwidth)/8); screenofs = ((200-STATUSLINES-viewheight)/2*SCREENWIDTH+(320-viewwidth)/8);
yoffset = (200-STATUSLINES-viewheight)/2
xoffset = (320-viewwidth)/2;
// //
// calculate trace angles and projection constants // calculate trace angles and projection constants
// //
......
This diff is collapsed.
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