add zelda3::music namespace, update documentation

This commit is contained in:
scawful
2024-04-14 13:46:23 -05:00
parent 512f349e62
commit e72b08eae4
9 changed files with 93 additions and 17 deletions

View File

@@ -11,8 +11,8 @@
#include "absl/status/status.h"
#include "app/core/common.h"
#include "app/editor/utils/editor.h"
#include "app/editor/master_editor.h"
#include "app/editor/utils/editor.h"
#include "app/gui/icons.h"
#include "app/gui/style.h"
@@ -22,6 +22,12 @@ namespace yaze {
namespace app {
namespace core {
/**
* @brief Main controller for the application.
*
* This class is responsible for managing the main window and the
* main editor. It is the main entry point for the application.
*/
class Controller : public ExperimentFlags {
public:
bool IsActive() const { return active_; }

View File

@@ -70,7 +70,7 @@ class MusicEditor : public SharedROM {
void DrawSongToolset();
void DrawToolset();
zelda3::Tracker music_tracker_;
zelda3::music::Tracker music_tracker_;
// Mix_Music* current_song_ = NULL;

View File

@@ -140,6 +140,12 @@ SnesPalette ReadPaletteFromRom(int offset, int num_colors, const uint8_t* rom);
std::array<float, 4> ToFloatArray(const SnesColor& color);
/**
* @brief Represents a group of palettes.
*
* Supports adding palettes and colors, clearing the group, and accessing
* palettes and colors by index.
*/
struct PaletteGroup {
PaletteGroup() = default;

View File

@@ -8,6 +8,15 @@
#include "absl/debugging/symbolize.h"
#include "app/core/controller.h"
/**
* @namespace yaze::app
* @brief Main namespace for the ImGui application.
*/
using namespace yaze::app;
/**
* @brief Main entry point for the application.
*/
int main(int argc, char** argv) {
absl::InitializeSymbolizer(argv[0]);
@@ -16,7 +25,7 @@ int main(int argc, char** argv) {
options.alarm_on_failure_secs = true;
absl::InstallFailureSignalHandler(options);
yaze::app::core::Controller controller;
core::Controller controller;
EXIT_IF_ERROR(controller.OnEntry())
#ifdef __APPLE__

View File

@@ -28,7 +28,7 @@ namespace zelda3 {
namespace {
void AddSPCReloc(SongSPCBlock *sbl, short addr) {
void AddSPCReloc(music::SongSPCBlock *sbl, short addr) {
sbl->relocs[sbl->relnum++] = addr;
if (sbl->relnum == sbl->relsz) {
sbl->relsz += 16;
@@ -38,8 +38,7 @@ void AddSPCReloc(SongSPCBlock *sbl, short addr) {
} // namespace
// =============================================================================
namespace music {
SongSPCBlock *Tracker::AllocSPCBlock(int len, int bank) {
SongSPCBlock *sbl;
if (!len) {
@@ -1337,8 +1336,7 @@ void Tracker::NewSR(ROM &rom, int bank) {
EditTrack(rom, sr->first);
}
// =============================================================================
} // namespace music
} // namespace zelda3
} // namespace app
} // namespace yaze

View File

@@ -17,6 +17,14 @@
namespace yaze {
namespace app {
namespace zelda3 {
/**
* @namespace yaze::app::zelda3::music
* @brief Contains classes and functions for handling music data in Zelda 3.
*
* Based off of the HyruleMagic tracker code.
*/
namespace music {
// bank 19, 1A, 1B
// iirc 1A is OW, 1B is dungeon
@@ -84,7 +92,7 @@ using Song = struct {
short numparts;
short lopst;
unsigned short addr;
bool in_use; // true
bool in_use; // true
};
// =============================================================================
@@ -252,6 +260,7 @@ class Tracker {
// =============================================================================
} // namespace music
} // namespace zelda3
} // namespace app
} // namespace yaze

View File

@@ -468,6 +468,12 @@ struct MapData {
std::vector<uint8_t> lowData;
};
/**
* @brief Represents the full Overworld data, light and dark world.
*
* This class is responsible for loading and saving the overworld data,
* as well as creating the tilesets and tilemaps for the overworld.
*/
class Overworld : public SharedROM, public core::ExperimentFlags {
public:
OWBlockset &GetMapTiles(int world_type);