Processes the AI Frame Interval Event
| 3349 | |
| 3350 | // Processes the AI Frame Interval Event |
| 3351 | void AlienOrganism::DoFrame(int me) { |
| 3352 | vector uvec; |
| 3353 | int flags; |
| 3354 | float anim_frame; |
| 3355 | int new_mode; |
| 3356 | vector vel; |
| 3357 | float last_see_time, last_see_game_time; |
| 3358 | float last_hear_time, last_hear_game_time; |
| 3359 | float last_perceive_time; |
| 3360 | |
| 3361 | /* |
| 3362 | float shields; |
| 3363 | Obj_Value(me, VF_GET, OBJV_F_SHIELDS, &shields); |
| 3364 | mprintf(0,"Shields: %.2f\n",shields); |
| 3365 | */ |
| 3366 | |
| 3367 | // Get the last see and hear time |
| 3368 | AI_Value(me, VF_GET, AIV_F_LAST_SEE_TARGET_TIME, &last_see_game_time); |
| 3369 | AI_Value(me, VF_GET, AIV_F_LAST_HEAR_TARGET_TIME, &last_hear_game_time); |
| 3370 | |
| 3371 | // Calculate the time since target was seen and heard |
| 3372 | last_hear_time = Game_GetTime() - last_hear_game_time; |
| 3373 | last_see_time = Game_GetTime() - last_see_game_time; |
| 3374 | |
| 3375 | // Perceive time is last time target was seen or heard (whichever is smalled) |
| 3376 | if (last_hear_time <= last_see_time) { |
| 3377 | last_perceive_time = last_hear_time; |
| 3378 | } else { |
| 3379 | last_perceive_time = last_see_time; |
| 3380 | } |
| 3381 | |
| 3382 | // Check if takeoff time is active |
| 3383 | if (memory->takeoff_time < ALIEN_MAX_TAKEOFF_TIME) { |
| 3384 | memory->takeoff_time += Game_GetFrameTime(); |
| 3385 | |
| 3386 | // If the time is up, clear the landing lock flags |
| 3387 | if (memory->takeoff_time >= ALIEN_MAX_TAKEOFF_TIME) { |
| 3388 | // Make sure we're in a mode that wants these flags cleared |
| 3389 | if (memory->mode != ALIEN_LANDING_AT_HOME && !IsLandedMode(memory->mode)) { |
| 3390 | // Clear wall point collision and axes lock |
| 3391 | flags = PF_LOCK_MASK | PF_POINT_COLLIDE_WALLS; |
| 3392 | Obj_Value(me, VF_CLEAR_FLAGS, OBJV_I_PHYSICS_FLAGS, &flags); |
| 3393 | |
| 3394 | // Turn on dodging |
| 3395 | flags = AIF_DODGE; |
| 3396 | AI_Value(me, VF_SET_FLAGS, AIV_I_FLAGS, &flags); |
| 3397 | |
| 3398 | // enable auto-leveling |
| 3399 | flags = PF_LEVELING; |
| 3400 | Obj_Value(me, VF_SET_FLAGS, OBJV_I_PHYSICS_FLAGS, &flags); |
| 3401 | |
| 3402 | // mprintf(0,"Alien landing flags cleared...\n"); |
| 3403 | } |
| 3404 | } |
| 3405 | } |
| 3406 | |
| 3407 | // If alien was hit by player, take action if necessary |
| 3408 | if (memory->hit_by_player) { |
nothing calls this directly
no test coverage detected