|
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
|
A_OverlayThink is an action that was originally the thinker for overlays during the development of v2.1, but by v2.1's release it had been made deprecated (the thinker for Objects of type MT_OVERLAY
is handled internally rather than through actions).
Code – A_OverlayThink
|
|
// Function: A_OverlayThink
//
// Description: Moves the overlay to the position of its target.
//
// var1 = unused
// var2 = invert, z offset
//
void A_OverlayThink(mobj_t *actor)
{
fixed_t destx, desty;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_OverlayThink", actor))
return;
#endif
if (!actor->target)
return;
if (!splitscreen && rendermode != render_soft)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, camera.x, camera.y);
destx = actor->target->x + P_ReturnThrustX(actor->target, viewingangle, FixedMul(FRACUNIT, actor->scale));
desty = actor->target->y + P_ReturnThrustY(actor->target, viewingangle, FixedMul(FRACUNIT, actor->scale));
}
else
{
destx = actor->target->x;
desty = actor->target->y;
}
P_UnsetThingPosition(actor);
actor->x = destx;
actor->y = desty;
P_SetThingPosition(actor);
if (actor->eflags & MFE_VERTICALFLIP)
actor->z = actor->target->z + actor->target->height - mobjinfo[actor->type].height - ((var2>>16) ? -1 : 1)*(var2&0xFFFF)*FRACUNIT;
else
actor->z = actor->target->z + ((var2>>16) ? -1 : 1)*(var2&0xFFFF)*FRACUNIT;
actor->angle = actor->target->angle + actor->movedir;
actor->eflags = actor->target->eflags;
actor->momx = actor->target->momx;
actor->momy = actor->target->momy;
actor->momz = actor->target->momz; // assume target has correct momz! Do not use P_SetObjectMomZ!
}
|
|