Files
top-octane/src/assets/sprites.hpp
T

59 lines
2.1 KiB
C++
Raw Normal View History

2026-11-30 22:31:51 +02:00
#pragma once
#include "assets/palette.hpp"
#include "core/vfs.hpp"
#include <cstdint>
#include <string>
#include <vector>
namespace top_octane::assets {
struct SpriteImage {
int width = 0;
int height = 0;
std::vector<uint8_t> rgba; // width * height * 4
};
struct SpriteBank {
std::vector<SpriteImage> sprites;
bool load(const Vfs& vfs, const std::string& dat_path, const std::string& tab_path,
const Palette& pal);
};
// World-space 3D billboard texture bank (DATA/TMAPS.DAT + DATA/TMAPS.TAB, entries 0..47)
struct TmapBank {
std::vector<SpriteImage> sprites; // 0..47; 29..42 are pickup/upgrade icons
bool load(const Vfs& vfs, const Palette& pal,
const std::string& dat_path = "DATA/TMAPS.DAT",
const std::string& tab_path = "DATA/TMAPS.TAB");
};
// Authentic HIOCTANE.EXE Type-5 subtype (0..13) -> TMAPS sprite index (29..42)
inline int pickup_tmap_index(uint8_t subtype) {
switch (subtype) {
case 0: return 41; // Invincible (green shield hex)
case 1: return 42; // Invisible (dark stealth hex)
case 2: return 35; // Shield Extra 10 (teal triangle)
case 3: return 36; // Shield Full 100 (teal diamond)
case 4: return 37; // Shield Double 200 (teal octagon)
case 5: return 32; // Ammo Extra 10 (yellow triangle)
case 6: return 33; // Ammo Full 100 (yellow diamond)
case 7: return 34; // Ammo Double 200 (yellow octagon)
case 8: return 29; // Fuel Extra 10 (purple triangle)
case 9: return 30; // Fuel Full 100 (purple diamond)
case 10: return 31; // Fuel Double 200 (purple octagon)
case 11: return 38; // Minigun Upgrade (red 4-barrel diamond)
case 12: return 39; // Missile Upgrade (red rocket hex)
case 13: return 40; // Booster Upgrade (orange up-chevron diamond)
default: return 38;
}
}
2026-11-30 22:31:51 +02:00
// Loads a raw indexed full-screen image (e.g., TITLE.DAT 320x200 or OSCR0-1.DAT 640x480)
bool load_raw_screen(const Vfs& vfs, const std::string& path, int width, int height,
const Palette& pal, SpriteImage& out_img);
} // namespace top_octane::assets