void call_init_ai_object(object *objp, int behavior) { int hide_segment; if (behavior == AIB_STATION) hide_segment = Cursegp-Segments; else { if (Markedsegp != NULL) hide_segment = Markedsegp-Segments; else hide_segment = Cursegp-Segments; } init_ai_object(objp-Objects, behavior, hide_segment); if (behavior == AIB_STATION) { int cseg, mseg; cseg = 0; mseg = 0; if (Cursegp != NULL) cseg = Cursegp-Segments; if (Markedsegp != NULL) { mseg = Markedsegp-Segments; } objp->ctype.ai_info.follow_path_start_seg = Cursegp-Segments; objp->ctype.ai_info.follow_path_end_seg = Markedsegp-Segments; } }
void call_init_ai_object(object *objp, int behavior) { int hide_segment; if (behavior == AIB_STATION) hide_segment = SEGMENT_NUMBER(Cursegp); else { if (Markedsegp != NULL) hide_segment = SEGMENT_NUMBER(Markedsegp); else hide_segment = SEGMENT_NUMBER(Cursegp); } mprintf((0, "Initializing AI object with hide segment = %i\n", hide_segment)); init_ai_object(OBJECT_NUMBER(objp), behavior, hide_segment); if (behavior == AIB_STATION) { int cseg, mseg; cseg = 0; mseg = 0; if (Cursegp != NULL) cseg = SEGMENT_NUMBER(Cursegp); if (Markedsegp != NULL) { mseg = SEGMENT_NUMBER(Markedsegp); } //objp->ctype.ai_info.follow_path_start_seg = SEGMENT_NUMBER(Cursegp); //objp->ctype.ai_info.follow_path_end_seg = SEGMENT_NUMBER(Markedsegp); } }
static void call_init_ai_object(object &objp, ai_behavior behavior) { segnum_t hide_segment; if (behavior == ai_behavior::AIB_STATION) hide_segment = Cursegp; else { if (Markedsegp != segment_none) hide_segment = Markedsegp; else hide_segment = Cursegp; } init_ai_object(objp, behavior, hide_segment); }
object * create_morph_robot( segment *segp, vms_vector *object_pos, int object_id) { short objnum; object *obj; int default_behavior; Players[Player_num].num_robots_level++; Players[Player_num].num_robots_total++; objnum = obj_create(OBJ_ROBOT, object_id, segp-Segments, object_pos, &vmd_identity_matrix, Polygon_models[Robot_info[object_id].model_num].rad, CT_AI, MT_PHYSICS, RT_POLYOBJ); if ( objnum < 0 ) { mprintf((1, "Can't create morph robot. Aborting morph.\n")); Int3(); return NULL; } obj = &Objects[objnum]; //Set polygon-object-specific data obj->rtype.pobj_info.model_num = Robot_info[obj->id].model_num; obj->rtype.pobj_info.subobj_flags = 0; //set Physics info obj->mtype.phys_info.mass = Robot_info[obj->id].mass; obj->mtype.phys_info.drag = Robot_info[obj->id].drag; obj->mtype.phys_info.flags |= (PF_LEVELLING); obj->shields = Robot_info[obj->id].strength; default_behavior = Robot_info[obj->id].behavior; init_ai_object(obj-Objects, default_behavior, -1 ); // Note, -1 = segment this robot goes to to hide, should probably be something useful create_n_segment_path(obj, 6, -1); // Create a 6 segment path from creation point. Ai_local_info[objnum].mode = ai_behavior_to_mode(default_behavior); return obj; }
static void call_init_ai_object(dxxobject *objp, int behavior) { segnum_t hide_segment; if (behavior == AIB_STATION) hide_segment = Cursegp-Segments; else { if (Markedsegp != NULL) hide_segment = Markedsegp-Segments; else hide_segment = Cursegp-Segments; } init_ai_object(objp-Objects, behavior, hide_segment); if (behavior == AIB_STATION) { //objp->ctype.ai_info.follow_path_start_seg = Cursegp-Segments; //objp->ctype.ai_info.follow_path_end_seg = Markedsegp-Segments; } }
// ------------------------------------------------------------------------------------ int place_object(segment *segp, vms_vector *object_pos, int object_type) { short objnum; object *obj; vms_matrix seg_matrix; med_extract_matrix_from_segment(segp,&seg_matrix); switch(ObjType[object_type]) { case OL_HOSTAGE: objnum = obj_create(OBJ_HOSTAGE, -1, segp-Segments,object_pos,&seg_matrix,HOSTAGE_SIZE, CT_NONE,MT_NONE,RT_HOSTAGE); if ( objnum < 0 ) return 0; obj = &Objects[objnum]; // Fill in obj->id and other hostage info hostage_init_info( objnum ); obj->control_type = CT_POWERUP; obj->rtype.vclip_info.vclip_num = Hostage_vclip_num[ObjId[object_type]]; obj->rtype.vclip_info.frametime = Vclip[obj->rtype.vclip_info.vclip_num].frame_time; obj->rtype.vclip_info.framenum = 0; break; case OL_ROBOT: objnum = obj_create(OBJ_ROBOT,ObjId[object_type],segp-Segments,object_pos, &seg_matrix,Polygon_models[Robot_info[ObjId[object_type]].model_num].rad, CT_AI,MT_PHYSICS,RT_POLYOBJ); if ( objnum < 0 ) return 0; obj = &Objects[objnum]; //Set polygon-object-specific data obj->rtype.pobj_info.model_num = Robot_info[obj->id].model_num; obj->rtype.pobj_info.subobj_flags = 0; //set Physics info obj->mtype.phys_info.mass = Robot_info[obj->id].mass; obj->mtype.phys_info.drag = Robot_info[obj->id].drag; obj->mtype.phys_info.flags |= (PF_LEVELLING); obj->shields = Robot_info[obj->id].strength; { int hide_segment; if (Markedsegp) hide_segment = Markedsegp-Segments; else hide_segment = -1; // robots which lunge forward to attack cannot have behavior type still. if (Robot_info[obj->id].attack_type) init_ai_object(obj-Objects, AIB_NORMAL, hide_segment); else init_ai_object(obj-Objects, AIB_STILL, hide_segment); } break; case OL_POWERUP: objnum = obj_create(OBJ_POWERUP,ObjId[object_type], segp-Segments,object_pos,&seg_matrix,Powerup_info[ObjId[object_type]].size, CT_POWERUP,MT_NONE,RT_POWERUP); if ( objnum < 0 ) return 0; obj = &Objects[objnum]; //set powerup-specific data obj->rtype.vclip_info.vclip_num = Powerup_info[obj->id].vclip_num; obj->rtype.vclip_info.frametime = Vclip[obj->rtype.vclip_info.vclip_num].play_time/Vclip[obj->rtype.vclip_info.vclip_num].num_frames; obj->rtype.vclip_info.framenum = 0; if (obj->id == POW_VULCAN_WEAPON) obj->ctype.powerup_info.count = VULCAN_WEAPON_AMMO_AMOUNT; else obj->ctype.powerup_info.count = 1; break; case OL_CLUTTER: case OL_CONTROL_CENTER: { int obj_type,control_type; if (ObjType[object_type]==OL_CONTROL_CENTER) { obj_type = OBJ_CNTRLCEN; control_type = CT_CNTRLCEN; } else { obj_type = OBJ_CLUTTER; control_type = CT_NONE; } objnum = obj_create(obj_type,object_type,segp-Segments,object_pos, &seg_matrix,Polygon_models[ObjId[object_type]].rad, control_type,MT_NONE,RT_POLYOBJ); if ( objnum < 0 ) return 0; obj = &Objects[objnum]; obj->shields = ObjStrength[object_type]; //Set polygon-object-specific data obj->shields = ObjStrength[object_type]; obj->rtype.pobj_info.model_num = ObjId[object_type]; obj->rtype.pobj_info.subobj_flags = 0; break; } case OL_PLAYER: { objnum = obj_create(OBJ_PLAYER,ObjId[object_type],segp-Segments,object_pos, &seg_matrix,Polygon_models[Player_ship->model_num].rad, CT_NONE,MT_PHYSICS,RT_POLYOBJ); if ( objnum < 0 ) return 0; obj = &Objects[objnum]; //Set polygon-object-specific data obj->rtype.pobj_info.model_num = Player_ship->model_num; obj->rtype.pobj_info.subobj_flags = 0; //for (i=0;i<MAX_SUBMODELS;i++) // vm_angvec_zero(&obj->rtype.pobj_info.anim_angles[i]); //set Physics info vm_vec_zero(&obj->mtype.phys_info.velocity); obj->mtype.phys_info.mass = Player_ship->mass; obj->mtype.phys_info.drag = Player_ship->drag; obj->mtype.phys_info.flags |= PF_TURNROLL | PF_LEVELLING | PF_WIGGLE; obj->shields = i2f(100); break; } default: break; } Cur_object_index = objnum; //Cur_object_seg = Cursegp; show_objects_in_segment(Cursegp); //mprintf the objects Update_flags |= UF_WORLD_CHANGED; return 1; }