Merge pull request #3043 from janisozaur/develop

Only enable assert() in drawing code when explicitly debugging
This commit is contained in:
Ted John 2016-02-28 20:50:51 +00:00
commit 3dcc962ef9
3 changed files with 5 additions and 2 deletions

View File

@ -63,7 +63,7 @@ uint8 text_palette[0x8] = {
};
// Previously 0x97FCBC use it to get the correct palette from g1_elements
const uint16 palette_to_g1_offset[] = {
const uint16 palette_to_g1_offset[PALETTE_TO_G1_OFFSET_COUNT] = {
0x1333, 0x1334, 0x1335, 0x1336,
0x1337, 0x1338, 0x1339, 0x133A,
0x133B, 0x133C, 0x133D, 0x133E,

View File

@ -82,6 +82,7 @@ typedef struct {
#define SPRITE_ID_PALETTE_COLOUR_1(colourId) ((IMAGE_TYPE_USE_PALETTE << 28) | ((colourId) << 19))
#define PALETTE_TO_G1_OFFSET_COUNT 144
extern const uint16 palette_to_g1_offset[];
extern const uint8 peep_palette[];
extern uint8 text_palette[];

View File

@ -319,7 +319,9 @@ void FASTCALL gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y
uint32 primary_offset = palette_to_g1_offset[(image_id >> 19) & 0x1F];
uint32 secondary_offset = palette_to_g1_offset[(image_id >> 24) & 0x1F];
assert(tertiary_colour < 144);
#if DEBUG_LEVEL_2
assert(tertiary_colour < PALETTE_TO_G1_OFFSET_COUNT);
#endif // DEBUG_LEVEL_2
uint32 tertiary_offset = palette_to_g1_offset[tertiary_colour];
rct_g1_element* primary_colour = &g1Elements[primary_offset];