Thanks for the hint with freeze mode. I'll try that.
Here's the code that's currently in use:
function load_new_room (STRING* lName,STRING* entPosName) {
my = NULL; // make this action a global function
levelLoaded = 0;
scan_active = 0;
wait(2); // wait for some actions to stop
mouse_mode = 0;
set_commandLine_invisible();
if (entPosName != NULL) { // only change room if player walked through door, but not when changing player
if (current_player == c_player1.entity) {
c_player1.isInRoom = lName;
} else if (current_player == c_player2.entity) {
c_player2.isInRoom = lName;
} else if (current_player == c_player3.entity) {
c_player3.isInRoom = lName;
}
}
max_cams = 0;
level_wmb = lName;
level_load(lName);
wait(2);
place_inroom_characters();
me = ent_for_name (current_player_name);
player = me;
current_player = me;
if (entPosName != NULL) {
you = ent_for_name (entPosName);
}
if (me != NULL) {
if (current_player == c_player1.entity) {
inventory = (Bag*)getFromGSHashmap(_chr("inventory1"));
if (you != NULL) {
vec_set(c_player1->entity.x,you.x);
c_player1->entity.pan = you.pan;
}
if(c_player2.isInCurrentRoom == 1) {
set(c_player2.entity,PASSABLE);
}
if(c_player3.isInCurrentRoom == 1) {
set(c_player3.entity,PASSABLE);
}
} else if (current_player == c_player2.entity) {
inventory = (Bag*)getFromGSHashmap(_chr("inventory2"));
if(you != NULL) {
vec_set(c_player2->entity.x,you.x);
c_player2->entity.pan = you.pan;
}
if(c_player1.isInCurrentRoom == 1) {
set(c_player1.entity,PASSABLE);
}
if(c_player3.isInCurrentRoom == 1) {
set(c_player3.entity,PASSABLE);
}
} else if (current_player == c_player3.entity) {
inventory = (Bag*)getFromGSHashmap(_chr("inventory3"));
if(you != NULL) {
vec_set(c_player3->entity.x,you.x);
c_player3->entity.pan = you.pan;
}
if(c_player1.isInCurrentRoom == 1) {
set(c_player1.entity,PASSABLE);
}
if(c_player2.isInCurrentRoom == 1) {
set(c_player2.entity,PASSABLE);
}
}
}
init_cameras();
levelLoaded = 1;
automatic_cam_selector();
update_room_cam();
scan_active = 1;
mouse_mode = 2;
set_commandLine_visible();
object_scanner();
}