Skip to content

Instantly share code, notes, and snippets.

@Interkarma
Created April 14, 2018 22:09
Show Gist options
  • Save Interkarma/7c83022a3cb73004816ae631a44d2070 to your computer and use it in GitHub Desktop.
Save Interkarma/7c83022a3cb73004816ae631a44d2070 to your computer and use it in GitHub Desktop.
Texture swap example
//
// BOOL ApplyRegion( long *pArchive )
// Change texture archive based on supported regions
// Return: TRUE if successful, otherwise FALSE
//
inline BOOL CDaggerfallExplorerApp::ApplyRegion( long *pArchive )
{
_ASSERT( pArchive );
// Exit if not using processor
if ( TERRAIN_NONE == m_dwTerrain ) {
return TRUE;
}
// Determine whether to apply climate offset
long nClimate = 0;
if ( WEATHER_WINTER == m_dwWeather && TERRAIN_DESERT != m_dwTerrain ) {
nClimate = 1;
}
// Find base index index of this texture
long nBase = *pArchive / 100;
// Process region against texture archive
long nIndex = *pArchive - (nBase * 100);
switch ( nIndex )
{
case STO_TERRAIN:
case STO_RUINS:
case STO_CASTLE:
case STO_CITYA:
case STO_CITYB:
case STO_CITYWALLS:
case STO_FARM:
case STO_FENCES:
case STO_MAGESGUILD:
case STO_MANOR:
case STO_MERCHANTHOMES:
case STO_TAVERNEXTERIORS:
case STO_TEMPLEEXTERIORS:
case STO_VILLAGE:
case STO_ROOFS:
*pArchive = (nIndex += m_dwTerrain + nClimate);
break;
default:
break;
};
return TRUE;
}/* ApplyRegion */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment