Skip to content

Commit

Permalink
Various 64bit and compiler warning fixes. Fixed jHexen FTBFS. Added g…
Browse files Browse the repository at this point in the history
…uards around code in /common which should not be included in jHexen. Updated /jhexen/CMakeLists.txt so src files are auto-included.
  • Loading branch information
danij committed Aug 5, 2006
1 parent ff5252b commit 17d3673
Show file tree
Hide file tree
Showing 28 changed files with 1,419 additions and 81 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/api/dd_api.h
Expand Up @@ -106,7 +106,7 @@ typedef struct {
int (*NetServerStop) (int before);
int (*NetConnect) (int before);
int (*NetDisconnect) (int before);
int (*NetPlayerEvent) (int playernum, int type, void *data);
long int (*NetPlayerEvent) (int playernum, int type, void *data);
int (*NetWorldEvent) (int type, int parm, void *data);
void (*HandlePacket) (int fromplayer, int type, void *data,
int length);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/cl_main.c
Expand Up @@ -127,7 +127,7 @@ void Cl_SendHello(void)

// The game mode is included in the hello packet.
memset(buf, 0, sizeof(buf));
strncpy(buf, gx.GetVariable(DD_GAME_MODE), sizeof(buf));
strncpy(buf, (char *) gx.GetVariable(DD_GAME_MODE), sizeof(buf));
Msg_Write(buf, 16);

Net_SendBuffer(0, SPF_ORDERED);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/con_config.c
Expand Up @@ -111,7 +111,7 @@ boolean Con_WriteState(const char *fileName)
}

fprintf(file, "# %s / Doomsday Engine " DOOMSDAY_VERSION_TEXT "\n",
gx.GetVariable(DD_GAME_ID));
(char *) gx.GetVariable(DD_GAME_ID));
fprintf(file,
"# This configuration file is generated automatically. Each line is a\n");
fprintf(file,
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/con_main.c
Expand Up @@ -2461,7 +2461,7 @@ D_CMD(Version)
Con_Printf("Doomsday Engine %s (" __TIME__ ")\n", DOOMSDAY_VERSIONTEXT);
if(gl.GetString)
Con_Printf("%s\n", gl.GetString(DGL_VERSION));
Con_Printf("Game DLL: %s\n", gx.GetVariable(DD_VERSION_LONG));
Con_Printf("Game DLL: %s\n", (char *) gx.GetVariable(DD_VERSION_LONG));
Con_Printf("http://sourceforge.net/projects/deng/\n");
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/con_start.c
Expand Up @@ -114,9 +114,9 @@ void Con_StartupDone(void)
GL_ShutdownVarFont();

// Update the secondary title and the game status.
strncpy(secondaryTitleText, gx.GetVariable(DD_GAME_ID),
strncpy(secondaryTitleText, (char *) gx.GetVariable(DD_GAME_ID),
sizeof(secondaryTitleText) - 1);
strncpy(statusText, gx.GetVariable(DD_GAME_MODE),
strncpy(statusText, (char *) gx.GetVariable(DD_GAME_MODE),
sizeof(statusText) - 1);
}

Expand Down
5 changes: 3 additions & 2 deletions doomsday/engine/portable/src/dd_main.c
Expand Up @@ -679,7 +679,8 @@ void DD_CheckQuery(int query, int parm)
case DD_TEXTURE_HEIGHT_QUERY:
queryResult = textures[parm]->height << FRACBITS;
break;

#if 0
// Unused
case DD_NET_QUERY:
switch (parm)
{
Expand All @@ -688,7 +689,7 @@ void DD_CheckQuery(int query, int parm)
break;
}
break;

#endif
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/dd_pinit.c
Expand Up @@ -99,7 +99,7 @@ void DD_ErrorBox(boolean error, char *format, ...)
void DD_MainWindowTitle(char *title)
{
sprintf(title, "Doomsday " DOOMSDAY_VERSION_TEXT " : %s",
__gx.GetVariable(DD_GAME_ID));
(char *) __gx.GetVariable(DD_GAME_ID));
}

void SetGameImports(game_import_t * imp)
Expand Down
10 changes: 5 additions & 5 deletions doomsday/engine/portable/src/def_main.c
Expand Up @@ -100,7 +100,7 @@ xgclass_t *xgClassLinks;
*/
static int GetXGClasses(void)
{
xgClassLinks = gx.GetVariable(DD_XGFUNC_LINK);
xgClassLinks = (xgclass_t *) gx.GetVariable(DD_XGFUNC_LINK);
if(!xgClassLinks)
{
memset(&nullXgClassLinks, 0, sizeof(nullXgClassLinks));
Expand Down Expand Up @@ -342,7 +342,7 @@ acfnptr_t Def_GetActionPtr(char *name)
{
// Action links are provided by the Game, who owns the actual
// action functions.
actionlink_t *link = gx.GetVariable(DD_ACTION_LINK);
actionlink_t *link = (actionlink_t *) gx.GetVariable(DD_ACTION_LINK);

if(!name || !name[0])
return 0;
Expand Down Expand Up @@ -1477,7 +1477,7 @@ int Def_Get(int type, char *id, void *out)

case DD_DEF_LINE_TYPE:
for(i = defs.count.lines.num - 1; i >= 0; i--)
if(defs.lines[i].id == (int) id)
if(defs.lines[i].id == strtol(id, (char **)NULL, 10))
{
if(out)
Def_CopyLineType(out, &defs.lines[i]);
Expand All @@ -1487,7 +1487,7 @@ int Def_Get(int type, char *id, void *out)

case DD_DEF_SECTOR_TYPE:
for(i = defs.count.sectors.num - 1; i >= 0; i--)
if(defs.sectors[i].id == (int) id)
if(defs.sectors[i].id == strtol(id, (char **)NULL, 10))
{
if(out)
Def_CopySectorType(out, &defs.sectors[i]);
Expand Down Expand Up @@ -1552,7 +1552,7 @@ int Def_Set(int type, int index, int value, void *ptr)
break;

case DD_CD_TRACK:
musdef->cdtrack = (int) ptr;
musdef->cdtrack = *(int *) ptr;
break;
}
// If the def was just created, return its index.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/def_read.c
Expand Up @@ -634,7 +634,7 @@ boolean DED_CheckCondition(const char *cond, boolean expected)
else if(isalnum(cond[0]))
{
// Then it must be a game mode.
value = !stricmp(cond, gx.GetVariable(DD_GAME_MODE));
value = !stricmp(cond, (char *) gx.GetVariable(DD_GAME_MODE));
}

return value == expected;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/edit_bias.c
Expand Up @@ -418,7 +418,7 @@ static boolean SBE_Save(const char *name)

// Since there can be quite a lot of these, make sure we'll skip
// the ones that are definitely not suitable.
fprintf(file, "SkipIf Not %s\n", gx.GetVariable(DD_GAME_MODE));
fprintf(file, "SkipIf Not %s\n", (char *) gx.GetVariable(DD_GAME_MODE));

s = SB_GetSource(0);
for(i = 0; i < numSources; ++i, ++s)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/p_data.c
Expand Up @@ -558,7 +558,7 @@ boolean P_CheckLevel(char *levelID, boolean silent)
{
int i, printCount;
boolean canContinue = !numMissingFronts;
boolean hasErrors = (numBadTexNames != 0 || numMissingFronts != 0);
// boolean hasErrors = (numBadTexNames != 0 || numMissingFronts != 0);

Con_Message("P_CheckLevel: Checking %s for errors...\n", levelID);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/p_particle.c
Expand Up @@ -729,7 +729,7 @@ fixed_t P_GetParticleZ(particle_t *pt)
void P_SpinParticle(ptcgen_t *gen, particle_t *pt)
{
ded_ptcstage_t *stDef = gen->def->stages + pt->stage;
uint index = pt - gen->ptcs + (int) gen / 8;
uint index = pt - gen->ptcs + (int) gen / 8; // DJS - skyjake, what does this do?
static int yawSigns[4] = { 1, 1, -1, -1 };
static int pitchSigns[4] = { 1, -1, 1, -1 };
int yawSign, pitchSign;
Expand Down
11 changes: 7 additions & 4 deletions doomsday/engine/portable/src/r_world.c
Expand Up @@ -365,7 +365,9 @@ void R_ConvexClipper(subsector_t *ssec, int num, divline_t * list)

if(!numedgepoints)
{
printf("All clipped away: subsector %i\n", GET_SUBSECTOR_IDX(ssec));
int idx = GET_SUBSECTOR_IDX(ssec);

printf("All clipped away: subsector %i\n", idx);
ssec->numverts = 0;
ssec->verts = 0;
//ssec->origverts = 0;
Expand Down Expand Up @@ -1313,12 +1315,13 @@ void R_RationalizeSectors(void)
else
vown = &vertexowners[GET_VERTEX_IDX(collectedLines[n]->v2)];

if(vown->numlines > 2)
if(vown && vown->numlines > 2)
{
for(o = 0; o <= vown->numlines && !found; ++o)
{
lcand = LINE_PTR(vown->linelist[o]);
if(lcand->frontsector && lcand->backsector &&
if(lcand &&
lcand->frontsector && lcand->backsector &&
lcand->frontsector == lcand->backsector &&
lcand->frontsector == sec)
{
Expand Down Expand Up @@ -2251,7 +2254,7 @@ const char *R_GetUniqueLevelID(void)
sprintf(uid, "%s|%s|%s|%s",
R_GetCurrentLevelID(),
base, (W_IsFromIWAD(lump) ? "iwad" : "pwad"),
gx.GetVariable(DD_GAME_MODE));
(char *) gx.GetVariable(DD_GAME_MODE));

strlwr(uid);
return uid;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/rend_fakeradio.c
Expand Up @@ -651,7 +651,7 @@ void Rend_RadioWallSection(const seg_t *seg, rendpoly_t *origQuad)
sector_t *backSector;
float bFloor, bCeil, limit, size, segOffset;
rendpoly_t quad, *q = &quad;
int i, texture, sideNum;
int i, texture = 0, sideNum;
lineinfo_t *info;
lineinfo_side_t *sInfo;
shadowcorner_t topCn[2], botCn[2], sideCn[2];
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/f_infine.c
Expand Up @@ -1961,7 +1961,7 @@ void FIC_If(void)
// Generic game mode string checking.
else if(!strnicmp(fi_token, "mode:", 5))
{
val = !stricmp(fi_token + 5, G_GetVariable(DD_GAME_MODE));
val = !stricmp(fi_token + 5, (char *) G_GetVariable(DD_GAME_MODE));
}
#if __JDOOM__
// Game modes.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/g_game.c
Expand Up @@ -2333,7 +2333,7 @@ void G_DoScreenShot(void)
char *numPos;

// Use game mode as the file name base.
sprintf(name, "%s-", G_GetVariable(DD_GAME_MODE));
sprintf(name, "%s-", (char *) G_GetVariable(DD_GAME_MODE));
numPos = name + strlen(name);

// Find an unused file name.
Expand Down
23 changes: 14 additions & 9 deletions doomsday/plugins/common/src/p_saveg.c
Expand Up @@ -18,8 +18,11 @@
/*
* p_saveg.c: Save Game I/O
*
* Compiles for jDoom and jHeretic
*/

#if __JDOOM__ || __JHERETIC__

// HEADER FILES ------------------------------------------------------------

#include <lzss.h>
Expand Down Expand Up @@ -1472,7 +1475,7 @@ static int SV_ReadCeiling(ceiling_t* ceiling)

if(hdr.version >= 5)
{ // Note: the thinker class byte has already been read.
int ver = SV_ReadByte(); // version byte.
/*int ver =*/ SV_ReadByte(); // version byte.

// Should we set the function?
if(SV_ReadByte())
Expand Down Expand Up @@ -1559,7 +1562,7 @@ static int SV_ReadDoor(vldoor_t* door)

if(hdr.version >= 5)
{ // Note: the thinker class byte has already been read.
int ver = SV_ReadByte(); // version byte.
/*int ver =*/ SV_ReadByte(); // version byte.

door->type = (vldoor_e) SV_ReadByte();

Expand Down Expand Up @@ -1638,7 +1641,7 @@ static int SV_ReadFloor(floormove_t* floor)

if(hdr.version >= 5)
{ // Note: the thinker class byte has already been read.
int ver = SV_ReadByte(); // version byte.
/*int ver =*/ SV_ReadByte(); // version byte.

floor->type = (floor_e) SV_ReadByte();

Expand Down Expand Up @@ -1726,7 +1729,7 @@ static int SV_ReadPlat(plat_t* plat)

if(hdr.version >= 5)
{ // Note: the thinker class byte has already been read.
int ver = SV_ReadByte(); // version byte.
/*int ver =*/ SV_ReadByte(); // version byte.

// Should we set the function?
if(SV_ReadByte())
Expand Down Expand Up @@ -1814,7 +1817,7 @@ static int SV_ReadFlash(lightflash_t* flash)

if(hdr.version >= 5)
{ // Note: the thinker class byte has already been read.
int ver = SV_ReadByte(); // version byte.
/*int ver =*/ SV_ReadByte(); // version byte.

sector = P_ToPtr(DMU_SECTOR, SV_ReadLong());

Expand Down Expand Up @@ -1880,7 +1883,7 @@ static int SV_ReadStrobe(strobe_t* strobe)

if(hdr.version >= 5)
{ // Note: the thinker class byte has already been read.
int ver = SV_ReadByte(); // version byte.
/*int ver =*/ SV_ReadByte(); // version byte.

sector = P_ToPtr(DMU_SECTOR, SV_ReadLong());

Expand Down Expand Up @@ -1944,7 +1947,7 @@ static int SV_ReadGlow(glow_t* glow)

if(hdr.version >= 5)
{ // Note: the thinker class byte has already been read.
int ver = SV_ReadByte(); // version byte.
/*int ver =*/ SV_ReadByte(); // version byte.

sector = P_ToPtr(DMU_SECTOR, SV_ReadLong());

Expand Down Expand Up @@ -2004,8 +2007,8 @@ static void SV_WriteFlicker(fireflicker_t* flicker)
*/
static int SV_ReadFlicker(fireflicker_t* flicker)
{
int ver = SV_ReadByte(); // version byte.
sector_t* sector;
/*int ver =*/ SV_ReadByte(); // version byte.

// Note: the thinker class byte has already been read.
sector = P_ToPtr(DMU_SECTOR, SV_ReadLong());
Expand Down Expand Up @@ -2322,7 +2325,7 @@ void SV_Init(void)
else
{
// Use the default path.
sprintf(save_path, "savegame\\%s\\", G_GetVariable(DD_GAME_MODE));
sprintf(save_path, "savegame\\%s\\", (char *) G_GetVariable(DD_GAME_MODE));
}

// Build the client save path.
Expand Down Expand Up @@ -2679,3 +2682,5 @@ void SV_LoadClient(unsigned int gameid)

return;
}

#endif
12 changes: 10 additions & 2 deletions doomsday/plugins/common/src/p_xgfile.c
Expand Up @@ -19,8 +19,11 @@
* p_xgfile.c: Extended Generalized Line Types.
*
* Writes XG data to file. Parses DD_XGDATA lumps
* Compiles for jDoom and jHeretic
*/

#if __JDOOM__ || __JHERETIC__

// HEADER FILES ------------------------------------------------------------

#if __JDOOM__
Expand Down Expand Up @@ -178,6 +181,7 @@ void XG_WriteTypes(FILE * f)
{
int i, k;
int linecount = 0, sectorcount = 0;
char buff[5];
linetype_t line;
sectortype_t sec;

Expand All @@ -191,7 +195,8 @@ void XG_WriteTypes(FILE * f)
// This is a very simple way to get the definitions.
for(i = 1; i < 65536; i++)
{
if(!Def_Get(DD_DEF_LINE_TYPE, (char *) i, &line))
memset(buff, 0, sizeof(buff));
if(!Def_Get(DD_DEF_LINE_TYPE, itoa(i, &buff[0], 10), &line))
continue;

linecount++;
Expand Down Expand Up @@ -236,7 +241,8 @@ void XG_WriteTypes(FILE * f)
// Then the sectors.
for(i = 1; i < 65536; i++)
{
if(!Def_Get(DD_DEF_SECTOR_TYPE, (char *) i, &sec))
memset(buff, 0, sizeof(buff));
if(!Def_Get(DD_DEF_SECTOR_TYPE, itoa(i, &buff[0], 10), &sec))
continue;

sectorcount++;
Expand Down Expand Up @@ -475,3 +481,5 @@ sectortype_t *XG_GetLumpSector(int id)
return sectypes + i;
return NULL; // Not found.
}

#endif

0 comments on commit 17d3673

Please sign in to comment.