this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove binary notation

authored by

phcoder and committed by
Vladimir Serbinenko
9f279e15 4fccc8f0

+24 -24
+19 -19
src/core/draw.c
··· 149 149 const tic_vram* vram = &core->memory.ram->vram; 150 150 u8* mapping = getPalette(&core->memory, colors, count); 151 151 152 - rotate &= 0b11; 153 - u32 orientation = flip & 0b11; 152 + rotate &= 3; 153 + u32 orientation = flip & 3; 154 154 155 - if (rotate == tic_90_rotate) orientation ^= 0b001; 156 - else if (rotate == tic_180_rotate) orientation ^= 0b011; 157 - else if (rotate == tic_270_rotate) orientation ^= 0b010; 158 - if (rotate == tic_90_rotate || rotate == tic_270_rotate) orientation |= 0b100; 155 + if (rotate == tic_90_rotate) orientation ^= 1; 156 + else if (rotate == tic_180_rotate) orientation ^= 3; 157 + else if (rotate == tic_270_rotate) orientation ^= 2; 158 + if (rotate == tic_90_rotate || rotate == tic_270_rotate) orientation |= 2; 159 159 160 160 if (scale == 1) { 161 161 // the most common path ··· 167 167 y += sy; 168 168 x += sx; 169 169 switch (orientation) { 170 - case 0b100: DRAW_TILE_BODY(py, px); break; 171 - case 0b110: DRAW_TILE_BODY(REVERT(py), px); break; 172 - case 0b101: DRAW_TILE_BODY(py, REVERT(px)); break; 173 - case 0b111: DRAW_TILE_BODY(REVERT(py), REVERT(px)); break; 174 - case 0b000: DRAW_TILE_BODY(px, py); break; 175 - case 0b010: DRAW_TILE_BODY(px, REVERT(py)); break; 176 - case 0b001: DRAW_TILE_BODY(REVERT(px), py); break; 177 - case 0b011: DRAW_TILE_BODY(REVERT(px), REVERT(py)); break; 170 + case 4: DRAW_TILE_BODY(py, px); break; 171 + case 6: DRAW_TILE_BODY(REVERT(py), px); break; 172 + case 5: DRAW_TILE_BODY(py, REVERT(px)); break; 173 + case 7: DRAW_TILE_BODY(REVERT(py), REVERT(px)); break; 174 + case 0: DRAW_TILE_BODY(px, py); break; 175 + case 2: DRAW_TILE_BODY(px, REVERT(py)); break; 176 + case 1: DRAW_TILE_BODY(REVERT(px), py); break; 177 + case 3: DRAW_TILE_BODY(REVERT(px), REVERT(py)); break; 178 178 } 179 179 return; 180 180 } ··· 186 186 s32 xx = x; 187 187 for (s32 px = 0; px < TIC_SPRITESIZE; px++, xx += scale) 188 188 { 189 - s32 ix = orientation & 0b001 ? TIC_SPRITESIZE - px - 1 : px; 190 - s32 iy = orientation & 0b010 ? TIC_SPRITESIZE - py - 1 : py; 191 - if (orientation & 0b100) { 189 + s32 ix = orientation & 1 ? TIC_SPRITESIZE - px - 1 : px; 190 + s32 iy = orientation & 2 ? TIC_SPRITESIZE - py - 1 : py; 191 + if (orientation & 4) { 192 192 s32 tmp = ix; ix = iy; iy = tmp; 193 193 } 194 194 u8 color = mapping[tic_tilesheet_gettilepix(tile, ix, iy)]; ··· 207 207 if (index < 0) 208 208 return; 209 209 210 - rotate &= 0b11; 211 - flip &= 0b11; 210 + rotate &= 3; 211 + flip &= 3; 212 212 213 213 tic_tilesheet sheet = getTileSheetFromSegment(&core->memory, core->memory.ram->vram.blit.segment); 214 214 if (w == 1 && h == 1) {
+3 -3
src/tic.h
··· 140 140 141 141 typedef enum 142 142 { 143 - tic_no_flip = 0b00, 144 - tic_horz_flip = 0b01, 145 - tic_vert_flip = 0b10, 143 + tic_no_flip = 0, 144 + tic_horz_flip = 1, 145 + tic_vert_flip = 2, 146 146 } tic_flip; 147 147 148 148 typedef enum
+2 -2
src/tools.c
··· 176 176 { 177 177 if(sfx >= SFX_COUNT) sfx = SFX_COUNT-1; 178 178 179 - row->sfxhi = (sfx & 0b00100000) >> MUSIC_SFXID_LOW_BITS; 180 - row->sfxlow = sfx & 0b00011111; 179 + row->sfxhi = (sfx & 0x20) >> MUSIC_SFXID_LOW_BITS; 180 + row->sfxlow = sfx & 0x1f; 181 181 } 182 182 183 183 bool tic_tool_empty(const void* buffer, s32 size)