shithub: wl3d

Download patch

ref: 8593017d90b2d7df84a70b06f5e6983d40e12e8d
parent: 581f80d934be37eece8c8dae06168d45f5fc2b54
author: qwx <>
date: Fri Aug 11 17:24:55 EDT 2017

nuke rest of ref code and fix wl3d(6) typo

--- a/debug.c
+++ /dev/null
@@ -1,118 +1,0 @@
-#define VIEWTILEX	(vw.dx/16)
-#define VIEWTILEY	(vw.dy/16)
-
-s16int	maporgx;
-s16int	maporgy;
-enum {mapview,tilemapview,actoratview,visview}	viewtype;
-
-s16int DebugKeys (void)
-{
-	int esc;
-	s16int level,i;
-
-	if (Keyboard[sc_O])
-	{
-		ViewMap();
-		return 1;
-	}
-	return 0;
-}
-
-void OverheadRefresh (void)
-{
-	u16int	x,y,endx,endy,sx,sy;
-	u16int	tile;
-
-	endx = maporgx+VIEWTILEX;
-	endy = maporgy+VIEWTILEY;
-
-	for (y=maporgy;y<endy;y++)
-		for (x=maporgx;x<endx;x++)
-		{
-			sx = (x-maporgx)*16;
-			sy = (y-maporgy)*16;
-
-			switch (viewtype)
-			{
-#if 0
-			case mapview:
-				tile = *(mapsegs[0]+farmapylookup[y]+x);
-				break;
-
-			case tilemapview:
-				tile = tilemap[x][y];
-				break;
-
-			case visview:
-				tile = spotvis[x][y];
-				break;
-#endif
-			case actoratview:
-				tile = (u16int)actorat[x][y];
-				break;
-			}
-
-			if (tile<MAXWALLTILES)
-				LatchDrawTile(sx,sy,tile);
-			else
-			{
-				LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12));
-				LatchDrawChar(sx+8,sy,NUMBERCHARS+((tile&0x0f00)>>8));
-				LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4));
-				LatchDrawChar(sx+8,sy+8,NUMBERCHARS+(tile&0x000f));
-			}
-		}
-
-}
-
-void ViewMap (void)
-{
-	int		button0held;
-
-	viewtype = actoratview;
-//	button0held = false;
-
-
-	maporgx = player->tilex - VIEWTILEX/2;
-	if (maporgx<0)
-		maporgx = 0;
-	if (maporgx>MAPSIZE-VIEWTILEX)
-		maporgx=MAPSIZE-VIEWTILEX;
-	maporgy = player->tiley - VIEWTILEY/2;
-	if (maporgy<0)
-		maporgy = 0;
-	if (maporgy>MAPSIZE-VIEWTILEY)
-		maporgy=MAPSIZE-VIEWTILEY;
-
-	do
-	{
-//
-// let user pan around
-//
-		PollControls ();
-		if (controlx < 0 && maporgx>0)
-			maporgx--;
-		if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
-			maporgx++;
-		if (controly < 0 && maporgy>0)
-			maporgy--;
-		if (controly > 0 && maporgy<mapheight-VIEWTILEY)
-			maporgy++;
-#if 0
-		if (c.button0 && !button0held)
-		{
-			button0held = true;
-			viewtype++;
-			if (viewtype>visview)
-				viewtype = mapview;
-		}
-		if (!c.button0)
-			button0held = false;
-#endif
-
-		OverheadRefresh ();
-
-	} while (!Keyboard[sc_Escape]);
-
-	IN_ClearKeysDown ();
-}
--- a/def.h
+++ /dev/null
@@ -1,211 +1,0 @@
-#define COLORBORDER(color)		asm{mov	dx,STATUS_REGISTER_1;in al,dx;\
-	mov dx,ATR_INDEX;mov al,ATR_OVERSCAN;out dx,al;mov al,color;out	dx,al;\
-	mov	al,32;out dx,al};
-
-#define MAPSPOT(x,y,plane)		(*(mapsegs[plane]+farmapylookup[y]+x))
-
-#define MAXWALLTILES	64				// max number of wall tiles
-
-//
-// tile constants
-//
-
-#define	ICONARROWS		90
-#define PUSHABLETILE	98
-#define EXITTILE		99	// at end of castle
-#define ELEVATORTILE	21
-#define	ALTELEVATORTILE	107
-
-#define NUMBERCHARS	9
-
-#define PLAYERSPEED		3000
-#define RUNSPEED   		6000
-
-#define	SCREENSEG		0xa000
-
-#define SCREENBWIDE		80
-
-#define HEIGHTRATIO		0.50		// also defined in id_mm.c
-
-#define BORDERCOLOR	3
-#define FLASHCOLOR	5
-#define FLASHTICS	4
-
-
-#define Dplr		Dmin			// player radius
-										// to any actor center
-
-#define NUMLATCHPICS	100
-
-#define UNSIGNEDSHIFT	8
-
-#define ANGLES		360					// must be divisable by 4
-#define ANGLEQUAD	(ANGLES/4)
-#define FINEANGLES	3600
-#define ANG90		(FINEANGLES/4)
-#define ANG180		(ANG90*2)
-#define ANG270		(ANG90*3)
-#define ANG360		(ANG90*4)
-#define VANG90		(ANGLES/4)
-#define VANG180		(VANG90*2)
-#define VANG270		(VANG90*3)
-#define VANG360		(VANG90*4)
-
-#define	MAXSCALEHEIGHT	256				// largest scale on largest view
-
-#define MAXVIEWWIDTH		320
-
-#define MAPSIZE		64					// maps are 64*64 max
-
-#define STATUSLINES		40
-
-#define SCREENSIZE		(SCREENBWIDE*208)
-#define PAGE1START		0
-#define PAGE2START		(SCREENSIZE)
-#define PAGE3START		(SCREENSIZE*2u)
-#define	FREESTART		(SCREENSIZE*3u)
-
-#define PIXRADIUS		512
-#define STARTAMMO		8
-
-#define	PORTTILESWIDE		20      // all drawing takes place inside a
-#define UPDATEWIDE			PORTTILESWIDE
-#define UPDATEHIGH			PORTTILESHIGH
-#define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b;
-
-typedef enum {
-	di_north,
-	di_east,
-	di_south,
-	di_west
-} controldir_t;
-
-typedef enum {
-	ac_badobject = -1,
-	ac_no,
-	ac_yes,
-	ac_allways
-} activetype;
-
-typedef struct	statestruct
-{
-	int	rotate;
-	s16int		shapenum;			// a shapenum of -1 means get from ob->temp1
-	s16int		tictime;
-	void	(*think) (),(*action) ();
-	struct	statestruct	*next;
-} statetype;
-
-typedef struct statstruct
-{
-	u8int	tilex,tiley;
-	u8int	*visspot;
-	s16int		shapenum;			// if shapenum == -1 the obj has been removed
-	u8int	flags;
-	u8int	item;
-} statobj_t;
-
-extern	u8int far	*scalermemory;
-
-extern	s32int		focallength;
-extern	u16int	screenofs;
-
-extern	int         startgame;
-extern	s16int		mouseadjustment;
-
-extern	int		ingame,fizzlein;
-extern	u16int	latchpics[NUMLATCHPICS];
-extern	gametype	gamestate;
-
-extern	s32int		spearx,speary;
-extern	u16int	spearangle;
-extern	int		spearflag;
-
-#define UPDATESIZE			(UPDATEWIDE*UPDATEHIGH)
-extern	u8int		update[UPDATESIZE];
-
-extern	s16int			extravbls;
-
-extern	char		far *demoptr, far *lastdemoptr;
-extern	uchar *demobuffer;
-
-extern	u16int screenloc[3] = {PAGE1START,PAGE2START,PAGE3START};
-extern	u16int freelatch;	// = FREESTART
-
-// the door is the last picture before the sprites
-#define SPdoor	(PMSpriteStart-8)
-// e.g. sprs-8
-
-extern	s32int 	lasttimecount;
-extern	s32int 	frameon;
-extern	int	fizzlein;
-
-extern	u16int	wallheight[MAXVIEWWIDTH];
-
-extern	s32int	focallength;
-extern	s32int	mindist;
-
-//
-// wall optimization variables
-//
-extern s16int	lastside;		// true for vertical
-extern s32int	lastintercept;
-extern s16int	lasttilehit;
-extern s16int	horizwall[MAXWALLTILES],vertwall[MAXWALLTILES];
-
-//
-// derived constants
-//
-extern	s32int 	scale;
-extern	s32int	mindist;
-
-// refresh variables
-extern	s32int		postsource;
-extern	u16int	scx;
-extern	u16int	postwidth;
-
-extern	dirtype opposite[9];
-extern	dirtype diagonal[9][9];
-
-typedef struct
-{
-	u16int	codeofs[65];
-	u16int	width[65];
-	u8int		code[];
-}	t_compscale;
-
-typedef struct
-{
-	u16int	leftpix,rightpix;
-	u16int	dataofs[64];
-// table data after dataofs[rightpix-leftpix+1]
-}	t_compshape;
-
-
-extern	t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1];
-extern	s32int			fullscalefarcall[MAXSCALEHEIGHT+1];
-
-extern	u8int		bitmasks1[8][8];
-extern	u8int		bitmasks2[8][8];
-extern	u16int	wordmasks[8][8];
-
-extern	u8int		mapmasks1[4][8];
-extern	u8int		mapmasks2[4][8];
-extern	u8int		mapmasks3[4][8];
-
-extern	s16int			maxscale,maxscaleshl2;
-
-extern	int	insetupscaling;
-
-extern	int		running;
-extern	u16int	plux,pluy;		// player coordinates scaled to u16int
-
-extern	s16int			anglefrac;
-extern	s16int			facecount;
-
-extern	u16int	doorposition[Ndoor],pwallstate;
-
-extern u16int	pwallstate;
-extern u16int	pwallpos;			// amount a pushable wall has been moved (0-63)
-extern u16int	pwallx,pwally;
-extern s16int			pwalldir;
--- a/game.c
+++ /dev/null
@@ -1,159 +1,0 @@
-int		ingame,fizzlein;
-u16int	latchpics[NUMLATCHPICS];
-
-#define MAXDEMOSIZE	8192
-
-void StartDemoRecord (s16int levelnumber)
-{
-	MM_GetPtr (&demobuffer,MAXDEMOSIZE);
-	MM_SetLock (&demobuffer,true);
-	demoptr = (char far *)demobuffer;
-	lastdemoptr = demoptr+MAXDEMOSIZE;
-
-	*demoptr = levelnumber;
-	demoptr += 4;				// leave space for length
-	gm.record = true;
-}
-
-char	demoname[13] = "DEMO?.";
-
-void FinishDemoRecord (void)
-{
-	s32int	length,level;
-
-	gm.record = false;
-
-	length = demoptr - (char far *)demobuffer;
-
-	demoptr = ((char far *)demobuffer)+1;
-	*(u16int far *)demoptr = length;
-
-	CenterWindow(24,3);	/* No. */
-	PrintY+=6;
-	US_Print(" Demo number (0-9):");
-	VW_UpdateScreen();
-
-	if (US_LineInput (px,py,str,NULL,true,2,0))
-	{
-		level = atoi (str);
-		if (level>=0 && level<=9)
-		{
-			demoname[4] = '0'+level;
-			CA_WriteFile (demoname,(void far *)demobuffer,length);
-		}
-	}
-	MM_FreePtr (&demobuffer);
-}
-
-void RecordDemo (void)
-{
-	s16int level,esc;
-
-	CenterWindow(26,3);	/* No. */
-	PrintY+=6;
-	CA_CacheGrChunk(STARTFONT);
-	fontnumber=0;
-	US_Print("  Demo which level(1-10):");
-	VW_UpdateScreen();
-	VW_FadeIn ();
-	esc = !US_LineInput (px,py,str,NULL,true,2,0);
-	if (esc)
-		return;
-
-	level = atoi (str);
-	level--;
-
-	SETFONTCOLOR(0,15);
-	VW_FadeOut ();
-
-#ifndef SPEAR
-	NewGame (GDhard,level/10);
-	gamestate.mapon = level%10;
-#else
-	NewGame (GDhard,0);
-	gamestate.mapon = level;
-#endif
-
-	StartDemoRecord (level);
-
-	view ();
-	VW_FadeIn ();
-
-	startgame = false;
-	gm.record = true;
-
-	initmap ();
-	mapmus ();
-	PM_CheckMainMem ();
-	fizzlein = true;
-
-	PlayLoop ();
-
-	gm.demo = false;
-
-	stopmus ();
-	VW_FadeOut ();
-
-	FinishDemoRecord ();
-}
-
-#define DEATHROTATE 2
-
-void GameLoop (void)
-{
-	s16int i,xl,yl,xh,yh;
-	char num[20];
-	int	died;
-
-restartgame:
-	SETFONTCOLOR(0,15);
-	view ();
-	died = false;
-restart:
-	do
-	{
-		if (!gm.load)
-		  gm.pt = gamestate.oldscore;
-		hudp();
-
-		startgame = false;
-		if (gm.load)
-			gm.load = false;
-		else
-			initmap ();
-
-		ingame = true;
-		mapmus ();
-		PM_CheckMainMem ();
-		if (!died)
-			PreloadGraphics ();
-		else
-			died = false;
-
-		fizzlein = true;
-		hudm ();
-
-startplayloop:
-		PlayLoop ();
-
-		stopmus ();
-		ingame = false;
-
-		if (gm.record && gm.φ != ex_warped)
-			FinishDemoRecord ();
-
-		if (startgame || gm.load)
-			goto restartgame;
-
-		switch (gm.φ)
-		{
-		case ex_completed:
-		case ex_secretlevel:
-			break;
-		case ex_died:
-			return;
-		case ex_victorious:
-			return;
-		}
-	} while (1);
-}
--- a/inter.c
+++ /dev/null
@@ -1,78 +1,0 @@
-void Victory (void)
-{
-	won();
-	IN_Ack();
-	VW_FadeOut ();
-#ifndef SPEAR
-	EndText();
-#else
-	EndSpear();
-#endif
-}
-
-void	CheckHighScore (s32int score,u16int other)
-{
-	u16int		i,j;
-	s16int			n;
-	HighScore	myscore;
-
-	strcpy(myscore.name,"");
-	myscore.score = score;
-	myscore.episode = gamestate.episode;
-	myscore.completed = other;
-
-	for (i = 0,n = -1;i < MaxScores;i++)
-	{
-		if
-		(
-			(myscore.score > Scores[i].score)
-		||	(
-				(myscore.score == Scores[i].score)
-			&& 	(myscore.completed > Scores[i].completed)
-			)
-		)
-		{
-			for (j = MaxScores;--j > i;)
-				Scores[j] = Scores[j - 1];
-			Scores[i] = myscore;
-			n = i;
-			break;
-		}
-	}
-
-#ifdef SPEAR
-	StartCPMusic (20);
-#else
-	StartCPMusic (23);
-#endif
-	DrawHighScores ();
-
-	VW_FadeIn ();
-
-	if (n != -1)
-	{
-	//
-	// got a high score
-	//
-		PrintY = 76 + (16 * n);
-#ifndef SPEAR
-		PrintX = 4*8;
-		backcolor = BORDCOLOR;
-		fontcolor = 15;
-		US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,100);
-#else
-		PrintX = 16;
-		fontnumber = 1;
-		VWB_Bar (PrintX-2,PrintY-2,145,15,0x9c);
-		VW_UpdateScreen ();
-		backcolor = 0x9c;
-		fontcolor = 15;
-		US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,130);
-#endif
-	}
-	else
-	{
-		IN_ClearKeysDown ();
-		IN_UserInput(500);
-	}
-}
--- a/main.c
+++ /dev/null
@@ -1,150 +1,0 @@
-int         startgame;
-s16int             mouseadjustment;
-
-char	configname[13]="CONFIG.";
-
-void ReadConfig(void)
-{
-	s16int                     file;
-	SDMode          sd;
-	SMMode          sm;
-	SDSMode         sds;
-
-
-	if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1)
-	{
-	//
-	// valid config file
-	//
-		read(file,Scores,sizeof(HighScore) * MaxScores);
-
-		read(file,&sd,sizeof(sd));
-		read(file,&sm,sizeof(sm));
-		read(file,&sds,sizeof(sds));
-
-		read(file,&mouseenabled,sizeof(mouseenabled));
-		read(file,&joystickenabled,sizeof(joystickenabled));
-		read(file,&joypadenabled,sizeof(joypadenabled));
-		read(file,&joystickprogressive,sizeof(joystickprogressive));
-		read(file,&joystickport,sizeof(joystickport));
-
-		read(file,&dirscan,sizeof(dirscan));
-		read(file,&buttonscan,sizeof(buttonscan));
-		read(file,&buttonmouse,sizeof(buttonmouse));
-		read(file,&buttonjoy,sizeof(buttonjoy));
-
-		read(file,&vw.size,sizeof(vw.size));
-		read(file,&mouseadjustment,sizeof(mouseadjustment));
-
-		close(file);
-
-		if (sd == sdm_AdLib && !AdLibPresent && !SoundBlasterPresent)
-		{
-			sd = sdm_PC;
-			sd = smm_Off;
-		}
-
-		if ((sds == sds_SoundBlaster && !SoundBlasterPresent) ||
-			(sds == sds_SoundSource && !SoundSourcePresent))
-			sds = sds_Off;
-
-		if (!MousePresent)
-			mouseenabled = false;
-
-		MainMenu[6].active=1;
-	}
-	else
-	{
-	//
-	// no config file, so select by hardware
-	//
-		if (SoundBlasterPresent || AdLibPresent)
-		{
-			sd = sdm_AdLib;
-			sm = smm_AdLib;
-		}
-		else
-		{
-			sd = sdm_PC;
-			sm = smm_Off;
-		}
-
-		if (SoundBlasterPresent)
-			sds = sds_SoundBlaster;
-		else if (SoundSourcePresent)
-			sds = sds_SoundSource;
-		else
-			sds = sds_Off;
-
-		if (MousePresent)
-			mouseenabled = true;
-
-		vw.size = 15;
-		mouseadjustment=5;
-	}
-
-	SD_SetMusicMode (sm);
-	SD_SetSoundMode (sd);
-	SD_SetDigiDevice (sds);
-
-}
-
-void WriteConfig(void)
-{
-	s16int                     file;
-
-	file = open(configname,O_CREAT | O_BINARY | O_WRONLY,
-				S_IREAD | S_IWRITE | S_IFREG);
-
-	if (file != -1)
-	{
-		write(file,Scores,sizeof(HighScore) * MaxScores);
-
-		write(file,&SoundMode,sizeof(SoundMode));
-		write(file,&MusicMode,sizeof(MusicMode));
-		write(file,&DigiMode,sizeof(DigiMode));
-
-		write(file,&mouseenabled,sizeof(mouseenabled));
-		write(file,&joystickenabled,sizeof(joystickenabled));
-		write(file,&joypadenabled,sizeof(joypadenabled));
-		write(file,&joystickprogressive,sizeof(joystickprogressive));
-		write(file,&joystickport,sizeof(joystickport));
-
-		write(file,&dirscan,sizeof(dirscan));
-		write(file,&buttonscan,sizeof(buttonscan));
-		write(file,&buttonmouse,sizeof(buttonmouse));
-		write(file,&buttonjoy,sizeof(buttonjoy));
-
-		write(file,&vw.size,sizeof(vw.size));
-		write(file,&mouseadjustment,sizeof(mouseadjustment));
-
-		close(file);
-	}
-}
-
-void    DemoLoop (void)
-{
-	while (1)
-	{
-		while (!NoWait)
-		{
-			PlayDemo(p++);
-			if(p >= epis)
-				p = dems;
-			if (gm.φ == ex_abort)
-				break;
-			StartCPMusic(INTROSONG);
-		}
-		VW_FadeOut ();
-		if (Keyboard[sc_Tab] && debug)
-			RecordDemo ();
-		else
-			US_ControlPanel (0);
-		if (startgame || gm.load)
-		{
-			GameLoop ();
-			VW_FadeOut();
-			StartCPMusic(INTROSONG);
-		}
-	}
-}
--- a/man/6/wl3d
+++ b/man/6/wl3d
@@ -486,7 +486,7 @@
 .IR bt [1]
 .IR dx [1]
 .IR dy [1]
-.RI }[ size-4 ]
+.RI }[ size/3-4 ]
 .RE
 .PP
 The only metadata contained in demo lumps is
--- a/menu.c
+++ /dev/null
@@ -1,122 +1,0 @@
-void CP_ReadThis(void)
-{
-	StartCPMusic(0);
-	HelpScreens();
-	StartCPMusic(MENUSONG);
-}
-
-s16int CP_CheckQuick(u16int scancode)
-{
-	switch(scancode)
-	{
-		//
-		// END GAME
-		//
-		case sc_F7:
-			CA_CacheGrChunk(STARTFONT+1);
-
-			WindowH=160;
-			if (Confirm(ENDGAMESTR))
-			{
-				gm.φ = ex_died;
-				pickquick = gamestate.lives = 0;
-			}
-
-			DrawAllPlayBorder();
-			WindowH=200;
-			fontnumber=0;
-			MainMenu[savegame].active = 0;
-			return 1;
-
-		//
-		// QUICKSAVE
-		//
-		case sc_F8:
-			if (SaveGamesAvail[LSItems.curpos] && pickquick)
-			{
-				CA_CacheGrChunk(STARTFONT+1);
-				fontnumber = 1;
-				Message("Saving...");
-				CP_SaveGame(1);
-				fontnumber=0;
-			}
-			else
-			{
-				VW_FadeOut ();
-
-				StartCPMusic(MENUSONG);
-				pickquick=CP_SaveGame(0);
-
-				SETFONTCOLOR(0,15);
-				IN_ClearKeysDown();
-				view ();
-
-				if (!startgame && !gm.load)
-				{
-					VW_FadeIn ();
-					mapmus ();
-				}
-
-				if (gm.load)
-					gm.φ = ex_abort;
-				lasttimecount = TimeCount;
-
-				if (MousePresent)
-					Mouse(MDelta);	// Clear accumulated mouse movement
-
-				PM_CheckMainMem ();
-			}
-			return 1;
-
-		//
-		// QUICKLOAD
-		//
-		case sc_F9:
-			if (SaveGamesAvail[LSItems.curpos] && pickquick)
-			{
-				char string[100]="Load Game called\n\"";
-
-
-				CA_CacheGrChunk(STARTFONT+1);
-				fontnumber = 1;
-
-				strcat(string,SaveGameNames[LSItems.curpos]);
-				strcat(string,"\"?");
-
-				if (Confirm(string))
-					CP_LoadGame(1);
-
-				DrawAllPlayBorder();
-				fontnumber=0;
-			}
-			else
-			{
-				VW_FadeOut ();
-
-				StartCPMusic(MENUSONG);
-				pickquick=CP_LoadGame(0);
-
-				SETFONTCOLOR(0,15);
-				IN_ClearKeysDown();
-				view ();
-
-				if (!startgame && !gm.load)
-				{
-					VW_FadeIn ();
-					mapmus ();
-				}
-
-				if (gm.load)
-					gm.φ = ex_abort;
-
-				lasttimecount = TimeCount;
-
-				if (MousePresent)
-					Mouse(MDelta);	// Clear accumulated mouse movement
-				PM_CheckMainMem ();
-			}
-			return 1;
-		}
-
-	return 0;
-}
--- a/play.c
+++ /dev/null
@@ -1,83 +1,0 @@
-char		far *demoptr, far *lastdemoptr;
-uchar *demobuffer;
-
-void CheckKeys (void)
-{
-	s16int		i;
-	u8int	scan;
-	u16int	temp;
-
-
-	if (screenfaded || gm.demo)	// don't do anything with a faded screen
-		return;
-
-	scan = LastScan;
-
-//
-// pause key weirdness can't be checked as a scan code
-//
-	if (Paused)
-	{
-		bufferofs = displayofs;
-		LatchDrawPic (20-4,80-2*8,Ppause);
-		SD_MusicOff();
-		IN_Ack();
-		IN_ClearKeysDown ();
-		SD_MusicOn();
-		Paused = false;
-		if (MousePresent)
-			Mouse(MDelta);	// Clear accumulated mouse movement
-		return;
-	}
-
-
-//
-// F1-F7/ESC to enter control panel
-//
-	if (
-		scan == sc_F10 ||
-		scan == sc_F9 ||
-		scan == sc_F7 ||
-		scan == sc_F8)			// pop up quit dialog
-	{
-		ClearMemory ();
-		ClearSplitVWB ();
-		VW_ScreenToScreen (displayofs,bufferofs,80,160);
-		US_ControlPanel(scan);
-
-		 DrawAllPlayBorderSides ();
-
-		if (scan == sc_F9)
-		  mapmus ();
-
-		PM_CheckMainMem ();
-		SETFONTCOLOR(0,15);
-		IN_ClearKeysDown();
-		return;
-	}
-
-	if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape)
-	{
-		stopmus ();
-		ClearMemory ();
-		VW_FadeOut ();
-
-		US_ControlPanel(scan);
-
-		SETFONTCOLOR(0,15);
-		IN_ClearKeysDown();
-		view ();
-		if (!startgame && !gm.load)
-		{
-			VW_FadeIn ();
-			mapmus ();
-		}
-		if (gm.load)
-			gm.φ = ex_abort;
-		lasttimecount = TimeCount;
-		if (MousePresent)
-			Mouse(MDelta);	// Clear accumulated mouse movement
-		PM_CheckMainMem ();
-		return;
-	}
-}
--- a/text.c
+++ /dev/null
@@ -1,686 +1,0 @@
-// WL_TEXT.C
-
-#include "WL_DEF.H"
-#pragma	hdrstop
-
-/*
-=============================================================================
-
-TEXT FORMATTING COMMANDS
-------------------------
-^C<hex digit>  			Change text color
-^E[enter]				End of layout (all pages)
-^G<y>,<x>,<pic>[enter]	Draw a graphic and push margins
-^P[enter]				start new page, must be the first chars in a layout
-^L<x>,<y>[ENTER]		Locate to a specific spot, x in pixels, y in lines
-
-=============================================================================
-*/
-
-/*
-=============================================================================
-
-						 LOCAL CONSTANTS
-
-=============================================================================
-*/
-
-#define BACKCOLOR		0x11
-
-
-#define WORDLIMIT		80
-#define FONTHEIGHT		10
-#define	TOPMARGIN		16
-#define BOTTOMMARGIN	32
-#define LEFTMARGIN		16
-#define RIGHTMARGIN		16
-#define PICMARGIN		8
-#define TEXTROWS		((200-TOPMARGIN-BOTTOMMARGIN)/FONTHEIGHT)
-#define	SPACEWIDTH		7
-#define SCREENPIXWIDTH	320
-#define SCREENMID		(SCREENPIXWIDTH/2)
-
-/*
-=============================================================================
-
-						 LOCAL VARIABLES
-
-=============================================================================
-*/
-
-s16int			pagenum,numpages;
-
-u16int	leftmargin[TEXTROWS],rightmargin[TEXTROWS];
-char		far *text;
-u16int	rowon;
-
-s16int			picx,picy,picnum,picdelay;
-int		layoutdone;
-
-//===========================================================================
-
-/*
-=====================
-=
-= RipToEOL
-=
-=====================
-*/
-
-void RipToEOL (void)
-{
-	while (*text++ != '\n')		// scan to end of line
-	;
-}
-
-
-/*
-=====================
-=
-= ParseNumber
-=
-=====================
-*/
-
-s16int	ParseNumber (void)
-{
-	char	ch;
-	char	num[80],*numptr;
-
-//
-// scan until a number is found
-//
-	ch = *text;
-	while (ch < '0' || ch >'9')
-		ch = *++text;
-
-//
-// copy the number out
-//
-	numptr = num;
-	do
-	{
-		*numptr++ = ch;
-		ch = *++text;
-	} while (ch >= '0' && ch <= '9');
-	*numptr = 0;
-
-	return atoi (num);
-}
-
-
-
-/*
-=====================
-=
-= ParsePicCommand
-=
-= Call with text pointing just after a ^P
-= Upon exit text points to the start of next line
-=
-=====================
-*/
-
-void	ParsePicCommand (void)
-{
-	picy=ParseNumber();
-	picx=ParseNumber();
-	picnum=ParseNumber();
-	RipToEOL ();
-}
-
-
-void	ParseTimedCommand (void)
-{
-	picy=ParseNumber();
-	picx=ParseNumber();
-	picnum=ParseNumber();
-	picdelay=ParseNumber();
-	RipToEOL ();
-}
-
-
-/*
-=====================
-=
-= TimedPicCommand
-=
-= Call with text pointing just after a ^P
-= Upon exit text points to the start of next line
-=
-=====================
-*/
-
-void	TimedPicCommand (void)
-{
-	ParseTimedCommand ();
-
-//
-// update the screen, and wait for time delay
-//
-	VW_UpdateScreen ();
-
-//
-// wait for time
-//
-	TimeCount = 0;
-	while (TimeCount < picdelay)
-	;
-
-//
-// draw pic
-//
-	VWB_DrawPic (picx&~7,picy,picnum);
-}
-
-
-/*
-=====================
-=
-= HandleCommand
-=
-=====================
-*/
-
-void HandleCommand (void)
-{
-	s16int	i,margin,top,bottom;
-	s16int	picwidth,picheight,picmid;
-
-	switch (toupper(*++text))
-	{
-	case 'B':
-		picy=ParseNumber();
-		picx=ParseNumber();
-		picwidth=ParseNumber();
-		picheight=ParseNumber();
-		VWB_Bar(picx,picy,picwidth,picheight,BACKCOLOR);
-		RipToEOL();
-		break;
-	case ';':		// comment
-		RipToEOL();
-		break;
-	case 'P':		// ^P is start of next page, ^E is end of file
-	case 'E':
-		layoutdone = true;
-		text--;    	// back up to the '^'
-		break;
-
-	case 'C':		// ^c<hex digit> changes text color
-		i = toupper(*++text);
-		if (i>='0' && i<='9')
-			fontcolor = i-'0';
-		else if (i>='A' && i<='F')
-			fontcolor = i-'A'+10;
-
-		fontcolor *= 16;
-		i = toupper(*++text);
-		if (i>='0' && i<='9')
-			fontcolor += i-'0';
-		else if (i>='A' && i<='F')
-			fontcolor += i-'A'+10;
-		text++;
-		break;
-
-	case '>':
-		px = 160;
-		text++;
-		break;
-
-	case 'L':
-		py=ParseNumber();
-		rowon = (py-TOPMARGIN)/FONTHEIGHT;
-		py = TOPMARGIN+rowon*FONTHEIGHT;
-		px=ParseNumber();
-		while (*text++ != '\n')		// scan to end of line
-		;
-		break;
-
-	case 'T':		// ^Tyyy,xxx,ppp,ttt waits ttt tics, then draws pic
-		TimedPicCommand ();
-		break;
-
-	case 'G':		// ^Gyyy,xxx,ppp draws graphic
-		ParsePicCommand ();
-		VWB_DrawPic (picx&~7,picy,picnum);
-		picwidth = pictable[picnum-STARTPICS].width;
-		picheight = pictable[picnum-STARTPICS].height;
-		//
-		// adjust margins
-		//
-		picmid = picx + picwidth/2;
-		if (picmid > SCREENMID)
-			margin = picx-PICMARGIN;			// new right margin
-		else
-			margin = picx+picwidth+PICMARGIN;	// new left margin
-
-		top = (picy-TOPMARGIN)/FONTHEIGHT;
-		if (top<0)
-			top = 0;
-		bottom = (picy+picheight-TOPMARGIN)/FONTHEIGHT;
-		if (bottom>=TEXTROWS)
-			bottom = TEXTROWS-1;
-
-		for (i=top;i<=bottom;i++)
-			if (picmid > SCREENMID)
-				rightmargin[i] = margin;
-			else
-				leftmargin[i] = margin;
-
-		//
-		// adjust this line if needed
-		//
-		if (px < leftmargin[rowon])
-			px = leftmargin[rowon];
-		break;
-	}
-}
-
-
-/*
-=====================
-=
-= NewLine
-=
-=====================
-*/
-
-void NewLine (void)
-{
-	char	ch;
-
-	if (++rowon == TEXTROWS)
-	{
-	//
-	// overflowed the page, so skip until next page break
-	//
-		layoutdone = true;
-		do
-		{
-			if (*text == '^')
-			{
-				ch = toupper(*(text+1));
-				if (ch == 'E' || ch == 'P')
-				{
-					layoutdone = true;
-					return;
-				}
-			}
-			text++;
-
-		} while (1);
-
-	}
-	px = leftmargin[rowon];
-	py+= FONTHEIGHT;
-}
-
-
-
-/*
-=====================
-=
-= HandleCtrls
-=
-=====================
-*/
-
-void HandleCtrls (void)
-{
-	char	ch;
-
-	ch = *text++;			// get the character and advance
-
-	if (ch == '\n')
-	{
-		NewLine ();
-		return;
-	}
-
-}
-
-
-/*
-=====================
-=
-= HandleWord
-=
-=====================
-*/
-
-void HandleWord (void)
-{
-	char		word[WORDLIMIT];
-	s16int			i,wordindex;
-	u16int	wwidth,wheight,newpos;
-
-
-	//
-	// copy the next word into [word]
-	//
-	word[0] = *text++;
-	wordindex = 1;
-	while (*text>32)
-	{
-		word[wordindex] = *text++;
-		if (++wordindex == WORDLIMIT)
-			Quit ("PageLayout: Word limit exceeded");
-	}
-	word[wordindex] = 0;		// stick a null at end for C
-
-	//
-	// see if it fits on this line
-	//
-	VW_MeasurePropString (word,&wwidth,&wheight);
-
-	while (px+wwidth > rightmargin[rowon])
-	{
-		NewLine ();
-		if (layoutdone)
-			return;		// overflowed page
-	}
-
-	//
-	// print it
-	//
-	newpos = px+wwidth;
-	VWB_DrawPropString (word);
-	px = newpos;
-
-	//
-	// suck up any extra spaces
-	//
-	while (*text == ' ')
-	{
-		px += SPACEWIDTH;
-		text++;
-	}
-}
-
-/*
-=====================
-=
-= PageLayout
-=
-= Clears the screen, draws the pics on the page, and word wraps the text.
-= Returns a pointer to the terminating command
-=
-=====================
-*/
-
-void PageLayout (int shownumber)
-{
-	s16int		i,oldfontcolor;
-	char	ch;
-
-	oldfontcolor = fontcolor;
-
-	fontcolor = 0;
-
-//
-// clear the screen
-//
-	/* wl. lumps only, never used with spear */
-	VWB_Bar (0,0,320,200,BACKCOLOR);
-	VWB_DrawPic (0,0,Pbackdrop);
-	VWB_DrawPic (0,8,Pbackdrop+1);
-	VWB_DrawPic (312,8,Pbackdrop+2);
-	VWB_DrawPic (8,176,Pbackdrop+3);
-
-
-	for (i=0;i<TEXTROWS;i++)
-	{
-		leftmargin[i] = LEFTMARGIN;
-		rightmargin[i] = SCREENPIXWIDTH-RIGHTMARGIN;
-	}
-
-	px = LEFTMARGIN;
-	py = TOPMARGIN;
-	rowon = 0;
-	layoutdone = false;
-
-//
-// make sure we are starting layout text (^P first command)
-//
-	while (*text <= 32)
-		text++;
-
-	if (*text != '^' || toupper(*++text) != 'P')
-		Quit ("PageLayout: Text not headed with ^P");
-
-	while (*text++ != '\n')
-	;
-
-
-//
-// process text stream
-//
-	do
-	{
-		ch = *text;
-
-		if (ch == '^')
-			HandleCommand ();
-		else
-		if (ch == 9)
-		{
-		 px = (px+8)&0xf8;
-		 text++;
-		}
-		else if (ch <= 32)
-			HandleCtrls ();
-		else
-			HandleWord ();
-
-	} while (!layoutdone);
-
-	pagenum++;
-
-	if (shownumber)
-	{
-		strcpy (str,"pg ");
-		itoa (pagenum,str2,10);
-		strcat (str,str2);
-		strcat (str," of ");
-		py = 183;
-		px = 213;
-		itoa (numpages,str2,10);
-		strcat (str,str2);
-		fontcolor = 0x4f; 			   //12^BACKCOLOR;
-
-		VWB_DrawPropString (str);
-	}
-
-	fontcolor = oldfontcolor;
-}
-
-//===========================================================================
-
-/*
-=====================
-=
-= BackPage
-=
-= Scans for a previous ^P
-=
-=====================
-*/
-
-void BackPage (void)
-{
-	pagenum--;
-	do
-	{
-		text--;
-		if (*text == '^' && toupper(*(text+1)) == 'P')
-			return;
-	} while (1);
-}
-
-
-//===========================================================================
-
-
-/*
-=====================
-=
-= CacheLayoutGraphics
-=
-= Scans an entire layout file (until a ^E) marking all graphics used, and
-= counting pages, then caches the graphics in
-=
-=====================
-*/
-void CacheLayoutGraphics (void)
-{
-	char	far *bombpoint, far *textstart;
-	char	ch;
-
-	textstart = text;
-	bombpoint = text+30000;
-	numpages = pagenum = 0;
-
-	do
-	{
-		if (*text == '^')
-		{
-			ch = toupper(*++text);
-			if (ch == 'P')		// start of a page
-				numpages++;
-			if (ch == 'E')		// end of file, so load graphics and return
-			{
-				CA_CacheMarks ();
-				text = textstart;
-				return;
-			}
-			if (ch == 'G')		// draw graphic command, so mark graphics
-			{
-				ParsePicCommand ();
-			}
-			if (ch == 'T')		// timed draw graphic command, so mark graphics
-			{
-				ParseTimedCommand ();
-			}
-		}
-		else
-			text++;
-
-	} while (text<bombpoint);
-
-	Quit ("CacheLayoutGraphics: No ^E to terminate file!");
-}
-
-/*
-=====================
-=
-= ShowArticle
-=
-=====================
-*/
-
-void ShowArticle (char far *article)
-{
-	u16int	oldfontnumber;
-	u16int	temp;
-	int 	newpage,firstpage;
-
-	text = article;
-	oldfontnumber = fontnumber;
-	fontnumber = 0;
-	VWB_Bar (0,0,320,200,BACKCOLOR);
-	CacheLayoutGraphics ();
-
-	newpage = true;
-	firstpage = true;
-
-	do
-	{
-		if (newpage)
-		{
-			newpage = false;
-			PageLayout (true);
-			VW_UpdateScreen ();
-			if (firstpage)
-			{
-				VL_FadeIn(0,255,&gamepal,10);
-				// VW_FadeIn ()
-				firstpage = false;
-			}
-		}
-
-		LastScan = 0;
-		while (!LastScan)
-		;
-
-		switch (LastScan)
-		{
-		case sc_UpArrow:
-		case sc_PgUp:
-		case sc_LeftArrow:
-			if (pagenum>1)
-			{
-				BackPage ();
-				BackPage ();
-				newpage = true;
-			}
-			break;
-
-		case sc_Enter:
-		case sc_DownArrow:
-		case sc_PgDn:
-		case sc_RightArrow:		// the text allready points at next page
-			if (pagenum<numpages)
-			{
-				newpage = true;
-			}
-			break;
-		}
-	} while (LastScan != sc_Escape);
-
-	IN_ClearKeysDown ();
-	fontnumber = oldfontnumber;
-}
-
-/*
-=================
-=
-= HelpScreens
-=
-=================
-*/
-#ifndef SPEAR
-void HelpScreens (void)
-{
-	uchar *layout;
-
-	CA_UpLevel ();
-
-	ShowArticle (Etitpal);
-
-	VW_FadeOut();
-
-	CA_DownLevel ();
-}
-#endif
-
-//
-// END ARTICLES
-//
-void EndText (void)
-{
-	uchar *layout;
-
-
-	ClearMemory ();
-	CA_UpLevel ();
-
-	ShowArticle (epis+gamestate.episode);
-
-	VW_FadeOut();
-	SETFONTCOLOR(0,15);
-	IN_ClearKeysDown();
-	if (MousePresent)
-		Mouse(MDelta);	// Clear accumulated mouse movement
-
-	CA_DownLevel ();
-}