/** * Check for moving actor collision. */ PMOVER InMoverBlock(PMOVER pMover, int x, int y) { int caX; // Calling actor's pos'n int caL, caR; // Calling actor's left and right int taX, taY; // Test actor's pos'n int taL, taR; // Test actor's left and right caX = pMover->objX; if (pMover->hFnpath != NOPOLY || GetNoBlocking()) return NULL; caL = GetMoverLeft(pMover) + x - caX; caR = GetMoverRight(pMover) + x - caX; for (int i = 0; i < MAX_MOVERS; i++) { if (pMover == &g_Movers[i] || (TinselV2 && (g_Movers[i].actorObj == NULL)) || (!TinselV2 && !g_Movers[i].bActive)) continue; // At around the same height? GetMoverPosition(&g_Movers[i], &taX, &taY); if (g_Movers[i].hFnpath != NOPOLY) continue; if (ABS(y - taY) > 2) // 2 was 8 continue; // To the left? taL = GetMoverLeft(&g_Movers[i]); if (caR <= taL) continue; // To the right? taR = GetMoverRight(&g_Movers[i]); if (caL >= taR) continue; return &g_Movers[i]; } return NULL; }
/** * Return the appropriate co-ordinate of the actor. * @param ano Actor Id */ int GetActorLeft(int ano) { assert(ano > 0 && ano <= NumActors); // illegal actor number if (!TinselV2) { // Tinsel 1 version if (!actorInfo[ano - 1].presObj) return 0; return MultiLeftmost(actorInfo[ano - 1].presObj); } // Tinsel 2 version PMOVER pMover = GetMover(ano); int i; bool bIsObj; int left = 0; if (pMover != NULL) { return GetMoverLeft(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; left = MultiLeftmost(actorInfo[ano - 1].presObjs[i]); } else { if (MultiLeftmost(actorInfo[ano - 1].presObjs[i]) < left) left = MultiLeftmost(actorInfo[ano - 1].presObjs[i]); } } } return bIsObj ? left : 0; } }