made jokers dynamic and changed memcpy to us 32

This commit is contained in:
cellos51
2025-07-23 17:00:18 -04:00
parent d122fde361
commit 300e725dfe
3 changed files with 9 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;