A_SpawnObjectAbsolute is an action which is used to spawn an Object of a type determined by Var2's lower 16 bits at an absolute location. The location's Z position is determined by Var2's upper 16 bits, its X position by Var1's upper 16 bits, and its Y position by Var1's lower 16 bits. The expressions for this are:
- Var1 = (X × 65536) + Y
- Var2 = (Z × 65536) + type
If the actor is in reverse gravity when this action is called, the Object spawned will have MF2_OBJECTFLIP
added to its secondary flags. The spawned Object's angle will be set to the actor's own angle.
Attributes |
Use
|
Var 1 |
Upper 16 bits: X position Lower 16 bits: Y position
|
Var 2 |
Upper 16 bits: Z position Lower 16 bits: Object type
|
Code – A_SpawnObjectAbsolute
|
|
// Function: A_SpawnObjectAbsolute
//
// Description: Spawns an object at an absolute position
//
// var1:
// var1 >> 16 = x
// var1 & 65535 = y
// var2:
// var2 >> 16 = z
// var2 & 65535 = type
//
void A_SpawnObjectAbsolute(mobj_t *actor)
{
INT16 x, y, z; // Want to be sure we can use negative values
mobjtype_t type;
mobj_t *mo;
INT32 locvar1 = var1;
INT32 locvar2 = var2;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SpawnObjectAbsolute", actor))
return;
#endif
x = (INT16)(locvar1>>16);
y = (INT16)(locvar1&65535);
z = (INT16)(locvar2>>16);
type = (mobjtype_t)(locvar2&65535);
mo = P_SpawnMobj(x<<FRACBITS, y<<FRACBITS, z<<FRACBITS, type);
// Spawn objects with an angle matching the spawner's, rather than spawning Eastwards - Monster Iestyn
mo->angle = actor->angle;
if (actor->eflags & MFE_VERTICALFLIP)
mo->flags2 |= MF2_OBJECTFLIP;
}
|
|