void server_game_stop(void) { // dispose remote and game // bound objects object_dispose_2(bt_remote); object_dispose_2(bt_game); // dispose game script scripts_dispose(js.game_attach.script_uid); // finish with object list free object_free_list(); }
void proj_setup_dispose(weapon_type *weap,int idx) { proj_setup_type *proj_setup; proj_setup=weap->proj_setup_list.proj_setups[idx]; if (proj_setup==NULL) return; // clear scripts and models scripts_dispose(proj_setup->script_idx); model_draw_free(&proj_setup->draw); // free and empty from list free(proj_setup); weap->proj_setup_list.proj_setups[idx]=NULL; }
void proj_setup_dispose(weapon_type *weap,int idx) { proj_setup_type *proj_setup; proj_setup=weap->proj_setup_list.proj_setups[idx]; if (proj_setup==NULL) return; // call the dispose event scripts_post_event_console(proj_setup->script_idx,-1,sd_event_dispose,0,0); // clear scripts and models scripts_dispose(proj_setup->script_idx); model_draw_dispose(&proj_setup->draw); // free and empty from list free(proj_setup); weap->proj_setup_list.proj_setups[idx]=NULL; }
void object_dispose_single(int idx) { int n; obj_type *obj; obj=server.obj_list.objs[idx]; // call the dispose event scripts_post_event_console(obj->script_idx,-1,sd_event_dispose,0,0); // destroy any live projectiles projectile_dispose_object(obj); // dispose weapons for (n=0;n!=max_weap_list;n++) { weapon_dispose(obj,n); } // if this is map bound, then // remove any particles attached // to bones if (obj->bind==bt_map) effect_object_bone_attach_particle_dispose(idx); // clear scripts and models scripts_dispose(obj->script_idx); model_draw_dispose(&obj->draw); // free and empty from list free(obj); server.obj_list.objs[idx]=NULL; }
bool server_game_start(char *game_script_name,int skill,network_reply_join_remotes *remotes,char *err_str) { int n; network_request_object_add *obj_add; // initialize lists model_initialize(); object_initialize_list(); weapon_initialize_list(); proj_setup_initialize_list(); scripts_initialize(); script_globals_initialize(); timers_initialize(); // setup skill level server.skill=skill; // run game script map.info.name[0]=0x0; map.info.player_start_name[0]=0x0; map.info.player_start_type[0]=0x0; map.info.in_load=FALSE; server.player_obj_uid=-1; js.game_attach.thing_type=thing_type_game; js.game_attach.thing_uid=-1; scripts_clear_attach_data(&js.game_attach); if (!scripts_add(&js.game_attach,"Game",game_script_name,NULL,err_str)) return(FALSE); // editor map override? if (setup.editor_override.on) { strcpy(map.info.name,setup.editor_override.map); } // can't start a game without a map if (map.info.name[0]==0x0) { strcpy(err_str,"Game: No start map specified in game script"); return(FALSE); } // prepare for any script based spawns object_script_spawn_start(); // put in additional objects (remotes, bots) if (remotes!=NULL) { obj_add=remotes->objects; for (n=0;n!=remotes->count;n++) { remote_add(obj_add,FALSE); obj_add++; } } // start player object server.player_obj_uid=object_start(NULL,TRUE,bt_game,-1,err_str); if (server.player_obj_uid==-1) { scripts_dispose(js.game_attach.script_uid); return(FALSE); } // force player to auto-spawn // spawing of player needs to happen before map_start events object_spawn(object_find_uid(server.player_obj_uid)); // finish any script based spawns object_script_spawn_finish(); return(TRUE); }