From 184adcefea1bf46575a66fafccea350b11f6338a Mon Sep 17 00:00:00 2001 From: Juliano Leal Goncalves Date: Sun, 27 Jun 2021 23:31:13 -0300 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Leverage=20'Point'=20in=20?= =?UTF-8?q?'DrawMonster'=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/scrollrt.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 53f1c418f..55f6f6978 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -340,13 +340,11 @@ void DrawMissile(const Surface &out, Point tilePosition, Point targetBufferPosit /** * @brief Render a monster sprite * @param out Output buffer - * @param x dPiece coordinate - * @param y dPiece coordinate - * @param mx Output buffer coordinate - * @param my Output buffer coordinate + * @param tilePosition dPiece coordinates + * @param targetBufferPosition Output buffer coordinates * @param m Id of monster */ -void DrawMonster(const Surface &out, int x, int y, int mx, int my, const Monster &monster) +void DrawMonster(const Surface &out, Point tilePosition, Point targetBufferPosition, const Monster &monster) { if (monster.AnimInfo.pCelSprite == nullptr) { Log("Draw Monster \"{}\": NULL Cel Buffer", monster.mName); @@ -430,8 +428,8 @@ void DrawMonster(const Surface &out, int x, int y, int mx, int my, const Monster const auto &cel = *monster.AnimInfo.pCelSprite; - if ((dFlags[x][y] & BFLAG_LIT) == 0) { - Cl2DrawLightTbl(out, mx, my, cel, nCel, 1); + if ((dFlags[tilePosition.x][tilePosition.y] & BFLAG_LIT) == 0) { + Cl2DrawLightTbl(out, targetBufferPosition.x, targetBufferPosition.y, cel, nCel, 1); return; } int trans = 0; @@ -442,9 +440,9 @@ void DrawMonster(const Surface &out, int x, int y, int mx, int my, const Monster if (Players[MyPlayerId]._pInfraFlag && LightTableIndex > 8) trans = 1; if (trans != 0) - Cl2DrawLightTbl(out, mx, my, cel, nCel, trans); + Cl2DrawLightTbl(out, targetBufferPosition.x, targetBufferPosition.y, cel, nCel, trans); else - Cl2DrawLight(out, mx, my, cel, nCel); + Cl2DrawLight(out, targetBufferPosition.x, targetBufferPosition.y, cel, nCel); } /** @@ -782,7 +780,7 @@ void DrawMonsterHelper(const Surface &out, Point tilePosition, int oy, Point tar if (mi == pcursmonst) { Cl2DrawOutline(out, 233, monsterRenderPosition.x, monsterRenderPosition.y, cel, monster.AnimInfo.GetFrameToUseForRendering()); } - DrawMonster(out, tilePosition.x, tilePosition.y, monsterRenderPosition.x, monsterRenderPosition.y, monster); + DrawMonster(out, tilePosition, monsterRenderPosition, monster); } /**