static void prvSchedulingTask( void *pvParameters ) { configASSERT( ( ( unsigned long ) pvParameters ) == SCHEDULING_PARAMETER ); TickType_t xLastWakeTime; const TickType_t xTimeToWait = 10; // Number entered here corresponds to the number of ticks we should wait. x = -1; spimem_read_sch(SCHEDULE_BASE, temp_arr, 4); // FDIR implemented for spimem_read num_commands = ((uint32_t)temp_arr[3]) << 24; num_commands = ((uint32_t)temp_arr[2]) << 16; num_commands = ((uint32_t)temp_arr[1]) << 8; num_commands = (uint32_t)temp_arr[0]; spimem_read_sch(SCHEDULE_BASE+4, temp_arr, 4); next_command_time = ((uint32_t)temp_arr[3]) << 24; next_command_time = ((uint32_t)temp_arr[2]) << 16; next_command_time = ((uint32_t)temp_arr[1]) << 8; next_command_time = (uint32_t)temp_arr[0]; spimem_read_sch(SCHEDULE_BASE + 4 + ((num_commands - 1) * 16), temp_arr, 4); furthest_command_time = ((uint32_t)temp_arr[3]) << 24; furthest_command_time = ((uint32_t)temp_arr[2]) << 16; furthest_command_time = ((uint32_t)temp_arr[1]) << 8; furthest_command_time = (uint32_t)temp_arr[0]; scheduling_on = 1; clear_schedule_buffers(); clear_temp_array(); clear_current_command(); /* @non-terminating@ */ for( ;; ) { exec_pus_commands(); check_schedule(); } }
/* * Prepare the "temp" array for "target_interactive_set" * * Return the number of target_able monsters in the set. */ static void target_set_interactive_prepare(int mode) { int y, x; bool expand_look = (mode & (TARGET_LOOK)) ? TRUE : FALSE; /* Reset "temp" array */ clear_temp_array(); /* Scan the current panel */ for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++) { for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++) { bool do_continue = FALSE; /* Check overflow */ if (temp_n >= TEMP_MAX) continue; /* Check bounds */ if (!in_bounds_fully(y, x)) continue; /* Require line of sight, unless "look" is "expanded" */ if (!player_has_los_bold(y, x) && (!expand_look)) continue; /* Require "interesting" contents */ if (!target_set_interactive_accept(y, x)) continue; /* Special mode */ if (mode & (TARGET_KILL)) { /* Must contain a monster */ if (!(cave_m_idx[y][x] > 0)) do_continue = TRUE; /* Must be a targettable monster */ if (!target_able(cave_m_idx[y][x])) do_continue = TRUE; } /* Don't continue on the trap exception, or if probing. */ if ((mode & (TARGET_TRAP)) && target_able_trap(y, x)) do_continue = FALSE; else if (mode & (TARGET_PROBE)) do_continue = FALSE; if (do_continue) continue; /* * Hack - don't go over redundant elemental terrain \ * (since we have large lakes and pools of the same terrain) */ if ((p_ptr->target_row > 0) || (p_ptr->target_col > 0)) { if (cave_feat[p_ptr->target_row][p_ptr->target_col] == cave_feat[y][x]) { if (cave_ff3_match(y, x, TERRAIN_MASK)) continue; } } /* Save the location */ temp_x[temp_n] = x; temp_y[temp_n] = y; temp_n++; } } /* Set the sort hooks */ ang_sort_comp = ang_sort_comp_distance; ang_sort_swap = ang_sort_swap_distance; /* Sort the positions */ ang_sort(temp_x, temp_y, temp_n); }