From 118c9cc93d17a7bb16f39088b36e2ba5a3f1be06 Mon Sep 17 00:00:00 2001 From: Pk11 Date: Thu, 26 Aug 2021 21:01:59 -0500 Subject: [PATCH] Couple tweaks to Image --- include/image.hpp | 5 ++--- source/image.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/image.hpp b/include/image.hpp index e863e3a..79013ae 100644 --- a/include/image.hpp +++ b/include/image.hpp @@ -72,13 +72,12 @@ public: const std::vector &bitmap(void) const { return _bitmap; } const std::vector &palette(void) const { return _palette; } - void changePaletteStart(u8 paletteStart); + void paletteStart(u8 paletteStart); /** * @brief Copies the palette into VRAM - * @param paletteStart Where to start the palette in VRAM */ - void copyPalette(int paletteStart); + void copyPalette(void); /** * @brief Draws the image to a background layer, slower but can skip alpha, scale, and offset the palette diff --git a/source/image.cpp b/source/image.cpp index e0c4f37..b46d660 100644 --- a/source/image.cpp +++ b/source/image.cpp @@ -88,7 +88,7 @@ Image::Image(const u8 *grf, u8 paletteStart) { load(grf, paletteStart); } -void Image::load(const u8 *grf, u8 paletteStart) { +void Image::load(const u8 *grf, u8 paletteStartLoc) { const u32 *ptr = (u32 *)grf; if(!ptr || ptr[0] != 0x46464952 || ptr[2] != 0x20465247) { return; @@ -106,7 +106,7 @@ void Image::load(const u8 *grf, u8 paletteStart) { } case 0x20584647: { // 'GFX ' _bitmap = std::vector(ptr[2] >> 8); decompressGrf(_bitmap.data(), ptr + 2); - changePaletteStart(paletteStart); + paletteStart(paletteStartLoc); break; } case 0x204C4150: { // 'PAL ' _palette = std::vector((ptr[2] >> 8) / 2); @@ -126,7 +126,7 @@ void Image::load(const u8 *grf, u8 paletteStart) { } } -void Image::changePaletteStart(u8 paletteStart) { +void Image::paletteStart(u8 paletteStart) { int moveBy = paletteStart - _paletteStart; if(moveBy != 0) { @@ -138,8 +138,8 @@ void Image::changePaletteStart(u8 paletteStart) { } } -void Image::copyPalette(int paletteStart) { - tonccpy((currentScreen ? BG_PALETTE : BG_PALETTE_SUB) + paletteStart, _palette.data(), _palette.size() * 2); +void Image::copyPalette(void) { + tonccpy((currentScreen ? BG_PALETTE : BG_PALETTE_SUB) + _paletteStart, _palette.data(), _palette.size() * 2); } void Image::draw(int x, int y, float scaleX, float scaleY, bool skipAlpha) {