mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Replace some constants with preprocessor macros.
git-svn-id: https://svn.eduke32.com/eduke32@4472 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
20bf310cba
commit
a755e95c2c
12 changed files with 56 additions and 33 deletions
|
@ -82,11 +82,12 @@ extern void setvsync(int32_t sync);
|
|||
extern char inputdevices;
|
||||
|
||||
// keys
|
||||
#define NUMKEYS 256
|
||||
#define KEYSTATUSSIZ 256
|
||||
#define KEYFIFOSIZ 64
|
||||
extern char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
|
||||
extern char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
|
||||
extern char scantoasc[128], remap[KEYSTATUSSIZ], key_names[256][24];
|
||||
extern char scantoasc[128], remap[KEYSTATUSSIZ], key_names[NUMKEYS][24];
|
||||
extern int32_t remapinit;
|
||||
|
||||
extern int32_t defaultres[][2];
|
||||
|
|
|
@ -733,7 +733,11 @@ EXTERN intptr_t ylookup[MAXYDIM+1];
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifndef GEKKO
|
||||
#define MAXVALIDMODES 256
|
||||
#else
|
||||
#define MAXVALIDMODES 16
|
||||
#endif
|
||||
EXTERN int32_t validmodecnt;
|
||||
struct validmode_t {
|
||||
int32_t xdim,ydim;
|
||||
|
|
|
@ -14,7 +14,7 @@ char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
|
|||
char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
|
||||
char remap[KEYSTATUSSIZ];
|
||||
int32_t remapinit=0;
|
||||
char key_names[256][24];
|
||||
char key_names[NUMKEYS][24];
|
||||
volatile int32_t mousex=0,mousey=0,mouseb=0,mouseabsx=0,mouseabsy=0;
|
||||
volatile uint8_t moustat = 0, mousegrab = 0;
|
||||
int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL;
|
||||
|
|
|
@ -285,11 +285,11 @@ void CONFIG_SetDefaults(void)
|
|||
Bstrcpy(ud.ridecule[0], "An inspiration for birth control.");
|
||||
Bstrcpy(ud.ridecule[1], "You're gonna die for that!");
|
||||
Bstrcpy(ud.ridecule[2], "It hurts to be you.");
|
||||
Bstrcpy(ud.ridecule[3], "Lucky Son of a Bitch.");
|
||||
Bstrcpy(ud.ridecule[4], "Hmmm....Payback time.");
|
||||
Bstrcpy(ud.ridecule[3], "Lucky son of a bitch.");
|
||||
Bstrcpy(ud.ridecule[4], "Hmmm... payback time.");
|
||||
Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker.");
|
||||
Bstrcpy(ud.ridecule[6], "Damn, you're ugly.");
|
||||
Bstrcpy(ud.ridecule[7], "Ha ha ha...Wasted!");
|
||||
Bstrcpy(ud.ridecule[7], "Ha ha ha... wasted!");
|
||||
Bstrcpy(ud.ridecule[8], "You suck!");
|
||||
Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");
|
||||
|
||||
|
@ -608,7 +608,7 @@ int32_t CONFIG_ReadSetup(void)
|
|||
{
|
||||
char dummybuf[64];
|
||||
|
||||
for (dummy = 0; dummy < 10; dummy++)
|
||||
for (dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
|
@ -970,7 +970,7 @@ void CONFIG_WriteSetup(uint32_t flags)
|
|||
{
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
for (dummy = 0; dummy < 10; dummy++)
|
||||
for (dummy = 0; dummy < MAXRIDECULE; dummy++)
|
||||
{
|
||||
commmacro[13] = dummy+'0';
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
||||
|
|
|
@ -151,7 +151,6 @@ int32_t g_Shareware = 0;
|
|||
int32_t quotebot, quotebotgoal;
|
||||
static int32_t user_quote_time[MAXUSERQUOTES];
|
||||
static char user_quote[MAXUSERQUOTES][178];
|
||||
// char typebuflen,typebuf[41];
|
||||
|
||||
// This was 32 for a while, but I think lowering it to 24 will help things like the Dingoo.
|
||||
// Ideally, we would look at our memory usage on our most cramped platform and figure out
|
||||
|
|
|
@ -31,6 +31,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define USERQUOTE_LEFTOFFSET 5
|
||||
#define USERQUOTE_RIGHTOFFSET 14
|
||||
|
||||
#define MAXRIDECULE 10
|
||||
#define MAXRIDECULELENGTH 40
|
||||
#define MAXSAVEGAMES 10
|
||||
#define MAXSAVEGAMENAME 22
|
||||
#define MAXPWLOCKOUT 128
|
||||
#define MAXRTSNAME 128
|
||||
|
||||
enum GametypeFlags_t {
|
||||
GAMETYPE_COOP = 0x00000001,
|
||||
GAMETYPE_WEAPSTAY = 0x00000002,
|
||||
|
@ -233,9 +240,9 @@ typedef struct {
|
|||
char overhead_on,last_overhead,showweapons;
|
||||
char god,warp_on,cashman,eog,showallmap;
|
||||
char show_help,scrollmode,noclip;
|
||||
char ridecule[10][40];
|
||||
char savegame[10][22];
|
||||
char pwlockout[128],rtsname[128];
|
||||
char ridecule[MAXRIDECULE][MAXRIDECULELENGTH];
|
||||
char savegame[MAXSAVEGAMES][MAXSAVEGAMENAME];
|
||||
char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
|
||||
char display_bonus_screen;
|
||||
char show_level_text;
|
||||
} user_defs;
|
||||
|
|
|
@ -3291,20 +3291,16 @@ nullquote:
|
|||
{
|
||||
g_lastSaveSlot = *insptr++;
|
||||
|
||||
if ((unsigned)g_lastSaveSlot >= 10)
|
||||
if ((unsigned)g_lastSaveSlot >= MAXSAVEGAMES)
|
||||
continue;
|
||||
|
||||
if (tw == CON_SAVE || ud.savegame[g_lastSaveSlot][0] == 0)
|
||||
{
|
||||
time_t curtime = time(NULL);
|
||||
Bstrcpy(tempbuf,asctime(localtime(&curtime)));
|
||||
clearbufbyte(ud.savegame[g_lastSaveSlot],sizeof(ud.savegame[g_lastSaveSlot]),0);
|
||||
Bsprintf(ud.savegame[g_lastSaveSlot],"Auto");
|
||||
// for (j=0;j<13;j++)
|
||||
// Bmemcpy(&ud.savegame[g_lastSaveSlot][j+4],&tempbuf[j+3],sizeof(tempbuf[j+3]));
|
||||
// ud.savegame[g_lastSaveSlot][j+4] = '\0';
|
||||
Bmemcpy(&ud.savegame[g_lastSaveSlot][4],&tempbuf[3],sizeof(tempbuf[0])*13);
|
||||
ud.savegame[g_lastSaveSlot][17] = '\0';
|
||||
struct tm *timeptr = localtime(&curtime);
|
||||
Bsnprintf(ud.savegame[g_lastSaveSlot], sizeof(ud.savegame[g_lastSaveSlot]), "Auto %.4d%.2d%.2d %.2d%.2d%.2d\n",
|
||||
timeptr->tm_year + 1900, timeptr->tm_mon, timeptr->tm_mday,
|
||||
timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec);
|
||||
}
|
||||
|
||||
OSD_Printf("Saving to slot %d\n",g_lastSaveSlot);
|
||||
|
|
|
@ -65,10 +65,12 @@ G_EXTERN char g_numSkills;
|
|||
G_EXTERN char myjumpingtoggle,myonground,myhardlanding,myreturntocenter;
|
||||
G_EXTERN char pus,pub;
|
||||
G_EXTERN char ready2send;
|
||||
G_EXTERN char szPlayerName[32];
|
||||
#define MAXPLAYERNAME 32
|
||||
G_EXTERN char szPlayerName[MAXPLAYERNAME];
|
||||
// XXX: menutextbuf overflow possible?
|
||||
G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[1024];
|
||||
G_EXTERN char typebuflen,typebuf[141];
|
||||
#define TYPEBUFSIZE 141
|
||||
G_EXTERN char typebuf[TYPEBUFSIZE];
|
||||
G_EXTERN input_t avg;
|
||||
G_EXTERN input_t loc;
|
||||
G_EXTERN input_t recsync[RECSYNCBUFSIZ];
|
||||
|
|
|
@ -481,6 +481,12 @@ enum
|
|||
MAXJOYBUTTONS = (32+4),
|
||||
MAXJOYAXES = 8,
|
||||
NUMGAMEFUNCTIONS = 56,
|
||||
MAXRIDECULE = 10,
|
||||
MAXRIDECULELENGTH = 40,
|
||||
MAXSAVEGAMES = 10,
|
||||
MAXSAVEGAMENAME = 22,
|
||||
MAXPWLOCKOUT = 128,
|
||||
MAXRTSNAME = 128,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -574,9 +580,9 @@ typedef struct {
|
|||
char overhead_on,last_overhead,showweapons;
|
||||
char god,warp_on,cashman,eog,showallmap;
|
||||
char show_help,scrollmode,noclip;
|
||||
char ridecule[10][40];
|
||||
char savegame[10][22];
|
||||
char pwlockout[128],rtsname[128];
|
||||
char ridecule[MAXRIDECULE][MAXRIDECULELENGTH];
|
||||
char savegame[MAXSAVEGAMES][MAXSAVEGAMENAME];
|
||||
char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
|
||||
char display_bonus_screen;
|
||||
char show_level_text;
|
||||
} user_defs;
|
||||
|
|
|
@ -572,7 +572,7 @@ static void M_DisplaySaveGameList(void)
|
|||
rotatesprite_fs(99<<16,50<<16,65536L,512,WINDOWBORDER1,24,0,10);
|
||||
rotatesprite_fs(103<<16,144<<16,65536L,1024+512,WINDOWBORDER1,24,0,10);
|
||||
|
||||
for (x=0; x<=9; x++)
|
||||
for (x=0; x<MAXSAVEGAMES; x++)
|
||||
{
|
||||
if (ud.savegame[x][0])
|
||||
{
|
||||
|
@ -1173,7 +1173,7 @@ void M_DisplayMenus(void)
|
|||
M_ChangeMenu(MENU_PLAYER);
|
||||
probey = 7;
|
||||
}
|
||||
else if (x >= 0 && x <= 9)
|
||||
else if (x >= 0 && x < MAXRIDECULE)
|
||||
{
|
||||
strcpy(buf, ud.ridecule[x]);
|
||||
inputloc = strlen(buf);
|
||||
|
@ -1197,7 +1197,7 @@ void M_DisplayMenus(void)
|
|||
probey = last_menu_pos;
|
||||
}
|
||||
}
|
||||
for (i=0; i<10; i++)
|
||||
for (i=0; i<MAXRIDECULE; i++)
|
||||
{
|
||||
if (g_currentMenu == MENU_MACROSTYPING && i == last_menu_pos) continue;
|
||||
mgametextpal(26,40+(i<<3),ud.ridecule[i],MENUHIGHLIGHT(i),0);
|
||||
|
|
|
@ -33,7 +33,7 @@ const char *g_failedVarname;
|
|||
|
||||
extern char *bitptr;
|
||||
|
||||
uint8_t g_oldverSavegame[10];
|
||||
uint8_t g_oldverSavegame[MAXSAVEGAMES];
|
||||
|
||||
#define BITPTR_POINTER 1
|
||||
|
||||
|
@ -143,7 +143,7 @@ void ReadSaveGameHeaders(void)
|
|||
|
||||
Bstrcpy(fn, "dukesav0.esv");
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
for (i=0; i<MAXSAVEGAMES; i++)
|
||||
{
|
||||
int32_t k;
|
||||
|
||||
|
@ -176,6 +176,8 @@ int32_t G_LoadSaveHeaderNew(int32_t spot, savehead_t *saveh)
|
|||
char fn[16];
|
||||
int32_t fil, screenshotofs, i;
|
||||
|
||||
Bassert(spot < MAXSAVEGAMES);
|
||||
|
||||
Bstrcpy(fn, "dukesav0.esv");
|
||||
fn[7] = spot + '0';
|
||||
|
||||
|
@ -228,6 +230,8 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
|
||||
savehead_t h;
|
||||
|
||||
Bassert(spot < MAXSAVEGAMES);
|
||||
|
||||
Bstrcpy(fn, "dukesav0.esv");
|
||||
fn[7] = spot + '0';
|
||||
|
||||
|
@ -347,6 +351,8 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
// char mpfn[16];
|
||||
FILE *fil;
|
||||
|
||||
Bassert(spot < MAXSAVEGAMES);
|
||||
|
||||
G_SaveTimers();
|
||||
|
||||
Bstrcpy(fn, "dukesav0.esv");
|
||||
|
@ -1232,7 +1238,7 @@ int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t
|
|||
h.skill = ud.player_skill;
|
||||
Bstrncpy(h.boardfn, currentboardfilename, sizeof(h.boardfn));
|
||||
|
||||
if (spot >= 0)
|
||||
if ((unsigned)spot < MAXSAVEGAMES)
|
||||
{
|
||||
// savegame
|
||||
Bstrncpyz(h.savename, ud.savegame[spot], sizeof(h.savename));
|
||||
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __savegame_h__
|
||||
#define __savegame_h__
|
||||
|
||||
#include "game.h"
|
||||
|
||||
#ifdef LUNATIC
|
||||
# define SV_MAJOR_VER 2
|
||||
#else
|
||||
|
@ -45,7 +47,7 @@ typedef struct
|
|||
int32_t reccnt, snapsiz;
|
||||
// 8 bytes
|
||||
|
||||
char savename[22]; // should be of the same length as ud.savegame[i]
|
||||
char savename[MAXSAVEGAMENAME];
|
||||
uint8_t numplayers, volnum, levnum, skill;
|
||||
char boardfn[256]; // BMAX_PATH
|
||||
// 282 bytes
|
||||
|
@ -76,7 +78,7 @@ extern void sv_postyaxload(void);
|
|||
// XXX: The 'bitptr' decl really belongs into gamedef.h, but we don't want to
|
||||
// pull all of it in savegame.c?
|
||||
extern char *bitptr;
|
||||
extern uint8_t g_oldverSavegame[10];
|
||||
extern uint8_t g_oldverSavegame[MAXSAVEGAMES];
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue