Popout PaletteEditor, general housekeeping
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "app/gui/canvas.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "app/gui/canvas.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
26
src/app/zelda3/music/spc700.def
Normal file
26
src/app/zelda3/music/spc700.def
Normal file
@@ -0,0 +1,26 @@
|
||||
LIBRARY snes_spc
|
||||
DESCRIPTION "snes_spc 0.9.0"
|
||||
EXPORTS
|
||||
spc_new @1
|
||||
spc_delete @2
|
||||
spc_init_rom @3
|
||||
spc_set_output @4
|
||||
spc_sample_count @5
|
||||
spc_reset @6
|
||||
spc_soft_reset @7
|
||||
spc_read_port @8
|
||||
spc_write_port @9
|
||||
spc_end_frame @10
|
||||
spc_mute_voices @11
|
||||
spc_disable_surround @12
|
||||
spc_set_tempo @13
|
||||
spc_load_spc @14
|
||||
spc_clear_echo @15
|
||||
spc_play @16
|
||||
spc_skip @17
|
||||
spc_filter_new @18
|
||||
spc_filter_delete @19
|
||||
spc_filter_run @20
|
||||
spc_filter_clear @21
|
||||
spc_filter_set_gain @22
|
||||
spc_filter_set_bass @23
|
||||
@@ -46,20 +46,20 @@ absl::Status Overworld::Load(ROM &rom) {
|
||||
for (int i = 0; i < core::kNumOverworldMaps; ++i) {
|
||||
futures.push_back(std::async(std::launch::async, [this, i, size]() {
|
||||
if (i < 64) {
|
||||
return overworld_maps_[i].BuildMap(
|
||||
size, game_state_, 0, map_parent_, map_tiles_.light_world);
|
||||
return overworld_maps_[i].BuildMap(size, game_state_, 0, map_parent_,
|
||||
map_tiles_.light_world);
|
||||
} else if (i < 0x80 && i >= 0x40) {
|
||||
return overworld_maps_[i].BuildMap(
|
||||
size, game_state_, 1, map_parent_, map_tiles_.dark_world);
|
||||
return overworld_maps_[i].BuildMap(size, game_state_, 1, map_parent_,
|
||||
map_tiles_.dark_world);
|
||||
} else {
|
||||
return overworld_maps_[i].BuildMap(
|
||||
size, game_state_, 2, map_parent_, map_tiles_.special_world);
|
||||
return overworld_maps_[i].BuildMap(size, game_state_, 2, map_parent_,
|
||||
map_tiles_.special_world);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// Wait for all tasks to complete and check their results
|
||||
for (auto& future : futures) {
|
||||
for (auto &future : futures) {
|
||||
absl::Status status = future.get();
|
||||
if (!status.ok()) {
|
||||
return status;
|
||||
@@ -275,110 +275,52 @@ absl::Status Overworld::SaveOverworldMaps() {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
void Overworld::SaveMap16Tiles() {
|
||||
int tpos = core::map16Tiles;
|
||||
// 3760
|
||||
for (int i = 0; i < core::NumberOfMap16; i += 1) {
|
||||
rom_.WriteShort(tpos, tiles16[i].tile0_);
|
||||
rom_.WriteShort(tpos, tiles16[i].tile0_.ToShort());
|
||||
tpos += 2;
|
||||
rom_.WriteShort(tpos, tiles16[i].tile1_);
|
||||
rom_.WriteShort(tpos, tiles16[i].tile1_.ToShort());
|
||||
tpos += 2;
|
||||
rom_.WriteShort(tpos, tiles16[i].tile2_);
|
||||
rom_.WriteShort(tpos, tiles16[i].tile2_.ToShort());
|
||||
tpos += 2;
|
||||
rom_.WriteShort(tpos, tiles16[i].tile3_);
|
||||
rom_.WriteShort(tpos, tiles16[i].tile3_.ToShort());
|
||||
tpos += 2;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
void Overworld::SaveMap32Tiles() {
|
||||
int index = 0;
|
||||
int c = tiles32_unique_.size();
|
||||
for (int i = 0; i < c; i += 6) {
|
||||
if (index >= 0x4540) // 3C87??
|
||||
{
|
||||
std::cout << "Too many unique tiles!" << std::endl;
|
||||
const int max_tiles = 0x4540;
|
||||
const int unique_size = tiles32_unique_.size();
|
||||
|
||||
break;
|
||||
auto write_tiles = [&](int address, auto get_tile) {
|
||||
for (int i = 0; i < unique_size && i < max_tiles; i += 4) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
rom_.Write(address + i + j, (uchar)(get_tile(i + j) & 0xFF));
|
||||
}
|
||||
rom_.Write(address + i + 4, (uchar)(((get_tile(i) >> 4) & 0xF0) |
|
||||
((get_tile(i + 1) >> 8) & 0x0F)));
|
||||
rom_.Write(address + i + 5, (uchar)(((get_tile(i + 2) >> 4) & 0xF0) |
|
||||
((get_tile(i + 3) >> 8) & 0x0F)));
|
||||
}
|
||||
};
|
||||
|
||||
// Top Left
|
||||
rom_.Write(core::map32TilesTL + (i),
|
||||
(uchar)(tiles32_unique_[index].tile0 & 0xFF));
|
||||
rom_.Write(core::map32TilesTL + (i + 1),
|
||||
(uchar)(tiles32_unique_[index + 1].tile0 & 0xFF));
|
||||
rom_.Write(core::map32TilesTL + (i + 2),
|
||||
(uchar)(tiles32_unique_[index + 2].tile0 & 0xFF));
|
||||
rom_.Write(core::map32TilesTL + (i + 3),
|
||||
(uchar)(tiles32_unique_[index + 3].tile0 & 0xFF));
|
||||
write_tiles(core::map32TilesTL,
|
||||
[&](int i) { return tiles32_unique_[i].tile0_; });
|
||||
write_tiles(core::map32TilesTR,
|
||||
[&](int i) { return tiles32_unique_[i].tile1_; });
|
||||
write_tiles(core::map32TilesBL,
|
||||
[&](int i) { return tiles32_unique_[i].tile2_; });
|
||||
write_tiles(core::map32TilesBR,
|
||||
[&](int i) { return tiles32_unique_[i].tile3_; });
|
||||
|
||||
rom_.Write(core::map32TilesTL + (i + 4),
|
||||
(uchar)(((tiles32_unique_[index].tile0 >> 4) & 0xF0) +
|
||||
((tiles32_unique_[index + 1].tile0 >> 8) & 0x0F)));
|
||||
rom_.Write(core::map32TilesTL + (i + 5),
|
||||
(uchar)(((tiles32_unique_[index + 2].tile0 >> 4) & 0xF0) +
|
||||
((tiles32_unique_[index + 3].tile0 >> 8) & 0x0F)));
|
||||
|
||||
// Top Right
|
||||
rom_.Write(core::map32TilesTR + (i),
|
||||
(uchar)(tiles32_unique_[index].tile1 & 0xFF));
|
||||
rom_.Write(core::map32TilesTR + (i + 1),
|
||||
(uchar)(tiles32_unique_[index + 1].tile1 & 0xFF));
|
||||
rom_.Write(core::map32TilesTR + (i + 2),
|
||||
(uchar)(tiles32_unique_[index + 2].tile1 & 0xFF));
|
||||
rom_.Write(core::map32TilesTR + (i + 3),
|
||||
(uchar)(tiles32_unique_[index + 3].tile1 & 0xFF));
|
||||
|
||||
rom_.Write(core::map32TilesTR + (i + 4),
|
||||
(uchar)(((tiles32_unique_[index].tile1 >> 4) & 0xF0) |
|
||||
((tiles32_unique_[index + 1].tile1 >> 8) & 0x0F)));
|
||||
rom_.Write(core::map32TilesTR + (i + 5),
|
||||
(uchar)(((tiles32_unique_[index + 2].tile1 >> 4) & 0xF0) |
|
||||
((tiles32_unique_[index + 3].tile1 >> 8) & 0x0F)));
|
||||
|
||||
// Bottom Left
|
||||
rom_.Write(core::map32TilesBL + (i),
|
||||
(uchar)(tiles32_unique_[index].tile2 & 0xFF));
|
||||
rom_.Write(core::map32TilesBL + (i + 1),
|
||||
(uchar)(tiles32_unique_[index + 1].tile2 & 0xFF));
|
||||
rom_.Write(core::map32TilesBL + (i + 2),
|
||||
(uchar)(tiles32_unique_[index + 2].tile2 & 0xFF));
|
||||
rom_.Write(core::map32TilesBL + (i + 3),
|
||||
(uchar)(tiles32_unique_[index + 3].tile2 & 0xFF));
|
||||
|
||||
rom_.Write(core::map32TilesBL + (i + 4),
|
||||
(uchar)(((tiles32_unique_[index].tile2 >> 4) & 0xF0) |
|
||||
((tiles32_unique_[index + 1].tile2 >> 8) & 0x0F)));
|
||||
rom_.Write(core::map32TilesBL + (i + 5),
|
||||
(uchar)(((tiles32_unique_[index + 2].tile2 >> 4) & 0xF0) |
|
||||
((tiles32_unique_[index + 3].tile2 >> 8) & 0x0F)));
|
||||
|
||||
// Bottom Right
|
||||
rom_.Write(core::map32TilesBR + (i),
|
||||
(uchar)(tiles32_unique_[index].tile3 & 0xFF));
|
||||
rom_.Write(core::map32TilesBR + (i + 1),
|
||||
(uchar)(tiles32_unique_[index + 1].tile3 & 0xFF));
|
||||
rom_.Write(core::map32TilesBR + (i + 2),
|
||||
(uchar)(tiles32_unique_[index + 2].tile3 & 0xFF));
|
||||
rom_.Write(core::map32TilesBR + (i + 3),
|
||||
(uchar)(tiles32_unique_[index + 3].tile3 & 0xFF));
|
||||
|
||||
rom_.Write(core::map32TilesBR + (i + 4),
|
||||
(uchar)(((tiles32_unique_[index].tile3 >> 4) & 0xF0) |
|
||||
((tiles32_unique_[index + 1].tile3 >> 8) & 0x0F)));
|
||||
rom_.Write(core::map32TilesBR + (i + 5),
|
||||
(uchar)(((tiles32_unique_[index + 2].tile3 >> 4) & 0xF0) |
|
||||
((tiles32_unique_[index + 3].tile3 >> 8) & 0x0F)));
|
||||
|
||||
index += 4;
|
||||
c += 2;
|
||||
if (unique_size > max_tiles) {
|
||||
std::cout << "Too many unique tiles!" << std::endl;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld_map.h"
|
||||
#include "app/zelda3/sprite.h"
|
||||
#include "app/zelda3/sprite/sprite.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -109,8 +109,8 @@ void SetColorsPalette(ROM& rom, int index, gfx::SNESPalette& current,
|
||||
k = 0;
|
||||
for (int y = 9; y < 13; y++) {
|
||||
for (int x = 1; x < 16; x++) {
|
||||
new_palette[x + (16 * y)] = rom.GetPaletteGroup("global_sprites")[0][k];
|
||||
k++;
|
||||
new_palette[x + (16 * y)] =
|
||||
rom.GetPaletteGroup("global_sprites")[0][k]; k++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,210 +267,156 @@ void OverworldMap::LoadAreaInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldMap::LoadAreaGraphics() {
|
||||
int world_index = 0x20;
|
||||
void OverworldMap::LoadWorldIndex() {
|
||||
if (parent_ < 0x40) {
|
||||
world_index = 0x20;
|
||||
world_index_ = 0x20;
|
||||
} else if (parent_ >= 0x40 && parent_ < 0x80) {
|
||||
world_index = 0x21;
|
||||
world_index_ = 0x21;
|
||||
} else if (parent_ == 0x88) {
|
||||
world_index = 0x24;
|
||||
world_index_ = 0x24;
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldMap::LoadSpritesBlocksets() {
|
||||
int static_graphics_base = 0x73;
|
||||
static_graphics_[8] = static_graphics_base + 0x00;
|
||||
static_graphics_[9] = static_graphics_base + 0x01;
|
||||
static_graphics_[10] = static_graphics_base + 0x06;
|
||||
static_graphics_[11] = static_graphics_base + 0x07;
|
||||
|
||||
// Sprites Blocksets
|
||||
static_graphics_[8] = 0x73 + 0x00;
|
||||
static_graphics_[9] = 0x73 + 0x01;
|
||||
static_graphics_[10] = 0x73 + 0x06;
|
||||
static_graphics_[11] = 0x73 + 0x07;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
static_graphics_[12 + i] = (rom_[core::kSpriteBlocksetPointer +
|
||||
(sprite_graphics_[game_state_] * 4) + i] +
|
||||
0x73);
|
||||
static_graphics_base);
|
||||
}
|
||||
}
|
||||
|
||||
// Main Blocksets
|
||||
void OverworldMap::LoadMainBlocksets() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
static_graphics_[i] =
|
||||
rom_[core::overworldgfxGroups2 + (world_index * 8) + i];
|
||||
rom_[core::overworldgfxGroups2 + (world_index_ * 8) + i];
|
||||
}
|
||||
}
|
||||
|
||||
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4)] != 0) {
|
||||
static_graphics_[3] = rom_[core::overworldgfxGroups + (area_graphics_ * 4)];
|
||||
}
|
||||
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 1] != 0) {
|
||||
static_graphics_[4] =
|
||||
rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 1];
|
||||
}
|
||||
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 2] != 0) {
|
||||
static_graphics_[5] =
|
||||
rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 2];
|
||||
}
|
||||
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 3] != 0) {
|
||||
static_graphics_[6] =
|
||||
rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 3];
|
||||
void OverworldMap::LoadAreaGraphicsBlocksets() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
uchar value = rom_[core::overworldgfxGroups + (area_graphics_ * 4) + i];
|
||||
if (value != 0) {
|
||||
static_graphics_[3 + i] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hardcoded overworld GFX Values, for death mountain
|
||||
if ((parent_ >= 0x03 && parent_ <= 0x07) ||
|
||||
(parent_ >= 0x0B && parent_ <= 0x0E)) {
|
||||
static_graphics_[7] = 0x59;
|
||||
} else if ((parent_ >= 0x43 && parent_ <= 0x47) ||
|
||||
(parent_ >= 0x4B && parent_ <= 0x4E)) {
|
||||
static_graphics_[7] = 0x59;
|
||||
void OverworldMap::LoadDeathMountainGFX() {
|
||||
static_graphics_[7] = (((parent_ >= 0x03 && parent_ <= 0x07) ||
|
||||
(parent_ >= 0x0B && parent_ <= 0x0E)) ||
|
||||
((parent_ >= 0x43 && parent_ <= 0x47) ||
|
||||
(parent_ >= 0x4B && parent_ <= 0x4E)))
|
||||
? 0x59
|
||||
: 0x5B;
|
||||
}
|
||||
|
||||
void OverworldMap::LoadAreaGraphics() {
|
||||
LoadWorldIndex();
|
||||
LoadSpritesBlocksets();
|
||||
LoadMainBlocksets();
|
||||
LoadAreaGraphicsBlocksets();
|
||||
LoadDeathMountainGFX();
|
||||
}
|
||||
|
||||
// New helper function to get a palette from the ROM.
|
||||
gfx::SNESPalette OverworldMap::GetPalette(const std::string& group, int index,
|
||||
int previousIndex, int limit) {
|
||||
if (index == 255) {
|
||||
index = rom_[core::overworldMapPaletteGroup + (previousIndex * 4)];
|
||||
}
|
||||
if (index != 255) {
|
||||
if (index >= limit) {
|
||||
index = limit - 1;
|
||||
}
|
||||
return rom_.GetPaletteGroup(group)[index];
|
||||
} else {
|
||||
static_graphics_[7] = 0x5B;
|
||||
return rom_.GetPaletteGroup(group)[0];
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldMap::LoadPalette() {
|
||||
int previousPalId = 0;
|
||||
int previousSprPalId = 0;
|
||||
if (index_ > 0) {
|
||||
previousPalId = rom_[core::overworldMapPalette + parent_ - 1];
|
||||
previousSprPalId = rom_[core::overworldSpritePalette + parent_ - 1];
|
||||
}
|
||||
int previousPalId =
|
||||
index_ > 0 ? rom_[core::overworldMapPalette + parent_ - 1] : 0;
|
||||
int previousSprPalId =
|
||||
index_ > 0 ? rom_[core::overworldSpritePalette + parent_ - 1] : 0;
|
||||
|
||||
if (area_palette_ >= 0xA3) {
|
||||
area_palette_ = 0xA3;
|
||||
}
|
||||
area_palette_ = std::min(area_palette_, 0xA3);
|
||||
|
||||
uchar pal0 = 0;
|
||||
|
||||
uchar pal1 = rom_[core::overworldMapPaletteGroup + (area_palette_ * 4)];
|
||||
uchar pal2 =
|
||||
rom_[core::overworldMapPaletteGroup + (area_palette_ * 4) + 1]; // aux2
|
||||
uchar pal3 = rom_[core::overworldMapPaletteGroup + (area_palette_ * 4) +
|
||||
2]; // animated
|
||||
|
||||
uchar pal2 = rom_[core::overworldMapPaletteGroup + (area_palette_ * 4) + 1];
|
||||
uchar pal3 = rom_[core::overworldMapPaletteGroup + (area_palette_ * 4) + 2];
|
||||
uchar pal4 = rom_[core::overworldSpritePaletteGroup +
|
||||
(sprite_palette_[game_state_] * 2)]; // spr3
|
||||
(sprite_palette_[game_state_] * 2)];
|
||||
uchar pal5 = rom_[core::overworldSpritePaletteGroup +
|
||||
(sprite_palette_[game_state_] * 2) + 1]; // spr4
|
||||
(sprite_palette_[game_state_] * 2) + 1];
|
||||
|
||||
gfx::SNESPalette aux1;
|
||||
gfx::SNESPalette aux2;
|
||||
gfx::SNESPalette main;
|
||||
gfx::SNESPalette animated;
|
||||
gfx::SNESPalette hud;
|
||||
gfx::SNESPalette spr;
|
||||
gfx::SNESPalette spr2;
|
||||
gfx::SNESColor bgr = rom_.GetPaletteGroup("grass")[0].GetColor(0);
|
||||
|
||||
if (pal1 == 255) {
|
||||
pal1 = rom_[core::overworldMapPaletteGroup + (previousPalId * 4)];
|
||||
}
|
||||
if (pal1 != 255) {
|
||||
if (pal1 >= 20) {
|
||||
pal1 = 19;
|
||||
}
|
||||
|
||||
aux1 = rom_.GetPaletteGroup("ow_aux")[pal1];
|
||||
} else {
|
||||
aux1 = rom_.GetPaletteGroup("ow_aux")[0];
|
||||
}
|
||||
|
||||
if (pal2 == 255) {
|
||||
pal2 = rom_[core::overworldMapPaletteGroup + (previousPalId * 4) + 1];
|
||||
}
|
||||
if (pal2 != 255) {
|
||||
if (pal2 >= 20) {
|
||||
pal2 = 19;
|
||||
}
|
||||
|
||||
aux2 = rom_.GetPaletteGroup("ow_aux")[pal2];
|
||||
} else {
|
||||
aux2 = rom_.GetPaletteGroup("ow_aux")[0];
|
||||
}
|
||||
gfx::SNESPalette aux1 = GetPalette("ow_aux", pal1, previousPalId, 20);
|
||||
gfx::SNESPalette aux2 = GetPalette("ow_aux", pal2, previousPalId, 20);
|
||||
|
||||
// Additional handling of `pal3` and `parent_`
|
||||
if (pal3 == 255) {
|
||||
pal3 = rom_[core::overworldMapPaletteGroup + (previousPalId * 4) + 2];
|
||||
}
|
||||
|
||||
if (parent_ < 0x40) {
|
||||
// Default LW Palette
|
||||
pal0 = 0;
|
||||
pal0 = parent_ == 0x03 || parent_ == 0x05 || parent_ == 0x07 ? 2 : 0;
|
||||
bgr = rom_.GetPaletteGroup("grass")[0].GetColor(0);
|
||||
if (parent_ == 0x03 || parent_ == 0x05 || parent_ == 0x07) {
|
||||
pal0 = 2;
|
||||
}
|
||||
} else if (parent_ >= 0x40 && parent_ < 0x80) {
|
||||
// Default DW Palette
|
||||
pal0 = 1;
|
||||
pal0 = parent_ == 0x43 || parent_ == 0x45 || parent_ == 0x47 ? 3 : 1;
|
||||
bgr = rom_.GetPaletteGroup("grass")[0].GetColor(1);
|
||||
if (parent_ == 0x43 || parent_ == 0x45 || parent_ == 0x47) {
|
||||
pal0 = 3;
|
||||
}
|
||||
} else if (parent_ >= 128 && parent_ < core::kNumOverworldMaps) {
|
||||
// Default SP Palette
|
||||
pal0 = 0;
|
||||
bgr = rom_.GetPaletteGroup("grass")[0].GetColor(2);
|
||||
}
|
||||
|
||||
if (parent_ == 0x88) {
|
||||
pal0 = 4;
|
||||
}
|
||||
gfx::SNESPalette main = GetPalette("ow_main", pal0, previousPalId, 255);
|
||||
gfx::SNESPalette animated =
|
||||
GetPalette("ow_animated", std::min((int)pal3, 13), previousPalId, 14);
|
||||
gfx::SNESPalette hud = rom_.GetPaletteGroup("hud")[0];
|
||||
|
||||
if (pal0 != 255) {
|
||||
main = rom_.GetPaletteGroup("ow_main")[pal0];
|
||||
} else {
|
||||
main = rom_.GetPaletteGroup("ow_main")[0];
|
||||
}
|
||||
|
||||
if (pal3 >= 14) {
|
||||
pal3 = 13;
|
||||
}
|
||||
animated = rom_.GetPaletteGroup("ow_animated")[(pal3)];
|
||||
|
||||
hud = rom_.GetPaletteGroup("hud")[0];
|
||||
if (pal4 == 255) {
|
||||
pal4 = rom_[core::overworldSpritePaletteGroup +
|
||||
(previousSprPalId * 2)]; // spr3
|
||||
}
|
||||
if (pal4 == 255) {
|
||||
pal4 = 0;
|
||||
}
|
||||
if (pal4 >= 24) {
|
||||
pal4 = 23;
|
||||
}
|
||||
spr = rom_.GetPaletteGroup("sprites_aux3")[pal4];
|
||||
|
||||
if (pal5 == 255) {
|
||||
pal5 = rom_[core::overworldSpritePaletteGroup + (previousSprPalId * 2) +
|
||||
1]; // spr3
|
||||
}
|
||||
if (pal5 == 255) {
|
||||
pal5 = 0;
|
||||
}
|
||||
if (pal5 >= 24) {
|
||||
pal5 = 23;
|
||||
}
|
||||
spr2 = rom_.GetPaletteGroup("sprites_aux3")[pal5];
|
||||
gfx::SNESPalette spr = GetPalette("sprites_aux3", pal4, previousSprPalId, 24);
|
||||
gfx::SNESPalette spr2 =
|
||||
GetPalette("sprites_aux3", pal5, previousSprPalId, 24);
|
||||
|
||||
SetColorsPalette(rom_, parent_, current_palette_, main, animated, aux1, aux2,
|
||||
hud, bgr, spr, spr2);
|
||||
}
|
||||
|
||||
// New helper function to process graphics buffer.
|
||||
void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
|
||||
int size) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
auto byte = all_gfx_[i + (static_graphics_offset * size)];
|
||||
switch (index) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
byte += 0x88;
|
||||
break;
|
||||
}
|
||||
current_gfx_[(index * size) + i] = byte;
|
||||
}
|
||||
}
|
||||
|
||||
absl::Status OverworldMap::BuildTileset() {
|
||||
all_gfx_ = rom_.GetGraphicsBuffer();
|
||||
current_gfx_.reserve(0x10000);
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
current_gfx_.push_back(0x00);
|
||||
}
|
||||
current_gfx_.resize(0x10000, 0x00);
|
||||
|
||||
for (int i = 0; i < 0x10; i++) {
|
||||
for (int j = 0; j < 0x1000; j++) {
|
||||
auto byte = all_gfx_[j + (static_graphics_[i] * 0x1000)];
|
||||
switch (i) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
byte += 0x88;
|
||||
break;
|
||||
}
|
||||
current_gfx_[(i * 0x1000) + j] = byte;
|
||||
}
|
||||
ProcessGraphicsBuffer(i, static_graphics_[i], 0x1000);
|
||||
}
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "app/core/common.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
@@ -39,9 +40,21 @@ class OverworldMap {
|
||||
|
||||
private:
|
||||
void LoadAreaInfo();
|
||||
|
||||
void LoadWorldIndex();
|
||||
void LoadSpritesBlocksets();
|
||||
void LoadMainBlocksets();
|
||||
void LoadAreaGraphicsBlocksets();
|
||||
void LoadDeathMountainGFX();
|
||||
void LoadAreaGraphics();
|
||||
|
||||
void LoadPalette();
|
||||
|
||||
|
||||
|
||||
void ProcessGraphicsBuffer(int index, int static_graphics_offset, int size);
|
||||
gfx::SNESPalette GetPalette(const std::string& group, int index, int previousIndex, int limit);
|
||||
|
||||
absl::Status BuildTileset();
|
||||
absl::Status BuildTiles16Gfx(int count);
|
||||
absl::Status BuildBitmap(OWBlockset& world_blockset);
|
||||
@@ -54,6 +67,8 @@ class OverworldMap {
|
||||
int area_palette_ = 0;
|
||||
int game_state_ = 0;
|
||||
|
||||
int world_index_ = 0;
|
||||
|
||||
uchar sprite_graphics_[3];
|
||||
uchar sprite_palette_[3];
|
||||
uchar area_music_[4];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "app/gui/canvas.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/rom.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "app/gui/canvas.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
Reference in New Issue
Block a user