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

Even more cleanups!

parent a95bbccf
......@@ -33,7 +33,7 @@ typedef struct
byte *tinf;
int mapon;
unsigned *mapsegs[MAPPLANES];
word *mapsegs[MAPPLANES];
maptype *mapheaderseg[NUMMAPS];
byte *audiosegs[NUMSNDCHUNKS];
void *grsegs[NUMCHUNKS];
......
......@@ -23,7 +23,7 @@ typedef struct
extern byte *tinf;
extern int mapon;
extern unsigned *mapsegs[MAPPLANES];
extern word *mapsegs[MAPPLANES];
extern maptype *mapheaderseg[NUMMAPS];
extern byte *audiosegs[NUMSNDCHUNKS];
extern void *grsegs[NUMCHUNKS];
......
......@@ -11,7 +11,6 @@ pictabletype *pictable;
int px,py;
byte fontcolor,backcolor;
int fontnumber;
int bufferwidth, bufferheight;
/* ======================================================================== */
......@@ -19,110 +18,42 @@ void VW_DrawPropString(char *string)
{
fontstruct *font;
int width, step, height, i;
byte *source, *dest, *origdest;
byte ch, mask;
byte *source, *dest, *ptrs, *ptrd;
byte ch;
font = (fontstruct *)grsegs[STARTFONT+fontnumber];
height = bufferheight = font->height;
dest = origdest = MK_FP(SCREENSEG,bufferofs+ylookup[py]+(px>>2));
mask = 1<<(px&3);
height = font->height;
dest = gfxbuf + py * 320 + px;
while ((ch = *string++)!=0)
{
while ((ch = *string++) != 0) {
width = step = font->width[ch];
source = ((byte *)font)+font->location[ch];
while (width--)
{
VGAMAPMASK(mask);
asm mov ah,[BYTE PTR fontcolor]
asm mov bx,[step]
asm mov cx,[height]
asm mov dx,[linewidth]
asm lds si,[source]
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++;
px++;
mask <<= 1;
if (mask == 16)
{
mask = 1;
dest++;
while (width--) {
height = font->height;
ptrs = source;
ptrd = dest;
while (height--) {
if (*ptrs)
*ptrd = fontcolor;
ptrs += step;
ptrd += 320;
}
source++;
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)
{
/* proportional width */
*height = font->height;
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)
{
VWL_MeasureString(string,width,height,(fontstruct *)grsegs[STARTFONT+fontnumber]);
}
......@@ -135,67 +66,9 @@ 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)
{
if (VW_MarkUpdateBlock (x,y,x+7,y+7))
LatchDrawChar(x,y,tile);
LatchDrawChar(x,y,tile);
}
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;
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)
{
int x;
x=px;
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)
{
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)
{
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)
{
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)
{
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 ();
}
......@@ -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;
byte *src;
unsigned destoff;
word destoff;
/*
tile 8s
......@@ -344,7 +209,6 @@ void LoadLatchMem (void)
UNCACHEGRCHUNK(i);
}
VGAMAPMASK(15);
}
/* ======================================================================== */
......@@ -376,15 +240,12 @@ boolean FizzleFade (unsigned source, unsigned dest,
IN_StartAck ();
TimeCount=frame=0;
do // while (1)
{
if (abortable && IN_CheckAck () )
do {
if (abortable && IN_CheckAck ())
return true;
asm mov es,[screenseg]
for (p=0;p<pixperframe;p++)
{
for (p=0;p<pixperframe;p++) {
#if 0
//
// seperate random value into x/y pair
//
......@@ -426,11 +287,13 @@ noxor:
asm add di,[pagedelta]
asm mov [es:di],al
if (rndval == 1) // entire sequence has been completed
#endif
if (rndval == 1) /* entire sequence has been completed */
return false;
}
frame++;
while (TimeCount<frame) // don't go too fast
while (TimeCount<frame)
;
} while (1);
}
......@@ -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_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_ScreenToScreen (unsigned source, unsigned dest,int width, int height);
void VL_MemToScreen (byte *source, int width, int height, int x, int y);
......
// WL_ACT1.C
/* wl_act1.c */
#include "WL_DEF.H"
#pragma hdrstop
#include "wl_def.h"
/*
=============================================================================
......@@ -275,7 +274,7 @@ int doornum;
unsigned doorposition[MAXDOORS]; // leading edge of door 0=closed
// 0xffff = fully open
byte far areaconnect[NUMAREAS][NUMAREAS];
byte areaconnect[NUMAREAS][NUMAREAS];
boolean areabyplayer[NUMAREAS];
......@@ -350,7 +349,7 @@ void InitDoorList (void)
void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
{
int areanumber;
unsigned far *map;
word *map;
if (doornum==64)
Quit ("64+ doors on level!");
......@@ -369,7 +368,7 @@ void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
// for door sides
//
tilemap[tilex][tiley] = doornum | 0x80;
map = mapsegs[0] + farmapylookup[tiley]+tilex;
map = (word *)(mapsegs[0] + farmapylookup[tiley]+tilex);
if (vertical)
{
*map = *(map-1); // set area number
......@@ -554,7 +553,7 @@ void DoorOpen (int door)
void DoorOpening (int door)
{
int area1,area2;
unsigned far *map;
word *map;
long position;
position = doorposition[door];
......@@ -563,8 +562,8 @@ void DoorOpening (int door)
//
// door is just starting to open, so connect the areas
//
map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex;
map = (word *)(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex);
if (doorobjlist[door].vertical)
{
......@@ -617,7 +616,7 @@ void DoorOpening (int door)
void DoorClosing (int door)
{
int area1,area2,move;
unsigned far *map;
word *map;
long position;
int tilex,tiley;
......@@ -646,8 +645,8 @@ void DoorClosing (int door)
doorobjlist[door].action = dr_closed;
map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex;
map = (word *)(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex);
if (doorobjlist[door].vertical)
{
......
......@@ -653,7 +653,7 @@ typedef enum {
} weapontype;
typedef enum {
/* typedef */ enum {
gd_baby,
gd_easy,
gd_medium,
......@@ -1008,7 +1008,7 @@ typedef struct
{
unsigned codeofs[65];
unsigned width[65];
byte code[];
byte *code;
} t_compscale;
typedef struct
......
This diff is collapsed.
......@@ -61,6 +61,7 @@ int mouseadjustment;
char configname[13]="config.";
unsigned xoffset, yoffset;
int _argc;
char **argv;
......@@ -690,7 +691,6 @@ void SignonScreen (void) // VGA version
if (!virtualreality)
{
VL_MungePic (&introscn,320,200);
VL_MemToScreen (&introscn,320,200,0,0);
}
}
......@@ -1211,7 +1211,10 @@ boolean SetViewSize (unsigned width, unsigned height)
centerx = viewwidth/2-1;
shootdelta = viewwidth/10;
screenofs = ((200-STATUSLINES-viewheight)/2*SCREENWIDTH+(320-viewwidth)/8);
yoffset = (200-STATUSLINES-viewheight)/2
xoffset = (320-viewwidth)/2;
//
// 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