diff --git a/src/BattleManager.hpp b/src/BattleManager.hpp index 0640a3c..4233d76 100644 --- a/src/BattleManager.hpp +++ b/src/BattleManager.hpp @@ -13,6 +13,8 @@ namespace SokuLib { + //! @brief Represents the state of the battle between characters, but + //! not the state of the battle scene itself. struct BattleManager { struct BattleManager_VTABLE *vtable; // 0x004 diff --git a/src/BattleMode.hpp b/src/BattleMode.hpp index c7350a8..b77455b 100644 --- a/src/BattleMode.hpp +++ b/src/BattleMode.hpp @@ -13,6 +13,7 @@ namespace SokuLib { + //! @brief Mode of the battle the player is currently in. enum BattleMode : unsigned char { BATTLE_MODE_STORY, BATTLE_MODE_ARCADE, @@ -25,6 +26,7 @@ namespace SokuLib BATTLE_MODE_PRACTICE }; + //! @brief The submode represents the playing state. enum BattleSubMode : unsigned char { BATTLE_SUBMODE_PLAYING1, BATTLE_SUBMODE_PLAYING2, diff --git a/src/Camera.hpp b/src/Camera.hpp index a81e3ff..6661458 100644 --- a/src/Camera.hpp +++ b/src/Camera.hpp @@ -10,6 +10,7 @@ namespace SokuLib { + //! @brief The camera object used during battle. struct Camera { char offset_0x00[0x4]; // 0x04 diff --git a/src/Character.hpp b/src/Character.hpp index fff4cd0..33020ab 100644 --- a/src/Character.hpp +++ b/src/Character.hpp @@ -15,6 +15,7 @@ namespace SokuLib { + //! @brief All playable characters. enum Character : unsigned int { /* 0 */ CHARACTER_REIMU, /* 1 */ CHARACTER_MARISA, @@ -57,6 +58,7 @@ namespace SokuLib /* 34 */ CHARACTER_RAN }; + //! @brief Contains all the player information required to load by the loading thread after the character select. struct PlayerInfo { Character character; unsigned char isRight; @@ -67,6 +69,7 @@ namespace SokuLib KeyManager *keyManager; }; + //! @brief Contains all the information required to load by the loading thread after the character select. struct GameStartParams { char offset_0x00[4]; unsigned char stageId; diff --git a/src/CharacterManager.hpp b/src/CharacterManager.hpp index 104e2db..85cb1ea 100644 --- a/src/CharacterManager.hpp +++ b/src/CharacterManager.hpp @@ -49,6 +49,9 @@ namespace SokuLib }; struct CharacterManager; + + //! @brief An Object is any entity that exists within a battle: characters, bullets, visual effects, etc. + //! It also corresponds to v2::AnimationObject in SokuLib. struct ObjectManager { // 0x000 void *vtable; @@ -189,12 +192,16 @@ namespace SokuLib void doAnimation(); }; + //! @brief Linked list of entities, here, specifically tied to a character subobject. An entity may hold such a + //! list for projectiles and visual effects. They are templated CObjectList + //! (i.e CObjectList) struct ObjListManager { char offset_0x00[0x58]; // ADDR_OBJPROJOFS = 0x58 LinkedList list; }; + //! @brief Object for projectiles. struct ProjectileManager { // 0x000 ObjectManager objectBase; @@ -213,6 +220,7 @@ namespace SokuLib }; //CHARACTERMGR + //! @brief Object for characters. struct CharacterManager { // 0x000 ObjectManager objectBase; diff --git a/src/FrameData.hpp b/src/FrameData.hpp index 1349664..dc26392 100644 --- a/src/FrameData.hpp +++ b/src/FrameData.hpp @@ -11,6 +11,7 @@ namespace SokuLib { + //! @brief Represents all attack properties bound to a hitbox. union AttackFlags { struct { /* 00 00 00 01 */ bool unk1: 1; @@ -42,6 +43,7 @@ namespace SokuLib unsigned int value; }; + //! @brief Represents all properties bound to a character. union FrameFlags { struct { /* 00 00 00 01 */ bool stand: 1; @@ -74,6 +76,7 @@ namespace SokuLib }; #pragma pack(push, 1) + //! @brief Holds all the information tied to an Action. struct FrameData { // 0x00 void *VTable; @@ -130,6 +133,7 @@ namespace SokuLib }; #pragma pack(pop) + //! @brief Reads the data contained by a Framedata. struct FrameDataReader { // 0x00 void *VTable; @@ -166,6 +170,7 @@ namespace SokuLib float rotateX, rotateY, rotateZ; }; + //! @brief Holds all the rendering information tied to an Action. class FrameData { public: enum RenderGroup : unsigned char { SPRITE = 0, TEXTURE = 1, WITHBLEND = 2 }; @@ -183,6 +188,7 @@ namespace SokuLib virtual ~FrameData(); }; // 0x1C + //! @brief Holds the framedata held by a character. class CharacterFrameData : public FrameData { public: // 0x1C @@ -225,6 +231,7 @@ namespace SokuLib virtual ~SequenceData() = default; }; + //! @brief Represents the sequence that the character is in when performing an Action. class CharacterSequenceData { public: Vector frames; diff --git a/src/GameData.hpp b/src/GameData.hpp index 6623c43..a62a674 100644 --- a/src/GameData.hpp +++ b/src/GameData.hpp @@ -9,7 +9,10 @@ #include "Player.hpp" namespace SokuLib { + +// The v2 namespace is a namespace created to prevent any breaking change for previously made mods. namespace v2 { + //! @brief Manages all the dynamically allocated player data, events and threads. struct GameDataManager { // 0x00 List> createQueue; @@ -34,6 +37,7 @@ namespace v2 { static GameDataManager*& instance; }; // 0x58 + //! @brief Manages all the data that is to be saved, so they can be retrieved when restarting the game. struct SaveDataManager { // 0x00 int unknown00; diff --git a/src/InputManager.hpp b/src/InputManager.hpp index f4ed8f0..3802990 100644 --- a/src/InputManager.hpp +++ b/src/InputManager.hpp @@ -8,6 +8,8 @@ namespace SokuLib { + //! @brief Contains the time for which all buttons were pressed. 0 means "not pressed". + //! horizontalAxis and verticalAxis can be negative to represent the opposite direction. struct KeyInput { int horizontalAxis; int verticalAxis; @@ -18,7 +20,8 @@ namespace SokuLib int changeCard; int spellcard; }; - + + //! @brief Represents which buttons were pressed keys used during character select. struct CharacterSelectKeys { bool up: 1; bool down: 1; @@ -33,6 +36,7 @@ namespace SokuLib unsigned char padding: 6; }; + //! @brief Represents which buttons were pressed keys used during battle. struct BattleKeys { bool up: 1; bool down: 1; @@ -51,6 +55,7 @@ namespace SokuLib //KEYMAPMGR //CInputManagerCluster + //! @brief Manages the bindings between the hardware input and the game input. struct KeymapManager { void *unknown; // isPlayer is -1 when using keyboard, 0 when using first gamepad, 1 when using second gamepad. diff --git a/src/KeyCombination.hpp b/src/KeyCombination.hpp index c524ba7..0c3bbdb 100644 --- a/src/KeyCombination.hpp +++ b/src/KeyCombination.hpp @@ -5,7 +5,7 @@ #ifndef SWRSTOYS_KEYCOMBINATION_HPP #define SWRSTOYS_KEYCOMBINATION_HPP - +//! @brief Key combinations for all motion inputs. struct KeyCombination { /* 0x1 */ bool _236a : 1; /* 0x2 */ bool _236b : 1; diff --git a/src/Menus.hpp b/src/Menus.hpp index 270f264..e1f32ca 100644 --- a/src/Menus.hpp +++ b/src/Menus.hpp @@ -11,6 +11,7 @@ namespace SokuLib { + //! @brief All menus in the game. enum Menu { MENU_NONE, MENU_CONNECT, diff --git a/src/NetObject.hpp b/src/NetObject.hpp index e8c1037..7442f6c 100644 --- a/src/NetObject.hpp +++ b/src/NetObject.hpp @@ -24,6 +24,7 @@ namespace SokuLib std::vector g_psvClients; }; + //! @brief The NetObject handles all the packets and network-related operations. struct NetObject { char unknown[4]; char profile1name[32]; diff --git a/src/Packet.hpp b/src/Packet.hpp index edb5d74..ee692d3 100644 --- a/src/Packet.hpp +++ b/src/Packet.hpp @@ -16,6 +16,9 @@ namespace SokuLib { + // For a general understanding of Soku's network protocol, read this: + // https://github.com/delthas/touhou-protocol-docs/blob/master/protocol_123.md + extern uint8_t Soku110acRollSWRAllChars[16]; extern uint8_t Soku110acNoRollSWRAllChars[16]; extern uint8_t Soku110acNoSWRAllChars[16]; diff --git a/src/Player.hpp b/src/Player.hpp index 96569d4..720157a 100644 --- a/src/Player.hpp +++ b/src/Player.hpp @@ -11,6 +11,7 @@ namespace SokuLib { namespace v2 { + //! @brief Holds all the information tied to a player during battle. class Player : public GameObjectBase { public: // offset 0x34C diff --git a/src/Scenes.hpp b/src/Scenes.hpp index b940356..fadafcc 100644 --- a/src/Scenes.hpp +++ b/src/Scenes.hpp @@ -16,6 +16,7 @@ namespace SokuLib { #pragma pack(push, 1) + //! @brief All the game scenes. enum Scene { SCENE_LOGO, SCENE_OPENING, @@ -142,6 +143,7 @@ namespace SokuLib int paletteUnused; }; + //! @brief The cursor used to navigate in the menus. struct SelectCursor { int alwaysZero; int alwaysTwenty; diff --git a/src/SoundData.hpp b/src/SoundData.hpp index 7238b9b..4a3fd7e 100644 --- a/src/SoundData.hpp +++ b/src/SoundData.hpp @@ -7,6 +7,7 @@ namespace SokuLib { + //! @brief Data used to play the BGM. class BgmData { public: IFileReader* reader; @@ -54,6 +55,7 @@ namespace SokuLib int bufferSize; }; + //! @brief Represents the current state of the BGM. class BgmBuffer { public: String filename; diff --git a/src/Sprite.hpp b/src/Sprite.hpp index 34cf275..86e7405 100644 --- a/src/Sprite.hpp +++ b/src/Sprite.hpp @@ -28,6 +28,7 @@ namespace SokuLib float v; }; + //! @brief Data of the bitmap image that is loaded into the game. class BitmapData { public: unsigned char bitsPerPixel = 0; @@ -59,6 +60,7 @@ namespace SokuLib virtual ~SpriteBase() = default; }; + //! @brief The sprite of any drawn object on screen. class Sprite : public SpriteBase { public: Vector2f pos; @@ -118,6 +120,7 @@ namespace SokuLib void renderGray(int texId, float x, float y, float w, float h); }; + //! @brief The palette data currently used for rendering a character. class Palette { public: unsigned char bitsPerPixel; diff --git a/src/Stage.hpp b/src/Stage.hpp index 3bd5d3d..e720b6e 100644 --- a/src/Stage.hpp +++ b/src/Stage.hpp @@ -14,6 +14,7 @@ namespace SokuLib { extern std::vector stagesName; + //! @brief All the selectable stages. enum Stage : unsigned char { STAGE_HAKUREI_SHRINE_BROKEN, STAGE_FOREST_OF_MAGIC, @@ -42,7 +43,7 @@ namespace SokuLib }; //! @brief Takes the raw stage id and restrict it in the range [0-19] - //! @param The stage id to convert + //! @param id The stage id to convert //! @return The stage index between 0 and 19 (bounds included) unsigned char flattenStageId(Stage id); diff --git a/src/VTables.hpp b/src/VTables.hpp index 63ff4b7..1307f51 100644 --- a/src/VTables.hpp +++ b/src/VTables.hpp @@ -33,6 +33,7 @@ namespace SokuLib int (T::*onRender)(); }; + //! @brief vtable for each phase of a battle. struct BattleManager_VTABLE { BattleManager *(BattleManager::*destructor)(char unknown); void (BattleManager::*onArenaStart)(void *param); diff --git a/src/Weather.hpp b/src/Weather.hpp index 3a8de83..e3f287d 100644 --- a/src/Weather.hpp +++ b/src/Weather.hpp @@ -8,6 +8,8 @@ namespace SokuLib { + //! @brief All weathers that can occur in a battle. + //! Note: Twilight normally only occurs in story mode. enum Weather { /* 0 (0x00) */ WEATHER_SUNNY, /* 1 (0x01) */ WEATHER_DRIZZLE, @@ -33,8 +35,8 @@ namespace SokuLib /* 21 (0x15) */ WEATHER_CLEAR, }; - extern Weather &activeWeather; - extern Weather &displayedWeather; + extern Weather &activeWeather; // Note: Aurora is not an active weather. + extern Weather &displayedWeather; // Note: Aurora is a displayed weather. extern unsigned short &weatherCounter; extern void (__stdcall * const activateWeather)(int weather, char unknown); }