Commit 06648dab authored by Steven Fuller's avatar Steven Fuller

Now compile with -Wall -pedantic. Now compiles without warnings except one

set of warnings (all the same thing).

Fixed small bug with the ceiling/floor code.
parent b8f18ac7
CC = gcc
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
CFLAGS = -g -Wall
#CFLAGS = -g -Wall -pedantic
#CFLAGS = -g -Wall
CFLAGS = -g -Wall -pedantic
#CFLAGS = -Os -Wall
#CFLAGS = -Os -Wall -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
......
......@@ -926,7 +926,7 @@ memptr PM_GetPage(int pagenum)
// Calls the update function after each load, indicating the current
// page, and the total pages that need to be loaded (for thermometer).
//
void PM_Preload(boolean (*update)(word current, word total))
void PM_Preload(boolean (*update)(int current, int total))
{
int i;
......
......@@ -77,7 +77,7 @@ extern PageListStruct *PMPages;
void PM_Startup();
void PM_Shutdown();
void PM_Preload(boolean (*update)(word current,word total));
void PM_Preload(boolean (*update)(int current, int total));
memptr PM_GetPage(int pagenum);
......
......@@ -31,7 +31,7 @@ void VL_DirectPlotFlush();
#define MaxJoys 2
#define NumCodes 128
typedef byte ScanCode;
typedef int8_t ScanCode;
#define sc_None 0
#define sc_Bad 0xff
......
......@@ -258,7 +258,7 @@ void VL_Startup()
gb = (char *)malloc(320);
imgtmp = XCreateImage(dpy, vi->visual, vi->depth, ZPixmap, 0,
gfxbuf, 16, 1, 8, 16*4);
gb, 16, 1, 8, 16*4);
if (gfxbuf == NULL)
gfxbuf = malloc(vwidth * vheight * 1);
......
......@@ -11,7 +11,6 @@
statobj_t statobjlist[MAXSTATS], *laststatobj;
struct
{
int picnum;
......@@ -26,9 +25,6 @@ struct
{SPR_STAT_5,block}, // Hanged man "
{SPR_STAT_6,bo_alpo}, // Bad food "
{SPR_STAT_7,block}, // Red pillar "
//
// NEW PAGE
//
{SPR_STAT_8,block}, // Tree spr2v
{SPR_STAT_9}, // Skeleton flat "
{SPR_STAT_10,block}, // Sink " (SOD:gibs)
......@@ -36,14 +32,13 @@ struct
{SPR_STAT_12,block}, // Urn "
{SPR_STAT_13,block}, // Bare table "
{SPR_STAT_14}, // Ceiling light "
#ifndef SPEAR
{SPR_STAT_15}, // Kitchen stuff "
#else
{SPR_STAT_15,block}, // Gibs!
#endif
//
// NEW PAGE
//
{SPR_STAT_16,block}, // suit of armor spr3v
{SPR_STAT_17,block}, // Hanging cage "
{SPR_STAT_18,block}, // SkeletoninCage "
......@@ -52,9 +47,6 @@ struct
{SPR_STAT_21,bo_key2}, // Key 2 "
{SPR_STAT_22,block}, // stuff (SOD:gibs)
{SPR_STAT_23}, // stuff
//
// NEW PAGE
//
{SPR_STAT_24,bo_food}, // Good food spr4v
{SPR_STAT_25,bo_firstaid}, // First aid "
{SPR_STAT_26,bo_clip}, // Clip "
......@@ -63,9 +55,6 @@ struct
{SPR_STAT_29,bo_cross}, // Cross "
{SPR_STAT_30,bo_chalice}, // Chalice "
{SPR_STAT_31,bo_bible}, // Bible "
//
// NEW PAGE
//
{SPR_STAT_32,bo_crown}, // crown spr5v
{SPR_STAT_33,bo_fullheal}, // one up "
{SPR_STAT_34,bo_gibs}, // gibs "
......@@ -74,31 +63,27 @@ struct
{SPR_STAT_37,block}, // Empty well "
{SPR_STAT_38,bo_gibs}, // Gibs 2 "
{SPR_STAT_39,block}, // flag "
//
// NEW PAGE
//
#ifndef SPEAR
{SPR_STAT_40,block}, // Call Apogee spr7v
#else
{SPR_STAT_40}, // Red light
#endif
//
// NEW PAGE
//
{SPR_STAT_41}, // junk "
{SPR_STAT_42}, // junk "
{SPR_STAT_43}, // junk "
#ifndef SPEAR
{SPR_STAT_44}, // pots "
#else
{SPR_STAT_44,block}, // Gibs!
#endif
{SPR_STAT_45,block}, // stove " (SOD:gibs)
{SPR_STAT_46,block}, // spears " (SOD:gibs)
{SPR_STAT_47}, // vines "
//
// NEW PAGE
//
#ifdef SPEAR
{SPR_STAT_48,block}, // marble pillar
{SPR_STAT_49,bo_25clip}, // bonus 25 clip
......@@ -255,7 +240,7 @@ Open doors conect two areas, so sounds will travel between them and sight
Areaconnect is incremented/decremented by each door. If >0 they connect
Every time a door opens or closes the areabyplayer matrix gets recalculated.
An area is true if it connects with the player's current spor.
An area is true if it connects with the player's current spot.
=============================================================================
*/
......@@ -265,9 +250,8 @@ Every time a door opens or closes the areabyplayer matrix gets recalculated.
doorobj_t doorobjlist[MAXDOORS],*lastdoorobj;
int doornum;
unsigned doorposition[MAXDOORS]; // leading edge of door 0=closed
// 0xffff = fully open
unsigned doorposition[MAXDOORS]; // leading edge of door 0=closed
// 0xffff = fully open
byte areaconnect[NUMAREAS][NUMAREAS];
boolean areabyplayer[NUMAREAS];
......@@ -724,7 +708,7 @@ void PushWall(int checkx, int checky, int dir)
case di_north:
if (actorat[checkx][checky-1])
{
SD_PlaySound (NOWAYSND);
SD_PlaySound(NOWAYSND);
return;
}
(unsigned)actorat[checkx][checky-1] =
......@@ -734,7 +718,7 @@ void PushWall(int checkx, int checky, int dir)
case di_east:
if (actorat[checkx+1][checky])
{
SD_PlaySound (NOWAYSND);
SD_PlaySound(NOWAYSND);
return;
}
(unsigned)actorat[checkx+1][checky] =
......@@ -744,7 +728,7 @@ void PushWall(int checkx, int checky, int dir)
case di_south:
if (actorat[checkx][checky+1])
{
SD_PlaySound (NOWAYSND);
SD_PlaySound(NOWAYSND);
return;
}
(unsigned)actorat[checkx][checky+1] =
......@@ -754,7 +738,7 @@ void PushWall(int checkx, int checky, int dir)
case di_west:
if (actorat[checkx-1][checky])
{
SD_PlaySound (NOWAYSND);
SD_PlaySound(NOWAYSND);
return;
}
(unsigned)actorat[checkx-1][checky] =
......@@ -771,7 +755,7 @@ void PushWall(int checkx, int checky, int dir)
tilemap[pwallx][pwally] |= 0xc0;
*(mapsegs[1]+farmapylookup[pwally]+pwallx) = 0; // remove P tile info
SD_PlaySound (PUSHWALLSND);
SD_PlaySound(PUSHWALLSND);
}
......
......@@ -791,7 +791,7 @@ extern int controlx,controly; // range from -100 to 100
extern boolean buttonstate[NUMBUTTONS];
extern boolean demorecord,demoplayback;
extern char *demoptr, *lastdemoptr;
extern byte *demoptr, *lastdemoptr;
extern memptr demobuffer;
......
......@@ -39,10 +39,11 @@ static void AsmRefresh();
#ifndef NOASM
#define FixedByFrac(x, y) \
({ unsigned long z; \
asm("imull %2; shrdl $16, %%edx, %%eax" : "=a" (z) : "a" (x), "q" (y) : "%edx"); \
z; \
})
__extension__ \
({ unsigned long z; \
asm("imull %2; shrdl $16, %%edx, %%eax" : "=a" (z) : "a" (x), "q" (y) : "%edx"); \
z; \
})
#endif
void ScaleShape(int xcenter, int shapenum, unsigned height);
......@@ -157,7 +158,6 @@ static boolean TransformTile(int tx, int ty, int *dispx, int *dispheight)
gyt = FixedByFrac(gy,viewcos);
ny = gyt+gxt;
//
// calculate perspective ratio
//
......@@ -180,44 +180,8 @@ static boolean TransformTile(int tx, int ty, int *dispx, int *dispheight)
return false;
}
/* ======================================================================== */
static unsigned int Ceiling[]=
{
#ifndef SPEAR
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xbfbf,
0x4e4e,0x4e4e,0x4e4e,0x1d1d,0x8d8d,0x4e4e,0x1d1d,0x2d2d,0x1d1d,0x8d8d,
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x2d2d,0xdddd,0x1d1d,0x1d1d,0x9898,
0x1d1d,0x9d9d,0x2d2d,0xdddd,0xdddd,0x9d9d,0x2d2d,0x4d4d,0x1d1d,0xdddd,
0x7d7d,0x1d1d,0x2d2d,0x2d2d,0xdddd,0xd7d7,0x1d1d,0x1d1d,0x1d1d,0x2d2d,
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xdddd,0xdddd,0x7d7d,0xdddd,0xdddd,0xdddd
#else
0x6f6f,0x4f4f,0x1d1d,0xdede,0xdfdf,0x2e2e,0x7f7f,0x9e9e,0xaeae,0x7f7f,
0x1d1d,0xdede,0xdfdf,0xdede,0xdfdf,0xdede,0xe1e1,0xdcdc,0x2e2e,0x1d1d,0xdcdc
#endif
};
/*
=====================
=
= ClearScreen
=
=====================
*/
static void ClearScreen()
{
unsigned int ceiling = Ceiling[gamestate.episode*10+mapon] & 0xFF;
unsigned int floor = 0x19;
VL_Bar(xoffset, yoffset, viewwidth, viewheight / 2, ceiling);
VL_Bar(xoffset, yoffset + viewheight / 2, viewwidth, viewheight / 2, floor);
}
//==========================================================================
/*
=====================
=
......@@ -467,20 +431,20 @@ static int spanstart[MAXVIEWHEIGHT/2];
static fixed basedist[MAXVIEWHEIGHT/2];
static unsigned char planepics[8192]; /* 4k of ceiling, 4k of floor */
static byte planepics[8192]; /* 4k of ceiling, 4k of floor */
static int halfheight = 0;
static byte *planeylookup[MAXVIEWHEIGHT/2];
static unsigned mirrorofs[MAXVIEWHEIGHT/2];
static unsigned short int mr_rowofs;
static unsigned short int mr_count;
static int mr_rowofs;
static int mr_count;
static unsigned short int mr_xstep;
static unsigned short int mr_ystep;
static unsigned short int mr_xfrac;
static unsigned short int mr_yfrac;
static char *mr_dest;
static byte *mr_dest;
static void MapRow()
{
......@@ -628,6 +592,41 @@ void DrawPlanes()
/* ======================================================================== */
static unsigned int Ceiling[]=
{
#ifndef SPEAR
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xbfbf,
0x4e4e,0x4e4e,0x4e4e,0x1d1d,0x8d8d,0x4e4e,0x1d1d,0x2d2d,0x1d1d,0x8d8d,
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x2d2d,0xdddd,0x1d1d,0x1d1d,0x9898,
0x1d1d,0x9d9d,0x2d2d,0xdddd,0xdddd,0x9d9d,0x2d2d,0x4d4d,0x1d1d,0xdddd,
0x7d7d,0x1d1d,0x2d2d,0x2d2d,0xdddd,0xd7d7,0x1d1d,0x1d1d,0x1d1d,0x2d2d,
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xdddd,0xdddd,0x7d7d,0xdddd,0xdddd,0xdddd
#else
0x6f6f,0x4f4f,0x1d1d,0xdede,0xdfdf,0x2e2e,0x7f7f,0x9e9e,0xaeae,0x7f7f,
0x1d1d,0xdede,0xdfdf,0xdede,0xdfdf,0xdede,0xe1e1,0xdcdc,0x2e2e,0x1d1d,0xdcdc
#endif
};
/*
=====================
=
= ClearScreen
=
=====================
*/
static void ClearScreen()
{
unsigned int ceiling = Ceiling[gamestate.episode*10+mapon] & 0xFF;
unsigned int floor = 0x19;
VL_Bar(xoffset, yoffset, viewwidth, viewheight / 2, ceiling);
VL_Bar(xoffset, yoffset + viewheight / 2, viewwidth, viewheight / 2, floor);
}
/* ======================================================================== */
/*
========================
=
......
......@@ -681,9 +681,9 @@ void DrawPlayScreen()
void StartDemoRecord(int levelnumber)
{
MM_GetPtr(&demobuffer,MAXDEMOSIZE);
MM_GetPtr(&demobuffer, MAXDEMOSIZE);
MM_SetLock(&demobuffer,true);
demoptr = (char *)demobuffer;
demoptr = (byte *)demobuffer;
lastdemoptr = demoptr+MAXDEMOSIZE;
*demoptr = levelnumber;
......@@ -707,10 +707,12 @@ void FinishDemoRecord()
demorecord = false;
length = demoptr - (char *)demobuffer;
length = demoptr - (byte *)demobuffer;
demoptr = ((char *)demobuffer)+1;
*(word *)demoptr = length;
demoptr = ((byte *)demobuffer)+1;
demoptr[0] = length & 0xFF;
demoptr[1] = (length >> 8) & 0xFF;
CenterWindow(24,3);
PrintY+=6;
......@@ -821,14 +823,14 @@ void PlayDemo(int demonumber)
NewGame (1,0);
gamestate.mapon = *demoptr++;
gamestate.difficulty = gd_hard;
length = *((word *)demoptr)++;
demoptr++;
length = demoptr[0] | (demoptr[1] << 8); // *((word *)demoptr)++;
demoptr += 3;
lastdemoptr = demoptr-4+length;
VW_FadeOut ();
VW_FadeOut();
SETFONTCOLOR(0,15);
DrawPlayScreen ();
DrawPlayScreen();
VW_UpdateScreen(); /* force redraw */
VW_FadeIn();
......@@ -837,10 +839,10 @@ void PlayDemo(int demonumber)
demoplayback = true;
SetupGameLevel ();
StartMusic ();
StartMusic();
fizzlein = true;
PlayLoop ();
PlayLoop();
CA_UnCacheGrChunk(dems[demonumber]);
......@@ -862,13 +864,13 @@ int PlayDemoFromFile(char *demoname)
}
MM_SetLock(&demobuffer,true);
demoptr = (char *)demobuffer;
demoptr = (byte *)demobuffer;
NewGame(1,0);
gamestate.mapon = *demoptr++;
gamestate.difficulty = gd_hard;
length = *((word *)demoptr)++;
demoptr++;
length = demoptr[0] | (demoptr[1] << 8); // *((word *)demoptr)++;
demoptr += 3;
lastdemoptr = demoptr-4+length;
VW_FadeOut();
......@@ -1132,16 +1134,16 @@ startplayloop:
#ifdef SPEARDEMO
if (gamestate.mapon == 1)
{
died = true; // don't "get psyched!"
died = true; // don't "get psyched!"
VW_FadeOut ();
VW_FadeOut();
ClearMemory ();
ClearMemory();
CheckHighScore (gamestate.score,gamestate.mapon+1);
CheckHighScore(gamestate.score,gamestate.mapon+1);
strcpy(MainMenu[viewscores].string,STR_VS);
MainMenu[viewscores].routine = (void *)CP_ViewScores;
MainMenu[viewscores].routine = (MenuFunc)CP_ViewScores;
return;
}
......@@ -1209,7 +1211,7 @@ startplayloop:
CheckHighScore(gamestate.score,gamestate.mapon+1);
strcpy(MainMenu[viewscores].string,STR_VS);
MainMenu[viewscores].routine = (void *)CP_ViewScores;
MainMenu[viewscores].routine = (MenuFunc)CP_ViewScores;
return;
......@@ -1229,7 +1231,7 @@ startplayloop:
CheckHighScore(gamestate.score,gamestate.mapon+1);
strcpy(MainMenu[viewscores].string,STR_VS);
MainMenu[viewscores].routine = (void *)CP_ViewScores;
MainMenu[viewscores].routine = (MenuFunc)CP_ViewScores;
return;
......
......@@ -856,7 +856,7 @@ void LevelCompleted()
=================
*/
boolean PreloadUpdate(unsigned current, unsigned total)
boolean PreloadUpdate(int current, int total)
{
int w = WindowW - 10;
......@@ -887,8 +887,8 @@ void PreloadGraphics()
VW_UpdateScreen();
VW_FadeIn();
PM_Preload((void *)PreloadUpdate);
IN_UserInput (70);
PM_Preload(PreloadUpdate);
IN_UserInput(70);
VW_FadeOut();
DrawPlayBorder();
......
......@@ -260,8 +260,12 @@ int ReadConfig()
MainMenu[readthis].active = 1;
MainItems.curpos = 0;
#endif
} else {
viewsize = 15;
}
viewsize = 15;
mouseenabled = false;
joystickenabled = false;
......
......@@ -46,16 +46,16 @@ CP_iteminfo
CP_itemtype
MainMenu[]=
{
{1,STR_NG,(void *)CP_NewGame},
{1,STR_SD,(void *)CP_Sound},
{1,STR_CL,(void *)CP_Control},
{1,STR_LG,(void *)CP_LoadGame},
{0,STR_SG,(void *)CP_SaveGame},
{1,STR_CV,(void *)CP_ChangeView},
{1,STR_NG,(MenuFunc)CP_NewGame},
{1,STR_SD,(MenuFunc)CP_Sound},
{1,STR_CL,(MenuFunc)CP_Control},
{1,STR_LG,(MenuFunc)CP_LoadGame},
{0,STR_SG,(MenuFunc)CP_SaveGame},
{1,STR_CV,(MenuFunc)CP_ChangeView},
#ifdef UPLOAD
{2,"Read This!",(void *)CP_ReadThis},
{2,"Read This!",(MenuFunc)CP_ReadThis},
#endif
{1,STR_VS,(void *)CP_ViewScores},
{1,STR_VS,(MenuFunc)CP_ViewScores},
{1,STR_BD,0},
{1,STR_QT,0}
},
......@@ -82,8 +82,8 @@ CtlMenu[]=
{0,STR_JOYEN,0},
{0,STR_PORT2,0},
{0,STR_GAMEPAD,0},
{0,STR_SENS,(void *)MouseSensitivity},
{1,STR_CUSTOM,(void *)CustomControls}
{0,STR_SENS,(MenuFunc)MouseSensitivity},
{1,STR_CUSTOM,(MenuFunc)CustomControls}
},
#ifndef SPEAR
......@@ -204,7 +204,7 @@ char *IN_GetScanName(ScanCode scan)
#else
static byte
static char
*ScanNames[] = // Scan code names with single chars
{
"?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?",
......@@ -233,14 +233,14 @@ static byte
char *IN_GetScanName(ScanCode scan)
{
byte **p;
char **p;
ScanCode *s;
for (s = ExtScanCodes, p = ExtScanNames; *s; p++, s++)
for (s = (ScanCode *)ExtScanCodes, p = (char **)ExtScanNames; *s; p++, s++)
if (*s == scan)
return *p;
return ScanNames[scan];
return ScanNames[(int)scan];
}
#endif
......@@ -704,7 +704,7 @@ int CP_EndGame()
playstate = ex_died;
MainMenu[savegame].active = 0;
MainMenu[viewscores].routine= (void *)CP_ViewScores;
MainMenu[viewscores].routine = (MenuFunc)CP_ViewScores;
strcpy(MainMenu[viewscores].string,STR_VS);
return 1;
......
......@@ -94,10 +94,12 @@ typedef struct {
int x,y,amount,curpos,indent;
} CP_iteminfo;
typedef void (* MenuFunc)(int temp1);
typedef struct {
int active;
char string[36];
void (* routine)(int temp1);
MenuFunc routine;
} CP_itemtype;
typedef struct {
......
......@@ -41,7 +41,7 @@ int buttonjoy[4]={bt_attack,bt_strafe,bt_use,bt_run};
boolean buttonheld[NUMBUTTONS];
boolean demorecord,demoplayback;
char *demoptr, *lastdemoptr;
byte *demoptr, *lastdemoptr;
memptr demobuffer;
//
......
......@@ -1400,5 +1400,3 @@ boolean SightPlayer (objtype *ob)
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