Changed doomclassic pointer casts for 64-bit compatibility

This commit is contained in:
Felix Rueegg 2013-11-01 08:38:10 +01:00
parent 40d0623479
commit c9f19c03b8
6 changed files with 24 additions and 24 deletions

View file

@ -74,7 +74,7 @@ extern bool globalNetworking;
//
int NetbufferSize (void)
{
int size = (int)&(((doomdata_t *)0)->cmds[::g->netbuffer->numtics]);
int size = (intptr_t)&(((doomdata_t *)0)->cmds[::g->netbuffer->numtics]);
return size;
}
@ -90,7 +90,7 @@ unsigned NetbufferChecksum (void)
c = 0x1234567;
if ( globalNetworking ) {
l = (NetbufferSize () - (int)&(((doomdata_t *)0)->retransmitfrom))/4;
l = (NetbufferSize () - (intptr_t)&(((doomdata_t *)0)->retransmitfrom))/4;
for (i=0 ; i<l ; i++)
c += ((unsigned *)&::g->netbuffer->retransmitfrom)[i] * (i+1);
}

View file

@ -219,7 +219,7 @@ If you have questions concerning this license or the applicable additional terms
#define BFGCELLS 40
// p_pspr.defs end //
// p_saveg.defs begin //
#define PADSAVEP() ::g->save_p += (4 - ((int) ::g->save_p & 3)) & 3
#define PADSAVEP() ::g->save_p += (4 - ((intptr_t) ::g->save_p & 3)) & 3
// p_saveg.defs end //
// p_setup.defs begin //
#define MAX_DEATHMATCH_STARTS 10

View file

@ -104,7 +104,7 @@ void P_UnArchivePlayers (void)
if (::g->players[i]. psprites[j].state)
{
::g->players[i]. psprites[j].state
= &::g->states[ (int)::g->players[i].psprites[j].state ];
= &::g->states[ (intptr_t)::g->players[i].psprites[j].state ];
}
}
}
@ -622,14 +622,14 @@ void P_UnArchiveThinkers (void)
mobj = (mobj_t*)DoomLib::Z_Malloc(sizeof(*mobj), PU_LEVEL, NULL);
memcpy (mobj, ::g->save_p, sizeof(*mobj));
::g->save_p += sizeof(*mobj);
mobj->state = &::g->states[(int)mobj->state];
mobj->state = &::g->states[(intptr_t)mobj->state];
mobj->target = NULL;
mobj->tracer = NULL;
if (mobj->player)
{
mobj->player = &::g->players[(int)mobj->player-1];
mobj->player = &::g->players[(intptr_t)mobj->player-1];
mobj->player->mo = mobj;
}
@ -693,7 +693,7 @@ void P_UnArchiveThinkers (void)
ceiling = (ceiling_t*)DoomLib::Z_Malloc(sizeof(*ceiling), PU_LEVEL, NULL);
memcpy (ceiling, ::g->save_p, sizeof(*ceiling));
::g->save_p += sizeof(*ceiling);
ceiling->sector = &::g->sectors[(int)ceiling->sector];
ceiling->sector = &::g->sectors[(intptr_t)ceiling->sector];
ceiling->sector->specialdata = ceiling;
if (ceiling->thinker.function.acp1)
@ -708,7 +708,7 @@ void P_UnArchiveThinkers (void)
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, NULL);
memcpy (door, ::g->save_p, sizeof(*door));
::g->save_p += sizeof(*door);
door->sector = &::g->sectors[(int)door->sector];
door->sector = &::g->sectors[(intptr_t)door->sector];
door->sector->specialdata = door;
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
P_AddThinker (&door->thinker);
@ -719,7 +719,7 @@ void P_UnArchiveThinkers (void)
floor = (floormove_t*)DoomLib::Z_Malloc (sizeof(*floor), PU_LEVEL, NULL);
memcpy (floor, ::g->save_p, sizeof(*floor));
::g->save_p += sizeof(*floor);
floor->sector = &::g->sectors[(int)floor->sector];
floor->sector = &::g->sectors[(intptr_t)floor->sector];
floor->sector->specialdata = floor;
floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor;
P_AddThinker (&floor->thinker);
@ -730,7 +730,7 @@ void P_UnArchiveThinkers (void)
plat = (plat_t*)DoomLib::Z_Malloc (sizeof(*plat), PU_LEVEL, NULL);
memcpy (plat, ::g->save_p, sizeof(*plat));
::g->save_p += sizeof(*plat);
plat->sector = &::g->sectors[(int)plat->sector];
plat->sector = &::g->sectors[(intptr_t)plat->sector];
plat->sector->specialdata = plat;
if (plat->thinker.function.acp1)
@ -745,7 +745,7 @@ void P_UnArchiveThinkers (void)
fire = (fireflicker_t*)DoomLib::Z_Malloc (sizeof(*fire), PU_LEVEL, NULL);
memcpy (fire, ::g->save_p, sizeof(*fire));
::g->save_p += sizeof(*fire);
fire->sector = &::g->sectors[(int)fire->sector];
fire->sector = &::g->sectors[(intptr_t)fire->sector];
fire->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
P_AddThinker (&fire->thinker);
break;
@ -755,7 +755,7 @@ void P_UnArchiveThinkers (void)
flash = (lightflash_t*)DoomLib::Z_Malloc (sizeof(*flash), PU_LEVEL, NULL);
memcpy (flash, ::g->save_p, sizeof(*flash));
::g->save_p += sizeof(*flash);
flash->sector = &::g->sectors[(int)flash->sector];
flash->sector = &::g->sectors[(intptr_t)flash->sector];
flash->thinker.function.acp1 = (actionf_p1)T_LightFlash;
P_AddThinker (&flash->thinker);
break;
@ -765,7 +765,7 @@ void P_UnArchiveThinkers (void)
strobe = (strobe_t*)DoomLib::Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL);
memcpy (strobe, ::g->save_p, sizeof(*strobe));
::g->save_p += sizeof(*strobe);
strobe->sector = &::g->sectors[(int)strobe->sector];
strobe->sector = &::g->sectors[(intptr_t)strobe->sector];
strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
P_AddThinker (&strobe->thinker);
break;
@ -775,7 +775,7 @@ void P_UnArchiveThinkers (void)
glow = (glow_t*)DoomLib::Z_Malloc (sizeof(*glow), PU_LEVEL, NULL);
memcpy (glow, ::g->save_p, sizeof(*glow));
::g->save_p += sizeof(*glow);
glow->sector = &::g->sectors[(int)glow->sector];
glow->sector = &::g->sectors[(intptr_t)glow->sector];
glow->thinker.function.acp1 = (actionf_p1)T_Glow;
P_AddThinker (&glow->thinker);
break;
@ -949,7 +949,7 @@ void P_UnArchiveSpecials (void)
ceiling = (ceiling_t*)DoomLib::Z_Malloc(sizeof(*ceiling), PU_LEVEL, NULL);
memcpy (ceiling, ::g->save_p, sizeof(*ceiling));
::g->save_p += sizeof(*ceiling);
ceiling->sector = &::g->sectors[(int)ceiling->sector];
ceiling->sector = &::g->sectors[(intptr_t)ceiling->sector];
ceiling->sector->specialdata = ceiling;
if (ceiling->thinker.function.acp1)
@ -964,7 +964,7 @@ void P_UnArchiveSpecials (void)
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, NULL);
memcpy (door, ::g->save_p, sizeof(*door));
::g->save_p += sizeof(*door);
door->sector = &::g->sectors[(int)door->sector];
door->sector = &::g->sectors[(intptr_t)door->sector];
door->sector->specialdata = door;
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
P_AddThinker (&door->thinker);
@ -975,7 +975,7 @@ void P_UnArchiveSpecials (void)
floor = (floormove_t*)DoomLib::Z_Malloc (sizeof(*floor), PU_LEVEL, NULL);
memcpy (floor, ::g->save_p, sizeof(*floor));
::g->save_p += sizeof(*floor);
floor->sector = &::g->sectors[(int)floor->sector];
floor->sector = &::g->sectors[(intptr_t)floor->sector];
floor->sector->specialdata = floor;
floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor;
P_AddThinker (&floor->thinker);
@ -986,7 +986,7 @@ void P_UnArchiveSpecials (void)
plat = (plat_t*)DoomLib::Z_Malloc (sizeof(*plat), PU_LEVEL, NULL);
memcpy (plat, ::g->save_p, sizeof(*plat));
::g->save_p += sizeof(*plat);
plat->sector = &::g->sectors[(int)plat->sector];
plat->sector = &::g->sectors[(intptr_t)plat->sector];
plat->sector->specialdata = plat;
if (plat->thinker.function.acp1)
@ -1001,7 +1001,7 @@ void P_UnArchiveSpecials (void)
flash = (lightflash_t*)DoomLib::Z_Malloc (sizeof(*flash), PU_LEVEL, NULL);
memcpy (flash, ::g->save_p, sizeof(*flash));
::g->save_p += sizeof(*flash);
flash->sector = &::g->sectors[(int)flash->sector];
flash->sector = &::g->sectors[(intptr_t)flash->sector];
flash->thinker.function.acp1 = (actionf_p1)T_LightFlash;
P_AddThinker (&flash->thinker);
break;
@ -1011,7 +1011,7 @@ void P_UnArchiveSpecials (void)
strobe = (strobe_t*)DoomLib::Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL);
memcpy (strobe, ::g->save_p, sizeof(*strobe));
::g->save_p += sizeof(*strobe);
strobe->sector = &::g->sectors[(int)strobe->sector];
strobe->sector = &::g->sectors[(intptr_t)strobe->sector];
strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
P_AddThinker (&strobe->thinker);
break;
@ -1021,7 +1021,7 @@ void P_UnArchiveSpecials (void)
glow = (glow_t*)DoomLib::Z_Malloc (sizeof(*glow), PU_LEVEL, NULL);
memcpy (glow, ::g->save_p, sizeof(*glow));
::g->save_p += sizeof(*glow);
glow->sector = &::g->sectors[(int)glow->sector];
glow->sector = &::g->sectors[(intptr_t)glow->sector];
glow->thinker.function.acp1 = (actionf_p1)T_Glow;
P_AddThinker (&glow->thinker);
break;

View file

@ -575,7 +575,7 @@ void R_InitColormaps (void)
lump = W_GetNumForName("COLORMAP");
length = W_LumpLength (lump) + 255;
::g->colormaps = (lighttable_t*)DoomLib::Z_Malloc (length, PU_STATIC, 0);
::g->colormaps = (byte *)( ((int)::g->colormaps + 255)&~0xff);
::g->colormaps = (byte *)( ((intptr_t)::g->colormaps + 255)&~0xff);
W_ReadLump (lump,::g->colormaps);
}

View file

@ -434,7 +434,7 @@ void R_InitTranslationTables (void)
int i;
::g->translationtables = (byte*)DoomLib::Z_Malloc (256*3+255, PU_STATIC, 0);
::g->translationtables = (byte *)(( (int)::g->translationtables + 255 )& ~255);
::g->translationtables = (byte *)(( (intptr_t)::g->translationtables + 255 )& ~255);
// translate just the 16 green colors
for (i=0 ; i<256 ; i++)

View file

@ -438,7 +438,7 @@ Z_ChangeTag2
if (block->id != ZONEID)
I_Error ("Z_ChangeTag: freed a pointer without ZONEID");
if (tag >= PU_PURGELEVEL && (unsigned)block->user < 0x100)
if (tag >= PU_PURGELEVEL && (uintptr_t)block->user < 0x100)
I_Error ("Z_ChangeTag: an owner is required for purgable blocks");
block->tag = tag;