You could also avoid the wait call in 'test' function and cut it in three: creator, loop content and remover. So the waiting function calls the creator before its loop, 'test' loop content as condition of the waiting function, and remover when breaking waiting funtion loop.
ENTITY *entBulletCreate ( VECTOR *vPos, VECTOR *vDir )
{
...
ENTITY *entBullet = ent_create ( ...
...
return entBullet;
}
var fnBulletMove ( ENTITY *ent )
{
...
c_move ( ent, ...
if ( HIT_TARGET )
return 0;
else
return 1;
}
function entBulletRemove ( ENTITY *ent )
{
ent_remove ( ent );
}
funtion start ()
{
ENTITY *entBullet = entBulletCreate ( ...
...
while ( entBulletMove ( entBullet ) )
{
...
wait(1);
}
...
entBulletRemove ( entBullet );
}