/** * Called from TagProcess, NextTaggedActor() is * called repeatedly until the caller gets fed up or * there are no more tagged actors to look at. */ int NextTaggedActor(int previous) { PMOVER pMover; // Convert actor number to index if (!previous) previous = -1; else previous = TaggedActorIndex(previous); while (++previous < numTaggedActors) { pMover = GetMover(taggedActors[previous].id); // No tag on lead actor while he's moving if ((taggedActors[previous].id) == GetLeadId() && MoverMoving(pMover)) { taggedActors[previous].tagFlags &= ~(POINTING | TAGWANTED); continue; } // Not if the actor doesn't exist at the moment if (pMover && !MoverIs(pMover)) continue; if (!(pMover ? MoverHidden(pMover) : ActorHidden(taggedActors[previous].id))) { return taggedActors[previous].id; } } return 0; }
/** * Perform a walk directly initiated by a click. */ static void WalkProcess(CORO_PARAM, const void *param) { // COROUTINE CORO_BEGIN_CONTEXT; PMOVER pMover; int thisWalk; CORO_END_CONTEXT(_ctx); const WP_INIT *to = (const WP_INIT *)param; // get the co-ordinates - copied to process when it was created CORO_BEGIN_CODE(_ctx); _ctx->pMover = GetMover(LEAD_ACTOR); if (TinselV2 && MoverIs(_ctx->pMover) && !MoverIsSWalking(_ctx->pMover)) { assert(_ctx->pMover->hCpath != NOPOLY); // Lead actor is not in a path _ctx->thisWalk = SetActorDest(_ctx->pMover, to->x, to->y, false, 0); DontScrollCursor(); while (MoverMoving(_ctx->pMover) && (_ctx->thisWalk == GetWalkNumber(_ctx->pMover))) CORO_SLEEP(1); } else if (!TinselV2 && _ctx->pMover->bActive) { assert(_ctx->pMover->hCpath != NOPOLY); // Lead actor is not in a path GetToken(TOKEN_LEAD); SetActorDest(_ctx->pMover, to->x, to->y, false, 0); DontScrollCursor(); while (MoverMoving(_ctx->pMover)) CORO_SLEEP(1); FreeToken(TOKEN_LEAD); } CORO_END_CODE; }
/** * To be SWalk()ing or not to be SWalk()ing? */ bool MoverIsSWalking(PMOVER pMover) { return (MoverMoving(pMover) && pMover->bIgPath); }