diff --git a/external/libsiedler2 b/external/libsiedler2 index 7ae27b5973..5a2deccc75 160000 --- a/external/libsiedler2 +++ b/external/libsiedler2 @@ -1 +1 @@ -Subproject commit 7ae27b5973970872bd34b9ef759bc098bb44decd +Subproject commit 5a2deccc752755001c45b6a5ed12f8ec02de90a5 diff --git a/libs/s25main/Loader.cpp b/libs/s25main/Loader.cpp index 42a6a5e03f..b0502b7730 100644 --- a/libs/s25main/Loader.cpp +++ b/libs/s25main/Loader.cpp @@ -709,8 +709,9 @@ void Loader::fillCaches() bmp.add(dynamic_cast( bob_jobs->getBody(spriteData.isFat(), imgDir, ani_step))); - bmp.add(dynamic_cast( - bob_jobs->getOverlay(spriteData.getBobId(Nation(nation)), spriteData.isFat(), imgDir, ani_step))); + auto overlay = + bob_jobs->getOverlay(spriteData.getBobId(Nation(nation)), spriteData.isFat(), imgDir, ani_step); + bmp.add(dynamic_cast(overlay.first), overlay.second); bmp.addShadow(GetMapImage(900 + static_cast(imgDir) * 8 + ani_step)); stp->add(bmp); @@ -728,7 +729,8 @@ void Loader::fillCaches() const libsiedler2::ImgDir imgDir = toImgDir(dir); bmp.add(dynamic_cast(bob_jobs->getBody(true, imgDir, ani_step))); - bmp.add(dynamic_cast(bob_jobs->getOverlay(0, true, imgDir, ani_step))); + auto overlay = bob_jobs->getOverlay(0, true, imgDir, ani_step); + bmp.add(dynamic_cast(overlay.first), overlay.second); bmp.addShadow(GetMapImage(900 + static_cast(imgDir) * 8 + ani_step)); stp->add(bmp); @@ -939,8 +941,8 @@ void Loader::fillCaches() } else { bmp.add(dynamic_cast(bob_carrier->getBody(fat, imgDir, ani_step))); - bmp.add(dynamic_cast( - bob_carrier->getOverlay(id, fat, imgDir, ani_step))); + auto overlay = bob_carrier->getOverlay(id, fat, imgDir, ani_step); + bmp.add(dynamic_cast(overlay.first), overlay.second); } bmp.addShadow(GetMapImage(900 + static_cast(imgDir) * 8 + ani_step)); diff --git a/libs/s25main/ogl/glArchivItem_Bob.cpp b/libs/s25main/ogl/glArchivItem_Bob.cpp index 1e1f5cb5cc..18a02c9978 100644 --- a/libs/s25main/ogl/glArchivItem_Bob.cpp +++ b/libs/s25main/ogl/glArchivItem_Bob.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "glArchivItem_Bob.h" +#include "DrawPoint.h" #include "glArchivItem_Bitmap_Player.h" #include "s25util/colors.h" @@ -15,9 +16,13 @@ void glArchivItem_Bob::Draw(unsigned item, libsiedler2::ImgDir direction, bool f auto* body = dynamic_cast(getBody(fat, direction, animationstep)); if(body) body->DrawFull(drawPt, COLOR_WHITE, color); - auto* overlay = dynamic_cast(getOverlay(item, fat, direction, animationstep)); - if(overlay) - overlay->DrawFull(drawPt, COLOR_WHITE, color); + auto overlay = getOverlay(item, fat, direction, animationstep); + auto* glOverlay = dynamic_cast(overlay.first); + if(glOverlay) + { + drawPt.y -= overlay.second; + glOverlay->DrawFull(drawPt, COLOR_WHITE, color); + } } void glArchivItem_Bob::mergeLinks(const std::map& overrideLinks) @@ -26,10 +31,10 @@ void glArchivItem_Bob::mergeLinks(const std::map& overrideLi return; // Get last key of sorted map const auto maxIdx = overrideLinks.rbegin()->first; - if(maxIdx >= links.size()) - links.resize(maxIdx + 1u); + if(maxIdx >= spriteOverlayIdx.size()) + spriteOverlayIdx.resize(maxIdx + 1u); for(const auto& newLink : overrideLinks) { - links[newLink.first] = newLink.second; + spriteOverlayIdx[newLink.first] = newLink.second; } } diff --git a/libs/s25main/ogl/glBitmapItem.cpp b/libs/s25main/ogl/glBitmapItem.cpp index f9ed7f03ae..1ea723ab26 100644 --- a/libs/s25main/ogl/glBitmapItem.cpp +++ b/libs/s25main/ogl/glBitmapItem.cpp @@ -13,9 +13,9 @@ glBitmapItem::glBitmapItem(libsiedler2::baseArchivItem_Bitmap* b, bool shadow, b b->getVisibleArea(pos.x, pos.y, size.x, size.y); origin = Position(b->getNx(), b->getNy()) - pos; } -glBitmapItem::glBitmapItem(libsiedler2::ArchivItem_Bitmap_Player* b, bool isOwning) +glBitmapItem::glBitmapItem(libsiedler2::ArchivItem_Bitmap_Player* b, int yOffset, bool isOwning) : bmp(b), type(glBitmapItemType::PlayerBitmap), isOwning_(isOwning) { b->getVisibleArea(pos.x, pos.y, size.x, size.y); - origin = Position(b->getNx(), b->getNy()) - pos; + origin = Position(b->getNx(), b->getNy() - yOffset) - pos; } diff --git a/libs/s25main/ogl/glBitmapItem.h b/libs/s25main/ogl/glBitmapItem.h index 7d9adf0eea..f362b469e2 100644 --- a/libs/s25main/ogl/glBitmapItem.h +++ b/libs/s25main/ogl/glBitmapItem.h @@ -23,7 +23,7 @@ class glBitmapItem { public: glBitmapItem(libsiedler2::baseArchivItem_Bitmap* b, bool shadow = false, bool isOwning = false); - glBitmapItem(libsiedler2::ArchivItem_Bitmap_Player* b, bool isOwning = false); + glBitmapItem(libsiedler2::ArchivItem_Bitmap_Player* b, int nyOffset, bool isOwning = false); libsiedler2::ArchivItem_BitmapBase* bmp; glBitmapItemType type; diff --git a/libs/s25main/ogl/glSmartBitmap.cpp b/libs/s25main/ogl/glSmartBitmap.cpp index 1784a29a4f..9757da4a9f 100644 --- a/libs/s25main/ogl/glSmartBitmap.cpp +++ b/libs/s25main/ogl/glSmartBitmap.cpp @@ -51,11 +51,11 @@ Extent glSmartBitmap::getRequiredTexSize() const return texSize; } -void glSmartBitmap::add(libsiedler2::ArchivItem_Bitmap_Player* bmp) +void glSmartBitmap::add(libsiedler2::ArchivItem_Bitmap_Player* bmp, int nyOffset) { if(!bmp) return; - items.push_back(glBitmapItem(bmp)); + items.push_back(glBitmapItem(bmp, nyOffset)); calcDimensions(); } diff --git a/libs/s25main/ogl/glSmartBitmap.h b/libs/s25main/ogl/glSmartBitmap.h index d0676691da..40a765eb22 100644 --- a/libs/s25main/ogl/glSmartBitmap.h +++ b/libs/s25main/ogl/glSmartBitmap.h @@ -70,6 +70,6 @@ class glSmartBitmap : public ITexture void add(libsiedler2::baseArchivItem_Bitmap* bmp); void add(std::unique_ptr bmp); - void add(libsiedler2::ArchivItem_Bitmap_Player* bmp); + void add(libsiedler2::ArchivItem_Bitmap_Player* bmp, int nyOffset = 0); void addShadow(libsiedler2::baseArchivItem_Bitmap* bmp); };