A_SetScale is an action that sets the actor's scale. Var1 determines the actor's new scale, which must be given as a multiple of FRACUNIT
(i.e. FRACUNIT
is 100% of the normal scale, 2*FRACUNIT
is 200%, and FRACUNIT/2
is 50%). The lower 16 bits of Var2 determine whether the new scale is applied instantaneously (0) or gradually applied over time (1). The upper 16 bits of Var2 determine whether the new scale is applied to the actor (0), its target (1), or its tracer (2) – if the actor does not have a target/tracer when either of the latter two cases are selected, this action will do nothing.
Code – A_SetScale
|
|
// Function: A_SetScale
//
// Description: Changes the scale of the actor or its target/tracer
//
// var1 = new scale (1*FRACUNIT = 100%)
// var2:
// upper 16 bits: 0 = actor, 1 = target, 2 = tracer
// lower 16 bits: 0 = instant change, 1 = smooth change
//
void A_SetScale(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
mobj_t *target;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SetScale", actor))
return;
#endif
if (locvar1 <= 0)
{
if(cv_debug)
CONS_Printf("A_SetScale: Valid scale not specified!\n");
return;
}
if ((locvar2>>16) == 1)
target = actor->target;
else if ((locvar2>>16) == 2)
target = actor->tracer;
else // default to yourself!
target = actor;
if (!target)
{
if(cv_debug)
CONS_Printf("A_SetScale: No target!\n");
return;
}
target->destscale = locvar1; // destination scale
if (!(locvar2 & 65535))
P_SetScale(target, locvar1); // this instantly changes current scale to var1 if used, if not destscale will alter scale to var1 anyway
}
|
|