Announcement

Collapse
No announcement yet.

Any know how to thicken the borders?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Any know how to thicken the borders?

    I went through the code on a mad quest to find the width and came up with nothing. I was just hoping to thicken them about 5 pixels or so, because the thin lines can get confusing fast.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    Well I dug around a bit since I know more about code. Searching on ShowPoliticalBorders

    brought me to tiledraw.cpp & h

    first the code appears to be

    Code:
    void TiledMap:: DrawNationalBorders(aui_Surface *surface, MapPoint &pos)
    {
    	sint32 myOwner = GetVisibleCellOwner(pos);
    	sint32 neighborOwner;
    	uint32 myCityOwner = GetVisibleCityOwner(pos);
    	uint32 neighborCityOwner;
    
    	if(myOwner < 0)
    		return;
    
    	Pixel16 color = g_colorSet->GetPlayerColor(myOwner);
    	Pixel16 white = GetColor(COLOR_WHITE);
    
    	if(!surface) surface = m_surface;
    
    	Player *visP = g_player[g_selected_item->GetVisiblePlayer()];
    
    	
    	if (visP == NULL)
    		return;
    
    	Unit myCity(myCityOwner);
    	UnitData *myCityData = myCity.IsValid() ? myCity.AccessData() : NULL;
    
    	MapPoint neighbor;
    	if(pos.GetNeighborPosition(NORTHWEST, neighbor)) {
    		neighborOwner = GetVisibleCellOwner(neighbor);
    		if(neighborOwner != myOwner 
    		&&(visP->HasSeen(myOwner)
    		|| g_fog_toggle // The sense of fog of and god mode is to see something.
    		|| g_god)
    		&& g_theProfileDB->GetShowPoliticalBorders()
    		){
    			DrawColoredBorderEdge(surface, pos, color, NORTHWEST, k_BORDER_SOLID); //EMOD- k_BORDER_SOLID defined in tiledmap.h as 0 and dashed as 1 its a bool?
    		}
    
    		neighborCityOwner = GetVisibleCityOwner(neighbor);		
    		if(neighborCityOwner != myCityOwner) {
    			if(myCityData && 
    			   myCityData->GetVisibility() & (1 << visP->m_owner) &&
    			   g_theProfileDB->IsShowCityInfluence()) {
    				DrawColoredBorderEdge(surface, pos, white, NORTHWEST, k_BORDER_DASHED);
    			}
    		}
    	}
    
    	if(pos.GetNeighborPosition(SOUTHWEST, neighbor)) {
    		neighborOwner = GetVisibleCellOwner(neighbor);
    		if(neighborOwner != myOwner 
    		&&(visP->HasSeen(myOwner)
    		|| g_fog_toggle
    		|| g_god)
    		&& g_theProfileDB->GetShowPoliticalBorders()
    		){
    			DrawColoredBorderEdge(surface, pos, color, SOUTHWEST, k_BORDER_SOLID);
    		}		
    		neighborCityOwner = GetVisibleCityOwner(neighbor);
    		if(neighborCityOwner != myCityOwner) {
    			if(myCityData &&
    			   myCityData->GetVisibility() & (1 << visP->m_owner) &&
    			   g_theProfileDB->IsShowCityInfluence()) {
    				DrawColoredBorderEdge(surface, pos, white, SOUTHWEST, k_BORDER_DASHED);
    			}
    		}
    	}
    
    	if(pos.GetNeighborPosition(NORTHEAST, neighbor)) {
    		neighborOwner = GetVisibleCellOwner(neighbor);
    		if(neighborOwner != myOwner 
    		&&(visP->HasSeen(myOwner)
    		|| g_fog_toggle
    		|| g_god)
    		&& g_theProfileDB->GetShowPoliticalBorders()
    		){
    			DrawColoredBorderEdge(surface, pos, color, NORTHEAST, k_BORDER_SOLID);
    		}
    		neighborCityOwner = GetVisibleCityOwner(neighbor);
    		if(neighborCityOwner != myCityOwner) {
    			if(myCityData &&
    			   myCityData->GetVisibility() & (1 << visP->m_owner) &&
    			   g_theProfileDB->IsShowCityInfluence()) {
    				DrawColoredBorderEdge(surface, pos, white, NORTHEAST, k_BORDER_DASHED);
    			}
    		}
    	}
    
    	if(pos.GetNeighborPosition(SOUTHEAST, neighbor)) {
    		neighborOwner = GetVisibleCellOwner(neighbor);
    		if(neighborOwner != myOwner 
    		&&(visP->HasSeen(myOwner)
    		|| g_fog_toggle
    		|| g_god)
    		&& g_theProfileDB->GetShowPoliticalBorders()
    		){
    			DrawColoredBorderEdge(surface, pos, color, SOUTHEAST, k_BORDER_SOLID);
    		}
    		neighborCityOwner = GetVisibleCityOwner(neighbor);
    		if(neighborCityOwner != myCityOwner) {
    			if(myCityData &&
    			   myCityData->GetVisibility() & (1 << visP->m_owner) &&
    			   g_theProfileDB->IsShowCityInfluence()) {
    				DrawColoredBorderEdge(surface, pos, white, SOUTHEAST, k_BORDER_DASHED);
    			}
    		}
    	}
    }
    
    void TiledMap:: DrawColoredBorderEdge(aui_Surface *surf, const MapPoint &pos, Pixel16 selectColorPixel, WORLD_DIRECTION side, sint32 dashMode)
    {
    	sint32		x, y;
    	maputils_MapXY2PixelXY(pos.x, pos.y, &x, &y);
    
    	sint32 width = GetZoomTilePixelWidth();  // changing here got rid of the border
    	sint32 height = GetZoomTilePixelHeight();
    
    	y += (sint32) ((double)k_TILE_PIXEL_HEADROOM * m_scale);
    
    	if (x < 0) return;
    	if (x >= surf->Width()-width) return;
    	if (y < 0) return;
    	if (y >= surf->Height() - height) return;
    
    	AddDirtyToMix(x, y, width, height);
    
    	uint8	* surfBase = m_surfBase; 
    	sint32  surfPitch = m_surfPitch; 
    
    	
    	uint16 *pDestPixel;
    
    	sint32 num = k_TILE_GRID_HEIGHT - k_TILE_PIXEL_HEADROOM;
    	sint32 den = height;
    	sint32 tot = num;
    
    	sint32 row = 0;
    
    	sint32 startI, endI;
    	if(side == NORTHWEST || side == NORTHEAST) {
    		startI = k_TILE_PIXEL_HEADROOM;  // E - pixel headroom is the space on the tga above the square tileset.h has these values
    		endI = k_TILE_PIXEL_HEADROOM + (k_TILE_GRID_HEIGHT / 2);
    	} else {
    		startI = k_TILE_PIXEL_HEADROOM + (k_TILE_GRID_HEIGHT / 2);
    		endI = k_TILE_GRID_HEIGHT;
    	}
    
    	bool west = (side == NORTHWEST) || (side == SOUTHWEST);
    	bool north = (side == NORTHWEST) || (side == NORTHEAST);
    
    	for (sint32 i = k_TILE_PIXEL_HEADROOM; i < k_TILE_GRID_HEIGHT;) 
    	{
    		if(north && i >= (k_TILE_PIXEL_HEADROOM + k_TILE_GRID_HEIGHT) / 2)
    			break;
    
    #if 0
    		start = (sint32) ((double)m_tileHitMask[i].start * m_scale);
    		end = (sint32)((double)m_tileHitMask[i].end * m_scale);
    #endif
    		sint32 start = m_tileHitMask[i].start;
    		sint32 end   = m_tileHitMask[i].end  ;
    
    
    		while (tot >= den) {
    			i++;
    			tot -= den;
    		}
    		tot += num;
    
    		if(!north && i < (k_TILE_PIXEL_HEADROOM + k_TILE_GRID_HEIGHT) / 2) {
    			row++;
    			continue;
    		}
    
    		if(dashMode && (row & 0x2)) {
    			row++;
    			continue;
    		}
    
    		pDestPixel = (Pixel16 *)(surfBase + ((y+row) * surfPitch) + ((x+start) << 1)); //EMOD change here
    		if(west) {
    			*pDestPixel = selectColorPixel;
    			*(pDestPixel + 1) = selectColorPixel;
    			*(pDestPixel + 2) = selectColorPixel;
    		}
    		pDestPixel += (end-start);
    
    		if(!west) {
    			*pDestPixel = 0; selectColorPixel;
    			*(pDestPixel - 1) = selectColorPixel;
    			*(pDestPixel - 2) = selectColorPixel;
    		}
    
    		row++;
    	}
    
    }
    but nothing on pixels which I assume to be k_BORDER_SOLID or k_BORDER_DASHED

    but in tiledraw.h I see
    Code:
    #define k_BORDER_SOLID 0
    #define k_BORDER_DASHED 1
    which looks like a bool. Am I missing something that will give me how think the line will can be? I'd like to make it an option Or even possible use a tga for the different angles (it looks supoprtable) so we can get ome of the nice border graphics that fans have created for Civ3.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment


    • #3
      Closing this thread since I made it so that borders can be mapicons
      Formerly known as "E" on Apolyton

      See me at Civfanatics.com

      Comment

      Working...
      X