Commit 2419d4f9 authored by Steven Fuller's avatar Steven Fuller

Cleanups (wl_game.c)

parent 9fb3c204
...@@ -3,38 +3,31 @@ ...@@ -3,38 +3,31 @@
#include "id_heads.h" #include "id_heads.h"
// Global variables // Global variables
char *abortprogram; boolean NoWait;
boolean NoWait; word PrintX,PrintY;
word PrintX,PrintY; word WindowX,WindowY,WindowW,WindowH;
word WindowX,WindowY,WindowW,WindowH;
// Internal variables // Internal variables
#define ConfigVersion 1
static char *ParmStrings[] = {"TEDLEVEL","NOWAIT"}, static char *ParmStrings[] = {"TEDLEVEL","NOWAIT"},
*ParmStrings2[] = {"COMP","NOCOMP"}; *ParmStrings2[] = {"COMP","NOCOMP"};
static boolean US_Started; static boolean US_Started;
boolean Button0,Button1, int CursorX,CursorY;
CursorBad;
int CursorX,CursorY;
void (*USL_MeasureString)(char *,word *,word *) = VW_MeasurePropString, void (*USL_MeasureString)(char *,word *,word *) = VW_MeasurePropString,
(*USL_DrawString)(char *) = VWB_DrawPropString; (*USL_DrawString)(char *) = VWB_DrawPropString;
SaveGame Games[MaxSaveGames]; SaveGame Games[MaxSaveGames];
HighScore Scores[MaxScores] = HighScore Scores[MaxScores] = {
{ {"id software-'92",10000,1},
{"id software-'92",10000,1}, {"Adrian Carmack",10000,1},
{"Adrian Carmack",10000,1}, {"John Carmack",10000,1},
{"John Carmack",10000,1}, {"Kevin Cloud",10000,1},
{"Kevin Cloud",10000,1}, {"Tom Hall",10000,1},
{"Tom Hall",10000,1}, {"John Romero",10000,1},
{"John Romero",10000,1}, {"Jay Wilbur",10000,1},
{"Jay Wilbur",10000,1}, };
};
// Internal routines
// Public routines // Public routines
...@@ -94,8 +87,7 @@ void US_Shutdown(void) ...@@ -94,8 +87,7 @@ void US_Shutdown(void)
// index of the string that matched, or -1 if no matches were found // index of the string that matched, or -1 if no matches were found
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
int int US_CheckParm(char *parm,char **strings)
US_CheckParm(char *parm,char **strings)
{ {
char cp,cs, char cp,cs,
*p,*s; *p,*s;
...@@ -132,8 +124,7 @@ US_CheckParm(char *parm,char **strings) ...@@ -132,8 +124,7 @@ US_CheckParm(char *parm,char **strings)
// between masked and non-masked fonts // between masked and non-masked fonts
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void void US_SetPrintRoutines(void (*measure)(char *,word *,word *),void (*print)(char *))
US_SetPrintRoutines(void (*measure)(char *,word *,word *),void (*print)(char *))
{ {
USL_MeasureString = measure; USL_MeasureString = measure;
USL_DrawString = print; USL_DrawString = print;
...@@ -224,8 +215,7 @@ void USL_PrintInCenter(char *s, Rect r) ...@@ -224,8 +215,7 @@ void USL_PrintInCenter(char *s, Rect r)
// US_PrintCentered() - Prints a string centered in the current window. // US_PrintCentered() - Prints a string centered in the current window.
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void void US_PrintCentered(char *s)
US_PrintCentered(char *s)
{ {
Rect r; Rect r;
......
...@@ -50,14 +50,11 @@ extern boolean ingame, // Set by game code if a game is in progress ...@@ -50,14 +50,11 @@ extern boolean ingame, // Set by game code if a game is in progress
loadedgame, // Set if the current game was loaded loadedgame, // Set if the current game was loaded
NoWait, NoWait,
HighScoresDirty; HighScoresDirty;
extern char *abortprogram; // Set to error msg if program is dying
extern GameDiff restartgame; // Normally gd_Continue, else starts game extern GameDiff restartgame; // Normally gd_Continue, else starts game
extern word PrintX,PrintY; // Current printing location in the window extern word PrintX,PrintY; // Current printing location in the window
extern word WindowX,WindowY,// Current location of window extern word WindowX,WindowY,// Current location of window
WindowW,WindowH;// Current size of window WindowW,WindowH;// Current size of window
extern boolean Button0,Button1,
CursorBad;
extern int CursorX,CursorY; extern int CursorX,CursorY;
extern void (*USL_MeasureString)(char *,word *,word *), extern void (*USL_MeasureString)(char *,word *,word *),
...@@ -68,9 +65,7 @@ extern void (*USL_ResetGame)(void); ...@@ -68,9 +65,7 @@ extern void (*USL_ResetGame)(void);
extern SaveGame Games[MaxSaveGames]; extern SaveGame Games[MaxSaveGames];
extern HighScore Scores[]; extern HighScore Scores[];
#define US_HomeWindow() {PrintX = WindowX; PrintY = WindowY;} void US_Startup(void),
extern void US_Startup(void),
US_Setup(void), US_Setup(void),
US_Shutdown(void), US_Shutdown(void),
US_InitRndT(boolean randomize), US_InitRndT(boolean randomize),
...@@ -97,10 +92,10 @@ extern void US_Startup(void), ...@@ -97,10 +92,10 @@ extern void US_Startup(void),
US_ShutCursor(void), US_ShutCursor(void),
US_CheckHighScore(long score,word other), US_CheckHighScore(long score,word other),
US_DisplayHighScores(int which); US_DisplayHighScores(int which);
extern boolean US_UpdateCursor(void), boolean US_UpdateCursor(void),
US_LineInput(int x,int y,char *buf,char *def,boolean escok, US_LineInput(int x,int y,char *buf,char *def,boolean escok,
int maxchars,int maxwidth); int maxchars,int maxwidth);
extern int US_CheckParm(char *parm,char **strings), int US_CheckParm(char *parm,char **strings),
US_RndT(void); US_RndT(void);
void USL_PrintInCenter(char *s,Rect r); void USL_PrintInCenter(char *s,Rect r);
......
...@@ -208,7 +208,7 @@ void ScanInfoPlane (void) ...@@ -208,7 +208,7 @@ void ScanInfoPlane (void)
{ {
unsigned x,y,i,j; unsigned x,y,i,j;
int tile; int tile;
unsigned far *start; word *start;
start = mapsegs[1]; start = mapsegs[1];
for (y=0;y<mapheight;y++) for (y=0;y<mapheight;y++)
...@@ -611,7 +611,7 @@ void ScanInfoPlane (void) ...@@ -611,7 +611,7 @@ void ScanInfoPlane (void)
void SetupGameLevel (void) void SetupGameLevel (void)
{ {
int x,y,i; int x,y,i;
unsigned far *map,tile,spot; word *map,tile,spot;
if (!loadedgame) if (!loadedgame)
...@@ -896,7 +896,7 @@ void StartDemoRecord (int levelnumber) ...@@ -896,7 +896,7 @@ void StartDemoRecord (int levelnumber)
{ {
MM_GetPtr (&demobuffer,MAXDEMOSIZE); MM_GetPtr (&demobuffer,MAXDEMOSIZE);
MM_SetLock (&demobuffer,true); MM_SetLock (&demobuffer,true);
demoptr = (char far *)demobuffer; demoptr = (char *)demobuffer;
lastdemoptr = demoptr+MAXDEMOSIZE; lastdemoptr = demoptr+MAXDEMOSIZE;
*demoptr = levelnumber; *demoptr = levelnumber;
...@@ -921,10 +921,10 @@ void FinishDemoRecord (void) ...@@ -921,10 +921,10 @@ void FinishDemoRecord (void)
demorecord = false; demorecord = false;
length = demoptr - (char far *)demobuffer; length = demoptr - (char *)demobuffer;
demoptr = ((char far *)demobuffer)+1; demoptr = ((char *)demobuffer)+1;
*(unsigned far *)demoptr = length; *(word *)demoptr = length;
CenterWindow(24,3); CenterWindow(24,3);
PrintY+=6; PrintY+=6;
...@@ -937,7 +937,7 @@ void FinishDemoRecord (void) ...@@ -937,7 +937,7 @@ void FinishDemoRecord (void)
if (level>=0 && level<=9) if (level>=0 && level<=9)
{ {
demoname[4] = '0'+level; demoname[4] = '0'+level;
CA_WriteFile (demoname,(void far *)demobuffer,length); CA_WriteFile (demoname,(void *)demobuffer,length);
} }
} }
...@@ -1041,13 +1041,13 @@ void PlayDemo (int demonumber) ...@@ -1041,13 +1041,13 @@ void PlayDemo (int demonumber)
demoname[4] = '0'+demonumber; demoname[4] = '0'+demonumber;
CA_LoadFile (demoname,&demobuffer); CA_LoadFile (demoname,&demobuffer);
MM_SetLock (&demobuffer,true); MM_SetLock (&demobuffer,true);
demoptr = (char far *)demobuffer; demoptr = (char *)demobuffer;
#endif #endif
NewGame (1,0); NewGame (1,0);
gamestate.mapon = *demoptr++; gamestate.mapon = *demoptr++;
gamestate.difficulty = gd_hard; gamestate.difficulty = gd_hard;
length = *((unsigned far *)demoptr)++; length = *((word *)demoptr)++;
demoptr++; demoptr++;
lastdemoptr = demoptr-4+length; lastdemoptr = demoptr-4+length;
...@@ -1324,12 +1324,10 @@ startplayloop: ...@@ -1324,12 +1324,10 @@ startplayloop:
CheckHighScore (gamestate.score,gamestate.mapon+1); CheckHighScore (gamestate.score,gamestate.mapon+1);
#pragma warn -sus
#ifndef JAPAN #ifndef JAPAN
_fstrcpy(MainMenu[viewscores].string,STR_VS); _fstrcpy(MainMenu[viewscores].string,STR_VS);
#endif #endif
MainMenu[viewscores].routine = CP_ViewScores; MainMenu[viewscores].routine = CP_ViewScores;
#pragma warn +sus
return; return;
} }
...@@ -1416,12 +1414,10 @@ startplayloop: ...@@ -1416,12 +1414,10 @@ startplayloop:
CheckHighScore (gamestate.score,gamestate.mapon+1); CheckHighScore (gamestate.score,gamestate.mapon+1);
#pragma warn -sus
#ifndef JAPAN #ifndef JAPAN
_fstrcpy(MainMenu[viewscores].string,STR_VS); strcpy(MainMenu[viewscores].string,STR_VS);
#endif #endif
MainMenu[viewscores].routine = CP_ViewScores; MainMenu[viewscores].routine = CP_ViewScores;
#pragma warn +sus
return; return;
...@@ -1440,12 +1436,10 @@ startplayloop: ...@@ -1440,12 +1436,10 @@ startplayloop:
CheckHighScore (gamestate.score,gamestate.mapon+1); CheckHighScore (gamestate.score,gamestate.mapon+1);
#pragma warn -sus
#ifndef JAPAN #ifndef JAPAN
_fstrcpy(MainMenu[viewscores].string,STR_VS); strcpy(MainMenu[viewscores].string,STR_VS);
#endif #endif
MainMenu[viewscores].routine = CP_ViewScores; MainMenu[viewscores].routine = CP_ViewScores;
#pragma warn +sus
return; return;
......
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