home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Hack-Phreak Scene Programs
/
cleanhpvac.zip
/
cleanhpvac
/
WD_SRC.ZIP
/
SOURCE
/
TEXTURE.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-04
|
1KB
|
82 lines
#include "..\Source\LastWolf.hpp"
MPointerArray pTextures;
BOOL tx_UnloadTextures()
{
Texture *pCurTex;
WORD i, x;
for( i=0; i < pTextures.NumElements(); i++ )
{
pCurTex = (Texture *)pTextures.Get(i);
for( x = pCurTex->width-1; x >= 0; x-- )
delete pCurTex->pVertLines[x];
delete pCurTex;
}
return TRUE;
}
TextureID tx_GetIDFromName( BYTE *pSearchName )
{
WORD i;
Texture *pCurTex;
for( i=0; i < pTextures.NumElements(); i++ )
{
pCurTex = (Texture *)pTextures.Get(i);
if( strncmp( pSearchName, pCurTex->textureName, 8 ) == 0 )
return (TextureID)i;
}
// If it gets through the for loop, there isn't a texture loaded with that name.
return BAD_TEXTURE_ID;
}
Texture *tx_GetTexture( TextureID index )
{
return (Texture *)pTextures.Get(index);
}
Texture *tx_AddTexture( TextureID *idNewTexture )
{
Texture *pNewTex;
pNewTex = new Texture;
pNewTex->pVertLines = NULL;
pNewTex->width = pNewTex->height = 0;
pTextures.Append( pNewTex );
*idNewTexture = pTextures.NumElements() - 1;
return pNewTex;
}
BOOL tx_DrawTexture( TextureID idToDraw )
{
Texture *pTexture;
WORD x, y;
pTexture = (Texture *)pTextures.Get( idToDraw );
for( x=0; x < pTexture->width; x++ )
{
for( y=0; y < pTexture->height; y++ )
pScreenMem[y*s_Width+x] = pTexture->pVertLines[x][y];
}
return TRUE;
}