//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// !load a texture @param szFileName the texture file path @return the texture id if succeded nil if failed */
| 1158 | @return the texture id if succeded nil if failed |
| 1159 | */ |
| 1160 | int 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 | |
| 1199 | int CScriptObjectSystem::FreeImage(IFunctionHandler *pH) |
| 1200 | { |
nothing calls this directly
no test coverage detected