Remove vmult lookup tables

There's really no need to put the y-multiplication in a lookup table.
The compiler will optimize the multiplication better than putting it in
a lookup table will.

To improve readability and to hardcode things less, the new
SCREEN_WIDTH_TILES and SCREEN_HEIGHT_TILES constant names are used, as
well as adding a new TILE_IDX macro to calculate the index of a tile in
a concatenated-rows (row-major in formal parlance) array. Also, tile
numbers are stored in a temporary variable to improve readability as
well (no more copy-pasting `contents[i + vmult[j]]` over and over
again).
This commit is contained in:
Misa committed 2021-09-24 16:37:27 -07:00
1 parent 491f3732aa
commit 6192269128
8 files changed
+64 -64

No files matched your search

-1
View File
@@ -134,7 +134,6 @@ public:
static const int maxwidth = 20, maxheight = 20; //Special; the physical max the engine allows
static const int numrooms = maxwidth * maxheight;
int contents[40 * 30 * numrooms];
int vmult[30 * maxheight];
int numtrinkets(void);
int numcrewmates(void);
RoomProperty roomproperties[numrooms]; //Maxwidth*maxheight