From 17874b033a579575ef30cb4ef5d2d3b0e39e3355 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Thu, 1 Nov 2018 00:57:01 +0100 Subject: [PATCH] Theme_Barrel bin exact --- Source/themes.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/themes.cpp b/Source/themes.cpp index 4ad7d4e75..7d8a3646e 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -703,13 +703,17 @@ void __fastcall PlaceThemeMonsts(int t, int f) } // 45D0E1: using guessed type int var_1D0[111]; +// Theme_Barrel initializes the barrel theme. +// +// Parameters: +// - t: theme number (index into themes array). void __fastcall Theme_Barrel(int t) { - int yp; // edi - int xp; // ebx + int xp; + int yp; int r; - char monstrnd[4]; char barrnd[4]; + char monstrnd[4]; barrnd[0] = 2; barrnd[1] = 6; @@ -719,18 +723,17 @@ void __fastcall Theme_Barrel(int t) monstrnd[1] = 7; monstrnd[2] = 3; monstrnd[3] = 9; - for (yp = 0; yp < 112; yp++) { for (xp = 0; xp < 112; xp++) { if (dung_map[xp][yp] == themes[t].ttval && !nSolidTable[dPiece[xp][yp]]) { - if (!random(0, barrnd[leveltype - 1])) { - r = random(0, barrnd[leveltype - 1]); - AddObject((r != 0) + OBJ_BARREL, xp, yp); + if (random(0, barrnd[leveltype - 1]) == 0) { + r = random(0, barrnd[leveltype - 1]) != 0; + r += OBJ_BARREL; + AddObject(r, xp, yp); } } } } - PlaceThemeMonsts(t, monstrnd[leveltype - 1]); }