fix overworld colors drawing

This commit is contained in:
scawful
2022-09-11 14:23:58 -05:00
parent 0896f51c39
commit 9b4f8fd716
4 changed files with 28 additions and 20 deletions

View File

@@ -194,9 +194,10 @@ void Overworld::FetchLargeMaps() {
overworld_maps_[136].SetLargeMap(false);
bool mapChecked[64];
for (auto &each : mapChecked) {
each = false;
}
for (int i = 0; i < 64; i++)
{
mapChecked[i] = false;
}
int xx = 0;
int yy = 0;
while (true) {

View File

@@ -9,7 +9,6 @@
#include "absl/status/status.h"
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/pseudo_vram.h"
#include "app/gfx/snes_tile.h"
#include "app/rom.h"
#include "app/zelda3/overworld_map.h"

View File

@@ -176,16 +176,7 @@ absl::Status OverworldMap::BuildMap(int count, int game_state, int world,
}
}
int world_index = 0x20;
if (parent_ < 0x40) {
world_index = 0x20;
} else if (parent_ >= 0x40 && parent_ < 0x80) {
world_index = 0x21;
} else if (parent_ == 0x88) {
world_index = 0x24;
}
LoadAreaGraphics(game_state, world_index);
LoadAreaGraphics();
RETURN_IF_ERROR(BuildTileset())
RETURN_IF_ERROR(BuildTiles16Gfx(count))
LoadPalette();
@@ -273,7 +264,16 @@ void OverworldMap::LoadAreaInfo() {
}
}
void OverworldMap::LoadAreaGraphics(int game_state, int world_index) {
void OverworldMap::LoadAreaGraphics() {
int world_index = 0x20;
if (parent_ < 0x40) {
world_index = 0x20;
} else if (parent_ >= 0x40 && parent_ < 0x80) {
world_index = 0x21;
} else if (parent_ == 0x88) {
world_index = 0x24;
}
// Sprites Blocksets
static_graphics_[8] = 0x73 + 0x00;
static_graphics_[9] = 0x73 + 0x01;
@@ -281,7 +281,7 @@ void OverworldMap::LoadAreaGraphics(int game_state, int world_index) {
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] +
(sprite_graphics_[game_state_] * 4) + i] +
0x73);
}
@@ -386,7 +386,7 @@ void OverworldMap::LoadPalette() {
if (parent_ < 0x40) {
// Default LW Palette
pal0 = 0;
bgr = rom_.GetPaletteGroup("grass")[0].GetColor(0);
if (parent_ == 0x03 || parent_ == 0x05 || parent_ == 0x07) {
pal0 = 2;
}
@@ -456,8 +456,16 @@ absl::Status OverworldMap::BuildTileset() {
for (int i = 0; i < 0x10; i++) {
for (int j = 0; j < 0x1000; j++) {
current_gfx_[(i * 0x1000) + j] =
all_gfx_[j + (static_graphics_[i] * 0x1000)];
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;
}
}
return absl::OkStatus();

View File

@@ -38,7 +38,7 @@ class OverworldMap {
private:
void LoadAreaInfo();
void LoadAreaGraphics(int game_state, int world_index);
void LoadAreaGraphics();
void LoadPalette();
absl::Status BuildTileset();