p_mobj.c
/*
================
=
= P_SetMobjState
=
= Returns true if the mobj is still present
================
*/
P_SetMobjState
Returns true if the mobj is still present
P_SetMobjState Returns true if the mobj is still present
boolean P_SetMobjState (mobj_t *mobj, statenum_t state)
{
	uint16_t changes = 0xffff;
	do {
		const state_t* st;
		if (state == S_NULL)
		{
			mobj->state = S_NULL;
			P_RemoveMobj(mobj);
			return false;
		}
		st = &states[state];
		mobj->state = state;
		mobj->tics = st->tics;
		mobj->sprite = st->sprite;
		mobj->frame = st->frame;
		if (st->action)		
			st->action(mobj);
		mobj->latecall = NULL;	
		state = st->nextstate;
	} while (!mobj->tics && --changes > 0);
	return true;
}
boolean P_SetMobjState ( mobj_t * mobj , statenum_t state ) { uint16_t changes = 0xffff ; do { const state_t * st ; if ( state == S_NULL ) { mobj -> state = S_NULL ; P_RemoveMobj ( mobj ) ; return false ; } st = & states [ state ] ; mobj -> state = state ; mobj -> tics = st -> tics ; mobj -> sprite = st -> sprite ; mobj -> frame = st -> frame ; if ( st -> action ) st -> action ( mobj ) ; mobj -> latecall = NULL ; state = st -> nextstate ; } while ( ! mobj -> tics && -- changes > 0 ) ; return true ; }
P_SetMobjState
Returns true if the mobj is still present
P_SetMobjState Returns true if the mobj is still present
/* call action functions when the state is set */ /* make sure it doesn't come back to life... */