void DrawBuildingLayout( INT32 iMapIndex )
{
	BUILDINGLAYOUTNODE *curr;
	INT32 iOffset;
	LEVELNODE* pNode;
	BOOLEAN fAdd;
	iOffset = iMapIndex - gsBuildingLayoutAnchorGridNo;
	curr = gpBuildingLayoutList;
	while( curr )
	{
		iMapIndex = curr->sGridNo + iOffset;
		if( iMapIndex > 0 && iMapIndex < WORLD_MAX )
		{
			fAdd = TRUE;
			pNode = gpWorldLevelData[ iMapIndex ].pTopmostHead;
			while( pNode )
			{
				if( pNode->usIndex == FIRSTPOINTERS1 )
				{
					fAdd = FALSE;
					break;
				}
				pNode = pNode->pNext;
			}
			if( fAdd )
				AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 );
		}
		curr = curr->next;		
	}
}
Beispiel #2
0
void ShowItemCursor( INT32 iMapIndex )
{
	LEVELNODE *pNode;
	pNode = gpWorldLevelData[ iMapIndex ].pTopmostHead;
	while( pNode )
	{
		if( pNode->usIndex == SELRING )
			return;
		pNode = pNode->pNext;
	}
	AddTopmostToTail( iMapIndex, SELRING1 );
}
Beispiel #3
0
void ShowExitGrids()
{
	INT32 i;
	LEVELNODE *pLevelNode;
	if( gfShowExitGrids )
		return;
	gfShowExitGrids = TRUE;
	for( i = 0; i < WORLD_MAX; i++ )
	{
		if( GetExitGridLevelNode( i, &pLevelNode ) )
		{
			AddTopmostToTail( i, FIRSTPOINTERS8 );
		}
	}
}
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) );
	}
}
void UpdateCursorAreas()
{
	INT32 x, y, iMapIndex;

	RemoveCursors();

	EnsureSelectionType();

	//Determine if the mouse is currently in the world.
	if( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA && GetMouseXY( &sGridX, &sGridY ) )
	{
		iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX );
		if( gpBuildingLayoutList )
		{
			gSelectRegion.iLeft = gSelectRegion.iRight = sGridX;
			gSelectRegion.iTop = gSelectRegion.iBottom = sGridY;
			fValidCursor = TRUE;
			DrawBuildingLayout( iMapIndex );
		}
		else switch( gusSelectionType )
		{
			case SMALLSELECTION: 
				gSelectRegion.iLeft = gSelectRegion.iRight = sGridX;
				gSelectRegion.iTop = gSelectRegion.iBottom = sGridY;
				fValidCursor = TRUE;
				break;
			case MEDIUMSELECTION: 
			case LARGESELECTION:  
			case XLARGESELECTION: 
				//The mouse mode value reflects the size of the cursor.
				gSelectRegion.iTop = sGridY - gusSelectionType;
				gSelectRegion.iBottom = sGridY + gusSelectionType;
				gSelectRegion.iLeft = sGridX - gusSelectionType;
				gSelectRegion.iRight = sGridX + gusSelectionType;
				ValidateSelectionRegionBoundaries();
				fValidCursor = TRUE;
				break;
			case LINESELECTION:
				fValidCursor = HandleAreaSelection();
				ForceAreaSelectionWidth();
				ValidateSelectionRegionBoundaries();
				break;
			case AREASELECTION:
				fValidCursor = HandleAreaSelection();
				break;
		}
	}
	//Draw all of the area cursors here.
	if( fValidCursor )
	{
		if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE || 
				iDrawMode == DRAW_MODE_REBEL || iDrawMode == DRAW_MODE_CIVILIAN ||
				iDrawMode == DRAW_MODE_SCHEDULEACTION )
		{
			iMapIndex = gSelectRegion.iTop * WORLD_COLS + gSelectRegion.iLeft;
			if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION || 
				  !IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION )
			{
				if( sBadMarker != iMapIndex )
				{
					RemoveBadMarker();
					if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) )
					{
						AddTopmostToTail( iMapIndex + ROOF_OFFSET, BADMARKER1 );
						sBadMarker = (INT16)(iMapIndex + ROOF_OFFSET );
					}
					else
					{
						AddTopmostToTail( (iMapIndex), BADMARKER1 );
						sBadMarker = (INT16)(iMapIndex);
					}
				}
			}
			else
			{
				RemoveBadMarker();
				if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) )
				{
					AddTopmostToTail( iMapIndex + ROOF_OFFSET, FIRSTPOINTERS5 );
					gfUsingOffset = TRUE;
				}
				else
					AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 );
			}
		}
		else for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ )
		{	
			for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ )
			{
				iMapIndex = y * WORLD_COLS + x;
				AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 );
			}
		}
	}
}