1#pragma once 2#include "ap_macro.h" 3#include "ap_req.h" 4 5#define AP_GOAL_TYPE_LIST \ 6 X(NONE) \ 7 X(PICKUP) \ 8 X(CHEST) \ 9 X(EXPLORE) \ 10 X(ITEM) \ 11 X(NPC) \ 12 X(SCRIPT) \ 13 14enum ap_goal_type { 15#define X(type) CONCAT(GOAL_, type), 16AP_GOAL_TYPE_LIST 17#undef X 18 _GOAL_TYPE_MAX 19}; 20 21extern const char * const ap_goal_type_names[]; 22struct ap_goal; 23struct ap_goal { 24 struct ap_goal * next; 25 struct ap_goal * prev; 26 27 enum ap_goal_type type; 28 char name[32]; 29 30 struct ap_node * node; 31 uint8_t item; 32 int attempts; 33 int last_score; 34 35 //struct ap_graph graph; 36 struct ap_req req; 37}; 38extern struct ap_goal * ap_goal_list; 39 40/* 41static struct ap_goal * 42ap_goal_from_graph(struct ap_graph * graph) { 43 uintptr_t p = (uintptr_t) graph; 44 p -= (uintptr_t) &((struct ap_goal *) 0)->graph; 45 return (struct ap_goal *) p; 46} 47*/ 48 49#define PRIGOAL "%s [node=" PRINODE "]" 50#define PRIGOALF(g) ap_goal_type_names[(g)->type], PRINODEF((g)->node) 51 52void 53ap_print_goals(bool no_limit); 54 55struct ap_goal * 56ap_goal_add(enum ap_goal_type type, struct ap_node * node); 57 58#define AP_TASK_TYPE_LIST \ 59 X(NONE) \ 60 X(GOTO_POINT) \ 61 X(TRANSITION) \ 62 X(OPEN_CHEST) \ 63 X(LIFT_POT) \ 64 X(SET_INVENTORY) \ 65 X(STEP_OFF_SWITCH) \ 66 X(TALK_NPC) \ 67 X(SCRIPT_SEQUENCE) \ 68 X(SCRIPT_KILLALL) \ 69 X(SCRIPT_KILLDROPS) \ 70 X(BOMB) \ 71 72enum ap_task_type { 73#define X(type) CONCAT(TASK_, type), 74AP_TASK_TYPE_LIST 75#undef X 76}; 77extern const char * const ap_task_type_names[]; 78 79struct ap_task; 80struct ap_task { 81 struct ap_task * next; 82 struct ap_task * prev; 83 84 enum ap_task_type type; 85 char name[32]; 86 87 int timeout; 88 int state; 89 90 struct ap_node * node; 91 uint8_t direction; 92 uint8_t item; 93}; 94extern struct ap_task * ap_task_list; 95 96const char * 97ap_print_task(const struct ap_task * task); 98 99#define PRITASK "%s" 100#define PRITASKF(t) ap_print_task(t) 101 102void 103ap_print_tasks(); 104 105void 106ap_plan_evaluate(uint16_t * joypad); 107 108void 109ap_plan_init();