From 557c610138f4ad3bb0f644a9870973f5de98939a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 4 Jul 2017 02:08:21 +0200 Subject: [PATCH] KINGDOM: Implement DrawIcon, make a check in GL1 more coherent (style wise) --- engines/kingdom/GPLogic1.cpp | 2 +- engines/kingdom/kingdom.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/engines/kingdom/GPLogic1.cpp b/engines/kingdom/GPLogic1.cpp index da7e153609d..a0ef18ac291 100644 --- a/engines/kingdom/GPLogic1.cpp +++ b/engines/kingdom/GPLogic1.cpp @@ -105,7 +105,7 @@ void KingdomGame::GPLogic1() { if (!_Wizard) { _StatPlay = 50; _LoopFlag = true; - return; + break; } } DrawLocation(); diff --git a/engines/kingdom/kingdom.cpp b/engines/kingdom/kingdom.cpp index b6eac132ba0..3fed5bba72e 100644 --- a/engines/kingdom/kingdom.cpp +++ b/engines/kingdom/kingdom.cpp @@ -1474,7 +1474,22 @@ void KingdomGame::SwitchMtoA() { } void KingdomGame::DrawIcon(int x, int y, int index) { - debug("STUB: DrawIcon"); + const byte *data = _kingartEntries[index].data; + int width = _kingartEntries[index].Width; + int height = _kingartEntries[index].Height; + + ::Graphics::Surface *screen = g_system->lockScreen(); + for (uint curX = 0; curX < width; curX++) { + for (uint curY = 0; curY < height; curY++) { + const byte *src = data + (curY * width) + curX; + byte *dst = (byte *)screen->getBasePtr(curX + x, curY + y); + if (*src != 0xFF) + *dst = *src; + } + } + g_system->unlockScreen(); + g_system->updateScreen(); + } int KingdomGame::GetAKey() {