ref: 0ea5739881d540d5e5d8007917ee7e17d68a57be
parent: 75f59299d005221304de2064558af2027eced6d7
author: Simon Howard <fraggle@gmail.com>
date: Sun Sep 25 16:59:22 EDT 2011
Fix special1/special2 values so that they can properly hold pointer values. This fixes Heretic under 64-bit. Subversion-branch: /branches/v2-branch Subversion-revision: 2406
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -142,6 +142,12 @@
think_t function;
} thinker_t;
+typedef union
+{
+ int i;
+ struct mobj_s *m;
+} specialval_t;
+
struct player_s;
typedef struct mobj_s
@@ -171,8 +177,8 @@
int damage; // For missiles
int flags;
int flags2; // Heretic flags
- int special1; // Special info
- int special2; // Special info
+ specialval_t special1; // Special info
+ specialval_t special2; // Special info
int health;
int movedir; // 0-7
int movecount; // when 0, select a new dir
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1013,7 +1013,7 @@
// memset(p->inventory, 0, sizeof(p->inventory));
if (p->chickenTics)
{
- p->readyweapon = p->mo->special1; // Restore weapon
+ p->readyweapon = p->mo->special1.i; // Restore weapon
p->chickenTics = 0;
}
p->messageTics = 0;
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -896,7 +896,7 @@
mo->momx = (P_Random() - P_Random()) << 10;
mo->momy = (P_Random() - P_Random()) << 10;
mo->momz = 9 * FRACUNIT;
- if (actor->special1 == 666)
+ if (actor->special1.i == 666)
{ // Extreme death crash
P_SetMobjState(actor, S_IMP_XCRASH1);
}
@@ -1020,7 +1020,7 @@
actor->flags &= ~MF_SOLID;
actor->flags |= MF_NOGRAVITY;
actor->flags2 |= MF2_FOOTCLIP;
- actor->special1 = 666; // Flag the crash routine
+ actor->special1.i = 666; // Flag the crash routine
}
//----------------------------------------------------------------------------
@@ -1056,12 +1056,12 @@
mobj_t *mo;
mobj_t oldChicken;
- actor->special1 -= tics;
- if (actor->special1 > 0)
+ actor->special1.i -= tics;
+ if (actor->special1.i > 0)
{
return (false);
}
- moType = actor->special2;
+ moType = actor->special2.i;
x = actor->x;
y = actor->y;
z = actor->z;
@@ -1076,8 +1076,8 @@
mo->flags = oldChicken.flags;
mo->health = oldChicken.health;
mo->target = oldChicken.target;
- mo->special1 = 5 * 35; // Next try in 5 seconds
- mo->special2 = moType;
+ mo->special1.i = 5 * 35; // Next try in 5 seconds
+ mo->special2.i = moType;
return (false);
}
mo->angle = oldChicken.angle;
@@ -1234,7 +1234,7 @@
//mo = P_SpawnMissile(actor, actor->target, MT_EGGFX);
if (mo != NULL)
{
- mo->special1 = (int) actor->target;
+ mo->special1.m = actor->target;
}
}
@@ -1272,7 +1272,7 @@
void A_Sor1Pain(mobj_t * actor)
{
- actor->special1 = 20; // Number of steps to walk fast
+ actor->special1.i = 20; // Number of steps to walk fast
A_Pain(actor);
}
@@ -1284,9 +1284,9 @@
void A_Sor1Chase(mobj_t * actor)
{
- if (actor->special1)
+ if (actor->special1.i)
{
- actor->special1--;
+ actor->special1.i--;
actor->tics -= 3;
}
A_Chase(actor);
@@ -1332,13 +1332,13 @@
}
if (actor->health < actor->info->spawnhealth / 3)
{ // Maybe attack again
- if (actor->special1)
+ if (actor->special1.i)
{ // Just attacked, so don't attack again
- actor->special1 = 0;
+ actor->special1.i = 0;
}
else
{ // Set state to attack again
- actor->special1 = 1;
+ actor->special1.i = 1;
P_SetMobjState(actor, S_SRCR1_ATK4);
}
}
@@ -1514,7 +1514,7 @@
void A_Sor2DthInit(mobj_t * actor)
{
- actor->special1 = 7; // Animation loop counter
+ actor->special1.i = 7; // Animation loop counter
P_Massacre(); // Kill monsters early
}
@@ -1526,7 +1526,7 @@
void A_Sor2DthLoop(mobj_t * actor)
{
- if (--actor->special1)
+ if (--actor->special1.i)
{ // Need to loop
P_SetMobjState(actor, S_SOR2_DIE4);
}
@@ -1630,13 +1630,13 @@
angle = actor->angle >> ANGLETOFINESHIFT;
actor->momx = FixedMul(MNTR_CHARGE_SPEED, finecosine[angle]);
actor->momy = FixedMul(MNTR_CHARGE_SPEED, finesine[angle]);
- actor->special1 = 35 / 2; // Charge duration
+ actor->special1.i = 35 / 2; // Charge duration
}
else if (target->z == target->floorz
&& dist < 9 * 64 * FRACUNIT && P_Random() < 220)
{ // Floor fire attack
P_SetMobjState(actor, S_MNTR_ATK3_1);
- actor->special2 = 0;
+ actor->special2.i = 0;
}
else
{ // Swing attack
@@ -1656,11 +1656,11 @@
{
mobj_t *puff;
- if (actor->special1)
+ if (actor->special1.i)
{
puff = P_SpawnMobj(actor->x, actor->y, actor->z, MT_PHOENIXPUFF);
puff->momz = 2 * FRACUNIT;
- actor->special1--;
+ actor->special1.i--;
}
else
{
@@ -1739,10 +1739,10 @@
S_StartSound(mo, sfx_minat1);
}
}
- if (P_Random() < 192 && actor->special2 == 0)
+ if (P_Random() < 192 && actor->special2.i == 0)
{
P_SetMobjState(actor, S_MNTR_ATK3_4);
- actor->special2 = 1;
+ actor->special2.i = 1;
}
}
@@ -1859,8 +1859,8 @@
if (mo != NULL)
{
mo->z -= 32 * FRACUNIT;
- mo->special1 = (int) target;
- mo->special2 = 50; // Timer for active sound
+ mo->special1.m = target;
+ mo->special2.i = 50; // Timer for active sound
mo->health = 20 * TICRATE; // Duration
S_StartSound(actor, sfx_hedat3);
}
@@ -1883,13 +1883,13 @@
actor->flags &= ~MF_MISSILE;
return;
}
- if ((actor->special2 -= 3) < 0)
+ if ((actor->special2.i -= 3) < 0)
{
- actor->special2 = 58 + (P_Random() & 31);
+ actor->special2.i = 58 + (P_Random() & 31);
S_StartSound(actor, sfx_hedat3);
}
- if (actor->special1
- && (((mobj_t *) (actor->special1))->flags & MF_SHADOW))
+ if (actor->special1.m
+ && (((mobj_t *) (actor->special1.m))->flags & MF_SHADOW))
{
return;
}
@@ -2083,7 +2083,7 @@
break;
case MT_PLAYER:
// Handle the different player death screams
- if (actor->special1 < 10)
+ if (actor->special1.i < 10)
{ // Wimpy death sound
S_StartSound(actor, sfx_plrwdth);
}
@@ -2249,12 +2249,12 @@
{
mobj_t *mo;
- if (actor->special2)
+ if (actor->special2.m)
{
- mo = (mobj_t *) actor->special2;
- if (mo->special1 > 0)
+ mo = (mobj_t *) actor->special2.m;
+ if (mo->special1.i > 0)
{
- mo->special1--;
+ mo->special1.i--;
}
}
}
@@ -2274,7 +2274,7 @@
fixed_t y;
fixed_t z;
- if (actor->special1 == MAX_GEN_PODS)
+ if (actor->special1.i == MAX_GEN_PODS)
{ // Too many generated pods
return;
}
@@ -2290,8 +2290,8 @@
P_SetMobjState(mo, S_POD_GROW1);
P_ThrustMobj(mo, P_Random() << 24, (fixed_t) (4.5 * FRACUNIT));
S_StartSound(mo, sfx_newpod);
- actor->special1++; // Increment generated pod count
- mo->special2 = (int) actor; // Link the generator to the pod
+ actor->special1.i++; // Increment generated pod count
+ mo->special2.m = actor; // Link the generator to the pod
return;
}
@@ -2598,7 +2598,7 @@
void A_CheckSkullDone(mobj_t * actor)
{
- if (actor->special2 == 666)
+ if (actor->special2.i == 666)
{
P_SetMobjState(actor, S_BLOODYSKULLX2);
}
@@ -2612,7 +2612,7 @@
void A_CheckBurnGone(mobj_t * actor)
{
- if (actor->special2 == 666)
+ if (actor->special2.i == 666)
{
P_SetMobjState(actor, S_PLAY_FDTH20);
}
--- a/src/heretic/p_inter.c
+++ b/src/heretic/p_inter.c
@@ -1060,7 +1060,7 @@
fog = P_SpawnMobj(x, y, z + TELEFOGHEIGHT, MT_TFOG);
S_StartSound(fog, sfx_telept);
chicken = P_SpawnMobj(x, y, z, MT_CHICPLAYER);
- chicken->special1 = player->readyweapon;
+ chicken->special1.i = player->readyweapon;
chicken->angle = angle;
chicken->player = player;
player->health = chicken->health = MAXCHICKENHEALTH;
@@ -1122,8 +1122,8 @@
fog = P_SpawnMobj(x, y, z + TELEFOGHEIGHT, MT_TFOG);
S_StartSound(fog, sfx_telept);
chicken = P_SpawnMobj(x, y, z, MT_CHICKEN);
- chicken->special2 = moType;
- chicken->special1 = CHICKENTICS + P_Random();
+ chicken->special2.i = moType;
+ chicken->special1.i = CHICKENTICS + P_Random();
chicken->flags |= ghost;
chicken->target = target;
chicken->angle = angle;
@@ -1453,7 +1453,7 @@
target->health -= damage;
if (target->health <= 0)
{ // Death
- target->special1 = damage;
+ target->special1.i = damage;
if (target->type == MT_POD && source && source->type != MT_POD)
{ // Make sure players get frags for chain-reaction kills
target->target = source;
--- a/src/heretic/p_mobj.c
+++ b/src/heretic/p_mobj.c
@@ -122,7 +122,7 @@
{
if (mo->type == MT_WHIRLWIND)
{
- if (++mo->special2 < 60)
+ if (++mo->special2.i < 60)
{
return;
}
@@ -227,7 +227,7 @@
angle_t angle;
mobj_t *target;
- target = (mobj_t *) actor->special1;
+ target = (mobj_t *) actor->special1.m;
if (target == NULL)
{
return (false);
@@ -234,7 +234,7 @@
}
if (!(target->flags & MF_SHOOTABLE))
{ // Target died
- actor->special1 = 0;
+ actor->special1.m = NULL;
return (false);
}
dir = P_FaceMobj(actor, target, &delta);
--- a/src/heretic/p_pspr.c
+++ b/src/heretic/p_pspr.c
@@ -1113,7 +1113,7 @@
+ (((P_Random() & 7) - 4) << 24));
if (ball)
{
- ball->special1 = 16; // tics till dropoff
+ ball->special1.i = 16; // tics till dropoff
}
}
@@ -1127,16 +1127,16 @@
{
angle_t angle;
- if (ball->special1 == 0)
+ if (ball->special1.i == 0)
{
return;
}
- ball->special1 -= 4;
- if (ball->special1 > 0)
+ ball->special1.i -= 4;
+ if (ball->special1.i > 0)
{
return;
}
- ball->special1 = 0;
+ ball->special1.i = 0;
ball->flags2 |= MF2_LOGRAV;
angle = ball->angle >> ANGLETOFINESHIFT;
ball->momx = FixedMul(7 * FRACUNIT, finecosine[angle]);
@@ -1246,7 +1246,7 @@
mo->momz = 2 * FRACUNIT + ((player->lookdir) << (FRACBITS - 5));
if (linetarget)
{
- mo->special1 = (int) linetarget;
+ mo->special1.m = linetarget;
}
}
S_StartSound(player->mo, sfx_lobsht);
@@ -1273,12 +1273,12 @@
if ((ball->z <= ball->floorz) && ball->momz)
{ // Bounce
newAngle = false;
- target = (mobj_t *) ball->special1;
+ target = (mobj_t *) ball->special1.m;
if (target)
{
if (!(target->flags & MF_SHOOTABLE))
{ // Target died
- ball->special1 = 0;
+ ball->special1.m = NULL;
}
else
{ // Seek
@@ -1295,7 +1295,7 @@
P_AimLineAttack(ball, angle, 10 * 64 * FRACUNIT);
if (linetarget && ball->target != linetarget)
{
- ball->special1 = (int) linetarget;
+ ball->special1.m = linetarget;
angle = R_PointToAngle2(ball->x, ball->y,
linetarget->x, linetarget->y);
newAngle = true;
@@ -1445,15 +1445,15 @@
// even if it exploded immediately.
if (netgame)
{ // Multi-player game
- MissileMobj->special2 = P_GetPlayerNum(player);
+ MissileMobj->special2.i = P_GetPlayerNum(player);
}
else
{ // Always use red missiles in single player games
- MissileMobj->special2 = 2;
+ MissileMobj->special2.i = 2;
}
if (linetarget)
{
- MissileMobj->special1 = (int) linetarget;
+ MissileMobj->special1.m = linetarget;
}
S_StartSound(MissileMobj, sfx_hrnpow);
}
@@ -1480,7 +1480,7 @@
int playerNum;
player_t *player;
- playerNum = netgame ? actor->special2 : 0;
+ playerNum = netgame ? actor->special2.i : 0;
if (!playeringame[playerNum])
{ // Player left the game
return;
@@ -1537,7 +1537,7 @@
if (actor->health-- == 0)
{
P_SetMobjState(actor, S_NULL);
- playerNum = netgame ? actor->special2 : 0;
+ playerNum = netgame ? actor->special2.i : 0;
if (!playeringame[playerNum])
{ // Player left the game
return;
@@ -1563,17 +1563,17 @@
}
x = actor->x + ((P_Random() & 127) - 64) * FRACUNIT;
y = actor->y + ((P_Random() & 127) - 64) * FRACUNIT;
- mo = P_SpawnMobj(x, y, ONCEILINGZ, MT_RAINPLR1 + actor->special2);
+ mo = P_SpawnMobj(x, y, ONCEILINGZ, MT_RAINPLR1 + actor->special2.i);
mo->target = actor->target;
mo->momx = 1; // Force collision detection
mo->momz = -mo->info->speed;
- mo->special2 = actor->special2; // Transfer player number
+ mo->special2.i = actor->special2.i; // Transfer player number
P_CheckMissileSpawn(mo);
- if (!(actor->special1 & 31))
+ if (!(actor->special1.i & 31))
{
S_StartSound(actor, sfx_ramrain);
}
- actor->special1++;
+ actor->special1.i++;
}
//----------------------------------------------------------------------------
@@ -1586,7 +1586,7 @@
{
if (actor->z > actor->floorz)
{
- P_SetMobjState(actor, S_RAINAIRXPLR1_1 + actor->special2);
+ P_SetMobjState(actor, S_RAINAIRXPLR1_1 + actor->special2.i);
}
else if (P_Random() < 40)
{
--- a/src/heretic/p_user.c
+++ b/src/heretic/p_user.c
@@ -404,7 +404,7 @@
player->playerstate = PST_REBORN;
// Let the mobj know the player has entered the reborn state. Some
// mobjs need to know when it's ok to remove themselves.
- player->mo->special2 = 666;
+ player->mo->special2.i = 666;
}
}
@@ -488,7 +488,7 @@
y = pmo->y;
z = pmo->z;
angle = pmo->angle;
- weapon = pmo->special1;
+ weapon = pmo->special1.i;
oldFlags = pmo->flags;
oldFlags2 = pmo->flags2;
P_SetMobjState(pmo, S_FREETARGMOBJ);
@@ -499,7 +499,7 @@
mo = P_SpawnMobj(x, y, z, MT_CHICPLAYER);
mo->angle = angle;
mo->health = player->health;
- mo->special1 = weapon;
+ mo->special1.i = weapon;
mo->player = player;
mo->flags = oldFlags;
mo->flags2 = oldFlags2;