summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-09-25 20:59:22 +0000
committerSimon Howard2011-09-25 20:59:22 +0000
commit0ea5739881d540d5e5d8007917ee7e17d68a57be (patch)
tree8ca67e65f9d88bc9896c82b2a06791c80668ad47 /src
parent75f59299d005221304de2064558af2027eced6d7 (diff)
downloadchocolate-doom-0ea5739881d540d5e5d8007917ee7e17d68a57be.tar.gz
chocolate-doom-0ea5739881d540d5e5d8007917ee7e17d68a57be.tar.bz2
chocolate-doom-0ea5739881d540d5e5d8007917ee7e17d68a57be.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/heretic/doomdef.h10
-rw-r--r--src/heretic/g_game.c2
-rw-r--r--src/heretic/p_enemy.c76
-rw-r--r--src/heretic/p_inter.c8
-rw-r--r--src/heretic/p_mobj.c6
-rw-r--r--src/heretic/p_pspr.c38
-rw-r--r--src/heretic/p_user.c6
7 files changed, 76 insertions, 70 deletions
diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h
index 12290970..e379cfaf 100644
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -142,6 +142,12 @@ typedef struct thinker_s
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 @@ typedef struct mobj_s
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
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index ff5a79c3..2c2b6cc6 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1013,7 +1013,7 @@ void G_PlayerFinishLevel(int player)
// 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;
diff --git a/src/heretic/p_enemy.c b/src/heretic/p_enemy.c
index 6ad8cff0..55e0d829 100644
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -896,7 +896,7 @@ void A_ImpExplode(mobj_t * actor)
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 @@ void A_ImpXDeath1(mobj_t * actor)
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 @@ boolean P_UpdateChicken(mobj_t * actor, int tics)
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 @@ boolean P_UpdateChicken(mobj_t * actor, int tics)
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 @@ void A_MummyAttack2(mobj_t * actor)
//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_MummySoul(mobj_t * mummy)
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_Sor1Pain(mobj_t * actor)
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 @@ void A_Srcr1Attack(mobj_t * actor)
}
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_GenWizard(mobj_t * actor)
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_Sor2DthInit(mobj_t * actor)
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 @@ void A_MinotaurDecide(mobj_t * actor)
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 @@ void A_MinotaurCharge(mobj_t * actor)
{
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 @@ void A_MinotaurAtk3(mobj_t * actor)
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 @@ void A_HeadAttack(mobj_t * actor)
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 @@ void A_WhirlwindSeek(mobj_t * actor)
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 @@ void A_Scream(mobj_t * actor)
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 @@ void A_RemovePod(mobj_t * actor)
{
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 @@ void A_MakePod(mobj_t * actor)
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 @@ void A_MakePod(mobj_t * actor)
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_CheckSkullFloor(mobj_t * actor)
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_CheckSkullDone(mobj_t * actor)
void A_CheckBurnGone(mobj_t * actor)
{
- if (actor->special2 == 666)
+ if (actor->special2.i == 666)
{
P_SetMobjState(actor, S_PLAY_FDTH20);
}
diff --git a/src/heretic/p_inter.c b/src/heretic/p_inter.c
index afdb37f2..0e7b24b8 100644
--- a/src/heretic/p_inter.c
+++ b/src/heretic/p_inter.c
@@ -1060,7 +1060,7 @@ boolean P_ChickenMorphPlayer(player_t * player)
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 @@ boolean P_ChickenMorph(mobj_t * actor)
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 @@ void P_DamageMobj
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;
diff --git a/src/heretic/p_mobj.c b/src/heretic/p_mobj.c
index e07ecf45..59681f86 100644
--- a/src/heretic/p_mobj.c
+++ b/src/heretic/p_mobj.c
@@ -122,7 +122,7 @@ void P_ExplodeMissile(mobj_t * mo)
{
if (mo->type == MT_WHIRLWIND)
{
- if (++mo->special2 < 60)
+ if (++mo->special2.i < 60)
{
return;
}
@@ -227,14 +227,14 @@ boolean P_SeekerMissile(mobj_t * actor, angle_t thresh, angle_t turnMax)
angle_t angle;
mobj_t *target;
- target = (mobj_t *) actor->special1;
+ target = (mobj_t *) actor->special1.m;
if (target == NULL)
{
return (false);
}
if (!(target->flags & MF_SHOOTABLE))
{ // Target died
- actor->special1 = 0;
+ actor->special1.m = NULL;
return (false);
}
dir = P_FaceMobj(actor, target, &delta);
diff --git a/src/heretic/p_pspr.c b/src/heretic/p_pspr.c
index bd47c9a1..c0abf559 100644
--- a/src/heretic/p_pspr.c
+++ b/src/heretic/p_pspr.c
@@ -1113,7 +1113,7 @@ void A_FireMacePL1(player_t * player, pspdef_t * psp)
+ (((P_Random() & 7) - 4) << 24));
if (ball)
{
- ball->special1 = 16; // tics till dropoff
+ ball->special1.i = 16; // tics till dropoff
}
}
@@ -1127,16 +1127,16 @@ void A_MacePL1Check(mobj_t * ball)
{
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 @@ void A_FireMacePL2(player_t * player, pspdef_t * psp)
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 @@ void A_DeathBallImpact(mobj_t * ball)
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 @@ void A_DeathBallImpact(mobj_t * ball)
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 @@ void A_FireSkullRodPL2(player_t * player, pspdef_t * psp)
// 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 @@ void A_AddPlayerRain(mobj_t * actor)
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 @@ void A_SkullRodStorm(mobj_t * actor)
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 @@ void A_SkullRodStorm(mobj_t * actor)
}
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 @@ void A_RainImpact(mobj_t * actor)
{
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)
{
diff --git a/src/heretic/p_user.c b/src/heretic/p_user.c
index 16dbed49..6b2a69fc 100644
--- a/src/heretic/p_user.c
+++ b/src/heretic/p_user.c
@@ -404,7 +404,7 @@ void P_DeathThink(player_t * player)
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 @@ boolean P_UndoPlayerChicken(player_t * player)
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 @@ boolean P_UndoPlayerChicken(player_t * player)
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;