MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / LoadImage

Method LoadImage

CrySystem/ScriptObjectSystem.cpp:1160–1197  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// !load a texture @param szFileName the texture file path @return the texture id if succeded nil if failed */

Source from the content-addressed store, hash-verified

1158 @return the texture id if succeded nil if failed
1159*/
1160int CScriptObjectSystem::LoadImage(IFunctionHandler *pH)
1161{
1162 if (pH->GetParamCount() < 1)
1163 {
1164 CHECK_PARAMETERS(1);
1165
1166 return pH->EndFunction();
1167 }
1168 const char *sFileName;
1169 int nTid=0;
1170 bool bClamp = false;
1171 bool bRemovable = false;
1172 pH->GetParam(1,sFileName);
1173
1174 if (pH->GetParamCount() > 1)
1175 {
1176 pH->GetParam(2, bClamp);
1177 }
1178
1179 if (pH->GetParamCount() > 2)
1180 {
1181 pH->GetParam(3, bRemovable);
1182 }
1183
1184 //nTid=m_pRenderer->LoadTexture(sFileName);
1185 ITexPic * pPic = m_pRenderer->EF_LoadTexture((char *)sFileName, (bRemovable ? 0 : FT_NOREMOVE) | FT_NORESIZE, 0, eTT_Base);
1186
1187 if (pPic && pPic->IsTextureLoaded())
1188 {
1189 nTid=pPic->GetTextureID();
1190 m_pRenderer->SetTexture(nTid);
1191 m_pRenderer->SetTexClampMode(bClamp);
1192 USER_DATA ud=m_pScriptSystem->CreateUserData((int)nTid,USER_DATA_TEXTURE);
1193 return pH->EndFunction(ud);
1194 }
1195
1196 return pH->EndFunctionNull();
1197}
1198
1199int CScriptObjectSystem::FreeImage(IFunctionHandler *pH)
1200{

Callers

nothing calls this directly

Calls 10

EndFunctionMethod · 0.80
EF_LoadTextureMethod · 0.80
IsTextureLoadedMethod · 0.80
GetTextureIDMethod · 0.80
CreateUserDataMethod · 0.80
EndFunctionNullMethod · 0.80
GetParamCountMethod · 0.45
GetParamMethod · 0.45
SetTextureMethod · 0.45
SetTexClampModeMethod · 0.45

Tested by

no test coverage detected