diff --git a/saco/game/textures.cpp b/saco/game/textures.cpp new file mode 100644 index 0000000..6046e78 --- /dev/null +++ b/saco/game/textures.cpp @@ -0,0 +1,180 @@ + +#include +#include "textures.h" + +//----------------------------------------------------------- + +int FindTextureSlot(char *szName) +{ + int iRetVal; + + _asm push szName + _asm mov edx, 0x731850 + _asm call edx + _asm pop edx + _asm mov iRetVal, eax + + return iRetVal; +} + +//----------------------------------------------------------- + +int AddTextureSlot(char *szName) +{ + int iResult; + + _asm push szName + _asm mov edx, 0x731C80 + _asm call edx + _asm pop edx + _asm mov iResult, eax + + return iResult; +} + +//----------------------------------------------------------- + +int LoadTexture(int iIndex, char *szName) +{ + BYTE byteResult = 0; + + _asm xor eax, eax + _asm push szName + _asm push iIndex + _asm mov edx, 0x7320B0 + _asm call edx + _asm mov byteResult, al + _asm pop edx + _asm pop edx + + return byteResult; +} + +//----------------------------------------------------------- + +void AddTextureRef(int iIndex) +{ + _asm push iIndex + _asm mov edx, 0x731A00 + _asm call edx + _asm pop edx +} + +//----------------------------------------------------------- + +void RemoveTextureRef(int iIndex) +{ + _asm push iIndex + _asm mov edx, 0x731A30 + _asm call edx + _asm pop edx +} + +//----------------------------------------------------------- + +void PushCurrentTexture() +{ + _asm mov edx, 0x7316A0 + _asm call edx +} + +//----------------------------------------------------------- + +void PopCurrentTexture() +{ + _asm mov edx, 0x7316B0 + _asm call edx +} + +//----------------------------------------------------------- + +void SetCurrentTexture(int iIndex) +{ + _asm push iIndex + _asm mov edx, 0x7319C0 + _asm call edx + _asm pop edx +} + +//----------------------------------------------------------- + +DWORD ReloadTexture(char *szName) +{ + DWORD dwThisTexture = 0; + + _asm push szName + _asm lea ecx, dwThisTexture + _asm mov edx, 0x727270 + _asm call edx + + return dwThisTexture; +} + +//----------------------------------------------------------- + +void DestroyTexture(DWORD dwTexture) +{ + _asm mov eax, dwTexture + _asm mov dwTexture, eax + _asm lea ecx, dwTexture + _asm mov edx, 0x7281E0 + _asm call edx +} + +//----------------------------------------------------------- + +void RemoveTextureSlotByName(char *szName) +{ + int iIndex = FindTextureSlot(szName); + + if(iIndex == -1) return; + + _asm push iIndex + _asm mov edx, 0x731CD0 + _asm call edx + _asm pop edx +} + +//----------------------------------------------------------- + +void RemoveTexture(int iIndex) +{ + if(iIndex == -1) return; + + _asm push iIndex + _asm mov edx, 0x731E90 + _asm call edx + _asm pop edx +} + +//----------------------------------------------------------- + +void RemoveTextureSlot(int iIndex) +{ + if(iIndex == -1) return; + + _asm push iIndex + _asm mov edx, 0x731CD0 + _asm call edx + _asm pop edx +} + +//----------------------------------------------------------- + +int GetTextureNumRefs(int iIndex) +{ + int iRetVal = -1; + + if(iIndex == -1) return -1; + + _asm push iIndex + _asm mov edx, 0x731AA0 + _asm call edx + _asm mov iRetVal, eax + _asm pop edx + + return iRetVal; +} + +//----------------------------------------------------------- +// EOF diff --git a/saco/game/textures.h b/saco/game/textures.h new file mode 100644 index 0000000..f322a58 --- /dev/null +++ b/saco/game/textures.h @@ -0,0 +1,21 @@ + +#pragma once + +//----------------------------------------------------------- + +int FindTextureSlot(char *szName); +int AddTextureSlot(char *szName); +int LoadTexture(int iIndex, char *szName); +void AddTextureRef(int iIndex); +void RemoveTextureRef(int iIndex); +void PushCurrentTexture(); +void PopCurrentTexture(); +void SetCurrentTexture(int iIndex); +DWORD ReloadTexture(char *szName); +void DestroyTexture(DWORD dwTexture); +void RemoveTextureSlotByName(char *szName); +void RemoveTexture(int iIndex); +void RemoveTextureSlot(int iIndex); +int GetTextureNumRefs(int iIndex); + +//-----------------------------------------------------------