public void loadPallete(byte dungeon, byte map, bool overworld, bool sideview) { if (overWorld || overworld) { gb.BufferLocation = 0x842EF + map; byte b = gb.ReadByte(); palOffset = b; b *= 2; gb.BufferLocation = 0x842B1 + b; gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address; paletteLocation = gb.BufferLocation; palette = gb.GetPalette(gb.BufferLocation); return; } if (cSideView || sideview) { if (dungeon != 0x07) { gb.BufferLocation = 0x84401 + (dungeon * 2); gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address; paletteLocation = gb.BufferLocation; palette = gb.GetPalette(gb.BufferLocation); return; } else if (map >= 0x64 && map <= 0x67 || map == 0x6A || map == 0x6B) { gb.BufferLocation = 0x86750; paletteLocation = gb.BufferLocation; palette = gb.GetPalette(gb.BufferLocation); return; } else { gb.BufferLocation = 0x84401 + (dungeon * 2); gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address; paletteLocation = gb.BufferLocation; palette = gb.GetPalette(gb.BufferLocation); return; } } if (!overWorld || !overworld) { gb.BufferLocation = 0x8523A; for (int i = 0; i < 0x2D; i++) { if (gb.ReadByte() != dungeon) { gb.BufferLocation += 3; continue; } if (gb.ReadByte() != map) { gb.BufferLocation += 2; continue; } byte off = gb.ReadByte(); if (off != 4) { gb.BufferLocation++; continue; } byte b = gb.ReadByte(); palOffset = b; gb.BufferLocation = 0x851F6; b &= 0x3F; b <<= 1; gb.BufferLocation += b; gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address; paletteLocation = gb.BufferLocation; palette = gb.GetPalette(gb.BufferLocation); return; } if (dungeon == 0xFF) //0xFF = Color dungeon { gb.BufferLocation = 0x867D0; paletteLocation = gb.BufferLocation; if (map != 0x1 && map != 0x13 && map != 0xF) { palette = gb.GetPalette(gb.BufferLocation); } else { for (int i = 0; i < 8; i++) { if (i == 7) { if (map == 0x1) { paletteLocation = gb.BufferLocation; gb.BufferLocation = 0xDACF0; } else { paletteLocation = gb.BufferLocation; gb.BufferLocation = 0xDACE0; } } for (int k = 0; k < 4; k++) { palette[i, k] = GetColor(gb.BufferLocation); } } } return; } else if (dungeon > 0x09) //Indoor { byte b = (byte)((dungeon - 0x0A) << 1); gb.BufferLocation = 0x84413 + b; gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address + map; b = (byte)gb.ReadByte(); palOffset = b; b *= 2; gb.BufferLocation = 0x8443F + b; gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address; paletteLocation = gb.BufferLocation; palette = gb.GetPalette(gb.BufferLocation); return; } else { gb.BufferLocation = 0x843EF + (dungeon * 2); gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address; paletteLocation = gb.BufferLocation; palette = gb.GetPalette(gb.BufferLocation); } } }