home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / WD_SRC.ZIP / SOURCE / TEXTURE.CPP < prev    next >
C/C++ Source or Header  |  1995-01-04  |  1KB  |  82 lines

  1. #include "..\Source\LastWolf.hpp"
  2.  
  3. MPointerArray pTextures;
  4.  
  5.  
  6. BOOL tx_UnloadTextures()
  7. {
  8.     Texture *pCurTex;
  9.     WORD i, x;
  10.     
  11.     for( i=0; i < pTextures.NumElements(); i++ )
  12.     {
  13.         pCurTex = (Texture *)pTextures.Get(i);
  14.         
  15.         for( x = pCurTex->width-1; x >= 0; x-- )
  16.             delete pCurTex->pVertLines[x];
  17.         
  18.         delete pCurTex;
  19.     }
  20.     
  21.     return TRUE;
  22. }                                
  23.  
  24.  
  25. TextureID tx_GetIDFromName( BYTE *pSearchName )
  26. {
  27.     WORD i;
  28.     Texture *pCurTex;
  29.     
  30.     for( i=0; i < pTextures.NumElements(); i++ )
  31.     {
  32.         pCurTex = (Texture *)pTextures.Get(i);
  33.         
  34.         if( strncmp( pSearchName, pCurTex->textureName, 8 ) == 0 )
  35.             return (TextureID)i;
  36.     }
  37.  
  38.     // If it gets through the for loop, there isn't a texture loaded with that name.
  39.     return BAD_TEXTURE_ID;
  40. }
  41.  
  42.  
  43. Texture *tx_GetTexture( TextureID index )
  44. {
  45.     return (Texture *)pTextures.Get(index);
  46. }
  47.  
  48.  
  49. Texture *tx_AddTexture( TextureID *idNewTexture )
  50. {
  51.     Texture *pNewTex;
  52.     
  53.     pNewTex = new Texture;
  54.     pNewTex->pVertLines = NULL;
  55.     pNewTex->width = pNewTex->height = 0;
  56.  
  57.     pTextures.Append( pNewTex );
  58.  
  59.     *idNewTexture = pTextures.NumElements() - 1;
  60.     
  61.     return pNewTex;
  62. }
  63.  
  64.  
  65. BOOL tx_DrawTexture( TextureID idToDraw )
  66. {
  67.     Texture *pTexture;
  68.     WORD x, y;
  69.     
  70.     pTexture = (Texture *)pTextures.Get( idToDraw );
  71.  
  72.     for( x=0; x < pTexture->width; x++ )
  73.     {
  74.         for( y=0; y < pTexture->height; y++ )
  75.             pScreenMem[y*s_Width+x] = pTexture->pVertLines[x][y];
  76.     }    
  77.     
  78.     return TRUE;
  79. }
  80.  
  81.  
  82.