Commit 14c715ef authored by Steven Fuller's avatar Steven Fuller

made code -Wwrite-strings clean.

parent 2577c478
Wolfenstein 3D for Linux - http://www.icculus.org/wolf3d/
------------------------
This is an in-progress port of the id Software MS-DOS game, Wolfenstein 3D,
to the GNU/Linux operating system.
Save game and configuration file formats are not yet "solid" (files created Save game and configuration file formats are not yet "solid" (files created
with an older version may not work with a new binary), but they probably with an older version may not work with a new binary), but they probably
...@@ -22,6 +27,6 @@ Thanks: ...@@ -22,6 +27,6 @@ Thanks:
* Chuck Mason * Chuck Mason
* And everyone who has emailed me about this code! Thanks! * And everyone who has emailed me about this code! Thanks!
----- --
Steven Fuller Steven Fuller
relnev@icculus.org relnev@icculus.org
...@@ -14,7 +14,8 @@ typedef struct ...@@ -14,7 +14,8 @@ typedef struct
============================================================================= =============================================================================
*/ */
word RLEWtag; static word RLEWtag;
int mapon; int mapon;
word *mapsegs[MAPPLANES]; word *mapsegs[MAPPLANES];
...@@ -49,7 +50,7 @@ static int audiohandle = -1; /* handle to AUDIOT */ ...@@ -49,7 +50,7 @@ static int audiohandle = -1; /* handle to AUDIOT */
============================================================================= =============================================================================
*/ */
static void CA_CannotOpen(char *string) static void CA_CannotOpen(const char *string)
{ {
char str[30]; char str[30];
...@@ -69,7 +70,7 @@ static void CA_CannotOpen(char *string) ...@@ -69,7 +70,7 @@ static void CA_CannotOpen(char *string)
========================== ==========================
*/ */
boolean CA_WriteFile(char *filename, void *ptr, long length) boolean CA_WriteFile(const char *filename, const void *ptr, long length)
{ {
ssize_t l; ssize_t l;
int handle; int handle;
...@@ -79,7 +80,7 @@ boolean CA_WriteFile(char *filename, void *ptr, long length) ...@@ -79,7 +80,7 @@ boolean CA_WriteFile(char *filename, void *ptr, long length)
if (handle == -1) if (handle == -1)
return false; return false;
l = WriteBytes(handle, (byte *)ptr, length); l = WriteBytes(handle, (const byte *)ptr, length);
if (l == -1) { if (l == -1) {
perror("CA_FarWrite"); perror("CA_FarWrite");
return false; return false;
...@@ -106,7 +107,7 @@ boolean CA_WriteFile(char *filename, void *ptr, long length) ...@@ -106,7 +107,7 @@ boolean CA_WriteFile(char *filename, void *ptr, long length)
========================== ==========================
*/ */
boolean CA_LoadFile(char *filename, memptr *ptr) boolean CA_LoadFile(const char *filename, memptr *ptr)
{ {
int handle; int handle;
ssize_t l; ssize_t l;
...@@ -154,10 +155,11 @@ boolean CA_LoadFile(char *filename, memptr *ptr) ...@@ -154,10 +155,11 @@ boolean CA_LoadFile(char *filename, memptr *ptr)
*/ */
/* From Ryan C. Gordon -- ryan_gordon@hotmail.com */ /* From Ryan C. Gordon -- ryan_gordon@hotmail.com */
void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable) void CAL_HuffExpand(const byte *source, byte *dest, long length,
const huffnode *htable)
{ {
huffnode *headptr; const huffnode *headptr;
huffnode *nodeon; const huffnode *nodeon;
byte mask = 0x01; byte mask = 0x01;
word path; word path;
byte *endoff = dest + length; byte *endoff = dest + length;
...@@ -198,11 +200,12 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable) ...@@ -198,11 +200,12 @@ void CAL_HuffExpand(byte *source, byte *dest, long length, huffnode *htable)
#define NEARTAG 0xa7 #define NEARTAG 0xa7
#define FARTAG 0xa8 #define FARTAG 0xa8
void CAL_CarmackExpand(byte *source, word *dest, word length) void CAL_CarmackExpand(const byte *source, word *dest, word length)
{ {
unsigned int offset; unsigned int offset;
word *copyptr, *outptr; word *copyptr, *outptr;
byte chhigh, chlow, *inptr; byte chhigh, chlow;
const byte *inptr;
length /= 2; length /= 2;
...@@ -262,7 +265,7 @@ void CAL_CarmackExpand(byte *source, word *dest, word length) ...@@ -262,7 +265,7 @@ void CAL_CarmackExpand(byte *source, word *dest, word length)
====================== ======================
*/ */
void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag) void CA_RLEWexpand(const word *source, word *dest, long length, word rlewtag)
{ {
word value, count, i; word value, count, i;
word *end = dest + length / 2; word *end = dest + length / 2;
...@@ -271,10 +274,10 @@ void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag) ...@@ -271,10 +274,10 @@ void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag)
do { do {
value = *source++; value = *source++;
if (value != rlewtag) if (value != rlewtag) {
/* uncompressed */ /* uncompressed */
*dest++ = value; *dest++ = value;
else { } else {
/* compressed string */ /* compressed string */
count = *source++; count = *source++;
...@@ -580,7 +583,7 @@ void CA_LoadAllSounds() ...@@ -580,7 +583,7 @@ void CA_LoadAllSounds()
====================== ======================
*/ */
static void CAL_ExpandGrChunk(int chunk, byte *source) static void CAL_ExpandGrChunk(int chunk, const byte *source)
{ {
int tilecount = 0, i; int tilecount = 0, i;
long expanded; long expanded;
......
...@@ -27,10 +27,8 @@ extern char extension[5]; ...@@ -27,10 +27,8 @@ extern char extension[5];
/* ======================================================================== */ /* ======================================================================== */
boolean CA_LoadFile(char *filename, memptr *ptr); boolean CA_LoadFile(const char *filename, memptr *ptr);
boolean CA_WriteFile(char *filename, void *ptr, long length); boolean CA_WriteFile(const char *filename, const void *ptr, long length);
void CA_RLEWexpand(word *source, word *dest, long length, word rlewtag);
void CA_Startup(); void CA_Startup();
void CA_Shutdown(); void CA_Shutdown();
......
...@@ -79,8 +79,8 @@ typedef struct { ...@@ -79,8 +79,8 @@ typedef struct {
extern const byte gamepal[]; extern const byte gamepal[];
int MS_CheckParm(char *string); int MS_CheckParm(const char *string);
void Quit(char *error); void Quit(const char *error);
#define TickBase 70 /* 70Hz per tick */ #define TickBase 70 /* 70Hz per tick */
......
...@@ -61,7 +61,7 @@ void US_Shutdown() ...@@ -61,7 +61,7 @@ void US_Shutdown()
// supported. // supported.
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void US_Print(char *str) void US_Print(const char *str)
{ {
char c, *se, *s, *sz = strdup(str); char c, *se, *s, *sz = strdup(str);
word w, h; word w, h;
...@@ -115,7 +115,7 @@ void US_PrintUnsigned(longword n) ...@@ -115,7 +115,7 @@ void US_PrintUnsigned(longword n)
// USL_PrintInCenter() - Prints a string in the center of the given rect // USL_PrintInCenter() - Prints a string in the center of the given rect
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void USL_PrintInCenter(char *s, Rect r) void USL_PrintInCenter(const char *s, Rect r)
{ {
word w, h, rw, rh; word w, h, rw, rh;
...@@ -133,7 +133,7 @@ void USL_PrintInCenter(char *s, Rect r) ...@@ -133,7 +133,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 US_PrintCentered(char *s) void US_PrintCentered(const char *s)
{ {
Rect r; Rect r;
...@@ -151,7 +151,7 @@ void US_PrintCentered(char *s) ...@@ -151,7 +151,7 @@ void US_PrintCentered(char *s)
// advances to the next line. Newlines are not supported. // advances to the next line. Newlines are not supported.
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void US_CPrintLine(char *s) void US_CPrintLine(const char *s)
{ {
word w, h; word w, h;
...@@ -171,7 +171,7 @@ void US_CPrintLine(char *s) ...@@ -171,7 +171,7 @@ void US_CPrintLine(char *s)
// supported. // supported.
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void US_CPrint(char *str) void US_CPrint(const char *str)
{ {
/* Functions like to pass a string constant */ /* Functions like to pass a string constant */
...@@ -251,7 +251,7 @@ void US_DrawWindow(word x,word y,word w,word h) ...@@ -251,7 +251,7 @@ void US_DrawWindow(word x,word y,word w,word h)
// USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput() // USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput()
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
static void USL_XORICursor(int x, int y, char *s, word cursor) static void USL_XORICursor(int x, int y, const char *s, word cursor)
{ {
static boolean status; static boolean status;
char buf[MaxString]; char buf[MaxString];
...@@ -285,7 +285,7 @@ static void USL_XORICursor(int x, int y, char *s, word cursor) ...@@ -285,7 +285,7 @@ static void USL_XORICursor(int x, int y, char *s, word cursor)
// returned // returned
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
boolean US_LineInput(int x,int y,char *buf,char *def,boolean escok, boolean US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
int maxchars,int maxwidth) int maxchars,int maxwidth)
{ {
boolean redraw, cursorvis, cursormoved, done, result = true; boolean redraw, cursorvis, cursormoved, done, result = true;
......
...@@ -30,15 +30,15 @@ void US_Startup(), ...@@ -30,15 +30,15 @@ void US_Startup(),
US_InitRndT(boolean randomize), US_InitRndT(boolean randomize),
US_DrawWindow(word x,word y,word w,word h), US_DrawWindow(word x,word y,word w,word h),
US_ClearWindow(void), US_ClearWindow(void),
US_PrintCentered(char *s), US_PrintCentered(const char *s),
US_CPrint(char *s), US_CPrint(const char *s),
US_CPrintLine(char *s), US_CPrintLine(const char *s),
US_Print(char *s), US_Print(const char *s),
US_PrintUnsigned(longword n); US_PrintUnsigned(longword n);
boolean US_LineInput(int x,int y,char *buf,char *def,boolean escok, boolean US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
int maxchars,int maxwidth); int maxchars,int maxwidth);
int US_RndT(); int US_RndT();
void USL_PrintInCenter(char *s,Rect r); void USL_PrintInCenter(const char *s,Rect r);
#endif #endif
...@@ -199,7 +199,7 @@ height is a word ...@@ -199,7 +199,7 @@ height is a word
256 byte widths 256 byte widths
data data
*/ */
void VW_DrawPropString(char *string) void VW_DrawPropString(const char *string)
{ {
byte *font; byte *font;
int width, step, height, x, xs, y; int width, step, height, x, xs, y;
...@@ -227,7 +227,7 @@ void VW_DrawPropString(char *string) ...@@ -227,7 +227,7 @@ void VW_DrawPropString(char *string)
} }
} }
void VW_MeasurePropString(char *string, word *width, word *height) void VW_MeasurePropString(const char *string, word *width, word *height)
{ {
int w, mw; int w, mw;
byte *font = grsegs[STARTFONT+fontnumber]; byte *font = grsegs[STARTFONT+fontnumber];
......
...@@ -29,9 +29,9 @@ extern boolean screenfaded; ...@@ -29,9 +29,9 @@ extern boolean screenfaded;
#define VW_WaitVBL VL_WaitVBL #define VW_WaitVBL VL_WaitVBL
#define VW_FadeIn() VL_FadeIn(0,255,gamepal,30); #define VW_FadeIn() VL_FadeIn(0,255,gamepal,30);
#define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30); #define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30);
void VW_MeasurePropString(char *string, word *width, word *height); void VW_MeasurePropString(const char *string, word *width, word *height);
void VW_DrawPropString(char *string); void VW_DrawPropString(const char *string);
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps); void VL_FadeOut(int start, int end, int red, int green, int blue, int steps);
void VL_FadeIn(int start, int end, const byte *palette, int steps); void VL_FadeIn(int start, int end, const byte *palette, int steps);
......
...@@ -160,7 +160,7 @@ static void put_dos2ansi(byte attrib) ...@@ -160,7 +160,7 @@ static void put_dos2ansi(byte attrib)
printf ("%c[%d;25;%dm%c[%dm", 27, intens, fore, 27, back); printf ("%c[%d;25;%dm%c[%dm", 27, intens, fore, 27, back);
} }
void DisplayTextSplash(byte *text, int l) void DisplayTextSplash(const byte *text, int l)
{ {
int i, x; int i, x;
...@@ -207,7 +207,7 @@ uint32_t SwapInt32L(uint32_t i) ...@@ -207,7 +207,7 @@ uint32_t SwapInt32L(uint32_t i)
/* ** */ /* ** */
int OpenWrite(char *fn) int OpenWrite(const char *fn)
{ {
int fp; int fp;
...@@ -215,7 +215,7 @@ int OpenWrite(char *fn) ...@@ -215,7 +215,7 @@ int OpenWrite(char *fn)
return fp; return fp;
} }
int OpenWriteAppend(char *fn) int OpenWriteAppend(const char *fn)
{ {
int fp; int fp;
...@@ -257,13 +257,13 @@ int WriteInt32(int fp, int32_t d) ...@@ -257,13 +257,13 @@ int WriteInt32(int fp, int32_t d)
return write(fp, &b, 4) / 4; return write(fp, &b, 4) / 4;
} }
int WriteBytes(int fp, byte *d, int len) int WriteBytes(int fp, const byte *d, int len)
{ {
return write(fp, d, len); return write(fp, d, len);
} }
int OpenRead(char *fn) int OpenRead(const char *fn)
{ {
int fp; int fp;
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
extern int _argc; extern int _argc;
extern char **_argv; extern char **_argv;
void SavePCX256ToFile(unsigned char *buf, int width, int height, unsigned char *pal, char *name); void SavePCX256ToFile(const unsigned char *buf, int width, int height, const unsigned char *pal, const char *name);
void SavePCXRGBToFile(unsigned char *buf, int width, int height, char *name); void SavePCXRGBToFile(const unsigned char *buf, int width, int height, const char *name);
void set_TimeCount(unsigned long t); void set_TimeCount(unsigned long t);
unsigned long get_TimeCount(); unsigned long get_TimeCount();
...@@ -23,8 +23,8 @@ char *ultoa(unsigned long value, char *string, int radix); ...@@ -23,8 +23,8 @@ char *ultoa(unsigned long value, char *string, int radix);
uint16_t SwapInt16L(uint16_t i); uint16_t SwapInt16L(uint16_t i);
uint32_t SwapInt32L(uint32_t i); uint32_t SwapInt32L(uint32_t i);
extern int OpenWrite(char *fn); extern int OpenWrite(const char *fn);
extern int OpenWriteAppend(char *fn); extern int OpenWriteAppend(const char *fn);
extern void CloseWrite(int fp); extern void CloseWrite(int fp);
extern int WriteSeek(int fp, int offset, int whence); extern int WriteSeek(int fp, int offset, int whence);
...@@ -33,9 +33,9 @@ extern int WritePos(int fp); ...@@ -33,9 +33,9 @@ extern int WritePos(int fp);
extern int WriteInt8(int fp, int8_t d); extern int WriteInt8(int fp, int8_t d);
extern int WriteInt16(int fp, int16_t d); extern int WriteInt16(int fp, int16_t d);
extern int WriteInt32(int fp, int32_t d); extern int WriteInt32(int fp, int32_t d);
extern int WriteBytes(int fp, byte *d, int len); extern int WriteBytes(int fp, const byte *d, int len);
extern int OpenRead(char *fn); extern int OpenRead(const char *fn);
extern void CloseRead(int fp); extern void CloseRead(int fp);
extern int ReadSeek(int fp, int offset, int whence); extern int ReadSeek(int fp, int offset, int whence);
......
...@@ -161,7 +161,7 @@ extern void IN_Startup(), IN_Shutdown(), IN_ClearKeysDown(), ...@@ -161,7 +161,7 @@ extern void IN_Startup(), IN_Shutdown(), IN_ClearKeysDown(),
IN_Ack(); IN_Ack();
extern boolean IN_UserInput(longword delay); extern boolean IN_UserInput(longword delay);
extern char *IN_GetScanName(ScanCode); extern const char *IN_GetScanName(ScanCode);
byte IN_MouseButtons(); byte IN_MouseButtons();
byte IN_JoyButtons(); byte IN_JoyButtons();
......
...@@ -14,7 +14,7 @@ byte *gfxbuf = NULL; ...@@ -14,7 +14,7 @@ byte *gfxbuf = NULL;
========================== ==========================
*/ */
void Quit(char *error) void Quit(const char *error)
{ {
memptr screen = NULL; memptr screen = NULL;
......
...@@ -25,7 +25,7 @@ void DisplayTextSplash(byte *text); ...@@ -25,7 +25,7 @@ void DisplayTextSplash(byte *text);
========================== ==========================
*/ */
void Quit(char *error) void Quit(const char *error)
{ {
memptr screen = NULL; memptr screen = NULL;
......
...@@ -19,7 +19,7 @@ void DisplayTextSplash(byte *text); ...@@ -19,7 +19,7 @@ void DisplayTextSplash(byte *text);
========================== ==========================
*/ */
void Quit(char *error) void Quit(const char *error)
{ {
memptr screen = NULL; memptr screen = NULL;
......
...@@ -499,9 +499,9 @@ int main(int argc, char *argv[]) ...@@ -499,9 +499,9 @@ int main(int argc, char *argv[])
========================== ==========================
*/ */
void DisplayTextSplash(byte *text, int l); void DisplayTextSplash(const byte *text, int l);
void Quit(char *error) void Quit(const char *error)
{ {
memptr screen = NULL; memptr screen = NULL;
int l = 0; int l = 0;
......
...@@ -493,7 +493,6 @@ typedef enum { ...@@ -493,7 +493,6 @@ typedef enum {
nodir nodir
} dirtype; } dirtype;
#define NUMENEMIES 22 #define NUMENEMIES 22
typedef enum { typedef enum {
en_guard, en_guard,
...@@ -520,15 +519,6 @@ typedef enum { ...@@ -520,15 +519,6 @@ typedef enum {
en_death en_death
} enemy_t; } enemy_t;
typedef struct statestruct
{
boolean rotate;
int shapenum; /* a shapenum of -1 means get from ob->temp1 */
int tictime;
void (*think)(), (*action)();
int next; /* stateenum */
} statetype;
//--------------------- //---------------------
// //
// trivial actor structure // trivial actor structure
...@@ -595,6 +585,15 @@ typedef struct objstruct ...@@ -595,6 +585,15 @@ typedef struct objstruct
struct objstruct *next,*prev; struct objstruct *next,*prev;
} objtype; } objtype;
typedef struct statestruct
{
boolean rotate;
int shapenum; /* a shapenum of -1 means get from ob->temp1 */
int tictime;
void (*think)(objtype *ob);
void (*action)(objtype *ob);
int next; /* stateenum */
} statetype;
#define NUMBUTTONS 8 #define NUMBUTTONS 8
enum { enum {
...@@ -700,9 +699,9 @@ void NewGame(int difficulty,int episode); ...@@ -700,9 +699,9 @@ void NewGame(int difficulty,int episode);
void NewViewSize(int width); void NewViewSize(int width);
void ShowViewSize(int width); void ShowViewSize(int width);
int LoadTheGame(char *fn, int x, int y); int LoadTheGame(const char *fn, int x, int y);
int SaveTheGame(char *fn, char *tag, int x, int y); int SaveTheGame(const char *fn, const char *tag, int x, int y);
int ReadSaveTag(char *fn, char *tag); int ReadSaveTag(const char *fn, const char *tag);
void ShutdownId(); void ShutdownId();
int WriteConfig(); int WriteConfig();
...@@ -735,7 +734,7 @@ void DrawPlayScreen (void); ...@@ -735,7 +734,7 @@ void DrawPlayScreen (void);
void GameLoop (void); void GameLoop (void);
void ClearMemory (void); void ClearMemory (void);
void PlayDemo(int demonumber); void PlayDemo(int demonumber);
int PlayDemoFromFile(char *demoname); int PlayDemoFromFile(const char *demoname);
void RecordDemo(); void RecordDemo();
void DrawHighScores(); void DrawHighScores();
void DrawPlayBorder(); void DrawPlayBorder();
......
...@@ -17,7 +17,7 @@ boolean spearflag; ...@@ -17,7 +17,7 @@ boolean spearflag;
/* ELEVATOR BACK MAPS - REMEMBER (-1)!! */ /* ELEVATOR BACK MAPS - REMEMBER (-1)!! */
#ifndef SPEAR #ifndef SPEAR
static int ElevatorBackTo[]={ 1, 1, 7, 3, 5, 3}; static const int ElevatorBackTo[]={ 1, 1, 7, 3, 5, 3};
#endif #endif
//=========================================================================== //===========================================================================
...@@ -841,7 +841,7 @@ void PlayDemo(int demonumber) ...@@ -841,7 +841,7 @@ void PlayDemo(int demonumber)
ClearMemory(); ClearMemory();
} }
int PlayDemoFromFile(char *demoname) int PlayDemoFromFile(const char *demoname)
{ {
int length; int length;
......
...@@ -269,9 +269,9 @@ void PG13() ...@@ -269,9 +269,9 @@ void PG13()
//========================================================================== //==========================================================================
void Write(int x,int y,char *string) void Write(int x,int y,const char *string)
{ {
int alpha[]={L_NUM0PIC,L_NUM1PIC,L_NUM2PIC,L_NUM3PIC,L_NUM4PIC,L_NUM5PIC, const int alpha[]={L_NUM0PIC,L_NUM1PIC,L_NUM2PIC,L_NUM3PIC,L_NUM4PIC,L_NUM5PIC,
L_NUM6PIC,L_NUM7PIC,L_NUM8PIC,L_NUM9PIC,L_COLONPIC,0,0,0,0,0,0,L_APIC,L_BPIC, L_NUM6PIC,L_NUM7PIC,L_NUM8PIC,L_NUM9PIC,L_COLONPIC,0,0,0,0,0,0,L_APIC,L_BPIC,
L_CPIC,L_DPIC,L_EPIC,L_FPIC,L_GPIC,L_HPIC,L_IPIC,L_JPIC,L_KPIC, L_CPIC,L_DPIC,L_EPIC,L_FPIC,L_GPIC,L_HPIC,L_IPIC,L_JPIC,L_KPIC,
L_LPIC,L_MPIC,L_NPIC,L_OPIC,L_PPIC,L_QPIC,L_RPIC,L_SPIC,L_TPIC, L_LPIC,L_MPIC,L_NPIC,L_OPIC,L_PPIC,L_QPIC,L_RPIC,L_SPIC,L_TPIC,
...@@ -320,7 +320,7 @@ void Write(int x,int y,char *string) ...@@ -320,7 +320,7 @@ void Write(int x,int y,char *string)
break; break;
default: default:
VWB_DrawPic(nx,ny,alpha[(int)ch]); VWB_DrawPic(nx,ny,alpha[(unsigned char)ch]);
} }
nx+=16; nx+=16;
} }
...@@ -333,7 +333,7 @@ void Write(int x,int y,char *string) ...@@ -333,7 +333,7 @@ void Write(int x,int y,char *string)
void BJ_Breathe() void BJ_Breathe()
{ {
static int which=0,max=10; static int which=0,max=10;
int pics[2]={L_GUYPIC,L_GUY2PIC}; const int pics[2]={L_GUYPIC,L_GUY2PIC};
if (get_TimeCount() > max) if (get_TimeCount() > max)
{ {
...@@ -380,7 +380,7 @@ void LevelCompleted() ...@@ -380,7 +380,7 @@ void LevelCompleted()
char tempstr[10]; char tempstr[10];
long bonus,timeleft=0; long bonus,timeleft=0;
times parTimes[]= const times parTimes[]=
{ {
#ifndef SPEAR #ifndef SPEAR
// //
......
...@@ -331,7 +331,7 @@ configend: ...@@ -331,7 +331,7 @@ configend:
return 0; return 0;
} }
int SaveTheGame(char *fn, char *tag, int dx, int dy) int SaveTheGame(const char *fn, const char *tag, int dx, int dy)
{ {
objtype *ob; objtype *ob;
int fd, i, x, y; int fd, i, x, y;
...@@ -508,7 +508,7 @@ int SaveTheGame(char *fn, char *tag, int dx, int dy) ...@@ -508,7 +508,7 @@ int SaveTheGame(char *fn, char *tag, int dx, int dy)
return 0; return 0;
} }
int ReadSaveTag(char *fn, char *tag) int ReadSaveTag(const char *fn, const char *tag)
{ {
char buf[8]; char buf[8];
int fd; int fd;
...@@ -556,7 +556,7 @@ rstfail: ...@@ -556,7 +556,7 @@ rstfail:
return -1; return -1;
} }
int LoadTheGame(char *fn, int dx, int dy) int LoadTheGame(const char *fn, int dx, int dy)
{ {
char buf[8]; char buf[8];
int fd, i, x, y, id; int fd, i, x, y, id;
...@@ -805,7 +805,7 @@ loadfail: ...@@ -805,7 +805,7 @@ loadfail:
================= =================
*/ */
int MS_CheckParm(char *check) int MS_CheckParm(const char *check)
{ {
int i; int i;
char *parm; char *parm;
......
...@@ -17,7 +17,7 @@ void CP_ReadThis(); ...@@ -17,7 +17,7 @@ void CP_ReadThis();
#define STARTITEM newgame #define STARTITEM newgame
#endif #endif
static char endStrings[9][80]= static const char endStrings[9][80]=
{ {
ENDSTR1, ENDSTR1,
ENDSTR2, ENDSTR2,
...@@ -146,8 +146,8 @@ CusMenu[]= ...@@ -146,8 +146,8 @@ CusMenu[]=
}; };
static int color_hlite[] = { DEACTIVE, HIGHLIGHT, READHCOLOR, 0x67 }; static const int color_hlite[] = { DEACTIVE, HIGHLIGHT, READHCOLOR, 0x67 };
static int color_norml[] = { DEACTIVE, TEXTCOLOR, READCOLOR, 0x6b }; static const int color_norml[] = { DEACTIVE, TEXTCOLOR, READCOLOR, 0x6b };
#ifndef SPEAR #ifndef SPEAR
static int EpisodeSelect[6] = { 1 }; static int EpisodeSelect[6] = { 1 };
...@@ -192,7 +192,7 @@ static struct { ...@@ -192,7 +192,7 @@ static struct {
{ sc_None, "?" } { sc_None, "?" }
}; };
char *IN_GetScanName(ScanCode scan) const char *IN_GetScanName(ScanCode scan)
{ {
int i; int i;
...@@ -204,7 +204,7 @@ char *IN_GetScanName(ScanCode scan) ...@@ -204,7 +204,7 @@ char *IN_GetScanName(ScanCode scan)
#else #else
static char static const char
*ScanNames[] = // Scan code names with single chars *ScanNames[] = // Scan code names with single chars
{ {
"?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?", "?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?",
...@@ -231,7 +231,7 @@ static char ...@@ -231,7 +231,7 @@ static char
"Down","Left","Right","" "Down","Left","Right",""
}; };
char *IN_GetScanName(ScanCode scan) const char *IN_GetScanName(ScanCode scan)
{ {
char **p; char **p;
ScanCode *s; ScanCode *s;
...@@ -240,7 +240,7 @@ char *IN_GetScanName(ScanCode scan) ...@@ -240,7 +240,7 @@ char *IN_GetScanName(ScanCode scan)
if (*s == scan) if (*s == scan)
return *p; return *p;
return ScanNames[(int)scan]; return ScanNames[(unsigned char)scan];
} }
#endif #endif
...@@ -3064,7 +3064,7 @@ void ReadAnyControl(ControlInfo *ci) ...@@ -3064,7 +3064,7 @@ void ReadAnyControl(ControlInfo *ci)
// DRAW DIALOG AND CONFIRM YES OR NO TO QUESTION // DRAW DIALOG AND CONFIRM YES OR NO TO QUESTION
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
int Confirm(char *string) int Confirm(const char *string)
{ {
int xit=0,x,y,tick=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND}; int xit=0,x,y,tick=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
...@@ -3120,7 +3120,7 @@ int Confirm(char *string) ...@@ -3120,7 +3120,7 @@ int Confirm(char *string)
// PRINT A MESSAGE IN A WINDOW // PRINT A MESSAGE IN A WINDOW
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void Message(char *string) void Message(const char *string)
{ {
word h=0, mw=0; word h=0, mw=0;
......
...@@ -126,8 +126,8 @@ void TicDelay(int count); ...@@ -126,8 +126,8 @@ void TicDelay(int count);
void CacheLump(int lumpstart,int lumpend); void CacheLump(int lumpstart,int lumpend);
void UnCacheLump(int lumpstart,int lumpend); void UnCacheLump(int lumpstart,int lumpend);
void StartCPMusic(int song); void StartCPMusic(int song);
int Confirm(char *string); int Confirm(const char *string);
void Message(char *string); void Message(const char *string);
void CheckPause(void); void CheckPause(void);
void ShootSnd(void); void ShootSnd(void);
void FreeMusic(void); void FreeMusic(void);
...@@ -220,7 +220,7 @@ typedef struct { ...@@ -220,7 +220,7 @@ typedef struct {
extern LRstruct LevelRatios[]; extern LRstruct LevelRatios[];
void Write(int x,int y,char *string); void Write(int x,int y,const char *string);
int GetYorN(int x,int y,int pic); int GetYorN(int x,int y,int pic);
#endif #endif
...@@ -46,14 +46,14 @@ TEXT FORMATTING COMMANDS ...@@ -46,14 +46,14 @@ TEXT FORMATTING COMMANDS
============================================================================= =============================================================================
*/ */
int pagenum, numpages; static int pagenum, numpages;
unsigned leftmargin[TEXTROWS], rightmargin[TEXTROWS]; static unsigned leftmargin[TEXTROWS], rightmargin[TEXTROWS];
char *text; static const char *text;
unsigned rowon; static unsigned rowon;
int picx, picy, picnum, picdelay; static int picx, picy, picnum, picdelay;
boolean layoutdone; static boolean layoutdone;
/* ======================================================================== */ /* ======================================================================== */
...@@ -526,7 +526,7 @@ void BackPage() ...@@ -526,7 +526,7 @@ void BackPage()
*/ */
void CacheLayoutGraphics() void CacheLayoutGraphics()
{ {
char *bombpoint, *textstart; const char *bombpoint, *textstart;
char ch; char ch;
textstart = text; textstart = text;
...@@ -577,7 +577,7 @@ void CacheLayoutGraphics() ...@@ -577,7 +577,7 @@ void CacheLayoutGraphics()
===================== =====================
*/ */
void ShowArticle(char *article) void ShowArticle(const char *article)
{ {
unsigned oldfontnumber; unsigned oldfontnumber;
boolean newpage, firstpage; boolean newpage, firstpage;
......
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