Filter out robots at render time, not wakeup time

A robot that is rendered may be woken later, subject to some conditions.
Move the easily checked conditions into the renderer, so that robots
which will not be woken are never recorded.
This commit is contained in:
Kp 2021-08-26 03:13:45 +00:00
parent 40c22d0663
commit fb63a73bd1
2 changed files with 2 additions and 6 deletions

View file

@ -2424,15 +2424,12 @@ void wake_up_rendered_objects(const object &viewer, window_rendered_data &window
range_for (const auto objnum, window.rendered_robots)
{
int fcval = d_tick_count & 3;
if ((objnum & 3) == fcval) {
const auto &&objp = vmobjptr(objnum);
if (objp->type == OBJ_ROBOT) {
if (vm_vec_dist_quick(viewer.pos, objp->pos) < F1_0*100)
{
ai_local *ailp = &objp->ctype.ai_info.ail;
if (ailp->player_awareness_type == player_awareness_type_t::PA_NONE) {
{
objp->ctype.ai_info.SUB_FLAGS |= SUB_FLAGS_CAMERA_AWAKE;
ailp->player_awareness_type = player_awareness_type_t::PA_WEAPON_ROBOT_COLLISION;
ailp->player_awareness_time = F1_0*3;
@ -2440,7 +2437,6 @@ void wake_up_rendered_objects(const object &viewer, window_rendered_data &window
}
}
}
}
}
}
#endif

View file

@ -654,7 +654,7 @@ static void do_render_object(grs_canvas &canvas, const d_level_unique_light_stat
// Added by MK on 09/07/94 (at about 5:28 pm, CDT, on a beautiful, sunny late summer day!) so
// that the guided missile system will know what objects to look at.
// I didn't know we had guided missiles before the release of D1. --MK
if (obj->type == OBJ_ROBOT)
if (obj->type == OBJ_ROBOT && obj->ctype.ai_info.ail.player_awareness_type == player_awareness_type_t::PA_NONE && (obj.get_unchecked_index() & 3) == (d_tick_count & 3))
window.rendered_robots.emplace_back(obj);
if ((count++ > MAX_OBJECTS) || (obj->next == obj)) {