From 8cc8d804bce0e8a2bce5952da15604ee80facab4 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 13 Oct 2024 22:49:31 -0700 Subject: [PATCH] refine some Ep3 structures --- src/CommandFormats.hh | 10 +++++----- src/Episode3/DataIndexes.cc | 4 +++- src/Episode3/DataIndexes.hh | 32 +++++++++++++++++++++----------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 3c2edda5..dd1f3a83 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -7066,13 +7066,13 @@ struct G_ServerVersionStrings_Ep3NTE_6xB4x46 { pstring date_str1; } __packed_ws__(G_ServerVersionStrings_Ep3NTE_6xB4x46, 0x88); -// 6xB5x47: Set spectator's CARD level -// header.sender_client_id is the spectator's client ID. +// 6xB5x47: Set online player's CARD level +// header.sender_client_id is the player's client ID. -struct G_SetSpectatorCARDLevel_Ep3_6xB5x47 { - G_CardBattleCommandHeader header = {0xB5, sizeof(G_SetSpectatorCARDLevel_Ep3_6xB5x47) / 4, 0, 0x47, 0, 0, 0}; +struct G_SetPlayerCARDLevel_Ep3_6xB5x47 { + G_CardBattleCommandHeader header = {0xB5, sizeof(G_SetPlayerCARDLevel_Ep3_6xB5x47) / 4, 0, 0x47, 0, 0, 0}; le_uint32_t clv = 0; -} __packed_ws__(G_SetSpectatorCARDLevel_Ep3_6xB5x47, 0x0C); +} __packed_ws__(G_SetPlayerCARDLevel_Ep3_6xB5x47, 0x0C); // 6xB3x48 / CAx48: End turn diff --git a/src/Episode3/DataIndexes.cc b/src/Episode3/DataIndexes.cc index 30876b08..582154f5 100644 --- a/src/Episode3/DataIndexes.cc +++ b/src/Episode3/DataIndexes.cc @@ -1177,6 +1177,7 @@ PlayerConfigNTE::PlayerConfigNTE(const PlayerConfig& config) offline_clv_exp(config.offline_clv_exp), online_clv_exp(config.online_clv_exp), recent_human_opponents(config.recent_human_opponents), + recent_battle_start_timestamps(config.recent_battle_start_timestamps), unknown_a10(config.unknown_a10), init_timestamp(config.init_timestamp), last_online_battle_start_timestamp(config.last_online_battle_start_timestamp), @@ -1206,6 +1207,7 @@ PlayerConfigNTE::operator PlayerConfig() const { ret.offline_clv_exp = this->offline_clv_exp; ret.online_clv_exp = this->online_clv_exp; ret.recent_human_opponents = this->recent_human_opponents; + ret.recent_battle_start_timestamps = this->recent_battle_start_timestamps; ret.unknown_a10 = this->unknown_a10; ret.init_timestamp = this->init_timestamp; ret.last_online_battle_start_timestamp = this->last_online_battle_start_timestamp; @@ -1964,7 +1966,7 @@ string MapDefinition::str(const CardIndex* card_index, uint8_t language) const { lines.emplace_back(phosg::string_printf(" field_offset: (x: %hd units, y:%hd units) (x: %lg tiles, y: %lg tiles)", this->field_offset_x.load(), this->field_offset_y.load(), static_cast(this->field_offset_x) / 25.0, static_cast(this->field_offset_y) / 25.0)); lines.emplace_back(phosg::string_printf(" map_category: %02hhX", this->map_category)); lines.emplace_back(phosg::string_printf(" cyber_block_type: %02hhX", this->cyber_block_type)); - lines.emplace_back(phosg::string_printf(" a11: %02hhX%02hhX", this->unknown_a11[0], this->unknown_a11[1])); + lines.emplace_back(phosg::string_printf(" a11: %04hX", this->unknown_a11.load())); static const array sc_card_entry_names = { "00 (Guykild; 0005)", "01 (Kylria; 0006)", diff --git a/src/Episode3/DataIndexes.hh b/src/Episode3/DataIndexes.hh index f254426d..f4e7d025 100644 --- a/src/Episode3/DataIndexes.hh +++ b/src/Episode3/DataIndexes.hh @@ -523,7 +523,6 @@ struct CardDefinition { // rules; for example, the expression "4+4//2" results in 4, not 6. /* 02 */ pstring expr; // when specifies in which phase the effect should activate. - // TODO: There are many values that can be used here; document them. /* 11 */ EffectWhen when; // arg1 generally specifies how long the effect activates for. /* 12 */ pstring arg1; @@ -918,13 +917,15 @@ struct PlayerConfig { /* 00 */ be_uint32_t guild_card_number; /* 04 */ pstring name; } __packed_ws__(PlayerReference, 0x1C); - // This array is updated when a battle is started (via a 6xB4x05 command). The - // client adds the opposing players' info to ths first two entries here if the - // opponents are human. (The existing entries are always moved back by two - // slots, but if one or both opponents are not humans, one or both of the - // newly-vacated slots is not filled in.) + // These two arrays are updated when a battle is started (via a 6xB4x05 + // command). The client adds the opposing players' info to ths first two + // entries in recent_human_opponents if the opponents are human. (The + // existing entries are always moved back by two slots, but if one or both + // opponents are not humans, one or both of the newly-vacated slots is not + // filled in.) Both arrays have the most recent entries at the beginning. /* 2128:1FD4 */ parray recent_human_opponents; - /* 2240:20EC */ parray unknown_a10; + /* 2240:20EC */ parray recent_battle_start_timestamps; + /* 2254:2100 */ parray unknown_a10; /* 2268:2114 */ be_uint32_t init_timestamp; /* 226C:2118 */ be_uint32_t last_online_battle_start_timestamp; // In a certain situation, unknown_t3 is set to init_timestamp plus a multiple @@ -961,7 +962,8 @@ struct PlayerConfigNTE { /* 1B70 */ be_uint32_t offline_clv_exp; /* 1B74 */ be_uint32_t online_clv_exp; /* 1B78 */ parray recent_human_opponents; - /* 1C90 */ parray unknown_a10; + /* 1C90 */ parray recent_battle_start_timestamps; + /* 1CA4 */ parray unknown_a10; /* 1CB8 */ be_uint32_t init_timestamp; /* 1CBC */ be_uint32_t last_online_battle_start_timestamp; /* 1CC0 */ be_uint32_t unknown_t3; @@ -1150,6 +1152,8 @@ struct OverlayState { // Any other value here will behave like 00 (no special tile behavior). parray, 0x10> tiles; + // This field appears to be unused in both NTE and the final version. Perhaps + // it had some meaning in a pre-NTE version. parray unused1; // TODO: Figure out exactly where these colors are used @@ -1382,7 +1386,13 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests /* 28F0 */ parray, 3> dialogue_sets; // These card IDs are always given to the player when they win a battle on - // this map. Unused entries should be set to FFFF. + // this map. Unused entries should be set to FFFF. Cards in this array are + // ignored if they have any of these features (in the card definition): + // - type is HUNTERS_SC or ARKZ_SC + // - card_class is BOSS_ATTACK_ACTION or BOSS_TECH + // - rank is D1, D2, or D3 + // - cannot_drop is 1 (specifically 1; other values don't prevent cards from + // appearing) /* 59B0 */ parray reward_card_ids; // These fields are used when determining which cards to drop after the battle @@ -1406,7 +1416,7 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests // There are 10 block types (0-9); if this value is > 9, type 0 is used. /* 59DD */ uint8_t cyber_block_type; - /* 59DE */ parray unknown_a11; + /* 59DE */ be_uint16_t unknown_a11; // This array specifies which SC characters can't participate in the quest // (that is, the player is not allowed to choose decks with these SC cards). @@ -1513,7 +1523,7 @@ struct MapDefinitionTrial { /* 4172 */ be_int16_t field_offset_y; /* 4174 */ uint8_t map_category; /* 4175 */ uint8_t cyber_block_type; - /* 4176 */ parray unknown_a11; + /* 4176 */ be_uint16_t unknown_a11; // TODO: This field may contain some version of unavailable_sc_cards and/or // entry_states from MapDefinition, but the format isn't the same /* 4178 */ parray unknown_t12;