JSBool js_obj_watch_stop_func(JSContext *cx,JSObject *j_obj,uintN argc,jsval *argv,jsval *rval) { obj_type *obj; obj=object_find_uid(js.attach.thing_uid); object_clear_watch(&obj->watch); return(JS_TRUE); }
int object_create(char *name,int type,int bind) { int n,idx; obj_type *obj; // find a unused object idx=-1; for (n=0;n!=max_obj_list;n++) { if (server.obj_list.objs[n]==NULL) { idx=n; break; } } if (idx==-1) return(-1); // create memory for new object obj=(obj_type*)malloc(sizeof(obj_type)); if (obj==NULL) return(-1); // put in list server.obj_list.objs[idx]=obj; // initial setup strcpy(obj->name,name); obj->idx=idx; obj->type=type; obj->bind=bind; obj->next_spawn_sub_event=sd_event_spawn_init; // initialize object obj->hidden=FALSE; obj->suspend=FALSE; obj->scenery.on=FALSE; obj->fly=FALSE; obj->single_speed=FALSE; obj->side_step=TRUE; obj->floating=TRUE; obj->quick_reverse=TRUE; obj->no_slide=FALSE; obj->crawl=TRUE; obj->open_doors=FALSE; obj->hide_all_weapons=FALSE; obj->find_on=TRUE; obj->hit_box.on=FALSE; obj->script_spawned=FALSE; obj->dispose_trigger=FALSE; obj->contact.object_on=TRUE; obj->contact.projectile_on=TRUE; obj->contact.force_on=TRUE; obj->contact.pushable=FALSE; obj->contact.collision_mode=collision_mode_cylinder; obj->pickup.on=FALSE; obj->pickup.ignore=FALSE; obj->damage.on=FALSE; obj->damage.crushable=FALSE; obj->damage.invincible=FALSE; obj->damage.in_damage=FALSE; obj->tint_color_idx=0; obj->character_idx=0; obj->input.mode=im_fpp; obj->input.freeze=FALSE; obj->input.respawn_freeze=FALSE; obj->in_collide_event=FALSE; obj->death_trigger=FALSE; obj->last_spawn_spot_idx=-1; obj->lock.x=obj->lock.y=obj->lock.z=FALSE; obj->damage_obj_idx=-1; obj->team_idx=net_team_none; obj->spawn_spot.name[0]=0x0; obj->spawn_spot.script[0]=0x0; obj->spawn_spot.params[0]=0x0; obj->click.on=FALSE; obj->click.distance=1500; obj->click.crosshair_up_idx=-1; obj->click.crosshair_down_idx=-1; object_clear_size(&obj->size); object_clear_position(&obj->pnt); object_clear_angle(&obj->ang); object_clear_motion(&obj->motion); object_clear_force(&obj->force); object_clear_movement(&obj->forward_move); object_clear_movement(&obj->side_move); object_clear_movement(&obj->vert_move); object_stop(obj); obj->sight.side_angle=20.0f; obj->sight.look_angle=0.0f; obj->sight.distance=22000; obj->bump.on=TRUE; obj->bump.high=450; obj->bump.smooth_factor=0.1f; obj->bump.smooth_offset=0; obj->slope_gravity=TRUE; obj->bounce.mesh_idx=-1; obj->bounce.factor=0.0f; obj->turn.ignore_mouse=FALSE; obj->turn.only_when_moving=FALSE; obj->turn.restrict_player_turning=FALSE; obj->face.obj_idx=-1; object_clear_angle(&obj->face.ang); obj->thrust.speed=0.5f; obj->thrust.max_speed=60.0f; obj->thrust.vct.x=obj->thrust.vct.y=obj->thrust.vct.z=0.0f; obj->thrust.drag=FALSE; obj->look.ang_add=0; obj->look.up_angle=80; obj->look.down_angle=35; obj->look.effect_weapons=TRUE; obj->duck.on=TRUE; obj->duck.mode=dm_stand; obj->duck.y_move=0; obj->duck.y_add=16; obj->duck.y_change=300; obj->jump.on=TRUE; obj->jump.y_add=32; obj->climb.on=FALSE; obj->climb.poly_ptr.mesh_idx=-1; obj->kickback.size=100; obj->vehicle.on=FALSE; obj->vehicle.use_vehicles=TRUE; obj->vehicle.in_enter=obj->vehicle.in_exit=FALSE; obj->vehicle.attach_obj_idx=-1; obj->radar.on=FALSE; obj->radar.icon[0]=0x0; obj->radar.icon_idx=-1; obj->radar.motion_only=FALSE; obj->radar.always_visible=FALSE; obj->radar.fade_start_tick=0; obj->status.health.value=obj->status.health.start_value=obj->status.health.max_value=100; obj->status.health.recover_tick=obj->status.health.recover_count=0; obj->status.health.recover_amount=1; obj->status.health.factor=1.0f; obj->status.armor.value=obj->status.armor.start_value=obj->status.armor.max_value=0; obj->status.armor.recover_tick=obj->status.armor.recover_count=0; obj->status.armor.recover_amount=1; obj->status.armor.factor=1.0f; obj->status.mesh_harm_count=0; object_clear_draw(&obj->draw); obj->ambient.on=FALSE; obj->held_weapon.mode=wm_held; obj->held_weapon.swap_tick=0; obj->held_weapon.current_idx=obj->held_weapon.next_idx=-1; obj->held_weapon.bounce_y=0; obj->crosshair_draw.on=FALSE; obj->crosshair_draw.alt_tick=0; obj->melee.strike_bone_name[0]=0x0; obj->melee.strike_pose_name[0]=0x0; obj->melee.object_strike_bone_name[0]=0x0; obj->melee.object_strike_pose_name[0]=0x0; obj->melee.radius=0; obj->melee.distance=0; obj->melee.damage=0; obj->melee.force=0; obj->melee.fall_off=TRUE; obj->hit_box.obj_hit_box_idx=-1; obj->hit_box.proj_hit_box_idx=-1; obj->count=0; obj->item_count=0; obj->turn.ang_add.y=0; obj->turn.fix_ang_add.y=0; obj->turn.ang_to.y=0; obj->turn.walk_speed=obj->turn.run_speed=obj->turn.crawl_speed=obj->turn.air_speed=1; obj->turn.walk_motion_speed=obj->turn.run_motion_speed=obj->turn.crawl_motion_speed=obj->turn.air_motion_speed=1; obj->turn.key_speed=1.8f; obj->turn.top_down_ang_offset=0.0f; obj->air_mode=am_ground; obj->liquid.mode=lm_out; obj->liquid.bob_y_move=0; obj->fall.dist=0; obj->fall.damage_minimum_height=3000; obj->fall.damage_factor=0.0f; obj->fall.started=FALSE; obj->fall.land_event_ok=FALSE; obj->last_move_animation_event=-1; obj->last_turn_animation_event=-1; obj->auto_walk.mode=aw_none; obj->auto_walk.dodge.on=FALSE; obj->label.text.str[0]=0x0; obj->label.bitmap.idx=-1; obj->label.bar.value=-1.0f; obj->debug.str[0]=0x0; object_clear_contact(&obj->contact); object_clear_touch(&obj->touch); object_clear_hit(&obj->hit); object_clear_pickup(&obj->pickup); object_clear_watch(&obj->watch); object_clear_remote(&obj->remote); object_grow_clear(obj); obj->score.kill=obj->score.death=obj->score.suicide=obj->score.goal=obj->score.score=0; obj->score.place=1; // clear weapons for (n=0;n!=max_weap_list;n++) { obj->weap_list.weaps[n]=NULL; } // connections for animated effects obj->draw.connect.obj_idx=idx; obj->draw.connect.weap_idx=-1; obj->draw.connect.proj_idx=-1; obj->draw.connect.net_sound=FALSE; obj->draw.connect.motion_vct.x=0.0f; obj->draw.connect.motion_vct.y=0.0f; obj->draw.connect.motion_vct.z=0.0f; return(idx); }