Public feed #726117

Someone

public c v1 · immutable
Raw Edit
·published 2007-10-04 22:05 UTC
rendered paste body
#ifndef NORMALSRB2static inline fixed_t P_SSBSSCamera(camera_t* thiscam){	size_t i;	fixed_t farthestplayer = 0, current = 0;	fixed_t center = 0, numpeeps = FRACUNIT;	// Find the center of all of the players and use that as the focus point.	// SSNTails 07-21-2006	for (i=0; i < MAXPLAYERS; i++)	{		if (!playeringame[i])			continue;		if (!players[i].mo)			continue;#if 1		if (!players[i].lives)			continue;#endif		center = FixedMul(center, FixedDiv(numpeeps-FRACUNIT, numpeeps));		center += FixedMul(players[i].mo->x, FixedDiv(FRACUNIT, numpeeps));		numpeeps += FRACUNIT;	}	thiscam->x = center;	for (i=0; i < MAXPLAYERS; i++)	{#if 1		if (playeringame[i] && players[i].mo && players[i].lives)#else		if (playeringame[i] && players[i].mo)#endif		{			current = abs(players[i].mo->x-center);			if (current > farthestplayer)				farthestplayer = current;		}	}#if 1	fixed_t NewDist = -(farthestplayer + 64*FRACUNIT); //Subtract a little so the player isn't right on the edge of the camera.	fixed_t  lowestZ = 0, highestZ = 0, lookZ = 0;	int lowestplayer = 0, highestplayer = 0;	for(i=0; i < MAXPLAYERS; i++)	{		if (playeringame[i] && players[i].mo && players[i].lives)		{			if (players[i].mo->z > highestZ || !highestZ)			{				highestZ = players[i].mo->z;				highestplayer = i;			}			if (players[i].mo->z < lowestZ || !lowestZ)			{				lowestZ = players[i].mo->z;				lowestplayer = i;			}		}	}	if (highestZ > lowestZ)		lookZ = highestZ - lowestZ;	else // doesn't need to zoom out because of heights.		lookZ = 0;	// Zoom out!	if (lookZ != 0 && NewDist > players[lowestplayer].mo->y-(lookZ/2+lookZ*2))		NewDist = players[lowestplayer].mo->y-(lookZ/2+lookZ*2);	thiscam->y = NewDist;#else	thiscam->y = -(farthestplayer + 64*FRACUNIT); //Subtract a little so the player isn't right on the edge of the camera.#endif	return 0;}#endif