O Ilusionista
Captain 80K
I was checking some old posts and I want to better understand how those functions works.
loadmodel(name)
As far as I know - and according to @Kratus post here, loadmodel loads a model in the memory instantly.
And when we use "3" on the extra parameter, it will unload the model only when the level ends, right?
What the other values (1 and 2) does anyway? I can't find the info anymore, I remember it was somthing related with the sprites only.
The engine source has no info about the other values:
Then @msmalik681 added a new function called unload_model() back in 6412 build (not documented yet) which, if I got it right, unloads the model instantly.
Can we confirm if this works instantly?
Thanks.
loadmodel(name)
- "Load" a model that is currently set as "know" in models.txt.
- "name" is the model's name.
C-like:
loadmodel("Axel", 3);
As far as I know - and according to @Kratus post here, loadmodel loads a model in the memory instantly.
And when we use "3" on the extra parameter, it will unload the model only when the level ends, right?
What the other values (1 and 2) does anyway? I can't find the info anymore, I remember it was somthing related with the sprites only.
The engine source has no info about the other values:
C-like:
//loadmodel(name)
HRESULT openbor_loadmodel(ScriptVariant **varlist , ScriptVariant **pretvar, int paramCount)
{
LONG unload = 0;
s_model *model;
if(paramCount < 1)
{
goto loadmodel_error;
}
if(varlist[0]->vt != VT_STR)
{
goto loadmodel_error;
}
ScriptVariant_ChangeType(*pretvar, VT_PTR);
if(paramCount >= 2)
if(FAILED(ScriptVariant_IntegerValue(varlist[1], &unload)))
{
goto loadmodel_error;
}
model = load_cached_model(StrCache_Get(varlist[0]->strVal), "openbor_loadmodel", (char)unload);
if(paramCount >= 3 && model)
{
model_cache[model->index].selectable = (char)ScriptVariant_IsTrue(varlist[2]);
}
(*pretvar)->ptrVal = (VOID *)model;
//else, it should return an empty value
return S_OK;
loadmodel_error:
printf("Function needs a string and integer parameters: loadmodel(name, unload, selectable)\n");
ScriptVariant_Clear(*pretvar);
*pretvar = NULL;
return E_FAIL;
}
Then @msmalik681 added a new function called unload_model() back in 6412 build (not documented yet) which, if I got it right, unloads the model instantly.
unload_loadmodel(name);
Can we confirm if this works instantly?
Thanks.