Client Terrain Texture limit removal

Results 1 to 4 of 4
  1. #1
    Apprentice TwistOfFate is offline
    MemberRank
    Dec 2012 Join Date
    7Posts

    Client Terrain Texture limit removal

    TerrainMng.cpp

    In CTerrainMng::CTerrainMng replace
    Code:
    	ZeroMemory( m_aTerrain, sizeof( m_aTerrain ) );//* MAX_TERRAIN );
    by
    Code:
    #ifdef __TERRAIN_TEXFIX
    	m_aTerrain.clear();
    #else // __TERRAIN_TEXFIX
    	ZeroMemory( m_aTerrain, sizeof( m_aTerrain ) );//* MAX_TERRAIN );
    #endif // __TERRAIN_TEXFIX
    In CTerrainMng::DeleteDeviceObjects replace
    Code:
    	for( int i = 0; i < MAX_TERRAIN; i++ )
    	{
    		if( m_aTerrain[i].m_pTexture )
    			SAFE_RELEASE( m_aTerrain[i].m_pTexture  );
    	}
    by
    Code:
    #ifdef __TERRAIN_TEXFIX
    	for( map<DWORD, TERRAIN>::iterator it = m_aTerrain.begin(); it != m_aTerrain.end(); ++it )
    	{
    		if(it->second.m_pTexture)
    			SAFE_RELEASE( it->second.m_pTexture );
    	}
    #else // __TERRAIN_TEXFIX
    	for( int i = 0; i < MAX_TERRAIN; i++ )
    	{
    		if( m_aTerrain[i].m_pTexture )
    			SAFE_RELEASE( m_aTerrain[i].m_pTexture  );
    	}
    #endif // __TERRAIN_TEXFIX
    TerrainMng.h:

    Replace
    Code:
    	TERRAIN m_aTerrain[MAX_TERRAIN];
    by
    Code:
    #ifdef __TERRAIN_TEXFIX
    	map<DWORD, TERRAIN> m_aTerrain;
    #else // __TERRAIN_TEXFIX
    	TERRAIN m_aTerrain[MAX_TERRAIN];
    #endif // __TERRAIN_TEXFIX

    ~ Enjoy.


  2. #2
    Member Addi is offline
    MemberRank
    Nov 2011 Join Date
    72Posts

    Re: Client Terrain Texture limit removal

    Why are you using a map when a vector'll work fine, most likely even better? o~O

    Anyway, you know the entire terrain is redrawn for every single texture layer it has, right? If you've reached the texture limit, you should probably rethink your map. Most professional engines only allow 3-4 textures at once [depends on how many sampler registers are available], but FlyFF's engine is so old that they couldn't at the time, so it only does one. :I

    Sooooo much overdraw.

  3. #3
    Apprentice TwistOfFate is offline
    MemberRank
    Dec 2012 Join Date
    7Posts

    Re: Client Terrain Texture limit removal

    Because with a map you're not stuck to sequential indexes, with a vector you are. This way we can use 1000+ for our custom worlds' texture IDs so we don't have to redo anything whenever e-flyff releases a new world that already uses these indexes.

    edit; replaced maps by 'worlds' to avoid confusion.
    Last edited by TwistOfFate; 12-12-12 at 12:13 PM.

  4. #4
    Member Addi is offline
    MemberRank
    Nov 2011 Join Date
    72Posts

    Re: Client Terrain Texture limit removal

    Eh. I was goin off of the code in this topic alone, thought it was odd you were replacing an array with a map, but I forgot just how bad FlyFF's source is. xD

    Sorry bout that.



Advertisement