Commit 3be1f771 authored by Steven Fuller's avatar Steven Fuller

More code reformatting.

Made some functions/variables static.
parent 46f35dd2
...@@ -1379,19 +1379,19 @@ void MM_SetLock (memptr *baseptr, boolean locked) ...@@ -1379,19 +1379,19 @@ void MM_SetLock (memptr *baseptr, boolean locked)
===================== =====================
*/ */
void MM_SortMem (void) void MM_SortMem()
{ {
} }
boolean PMStarted; boolean PMStarted;
char PageFileName[13] = {"vswap."}; char PageFileName[13] = {"vswap."};
int PageFile = -1; int PageFile = -1;
word ChunksInFile; word ChunksInFile;
word PMSpriteStart,PMSoundStart; word PMSpriteStart,PMSoundStart;
word PMNumBlocks; word PMNumBlocks;
long PMFrameCount; long PMFrameCount;
PageListStruct *PMPages, *PMSegPages; PageListStruct *PMPages, *PMSegPages;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
...@@ -1402,13 +1402,13 @@ void MM_SortMem (void) ...@@ -1402,13 +1402,13 @@ void MM_SortMem (void)
// //
// PML_ReadFromFile() - Reads some data in from the page file // PML_ReadFromFile() - Reads some data in from the page file
// //
void PML_ReadFromFile(byte *buf, long offset, word length) static void PML_ReadFromFile(byte *buf, long offset, word length)
{ {
if (!buf) if (!buf)
Quit("PML_ReadFromFile: Null pointer"); Quit("PML_ReadFromFile: Null pointer");
if (!offset) if (!offset)
Quit("PML_ReadFromFile: Zero offset"); Quit("PML_ReadFromFile: Zero offset");
if (lseek(PageFile,offset,SEEK_SET) != offset) if (lseek(PageFile, offset, SEEK_SET) != offset)
Quit("PML_ReadFromFile: Seek failed"); Quit("PML_ReadFromFile: Seek failed");
if (!CA_FarRead(PageFile,buf,length)) if (!CA_FarRead(PageFile,buf,length))
Quit("PML_ReadFromFile: Read failed"); Quit("PML_ReadFromFile: Read failed");
...@@ -1417,7 +1417,7 @@ void PML_ReadFromFile(byte *buf, long offset, word length) ...@@ -1417,7 +1417,7 @@ void PML_ReadFromFile(byte *buf, long offset, word length)
// //
// PML_OpenPageFile() - Opens the page file and sets up the page info // PML_OpenPageFile() - Opens the page file and sets up the page info
// //
void PML_OpenPageFile(void) static void PML_OpenPageFile()
{ {
int i; int i;
long size; long size;
...@@ -1465,7 +1465,7 @@ void PML_OpenPageFile(void) ...@@ -1465,7 +1465,7 @@ void PML_OpenPageFile(void)
// //
// PML_ClosePageFile() - Closes the page file // PML_ClosePageFile() - Closes the page file
// //
void PML_ClosePageFile(void) static void PML_ClosePageFile()
{ {
if (PageFile != -1) if (PageFile != -1)
close(PageFile); close(PageFile);
...@@ -1534,7 +1534,7 @@ void PM_Preload(boolean (*update)(word current,word total)) ...@@ -1534,7 +1534,7 @@ void PM_Preload(boolean (*update)(word current,word total))
// //
// PM_NextFrame() - Increments the frame counter // PM_NextFrame() - Increments the frame counter
// //
void PM_NextFrame(void) void PM_NextFrame()
{ {
int i; int i;
...@@ -1566,7 +1566,7 @@ void PM_Reset() ...@@ -1566,7 +1566,7 @@ void PM_Reset()
// //
// PM_Startup() - Start up the Page Mgr // PM_Startup() - Start up the Page Mgr
// //
void PM_Startup(void) void PM_Startup()
{ {
if (PMStarted) if (PMStarted)
return; return;
...@@ -1581,7 +1581,7 @@ void PM_Startup(void) ...@@ -1581,7 +1581,7 @@ void PM_Startup(void)
// //
// PM_Shutdown() - Shut down the Page Mgr // PM_Shutdown() - Shut down the Page Mgr
// //
void PM_Shutdown(void) void PM_Shutdown()
{ {
if (!PMStarted) if (!PMStarted)
return; return;
......
...@@ -94,7 +94,7 @@ void PicturePause (void) ...@@ -94,7 +94,7 @@ void PicturePause (void)
================ ================
*/ */
void ShapeTest (void) void ShapeTest()
{ {
#if 0 /* TODO: this code want to access the raycasting renderer directly */ #if 0 /* TODO: this code want to access the raycasting renderer directly */
extern word NumDigi; extern word NumDigi;
......
...@@ -898,10 +898,7 @@ extern unsigned pwallpos; ...@@ -898,10 +898,7 @@ extern unsigned pwallpos;
fixed FixedByFrac (fixed a, fixed b); fixed FixedByFrac (fixed a, fixed b);
void TransformActor (objtype *ob);
void BuildTables (void); void BuildTables (void);
int CalcRotate (objtype *ob);
void DrawScaleds (void);
void CalcTics (void); void CalcTics (void);
void ThreeDRefresh (void); void ThreeDRefresh (void);
......
...@@ -19,27 +19,28 @@ unsigned wallheight[MAXVIEWWIDTH]; ...@@ -19,27 +19,28 @@ unsigned wallheight[MAXVIEWWIDTH];
// //
// refresh variables // refresh variables
// //
fixed viewx,viewy; // the focal point static fixed viewx,viewy; // the focal point
int viewangle; static int viewangle;
// //
// ray tracing variables // ray casting variables
// //
int focaltx,focalty; static int focaltx, focalty;
int midangle,angle; static int midangle;
unsigned xpartial,ypartial; static unsigned xpartial, ypartial;
unsigned xpartialup,xpartialdown,ypartialup,ypartialdown; static unsigned xpartialup, xpartialdown, ypartialup, ypartialdown;
unsigned tilehit; static unsigned tilehit;
unsigned pixx;
int xtile,ytile; static int xtile, ytile;
int xtilestep,ytilestep; static int xtilestep, ytilestep;
long xintercept,yintercept; static long xintercept, yintercept;
long xstep,ystep; static long xstep, ystep;
void AsmRefresh (void); static unsigned postx;
static void AsmRefresh();
void xBuildCompScale(int height, byte *source, int x); void xBuildCompScale(int height, byte *source, int x);
#ifndef NOASM #ifndef NOASM
...@@ -77,7 +78,7 @@ void xBuildCompScale(int height, byte *source, int x); ...@@ -77,7 +78,7 @@ void xBuildCompScale(int height, byte *source, int x);
// //
// transform actor // transform actor
// //
void TransformActor (objtype *ob) static void TransformActor(objtype *ob)
{ {
fixed gx,gy,gxt,gyt,nx,ny; fixed gx,gy,gxt,gyt,nx,ny;
...@@ -90,8 +91,8 @@ void TransformActor (objtype *ob) ...@@ -90,8 +91,8 @@ void TransformActor (objtype *ob)
// //
// calculate newx // calculate newx
// //
gxt = FixedByFrac(gx,viewcos); gxt = FixedByFrac(gx, viewcos);
gyt = FixedByFrac(gy,viewsin); gyt = FixedByFrac(gy, viewsin);
nx = gxt-gyt-ACTORSIZE; // fudge the shape forward a bit, because nx = gxt-gyt-ACTORSIZE; // fudge the shape forward a bit, because
// the midpoint could put parts of the shape // the midpoint could put parts of the shape
// into an adjacent wall // into an adjacent wall
...@@ -144,7 +145,7 @@ void TransformActor (objtype *ob) ...@@ -144,7 +145,7 @@ void TransformActor (objtype *ob)
======================== ========================
*/ */
boolean TransformTile (int tx, int ty, int *dispx, int *dispheight) static boolean TransformTile(int tx, int ty, int *dispx, int *dispheight)
{ {
fixed gx,gy,gxt,gyt,nx,ny; fixed gx,gy,gxt,gyt,nx,ny;
...@@ -203,8 +204,7 @@ boolean TransformTile (int tx, int ty, int *dispx, int *dispheight) ...@@ -203,8 +204,7 @@ boolean TransformTile (int tx, int ty, int *dispx, int *dispheight)
==================== ====================
*/ */
static int CalcHeight()
int CalcHeight()
{ {
fixed gxt,gyt,nx,gx,gy; fixed gxt,gyt,nx,gx,gy;
...@@ -236,17 +236,15 @@ int CalcHeight() ...@@ -236,17 +236,15 @@ int CalcHeight()
=================== ===================
*/ */
unsigned postx; static void ScalePost(byte *wall, int texture)
void ScalePost(byte *wall, int texture)
{ {
int height; int height;
byte *source; byte *source;
height = (wallheight [postx] & 0xfff8) >> 1; height = (wallheight[postx] & 0xfff8) >> 1;
source = wall+texture; source = wall+texture;
xBuildCompScale (height/2, source, postx); xBuildCompScale(height/2, source, postx);
} }
/* /*
...@@ -257,20 +255,17 @@ void ScalePost(byte *wall, int texture) ...@@ -257,20 +255,17 @@ void ScalePost(byte *wall, int texture)
==================== ====================
*/ */
void HitHorizDoor() static void HitHorizDoor()
{ {
unsigned texture, doorpage = 0, doornum; unsigned texture, doorpage = 0, doornum;
byte *wall; byte *wall;
doornum = tilehit&0x7f; doornum = tilehit&0x7f;
texture = ( (xintercept-doorposition[doornum]) >> 4) &0xfc0; texture = ((xintercept-doorposition[doornum]) >> 4) & 0xfc0;
wallheight[pixx] = CalcHeight();
postx = pixx; wallheight[postx] = CalcHeight();
switch (doorobjlist[doornum].lock) switch(doorobjlist[doornum].lock) {
{
case dr_normal: case dr_normal:
doorpage = DOORWALL; doorpage = DOORWALL;
break; break;
...@@ -283,10 +278,10 @@ void HitHorizDoor() ...@@ -283,10 +278,10 @@ void HitHorizDoor()
case dr_elevator: case dr_elevator:
doorpage = DOORWALL+4; doorpage = DOORWALL+4;
break; break;
} }
wall = PM_GetPage (doorpage); wall = PM_GetPage(doorpage);
ScalePost (wall, texture); ScalePost(wall, texture);
} }
//========================================================================== //==========================================================================
...@@ -299,19 +294,17 @@ void HitHorizDoor() ...@@ -299,19 +294,17 @@ void HitHorizDoor()
==================== ====================
*/ */
void HitVertDoor() static void HitVertDoor()
{ {
unsigned texture, doorpage = 0, doornum; unsigned texture, doorpage = 0, doornum;
byte *wall; byte *wall;
doornum = tilehit&0x7f; doornum = tilehit&0x7f;
texture = ( (yintercept-doorposition[doornum]) >> 4) &0xfc0; texture = ((yintercept-doorposition[doornum]) >> 4) & 0xfc0;
wallheight[pixx] = CalcHeight(); wallheight[postx] = CalcHeight();
postx = pixx; switch(doorobjlist[doornum].lock) {
switch (doorobjlist[doornum].lock) {
case dr_normal: case dr_normal:
doorpage = DOORWALL; doorpage = DOORWALL;
break; break;
...@@ -332,7 +325,7 @@ void HitVertDoor() ...@@ -332,7 +325,7 @@ void HitVertDoor()
/* ======================================================================== */ /* ======================================================================== */
unsigned int Ceiling[]= static unsigned int 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,
...@@ -356,7 +349,7 @@ unsigned int Ceiling[]= ...@@ -356,7 +349,7 @@ unsigned int Ceiling[]=
===================== =====================
*/ */
void ClearScreen() static void ClearScreen()
{ {
unsigned int ceiling = Ceiling[gamestate.episode*10+mapon] & 0xFF; unsigned int ceiling = Ceiling[gamestate.episode*10+mapon] & 0xFF;
unsigned int floor = 0x19; unsigned int floor = 0x19;
...@@ -375,7 +368,7 @@ void ClearScreen() ...@@ -375,7 +368,7 @@ void ClearScreen()
===================== =====================
*/ */
int CalcRotate(objtype *ob) static int CalcRotate(objtype *ob)
{ {
int angle,viewangle; int angle,viewangle;
...@@ -414,16 +407,15 @@ int CalcRotate(objtype *ob) ...@@ -414,16 +407,15 @@ int CalcRotate(objtype *ob)
#define MAXVISABLE 50 #define MAXVISABLE 50
typedef struct typedef struct {
{ int viewx;
int viewx, int viewheight;
viewheight, int shapenum;
shapenum;
} visobj_t; } visobj_t;
visobj_t vislist[MAXVISABLE],*visptr,*visstep,*farthest; static visobj_t vislist[MAXVISABLE], *visptr, *visstep, *farthest;
void DrawScaleds() static void DrawScaleds()
{ {
int i,least,numvisable,height; int i,least,numvisable,height;
byte *tilespot,*visspot; byte *tilespot,*visspot;
...@@ -445,7 +437,7 @@ void DrawScaleds() ...@@ -445,7 +437,7 @@ void DrawScaleds()
if (!*statptr->visspot) if (!*statptr->visspot)
continue; // not visable continue; // not visable
if (TransformTile (statptr->tilex,statptr->tiley if (TransformTile(statptr->tilex, statptr->tiley
,&visptr->viewx,&visptr->viewheight) && statptr->flags & FL_BONUS) ,&visptr->viewx,&visptr->viewheight) && statptr->flags & FL_BONUS)
{ {
GetBonus (statptr); GetBonus (statptr);
...@@ -462,30 +454,30 @@ void DrawScaleds() ...@@ -462,30 +454,30 @@ void DrawScaleds()
// //
// place active objects // place active objects
// //
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;
visspot = &spotvis[0][0]+spotloc; visspot = &spotvis[0][0] + spotloc;
tilespot = &tilemap[0][0]+spotloc; tilespot = &tilemap[0][0] + spotloc;
// //
// could be in any of the nine surrounding tiles // could be in any of the nine surrounding tiles
// //
if (*visspot if (*visspot
|| ( *(visspot-1) && !*(tilespot-1) ) || (*(visspot-1) && !*(tilespot-1))
|| ( *(visspot+1) && !*(tilespot+1) ) || (*(visspot+1) && !*(tilespot+1))
|| ( *(visspot-65) && !*(tilespot-65) ) || (*(visspot-65) && !*(tilespot-65))
|| ( *(visspot-64) && !*(tilespot-64) ) || (*(visspot-64) && !*(tilespot-64))
|| ( *(visspot-63) && !*(tilespot-63) ) || (*(visspot-63) && !*(tilespot-63))
|| ( *(visspot+65) && !*(tilespot+65) ) || (*(visspot+65) && !*(tilespot+65))
|| ( *(visspot+64) && !*(tilespot+64) ) || (*(visspot+64) && !*(tilespot+64))
|| ( *(visspot+63) && !*(tilespot+63) ) ) || (*(visspot+63) && !*(tilespot+63)))
{ {
obj->active = true; obj->active = true;
TransformActor (obj); TransformActor(obj);
if (!obj->viewheight) if (!obj->viewheight)
continue; // too close or far away continue; // too close or far away
...@@ -500,8 +492,7 @@ void DrawScaleds() ...@@ -500,8 +492,7 @@ void DrawScaleds()
if (visptr < &vislist[MAXVISABLE-1]) /* don't let it overflow */ if (visptr < &vislist[MAXVISABLE-1]) /* don't let it overflow */
visptr++; visptr++;
obj->flags |= FL_VISABLE; obj->flags |= FL_VISABLE;
} } else
else
obj->flags &= ~FL_VISABLE; obj->flags &= ~FL_VISABLE;
} }
...@@ -547,10 +538,10 @@ void DrawScaleds() ...@@ -547,10 +538,10 @@ void DrawScaleds()
============== ==============
*/ */
int weaponscale[NUMWEAPONS] = {SPR_KNIFEREADY,SPR_PISTOLREADY static int weaponscale[NUMWEAPONS] = {SPR_KNIFEREADY,SPR_PISTOLREADY
,SPR_MACHINEGUNREADY,SPR_CHAINREADY}; ,SPR_MACHINEGUNREADY,SPR_CHAINREADY};
void DrawPlayerWeapon (void) static void DrawPlayerWeapon()
{ {
int shapenum; int shapenum;
...@@ -584,7 +575,7 @@ void DrawPlayerWeapon (void) ...@@ -584,7 +575,7 @@ void DrawPlayerWeapon (void)
==================== ====================
*/ */
void WallRefresh (void) static void WallRefresh()
{ {
/* /*
set up variables for this view set up variables for this view
...@@ -699,19 +690,19 @@ static int samey(int intercept, int tile) ...@@ -699,19 +690,19 @@ static int samey(int intercept, int tile)
#define DEG270 2700 #define DEG270 2700
#define DEG360 3600 #define DEG360 3600
void HitHorizWall (void); static void HitHorizWall();
void HitVertWall (void); static void HitVertWall();
void HitHorizPWall (void); static void HitHorizPWall();
void HitVertPWall (void); static void HitVertPWall();
void AsmRefresh (void) static void AsmRefresh()
{ {
fixed doorxhit, dooryhit; fixed doorxhit, dooryhit;
int angle; /* ray angle through pixx */ int angle; /* ray angle through postx */
for (pixx = 0; pixx < viewwidth; pixx++) { for (postx = 0; postx < viewwidth; postx++) {
angle = midangle + pixelangle[pixx]; angle = midangle + pixelangle[postx];
if (angle < 0) { if (angle < 0) {
/* -90 - -1 degree arc */ /* -90 - -1 degree arc */
...@@ -795,12 +786,12 @@ void AsmRefresh (void) ...@@ -795,12 +786,12 @@ void AsmRefresh (void)
goto passvert; goto passvert;
yintercept = dooryhit; yintercept = dooryhit;
xintercept = (xtile << 16) + 32768; xintercept = (xtile << 16) + 32768;
HitVertDoor (); HitVertDoor();
} }
} }
else { else {
xintercept = xtile << 16; xintercept = xtile << 16;
HitVertWall (); HitVertWall();
} }
goto nextpix; goto nextpix;
} }
...@@ -857,67 +848,60 @@ void AsmRefresh (void) ...@@ -857,67 +848,60 @@ void AsmRefresh (void)
} }
void HitVertWall (void) static void HitVertWall()
{ {
int wallpic; int wallpic;
unsigned texture; unsigned texture;
byte *wall; byte *wall;
texture = (yintercept>>4)&0xfc0; texture = (yintercept>>4)&0xfc0;
if (xtilestep == -1)
{ if (xtilestep == -1) {
texture = 0xfc0-texture; texture = 0xfc0-texture;
xintercept += TILEGLOBAL; xintercept += TILEGLOBAL;
} }
wallheight[pixx] = CalcHeight();
wallheight[postx] = CalcHeight();
postx = pixx;
if (tilehit & 0x40) if (tilehit & 0x40) { // check for adjacent doors
{ // check for adjacent doors ytile = yintercept>>TILESHIFT;
ytile = yintercept>>TILESHIFT; if (tilemap[xtile-xtilestep][ytile] & 0x80)
if ( tilemap[xtile-xtilestep][ytile]&0x80 ) wallpic = DOORWALL+3;
wallpic = DOORWALL+3;
else
wallpic = vertwall[tilehit & ~0x40];
}
else else
wallpic = vertwall[tilehit]; wallpic = vertwall[tilehit & ~0x40];
} else
wallpic = vertwall[tilehit];
wall = PM_GetPage (wallpic); wall = PM_GetPage(wallpic);
ScalePost (wall, texture); ScalePost(wall, texture);
} }
void HitHorizWall (void) static void HitHorizWall()
{ {
int wallpic; int wallpic;
unsigned texture; unsigned texture;
byte *wall; byte *wall;
texture = (xintercept>>4)&0xfc0; texture = (xintercept >> 4) & 0xfc0;
if (ytilestep == -1) if (ytilestep == -1)
yintercept += TILEGLOBAL; yintercept += TILEGLOBAL;
else else
texture = 0xfc0-texture; texture = 0xfc0 - texture;
wallheight[pixx] = CalcHeight();
wallheight[postx] = CalcHeight();
postx = pixx;
if (tilehit & 0x40) if (tilehit & 0x40) { // check for adjacent doors
{ // check for adjacent doors xtile = xintercept>>TILESHIFT;
xtile = xintercept>>TILESHIFT; if (tilemap[xtile][ytile-ytilestep] & 0x80)
if ( tilemap[xtile][ytile-ytilestep]&0x80 ) wallpic = DOORWALL+2;
wallpic = DOORWALL+2;
else
wallpic = horizwall[tilehit & ~0x40];
}
else else
wallpic = horizwall[tilehit]; wallpic = horizwall[tilehit & ~0x40];
} else
wall = PM_GetPage (wallpic); wallpic = horizwall[tilehit];
ScalePost (wall, texture);
wall = PM_GetPage(wallpic);
ScalePost(wall, texture);
} }
/* /*
...@@ -930,29 +914,28 @@ void HitHorizWall (void) ...@@ -930,29 +914,28 @@ void HitHorizWall (void)
==================== ====================
*/ */
void HitHorizPWall (void) static void HitHorizPWall()
{ {
int wallpic; int wallpic;
unsigned texture,offset; unsigned texture, offset;
byte *wall; byte *wall;
texture = (xintercept>>4)&0xfc0; texture = (xintercept >> 4) & 0xfc0;
offset = pwallpos<<10;
offset = pwallpos << 10;
if (ytilestep == -1) if (ytilestep == -1)
yintercept += TILEGLOBAL-offset; yintercept += TILEGLOBAL-offset;
else else {
{
texture = 0xfc0-texture; texture = 0xfc0-texture;
yintercept += offset; yintercept += offset;
} }
wallheight[pixx] = CalcHeight(); wallheight[postx] = CalcHeight();
postx = pixx;
wallpic = horizwall[tilehit&63]; wallpic = horizwall[tilehit&63];
wall = PM_GetPage (wallpic); wall = PM_GetPage(wallpic);
ScalePost (wall, texture); ScalePost(wall, texture);
} }
...@@ -966,27 +949,25 @@ void HitHorizPWall (void) ...@@ -966,27 +949,25 @@ void HitHorizPWall (void)
==================== ====================
*/ */
void HitVertPWall (void) static void HitVertPWall()
{ {
int wallpic; int wallpic;
unsigned texture,offset; unsigned texture, offset;
byte *wall; byte *wall;
texture = (yintercept>>4)&0xfc0; texture = (yintercept >> 4) & 0xfc0;
offset = pwallpos<<10; offset = pwallpos << 10;
if (xtilestep == -1)
{ if (xtilestep == -1) {
xintercept += TILEGLOBAL-offset; xintercept += TILEGLOBAL-offset;
texture = 0xfc0-texture; texture = 0xfc0-texture;
} } else
else
xintercept += offset; xintercept += offset;
wallheight[pixx] = CalcHeight(); wallheight[postx] = CalcHeight();
postx = pixx;
wallpic = vertwall[tilehit&63];
wallpic = vertwall[tilehit&63];
wall = PM_GetPage (wallpic); wall = PM_GetPage(wallpic);
ScalePost (wall, texture); ScalePost(wall, texture);
} }
...@@ -14,7 +14,7 @@ boolean madenoise; // true when shooting or screaming ...@@ -14,7 +14,7 @@ boolean madenoise; // true when shooting or screaming
exit_t playstate; exit_t playstate;
int DebugOk; int DebugOk;
objtype objlist[MAXACTORS],*new,*obj,*player,*lastobj, objtype objlist[MAXACTORS],*new,*obj,*player,*lastobj,
*objfreelist,*killerobj; *objfreelist,*killerobj;
...@@ -418,41 +418,47 @@ void PollJoystickMove (void) ...@@ -418,41 +418,47 @@ void PollJoystickMove (void)
=================== ===================
*/ */
void PollControls (void) void PollControls()
{ {
int max,min,i; int max, min, i;
byte buttonbits; byte buttonbits;
// //
// get timing info for last frame // get timing info for last frame
// //
if (demoplayback) if (demoplayback) {
{ #if 0
while ( get_TimeCount() < (lasttimecount+DEMOTICS) ) ; if (1 /* (TEMP) TODO: TimeDemo */) {
set_TimeCount(lasttimecount + DEMOTICS); set_TimeCount(lasttimecount + DEMOTICS);
lasttimecount += DEMOTICS; lasttimecount += DEMOTICS;
tics = DEMOTICS; tics = DEMOTICS;
} } else
else if (demorecord) // demo recording and playback needs #endif
{ // to be constant {
while ( get_TimeCount() < (lasttimecount+DEMOTICS) ) ;
set_TimeCount(lasttimecount + DEMOTICS);
lasttimecount += DEMOTICS;
tics = DEMOTICS;
}
} else if (demorecord) {
// demo recording and playback needs
// to be constant
// //
// take DEMOTICS or more tics, and modify Timecount to reflect time taken // take DEMOTICS or more tics, and modify Timecount to reflect time taken
// //
while ( get_TimeCount() < (lasttimecount+DEMOTICS) ) ; while (get_TimeCount() < (lasttimecount+DEMOTICS)) ;
set_TimeCount(lasttimecount + DEMOTICS); set_TimeCount(lasttimecount + DEMOTICS);
lasttimecount += DEMOTICS; lasttimecount += DEMOTICS;
tics = DEMOTICS; tics = DEMOTICS;
} } else
else
CalcTics (); CalcTics ();
controlx = 0; controlx = 0;
controly = 0; controly = 0;
memcpy (buttonheld,buttonstate,sizeof(buttonstate)); memcpy(buttonheld, buttonstate, sizeof(buttonstate));
memset (buttonstate,0,sizeof(buttonstate)); memset(buttonstate, 0, sizeof(buttonstate));
if (demoplayback) if (demoplayback) {
{
// //
// read commands from demo buffer // read commands from demo buffer
// //
...@@ -481,26 +487,26 @@ void PollControls (void) ...@@ -481,26 +487,26 @@ void PollControls (void)
// //
/* Update keys */ /* Update keys */
IN_CheckAck(); /* TODO: better name */ IN_CheckAck();
PollKeyboardButtons (); PollKeyboardButtons();
if (mouseenabled) if (mouseenabled)
PollMouseButtons (); PollMouseButtons();
if (joystickenabled) if (joystickenabled)
PollJoystickButtons (); PollJoystickButtons();
// //
// get movements // get movements
// //
PollKeyboardMove (); PollKeyboardMove();
if (mouseenabled) if (mouseenabled)
PollMouseMove (); PollMouseMove();
if (joystickenabled) if (joystickenabled)
PollJoystickMove (); PollJoystickMove();
// //
// bound movement to a maximum // bound movement to a maximum
......
...@@ -20,11 +20,10 @@ typedef struct { ...@@ -20,11 +20,10 @@ typedef struct {
short desty [65]; short desty [65];
} t_scaledata; } t_scaledata;
t_scaledata scaledata [MAXSCALEHEIGHT+1]; static t_scaledata scaledata[MAXSCALEHEIGHT+1];
static int maxscale;
int maxscale; static void BuildCompScale(int height)
void BuildCompScale(int height)
{ {
long fix,step; long fix,step;
unsigned src; unsigned src;
...@@ -79,7 +78,7 @@ void SetupScaling(int maxscaleheight) ...@@ -79,7 +78,7 @@ void SetupScaling(int maxscaleheight)
// //
for (i=1;i<=maxscaleheight;i++) for (i=1;i<=maxscaleheight;i++)
{ {
BuildCompScale (i); BuildCompScale(i);
} }
} }
...@@ -141,10 +140,10 @@ void xBuildCompScale(unsigned int height, byte *source, int x) ...@@ -141,10 +140,10 @@ void xBuildCompScale(unsigned int height, byte *source, int x)
======================= =======================
*/ */
int slinex, slinewidth; static int slinex, slinewidth;
short *linecmds; static short *linecmds;
int linescale; static int linescale;
t_compshape *shapeptr; static t_compshape *shapeptr;
/* /*
linecmds - points to line segment data linecmds - points to line segment data
...@@ -152,7 +151,7 @@ t_compshape *shapeptr; ...@@ -152,7 +151,7 @@ t_compshape *shapeptr;
slinex - screen coord of first column slinex - screen coord of first column
*/ */
void ScaleLine() static void ScaleLine()
{ {
int x, y, ys; int x, y, ys;
int n, ny; int n, ny;
...@@ -445,7 +444,7 @@ void SimpleScaleShape(int xcenter, int shapenum, unsigned height) ...@@ -445,7 +444,7 @@ void SimpleScaleShape(int xcenter, int shapenum, unsigned height)
if ( !(slinewidth = scaledata[scale].count[srcx]) ) if ( !(slinewidth = scaledata[scale].count[srcx]) )
continue; continue;
ScaleLine (); ScaleLine();
slinex+=slinewidth; slinex += slinewidth;
} }
} }
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