Exemplo n.º 1
0
//BEGINNING OF BUILDING UTILITY FUNCTIONS
void UpdateRoofsView()
{
	INT32 x;
	UINT16 usType;
	for ( x = 0; x < WORLD_MAX; x++ )
	{
		for ( usType = FIRSTROOF; usType <= LASTSLANTROOF; usType++ )
		{
			if( !gfAlternateRoofHiding || !gubWorldRoomInfo[ x ] && gfAlternateRoofHiding )
			{
				HideStructOfGivenType( x, usType, (BOOLEAN)(!fBuildingShowRoofs) );
			}
		}
	}
	gfRenderWorld = TRUE;
}
Exemplo n.º 2
0
//Given a gridno, it will erase the current roof, and calculate the new roof piece based on the
//wall orientions giving priority to the top and left walls before anything else.
//NOTE:  passing NULL for usRoofType will force the function to calculate the nearest roof type,
//  and use that for the new roof.  This is needed when erasing parts of multiple buildings simultaneously.
void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType )
{
	UINT16 usRoofIndex, usTileIndex;
	BOOLEAN fTop, fBottom, fLeft, fRight;
	if( !usRoofType )
	{
		usRoofType = SearchForRoofType( iMapIndex );
	}
	if( usRoofType == 0xffff )
		return;  //no roof type around, so don't draw one.
	//Analyse the mapindex for walls and set the flags.
	//NOTE:  There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT
	AddToUndoList( iMapIndex );
	EraseRoof( iMapIndex );

	fTop = GetHorizontalWall( iMapIndex - WORLD_COLS ) ? TRUE : FALSE;
	fLeft = GetVerticalWall( iMapIndex - 1 ) ? TRUE : FALSE;
	fBottom = GetHorizontalWall( iMapIndex ) ? TRUE : FALSE;
	fRight = GetVerticalWall( iMapIndex ) ? TRUE : FALSE;
	if( fTop && fLeft )						usRoofIndex = TOPLEFT_ROOF_INDEX;
	else if( fTop && fRight)			usRoofIndex = TOPRIGHT_ROOF_INDEX;
	else if( fBottom && fLeft )		usRoofIndex = BOTTOMLEFT_ROOF_INDEX;
	else if( fBottom && fRight )	usRoofIndex = BOTTOMRIGHT_ROOF_INDEX;
	else if( fTop )								usRoofIndex = TOP_ROOF_INDEX;
	else if( fBottom )						usRoofIndex = BOTTOM_ROOF_INDEX;
	else if( fLeft )							usRoofIndex = LEFT_ROOF_INDEX;
	else if( fRight )							usRoofIndex = RIGHT_ROOF_INDEX;
	else													usRoofIndex = CENTER_ROOF_BASE_INDEX + ( rand() % CENTER_ROOF_VARIANTS );
	GetTileIndexFromTypeSubIndex( usRoofType, usRoofIndex, &usTileIndex );
	AddRoofToHead( iMapIndex, usTileIndex );
	//if the editor view roofs is off, then the new roofs need to be hidden.
	if( !fBuildingShowRoofs )
	{
		HideStructOfGivenType( iMapIndex, usRoofType, TRUE );
	}
}	
Exemplo n.º 3
0
void PasteMapElementToNewMapElement( INT32 iSrcGridNo, INT32 iDstGridNo )
{
	MAP_ELEMENT			*pSrcMapElement;
	LEVELNODE				*pNode;
	UINT16					usType;

	DeleteStuffFromMapTile( iDstGridNo );
	DeleteAllLandLayers( iDstGridNo );

	//Get a pointer to the src mapelement
	pSrcMapElement = &gpWorldLevelData[ iSrcGridNo ];

	//Go through each levelnode, and paste the info into the new gridno
	pNode = pSrcMapElement->pLandHead;
	while( pNode )
	{
		if( pNode == pSrcMapElement->pLandStart )
			gpWorldLevelData[ iDstGridNo ].pLandStart = AddLandToTail( iDstGridNo, pNode->usIndex );
		else
			AddLandToTail( iDstGridNo, pNode->usIndex );
		pNode = pNode->pNext;
	}
	pNode = pSrcMapElement->pObjectHead;
	while( pNode )
	{
		AddObjectToTail( iDstGridNo, pNode->usIndex );
		pNode = pNode->pNext;
	}
	pNode = pSrcMapElement->pStructHead;
	while( pNode )
	{
		AddStructToTail( iDstGridNo, pNode->usIndex );
		pNode = pNode->pNext;
	}
	pNode = pSrcMapElement->pShadowHead;
	while( pNode )
	{
		AddShadowToTail( iDstGridNo, pNode->usIndex );
		pNode = pNode->pNext;
	}
	pNode = pSrcMapElement->pRoofHead;
	while( pNode )
	{
		AddRoofToTail( iDstGridNo, pNode->usIndex );
		pNode = pNode->pNext;
	}
	pNode = pSrcMapElement->pOnRoofHead;
	while( pNode )
	{
		AddOnRoofToTail( iDstGridNo, pNode->usIndex );
		pNode = pNode->pNext;
	}
	pNode = pSrcMapElement->pTopmostHead;
	while( pNode )
	{
		if( pNode->usIndex != FIRSTPOINTERS1 )
			AddTopmostToTail( iDstGridNo, pNode->usIndex );
		pNode = pNode->pNext;
	}
	for ( usType = FIRSTROOF; usType <= LASTSLANTROOF; usType++ )
	{
		HideStructOfGivenType( iDstGridNo, usType, (BOOLEAN)(!fBuildingShowRoofs) );
	}
}