Add MOD to match mod with powers of 2

This commit is contained in:
GriffinR
2023-08-16 16:44:45 -04:00
parent 057928438a
commit bdc0ea1037
8 changed files with 21 additions and 14 deletions
+2 -2
View File
@@ -38,7 +38,7 @@
#include "constants/moves.h"
#include "constants/trainers.h"
#define NUM_LAYOUT_OFFSETS 8 // Assumed to be a power of 2
#define NUM_LAYOUT_OFFSETS 8
extern const struct MapLayout *const gMapLayouts[];
@@ -1904,7 +1904,7 @@ static void GetPyramidFloorLayoutOffsets(u8 *layoutOffsets)
for (i = 0; i < NUM_PYRAMID_FLOOR_SQUARES; i++)
{
layoutOffsets[i] = sPyramidFloorTemplates[id].layoutOffsets[rand & (NUM_LAYOUT_OFFSETS - 1)];
layoutOffsets[i] = sPyramidFloorTemplates[id].layoutOffsets[MOD(rand, NUM_LAYOUT_OFFSETS)];
rand >>= 3;
if (i == 7)
{