1#ifndef __AP_REQ__ 2#define __AP_REQ__ 3 4#include "ap_snes.h" 5#include <assert.h> 6#include <stdbool.h> 7 8#define AP_REQ_SLOTS ((size_t) 4) 9 10struct ap_reqmask { 11 uint64_t bits[1]; 12}; 13 14struct ap_req { 15 struct ap_reqmask alternative_requirements[AP_REQ_SLOTS]; 16}; 17 18// Call every frame 19void ap_req_update(void); 20 21void ap_req_init(struct ap_req * req); 22 23void ap_req_require(struct ap_req * req, size_t slot, uint16_t requirement); 24 25bool ap_req_is_satisfied(const struct ap_req * req); 26 27const char * ap_req_print(const struct ap_req * req); 28 29#define REQUIREMENT_LIST \ 30 INVENTORY_LIST \ 31 X(0, MASTER_SWORD) \ 32 X(0, KEY) \ 33 X(0, GREEN_PENDANT) \ 34 X(0, ALL_PENDANTS) \ 35 X(0, FIVESIX_CRYSTALS) \ 36 X(0, ALL_CRYSTALS) \ 37 X(0, GLOVES_1) \ 38 X(0, GLOVES_2) \ 39 40enum ap_requirement { 41#define X(i, n) CONCAT(REQUIREMENT_, n), 42REQUIREMENT_LIST 43#undef X 44 _REQUIREMENT_MAX 45}; 46static_assert(_REQUIREMENT_MAX < 64, "Reimplement reqmask to support >= 64 requirements"); 47 48extern const char * const ap_requirement_names[]; 49 50#endif