Commit c3ef597e authored by Steven Fuller's avatar Steven Fuller

Made vi_glx build compile without wl_scale/wl_draw

parent fc4b151a
...@@ -4,12 +4,13 @@ CC = gcc ...@@ -4,12 +4,13 @@ CC = gcc
CFLAGS = -g CFLAGS = -g
#CFLAGS = -Os #CFLAGS = -Os
OBJS = objs.o misc.o id_ca.o id_sd.o id_vh.o id_us.o \ OBJS = objs.o misc.o id_ca.o id_sd.o id_vh.o id_us.o \
wl_scale.o wl_draw.o wl_act1.o wl_act2.o wl_agent.o wl_game.o \ wl_act1.o wl_act2.o wl_agent.o wl_game.o \
wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \ wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \
wl_debug.o wl_debug.o
SOBJS = $(OBJS) vi_svga.o ROBJS = wl_draw.o wl_scale.o
XOBJS = $(OBJS) vi_xlib.o SOBJS = $(OBJS) $(ROBJS) vi_svga.o
GOBJS = $(OBJS) vi_glx.o XOBJS = $(OBJS) $(ROBJS) vi_xlib.o
GOBJS = $(OBJS) vi_ogl.o vi_glx.o
LFLAGS = -lm LFLAGS = -lm
#LFLAGS = -lm -lvga ElectricFence-2.2.2/libefence.a -lpthread #LFLAGS = -lm -lvga ElectricFence-2.2.2/libefence.a -lpthread
......
...@@ -84,6 +84,7 @@ also, the higher bitrates are a hack since a palette lookup has to be done ...@@ -84,6 +84,7 @@ also, the higher bitrates are a hack since a palette lookup has to be done
for every byte when transferring to the pixmap, palette fades require a for every byte when transferring to the pixmap, palette fades require a
screen update screen update
* mitshm * mitshm
* make sure none of the code tries to handle gfx/sound data directly
Specific: Specific:
* memory/sound intro screen goes * memory/sound intro screen goes
......
...@@ -84,7 +84,8 @@ typedef enum { ...@@ -84,7 +84,8 @@ typedef enum {
LASTSOUND LASTSOUND
} soundnames; } soundnames;
#define YEAHSND NOWAYSND // TODO: YEAHSND not defined in here /* TODO: YEAHSND not defined in here */
#define YEAHSND NOWAYSND
// //
// Base offsets // Base offsets
......
...@@ -25,7 +25,7 @@ typedef enum { ...@@ -25,7 +25,7 @@ typedef enum {
H_LEFTWINDOWPIC, // 18 H_LEFTWINDOWPIC, // 18
H_RIGHTWINDOWPIC, // 19 H_RIGHTWINDOWPIC, // 19
H_BOTTOMINFOPIC, // 20 H_BOTTOMINFOPIC, // 20
H_SPEARINFO, /* TODO: this ruins the numbers :) */ // 21 H_SPEARINFO, // 21
// Lump Start // Lump Start
C_OPTIONSPIC, // 22 C_OPTIONSPIC, // 22
C_CURSOR1PIC, // 23 C_CURSOR1PIC, // 23
......
...@@ -1429,36 +1429,6 @@ void MM_SortMem (void) ...@@ -1429,36 +1429,6 @@ void MM_SortMem (void)
{ {
} }
/*
======================
=
= MM_UnusedMemory
=
= Returns the total free space without purging
=
======================
*/
long MM_UnusedMemory(void)
{
return 0;
}
/*
======================
=
= MM_TotalFree
=
= Returns the total free space with purging
=
======================
*/
long MM_TotalFree (void)
{
return 0;
}
boolean PMStarted; boolean PMStarted;
char PageFileName[13] = {"vswap."}; char PageFileName[13] = {"vswap."};
int PageFile = -1; int PageFile = -1;
......
...@@ -95,9 +95,6 @@ void MM_SetPurge (memptr *baseptr, int purge); ...@@ -95,9 +95,6 @@ void MM_SetPurge (memptr *baseptr, int purge);
void MM_SetLock (memptr *baseptr, boolean locked); void MM_SetLock (memptr *baseptr, boolean locked);
void MM_SortMem (void); void MM_SortMem (void);
long MM_UnusedMemory (void);
long MM_TotalFree (void);
#define PMPageSize 4096 #define PMPageSize 4096
typedef enum typedef enum
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
#include <glob.h> #include <glob.h>
#include <math.h> #include <math.h>
#include <vga.h>
#include <vgakeyboard.h>
#include "misc.h" #include "misc.h"
#include "version.h" #include "version.h"
......
...@@ -165,6 +165,8 @@ void VW_UpdateScreen() ...@@ -165,6 +165,8 @@ void VW_UpdateScreen()
======================= =======================
*/ */
void Init3D();
void VL_Startup() void VL_Startup()
{ {
if (gfxbuf == NULL) if (gfxbuf == NULL)
...@@ -181,7 +183,8 @@ void VL_Startup() ...@@ -181,7 +183,8 @@ void VL_Startup()
glLoadIdentity(); glLoadIdentity();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
Init3D();
} }
/* /*
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#include "id_heads.h" #include "id_heads.h"
#include <vga.h>
#include <vgakeyboard.h>
byte *gfxbuf = NULL; byte *gfxbuf = NULL;
void VL_WaitVBL(int vbls) void VL_WaitVBL(int vbls)
......
...@@ -205,8 +205,8 @@ void PlaceItemType (int itemtype, int tilex, int tiley) ...@@ -205,8 +205,8 @@ void PlaceItemType (int itemtype, int tilex, int tiley)
// //
for (type=0 ; ; type++) for (type=0 ; ; type++)
{ {
if (statinfo[type].picnum == -1) // end of list if (statinfo[type].picnum == -1) /* end of list */
Quit ("PlaceItemType: couldn't find type!"); Quit("PlaceItemType: couldn't find type!");
if (statinfo[type].type == itemtype) if (statinfo[type].type == itemtype)
break; break;
} }
...@@ -219,12 +219,12 @@ void PlaceItemType (int itemtype, int tilex, int tiley) ...@@ -219,12 +219,12 @@ void PlaceItemType (int itemtype, int tilex, int tiley)
if (spot==laststatobj) if (spot==laststatobj)
{ {
if (spot == &statobjlist[MAXSTATS]) if (spot == &statobjlist[MAXSTATS])
return; // no free spots return; /* no free spots */
laststatobj++; // space at end laststatobj++; /* space at end */
break; break;
} }
if (spot->shapenum == -1) // -1 is a free spot if (spot->shapenum == -1) /* -1 is a free spot */
break; break;
} }
// //
......
...@@ -893,11 +893,10 @@ void VictoryTile (void) ...@@ -893,11 +893,10 @@ void VictoryTile (void)
=================== ===================
*/ */
void Thrust (int angle, long speed) void Thrust(int angle, long speed)
{ {
long xmove,ymove; long xmove,ymove;
long slowmax; unsigned offset;
unsigned offset;
// //
...@@ -927,7 +926,7 @@ void Thrust (int angle, long speed) ...@@ -927,7 +926,7 @@ void Thrust (int angle, long speed)
player->areanumber = *(mapsegs[0] + offset) -AREATILE; player->areanumber = *(mapsegs[0] + offset) -AREATILE;
if (*(mapsegs[1] + offset) == EXITTILE) if (*(mapsegs[1] + offset) == EXITTILE)
VictoryTile (); VictoryTile();
} }
......
...@@ -41,35 +41,6 @@ void ViewMap (void); ...@@ -41,35 +41,6 @@ void ViewMap (void);
//=========================================================================== //===========================================================================
/*
==================
=
= DebugMemory
=
==================
*/
void DebugMemory (void)
{
int i;
char scratch[80],str[10];
long mem;
CenterWindow (16,7);
US_CPrint ("Memory Usage");
US_CPrint ("------------");
US_Print ("k\nFree :");
US_PrintUnsigned (MM_UnusedMemory()/1024);
US_Print ("k\nWith purge:");
US_PrintUnsigned (MM_TotalFree()/1024);
US_Print ("k\n");
VW_UpdateScreen();
IN_Ack ();
}
//===========================================================================
/* /*
================== ==================
= =
...@@ -174,6 +145,7 @@ void PicturePause (void) ...@@ -174,6 +145,7 @@ void PicturePause (void)
void ShapeTest (void) void ShapeTest (void)
{ {
#if 0 /* TODO: this code want to access the raycasting renderer directly */
extern word NumDigi; extern word NumDigi;
extern word *DigiList; extern word *DigiList;
static char buf[10]; static char buf[10];
...@@ -190,7 +162,6 @@ static char buf[10]; ...@@ -190,7 +162,6 @@ static char buf[10];
for (i = 0,done = false;!done;) for (i = 0,done = false;!done;)
{ {
US_ClearWindow(); US_ClearWindow();
// sound = -1;
page = &PMPages[i]; page = &PMPages[i];
US_Print(" Page #"); US_Print(" Page #");
...@@ -268,7 +239,6 @@ static char buf[10]; ...@@ -268,7 +239,6 @@ static char buf[10];
} }
if (j < NumDigi) if (j < NumDigi)
{ {
// sound = j;
US_Print("\n Sound #"); US_Print("\n Sound #");
US_PrintUnsigned(j); US_PrintUnsigned(j);
US_Print("\n Segment #"); US_Print("\n Segment #");
...@@ -294,8 +264,10 @@ static char buf[10]; ...@@ -294,8 +264,10 @@ static char buf[10];
VW_UpdateScreen(); VW_UpdateScreen();
while (!(scan = LastScan)) while (!(scan = LastScan)) {
SD_Poll(); SD_Poll();
IN_CheckAck();
}
IN_ClearKey(scan); IN_ClearKey(scan);
switch (scan) switch (scan)
...@@ -337,6 +309,7 @@ static char buf[10]; ...@@ -337,6 +309,7 @@ static char buf[10];
} }
} }
SD_StopDigitized(); SD_StopDigitized();
#endif
} }
//=========================================================================== //===========================================================================
...@@ -414,11 +387,6 @@ int DebugKeys() ...@@ -414,11 +387,6 @@ int DebugKeys()
IN_Ack (); IN_Ack ();
return 1; return 1;
} }
else if (Keyboard[sc_M]) // M = memory info
{
DebugMemory();
return 1;
}
else if (Keyboard[sc_N]) // N = no clip else if (Keyboard[sc_N]) // N = no clip
{ {
noclip^=1; noclip^=1;
...@@ -444,7 +412,7 @@ int DebugKeys() ...@@ -444,7 +412,7 @@ int DebugKeys()
return 1; return 1;
} }
else if (Keyboard[sc_Q]) // Q = fast quit else if (Keyboard[sc_Q]) // Q = fast quit
Quit (NULL); Quit(NULL);
else if (Keyboard[sc_S]) // S = slow motion else if (Keyboard[sc_S]) // S = slow motion
{ {
singlestep^=1; singlestep^=1;
......
...@@ -414,7 +414,7 @@ enum { ...@@ -414,7 +414,7 @@ enum {
SPR_MACHINEGUNATK4, SPR_MACHINEGUNATK4,
SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3, SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3,
SPR_CHAINATK4 SPR_CHAINATK4, SPR_NULLSPRITE
}; };
...@@ -724,11 +724,6 @@ extern int pixelangle[MAXVIEWWIDTH]; ...@@ -724,11 +724,6 @@ extern int pixelangle[MAXVIEWWIDTH];
extern long finetangent[FINEANGLES/4]; extern long finetangent[FINEANGLES/4];
extern fixed sintable[], *costable; extern fixed sintable[], *costable;
//
// derived constants
//
extern fixed maxslope;
extern char configname[13]; extern char configname[13];
void HelpScreens (void); void HelpScreens (void);
...@@ -921,7 +916,6 @@ extern unsigned pwallpos; ...@@ -921,7 +916,6 @@ extern unsigned pwallpos;
fixed FixedByFrac (fixed a, fixed b); fixed FixedByFrac (fixed a, fixed b);
void TransformActor (objtype *ob); void TransformActor (objtype *ob);
void BuildTables (void); void BuildTables (void);
void ClearScreen (void);
int CalcRotate (objtype *ob); int CalcRotate (objtype *ob);
void DrawScaleds (void); void DrawScaleds (void);
void CalcTics (void); void CalcTics (void);
......
...@@ -9,34 +9,18 @@ ...@@ -9,34 +9,18 @@
#define ACTORSIZE 0x4000 #define ACTORSIZE 0x4000
long lasttimecount;
long frameon;
unsigned wallheight[MAXVIEWWIDTH]; unsigned wallheight[MAXVIEWWIDTH];
#define mindist MINDIST #define mindist MINDIST
// //int pixelangle[MAXVIEWWIDTH]; /* TODO: i put these in wl_main */
// math tables //long finetangent[FINEANGLES/4];
//
int pixelangle[MAXVIEWWIDTH];
long finetangent[FINEANGLES/4];
fixed sintable[ANGLES+ANGLES/4+1],*costable = sintable+(ANGLES/4);
// //
// refresh variables // refresh variables
// //
fixed viewx,viewy; // the focal point fixed viewx,viewy; // the focal point
int viewangle; int viewangle;
fixed viewsin,viewcos;
void TransformActor (objtype *ob);
void BuildTables (void);
void ClearScreen (void);
int CalcRotate (objtype *ob);
void DrawScaleds (void);
void CalcTics (void);
void ThreeDRefresh (void);
// //
// ray tracing variables // ray tracing variables
...@@ -55,33 +39,10 @@ int xtilestep,ytilestep; ...@@ -55,33 +39,10 @@ int xtilestep,ytilestep;
long xintercept,yintercept; long xintercept,yintercept;
long xstep,ystep; long xstep,ystep;
int horizwall[MAXWALLTILES],vertwall[MAXWALLTILES];
extern unsigned xoffset, yoffset; extern unsigned xoffset, yoffset;
void AsmRefresh (void); void AsmRefresh (void);
/*
========================
=
= FixedByFrac
=
= multiply a 16/16 bit, 2's complement fixed point number by a 16 bit
= fraction, passed as a signed magnitude 32 bit number
=
========================
*/
fixed FixedByFrac (fixed a, fixed b)
{
long long ra = a;
long long rb = b;
long long r;
r = ra * rb;
r >>= 16;
return (fixed)r;
}
//========================================================================== //==========================================================================
/* /*
...@@ -103,7 +64,6 @@ fixed FixedByFrac (fixed a, fixed b) ...@@ -103,7 +64,6 @@ fixed FixedByFrac (fixed a, fixed b)
======================== ========================
*/ */
// //
// transform actor // transform actor
// //
...@@ -366,7 +326,7 @@ void HitVertDoor (void) ...@@ -366,7 +326,7 @@ void HitVertDoor (void)
//========================================================================== //==========================================================================
unsigned vgaCeiling[]= unsigned Ceiling[]=
{ {
#ifndef SPEAR #ifndef SPEAR
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xbfbf, 0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xbfbf,
...@@ -385,14 +345,14 @@ unsigned vgaCeiling[]= ...@@ -385,14 +345,14 @@ unsigned vgaCeiling[]=
/* /*
===================== =====================
= =
= VGAClearScreen = ClearScreen
= =
===================== =====================
*/ */
void VGAClearScreen (void) void ClearScreen()
{ {
unsigned ceiling = vgaCeiling[gamestate.episode*10+mapon] & 0xFF; unsigned ceiling = Ceiling[gamestate.episode*10+mapon] & 0xFF;
unsigned floor = 0x19; unsigned floor = 0x19;
VL_Bar(xoffset, yoffset, viewwidth, viewheight / 2, ceiling); VL_Bar(xoffset, yoffset, viewwidth, viewheight / 2, ceiling);
...@@ -409,7 +369,7 @@ void VGAClearScreen (void) ...@@ -409,7 +369,7 @@ void VGAClearScreen (void)
===================== =====================
*/ */
int CalcRotate (objtype *ob) int CalcRotate(objtype *ob)
{ {
int angle,viewangle; int angle,viewangle;
...@@ -499,7 +459,7 @@ void DrawScaleds (void) ...@@ -499,7 +459,7 @@ void DrawScaleds (void)
for (obj = player->next;obj;obj=obj->next) for (obj = player->next;obj;obj=obj->next)
{ {
if (!(visptr->shapenum = obj->state->shapenum)) if (!(visptr->shapenum = obj->state->shapenum))
continue; // no shape continue; // no shape
spotloc = (obj->tilex<<6)+obj->tiley; // optimize: keep in struct? spotloc = (obj->tilex<<6)+obj->tiley; // optimize: keep in struct?
visspot = &spotvis[0][0]+spotloc; visspot = &spotvis[0][0]+spotloc;
...@@ -610,43 +570,6 @@ void DrawPlayerWeapon (void) ...@@ -610,43 +570,6 @@ void DrawPlayerWeapon (void)
//========================================================================== //==========================================================================
/*
=====================
=
= CalcTics
=
=====================
*/
void CalcTics (void)
{
long newtime;
//
// calculate tics since last refresh for adaptive timing
//
if (lasttimecount > get_TimeCount())
set_TimeCount(lasttimecount); // if the game was paused a LONG time
do
{
newtime = get_TimeCount();
tics = newtime-lasttimecount;
} while (!tics); // make sure at least one tic passes
lasttimecount = newtime;
if (tics>MAXTICS)
{
set_TimeCount(get_TimeCount() - (tics-MAXTICS));
tics = MAXTICS;
}
}
//==========================================================================
/* /*
==================== ====================
= =
...@@ -688,7 +611,7 @@ void WallRefresh (void) ...@@ -688,7 +611,7 @@ void WallRefresh (void)
======================== ========================
*/ */
void ThreeDRefresh (void) void ThreeDRefresh()
{ {
// //
...@@ -700,7 +623,7 @@ void ThreeDRefresh (void) ...@@ -700,7 +623,7 @@ void ThreeDRefresh (void)
// follow the walls from there to the right, drawwing as we go // follow the walls from there to the right, drawwing as we go
// //
DrawPlayBorder(); DrawPlayBorder();
VGAClearScreen (); ClearScreen();
WallRefresh (); WallRefresh ();
...@@ -708,7 +631,7 @@ void ThreeDRefresh (void) ...@@ -708,7 +631,7 @@ void ThreeDRefresh (void)
// draw all the scaled images // draw all the scaled images
// //
DrawScaleds(); // draw scaled stuff DrawScaleds(); // draw scaled stuff
DrawPlayerWeapon (); /* draw player's hands */ DrawPlayerWeapon(); /* draw player's hands */
// //
// show screen and time last cycle // show screen and time last cycle
......
...@@ -46,7 +46,7 @@ int viewwidth; ...@@ -46,7 +46,7 @@ int viewwidth;
int viewheight; int viewheight;
int centerx; int centerx;
int shootdelta; // pixels away from centerx a target can be int shootdelta; // pixels away from centerx a target can be
fixed scale,maxslope; fixed scale;
long heightnumerator; long heightnumerator;
void Quit(char *error); void Quit(char *error);
...@@ -54,7 +54,18 @@ void Quit(char *error); ...@@ -54,7 +54,18 @@ void Quit(char *error);
boolean startgame,loadedgame; boolean startgame,loadedgame;
int mouseadjustment; int mouseadjustment;
char configname[13]="config."; /* These are refuges from wl_draw.c */
long frameon;
long lasttimecount;
fixed viewsin, viewcos;
fixed viewx, viewy; // the focal point
int pixelangle[MAXVIEWWIDTH];
long finetangent[FINEANGLES/4];
int horizwall[MAXWALLTILES], vertwall[MAXWALLTILES];
char configname[13] = "config.";
fixed sintable[ANGLES+ANGLES/4+1], *costable = sintable+(ANGLES/4);
unsigned xoffset, yoffset; unsigned xoffset, yoffset;
...@@ -62,13 +73,55 @@ int _argc; ...@@ -62,13 +73,55 @@ int _argc;
char **_argv; char **_argv;
/* /*
============================================================================= ========================
=
= FixedByFrac
=
= multiply a 16/16 bit, 2's complement fixed point number by a 16 bit
= fraction, passed as a signed magnitude 32 bit number
=
========================
*/
LOCAL VARIABLES fixed FixedByFrac(fixed a, fixed b)
{
long long ra = a;
long long rb = b;
long long r;
r = ra * rb;
r >>= 16;
return (fixed)r;
}
============================================================================= /*
=====================
=
= CalcTics
=
=====================
*/ */
void CalcTics()
{
long newtime;
/* calculate tics since last refresh for adaptive timing */
if (lasttimecount > get_TimeCount())
set_TimeCount(lasttimecount); /* if paused for a long time */
do {
newtime = get_TimeCount();
tics = newtime - lasttimecount;
} while (!tics); /* make sure at least one tic passes */
lasttimecount = newtime;
if (tics > MAXTICS) {
set_TimeCount(get_TimeCount() - (tics - MAXTICS));
tics = MAXTICS;
}
}
/* /*
==================== ====================
...@@ -592,13 +645,6 @@ void CalcProjection (long focal) ...@@ -592,13 +645,6 @@ void CalcProjection (long focal)
pixelangle[halfview-1-i] = intang; pixelangle[halfview-1-i] = intang;
pixelangle[halfview+i] = -intang; pixelangle[halfview+i] = -intang;
} }
//
// if a point's abs(y/x) is greater than maxslope, the point is outside
// the view area
//
maxslope = finetangent[pixelangle[0]];
maxslope >>= 8;
} }
...@@ -1019,15 +1065,15 @@ void InitGame(void) ...@@ -1019,15 +1065,15 @@ void InitGame(void)
{ {
int i; int i;
MM_Startup (); MM_Startup();
VW_Startup (); PM_Startup();
IN_Startup (); CA_Startup();
PM_Startup (); VW_Startup();
SD_Startup (); IN_Startup();
CA_Startup (); SD_Startup();
US_Startup (); US_Startup();
SignonScreen (); SignonScreen();
// //
// build some tables // build some tables
...@@ -1086,7 +1132,7 @@ void InitGame(void) ...@@ -1086,7 +1132,7 @@ void InitGame(void)
========================== ==========================
*/ */
boolean SetViewSize (unsigned width, unsigned height) boolean SetViewSize(unsigned width, unsigned height)
{ {
viewwidth = width&~15; // must be divisable by 16 viewwidth = width&~15; // must be divisable by 16
viewheight = height&~1; // must be even viewheight = height&~1; // must be even
...@@ -1104,7 +1150,7 @@ boolean SetViewSize (unsigned width, unsigned height) ...@@ -1104,7 +1150,7 @@ boolean SetViewSize (unsigned width, unsigned height)
// //
// build all needed compiled scalers // build all needed compiled scalers
// //
SetupScaling (viewwidth*1.5); SetupScaling(viewwidth*1.5);
return true; return true;
} }
......
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