/** * Moving actor's mid-top position. */ void GetMoverMidTop(PMOVER pMover, int *aniX, int *aniY) { assert(pMover); // Getting null moving actor's mid-top position assert(pMover->actorObj); // Getting null moving actor's mid-top position *aniX = (MultiLeftmost(pMover->actorObj) + MultiRightmost(pMover->actorObj)) / 2; *aniY = MultiHighest(pMover->actorObj); }
/** * Return the appropriate co-ordinate of the actor. * @param ano Actor Id */ int GetActorTop(int ano) { assert(ano > 0 && ano <= NumActors); // illegal actor number if (!TinselV2) { // Tinsel 1 version if (!actorInfo[ano - 1].presObj) return 0; return MultiHighest(actorInfo[ano - 1].presObj); } // Tinsel 2 version PMOVER pMover = GetMover(ano); int i; bool bIsObj; int top = 0; if (pMover != NULL) { return GetMoverTop(pMover); } else { for (i = 0, bIsObj = false; i < MAX_REELS; i++) { // If there's an object // and it is not a blank frame for it... if (actorInfo[ano-1].presObjs[i] && MultiHasShape(actorInfo[ano-1].presObjs[i])) { if (!bIsObj) { bIsObj = true; top = MultiHighest(actorInfo[ano-1].presObjs[i]); } else { if (MultiHighest(actorInfo[ano-1].presObjs[i]) < top) top = MultiHighest(actorInfo[ano-1].presObjs[i]); } } } return bIsObj ? top : 0; } }
/** * Returns the position of the mid-top of the actor. * Delegate the task for moving actors. * @param ano Actor Id * @param x Output x * @param y Output y */ void GetActorMidTop(int ano, int *x, int *y) { // Not used in JAPAN version PMOVER pActor; assert((ano > 0 && ano <= NumActors) || ano == LEAD_ACTOR); // unknown actor pActor = GetMover(ano); if (pActor) GetMoverMidTop(pActor, x, y); else if (TinselV2) { *x = (GetActorLeft(ano) + GetActorRight(ano)) / 2; *y = GetActorTop(ano); } else if (actorInfo[ano - 1].presObj) { *x = (MultiLeftmost(actorInfo[ano - 1].presObj) + MultiRightmost(actorInfo[ano - 1].presObj)) / 2; *y = MultiHighest(actorInfo[ano - 1].presObj); } else GetActorPos(ano, x, y); // The best we can do! }
/** * Moving actor's top co-ordinate. */ int GetMoverTop(PMOVER pMover) { assert(pMover); // Getting null moving actor's topmost position assert(pMover->actorObj); // Getting null moving actor's topmost position return MultiHighest(pMover->actorObj); }