Add core functionality for loading and processing game assets
- Implemented palette loading from binary files in `palette.cpp`.
- Added runtime utilities for reading text and JSON files in `runtime.cpp`.
- Created shape archive handling in `shape_archive.cpp`, including frame parsing and pixel decoding.
- Introduced type flag loading functionality in `type_flags.cpp`.
- Developed tests for combat tactics, entity dispatch entries, file system operations, fixed maps, flex archives, glob archives, map rendering, palette loading, shape archives, and type flags.
- Added a Python script for importing Ghidra-exported function slices with reporting capabilities.
2026-04-27 21:15:01 +02:00
|
|
|
#include "remorse/file_system.h"
|
2026-09-25 21:41:20 +02:00
|
|
|
#include "remorse/fixed_map.h"
|
Add core functionality for loading and processing game assets
- Implemented palette loading from binary files in `palette.cpp`.
- Added runtime utilities for reading text and JSON files in `runtime.cpp`.
- Created shape archive handling in `shape_archive.cpp`, including frame parsing and pixel decoding.
- Introduced type flag loading functionality in `type_flags.cpp`.
- Developed tests for combat tactics, entity dispatch entries, file system operations, fixed maps, flex archives, glob archives, map rendering, palette loading, shape archives, and type flags.
- Added a Python script for importing Ghidra-exported function slices with reporting capabilities.
2026-04-27 21:15:01 +02:00
|
|
|
#include "remorse/map_renderer.h"
|
|
|
|
|
|
2026-09-25 21:41:20 +02:00
|
|
|
#include <algorithm>
|
Add core functionality for loading and processing game assets
- Implemented palette loading from binary files in `palette.cpp`.
- Added runtime utilities for reading text and JSON files in `runtime.cpp`.
- Created shape archive handling in `shape_archive.cpp`, including frame parsing and pixel decoding.
- Introduced type flag loading functionality in `type_flags.cpp`.
- Developed tests for combat tactics, entity dispatch entries, file system operations, fixed maps, flex archives, glob archives, map rendering, palette loading, shape archives, and type flags.
- Added a Python script for importing Ghidra-exported function slices with reporting capabilities.
2026-04-27 21:15:01 +02:00
|
|
|
#include <cassert>
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
const auto root = remorse::findGameDataRoot(std::filesystem::current_path());
|
|
|
|
|
assert(root.has_value());
|
|
|
|
|
|
|
|
|
|
remorse::MapRenderOptions options;
|
|
|
|
|
options.mapIndex = 1;
|
|
|
|
|
options.maxWidth = 320;
|
|
|
|
|
options.maxHeight = 200;
|
|
|
|
|
|
|
|
|
|
const auto image = remorse::renderMapPreview(*root, options);
|
|
|
|
|
assert(image.has_value());
|
|
|
|
|
assert(image->width > 0);
|
|
|
|
|
assert(image->height > 0);
|
|
|
|
|
assert(!image->pixels.empty());
|
|
|
|
|
assert(image->decodedItemCount > 0);
|
|
|
|
|
assert(image->paintedItemCount > 0);
|
2026-09-25 21:41:20 +02:00
|
|
|
|
|
|
|
|
const auto fixedPath = remorse::resolveGameDataPath(*root, std::filesystem::path("STATIC") / "FIXED.DAT");
|
|
|
|
|
assert(fixedPath.has_value());
|
|
|
|
|
const auto archive = remorse::loadFixedMapArchive(*fixedPath);
|
|
|
|
|
assert(archive.has_value());
|
|
|
|
|
const auto fixedMap = remorse::loadFixedMap(*archive, options.mapIndex);
|
|
|
|
|
assert(fixedMap.has_value());
|
|
|
|
|
remorse::s32 minX = fixedMap->entries.front().x;
|
|
|
|
|
remorse::s32 minY = fixedMap->entries.front().y;
|
|
|
|
|
remorse::s32 maxX = minX;
|
|
|
|
|
remorse::s32 maxY = minY;
|
|
|
|
|
for (const remorse::FixedMapEntry& entry : fixedMap->entries) {
|
|
|
|
|
minX = std::min(minX, static_cast<remorse::s32>(entry.x));
|
|
|
|
|
minY = std::min(minY, static_cast<remorse::s32>(entry.y));
|
|
|
|
|
maxX = std::max(maxX, static_cast<remorse::s32>(entry.x));
|
|
|
|
|
maxY = std::max(maxY, static_cast<remorse::s32>(entry.y));
|
|
|
|
|
}
|
|
|
|
|
options.maxWidth = 1280;
|
|
|
|
|
options.maxHeight = 760;
|
|
|
|
|
options.viewCenter = remorse::WorldPoint{(minX + maxX) / 2, (minY + maxY) / 2, 0};
|
|
|
|
|
const auto centeredImage = remorse::renderMapPreview(*root, options);
|
|
|
|
|
assert(centeredImage.has_value());
|
|
|
|
|
assert(centeredImage->paintedItemCount > 0);
|
|
|
|
|
assert(centeredImage->width == options.maxWidth);
|
|
|
|
|
assert(centeredImage->height == options.maxHeight);
|
|
|
|
|
const remorse::ScreenPoint center = remorse::projectToScreen(*options.viewCenter);
|
|
|
|
|
assert(centeredImage->sourceLeft == center.x - static_cast<remorse::s32>(options.maxWidth / 2));
|
|
|
|
|
assert(centeredImage->sourceTop == center.y - static_cast<remorse::s32>(options.maxHeight / 2));
|
Add core functionality for loading and processing game assets
- Implemented palette loading from binary files in `palette.cpp`.
- Added runtime utilities for reading text and JSON files in `runtime.cpp`.
- Created shape archive handling in `shape_archive.cpp`, including frame parsing and pixel decoding.
- Introduced type flag loading functionality in `type_flags.cpp`.
- Developed tests for combat tactics, entity dispatch entries, file system operations, fixed maps, flex archives, glob archives, map rendering, palette loading, shape archives, and type flags.
- Added a Python script for importing Ghidra-exported function slices with reporting capabilities.
2026-04-27 21:15:01 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|