Having one game loop is the way to go IMO, so as long as your project isn't that complex already change it.
wait(1) is rather "slow" and you have no real influence on when functions are executed. proc_mode (in particular PROC_GLOBAL) is a game and project killer, leading to seemingly random crashes as it affects all kinds of functions you don't want it to have an impact on. Example:
Click to reveal..
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////

void projectile()
{
    my.skill1 = 128;
    my.pan = random(20)-10;
    my.tilt = random(20)-10;
    while(my.skill1 > 0)
    {
        c_move(me,vector(16*time_step,0,0),nullvector,0);
        my.skill1 -= time_step;
        
        VECTOR temp;
        vec_set(temp,my.x);
        if(vec_to_screen(temp,camera)) draw_text(str_printf(NULL,"%d",(int)proc_mode),temp.x,temp.y,COLOR_RED);
        
        wait(1);
    }
    ptr_remove(me);
}

void spawnProjectile()
{
    proc_mode = PROC_GLOBAL;
    wait(1); // <- doesn't help as proc_mode is restored after wait
    ent_create(CUBE_MDL,vector(0,random(16)-8,0),projectile);
}

void reload()
{
    level_load(NULL);
}

void main()
{
    fps_max = 60;
    video_mode = 10;
    level_load(NULL);
    on_mouse_left = spawnProjectile; // press left mouse button a few times,
    on_mouse_right = reload; // then the right mouse button to crash the game
}



What I've done for the past few years for new projects was to use on_frame, like this:

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

// header files
#include "player.h"

// implementation:
#include "player.c"

///////////////////////////////

void mainFrameEvent()
{
	input update function;
	if(gameMode == GAME_MODE_PLAY)
	{
		objectsUpdate();
		enemiesUpdate();
		playerUpdate();
	}
	if(gameMode == other modes) { ... }
}

void main()
{
	fps_max = 60;
	level_load(NULL);
	...
	on_frame = mainFrameEvent;
}



This way you have complete control over what gets executed when and how. You could for example freeze all enemies or projectiles in the game with a simple if(variable) check, while allowing the player to move freely.
You only have to let's say create a list of objects after level_load (on_level_load or what it's called) and free that list on or before level change.

I still use wait(1) entity loops here and there but just for some level decoration/ dynamic objects which don't have an actual influence on gameplay.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends