Commit b2cc1455 authored by Steven Fuller's avatar Steven Fuller

Compiled, linked, now to make it work!

parent 40ed398f
......@@ -4,3 +4,6 @@ so does wl_menu.c
* would it not make sense to remove bufferseg from id_ca.c?
* menu code is a mess, always does things differently than the rest of the
code, it really needs to be cleaned up
* id_ca.c cache code: nice idea but messy and maybe can be fixed
in an effort to not allocate everything to memory and forget about it
* remove virtualreality
......@@ -41,8 +41,6 @@ void *grsegs[NUMCHUNKS];
byte grneeded[NUMCHUNKS];
byte ca_levelbit,ca_levelnum;
memptr bufferseg;
/*
=============================================================================
......@@ -843,13 +841,16 @@ void CAL_ExpandGrChunk (int chunk, byte *source)
======================
*/
void CA_CacheGrChunk (int chunk)
void CA_CacheGrChunk(int chunk)
{
long pos,compressed;
memptr bigbufferseg;
byte *source;
int next;
if ( (grhandle == 0) || (grhandle == -1) ) /* make sure this works ok */
return;
grneeded[chunk] |= ca_levelbit; /* make sure it doesn't get removed */
if (grsegs[chunk])
{
......@@ -873,23 +874,14 @@ void CA_CacheGrChunk (int chunk)
lseek(grhandle,pos,SEEK_SET);
if (compressed<=BUFFERSIZE)
{
CA_FarRead(grhandle,bufferseg,compressed);
source = bufferseg;
}
else
{
MM_GetPtr(&bigbufferseg,compressed);
MM_SetLock (&bigbufferseg,true);
CA_FarRead(grhandle,bigbufferseg,compressed);
source = bigbufferseg;
}
MM_GetPtr(&bigbufferseg,compressed);
MM_SetLock (&bigbufferseg,true);
CA_FarRead(grhandle,bigbufferseg,compressed);
source = bigbufferseg;
CAL_ExpandGrChunk (chunk,source);
if (compressed>BUFFERSIZE)
MM_FreePtr(&bigbufferseg);
MM_FreePtr(&bigbufferseg);
}
......@@ -978,14 +970,9 @@ void CA_CacheMap(int mapnum)
dest = (memptr)&mapsegs[plane];
lseek(maphandle,pos,SEEK_SET);
if (compressed<=BUFFERSIZE)
source = bufferseg;
else
{
MM_GetPtr(&bigbufferseg,compressed);
MM_SetLock (&bigbufferseg,true);
source = bigbufferseg;
}
MM_GetPtr(&bigbufferseg,compressed);
MM_SetLock (&bigbufferseg,true);
source = bigbufferseg;
CA_FarRead(maphandle,(byte *)source,compressed);
/*
......@@ -1002,8 +989,7 @@ void CA_CacheMap(int mapnum)
((mapfiletype *)tinf)->RLEWtag);
MM_FreePtr (&buffer2seg);
if (compressed>BUFFERSIZE)
MM_FreePtr(&bigbufferseg);
MM_FreePtr(&bigbufferseg);
}
}
......@@ -1022,6 +1008,7 @@ void CA_CacheMap(int mapnum)
void CA_UpLevel (void)
{
/*
int i;
if (ca_levelnum==7)
......@@ -1032,6 +1019,7 @@ void CA_UpLevel (void)
MM_SetPurge ((memptr)&grsegs[i],3);
ca_levelbit<<=1;
ca_levelnum++;
*/
}
//===========================================================================
......@@ -1049,11 +1037,13 @@ void CA_UpLevel (void)
void CA_DownLevel (void)
{
/*
if (!ca_levelnum)
Quit ("CA_DownLevel: Down past level 0!");
ca_levelbit>>=1;
ca_levelnum--;
CA_CacheMarks();
*/
}
//===========================================================================
......@@ -1067,7 +1057,7 @@ void CA_DownLevel (void)
=
======================
*/
#if 0
void CA_ClearMarks (void)
{
int i;
......@@ -1075,7 +1065,7 @@ void CA_ClearMarks (void)
for (i=0;i<NUMCHUNKS;i++)
grneeded[i]&=~ca_levelbit;
}
#endif
//===========================================================================
......@@ -1088,14 +1078,14 @@ void CA_ClearMarks (void)
=
======================
*/
#if 0
void CA_ClearAllMarks (void)
{
memset (grneeded,0,sizeof(grneeded));
ca_levelbit = 1;
ca_levelnum = 0;
}
#endif
//===========================================================================
......@@ -1106,7 +1096,7 @@ void CA_ClearAllMarks (void)
=
======================
*/
#if 0
void CA_SetGrPurge (void)
{
int i;
......@@ -1120,7 +1110,7 @@ void CA_SetGrPurge (void)
if (grsegs[i])
MM_SetPurge ((memptr)&grsegs[i],3);
}
#endif
/*
======================
=
......@@ -1130,7 +1120,7 @@ void CA_SetGrPurge (void)
=
======================
*/
#if 0
void CA_SetAllPurge (void)
{
int i;
......@@ -1148,10 +1138,10 @@ void CA_SetAllPurge (void)
//
CA_SetGrPurge ();
}
#endif
//===========================================================================
#if 0
/*
======================
=
......@@ -1265,6 +1255,7 @@ void CA_CacheMarks (void)
}
}
#endif
void CA_CannotOpen(char *string)
{
......@@ -1297,7 +1288,6 @@ void CA_CannotOpen(char *string)
void MM_Startup (void)
{
MM_GetPtr (&bufferseg, BUFFERSIZE);
}
/*
......@@ -1312,8 +1302,6 @@ void MM_Startup (void)
void MM_Shutdown(void)
{
MM_FreePtr(bufferseg);
bufferseg = NULL;
}
/*
......
......@@ -63,9 +63,12 @@ void CA_SetGrPurge (void);
void CA_CacheAudioChunk (int chunk);
void CA_LoadAllSounds (void);
void CA_CacheMap (int mapnum);
void CA_CacheGrChunk (int chunk);
void CA_UpLevel (void);
void CA_DownLevel (void);
/*
void CA_SetAllPurge (void);
void CA_ClearMarks (void);
......@@ -73,15 +76,11 @@ void CA_ClearAllMarks (void);
#define CA_MarkGrChunk(chunk) grneeded[chunk]|=ca_levelbit
void CA_CacheGrChunk (int chunk);
void CA_CacheMap (int mapnum);
void CA_CacheMarks (void);
*/
void CA_CacheScreen (int chunk);
#define BUFFERSIZE 0x1000 // miscelanious, allways available buffer
//==========================================================================
void MM_Startup (void);
......
......@@ -111,7 +111,7 @@ void VWB_Vlin(int y1, int y2, int x, int color)
void VW_UpdateScreen(void)
{
VH_UpdateScreen ();
VL_UpdateScreen ();
}
/*
......
......@@ -26,11 +26,6 @@ extern byte fontcolor;
extern int fontnumber;
extern int px,py;
//
// Double buffer management routines
//
int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2);
void VW_UpdateScreen (void);
//
......@@ -52,7 +47,6 @@ extern byte gamepal;
#define VW_Startup VL_Startup
#define VW_Shutdown VL_Shutdown
#define VW_SetScreen VL_SetScreen
#define VW_Bar VL_Bar
#define VW_Plot VL_Plot
#define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c)
......@@ -61,15 +55,14 @@ extern byte gamepal;
#define VW_WaitVBL VL_WaitVBL
#define VW_FadeIn() VL_FadeIn(0,255,&gamepal,30);
#define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30);
#define VW_ScreenToScreen VL_ScreenToScreen
void VW_MeasurePropString(char *string, word *width, word *height);
#define LatchDrawChar(x,y,p) VL_LatchToScreen(latchpics[0]+(p)*16,2,8,x,y)
#define LatchDrawTile(x,y,p) VL_LatchToScreen(latchpics[1]+(p)*64,4,16,x,y)
void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);
void LoadLatchMem (void);
boolean FizzleFade (byte *source, unsigned width,unsigned height, unsigned frames,boolean abortable);
void LatchDrawPic(unsigned x, unsigned y, unsigned picnum);
void LoadLatchMem(void);
boolean FizzleFade(byte *source, unsigned width,unsigned height, unsigned frames,boolean abortable);
#define NUMLATCHPICS 100
extern unsigned latchpics[NUMLATCHPICS];
......
......@@ -2,16 +2,20 @@
#include "id_heads.h"
boolean screenfaded;
boolean screenfaded;
byte palette1[256][3], palette2[256][3];
byte palette1[256][3], palette2[256][3];
byte *gfxbuf;
byte *gfxbuf = NULL;
void VL_WaitVBL(int vbls)
{
}
void VL_UpdateScreen()
{
}
/*
=======================
=
......@@ -22,6 +26,8 @@ void VL_WaitVBL(int vbls)
void VL_Startup (void)
{
if (gfxbuf == NULL)
gfxbuf = malloc(320 * 200 * 1);
}
/*
......@@ -34,6 +40,10 @@ void VL_Startup (void)
void VL_Shutdown (void)
{
if (gfxbuf != NULL) {
free(gfxbuf);
gfxbuf = NULL;
}
}
//===========================================================================
......@@ -71,7 +81,7 @@ void VL_ClearVideo (byte color)
=================
*/
void VL_FillPalette (int red, int green, int blue)
void VL_FillPalette(int red, int green, int blue)
{
}
......@@ -431,46 +441,3 @@ asm mov ds,ax
VGAWRITEMODE(0);
#endif
}
/* ======================================================================== */
#if 0
/*
=================
=
= VL_ScreenToScreen
=
=================
*/
void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height)
{
VGAWRITEMODE(1);
VGAMAPMASK(15);
asm mov si,[source]
asm mov di,[dest]
asm mov ax,[width]
asm mov bx,[linewidth]
asm sub bx,ax
asm mov dx,[height]
asm mov cx,SCREENSEG
asm mov ds,cx
asm mov es,cx
drawline:
asm mov cx,ax
asm rep movsb
asm add si,bx
asm add di,bx
asm dec dx
asm jnz drawline
asm mov ax,ss
asm mov ds,ax
VGAWRITEMODE(0);
}
#endif
......@@ -3,18 +3,9 @@
//===========================================================================
#define SCREENWIDTH 80 // default screen width in bytes
#define TILEWIDTH 4
//===========================================================================
extern byte *gfxbuf;
extern unsigned bufferofs; // all drawing is reletive to this
extern unsigned displayofs; // last setscreen coordinates
extern boolean screenfaded;
extern boolean screenfaded;
//===========================================================================
......@@ -40,7 +31,6 @@ 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_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);
void VL_DrawPropString (char *str, unsigned tile8ptr, int printx, int printy);
......
......@@ -154,16 +154,10 @@ void PicturePause (void)
// vga stuff...
//
ClearMemory ();
CA_SetAllPurge();
/* TODO: save picture to file */
VL_SetPalette (&gamepal);
IN_Shutdown ();
VW_WaitVBL(70);
VW_WaitVBL(70);
Quit(NULL);
......
......@@ -712,7 +712,6 @@ extern char str[80],str2[20];
extern fixed focallength;
extern unsigned viewangles;
extern unsigned screenofs;
extern int viewwidth;
extern int viewheight;
extern int centerx;
......
......@@ -42,7 +42,6 @@ int dirangle[9] = {0,ANGLES/8,2*ANGLES/8,3*ANGLES/8,4*ANGLES
// proejection variables
//
fixed focallength;
unsigned screenofs;
int viewwidth;
int viewheight;
int centerx;
......@@ -1048,17 +1047,16 @@ void InitGame (void)
else
virtualreality = false;
MM_Startup (); // so the signon screen can be freed
SignonScreen ();
MM_Startup ();
VW_Startup ();
IN_Startup ();
PM_Startup ();
SD_Startup ();
CA_Startup ();
US_Startup ();
SignonScreen ();
//
// build some tables
//
......@@ -1129,7 +1127,6 @@ boolean SetViewSize (unsigned width, unsigned height)
viewheight = height&~1; // must be even
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;
......@@ -1196,26 +1193,28 @@ void NewViewSize (int width)
void Quit (char *error)
{
unsigned finscreen;
memptr screen;
memptr screen;
ClearMemory ();
if (!*error)
{
#ifndef JAPAN
CA_CacheGrChunk (ORDERSCREEN);
CA_CacheGrChunk(ORDERSCREEN);
screen = grsegs[ORDERSCREEN];
#endif
WriteConfig ();
}
else
{
CA_CacheGrChunk (ERRORSCREEN);
CA_CacheGrChunk(ERRORSCREEN);
screen = grsegs[ERRORSCREEN];
}
ShutdownId ();
if (screen) {
/* blah blah */
}
if (error && *error)
printf("Quit: %s\n", error);
else
......
......@@ -639,7 +639,6 @@ void CheckKeys (void)
ClearMemory ();
CA_CacheGrChunk (STARTFONT+1);
ClearSplitVWB ();
VW_ScreenToScreen (displayofs,bufferofs,80,160);
Message(STR_CHEATER1"\n"
STR_CHEATER2"\n\n"
......@@ -672,7 +671,6 @@ void CheckKeys (void)
ClearMemory ();
CA_CacheGrChunk (STARTFONT+1);
ClearSplitVWB ();
VW_ScreenToScreen (displayofs,bufferofs,80,160);
Message("Debugging keys are\nnow available!");
UNCACHEGRCHUNK(STARTFONT+1);
......@@ -693,7 +691,6 @@ void CheckKeys (void)
ClearMemory ();
CA_CacheGrChunk (STARTFONT+1);
ClearSplitVWB ();
VW_ScreenToScreen (displayofs,bufferofs,80,160);
Message("Commander Keen is also\n"
"available from Apogee, but\n"
......@@ -733,10 +730,9 @@ void CheckKeys (void)
{
ClearMemory ();
ClearSplitVWB ();
VW_ScreenToScreen (displayofs,bufferofs,80,160);
US_ControlPanel(scan);
DrawAllPlayBorderSides ();
DrawAllPlayBorderSides ();
if (scan == sc_F9)
StartMusic ();
......
......@@ -556,23 +556,32 @@ void CacheLayoutGraphics (void)
numpages++;
if (ch == 'E') // end of file, so load graphics and return
{
/*
CA_MarkGrChunk(H_TOPWINDOWPIC);
CA_MarkGrChunk(H_LEFTWINDOWPIC);
CA_MarkGrChunk(H_RIGHTWINDOWPIC);
CA_MarkGrChunk(H_BOTTOMINFOPIC);
CA_CacheMarks ();
*/
CA_CacheGrChunk(H_TOPWINDOWPIC);
CA_CacheGrChunk(H_LEFTWINDOWPIC);
CA_CacheGrChunk(H_RIGHTWINDOWPIC);
CA_CacheGrChunk(H_BOTTOMINFOPIC);
text = textstart;
return;
}
if (ch == 'G') // draw graphic command, so mark graphics
{
ParsePicCommand ();
CA_MarkGrChunk (picnum);
/* CA_MarkGrChunk (picnum); */
CA_CacheGrChunk(picnum);
}
if (ch == 'T') // timed draw graphic command, so mark graphics
{
ParseTimedCommand ();
CA_MarkGrChunk (picnum);
/* CA_MarkGrChunk (picnum); */
CA_CacheGrChunk(picnum);
}
}
else
......@@ -644,7 +653,8 @@ void ShowArticle (char *article)
text = article;
oldfontnumber = fontnumber;
fontnumber = 0;
CA_MarkGrChunk(STARTFONT);
/* CA_MarkGrChunk(STARTFONT); */
CA_CacheGrChunk(STARTFONT);
VWB_Bar (0,0,320,200,BACKCOLOR);
CacheLayoutGraphics ();
#endif
......
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