From ba9cf89a9e34ce044ee07e23ac11dc03726c1d30 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Apr 2019 02:46:48 +0200 Subject: [PATCH] Clean up TFit_Obj3 --- Source/themes.cpp | 29 +++++++++-------------------- Source/themes.h | 2 +- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Source/themes.cpp b/Source/themes.cpp index 77a8dc2c7..933e028a6 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -229,33 +229,22 @@ BOOL __fastcall CheckThemeObj3(int xp, int yp, int t, int f) return TRUE; } -BOOLEAN __fastcall TFit_Obj3(int t) +BOOL __fastcall TFit_Obj3(int t) { - int yp; // edi - int xp; // esi - char objrnd[4]; // [esp+Bh] [ebp-5h] - - objrnd[0] = 4; - objrnd[1] = 4; - objrnd[2] = 3; - objrnd[3] = 5; - yp = 1; - while (2) { - xp = 1; - do { + int xp, yp; + char objrnd[4] = { 4, 4, 3, 5 }; + + for (yp = 1; yp < MAXDUNY - 1; yp++) { + for (xp = 1; xp < MAXDUNX - 1; xp++) { if (CheckThemeObj3(xp, yp, t, objrnd[leveltype - 1])) { themex = xp; themey = yp; - return 1; + return TRUE; } - ++xp; - } while (xp < 111); - if (++yp < 111) { - continue; } - break; } - return 0; + + return FALSE; } BOOLEAN __fastcall CheckThemeReqs(int t) diff --git a/Source/themes.h b/Source/themes.h index a3638d631..6ddc03d15 100644 --- a/Source/themes.h +++ b/Source/themes.h @@ -24,7 +24,7 @@ BOOL __fastcall TFit_Obj5(int t); BOOL __fastcall TFit_SkelRoom(int t); BOOL __fastcall TFit_GoatShrine(int t); BOOL __fastcall CheckThemeObj3(int xp, int yp, int t, int f); -BOOLEAN __fastcall TFit_Obj3(int t); +BOOL __fastcall TFit_Obj3(int t); BOOLEAN __fastcall CheckThemeReqs(int t); BOOLEAN __fastcall SpecialThemeFit(int i, int t); BOOLEAN __fastcall CheckThemeRoom(int tv);