Processes the AI Initialize event
| 3088 | |
| 3089 | // Processes the AI Initialize event |
| 3090 | void AlienOrganism::DoInit(int me) { |
| 3091 | int flags; |
| 3092 | msafe_struct m; |
| 3093 | m.objhandle = me; |
| 3094 | |
| 3095 | // Setup memory data |
| 3096 | tOSIRISMEMCHUNK ch; |
| 3097 | ch.id = ALIEN_MEMORY_ID; |
| 3098 | ch.size = sizeof(alienorganism_data); |
| 3099 | ch.my_id.type = OBJECT_SCRIPT; |
| 3100 | ch.my_id.objhandle = me; |
| 3101 | |
| 3102 | memory = (alienorganism_data *)Scrpt_MemAlloc(&ch); |
| 3103 | |
| 3104 | // Init base values |
| 3105 | AI_Value(me, VF_GET, AIV_F_MAX_SPEED, &memory->base_speed); |
| 3106 | AI_Value(me, VF_GET, AIV_F_CIRCLE_DIST, &memory->base_circle_distance); |
| 3107 | Obj_Value(me, VF_GET, OBJV_F_SHIELDS, &memory->base_shields); |
| 3108 | |
| 3109 | // Init energy charge |
| 3110 | memory->energy_charges = 0.0f; |
| 3111 | memory->ok_to_deposit = true; |
| 3112 | |
| 3113 | // All beams off initially |
| 3114 | memory->enabled_beams = 0; |
| 3115 | |
| 3116 | // Clear the destination object handle |
| 3117 | memory->dest_object_handle = OBJECT_HANDLE_NONE; |
| 3118 | |
| 3119 | // Alien hasn't been hit by player yet |
| 3120 | memory->hit_by_player = false; |
| 3121 | |
| 3122 | // Alien hasn't taken off yet |
| 3123 | memory->takeoff_time = ALIEN_MAX_TAKEOFF_TIME; |
| 3124 | |
| 3125 | // Setup Squad Information |
| 3126 | memory->squad_flags = 0; |
| 3127 | memory->leader_handle = OBJECT_HANDLE_NONE; |
| 3128 | memory->num_teammates = 0; |
| 3129 | |
| 3130 | // .1 to 1.1 seconds into the level, do the first squad matching |
| 3131 | memory->next_update_squad_time = Game_GetTime() + ((float)rand() / (float)D3_RAND_MAX) * 2.0f + 0.1f; |
| 3132 | |
| 3133 | // Update the energy effect as soon as charge exists |
| 3134 | memory->next_update_energy_time = Game_GetTime(); |
| 3135 | memory->next_update_beam_time = Game_GetTime(); |
| 3136 | |
| 3137 | // Update the squadie catchup speed as soon as possible |
| 3138 | memory->next_squadie_update_time = Game_GetTime(); |
| 3139 | |
| 3140 | // Do special damage as soon as relevant |
| 3141 | memory->next_special_damage_time = Game_GetTime(); |
| 3142 | |
| 3143 | // Set the next generic check time |
| 3144 | memory->next_generic_check_time = Game_GetTime() + ((float)rand() / (float)D3_RAND_MAX) * 1.0f + 0.5f; |
| 3145 | memory->next_vis_check_time = Game_GetTime() + ((float)rand() / (float)D3_RAND_MAX) * 2.0f + 1.0f; |
| 3146 | |
| 3147 | // Init other times |
nothing calls this directly
no test coverage detected