From 300e725dfe0804fe7aeca76e9be0063abc505bef Mon Sep 17 00:00:00 2001 From: cellos51 Date: Wed, 23 Jul 2025 17:00:18 -0400 Subject: [PATCH] made jokers dynamic and changed memcpy to us 32 --- source/card.c | 2 +- source/game.c | 4 ++-- source/joker.c | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/card.c b/source/card.c index 8db0c2f3..c1fc94cc 100644 --- a/source/card.c +++ b/source/card.c @@ -151,7 +151,7 @@ void card_object_update(CardObject *card_object) void card_object_set_sprite(CardObject *card_object, int layer) { int tile_index = CARD_TID + (layer * CARD_SPRITE_OFFSET); - memcpy16(&tile_mem[4][tile_index], &deck_gfxTiles[card_sprite_lut[card_object->card->suit][card_object->card->rank] * TILE_SIZE], TILE_SIZE * CARD_SPRITE_OFFSET * 2); + memcpy32(&tile_mem[4][tile_index], &deck_gfxTiles[card_sprite_lut[card_object->card->suit][card_object->card->rank] * TILE_SIZE], TILE_SIZE * CARD_SPRITE_OFFSET); sprite_destroy(&card_object->sprite); // Destroy the old sprite if it exists card_object->sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF, ATTR1_SIZE_32, tile_index, 0, layer + CARD_STARTING_LAYER); } diff --git a/source/game.c b/source/game.c index 19e46d23..0dea05b2 100644 --- a/source/game.c +++ b/source/game.c @@ -27,7 +27,7 @@ static uint timer = 0; // This might already exist in libtonc but idk so i'm jus static int game_speed = 1; static int background = 0; -static enum GameState game_state = GAME_BLIND_SELECT; // The current game state, this is used to determine what the game is doing at any given time +static enum GameState game_state = GAME_SHOP; // The current game state, this is used to determine what the game is doing at any given time static enum HandState hand_state = HAND_DRAW; static enum PlayState play_state = PLAY_PLAYING; static int state = 0; // General state variable, used for switch statements in each game state related function @@ -51,7 +51,7 @@ static int discards = 0; static int round = 0; static int ante = 1; -static int money = 4; +static int money = 100; static int score = 0; static int temp_score = 0; // This is the score that shows in the same spot as the hand type. static FIXED lerped_score = 0; diff --git a/source/joker.c b/source/joker.c index f76f3879..defc29d1 100644 --- a/source/joker.c +++ b/source/joker.c @@ -36,7 +36,7 @@ static bool used_layers[MAX_JOKER_OBJECTS] = {false}; // Track used layers for j void joker_init() { - GRIT_CPY(&tile_mem[4][JOKER_TID], joker_gfxTiles); + //GRIT_CPY(&tile_mem[4][JOKER_TID], joker_gfxTiles); memcpy16(&pal_obj_mem[PAL_ROW_LEN * JOKER_PB], joker_gfxPal, sizeof(joker_gfxPal) / 2); } @@ -100,14 +100,18 @@ JokerObject *joker_object_new(Joker *joker) } joker_object->joker = joker; + + int tile_index = JOKER_TID + (layer * JOKER_SPRITE_OFFSET); + memcpy32(&tile_mem[4][tile_index], &joker_gfxTiles[joker->id * TILE_SIZE * JOKER_SPRITE_OFFSET], TILE_SIZE * JOKER_SPRITE_OFFSET); joker_object->sprite = sprite_new ( ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF, ATTR1_SIZE_32, - JOKER_TID + (JOKER_SPRITE_OFFSET * joker->id), + tile_index, JOKER_PB, JOKER_STARTING_LAYER + layer ); + joker_object->tx = 0; // Target position joker_object->ty = 0; joker_object->x = 0;