Esempio n. 1
0
void GetActorPos(int ano, int *x, int *y) {
	PMOVER pActor;

	assert((ano > 0 && ano <= NumActors) || ano == LEAD_ACTOR); // unknown actor

	pActor = GetMover(ano);

	if (pActor)
		GetMoverPosition(pActor, x, y);
	else {
		*x = actorInfo[ano - 1].x;
		*y = actorInfo[ano - 1].y;
	}
}
Esempio n. 2
0
/**
 * 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;
}