Solitaire for the TI-84 Plus CE!

Compare changes

Choose any two refs to compare.

+811 -1118
+2 -7
.gitignore
··· 1 - obj/ 2 - bin/ 3 - solver/ 4 - src/gfx/*.h 5 - src/gfx/*.c 6 - src/gfx/*.8xv 7 - src/gfx/*.lst 1 + bin/* 2 + obj/*
+1 -11
README.md
··· 2 2 3 3 This is a card solitaire game for the TI-84 Plus CE and TI-83 Premium CE. 4 4 5 - ## How to Play 6 - 7 - This is calculation. There are four foundation piles, each of which start with one card at the beginning of the game: the first pile starts with an ace, the second with a two, and so on. Each foundation is built on in multiples of the initial card (i.e. its position). So the first pile is built A, 2, 3, 4...; the second 2, 4, 6, 8...; the third 3, 6, 9, Q...; and the fourth 4, 8, Q, 3.... The card after K is A, though once a foundation has a king played to it, that is its thirteenth card and it is now complete, and no more cards may be played to it. 8 - 9 - Additionally, there are four tableau piles beneath the foundation piles. A card can always be placed on the top of a tableau pile, but it can only be removed from the pile by playing it to a foundation. Therefore, the clever placement of cards in the tableau is key to victory. 10 - 11 - Cards may be drawn one at a time from the deck by pressing `alpha` or picked up from the selected tableau pile with `2nd`. The card held in the player's hand may be played to the selected pile with `2nd` or returned to its origin pile in the tableau with `clear`. When interacting with tableau and foundation piles, the selected pile is marked with the cursor, which can be moved with the arrow keys. Moving the cursor all the way to the left or right causes it to wrap around from the tableau to the foundations or vice versa. 12 - 13 - Once all four foundations are completed, the game is over. The game can be reset at any point by pressing `del`. 14 - 15 5 ## Roadmap 16 6 17 - As more and more of the core game logic is made generic, the goal is to spin out the rules of the game to an interpreted script, and then allow the play of multiple solitaire games with one program and set of graphical assets. 7 + This branch is still heavily under development! Check back later for more information. 18 8 19 9 ## Dependencies 20 10
+47
src/card.c
··· 1 + #include "card.h" 2 + #include <stdlib.h> 3 + 4 + stack_t *stacks; 5 + uint8_t num_stacks; 6 + uint8_t next_stack; 7 + 8 + uint8_t alloc_stacks(uint8_t num) 9 + { 10 + num_stacks = num; 11 + stacks = malloc(num_stacks * sizeof(stack_t)); 12 + if (stacks == NULL) return 1; 13 + 14 + next_stack = 0; 15 + return 0; 16 + } 17 + 18 + uint8_t make_stack( 19 + uint8_t type, uint8_t max_cards, uint24_t x, 20 + uint8_t y, int8_t dx, int8_t dy 21 + ) { 22 + card_t *cards = malloc(max_cards * sizeof(card_t)); 23 + if (cards == NULL) return 1; 24 + 25 + stacks[next_stack].type = type; 26 + stacks[next_stack].cards = cards; 27 + stacks[next_stack].max_cards = max_cards; 28 + stacks[next_stack].x = x; 29 + stacks[next_stack].y = y; 30 + stacks[next_stack].dx = dx; 31 + stacks[next_stack].dy = dy; 32 + 33 + next_stack++; 34 + 35 + return 0; 36 + } 37 + 38 + void free_stacks() 39 + { 40 + for (uint8_t i = 0; i < num_stacks; i++) 41 + { 42 + free(stacks[i].cards); 43 + } 44 + 45 + free(stacks); 46 + } 47 +
+31
src/card.h
··· 1 + #ifndef CARD_H 2 + #define CARD_H 3 + 4 + #include <stdint.h> 5 + 6 + typedef uint8_t card_t; 7 + #define EMPTY_CARD 0x00 8 + #define EXISTS(card) (card & 0x80) 9 + #define SUIT(card) ((card & 0x30) >> 4) 10 + #define IS_RED(card) (card & 0x20) 11 + #define NUMBER(card) (card & 0x0f) 12 + 13 + typedef struct { 14 + uint8_t type; 15 + uint24_t x; 16 + uint8_t y; 17 + int8_t dx; 18 + int8_t dy; 19 + card_t *cards; 20 + uint8_t max_cards; 21 + } stack_t; 22 + 23 + extern stack_t *stacks; 24 + extern uint8_t num_stacks; 25 + 26 + uint8_t alloc_stacks(uint8_t num_stacks); 27 + uint8_t make_stack(uint8_t type, uint8_t max_cards, uint24_t x, 28 + uint8_t y, int8_t dx, int8_t dy); 29 + void free_stacks(); 30 + 31 + #endif
+179 -349
src/drawing.c
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #include "drawing.h" 18 - 19 - #include <graphx.h> 20 - #include <time.h> 21 - #include "gfx/gfx.h" 22 - #include "variables.h" 23 - #include "ops.h" 24 - 25 - // these are used for placing pips on cards 26 - const unsigned char segments[] = { 27 - 0x01, 0x24, 0x25, 0x48, 0x49, 0x4a, 0xa8, 0x90, 0x91, 0xb4 28 - }; 29 - const unsigned char pipCode[] = { 30 - 0x04, 07, 02, 15, 02, 07, 12, 15, 12, 31 - 0x02, 07, 07, 15, 07, 32 - 0x01, 11, 07, 33 - 0x84, 12, 29, 20, 29, 12, 39, 20, 39, 34 - 0x82, 12, 34, 20, 34, 35 - 0x81, 16, 34, 36 - 0x02, 07, 17, 15, 17, 37 - 0x01, 11, 17 38 - }; 39 - 40 - void drawMask(const unsigned char *data, unsigned char rows, unsigned int x, unsigned char y) 41 - { 42 - unsigned char yy = y; 43 - 44 - for (unsigned char row = 0; row < rows; row++) 45 - { 46 - unsigned char row_data = data[row]; 47 - 48 - for (unsigned int xx = x; xx < x + 8; xx++) 49 - { 50 - if (row_data & 0x80) 51 - { 52 - gfx_SetPixel(xx, yy); 53 - } 54 - 55 - row_data <<= 1; 56 - } 57 - 58 - yy++; 59 - } 60 - } 61 - 62 - void drawMaskInverted(const unsigned char *data, unsigned char rows, unsigned int x, unsigned char y) 63 - { 64 - unsigned char yy = y - rows; 65 - 66 - for (unsigned char row = 1; row <= rows; row++) 67 - { 68 - unsigned char row_data = data[rows - row]; 69 - 70 - for (unsigned int xx = x - 8; xx < x; xx++) 71 - { 72 - if (row_data & 0x01) 73 - { 74 - gfx_SetPixel(xx, yy); 75 - } 76 - 77 - row_data >>= 1; 78 - } 79 - 80 - yy++; 81 - } 82 - } 83 - 84 - unsigned int getCursorX() 85 - { 86 - if (cursorStack < NUM_FREECELLS) return FC_HPOS + cursorStack * (CARD_WIDTH + CARD_SPACING); 87 - else return TABL_HPOS + (cursorStack - NUM_FREECELLS) * (CARD_WIDTH + CARD_SPACING); 88 - } 89 - 90 - unsigned char getCursorY() 91 - { 92 - if (cursorStack < NUM_FREECELLS) return FC_VPOS; 93 - else return TABL_VPOS + cursorIndex * CARD_VOFFSET; 94 - } 95 - 96 - void drawCursor() 97 - { 98 - const unsigned int X = getCursorX(); 99 - const unsigned char Y = getCursorY(); 100 - 101 - gfx_SetColor(cursorMode == SELECT ? BLACK_COLOR : RED_COLOR); 102 - 103 - drawMask(selcorner_tile_0_data, 6, X - 2, Y - 2); 104 - drawMask(selcorner_tile_1_data, 6, X + CARD_WIDTH - 4, Y - 2); 105 - drawMaskInverted(selcorner_tile_1_data, 6, X + 4, Y + CARD_HEIGHT + 2); 106 - drawMaskInverted(selcorner_tile_0_data, 6, X + CARD_WIDTH + 2, Y + CARD_HEIGHT + 2); 107 - } 108 - 109 - #include <debug.h> 110 - 111 - void drawCardBlank(unsigned int x, unsigned char y) 112 - { 113 - gfx_SetColor(CARD_COLOR); 114 - gfx_HorizLine(x + 1, y, CARD_WIDTH - 2); 115 - gfx_HorizLine(x + 1, y + CARD_HEIGHT - 1, CARD_WIDTH - 2); 116 - gfx_FillRectangle(x, y + 1, CARD_WIDTH, CARD_HEIGHT - 2); 117 - 118 - gfx_SetColor(BLACK_COLOR); 119 - gfx_SetPixel(x, y + CARD_HEIGHT - 1); 120 - gfx_SetPixel(x + CARD_WIDTH - 1, y + CARD_HEIGHT - 1); 121 - gfx_HorizLine(x + 1, y + CARD_HEIGHT, CARD_WIDTH - 2); 122 - } 123 - 124 - void drawCard(card_t toDraw, unsigned int x, unsigned char y, bool useCutoff) 125 - { 126 - if (!(toDraw & CARD_EXISTS)) return; 127 - 128 - const unsigned char cardNumber = toDraw & CARD_NUMBER; 129 - const unsigned char cardSuit = (toDraw & CARD_SUIT) >> 4; 130 - 131 - drawCardBlank(x, y); 132 - 133 - if (cardNumber >= 10) 134 - { 135 - // this is a face card 136 - const unsigned char tileIndex = cardSuit * 3 + cardNumber - 10; 137 - const gfx_sprite_t *faceSprite = faces_tiles[tileIndex]; 138 - 139 - gfx_TempSprite(bottomSprite, CARD_FACE_WIDTH, CARD_FACE_HEIGHT); 140 - gfx_RotateSpriteHalf(faceSprite, bottomSprite); 141 - 142 - gfx_Sprite(faceSprite, x + CARD_FACE_HOFFSET, y + CARD_FACE_VOFFSET); 143 - gfx_Sprite(bottomSprite, x + CARD_FACE_HOFFSET, y + CARD_HEIGHT / 2); 144 - 145 - gfx_SetColor(BLACK_COLOR); 146 - gfx_VertLine(x + 3, y + 12, 26); 147 - gfx_VertLine(x + 23, y + 3, 26); 148 - gfx_HorizLine(x + 6, y + 3, 17); 149 - gfx_HorizLine(x + 4, y + 37, 17); 150 - 151 - if (toDraw & CARD_RED) gfx_SetColor(RED_COLOR); 152 - } 153 - else 154 - { 155 - // this is a number card (A-10) and should have pips 156 - dbg_printf("drawing pips for card with value %u at (%u, %u)...\n", cardNumber, x, y); 157 - gfx_SetColor((toDraw & CARD_RED) ? RED_COLOR : BLACK_COLOR); 158 - const unsigned char *pipMask = medium_suits_tiles_data[cardSuit]; 159 - dbg_printf("located pip mask at %p...\n", pipMask); 160 - const unsigned char *codePtr = pipCode; 161 - for (unsigned char pipMap = segments[cardNumber]; pipMap != 0x00; pipMap <<= 1) 162 - { 163 - dbg_printf("current pip map is %x...\n", pipMap); 164 - unsigned char counter = *codePtr & 0x0f; 165 - if (pipMap & 0x80) 166 - { 167 - dbg_printf("executing instruction at %p...\n", codePtr); 168 - const bool isNegative = *codePtr & 0x80; 169 - if (isNegative) dbg_printf("pip is inverted...\n"); 170 - codePtr++; 171 - 172 - while (counter-- > 0) 173 - { 174 - if (isNegative) drawMaskInverted(pipMask, 6, x + codePtr[0], y + codePtr[1]); 175 - else drawMask(pipMask, 6, x + codePtr[0], y + codePtr[1]); 176 - 177 - codePtr += 2; 178 - } 179 - } 180 - else 181 - { 182 - codePtr += counter * 2 + 1; 183 - } 184 - } 185 - } 186 - 187 - // no matter what, we need numerals and suit icons 188 - drawMask(numerals_tiles_data[cardNumber], 5, x + CARD_NUMERAL_HOFFSET, y + CARD_NUMERAL_VOFFSET); 189 - drawMask(small_suits_tiles_data[cardSuit], 4, x + CARD_FSUIT_HOFFSET, y + CARD_FSUIT_VOFFSET); 190 - 191 - if (!useCutoff) 192 - { 193 - drawMaskInverted(numerals_tiles_data[cardNumber], 5, x + CARD_WIDTH - CARD_NUMERAL_HOFFSET, y + CARD_HEIGHT - CARD_NUMERAL_VOFFSET); 194 - drawMaskInverted(small_suits_tiles_data[cardSuit], 4, x + CARD_WIDTH - CARD_FSUIT_HOFFSET, y + CARD_HEIGHT - CARD_FSUIT_VOFFSET); 195 - } 196 - } 197 - 198 - void drawCardBack(unsigned int x, unsigned char y) 199 - { 200 - drawCardBlank(x, y); 201 - 202 - gfx_SetColor(BLACK_COLOR); 203 - for (unsigned char i = 0; i < 3; i++) 204 - { 205 - drawMask(card_back_tiles_data[i], 20, x + 8 * i + 1, y + 1); 206 - drawMaskInverted(card_back_tiles_data[i], 20, x - 8 * i + 26, y + 40); 207 - } 208 - 209 - gfx_VertLine(x + 1, y + 21, 19); 210 - gfx_VertLine(x + 25, y + 1, 19); 211 - } 212 - 213 - void drawDeck() 214 - { 215 - if (deckCards == 0) return; 216 - unsigned char y = DECK_VPOS; 217 - for (unsigned char x = 0; x <= deckCards; x += DECK_CARDS_PER_HEIGHT) 218 - { 219 - drawCardBack(DECK_HPOS, y); 220 - y -= 2; 221 - } 222 - } 223 - 224 - void drawStack(unsigned char stackIndex) 225 - { 226 - for (unsigned char j = 0; j < TABL_STACK_SIZE; j++) 227 - { 228 - unsigned char cardX = TABL_HPOS + stackIndex * (CARD_WIDTH + CARD_SPACING); 229 - unsigned char cardY = TABL_VPOS + j * CARD_VOFFSET; 230 - 231 - drawCard(tableau[stackIndex][j], cardX, cardY, tableau[stackIndex][j + 1] & CARD_EXISTS); 232 - } 233 - } 234 - 235 - void drawBar() 236 - { 237 - gfx_SetColor(BORDER_COLOR); 238 - gfx_FillRectangle(0, 0, GFX_LCD_WIDTH, TOP_BORDER); 239 - 240 - gfx_SetTextFGColor(BLACK_COLOR); 241 - 242 - if (progress < PROGRESS_COMPLETE) 243 - { 244 - if (cursorMode == SELECT) gfx_PrintStringXY("SELECT", GFX_LCD_WIDTH / 2 - 3 * TEXT_CHAR_WIDTH, SELCARD_DISP_Y); 245 - else gfx_PrintStringXY("DROP", GFX_LCD_WIDTH / 2 - 2 * TEXT_CHAR_WIDTH, SELCARD_DISP_Y); 246 - } 247 - 248 - else gfx_PrintStringXY("COMPLETE", GFX_LCD_WIDTH / 2 - 4 * TEXT_CHAR_WIDTH, SELCARD_DISP_Y); 249 - 250 - gfx_SetTextXY(NUMWINS_DISP_X, SELCARD_DISP_Y); 251 - gfx_PrintUInt(*numWins, 3); 252 - } 253 - 254 - void drawFrame(bool drawSelected) 255 - { 256 - gfx_FillScreen(BKGND_COLOR); 257 - 258 - for (unsigned char i = 0; i < NUM_FREECELLS; i++) drawCard(freeCells[i], FC_HPOS + i * (CARD_WIDTH + CARD_SPACING), FC_VPOS, false); 259 - for (unsigned char i = 0; i < NUM_TABLSLOTS; i++) drawStack(i); 260 - if (drawSelected && (selectedCard & CARD_EXISTS) && cursorMode == DROP) drawCard(selectedCard, SELCARD_XPOS, SELCARD_YPOS, false); 261 - 262 - drawDeck(); 263 - drawBar(); 264 - drawCursor(); 265 - 266 - gfx_BlitBuffer(); 267 - } 268 - 269 - void animateMoveInternal(bool flipX, bool flipY, unsigned int x0, unsigned char y0, unsigned int x1, unsigned char y1, bool faceDown) 270 - { 271 - gfx_TempSprite(spriteBuffer, CARD_WIDTH, CARD_HEIGHT + 1); 272 - 273 - const unsigned int Dx = x1 - x0; 274 - const unsigned char Dy = y1 - y0; 275 - const clock_t duration = MOVE_ANIM_LENGTH * (Dy + Dx); 276 - 277 - const clock_t startTime = clock(); 278 - 279 - while (true) 280 - { 281 - const clock_t nowTime = clock(); 282 - const clock_t elapsed = nowTime - startTime; 283 - 284 - const bool lastIteration = nowTime - startTime > duration; 285 - 286 - const unsigned int dx = lastIteration ? Dx : Dx * elapsed / duration; 287 - const unsigned char dy = lastIteration ? Dy : Dy * elapsed / duration; 288 - 289 - const unsigned int cardX = flipX ? x1 - dx : x0 + dx; 290 - const unsigned char cardY = flipY ? y1 - dy : y0 + dy; 291 - 292 - gfx_GetSprite(spriteBuffer, cardX, cardY); 293 - if (faceDown) 294 - { 295 - drawCardBack(cardX, cardY); 296 - } 297 - else 298 - { 299 - drawCard(selectedCard, cardX, cardY, false); 300 - } 301 - gfx_BlitBuffer(); 302 - gfx_Sprite(spriteBuffer, cardX, cardY); 303 - 304 - if (lastIteration) break; 305 - } 306 - } 307 - 308 - void animateMove(unsigned int x0, unsigned char y0, unsigned int x1, unsigned char y1, bool faceDown) 309 - { 310 - const bool flipX = x0 > x1; 311 - const bool flipY = y0 > y1; 312 - 313 - if (flipX) 314 - { 315 - x0 ^= x1; 316 - x1 ^= x0; 317 - x0 ^= x1; 318 - } 319 - if (flipY) 320 - { 321 - y0 ^= y1; 322 - y1 ^= y0; 323 - y0 ^= y1; 324 - } 325 - 326 - drawFrame(false); 327 - animateMoveInternal(flipX, flipY, x0, y0, x1, y1, faceDown); 328 - } 329 - 330 - void animateDeal() 331 - { 332 - gfx_FillScreen(BKGND_COLOR); 333 - drawDeck(); 334 - drawBar(); 335 - gfx_BlitBuffer(); 336 - 337 - for (unsigned char i = NUM_FREECELLS - 1; i < NUM_FREECELLS; i--) 338 - { 339 - selectedCard = freeCells[i]; 340 - 341 - const unsigned int targetX = FC_HPOS + i * (CARD_WIDTH + CARD_SPACING); 342 - 343 - animateMoveInternal(false, false, DECK_HPOS, DECK_VPOS, targetX, FC_VPOS, false); 344 - drawCard(selectedCard, targetX, FC_VPOS, false); 345 - } 346 - 347 - selectedCard = CARD_EMPTY; 348 - drawFrame(false); 349 - } 1 + #include "drawing.h" 2 + #include "gfx/gfx.h" 3 + #include "card.h" 4 + #include <graphx.h> 5 + 6 + #define CARD_WIDTH 27 7 + #define CARD_HEIGHT 41 8 + #define CARD_NUMERAL_HOFFSET 1 9 + #define CARD_NUMERAL_VOFFSET 1 10 + #define CARD_FSUIT_HOFFSET 1 11 + #define CARD_FSUIT_VOFFSET 7 12 + #define CARD_FACE_HOFFSET 4 13 + #define CARD_FACE_VOFFSET 4 14 + #define CARD_FACE_WIDTH 19 15 + #define CARD_FACE_HEIGHT 17 16 + 17 + #define CARD_COLOR 0 18 + #define BLACK_COLOR 1 19 + #define RED_COLOR 2 20 + 21 + // these are used for placing pips on cards 22 + const uint8_t segments[] = { 23 + 0x01, 0x24, 0x25, 0x48, 0x49, 0x4a, 0xa8, 0x90, 0x91, 0xb4 24 + }; 25 + const uint8_t pip_code[] = { 26 + 0x04, 07, 02, 15, 02, 07, 12, 15, 12, 27 + 0x02, 07, 07, 15, 07, 28 + 0x01, 11, 07, 29 + 0x84, 12, 29, 20, 29, 12, 39, 20, 39, 30 + 0x82, 12, 34, 20, 34, 31 + 0x81, 16, 34, 32 + 0x02, 07, 17, 15, 17, 33 + 0x01, 11, 17 34 + }; 35 + 36 + void draw_mask(const uint8_t *data, uint8_t rows, uint24_t x, uint8_t y) 37 + { 38 + uint8_t yy = y; 39 + 40 + for (uint8_t row = 0; row < rows; row++) 41 + { 42 + uint8_t row_data = data[row]; 43 + 44 + for (uint24_t xx = x; xx < x + 8; xx++) 45 + { 46 + if (row_data & 0x80) 47 + { 48 + gfx_SetPixel(xx, yy); 49 + } 50 + 51 + row_data <<= 1; 52 + } 53 + 54 + yy++; 55 + } 56 + } 57 + 58 + void draw_mask_inverted(const uint8_t *data, uint8_t rows, uint24_t x, uint8_t y) 59 + { 60 + uint8_t yy = y - rows; 61 + 62 + for (uint8_t row = 1; row <= rows; row++) 63 + { 64 + uint8_t row_data = data[rows - row]; 65 + 66 + for (uint24_t xx = x - 8; xx < x; xx++) 67 + { 68 + if (row_data & 0x01) 69 + { 70 + gfx_SetPixel(xx, yy); 71 + } 72 + 73 + row_data >>= 1; 74 + } 75 + 76 + yy++; 77 + } 78 + } 79 + 80 + void draw_card_blank(uint24_t x, uint8_t y) 81 + { 82 + gfx_SetColor(CARD_COLOR); 83 + gfx_HorizLine(x + 1, y, CARD_WIDTH - 2); 84 + gfx_HorizLine(x + 1, y + CARD_HEIGHT - 1, CARD_WIDTH - 2); 85 + gfx_FillRectangle(x, y + 1, CARD_WIDTH, CARD_HEIGHT - 2); 86 + 87 + gfx_SetColor(BLACK_COLOR); 88 + gfx_SetPixel(x, y + CARD_HEIGHT - 1); 89 + gfx_SetPixel(x + CARD_WIDTH - 1, y + CARD_HEIGHT - 1); 90 + gfx_HorizLine(x + 1, y + CARD_HEIGHT, CARD_WIDTH - 2); 91 + } 92 + 93 + void draw_card(uint24_t x, uint8_t y, card_t card) 94 + { 95 + if (!EXISTS(card)) return; 96 + 97 + const uint8_t card_num = NUMBER(card); 98 + const uint24_t card_suit = SUIT(card); 99 + 100 + draw_card_blank(x, y); 101 + 102 + if (card_num >= 10) 103 + { 104 + // this is a face card 105 + const uint8_t tile_index = card_suit * 3 + card_num - 10; 106 + const gfx_sprite_t *face_sprite = faces_tiles[tile_index]; 107 + 108 + gfx_TempSprite(bottom_sprite, CARD_FACE_WIDTH, CARD_FACE_HEIGHT); 109 + gfx_RotateSpriteHalf(face_sprite, bottom_sprite); 110 + 111 + gfx_Sprite(face_sprite, x + CARD_FACE_HOFFSET, y + CARD_FACE_VOFFSET); 112 + gfx_Sprite(bottom_sprite, x + CARD_FACE_HOFFSET, y + CARD_HEIGHT / 2); 113 + 114 + gfx_SetColor(BLACK_COLOR); 115 + gfx_VertLine(x + 3, y + 12, 26); 116 + gfx_VertLine(x + 23, y + 3, 26); 117 + gfx_HorizLine(x + 6, y + 3, 17); 118 + gfx_HorizLine(x + 4, y + 37, 17); 119 + 120 + if (IS_RED(card)) gfx_SetColor(RED_COLOR); 121 + } 122 + else 123 + { 124 + // this is a number card (A-10) and should have pips 125 + gfx_SetColor(IS_RED(card) ? RED_COLOR : BLACK_COLOR); 126 + const uint8_t *pip_mask = medium_suits_tiles_data[card_suit]; 127 + const uint8_t *code_ptr = pip_code; 128 + for (uint8_t pip_map = segments[card_num]; pip_map != 0x00; pip_map <<= 1) 129 + { 130 + uint8_t counter = *code_ptr & 0x0f; 131 + if (pip_map & 0x80) 132 + { 133 + const uint8_t is_negative = *code_ptr & 0x80; 134 + code_ptr++; 135 + 136 + while (counter-- > 0) 137 + { 138 + if (is_negative) draw_mask_inverted(pip_mask, 6, x + code_ptr[0], y + code_ptr[1]); 139 + else draw_mask(pip_mask, 6, x + code_ptr[0], y + code_ptr[1]); 140 + 141 + code_ptr += 2; 142 + } 143 + } 144 + else 145 + { 146 + code_ptr += counter * 2 + 1; 147 + } 148 + } 149 + } 150 + 151 + draw_mask(numerals_tiles_data[card_num], 5, x + CARD_NUMERAL_HOFFSET, y + CARD_NUMERAL_VOFFSET); 152 + draw_mask(small_suits_tiles_data[card_suit], 4, x + CARD_FSUIT_HOFFSET, y + CARD_FSUIT_VOFFSET); 153 + draw_mask_inverted(numerals_tiles_data[card_num], 5, x + CARD_WIDTH - CARD_NUMERAL_HOFFSET, y + CARD_HEIGHT - CARD_NUMERAL_VOFFSET); 154 + draw_mask_inverted(small_suits_tiles_data[card_suit], 4, x + CARD_WIDTH - CARD_FSUIT_HOFFSET, y + CARD_HEIGHT - CARD_FSUIT_VOFFSET); 155 + } 156 + 157 + void draw_stack(stack_t *stack) 158 + { 159 + uint24_t x = stack->x; 160 + uint8_t y = stack->y; 161 + 162 + for (uint8_t i = 0; i < stack->max_cards; i++) 163 + { 164 + if (!EXISTS(stack->cards[i])) return; 165 + 166 + draw_card(x, y, stack->cards[i]); 167 + 168 + x += stack->dx; 169 + y += stack->dy; 170 + } 171 + } 172 + 173 + void draw_stacks() 174 + { 175 + for (uint8_t i = 0; i < num_stacks; i++) 176 + { 177 + draw_stack(&stacks[i]); 178 + } 179 + }
+10 -86
src/drawing.h
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #ifndef drawing_include_file 18 - #define drawing_include_file 19 - 20 - #include <graphx.h> 21 - #include <gfx/gfx.h> 22 - #include "variables.h" 23 - 24 - #define CARD_HEIGHT 41 25 - #define CARD_WIDTH 27 26 - #define CARD_SPACING 5 27 - #define CARD_VOFFSET 7 28 - 29 - #define CARD_NUMERAL_HOFFSET 1 30 - #define CARD_NUMERAL_VOFFSET 1 31 - #define CARD_FACE_HOFFSET 4 32 - #define CARD_FACE_VOFFSET 4 33 - #define CARD_FACE_WIDTH 19 34 - #define CARD_FACE_HEIGHT 17 35 - #define CARD_FSUIT_HOFFSET 1 36 - #define CARD_FSUIT_VOFFSET 7 37 - #define LOCK_ICON_VOFFSET 17 38 - #define LOCK_ICON_HOFFSET 9 39 - #define FC_VPOS 50 40 - #define TABL_VPOS 100 41 - #define FC_HPOS 98 42 - #define TABL_HPOS 98 43 - 44 - #define TEXT_CHAR_WIDTH 8 45 - #define SELCARD_DISP_X 5 46 - #define SELCARD_DISP_Y 9 47 - #define NUMWINS_DISP_X (GFX_LCD_WIDTH - 5 - 3 * TEXT_CHAR_WIDTH) 48 - 49 - #define BKGND_COLOR 3 50 - #define BORDER_COLOR 0 51 - #define CARD_COLOR 0 52 - #define BLACK_COLOR 1 53 - #define RED_COLOR 2 54 - 55 - #define TOP_BORDER 25 56 - 57 - #define DECK_VPOS FC_VPOS 58 - #define DECK_HPOS (FC_HPOS - CARD_WIDTH - CARD_SPACING) 59 - #define DECK_CARDS_PER_HEIGHT 9 60 - 61 - #define SELCARD_XPOS 147 62 - #define SELCARD_YPOS 210 63 - 64 - #define MOVE_ANIM_LENGTH 40 65 - 66 - extern gfx_sprite_t* cardSprite[11]; 67 - 68 - unsigned int getCursorX(); 69 - unsigned char getCursorY(); 70 - void drawCursor(); 71 - void drawCard(card_t toDraw, unsigned int x, unsigned char y, bool useCutoff); 72 - void drawStack(unsigned char stackIndex); 73 - void drawBar(); 74 - void drawFrame(bool drawSelected); 75 - void animateMove(unsigned int x0, unsigned char y0, unsigned int x1, unsigned char y1, bool faceDown); 76 - void animateDeal(); 77 - 78 - #define getOrgX() (TABL_HPOS + (orgStack - NUM_FREECELLS) * (CARD_WIDTH + CARD_SPACING)) 79 - #define getOrgY() (TABL_VPOS + orgIndex * CARD_VOFFSET) 80 - 81 - #define animateGrab() animateMove(getCursorX(), getCursorY(), SELCARD_XPOS, SELCARD_YPOS, false) 82 - #define animateDrop() animateMove(SELCARD_XPOS, SELCARD_YPOS, getCursorX(), getCursorY(), false) 83 - #define animateDraw() animateMove(DECK_HPOS, DECK_VPOS, SELCARD_XPOS, SELCARD_YPOS, true) 84 - #define animateClear() animateMove(SELCARD_XPOS, SELCARD_YPOS, getOrgX(), getOrgY(), false) 85 - 86 - #endif 1 + #ifndef DRAWING_H 2 + #define DRAWING_H 3 + 4 + #include "card.h" 5 + 6 + void draw_card(uint24_t x, uint8_t y, card_t card); 7 + void draw_stack(stack_t *stack); 8 + void draw_stacks(); 9 + 10 + #endif
+4
src/game.c
··· 1 + #include "game.h" 2 + 3 + uint8_t cursor_stack; 4 + uint8_t cursor_index;
+9
src/game.h
··· 1 + #ifndef GAME_H 2 + #define GAME_H 3 + 4 + #include <stdint.h> 5 + 6 + extern uint8_t cursor_stack; 7 + extern uint8_t cursor_index; 8 + 9 + #endif
+18
src/gfx/card_back.c
··· 1 + unsigned char card_back_tile_0_data[20] = 2 + { 3 + 0xff,0xff,0xcd,0xc7,0xef,0xf8,0xdb,0xfb,0xdb,0xfb,0xfa,0xca,0xfb,0xda,0xfe,0xcd,0xfd,0xe8,0xca,0x99 4 + }; 5 + unsigned char card_back_tile_1_data[20] = 6 + { 7 + 0xff,0xf7,0x63,0x49,0xff,0x00,0xff,0xc9,0x77,0x5d,0x22,0x3e,0xeb,0x2a,0x36,0x14,0x08,0xc9,0x3e,0xdd 8 + }; 9 + unsigned char card_back_tile_2_data[20] = 10 + { 11 + 0xff,0xff,0x59,0x71,0xfb,0x0f,0xed,0xef,0x6d,0x6f,0x2f,0x29,0xef,0x2d,0x3f,0x59,0x5f,0x8b,0x29,0xcc 12 + }; 13 + unsigned char *card_back_tiles_data[3] = 14 + { 15 + card_back_tile_0_data, 16 + card_back_tile_1_data, 17 + card_back_tile_2_data, 18 + };
+18
src/gfx/card_back.h
··· 1 + #ifndef card_back_include_file 2 + #define card_back_include_file 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + extern unsigned char card_back_tile_0_data[20]; 9 + extern unsigned char card_back_tile_1_data[20]; 10 + extern unsigned char card_back_tile_2_data[20]; 11 + #define card_back_num_tiles 3 12 + extern unsigned char *card_back_tiles_data[3]; 13 + 14 + #ifdef __cplusplus 15 + } 16 + #endif 17 + 18 + #endif
+183
src/gfx/faces.c
··· 1 + unsigned char faces_tile_0_data[325] = 2 + { 3 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, 4 + 0x08,0x08,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x08, 5 + 0x08,0x08,0x09,0x09,0x09,0x06,0x08,0x08,0x00,0x00,0x0a,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x09,0x09,0x09,0x06,0x06,0x06,0x00,0x00,0x0a,0x07,0x07, 6 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x04,0x09,0x04,0x09,0x06,0x06,0x00,0x07,0x0a,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06, 7 + 0x06,0x07,0x07,0x0a,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x06,0x07,0x0a,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x06,0x06, 8 + 0x00,0x09,0x09,0x09,0x00,0x00,0x06,0x06,0x00,0x06,0x07,0x07,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x08,0x08,0x06,0x00,0x07,0x00, 9 + 0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x00,0x00,0x00,0x05,0x05,0x05,0x08,0x08,0x06,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x00,0x0a,0x05,0x05,0x05, 10 + 0x08,0x08,0x06,0x08,0x00,0x00,0x00,0x08,0x0a,0x08,0x08,0x05,0x05,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x08,0x06,0x08,0x00,0x00,0x00,0x08,0x08,0x0a,0x08,0x05,0x05, 11 + 0x05,0x00,0x0a,0x05,0x05,0x05,0x05,0x08,0x06,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x08,0x06,0x08,0x00,0x00,0x07, 12 + 0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x05,0x07,0x05,0x07,0x06,0x07,0x00,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x00,0x07,0x00,0x07,0x05,0x07, 13 + 0x08,0x07,0x08,0x07,0x00 14 + }; 15 + unsigned char faces_tile_1_data[325] = 16 + { 17 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,0x0a,0x0a, 18 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,0x06,0x06,0x06,0x06,0x00,0x07,0x05,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 19 + 0x00,0x06,0x06,0x09,0x09,0x06,0x06,0x07,0x05,0x07,0x05,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x07,0x05,0x07,0x05,0x07,0x07,0x00, 20 + 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x05,0x07,0x05,0x07,0x05,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x04,0x09,0x04,0x07, 21 + 0x05,0x07,0x05,0x05,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x07,0x07,0x07,0x07,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 22 + 0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x00,0x09,0x06,0x00,0x00,0x00,0x00,0x08,0x06,0x06,0x06,0x06,0x09,0x09,0x09,0x06,0x06,0x06,0x08,0x00,0x09,0x06,0x00, 23 + 0x00,0x00,0x08,0x08,0x06,0x06,0x06,0x06,0x0a,0x0a,0x06,0x06,0x06,0x06,0x08,0x08,0x09,0x09,0x06,0x00,0x08,0x08,0x00,0x00,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x06, 24 + 0x00,0x00,0x09,0x09,0x09,0x00,0x00,0x08,0x08,0x08,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x00,0x00,0x05,0x08,0x09,0x09,0x09,0x00,0x00,0x08,0x08,0x05,0x08,0x05,0x08, 25 + 0x08,0x05,0x05,0x08,0x08,0x05,0x08,0x05,0x09,0x09,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x08,0x08,0x05,0x08,0x08,0x08,0x08,0x09,0x09,0x08,0x00,0x07, 26 + 0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x09,0x07,0x08,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07, 27 + 0x08,0x07,0x08,0x07,0x00 28 + }; 29 + unsigned char faces_tile_2_data[325] = 30 + { 31 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08, 32 + 0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x08,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x08,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 33 + 0x0a,0x0a,0x06,0x06,0x09,0x09,0x09,0x0a,0x0a,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x06,0x00,0x0a,0x05,0x0a,0x00, 34 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x04,0x09,0x04,0x06,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09, 35 + 0x06,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06, 36 + 0x06,0x06,0x06,0x06,0x09,0x06,0x00,0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, 37 + 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x00,0x00,0x05,0x00,0x00,0x0a,0x00,0x05, 38 + 0x05,0x00,0x0a,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x05,0x05,0x05,0x05,0x0a,0x05,0x05,0x05,0x08,0x0a,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x05, 39 + 0x05,0x05,0x05,0x08,0x05,0x05,0x05,0x08,0x0a,0x08,0x08,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x0a,0x05,0x05,0x05,0x08,0x0a,0x08,0x08,0x00,0x07, 40 + 0x08,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x08,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07, 41 + 0x08,0x07,0x08,0x07,0x00 42 + }; 43 + unsigned char faces_tile_3_data[325] = 44 + { 45 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, 46 + 0x08,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x08, 47 + 0x08,0x08,0x09,0x09,0x06,0x06,0x08,0x08,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x07,0x07,0x07,0x00, 48 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x04,0x09,0x04,0x09,0x06,0x06,0x00,0x0a,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06, 49 + 0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08, 50 + 0x00,0x09,0x09,0x09,0x09,0x00,0x08,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x09,0x09,0x00,0x05,0x05,0x06,0x08,0x00,0x00,0x00,0x00, 51 + 0x00,0x00,0x0a,0x08,0x08,0x08,0x05,0x00,0x00,0x00,0x00,0x05,0x05,0x06,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x08,0x05,0x05,0x00,0x0a,0x05,0x05,0x06, 52 + 0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x05,0x00,0x05,0x05,0x06,0x05,0x08,0x08,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05, 53 + 0x05,0x05,0x0a,0x05,0x05,0x06,0x05,0x08,0x08,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x05,0x00,0x05,0x06,0x05,0x05,0x08,0x08,0x08,0x00,0x00,0x07, 54 + 0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x06,0x07,0x05,0x07,0x08,0x07,0x00,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07, 55 + 0x08,0x07,0x08,0x07,0x00 56 + }; 57 + unsigned char faces_tile_4_data[325] = 58 + { 59 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x0a,0x06,0x0a, 60 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 61 + 0x00,0x06,0x06,0x09,0x09,0x06,0x06,0x0a,0x00,0x05,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x05,0x05,0x05,0x00, 62 + 0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x04,0x09,0x04,0x06, 63 + 0x06,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x06,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 64 + 0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x00,0x09,0x06,0x00,0x00,0x00,0x00,0x09,0x09,0x00,0x09,0x0a,0x09,0x09,0x0a,0x09,0x00,0x09,0x09,0x00,0x09,0x09,0x06, 65 + 0x00,0x00,0x09,0x09,0x00,0x00,0x09,0x09,0x0a,0x0a,0x09,0x09,0x00,0x00,0x09,0x09,0x09,0x09,0x06,0x00,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 66 + 0x00,0x00,0x09,0x09,0x09,0x06,0x00,0x08,0x08,0x08,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x00,0x00,0x05,0x08,0x09,0x09,0x09,0x00,0x00,0x08,0x08,0x05,0x08,0x05,0x08, 67 + 0x08,0x05,0x05,0x08,0x08,0x05,0x08,0x05,0x09,0x09,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x08,0x08,0x05,0x08,0x08,0x08,0x08,0x09,0x09,0x08,0x00,0x07, 68 + 0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x09,0x07,0x08,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07, 69 + 0x08,0x07,0x08,0x07,0x00 70 + }; 71 + unsigned char faces_tile_5_data[325] = 72 + { 73 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08, 74 + 0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x08,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x08,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 75 + 0x0a,0x0a,0x06,0x06,0x09,0x09,0x09,0x0a,0x0a,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x06,0x00,0x0a,0x05,0x0a,0x00, 76 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x04,0x09,0x04,0x06,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09, 77 + 0x06,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06, 78 + 0x06,0x06,0x09,0x09,0x09,0x09,0x00,0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, 79 + 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x05,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x00,0x00,0x05,0x00,0x00,0x0a,0x00,0x05, 80 + 0x05,0x00,0x0a,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x05,0x05,0x05,0x05,0x0a,0x05,0x05,0x05,0x08,0x0a,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x05, 81 + 0x05,0x05,0x05,0x08,0x05,0x05,0x05,0x08,0x0a,0x08,0x08,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x0a,0x05,0x05,0x05,0x08,0x0a,0x08,0x08,0x00,0x07, 82 + 0x08,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x08,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07, 83 + 0x08,0x07,0x08,0x07,0x00 84 + }; 85 + unsigned char faces_tile_6_data[325] = 86 + { 87 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, 88 + 0x08,0x08,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x08, 89 + 0x08,0x08,0x09,0x09,0x09,0x06,0x08,0x08,0x00,0x00,0x0a,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x09,0x09,0x09,0x06,0x06,0x06,0x00,0x00,0x0a,0x07,0x07, 90 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x04,0x09,0x04,0x09,0x06,0x06,0x00,0x07,0x0a,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06, 91 + 0x06,0x07,0x07,0x0a,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x06,0x07,0x0a,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x06,0x06, 92 + 0x00,0x09,0x09,0x09,0x00,0x00,0x06,0x06,0x00,0x06,0x07,0x07,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x08,0x08,0x06,0x00,0x07,0x00, 93 + 0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x00,0x00,0x00,0x05,0x05,0x05,0x08,0x08,0x06,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x00,0x0a,0x05,0x05,0x05, 94 + 0x08,0x08,0x06,0x08,0x00,0x00,0x00,0x08,0x0a,0x08,0x08,0x05,0x05,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x08,0x06,0x08,0x00,0x00,0x00,0x08,0x08,0x0a,0x08,0x05,0x05, 95 + 0x05,0x00,0x0a,0x05,0x05,0x05,0x05,0x08,0x06,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x08,0x06,0x08,0x00,0x00,0x07, 96 + 0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x05,0x07,0x05,0x07,0x06,0x07,0x00,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x00,0x07,0x00,0x07,0x05,0x07, 97 + 0x08,0x07,0x08,0x07,0x00 98 + }; 99 + unsigned char faces_tile_7_data[325] = 100 + { 101 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,0x0a,0x0a, 102 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 103 + 0x00,0x06,0x06,0x09,0x09,0x06,0x06,0x0a,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x08,0x08,0x08,0x00, 104 + 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x04,0x09,0x04,0x06, 105 + 0x06,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 106 + 0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x00,0x09,0x06,0x00,0x00,0x00,0x00,0x08,0x06,0x06,0x06,0x06,0x09,0x09,0x09,0x06,0x06,0x06,0x08,0x00,0x09,0x09,0x06, 107 + 0x00,0x00,0x08,0x08,0x06,0x06,0x06,0x06,0x0a,0x0a,0x06,0x06,0x06,0x06,0x08,0x08,0x09,0x09,0x06,0x00,0x08,0x08,0x00,0x00,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x06, 108 + 0x00,0x00,0x09,0x09,0x09,0x06,0x00,0x08,0x08,0x08,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x00,0x00,0x05,0x08,0x09,0x09,0x09,0x00,0x00,0x08,0x08,0x05,0x08,0x05,0x08, 109 + 0x08,0x05,0x05,0x08,0x08,0x05,0x08,0x05,0x09,0x09,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x08,0x08,0x05,0x08,0x08,0x08,0x08,0x09,0x09,0x08,0x00,0x07, 110 + 0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x09,0x07,0x08,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07, 111 + 0x08,0x07,0x08,0x07,0x00 112 + }; 113 + unsigned char faces_tile_8_data[325] = 114 + { 115 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08, 116 + 0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x08,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x08,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 117 + 0x0a,0x0a,0x06,0x06,0x09,0x09,0x09,0x0a,0x0a,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x06,0x00,0x0a,0x08,0x0a,0x00, 118 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x04,0x09,0x04,0x06,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09, 119 + 0x06,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06, 120 + 0x06,0x06,0x06,0x06,0x09,0x06,0x00,0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, 121 + 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x00,0x00,0x05,0x00,0x00,0x0a,0x00,0x05, 122 + 0x05,0x00,0x0a,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x05,0x05,0x05,0x05,0x0a,0x05,0x05,0x05,0x08,0x0a,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x05, 123 + 0x05,0x05,0x05,0x08,0x05,0x05,0x05,0x08,0x0a,0x08,0x08,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x0a,0x05,0x05,0x05,0x08,0x0a,0x08,0x08,0x00,0x07, 124 + 0x08,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x08,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07, 125 + 0x08,0x07,0x08,0x07,0x00 126 + }; 127 + unsigned char faces_tile_9_data[325] = 128 + { 129 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, 130 + 0x08,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x08, 131 + 0x08,0x08,0x09,0x09,0x06,0x06,0x08,0x08,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x07,0x07,0x07,0x00, 132 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x04,0x09,0x04,0x09,0x06,0x06,0x00,0x0a,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06, 133 + 0x06,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08, 134 + 0x00,0x09,0x09,0x09,0x09,0x00,0x08,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x09,0x09,0x00,0x05,0x05,0x06,0x08,0x00,0x00,0x00,0x00, 135 + 0x00,0x00,0x0a,0x08,0x08,0x08,0x05,0x00,0x00,0x00,0x00,0x05,0x05,0x06,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x08,0x05,0x05,0x00,0x0a,0x05,0x05,0x06, 136 + 0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x05,0x00,0x05,0x05,0x06,0x05,0x08,0x08,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05, 137 + 0x05,0x05,0x0a,0x05,0x05,0x06,0x05,0x08,0x08,0x08,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x05,0x05,0x05,0x05,0x00,0x05,0x06,0x05,0x05,0x08,0x08,0x08,0x00,0x00,0x07, 138 + 0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x06,0x07,0x05,0x07,0x08,0x07,0x00,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07, 139 + 0x08,0x07,0x08,0x07,0x00 140 + }; 141 + unsigned char faces_tile_10_data[325] = 142 + { 143 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,0x0a,0x0a, 144 + 0x00,0x00,0x00,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 145 + 0x00,0x06,0x06,0x09,0x09,0x06,0x06,0x0a,0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x06,0x00,0x00, 146 + 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x04,0x09,0x04,0x06, 147 + 0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x00,0x09,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 148 + 0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x00,0x09,0x09,0x06,0x00,0x00,0x00,0x09,0x09,0x09,0x09,0x0a,0x09,0x09,0x0a,0x09,0x09,0x09,0x09,0x00,0x09,0x09,0x06, 149 + 0x00,0x00,0x09,0x09,0x00,0x00,0x09,0x09,0x0a,0x0a,0x09,0x09,0x00,0x00,0x09,0x09,0x09,0x09,0x06,0x00,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 150 + 0x00,0x00,0x09,0x09,0x09,0x00,0x00,0x08,0x08,0x08,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x00,0x00,0x05,0x08,0x09,0x09,0x00,0x00,0x00,0x08,0x08,0x05,0x08,0x05,0x08, 151 + 0x08,0x05,0x05,0x08,0x08,0x05,0x08,0x05,0x09,0x09,0x08,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x08,0x08,0x05,0x08,0x08,0x08,0x08,0x09,0x09,0x08,0x00,0x07, 152 + 0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x09,0x07,0x08,0x07,0x00,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07,0x08,0x07, 153 + 0x08,0x07,0x08,0x07,0x00 154 + }; 155 + unsigned char faces_tile_11_data[325] = 156 + { 157 + 0x13,0x11,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0a,0x08,0x0a,0x08,0x0a,0x08, 158 + 0x0a,0x08,0x0a,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x08,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x08,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 159 + 0x0a,0x0a,0x06,0x06,0x09,0x09,0x09,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x06,0x00,0x00,0x00,0x00,0x00, 160 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x09,0x04,0x09,0x04,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09, 161 + 0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x09,0x09,0x09,0x09,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x06,0x06, 162 + 0x06,0x06,0x09,0x09,0x09,0x09,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x06,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, 163 + 0x00,0x00,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x05,0x0a,0x08,0x0a,0x00,0x00,0x00,0x00,0x07,0x07,0x00,0x00,0x00,0x05,0x00,0x00,0x0a,0x00,0x05, 164 + 0x05,0x00,0x0a,0x00,0x00,0x00,0x00,0x08,0x07,0x07,0x08,0x00,0x05,0x05,0x05,0x05,0x0a,0x05,0x05,0x05,0x0a,0x0a,0x0a,0x00,0x00,0x00,0x0a,0x0a,0x0a,0x0a,0x08,0x05, 165 + 0x05,0x05,0x05,0x08,0x05,0x05,0x0a,0x0a,0x0a,0x0a,0x0a,0x00,0x00,0x08,0x0a,0x0a,0x08,0x08,0x08,0x05,0x05,0x05,0x0a,0x05,0x05,0x0a,0x0a,0x0a,0x0a,0x0a,0x00,0x07, 166 + 0x08,0x07,0x0a,0x07,0x08,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x0a,0x07,0x0a,0x07,0x0a,0x07,0x00,0x07,0x0a,0x07,0x0a,0x07,0x05,0x07,0x05,0x07,0x05,0x07,0x05,0x07, 167 + 0x0a,0x07,0x0a,0x07,0x00 168 + }; 169 + unsigned char *faces_tiles_data[12] = 170 + { 171 + faces_tile_0_data, 172 + faces_tile_1_data, 173 + faces_tile_2_data, 174 + faces_tile_3_data, 175 + faces_tile_4_data, 176 + faces_tile_5_data, 177 + faces_tile_6_data, 178 + faces_tile_7_data, 179 + faces_tile_8_data, 180 + faces_tile_9_data, 181 + faces_tile_10_data, 182 + faces_tile_11_data, 183 + };
+40
src/gfx/faces.h
··· 1 + #ifndef faces_include_file 2 + #define faces_include_file 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + #define faces_tile_0 ((gfx_sprite_t*)faces_tile_0_data) 9 + extern unsigned char faces_tile_0_data[325]; 10 + #define faces_tile_1 ((gfx_sprite_t*)faces_tile_1_data) 11 + extern unsigned char faces_tile_1_data[325]; 12 + #define faces_tile_2 ((gfx_sprite_t*)faces_tile_2_data) 13 + extern unsigned char faces_tile_2_data[325]; 14 + #define faces_tile_3 ((gfx_sprite_t*)faces_tile_3_data) 15 + extern unsigned char faces_tile_3_data[325]; 16 + #define faces_tile_4 ((gfx_sprite_t*)faces_tile_4_data) 17 + extern unsigned char faces_tile_4_data[325]; 18 + #define faces_tile_5 ((gfx_sprite_t*)faces_tile_5_data) 19 + extern unsigned char faces_tile_5_data[325]; 20 + #define faces_tile_6 ((gfx_sprite_t*)faces_tile_6_data) 21 + extern unsigned char faces_tile_6_data[325]; 22 + #define faces_tile_7 ((gfx_sprite_t*)faces_tile_7_data) 23 + extern unsigned char faces_tile_7_data[325]; 24 + #define faces_tile_8 ((gfx_sprite_t*)faces_tile_8_data) 25 + extern unsigned char faces_tile_8_data[325]; 26 + #define faces_tile_9 ((gfx_sprite_t*)faces_tile_9_data) 27 + extern unsigned char faces_tile_9_data[325]; 28 + #define faces_tile_10 ((gfx_sprite_t*)faces_tile_10_data) 29 + extern unsigned char faces_tile_10_data[325]; 30 + #define faces_tile_11 ((gfx_sprite_t*)faces_tile_11_data) 31 + extern unsigned char faces_tile_11_data[325]; 32 + #define faces_num_tiles 12 33 + #define faces_tiles ((gfx_sprite_t**)faces_tiles_data) 34 + extern unsigned char *faces_tiles_data[12]; 35 + 36 + #ifdef __cplusplus 37 + } 38 + #endif 39 + 40 + #endif
+14
src/gfx/global_palette.c
··· 1 + unsigned char global_palette[22] = 2 + { 3 + 0xff, 0xff, /* 0: rgb(255, 255, 255) */ 4 + 0x00, 0x00, /* 1: rgb( 0, 0, 0) */ 5 + 0x00, 0x7c, /* 2: rgb(255, 0, 0) */ 6 + 0xa5, 0x85, /* 3: rgb( 8, 109, 41) */ 7 + 0x00, 0x00, /* 4: rgb( 0, 0, 0) */ 8 + 0xb9, 0x95, /* 5: rgb( 41, 109, 206) */ 9 + 0xc2, 0x20, /* 6: rgb( 66, 49, 16) */ 10 + 0xd7, 0xda, /* 7: rgb(181, 182, 189) */ 11 + 0xa5, 0xe8, /* 8: rgb(214, 45, 41) */ 12 + 0xb2, 0x6a, /* 9: rgb(214, 170, 148) */ 13 + 0x6a, 0xf7, /* 10: rgb(239, 223, 82) */ 14 + };
+15
src/gfx/global_palette.h
··· 1 + #ifndef global_palette_include_file 2 + #define global_palette_include_file 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + #define sizeof_global_palette 22 9 + extern unsigned char global_palette[22]; 10 + 11 + #ifdef __cplusplus 12 + } 13 + #endif 14 + 15 + #endif
+23
src/gfx/medium_suits.c
··· 1 + unsigned char medium_suits_tile_0_data[6] = 2 + { 3 + 0x20,0x70,0xf8,0xf8,0x20,0x70 4 + }; 5 + unsigned char medium_suits_tile_1_data[6] = 6 + { 7 + 0x20,0x70,0xa8,0xf8,0xa8,0x20 8 + }; 9 + unsigned char medium_suits_tile_2_data[6] = 10 + { 11 + 0x00,0xd8,0xf8,0xf8,0x70,0x20 12 + }; 13 + unsigned char medium_suits_tile_3_data[6] = 14 + { 15 + 0x20,0x70,0xf8,0xf8,0x70,0x20 16 + }; 17 + unsigned char *medium_suits_tiles_data[4] = 18 + { 19 + medium_suits_tile_0_data, 20 + medium_suits_tile_1_data, 21 + medium_suits_tile_2_data, 22 + medium_suits_tile_3_data, 23 + };
+19
src/gfx/medium_suits.h
··· 1 + #ifndef medium_suits_include_file 2 + #define medium_suits_include_file 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + extern unsigned char medium_suits_tile_0_data[6]; 9 + extern unsigned char medium_suits_tile_1_data[6]; 10 + extern unsigned char medium_suits_tile_2_data[6]; 11 + extern unsigned char medium_suits_tile_3_data[6]; 12 + #define medium_suits_num_tiles 4 13 + extern unsigned char *medium_suits_tiles_data[4]; 14 + 15 + #ifdef __cplusplus 16 + } 17 + #endif 18 + 19 + #endif
+68
src/gfx/numerals.c
··· 1 + unsigned char numerals_tile_0_data[5] = 2 + { 3 + 0x70,0x50,0x70,0x50,0x50 4 + }; 5 + unsigned char numerals_tile_1_data[5] = 6 + { 7 + 0x70,0x10,0x70,0x40,0x70 8 + }; 9 + unsigned char numerals_tile_2_data[5] = 10 + { 11 + 0x70,0x10,0x30,0x10,0x70 12 + }; 13 + unsigned char numerals_tile_3_data[5] = 14 + { 15 + 0x50,0x50,0x70,0x10,0x10 16 + }; 17 + unsigned char numerals_tile_4_data[5] = 18 + { 19 + 0x70,0x40,0x70,0x10,0x70 20 + }; 21 + unsigned char numerals_tile_5_data[5] = 22 + { 23 + 0x70,0x40,0x70,0x50,0x70 24 + }; 25 + unsigned char numerals_tile_6_data[5] = 26 + { 27 + 0x70,0x10,0x10,0x10,0x10 28 + }; 29 + unsigned char numerals_tile_7_data[5] = 30 + { 31 + 0x70,0x50,0x70,0x50,0x70 32 + }; 33 + unsigned char numerals_tile_8_data[5] = 34 + { 35 + 0x70,0x50,0x70,0x10,0x10 36 + }; 37 + unsigned char numerals_tile_9_data[5] = 38 + { 39 + 0xb8,0xa8,0xa8,0xa8,0xb8 40 + }; 41 + unsigned char numerals_tile_10_data[5] = 42 + { 43 + 0x70,0x20,0x20,0x20,0x60 44 + }; 45 + unsigned char numerals_tile_11_data[5] = 46 + { 47 + 0x70,0x50,0x50,0x50,0x68 48 + }; 49 + unsigned char numerals_tile_12_data[5] = 50 + { 51 + 0x50,0x50,0x60,0x50,0x50 52 + }; 53 + unsigned char *numerals_tiles_data[13] = 54 + { 55 + numerals_tile_0_data, 56 + numerals_tile_1_data, 57 + numerals_tile_2_data, 58 + numerals_tile_3_data, 59 + numerals_tile_4_data, 60 + numerals_tile_5_data, 61 + numerals_tile_6_data, 62 + numerals_tile_7_data, 63 + numerals_tile_8_data, 64 + numerals_tile_9_data, 65 + numerals_tile_10_data, 66 + numerals_tile_11_data, 67 + numerals_tile_12_data, 68 + };
+28
src/gfx/numerals.h
··· 1 + #ifndef numerals_include_file 2 + #define numerals_include_file 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + extern unsigned char numerals_tile_0_data[5]; 9 + extern unsigned char numerals_tile_1_data[5]; 10 + extern unsigned char numerals_tile_2_data[5]; 11 + extern unsigned char numerals_tile_3_data[5]; 12 + extern unsigned char numerals_tile_4_data[5]; 13 + extern unsigned char numerals_tile_5_data[5]; 14 + extern unsigned char numerals_tile_6_data[5]; 15 + extern unsigned char numerals_tile_7_data[5]; 16 + extern unsigned char numerals_tile_8_data[5]; 17 + extern unsigned char numerals_tile_9_data[5]; 18 + extern unsigned char numerals_tile_10_data[5]; 19 + extern unsigned char numerals_tile_11_data[5]; 20 + extern unsigned char numerals_tile_12_data[5]; 21 + #define numerals_num_tiles 13 22 + extern unsigned char *numerals_tiles_data[13]; 23 + 24 + #ifdef __cplusplus 25 + } 26 + #endif 27 + 28 + #endif
+13
src/gfx/selcorner.c
··· 1 + unsigned char selcorner_tile_0_data[6] = 2 + { 3 + 0xfc,0xfc,0xe0,0xc0,0xc0,0xc0 4 + }; 5 + unsigned char selcorner_tile_1_data[6] = 6 + { 7 + 0xfc,0xfc,0x1c,0x0c,0x0c,0x0c 8 + }; 9 + unsigned char *selcorner_tiles_data[2] = 10 + { 11 + selcorner_tile_0_data, 12 + selcorner_tile_1_data, 13 + };
+17
src/gfx/selcorner.h
··· 1 + #ifndef selcorner_include_file 2 + #define selcorner_include_file 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + extern unsigned char selcorner_tile_0_data[6]; 9 + extern unsigned char selcorner_tile_1_data[6]; 10 + #define selcorner_num_tiles 2 11 + extern unsigned char *selcorner_tiles_data[2]; 12 + 13 + #ifdef __cplusplus 14 + } 15 + #endif 16 + 17 + #endif
+23
src/gfx/small_suits.c
··· 1 + unsigned char small_suits_tile_0_data[4] = 2 + { 3 + 0x20,0x70,0x70,0x50 4 + }; 5 + unsigned char small_suits_tile_1_data[4] = 6 + { 7 + 0x20,0x70,0x20,0x70 8 + }; 9 + unsigned char small_suits_tile_2_data[4] = 10 + { 11 + 0x50,0x70,0x70,0x20 12 + }; 13 + unsigned char small_suits_tile_3_data[4] = 14 + { 15 + 0x20,0x70,0x70,0x20 16 + }; 17 + unsigned char *small_suits_tiles_data[4] = 18 + { 19 + small_suits_tile_0_data, 20 + small_suits_tile_1_data, 21 + small_suits_tile_2_data, 22 + small_suits_tile_3_data, 23 + };
+19
src/gfx/small_suits.h
··· 1 + #ifndef small_suits_include_file 2 + #define small_suits_include_file 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + extern unsigned char small_suits_tile_0_data[4]; 9 + extern unsigned char small_suits_tile_1_data[4]; 10 + extern unsigned char small_suits_tile_2_data[4]; 11 + extern unsigned char small_suits_tile_3_data[4]; 12 + #define small_suits_num_tiles 4 13 + extern unsigned char *small_suits_tiles_data[4]; 14 + 15 + #ifdef __cplusplus 16 + } 17 + #endif 18 + 19 + #endif
-120
src/input.c
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #include "input.h" 18 - 19 - #include <stdlib.h> 20 - #include <keypadc.h> 21 - #include "variables.h" 22 - #include "ops.h" 23 - #include "save.h" 24 - 25 - unsigned char down, left, right, up; 26 - 27 - bool doInput() 28 - { 29 - const bool prevSecond = kb_IsDown(kb_Key2nd); 30 - const bool prevAlpha = kb_IsDown(kb_KeyAlpha); 31 - const bool prevClear = kb_IsDown(kb_KeyClear); 32 - 33 - kb_Scan(); 34 - 35 - up = kb_IsDown(kb_KeyUp) ? up + 1 : 0; 36 - down = kb_IsDown(kb_KeyDown) ? down + 1 : 0; 37 - left = kb_IsDown(kb_KeyLeft) ? left + 1 : 0; 38 - right = kb_IsDown(kb_KeyRight) ? right + 1 : 0; 39 - 40 - const bool select = (kb_IsDown(kb_Key2nd) && !prevSecond); 41 - const bool draw = (kb_IsDown(kb_KeyAlpha) && !prevAlpha); 42 - const bool clear = (kb_IsDown(kb_KeyClear) && !prevClear); 43 - 44 - if (select) 45 - { 46 - if (cursorMode == SELECT) 47 - { 48 - if (canGrabCard()) 49 - { 50 - grabCard(); 51 - cursorMode = DROP; 52 - } 53 - } 54 - else if (canDropCard()) 55 - { 56 - dropCard(); 57 - cursorMode = SELECT; 58 - } 59 - } 60 - else if (clear) 61 - { 62 - if (canClearCard()) 63 - { 64 - clearCard(); 65 - cursorMode = SELECT; 66 - } 67 - } 68 - else if (draw) 69 - { 70 - if (cursorMode == SELECT && deckCards > 0) 71 - { 72 - getNewCard(); 73 - orgStack = DECK_ORG; 74 - cursorMode = DROP; 75 - } 76 - } 77 - 78 - unsigned char prevCursorStack = cursorStack; 79 - 80 - if (down == 1 || down > HOLD_TIME) 81 - { 82 - if (cursorStack < NUM_FREECELLS || !(tableau[cursorStack][cursorIndex + 1] & CARD_EXISTS)) cursorIndex++; 83 - } 84 - else if (left == 1 || left > HOLD_TIME) 85 - { 86 - if (cursorStack == 0) cursorStack = NUM_FREECELLS + NUM_TABLSLOTS - 1; // wrap 87 - else cursorStack--; 88 - } 89 - else if (right == 1 || right > HOLD_TIME) 90 - { 91 - if (cursorStack > NUM_FREECELLS + NUM_TABLSLOTS - 2) cursorStack = 0; // wrap 92 - else cursorStack++; 93 - } 94 - else if (up == 1 || up > HOLD_TIME) 95 - { 96 - if (cursorIndex > 0) cursorIndex--; 97 - } 98 - 99 - if (cursorStack < NUM_FREECELLS) 100 - { 101 - cursorIndex = 0; 102 - } 103 - else if (cursorMode == DROP) 104 - { 105 - maxCursorIndex(); 106 - if (cursorStack >= NUM_FREECELLS && (tableau[cursorStack - NUM_FREECELLS][0] & CARD_EXISTS)) cursorIndex++; 107 - } 108 - else if (cursorStack != prevCursorStack) 109 - { 110 - maxCursorIndex(); 111 - } 112 - 113 - if (kb_IsDown(kb_KeyDel)) 114 - { 115 - deleteSave(); 116 - start(); 117 - } 118 - 119 - return !kb_On && progress < 10; 120 - }
-24
src/input.h
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #ifndef input_include_file 18 - #define input_include_file 19 - 20 - #include <stdbool.h> 21 - 22 - bool doInput(); 23 - 24 - #endif
+30 -92
src/main.c
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #include <fileioc.h> 18 - #include <stdlib.h> 19 - #include <math.h> 20 - #include <time.h> 21 - #include <sys/rtc.h> 22 - #include <keypadc.h> 23 - 24 - #include "variables.h" 25 - #include "input.h" 26 - #include "drawing.h" 27 - #include "save.h" 28 - #include "ops.h" 29 - 30 - card_t tableau[NUM_TABLSLOTS][TABL_STACK_SIZE]; 31 - card_t freeCells[NUM_FREECELLS]; 32 - unsigned char progress; 33 - 34 - bool run() 35 - { 36 - start(); 37 - 38 - while (doInput()) 39 - { 40 - clock_t frameTimer = clock(); 41 - 42 - drawFrame(true); 43 - 44 - while (clock() - frameTimer < FRAME_TIME); 45 - } 46 - 47 - if (progress == PROGRESS_COMPLETE) 48 - { 49 - // this way we know not to try to resume 50 - deleteSave(); 51 - 52 - drawFrame(true); 53 - 54 - while (kb_AnyKey()); 55 - 56 - while (true) 57 - { 58 - kb_Scan(); 59 - if (kb_On) return false; 60 - if (kb_IsDown(kb_Key2nd) || kb_IsDown(kb_KeyEnter)) return true; 61 - } 62 - } 63 - else 64 - { 65 - // user exited mid-game 66 - save(); 67 - return false; 68 - } 69 - } 70 - 71 - int main(void) 72 - { 73 - srand(rtc_Time()); 74 - 75 - gfx_Begin(); 76 - gfx_SetDrawBuffer(); 77 - gfx_SetPalette(global_palette, sizeof_global_palette, 0); 78 - gfx_SetTransparentColor(3); 79 - 80 - kb_EnableOnLatch(); 81 - kb_ClearOnLatch(); 82 - 83 - loadWins(); 84 - 85 - while (run()); 86 - 87 - gfx_End(); 88 - 89 - kb_ClearOnLatch(); 90 - 91 - return 0; 92 - } 1 + #include "card.h" 2 + #include "drawing.h" 3 + #include "gfx/gfx.h" 4 + #include <graphx.h> 5 + #include <ti/getcsc.h> 6 + 7 + int main(void) 8 + { 9 + gfx_Begin(); 10 + gfx_SetPalette(&global_palette, sizeof(global_palette), 0); 11 + gfx_SetDrawBuffer(); 12 + gfx_FillScreen(3); 13 + 14 + alloc_stacks(2); 15 + make_stack(0, 5, 100, 50, 5, 2); 16 + stacks[0].cards[0] = 0x8c; 17 + stacks[0].cards[1] = 0x9b; 18 + 19 + while (!boot_CheckOnPressed()) 20 + { 21 + gfx_SetColor(7); 22 + 23 + draw_stacks(); 24 + gfx_BlitBuffer(); 25 + 26 + os_GetCSC(); 27 + } 28 + 29 + gfx_End(); 30 + }
-146
src/ops.c
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #include "ops.h" 18 - 19 - #include <stdlib.h> 20 - #include <fileioc.h> 21 - 22 - #include "variables.h" 23 - #include "save.h" 24 - #include "drawing.h" 25 - 26 - unsigned char cursorStack; 27 - unsigned char cursorIndex; 28 - enum cursorMode_t cursorMode; 29 - unsigned char selectedCard; 30 - unsigned char selectedQty; 31 - unsigned char orgStack; 32 - unsigned char orgIndex; 33 - 34 - void start() 35 - { 36 - loadWins(); 37 - load(); // will call deal() as well if necessary 38 - 39 - // set initial variables 40 - cursorMode = SELECT; 41 - cursorStack = NUM_FREECELLS; 42 - maxCursorIndex(); 43 - selectedCard = CARD_EMPTY; 44 - } 45 - 46 - bool canGrabCard() 47 - { 48 - if (cursorStack < NUM_FREECELLS) return false; 49 - else if (tableau[cursorStack - NUM_FREECELLS][cursorIndex + 1] & CARD_EXISTS) return false; 50 - else return tableau[cursorStack - NUM_FREECELLS][cursorIndex] & CARD_EXISTS; 51 - } 52 - 53 - bool canDropCard() 54 - { 55 - if (cursorStack < NUM_FREECELLS) 56 - { 57 - if ((freeCells[cursorStack] & CARD_NUMBER) == CARD_KING) return false; 58 - else return (selectedCard & CARD_NUMBER) == (cursorStack + (freeCells[cursorStack] & CARD_NUMBER) + 1) % 13; 59 - } 60 - else if (orgStack != DECK_ORG) 61 - { 62 - return cursorStack == orgStack; 63 - } 64 - else if (cursorIndex == 0) 65 - { 66 - return true; 67 - } 68 - else 69 - { 70 - return !(tableau[cursorStack - NUM_FREECELLS][cursorIndex + 1] & CARD_EXISTS); 71 - } 72 - } 73 - 74 - bool canClearCard() 75 - { 76 - if (orgStack == DECK_ORG) return false; 77 - else return selectedCard & CARD_EXISTS; 78 - } 79 - 80 - void getNewCard() 81 - { 82 - while (true) 83 - { 84 - selectedCard = (rand() & CARD_SUIT) | (rand() % 13) | CARD_EXISTS; 85 - if (!removeFromDeck(selectedCard)) break; 86 - } 87 - 88 - animateDraw(); 89 - } 90 - 91 - bool removeFromDeck(card_t toRemove) 92 - { 93 - unsigned char cardIndex = ((toRemove & CARD_SUIT) >> 4) * 13 + (toRemove & CARD_NUMBER); 94 - unsigned char *deckByte = deck + (cardIndex / 8); 95 - unsigned char pokeByte = 0x01 << (cardIndex % 8); 96 - if (*deckByte & pokeByte) return true; 97 - 98 - *deckByte |= pokeByte; 99 - deckCards--; 100 - return false; 101 - } 102 - 103 - void grabCard() 104 - { 105 - orgStack = cursorStack; 106 - orgIndex = cursorIndex; 107 - 108 - selectedCard = tableau[cursorStack - NUM_FREECELLS][cursorIndex]; 109 - tableau[cursorStack - NUM_FREECELLS][cursorIndex] = CARD_EMPTY; 110 - 111 - animateGrab(); 112 - } 113 - 114 - void dropCard() 115 - { 116 - animateDrop(); 117 - 118 - unsigned char const prevProgress = progress; 119 - 120 - if (cursorStack < NUM_FREECELLS) 121 - { 122 - freeCells[cursorStack] = selectedCard; 123 - if ((selectedCard & CARD_NUMBER) == CARD_KING) progress++; 124 - } 125 - else 126 - { 127 - tableau[cursorStack - NUM_FREECELLS][cursorIndex] = selectedCard; 128 - } 129 - 130 - if (progress == PROGRESS_COMPLETE && prevProgress < PROGRESS_COMPLETE) (*numWins)++; 131 - } 132 - 133 - void clearCard() 134 - { 135 - animateClear(); 136 - tableau[orgStack - NUM_FREECELLS][orgIndex] = selectedCard; 137 - selectedCard = CARD_EMPTY; 138 - } 139 - 140 - void maxCursorIndex() 141 - { 142 - if (cursorStack < NUM_FREECELLS) return; 143 - 144 - cursorIndex = 0; 145 - while (tableau[cursorStack - NUM_FREECELLS][cursorIndex + 1] & CARD_EXISTS) cursorIndex++; 146 - }
-41
src/ops.h
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #ifndef ops_include_file 18 - #define ops_include_file 19 - 20 - #include <stdbool.h> 21 - #include "variables.h" 22 - 23 - #define canPress2nd() (cursorMode == SELECT ? canGrabCard() : canDropCard()) 24 - #define canPressAlpha() (!(selectedCard & CARD_EXISTS)) 25 - #define canPressClear() (canClearCard()) 26 - #define canPressDel() (true) 27 - 28 - void start(); 29 - 30 - bool canGrabCard(); 31 - bool canDropCard(); 32 - bool canClearCard(); 33 - 34 - void getNewCard(); 35 - bool removeFromDeck(card_t toRemove); // returns true iff card not in deck 36 - void grabCard(); 37 - void dropCard(); 38 - void clearCard(); 39 - void maxCursorIndex(); 40 - 41 - #endif
-152
src/save.c
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #include "save.h" 18 - 19 - #include <sys/rtc.h> 20 - #include <fileioc.h> 21 - #include <stdlib.h> 22 - 23 - #include "variables.h" 24 - #include "drawing.h" 25 - #include "ops.h" 26 - 27 - unsigned char deck[7]; 28 - unsigned char deckCards; 29 - 30 - unsigned int *numWins; 31 - unsigned char *saveData; 32 - 33 - void deal() 34 - { 35 - progress = 0; 36 - deckCards = 52; 37 - 38 - for (unsigned char i = 0; i < 7; i++) 39 - { 40 - deck[i] = 0x00; 41 - } 42 - 43 - for (unsigned char i = 0; i < NUM_TABLSLOTS; i++) 44 - { 45 - for (unsigned char j = 0; j < TABL_STACK_SIZE; j++) 46 - { 47 - tableau[i][j] = CARD_EMPTY; 48 - } 49 - } 50 - 51 - for (unsigned char i = 0; i < NUM_FREECELLS; i++) 52 - { 53 - freeCells[i] = CARD_EXISTS | i | (unsigned char)(rand() & CARD_SUIT); 54 - removeFromDeck(freeCells[i]); 55 - } 56 - 57 - animateDeal(); 58 - } 59 - 60 - void loadWins() 61 - { 62 - unsigned char winsHandle = ti_Open(WINS_VAR_NAME, "r+"); 63 - 64 - if (winsHandle == 0) 65 - { 66 - // create a new blank file 67 - winsHandle = ti_Open(WINS_VAR_NAME, "w"); 68 - ti_PutC(0, winsHandle); 69 - ti_Seek(0, SEEK_SET, winsHandle); 70 - } 71 - 72 - // is there already an entry for this game? 73 - unsigned char *length = ti_GetDataPtr(winsHandle); 74 - highscore_t *entries = (highscore_t *)length + sizeof(char); 75 - for (unsigned char i = 0; i < *length; i++) 76 - { 77 - if (entries[i].gameId == GAME_ID) 78 - { 79 - numWins = &(entries[i].score); 80 - goto found_wins; 81 - } 82 - } 83 - 84 - // add a new blank entry 85 - (*length)++; 86 - ti_Seek(sizeof(char) + *length * sizeof(highscore_t), SEEK_SET, winsHandle); 87 - const highscore_t newHighScore = { GAME_ID, 0 }; 88 - highscore_t *entry = (highscore_t *)ti_GetDataPtr(winsHandle); 89 - ti_Write(&newHighScore, sizeof(highscore_t), 1, winsHandle); 90 - numWins = &(entry->score); 91 - 92 - found_wins: 93 - ti_Close(winsHandle); 94 - } 95 - 96 - void load() 97 - { 98 - unsigned char saveHandle = ti_Open(SAVE_VAR_NAME, "r"); 99 - 100 - if (saveHandle == 0) 101 - { 102 - // no save present 103 - deal(); 104 - } 105 - else 106 - { 107 - unsigned char magicNumber = ti_GetC(saveHandle); 108 - if (magicNumber != GAME_ID) 109 - { 110 - // this is from a different solitaire game 111 - deal(); 112 - } 113 - else 114 - { 115 - // load save 116 - ti_Read(freeCells, 1, NUM_FREECELLS, saveHandle); 117 - ti_Read(tableau, 1, NUM_TABLSLOTS * TABL_STACK_SIZE, saveHandle); 118 - 119 - // how far along does that make us? 120 - progress = 0; 121 - for (unsigned char i = 0; i < NUM_FREECELLS; i++) 122 - { 123 - if ((freeCells[i] & CARD_NUMBER) == CARD_KING) progress++; 124 - } 125 - 126 - ti_Read(&deckCards, 1, 1, saveHandle); 127 - ti_Read(deck, 1, 7, saveHandle); 128 - ti_Read(&selectedCard, 1, 1, saveHandle); 129 - } 130 - } 131 - 132 - ti_Close(saveHandle); 133 - } 134 - 135 - void save() 136 - { 137 - unsigned char saveHandle = ti_Open(SAVE_VAR_NAME, "w"); 138 - 139 - ti_PutC(GAME_ID, saveHandle); 140 - ti_Write(freeCells, 1, NUM_FREECELLS, saveHandle); 141 - ti_Write(tableau, 1, NUM_TABLSLOTS * TABL_STACK_SIZE, saveHandle); 142 - ti_Write(&deckCards, 1, 1, saveHandle); 143 - ti_Write(deck, 1, 7, saveHandle); 144 - ti_Write(&selectedCard, 1, 1, saveHandle); 145 - 146 - ti_Close(saveHandle); 147 - } 148 - 149 - void deleteSave() 150 - { 151 - ti_Delete(SAVE_VAR_NAME); 152 - }
-31
src/save.h
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #ifndef save_include_file 18 - #define save_include_file 19 - 20 - typedef struct { 21 - unsigned char gameId; 22 - unsigned int score; 23 - } highscore_t; 24 - 25 - void deal(); 26 - void load(); 27 - void save(); 28 - void deleteSave(); 29 - void loadWins(); 30 - 31 - #endif
-59
src/variables.h
··· 1 - // Calculation Solitaire / CALCSLTR for the TI-84 Plus CE 2 - // Copyright (C) 2025 euphory 3 - // 4 - // This program is free software: you can redistribute it and/or modify 5 - // it under the terms of the GNU General Public License as published by 6 - // the Free Software Foundation, either version 3 of the License, or 7 - // (at your option) any later version. 8 - // 9 - // This program is distributed in the hope that it will be useful, 10 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - // GNU General Public License for more details. 13 - // 14 - // You should have received a copy of the GNU General Public License 15 - // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 - 17 - #ifndef variables_include_file 18 - #define variables_include_file 19 - 20 - #define WINS_VAR_NAME "SLTRWINS" 21 - #define SAVE_VAR_NAME "SLTRSAVE" 22 - #define GAME_ID 0x02 23 - 24 - #define FRAME_TIME 3277 25 - #define HOLD_TIME 2 26 - 27 - #define NUM_FREECELLS 4 28 - #define NUM_TABLSLOTS 4 29 - #define TABL_STACK_SIZE 12 30 - 31 - #define PROGRESS_COMPLETE 4 32 - #define DECK_ORG 0xff 33 - 34 - #define CARD_RED 0x20 35 - #define CARD_SUIT 0x30 36 - #define CARD_NUMBER 0x0f 37 - #define CARD_KING 12 38 - #define CARD_EMPTY 0x00 39 - #define CARD_EXISTS 0x80 40 - 41 - typedef unsigned char card_t; 42 - 43 - extern card_t tableau[NUM_TABLSLOTS][TABL_STACK_SIZE]; 44 - extern card_t freeCells[NUM_FREECELLS]; 45 - 46 - extern unsigned char cursorStack; 47 - extern unsigned char cursorIndex; 48 - extern enum cursorMode_t { SELECT, DROP } cursorMode; 49 - extern card_t selectedCard; 50 - extern unsigned char orgStack; 51 - extern unsigned char orgIndex; 52 - 53 - extern unsigned char progress; 54 - extern unsigned int *numWins; 55 - 56 - extern unsigned char deck[7]; 57 - extern unsigned char deckCards; 58 - 59 - #endif