level_load (STRING* filename);
Level change;
creates an empty level or
loads a new level based on a level map (WMB), terrain (HMP)
or model (MDL).
Parameters:
filename -
STRING* or char*; name of the map, model, or
terrain file,
or NULL for an empty level.
Remarks:
- The current level is closed, the cache holding level
entity files is purged. All current entities in the old level are
removed,
thus all entity pointers referring
to them
can't
be used anymore.
For preventing an entity file from being purged at level change - which could make sense for speeding up level loading - define it as a
view entity.
-
Functions assigned to
or called by
entities - that means all functions in which
the my pointer
is not zero - are automatically terminated at their next wait call.
All other functions in which my is zero, such as the main() function,
will keep running and won't change,
even if a different script was assigned in WED to the new level.
- A7 During the load process, the on_level event can be used to display
a progress bar or animation on a panel.
-
One frame after level loading the last_error variable indicates
loading errors.
- A7
The preload_mode variable determines whether level entities, meshes and textures are already created at load time. Level loading is slower in this case, but delays when entities become visible are avoided.
-
If the level requires no physics and collision detection, setting enable_polycollision to 0 before level_load will speed up loading and entity creation.
Speed:
SlowExample:
function main()
{
level_load("newlevel.wmb"); // load level newlevel.wmb
}
See Also:
game_load,
level_mark, level_loadendless, level_ent,
on_level, last_error
► latest
version online