P_SetOrigin & P_MoveOrigin to replace P_TeleportMove

This commit is contained in:
Sally Coolatta 2021-11-29 08:20:27 -05:00
parent f398004a18
commit c43f8da5e6
11 changed files with 127 additions and 64 deletions

View file

@ -1580,7 +1580,7 @@ void G_ReadMetalTic(mobj_t *metal)
oldmetal.x = READFIXED(metal_p);
oldmetal.y = READFIXED(metal_p);
oldmetal.z = READFIXED(metal_p);
P_TeleportMove(metal, oldmetal.x, oldmetal.y, oldmetal.z);
P_MoveOrigin(metal, oldmetal.x, oldmetal.y, oldmetal.z);
oldmetal.x = metal->x;
oldmetal.y = metal->y;
oldmetal.z = metal->z;

View file

@ -3754,7 +3754,7 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
{
// floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn
// This should set it for FOFs
P_TeleportMove(th, th->x, th->y, th->z);
P_SetOrigin(th, th->x, th->y, th->z);
// spawn on the ground if the player is on the ground
if (P_MobjFlip(source) < 0)
{
@ -4717,7 +4717,7 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing,
{
// floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn
// This should set it for FOFs
P_TeleportMove(mo, mo->x, mo->y, mo->z); // however, THIS can fuck up your day. just absolutely ruin you.
P_SetOrigin(mo, mo->x, mo->y, mo->z); // however, THIS can fuck up your day. just absolutely ruin you.
if (P_MobjWasRemoved(mo))
return NULL;
@ -5347,7 +5347,7 @@ void K_DropHnextList(player_t *player, boolean keepshields)
{
// floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn
// This should set it for FOFs
//P_TeleportMove(dropwork, dropwork->x, dropwork->y, dropwork->z); -- handled better by above floorz/ceilingz passing
//P_SetOrigin(dropwork, dropwork->x, dropwork->y, dropwork->z); -- handled better by above floorz/ceilingz passing
if (flip == 1)
{
@ -5873,7 +5873,7 @@ static void K_MoveHeldObjects(player_t *player)
z = player->mo->z + player->mo->height - cur->height;
cur->flags |= MF_NOCLIPTHING; // temporarily make them noclip other objects so they can't hit anyone while in the player
P_TeleportMove(cur, player->mo->x, player->mo->y, z);
P_MoveOrigin(cur, player->mo->x, player->mo->y, z);
cur->momx = FixedMul(FINECOSINE(cur->angle>>ANGLETOFINESHIFT), cur->extravalue1);
cur->momy = FixedMul(FINESINE(cur->angle>>ANGLETOFINESHIFT), cur->extravalue1);
cur->flags &= ~MF_NOCLIPTHING;
@ -5986,7 +5986,7 @@ static void K_MoveHeldObjects(player_t *player)
P_SetObjectMomZ(cur, FixedMul(targz - cur->z, 7*FRACUNIT/8) - gravity, false);
if (R_PointToDist2(cur->x, cur->y, targx, targy) > 768*FRACUNIT)
P_TeleportMove(cur, targx, targy, cur->z);
P_MoveOrigin(cur, targx, targy, cur->z);
if (P_IsObjectOnGround(cur))
{
@ -6076,12 +6076,12 @@ static void K_MoveHeldObjects(player_t *player)
diffy = targy - cur->y;
diffz = targz - cur->z;
P_TeleportMove(cur->tracer, cur->tracer->x + diffx + P_ReturnThrustX(cur, cur->angle + angoffset, 6*cur->scale),
P_MoveOrigin(cur->tracer, cur->tracer->x + diffx + P_ReturnThrustX(cur, cur->angle + angoffset, 6*cur->scale),
cur->tracer->y + diffy + P_ReturnThrustY(cur, cur->angle + angoffset, 6*cur->scale), cur->tracer->z + diffz);
P_SetScale(cur->tracer, (cur->tracer->destscale = 3*cur->scale/4));
}
P_TeleportMove(cur, targx, targy, targz);
P_MoveOrigin(cur, targx, targy, targz);
K_FlipFromObject(cur, player->mo); // Update graviflip in real time thanks.
cur->roll = player->mo->roll;

View file

@ -1415,7 +1415,42 @@ static int lib_pTeleportMove(lua_State *L)
INLEVEL
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_TeleportMove(thing, x, y, z));
LUA_Deprecated(L, "P_TeleportMove", "P_SetOrigin or P_MoveOrigin");
lua_pushboolean(L, P_SetOrigin(thing, x, y, z));
LUA_PushUserdata(L, tmthing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing);
return 2;
}
static int lib_pSetOrigin(lua_State *L)
{
mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
fixed_t z = luaL_checkfixed(L, 4);
NOHUD
INLEVEL
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SetOrigin(thing, x, y, z));
LUA_PushUserdata(L, tmthing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing);
return 2;
}
static int lib_pMoveOrigin(lua_State *L)
{
mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
fixed_t z = luaL_checkfixed(L, 4);
NOHUD
INLEVEL
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_MoveOrigin(thing, x, y, z));
LUA_PushUserdata(L, tmthing, META_MOBJ);
P_SetTarget(&tmthing, ptmthing);
return 2;
@ -3835,6 +3870,8 @@ static luaL_Reg lib[] = {
{"P_TryMove",lib_pTryMove},
{"P_Move",lib_pMove},
{"P_TeleportMove",lib_pTeleportMove},
{"P_SetOrigin",lib_pSetOrigin},
{"P_MoveOrigin",lib_pMoveOrigin},
{"P_SlideMove",lib_pSlideMove},
{"P_BounceMove",lib_pBounceMove},
{"P_CheckSight", lib_pCheckSight},

View file

@ -477,7 +477,7 @@ static int mobj_get(lua_State *L)
}
#define NOSET luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " should not be set directly.", mobj_opt[field])
#define NOSETPOS luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " should not be set directly. Use " LUA_QL("P_Move") ", " LUA_QL("P_TryMove") ", or " LUA_QL("P_TeleportMove") " instead.", mobj_opt[field])
#define NOSETPOS luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " should not be set directly. Use " LUA_QL("P_Move") ", " LUA_QL("P_TryMove") ", or " LUA_QL("P_SetOrigin") ", or " LUA_QL("P_MoveOrigin") " instead.", mobj_opt[field])
static int mobj_set(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));

View file

@ -420,7 +420,7 @@ void Command_RTeleport_f(void)
CONS_Printf(M_GetText("Teleporting by %d, %d, %d...\n"), intx, inty, FixedInt((intz-p->mo->z)));
P_MapStart();
if (!P_TeleportMove(p->mo, p->mo->x+intx*FRACUNIT, p->mo->y+inty*FRACUNIT, intz))
if (!P_SetOrigin(p->mo, p->mo->x+intx*FRACUNIT, p->mo->y+inty*FRACUNIT, intz))
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
else
S_StartSound(p->mo, sfx_mixup);
@ -641,7 +641,7 @@ void Command_Teleport_f(void)
}
P_MapStart();
if (!P_TeleportMove(p->mo, intx, inty, intz))
if (!P_SetOrigin(p->mo, intx, inty, intz))
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
else
S_StartSound(p->mo, sfx_mixup);
@ -1039,7 +1039,7 @@ void OP_ObjectplaceMovement(player_t *player)
if (cmd->forwardmove != 0)
{
P_Thrust(player->mo, player->mo->angle, (cmd->forwardmove*player->mo->scale/MAXPLMOVE)*cv_speed.value);
P_TeleportMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, player->mo->z);
P_MoveOrigin(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, player->mo->z);
player->mo->momx = player->mo->momy = 0;
}

View file

@ -1145,7 +1145,7 @@ void A_FaceStabHurl(mobj_t *actor)
hwork->destscale = FixedSqrt(step*basesize);
P_SetScale(hwork, hwork->destscale);
hwork->fuse = 2;
P_TeleportMove(hwork, actor->x + xo*(15-step), actor->y + yo*(15-step), actor->z + (actor->height - hwork->height)/2 + (P_MobjFlip(actor)*(8<<FRACBITS)));
P_MoveOrigin(hwork, actor->x + xo*(15-step), actor->y + yo*(15-step), actor->z + (actor->height - hwork->height)/2 + (P_MobjFlip(actor)*(8<<FRACBITS)));
step -= NUMGRADS;
}
@ -1905,7 +1905,7 @@ void A_CrushclawAim(mobj_t *actor)
#undef anglimit
#undef angfactor
P_TeleportMove(actor,
P_MoveOrigin(actor,
crab->x + P_ReturnThrustX(actor, actor->angle, locvar1*crab->scale),
crab->y + P_ReturnThrustY(actor, actor->angle, locvar1*crab->scale),
crab->z + locvar2*crab->scale);
@ -2043,7 +2043,7 @@ void A_CrushclawLaunch(mobj_t *actor)
fixed_t idx = dx, idy = dy, idz = dz;
while (chain)
{
P_TeleportMove(chain, actor->target->x + idx, actor->target->y + idy, actor->target->z + idz);
P_MoveOrigin(chain, actor->target->x + idx, actor->target->y + idy, actor->target->z + idz);
chain->movefactor = chain->z;
idx += dx;
idy += dy;
@ -4023,7 +4023,7 @@ void A_AttractChase(mobj_t *actor)
//P_SetScale(actor, (actor->destscale = actor->target->scale));
actor->z = actor->target->z;
K_MatchGenericExtraFlags(actor, actor->target);
P_TeleportMove(actor, actor->target->x, actor->target->y,
P_MoveOrigin(actor, actor->target->x, actor->target->y,
actor->z +
( actor->target->height + offz )* P_MobjFlip(actor));
actor->extravalue1++;
@ -4052,7 +4052,7 @@ void A_AttractChase(mobj_t *actor)
P_SetScale(actor, (actor->destscale = actor->target->scale - ((actor->target->scale/14) * actor->extravalue1)));
actor->z = actor->target->z;
K_MatchGenericExtraFlags(actor, actor->target);
P_TeleportMove(actor,
P_MoveOrigin(actor,
actor->target->x + FixedMul(dist, FINECOSINE(actor->angle >> ANGLETOFINESHIFT)),
actor->target->y + FixedMul(dist, FINESINE(actor->angle >> ANGLETOFINESHIFT)),
actor->z + actor->target->scale * 24 * P_MobjFlip(actor));
@ -9911,7 +9911,7 @@ void A_VileAttack(mobj_t *actor)
// move the fire between the vile and the player
//fire->x = actor->target->x - FixedMul (24*FRACUNIT, finecosine[an]);
//fire->y = actor->target->y - FixedMul (24*FRACUNIT, finesine[an]);
P_TeleportMove(fire,
P_MoveOrigin(fire,
actor->target->x - P_ReturnThrustX(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
actor->target->y - P_ReturnThrustY(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
fire->z);
@ -9956,7 +9956,7 @@ void A_VileAttack(mobj_t *actor)
// move the fire between the vile and the player
//fire->x = actor->target->x - FixedMul (24*FRACUNIT, finecosine[an]);
//fire->y = actor->target->y - FixedMul (24*FRACUNIT, finesine[an]);
P_TeleportMove(fire,
P_MoveOrigin(fire,
actor->target->x - P_ReturnThrustX(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
actor->target->y - P_ReturnThrustY(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
fire->z);
@ -10629,13 +10629,13 @@ void A_FlickyCenter(mobj_t *actor)
if (actor->target && P_AproxDistance(actor->target->x - originx, actor->target->y - originy) < actor->extravalue1)
{
actor->extravalue2 = 1;
P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z);
P_SetOrigin(actor, actor->target->x, actor->target->y, actor->target->z);
tmthing = NULL;
}
else if(actor->extravalue2)
{
actor->extravalue2 = 0;
P_TeleportMove(actor, originx, originy, originz);
P_SetOrigin(actor, originx, originy, originz);
tmthing = NULL;
}
}
@ -11172,7 +11172,7 @@ void A_LightBeamReset(mobj_t *actor)
actor->momy = (P_SignedRandom()*FINECOSINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/128;
actor->momz = (P_SignedRandom()*FRACUNIT)/128;
P_TeleportMove(actor,
P_SetOrigin(actor,
actor->spawnpoint->x*FRACUNIT - (P_SignedRandom()*FINESINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/2,
actor->spawnpoint->y*FRACUNIT + (P_SignedRandom()*FINECOSINE(((actor->spawnpoint->angle*ANG1)>>ANGLETOFINESHIFT) & FINEMASK))/2,
actor->spawnpoint->z*FRACUNIT + (P_SignedRandom()*FRACUNIT)/2);
@ -11757,7 +11757,7 @@ void A_DoNPCSkid(mobj_t *actor)
actor->momy = (2*actor->momy)/3;
}
P_TeleportMove(actor, x, y, z);
P_MoveOrigin(actor, x, y, z);
// Spawn a particle every 3 tics.
if (!(leveltime % 3))
@ -12098,7 +12098,7 @@ void A_Boss5MakeJunk(mobj_t *actor)
if (locvar1 > 0)
P_SetMobjState(broked, locvar1);
if (!P_MobjWasRemoved(broked))
P_TeleportMove(broked, broked->x + broked->momx, broked->y + broked->momy, broked->z);
P_MoveOrigin(broked, broked->x + broked->momx, broked->y + broked->momy, broked->z);
ang += ANGLE_45;
}
@ -13161,7 +13161,7 @@ void A_DragonWing(mobj_t *actor)
actor->angle = target->angle + actor->movedir;
x = target->x + P_ReturnThrustX(actor, actor->angle, -target->radius);
y = target->y + P_ReturnThrustY(actor, actor->angle, -target->radius);
P_TeleportMove(actor, x, y, target->z);
P_MoveOrigin(actor, x, y, target->z);
}
// Function: A_DragonSegment
@ -13202,7 +13202,7 @@ void A_DragonSegment(mobj_t *actor)
zdist = P_ReturnThrustY(target, zangle, radius);
actor->angle = hangle;
P_TeleportMove(actor, target->x + xdist, target->y + ydist, target->z + zdist);
P_MoveOrigin(actor, target->x + xdist, target->y + ydist, target->z + zdist);
}
// Function: A_ChangeHeight
@ -14164,10 +14164,10 @@ void A_LightningFollowPlayer(mobj_t *actor)
{
sx = actor->target->x + FixedMul((actor->target->scale*actor->extravalue1), FINECOSINE((actor->angle)>>ANGLETOFINESHIFT));
sy = actor->target->y + FixedMul((actor->target->scale*actor->extravalue1), FINESINE((actor->angle)>>ANGLETOFINESHIFT));
P_TeleportMove(actor, sx, sy, actor->target->z);
P_MoveOrigin(actor, sx, sy, actor->target->z);
}
else // else just teleport to player directly
P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z);
P_MoveOrigin(actor, actor->target->x, actor->target->y, actor->target->z);
K_MatchGenericExtraFlags(actor, actor->target); // copy our target for graviflip
actor->momx = actor->target->momx;
@ -14644,7 +14644,7 @@ void A_InvincSparkleRotate(mobj_t *actor)
sx = actor->target->x + FixedMul((actor->movefactor), FINECOSINE((actor->angle)>>ANGLETOFINESHIFT));
sy = actor->target->y + FixedMul((actor->movefactor), FINESINE((actor->angle)>>ANGLETOFINESHIFT));
sz = actor->target->z + (actor->extravalue1) + FixedMul((actor->cvmem), FINECOSINE((leveltime*ANG1*10 + actor->angle)>>ANGLETOFINESHIFT));
P_TeleportMove(actor, sx, sy, sz);
P_MoveOrigin(actor, sx, sy, sz);
actor->momx = actor->target->momx;
actor->momy = actor->target->momy;

View file

@ -237,7 +237,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (!special->target)
return; // foolproof crash prevention check!!!!!
P_TeleportMove(player->mo, special->target->x, special->target->y, special->target->z + (48<<FRACBITS));
P_SetOrigin(player->mo, special->target->x, special->target->y, special->target->z + (48<<FRACBITS));
player->mo->angle = special->target->angle;
P_SetObjectMomZ(player->mo, 12<<FRACBITS, false);
P_InstaThrust(player->mo, player->mo->angle, 20<<FRACBITS);

View file

@ -403,7 +403,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
boolean P_Move(mobj_t *actor, fixed_t speed);
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
boolean P_SetOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
void P_SlideMove(mobj_t *mo);
void P_BouncePlayerMove(mobj_t *mo);
void P_BounceMove(mobj_t *mo);

View file

@ -96,7 +96,7 @@ camera_t *mapcampointer;
//
// P_TeleportMove
//
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
static boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
{
numspechit = 0U;
@ -130,6 +130,31 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
return true;
}
//
// P_SetOrigin - P_TeleportMove which RESETS interpolation values.
//
boolean P_SetOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
{
boolean result = P_TeleportMove(thing, x, y, z);
if (result == true)
{
thing->old_x = thing->x;
thing->old_y = thing->y;
thing->old_z = thing->z;
}
return result;
}
//
// P_MoveOrigin - P_TeleportMove which KEEPS interpolation values.
//
boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
{
return P_TeleportMove(thing, x, y, z);
}
// =========================================================================
// MOVEMENT ITERATOR FUNCTIONS
// =========================================================================
@ -1598,7 +1623,7 @@ static boolean PIT_CheckLine(line_t *ld)
cosradius = FixedMul(dist, FINECOSINE(langle>>ANGLETOFINESHIFT));
sinradius = FixedMul(dist, FINESINE(langle>>ANGLETOFINESHIFT));
tmthing->flags |= MF_NOCLIP;
P_TeleportMove(tmthing, result.x + cosradius - tmthing->momx, result.y + sinradius - tmthing->momy, tmthing->z);
P_MoveOrigin(tmthing, result.x + cosradius - tmthing->momx, result.y + sinradius - tmthing->momy, tmthing->z);
tmthing->flags &= ~MF_NOCLIP;
}
#endif

View file

@ -3795,9 +3795,9 @@ static void P_ItemCapsulePartThinker(mobj_t *mobj)
// rotate & move to capsule
mobj->angle += mobj->movedir;
if (mobj->flags2 & MF2_CLASSICPUSH) // centered
P_TeleportMove(mobj, target->x, target->y, z);
P_MoveOrigin(mobj, target->x, target->y, z);
else
P_TeleportMove(mobj,
P_MoveOrigin(mobj,
target->x + P_ReturnThrustX(mobj, mobj->angle + ANGLE_90, mobj->radius),
target->y + P_ReturnThrustY(mobj, mobj->angle + ANGLE_90, mobj->radius),
z);
@ -4216,7 +4216,7 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y
if (dist < source->movefactor)
{
source->momx = source->momy = source->momz = 0;
P_TeleportMove(source, tx, ty, tz);
P_MoveOrigin(source, tx, ty, tz);
}
else
{
@ -6547,7 +6547,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->angle += ANGLE_90;
}
P_TeleportMove(mobj,
P_MoveOrigin(mobj,
mobj->target->x + P_ReturnThrustX(mobj, angle + ANGLE_180, nudge),
mobj->target->y + P_ReturnThrustY(mobj, angle + ANGLE_180, nudge),
mobj->target->z);
@ -6626,7 +6626,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
}
mobj->angle = mobj->target->angle;
P_TeleportMove(mobj, mobj->target->x + P_ReturnThrustX(mobj, mobj->angle+ANGLE_180, mobj->target->radius),
P_MoveOrigin(mobj, mobj->target->x + P_ReturnThrustX(mobj, mobj->angle+ANGLE_180, mobj->target->radius),
mobj->target->y + P_ReturnThrustY(mobj, mobj->angle+ANGLE_180, mobj->target->radius), mobj->target->z);
P_SetScale(mobj, mobj->target->scale);
@ -6678,7 +6678,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
P_RemoveMobj(mobj);
return false;
}
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
break;
case MT_BRAKEDRIFT:
if ((!mobj->target || !mobj->target->health || !mobj->target->player || !P_IsObjectOnGround(mobj->target))
@ -6699,7 +6699,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
newx = mobj->target->x + P_ReturnThrustX(mobj->target, travelangle+ANGLE_180, 24*mobj->target->scale);
newy = mobj->target->y + P_ReturnThrustY(mobj->target, travelangle+ANGLE_180, 24*mobj->target->scale);
P_TeleportMove(mobj, newx, newy, mobj->target->z);
P_MoveOrigin(mobj, newx, newy, mobj->target->z);
mobj->angle = travelangle - ((ANGLE_90/5)*mobj->target->player->drift);
P_SetScale(mobj, (mobj->destscale = mobj->target->scale));
@ -6728,7 +6728,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
{
mobj->fuse = 9;
}
P_TeleportMove(mobj, mobj->target->x,
P_MoveOrigin(mobj, mobj->target->x,
mobj->target->y, mobj->target->z);
mobj->angle = mobj->target->angle + mobj->cusval;
break;
@ -6738,7 +6738,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
P_RemoveMobj(mobj);
return false;
}
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
break;
case MT_INSTASHIELDB:
mobj->renderflags ^= RF_DONTDRAW;
@ -6750,7 +6750,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
P_RemoveMobj(mobj);
return false;
}
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
K_MatchGenericExtraFlags(mobj, mobj->target);
break;
case MT_BATTLEPOINT:
@ -6773,7 +6773,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->movefactor = mobj->target->height;
}
K_MatchGenericExtraFlags(mobj, mobj->target);
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z + (mobj->target->height/2) + mobj->movefactor);
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z + (mobj->target->height/2) + mobj->movefactor);
break;
case MT_RINGSPARKS:
if (!mobj->target || P_MobjWasRemoved(mobj->target))
@ -6786,7 +6786,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
K_MatchGenericExtraFlags(mobj, mobj->target);
P_TeleportMove(mobj, mobj->target->x + FINECOSINE(mobj->angle >> ANGLETOFINESHIFT),
P_MoveOrigin(mobj, mobj->target->x + FINECOSINE(mobj->angle >> ANGLETOFINESHIFT),
mobj->target->y + FINESINE(mobj->angle >> ANGLETOFINESHIFT),
mobj->z + (mobj->target->height * P_MobjFlip(mobj)));
break;
@ -6807,7 +6807,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
K_MatchGenericExtraFlags(mobj, mobj->target);
mobj->renderflags = (mobj->renderflags & ~RF_DONTDRAW)|K_GetPlayerDontDrawFlag(mobj->target->player);
P_TeleportMove(mobj, mobj->target->x + FixedMul(34 * mapobjectscale, FINECOSINE((mobj->angle + mobj->movedir) >> ANGLETOFINESHIFT)),
P_MoveOrigin(mobj, mobj->target->x + FixedMul(34 * mapobjectscale, FINECOSINE((mobj->angle + mobj->movedir) >> ANGLETOFINESHIFT)),
mobj->target->y + FixedMul(34 * mapobjectscale, FINESINE((mobj->angle + mobj->movedir) >> ANGLETOFINESHIFT)),
mobj->z + (32 * mapobjectscale * P_MobjFlip(mobj)));
@ -6850,7 +6850,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
fixed_t newx = mobj->target->x + P_ReturnThrustX(NULL, mobj->target->angle + perpendicular, 8*mobj->target->scale);
fixed_t newy = mobj->target->y + P_ReturnThrustY(NULL, mobj->target->angle + perpendicular, 8*mobj->target->scale);
P_TeleportMove(mobj, newx, newy, mobj->target->z);
P_MoveOrigin(mobj, newx, newy, mobj->target->z);
if (mobj->extravalue1 & 1)
mobj->angle = mobj->target->angle - ANGLE_45;
@ -6888,7 +6888,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
else
ang = (signed)(ang + off);
P_TeleportMove(mobj,
P_MoveOrigin(mobj,
mobj->target->x - FixedMul(mobj->target->radius, FINECOSINE(ang >> ANGLETOFINESHIFT)),
mobj->target->y - FixedMul(mobj->target->radius, FINESINE(ang >> ANGLETOFINESHIFT)),
z);
@ -6943,7 +6943,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
desty = mobj->target->y;
}
P_TeleportMove(mobj, destx, desty, mobj->target->z);
P_MoveOrigin(mobj, destx, desty, mobj->target->z);
break;
}
case MT_BUBBLESHIELD:
@ -7071,7 +7071,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
desty = mobj->target->y;
}
P_TeleportMove(mobj, destx, desty, mobj->target->z);
P_MoveOrigin(mobj, destx, desty, mobj->target->z);
break;
}
case MT_FLAMESHIELD:
@ -7179,7 +7179,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
desty = mobj->target->y;
}
P_TeleportMove(mobj, destx, desty, mobj->target->z);
P_MoveOrigin(mobj, destx, desty, mobj->target->z);
mobj->angle = K_MomentumAngle(mobj->target);
if (underlayst != S_NULL)
@ -7223,7 +7223,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
return false;
}
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
mobj->angle = mobj->target->angle;
mobj->scalespeed = mobj->target->scalespeed;
mobj->destscale = mobj->target->destscale;
@ -7273,7 +7273,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
if (cur->lastlook == 2 || cur->lastlook == 3)
offy *= -1;
P_TeleportMove(cur, mobj->x + offx, mobj->y + offy, mobj->z);
P_MoveOrigin(cur, mobj->x + offx, mobj->y + offy, mobj->z);
cur->scalespeed = mobj->target->scalespeed;
cur->destscale = mobj->target->destscale;
P_SetScale(cur, mobj->target->scale);
@ -7412,7 +7412,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
amt += 1;
}
P_TeleportMove(
P_MoveOrigin(
cur,
mobj->x + FixedMul(amt, FINECOSINE(dir >> ANGLETOFINESHIFT)),
mobj->y + FixedMul(amt, FINESINE(dir >> ANGLETOFINESHIFT)),
@ -7502,7 +7502,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
while (cur && !P_MobjWasRemoved(cur))
{
cur->angle += FixedAngle(mobj->info->speed);
P_TeleportMove(cur, mobj->x + FINECOSINE((cur->angle*8)>>ANGLETOFINESHIFT),
P_MoveOrigin(cur, mobj->x + FINECOSINE((cur->angle*8)>>ANGLETOFINESHIFT),
mobj->y + FINESINE((cur->angle*8)>>ANGLETOFINESHIFT), mobj->z);
//P_SpawnGhostMobj(cur)->tics = 2;
@ -7635,7 +7635,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
fixed_t wz = mobj->tracer->z + (joint * ((mobj->z + (mobj->height/2)) - mobj->tracer->z) / (numjoints+1));
if (cur && !P_MobjWasRemoved(cur))
P_TeleportMove(cur, wx, wy, wz);
P_MoveOrigin(cur, wx, wy, wz);
else
cur = P_SpawnMobj(wx, wy, wz, MT_FROGTONGUE_JOINT);
@ -7746,7 +7746,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
continue;
}
else // Move into place
P_TeleportMove(cur, mobj->x, mobj->y, segz);
P_MoveOrigin(cur, mobj->x, mobj->y, segz);
}
else
{
@ -7820,7 +7820,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->extravalue1 = 1;
player->offroad += 2<<FRACBITS;
P_TeleportMove(mobj,
P_MoveOrigin(mobj,
player->mo->x + P_ReturnThrustX(NULL, player->mo->angle, player->mo->radius)
+ P_ReturnThrustX(NULL, player->mo->angle+ANGLE_90, (mobj->threshold)<<FRACBITS),
player->mo->y + P_ReturnThrustY(NULL, player->mo->angle, player->mo->radius)
@ -7981,7 +7981,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->tracer->momx = mobj->tracer->momy = 0;
}
P_TeleportMove(mobj,
P_MoveOrigin(mobj,
mobj->tracer->x + P_ReturnThrustX(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<<FRACBITS),
mobj->tracer->y + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<<FRACBITS),
mobj->tracer->z - (4*mobj->tracer->scale) + (P_RandomRange(-abs(mobj->cvmem), abs(mobj->cvmem))<<FRACBITS));
@ -8324,7 +8324,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
cur->angle = angle + ANGLE_90;
}
P_TeleportMove(cur, newx, newy, newz);
P_MoveOrigin(cur, newx, newy, newz);
cur = cur->hnext;
}
@ -8350,7 +8350,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->extravalue1++;
dist = mobj->extravalue1 * mapobjectscale;
P_TeleportMove(mobj, battleovertime.x + P_ReturnThrustX(NULL, ang, dist),
P_MoveOrigin(mobj, battleovertime.x + P_ReturnThrustX(NULL, ang, dist),
battleovertime.y + P_ReturnThrustY(NULL, ang, dist), z);
ghost = P_SpawnGhostMobj(mobj);
@ -9680,7 +9680,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
cur = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_SMK_ICEBLOCK_SIDE);
P_SetTarget(&cur->target, mobj);
cur->threshold = i;
P_TeleportMove(cur, cur->x + ((cur->radius>>FRACBITS) * FINECOSINE((FixedAngle((90*cur->threshold)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK)),
P_MoveOrigin(cur, cur->x + ((cur->radius>>FRACBITS) * FINECOSINE((FixedAngle((90*cur->threshold)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK)),
cur->y + ((cur->radius>>FRACBITS) * FINESINE((FixedAngle((90*cur->threshold)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK)), cur->z);
cur->angle = ANGLE_90*(cur->threshold+1);

View file

@ -120,7 +120,7 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
{
UINT8 i;
if (!P_TeleportMove(thing, x, y, z))
if (!P_SetOrigin(thing, x, y, z))
return false;
if (!dontstopmove)