diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 8ec05b75e5..ba216a8ba6 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -1294,9 +1294,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2) } angle = self->angle; - fixedvec3 pos = self->Vec3Offset( - (pr_fp2.Random2() << 9), - (pr_fp2.Random2() << 9), + fixed_t xo = (pr_fp2.Random2() << 9); + fixed_t yo = (pr_fp2.Random2() << 9); + fixedvec3 pos = self->Vec3Offset(xo, yo, 26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] - self->floorclip); slope = finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10); diff --git a/src/g_heretic/a_knight.cpp b/src/g_heretic/a_knight.cpp index d845920f99..0ae5a240a8 100644 --- a/src/g_heretic/a_knight.cpp +++ b/src/g_heretic/a_knight.cpp @@ -23,10 +23,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_DripBlood) { AActor *mo; - fixedvec3 pos = self->Vec3Offset( - (pr_dripblood.Random2 () << 11), - (pr_dripblood.Random2 () << 11), 0); - mo = Spawn ("Blood", pos, ALLOW_REPLACE); + fixed_t xo = (pr_dripblood.Random2() << 11); + fixed_t yo = (pr_dripblood.Random2() << 11); + mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE); mo->velx = pr_dripblood.Random2 () << 10; mo->vely = pr_dripblood.Random2 () << 10; mo->gravity = FRACUNIT/8; diff --git a/src/g_hexen/a_bishop.cpp b/src/g_hexen/a_bishop.cpp index 8b252e63a2..167fae5685 100644 --- a/src/g_hexen/a_bishop.cpp +++ b/src/g_hexen/a_bishop.cpp @@ -193,11 +193,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur) self->SetState (self->FindState ("Blur")); return; } - fixedvec3 pos = self->Vec3Offset( - (pr_pain.Random2()<<12), - (pr_pain.Random2()<<12), - (pr_pain.Random2()<<11)); - mo = Spawn ("BishopPainBlur", pos, ALLOW_REPLACE); + fixed_t xo = (pr_pain.Random2() << 12); + fixed_t yo = (pr_pain.Random2() << 12); + fixed_t zo = (pr_pain.Random2() << 11); + mo = Spawn ("BishopPainBlur", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->angle = self->angle; diff --git a/src/g_hexen/a_dragon.cpp b/src/g_hexen/a_dragon.cpp index 7b160a6898..9dc577aa94 100644 --- a/src/g_hexen/a_dragon.cpp +++ b/src/g_hexen/a_dragon.cpp @@ -252,12 +252,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFX2) delay = 16+(pr_dragonfx2()>>3); for (i = 1+(pr_dragonfx2()&3); i; i--) { - fixedvec3 pos = self->Vec3Offset( - ((pr_dragonfx2()-128)<<14), - ((pr_dragonfx2()-128)<<14), - ((pr_dragonfx2()-128)<<12)); + fixed_t xo = ((pr_dragonfx2() - 128) << 14); + fixed_t yo = ((pr_dragonfx2() - 128) << 14); + fixed_t zo = ((pr_dragonfx2() - 128) << 12); - mo = Spawn ("DragonExplosion", pos, ALLOW_REPLACE); + mo = Spawn ("DragonExplosion", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->tics = delay+(pr_dragonfx2()&3)*i*2; diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index ae6df183ca..cd3f65607c 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -112,11 +112,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordFlames) for (i = 1+(pr_fswordflame()&3); i; i--) { - fixedvec3 pos = self->Vec3Offset( - ((pr_fswordflame()-128)<<12), - ((pr_fswordflame()-128)<<12), - ((pr_fswordflame()-128)<<11)); - Spawn ("FSwordFlame", pos, ALLOW_REPLACE); + fixed_t xo = ((pr_fswordflame() - 128) << 12); + fixed_t yo = ((pr_fswordflame() - 128) << 12); + fixed_t zo = ((pr_fswordflame() - 128) << 11); + Spawn ("FSwordFlame", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); } } diff --git a/src/g_hexen/a_firedemon.cpp b/src/g_hexen/a_firedemon.cpp index e33c838964..40f03abbf9 100644 --- a/src/g_hexen/a_firedemon.cpp +++ b/src/g_hexen/a_firedemon.cpp @@ -54,11 +54,10 @@ void A_FiredSpawnRock (AActor *actor) break; } - fixedvec3 pos = actor->Vec3Offset( - ((pr_firedemonrock() - 128) << 12), - ((pr_firedemonrock() - 128) << 12), - ( pr_firedemonrock() << 11)); - mo = Spawn (rtype, pos, ALLOW_REPLACE); + fixed_t xo = ((pr_firedemonrock() - 128) << 12); + fixed_t yo = ((pr_firedemonrock() - 128) << 12); + fixed_t zo = (pr_firedemonrock() << 11); + mo = Spawn (rtype, actor->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->target = actor; diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 19cb4f7525..b79d9f2c23 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -197,11 +197,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn) for (i = (pr_leaf()&3)+1; i; i--) { + fixed_t xo = (pr_leaf.Random2() << 14); + fixed_t yo = (pr_leaf.Random2() << 14); + fixed_t zo = (pr_leaf() << 14); mo = Spawn (pr_leaf()&1 ? PClass::FindClass ("Leaf1") : PClass::FindClass ("Leaf2"), - self->Vec3Offset( - (pr_leaf.Random2()<<14), - (pr_leaf.Random2()<<14), - (pr_leaf()<<14)), ALLOW_REPLACE); + self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); + if (mo) { P_ThrustMobj (mo, self->angle, (pr_leaf()<<9)+3*FRACUNIT); @@ -278,10 +279,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode) for (i = 0; i < 10; i++) { - mo = Spawn ("ZArmorChunk", self->Vec3Offset( - ((pr_soaexplode()-128)<<12), - ((pr_soaexplode()-128)<<12), - (pr_soaexplode()*self->height/256)), ALLOW_REPLACE); + fixed_t xo = ((pr_soaexplode() - 128) << 12); + fixed_t yo = ((pr_soaexplode() - 128) << 12); + fixed_t zo = (pr_soaexplode()*self->height / 256); + mo = Spawn ("ZArmorChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->SetState (mo->SpawnState + i); diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 88c6dba8be..c1dd7d7d00 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -227,12 +227,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap) else { deltaZ = -10*FRACUNIT; - } - mo = Spawn(lightning, - self->Vec3Offset( - ((pr_zap() - 128)*self->radius / 256), - ((pr_zap() - 128)*self->radius / 256), - deltaZ), ALLOW_REPLACE); + } + fixed_t xo = ((pr_zap() - 128)*self->radius / 256); + fixed_t yo = ((pr_zap() - 128)*self->radius / 256); + + mo = Spawn(lightning, self->Vec3Offset(xo, yo, deltaZ), ALLOW_REPLACE); if (mo) { mo->lastenemy = self; diff --git a/src/g_hexen/a_wraith.cpp b/src/g_hexen/a_wraith.cpp index 312585cdfb..3bbe567ac6 100644 --- a/src/g_hexen/a_wraith.cpp +++ b/src/g_hexen/a_wraith.cpp @@ -147,12 +147,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX3) while (numdropped-- > 0) { - fixedvec3 pos = self->Vec3Offset( - (pr_wraithfx3()-128)<<11, - (pr_wraithfx3()-128)<<11, - (pr_wraithfx3()<<10)); + fixed_t xo = (pr_wraithfx3() - 128) << 11; + fixed_t yo = (pr_wraithfx3() - 128) << 11; + fixed_t zo = pr_wraithfx3() << 10; - mo = Spawn ("WraithFX3", pos, ALLOW_REPLACE); + mo = Spawn ("WraithFX3", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->floorz = self->floorz; @@ -199,12 +198,11 @@ void A_WraithFX4 (AActor *self) if (spawn4) { - fixedvec3 pos = self->Vec3Offset( - (pr_wraithfx4()-128)<<12, - (pr_wraithfx4()-128)<<12, - (pr_wraithfx4()<<10)); + fixed_t xo = (pr_wraithfx4() - 128) << 12; + fixed_t yo = (pr_wraithfx4() - 128) << 12; + fixed_t zo = (pr_wraithfx4() << 10); - mo = Spawn ("WraithFX4", pos, ALLOW_REPLACE); + mo = Spawn ("WraithFX4", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->floorz = self->floorz; @@ -214,12 +212,11 @@ void A_WraithFX4 (AActor *self) } if (spawn5) { - fixedvec3 pos = self->Vec3Offset( - (pr_wraithfx4()-128)<<12, - (pr_wraithfx4()-128)<<12, - (pr_wraithfx4()<<10)); + fixed_t xo = (pr_wraithfx4() - 128) << 11; + fixed_t yo = (pr_wraithfx4() - 128) << 11; + fixed_t zo = (pr_wraithfx4()<<10); - mo = Spawn ("WraithFX5", pos, ALLOW_REPLACE); + mo = Spawn ("WraithFX5", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->floorz = self->floorz; diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 29f24b47ed..e4b683e97a 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -262,10 +262,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks) i = (pr_freeze.Random2()) % (numChunks/4); for (i = MAX (24, numChunks + i); i >= 0; i--) { - mo = Spawn("IceChunk", self->Vec3Offset( - (((pr_freeze()-128)*self->radius)>>7), - (((pr_freeze()-128)*self->radius)>>7), - (pr_freeze()*self->height/255)), ALLOW_REPLACE); + fixed_t xo = (((pr_freeze() - 128)*self->radius) >> 7); + fixed_t yo = (((pr_freeze() - 128)*self->radius) >> 7); + fixed_t zo = (pr_freeze()*self->height / 255); + mo = Spawn("IceChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { mo->SetState (mo->SpawnState + (pr_freeze()%3)); diff --git a/src/g_shared/a_debris.cpp b/src/g_shared/a_debris.cpp index c85c0fed9d..f60e71595c 100644 --- a/src/g_shared/a_debris.cpp +++ b/src/g_shared/a_debris.cpp @@ -34,7 +34,8 @@ void P_SpawnDirt (AActor *actor, fixed_t radius) const PClass *dtype = NULL; AActor *mo; - fixedvec3 pos = actor->Vec3Angle(radius, pr_dirt() << 24, (pr_dirt() << 9) + FRACUNIT); + fixed_t zo = (pr_dirt() << 9) + FRACUNIT; + fixedvec3 pos = actor->Vec3Angle(radius, pr_dirt() << 24, zo); char fmt[8]; mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6); diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index 81dcc9f3e2..3e0efe5259 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -18,9 +18,10 @@ extern const PClass *QuestItemClasses[31]; DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud) { - fixedvec3 pos = self->Vec3Offset((pr_bang4cloud.Random2() & 3) * 10240, (pr_bang4cloud.Random2() & 3) * 10240, 0); + fixed_t xo = (pr_bang4cloud.Random2() & 3) * 10240; + fixed_t yo = (pr_bang4cloud.Random2() & 3) * 10240; - Spawn("Bang4Cloud", pos, ALLOW_REPLACE); + Spawn("Bang4Cloud", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE); } // ------------------------------------------------------------------- diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 2907b0d379..1ff9414bdc 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -843,10 +843,11 @@ void P_DisconnectEffect (AActor *actor) if (!p) break; - fixedvec3 pos = actor->Vec3Offset( - ((M_Random()-128)<<9) * (actor->radius>>FRACBITS), - ((M_Random()-128)<<9) * (actor->radius>>FRACBITS), - (M_Random()<<8) * (actor->height>>FRACBITS)); + + fixed_t xo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS); + fixed_t yo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS); + fixed_t zo = (M_Random() << 8) * (actor->height >> FRACBITS); + fixedvec3 pos = actor->Vec3Offset(xo, yo, zo); p->x = pos.x; p->y = pos.y; p->z = pos.z; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e2d5a3cf68..114c026f74 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3297,10 +3297,9 @@ void AActor::Tick () { smokecounter = 0; angle_t moveangle = R_PointToAngle2(0,0,velx,vely); - AActor * th = Spawn("GrenadeSmokeTrail", Vec3Offset( - - FixedMul (finecosine[(moveangle)>>ANGLETOFINESHIFT], radius*2) + (pr_rockettrail()<<10), - - FixedMul (finesine[(moveangle)>>ANGLETOFINESHIFT], radius*2) + (pr_rockettrail()<<10), - - (height>>3) * (velz>>16) + (2*height)/3), ALLOW_REPLACE); + fixed_t xo = -FixedMul(finecosine[(moveangle) >> ANGLETOFINESHIFT], radius * 2) + (pr_rockettrail() << 10); + fixed_t yo = -FixedMul(finesine[(moveangle) >> ANGLETOFINESHIFT], radius * 2) + (pr_rockettrail() << 10); + AActor * th = Spawn("GrenadeSmokeTrail", Vec3Offset(xo, yo, - (height>>3) * (velz>>16) + (2*height)/3), ALLOW_REPLACE); if (th) { th->tics -= pr_rockettrail()&3; @@ -5266,10 +5265,10 @@ void P_RipperBlood (AActor *mo, AActor *bleeder) PalEntry bloodcolor = bleeder->GetBloodColor(); const PClass *bloodcls = bleeder->GetBloodType(); - fixedvec3 pos = mo->Vec3Offset( - (pr_ripperblood.Random2 () << 12), - (pr_ripperblood.Random2 () << 12), - (pr_ripperblood.Random2 () << 12)); + fixed_t xo = (pr_ripperblood.Random2() << 12); + fixed_t yo = (pr_ripperblood.Random2() << 12); + fixed_t zo = (pr_ripperblood.Random2() << 12); + fixedvec3 pos = mo->Vec3Offset(xo, yo, zo); int bloodtype = cl_bloodtype; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 9b4304c9d8..6a33bf5950 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2606,10 +2606,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris) for (i = 0; i < GetDefaultByType(debris)->health; i++) { - mo = Spawn(debris, self->Vec3Offset( - ((pr_spawndebris()-128)<<12), - ((pr_spawndebris()-128)<<12), - (pr_spawndebris()*self->height/256+self->GetBobOffset())), ALLOW_REPLACE); + fixed_t xo = ((pr_spawndebris() - 128) << 12); + fixed_t yo = ((pr_spawndebris() - 128) << 12); + fixed_t zo = (pr_spawndebris()*self->height / 256 + self->GetBobOffset()); + mo = Spawn(debris, self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) { if (transfer_translation) @@ -2924,10 +2924,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) i = (pr_burst.Random2()) % (numChunks/4); for (i = MAX (24, numChunks + i); i >= 0; i--) { - mo = Spawn(chunk, self->Vec3Offset( - (((pr_burst()-128)*self->radius)>>7), - (((pr_burst()-128)*self->radius)>>7), - (pr_burst()*self->height/255 + self->GetBobOffset())), ALLOW_REPLACE); + fixed_t xo = (((pr_burst() - 128)*self->radius) >> 7); + fixed_t yo = (((pr_burst() - 128)*self->radius) >> 7); + fixed_t zo = (pr_burst()*self->height / 255 + self->GetBobOffset()); + mo = Spawn(chunk, self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) {