track specialized boxes server-side

This commit is contained in:
Martin Michelsen
2023-11-13 22:07:21 -08:00
parent 4b4627d3e5
commit 4fe238a01a
161 changed files with 119 additions and 17 deletions
+21 -2
View File
@@ -48,7 +48,7 @@ struct Map {
/* 1C */ le_uint32_t x_angle;
/* 20 */ le_uint32_t y_angle;
/* 24 */ le_uint32_t z_angle;
/* 28 */ le_float param1;
/* 28 */ le_float param1; // If <= 0, this is a specialized box, and the specialization is in param4/5/6
/* 2C */ le_float param2;
/* 30 */ le_float param3;
/* 34 */ le_uint32_t param4;
@@ -192,6 +192,21 @@ struct Map {
static const RareEnemyRates NO_RARE_ENEMIES;
static const RareEnemyRates DEFAULT_RARE_ENEMIES;
struct Object {
// TODO: Add more fields in here if we ever care about them. Currently we
// only care about boxes with fixed item drops.
uint16_t base_type;
uint16_t section;
float param1; // If <= 0, this is a specialized box, and the specialization is in param4/5/6
uint32_t param4;
uint32_t param5;
uint32_t param6;
uint8_t floor;
bool item_drop_checked;
std::string str() const;
};
struct Enemy {
enum Flag {
HIT_BY_PLAYER0 = 0x01,
@@ -211,11 +226,14 @@ struct Map {
std::string str() const;
} __attribute__((packed));
std::vector<Object> objects;
std::vector<Enemy> enemies;
std::vector<size_t> rare_enemy_indexes;
void clear();
void add_objects_from_map_data(const void* data, size_t size);
void add_objects_from_map_data(uint8_t floor, const void* data, size_t size);
bool check_and_log_rare_enemy(bool default_is_rare, uint32_t rare_rate);
void add_enemy(uint8_t floor, EnemyType type);
void add_enemy(
@@ -244,6 +262,7 @@ struct Map {
StringReader random_enemy_definitions_r,
uint32_t rare_seed,
const RareEnemyRates& rare_rates = Map::DEFAULT_RARE_ENEMIES);
void add_enemies_and_objects_from_quest_data(
Episode episode,
uint8_t difficulty,