pokemon/map_objects.hpp

85 lines
1.4 KiB
C++

#pragma once
#include <cstdint>
#include "gen/maps.hpp"
struct position_t {
uint8_t x;
uint8_t y;
};
struct warp_event_t {
position_t position;
struct {
map_t::map map;
uint8_t warp_index;
} destination;
};
struct bg_event_t {
position_t position;
uint8_t sign_id;
};
struct object_event_t {
enum struct type {
generic,
item,
trainer,
pokemon,
};
enum struct movement {
stay,
walk,
};
enum struct range_or_direction {
any_dir,
up_down,
left_right,
down,
up,
left,
right,
none,
boulder_movement_byte_2,
};
enum type type;
position_t position;
uint8_t sprite_id; // fixme
enum movement movement;
enum range_or_direction range_or_direction;
uint8_t text_id; // fixme
union {
struct {
uint8_t id;
} item;
struct {
uint8_t type; // trainer class
uint8_t number; // trainer number
} trainer;
struct {
uint8_t id; // pokemon id
uint8_t level;
} pokemon;
};
};
// this is written "oddly" to make the struct more compact; making a
// {length, events} struct for each event type would would require 28
// bytes contrast to 16 bytes as modeled here.
struct object_t {
uint8_t border_block;
uint8_t warp_length;
uint8_t bg_length;
uint8_t object_length;
const warp_event_t * warp_events;
const bg_event_t * bg_events;
const object_event_t * object_events;
};
extern const object_t map_objects[];