OK... no one seems to be able to understand my question... So I will try again.
#include <acknex.h>
#include <default2.c>
//
void main()
{
wait(1); level_load(NULL); wait(1); camera.x = -150; random_seed=100;
//--------------------------------------------------------------------------------------
//
ENTITY* ents[100]; int i,v; CONTACT* c; VECTOR tmpV;
//--------------------------------------------------------------------------------------
for(i=0; i<100; i++)
{
ents[i]=ent_create(SPHERE_MDL, vector(0,random(100)-50,random(100)-50), NULL);
ent_clone(ents[i]);
//
v = integer(random(ent_status(ents[i],0)));
c = ent_getvertex(ents[i], NULL, v);
tmpV.x = c.v.x; tmpV.y = c.v.z; tmpV.z = c.v.y;
vec_scale(tmpV, 1.5);
c.v.x = tmpV.x; c.v.z = tmpV.y; c.v.y = tmpV.z;
ent_setvertex(ents[i], c, v);
}
//--------------------------------------------------------------------------------------
while(1)
{
for(i=0; i<100; i++)
{
switch(integer(random(4)))
{
case 1:
ent_morph(ents[i], CUBE_MDL);
ent_clone(ents[i]);
break;
case 2:
ent_morph(ents[i], SPHERE_MDL);
ent_clone(ents[i]);
break;
default:
// just do vertex displacement
}
//
v = integer(random(ent_status(ents[i],0)));
c = ent_getvertex(ents[i], NULL, v);
tmpV.x = c.v.x; tmpV.y = c.v.z; tmpV.z = c.v.y;
vec_scale(tmpV, 1.1);
c.v.x = tmpV.x; c.v.z = tmpV.y; c.v.y = tmpV.z;
ent_setvertex(ents[i], c, v);
}
//
wait(1);
}
//--------------------------------------------------------------------------------------
sys_exit(0);
}
HOW can I fix the memory leak in this code? CAN I fix the memory leak in this code?
ALL instances of ent_clone and ent_morph are REQUIRED! Ent_remove is NOT ALLOWED!!
Hopefully someone can just ANSWER my questions without trying to re-write my code...
This is just SAMPLE code, I cant post 100Mb of project here...
This SAMPLE is just to convey my problem, and the limitations the answers
are constrained by...
PS:: I have tried playing with ent_purge and ent_reload, with no sucess,
but that doesnt mean Im not using them wrong...