Exemple #1
0
static int chopUpdateTerrainRecycling(struct CTerrain *ter)
{
    int i=1;
    int iNewNodePos,g,v;
    while(i < ter->iNodesCount)
    {

        if( iCameraPosX > ter->mNodes[i].x)
        {

            chopTerrainNodeDeleteAndShift(ter,i);

            iNewNodePos = ter->iLastNodePlacedPosX + 50;
            g = iScreenY - 10;

            v = 3*iPlayerSpeedX;
            if(v>50)
                v=50;
            if(iCurrLevelMode == LEVEL_MODE_STEEP)
                v*=5;

            chopAddTerrainNode(ter,iNewNodePos,g - iR(-v,v));
        }

        i++;

    }

    return 1;
}
int chopUpdateTerrainRecycling(CTerrain *ter)
{
	int i=1;
	int ret = 0;
	int iNewNodePos,g,v;
	while(i < ter->iNodesCount)
	{
		
		if( iCameraPosX > ter->mNodes[i].x)
		{
//			int x = ter->mNodes[i].x;
			//it's off the screen
			chopTerrainNodeDeleteAndShift(ter,i);
			
			
			
			iNewNodePos = ter->iLastNodePlacedPosX + 50; //magic number
			g = iScreenY - 10;
			
			v = 10;
			if(iLevelMode == LEVEL_MODE_STEEP)
				v*=5;
				
			chopAddTerrainNode(ter,iNewNodePos,g - iR(-v,v));
			
			ret=1;
			
			
		}

		i++;
		
	}

	return ret;
}