Defining a basic system for jokers

This commit is contained in:
cellos51
2025-07-17 21:47:50 -04:00
parent ea2e503222
commit 4a5644eddb
10 changed files with 139 additions and 23 deletions
+5 -9
View File
@@ -4,24 +4,20 @@
#include "blinds_gfx.h"
#include "graphic_utils.h"
// Palettes for the blinds (Transparency, Text Color, Shadow, Highlight, Main Color) Use this: http://www.budmelvin.com/dev/15bitconverter.html
static const u16 small_blind_token_palette[PAL_ROW_LEN] = {0x0000, 0x7FFF, 0x34A1, 0x5DCB, 0x5104, 0x55A0, 0x2D01, 0x34E0};
static const u16 big_blind_token_palette[PAL_ROW_LEN] = {0x0000, 0x2527, 0x15F5, 0x36FC, 0x1E9C, 0x01B4, 0x0D0A, 0x010E};
static const u16 boss_blind_token_palette[PAL_ROW_LEN] = {0x0000, 0x2CC9, 0x3D0D, 0x5E14, 0x5171}; // This variable is temporary, each boss blind will have its own unique palette
void blinds_init()
void blind_init()
{
// Blind graphics (fighting grit every step of the way as usual)
GRIT_CPY(&tile_mem[4][SMALL_BLIND_TID], blinds_gfxTiles);
// Palettes for the blinds (Transparency, Text Color, Shadow, Highlight, Main Color) Use this: http://www.budmelvin.com/dev/15bitconverter.html
// Small Blind
memcpy16(&pal_obj_mem[16 * SMALL_BLIND_PB], &small_blind_token_palette, sizeof(small_blind_token_palette) / 2);
// Big Blind
memcpy16(&pal_obj_mem[16 * BIG_BLIND_PB], &big_blind_token_palette, sizeof(big_blind_token_palette) / 2);
memcpy16(&pal_obj_mem[PAL_ROW_LEN * SMALL_BLIND_PB], &small_blind_token_palette, sizeof(small_blind_token_palette) / 2);
memcpy16(&pal_obj_mem[PAL_ROW_LEN * BIG_BLIND_PB], &big_blind_token_palette, sizeof(big_blind_token_palette) / 2);
// Boss Blind (This is temporary. Each boss blind is unique and will have to have its own graphics and palette which will probably be stored in some huge array)
memcpy16(&pal_obj_mem[16 * BOSS_BLIND_PB], &boss_blind_token_palette, sizeof(boss_blind_token_palette) / 2);
memcpy16(&pal_obj_mem[PAL_ROW_LEN * BOSS_BLIND_PB], &boss_blind_token_palette, sizeof(boss_blind_token_palette) / 2);
}
int blind_get_requirement(int type, int ante)
+8
View File
@@ -3,6 +3,8 @@
#include <maxmod.h>
#include <stdlib.h>
#include "deck_gfx.h"
// Audio
#include "soundbank.h"
@@ -14,6 +16,12 @@ const static u16 card_sprite_lut[NUM_SUITS][NUM_RANKS] = {
{624, 640, 656, 672, 688, 704, 720, 736, 752, 768, 784, 800, 816}
};
void card_init()
{
GRIT_CPY(&tile_mem[4], deck_gfxTiles);
GRIT_CPY(pal_obj_mem, deck_gfxPal);
}
// Card methods
Card *card_new(u8 suit, u8 rank)
{
+2 -7
View File
@@ -776,11 +776,6 @@ void hand_set_focus(int index)
mmEffectEx(&sfx_focus);
}
int hand_get_focus()
{
return card_focused;
}
void hand_select()
{
if (hand_state != HAND_SELECT || hand[card_focused] == NULL) return;
@@ -978,11 +973,11 @@ static void game_playing_process_input_and_state()
{
if (key_hit(KEY_LEFT))
{
hand_set_focus(hand_get_focus() + 1); // The reason why this adds 1 is because the hand is drawn from right to left. There is no particular reason for this, it's just how I did it.
hand_set_focus(card_focused + 1); // The reason why this adds 1 is because the hand is drawn from right to left. There is no particular reason for this, it's just how I did it.
}
else if (key_hit(KEY_RIGHT))
{
hand_set_focus(hand_get_focus() - 1);
hand_set_focus(card_focused - 1);
}
if (key_hit(KEY_A))
+36
View File
@@ -0,0 +1,36 @@
#include <tonc.h>
#include "joker.h"
#include "joker_gfx.h"
#include "graphic_utils.h"
const static u8 joker_data_lut[MAX_JOKERS][2] = // Rarity, Value
{
{COMMON_JOKER, 2}, // Default Joker
{COMMON_JOKER, 5}, // Greedy Joker
};
void joker_init()
{
GRIT_CPY(&tile_mem[4][JOKER_TID], joker_gfxTiles);
memcpy16(&pal_obj_mem[PAL_ROW_LEN * JOKER_PB], joker_gfxPal, sizeof(joker_gfxPal) / 2);
}
Joker *joker_new(u8 id)
{
Joker *joker = malloc(sizeof(Joker));
joker->id = id; // TODO: Make this random later
joker->modifier = BASE_EDITION; // TODO: Make this random later
joker->value = joker_data_lut[id][1];
joker->rarity = joker_data_lut[id][0];
return joker;
}
void joker_destroy(Joker **joker)
{
if (*joker == NULL) return;
free(*joker);
*joker = NULL;
}
+4 -6
View File
@@ -6,10 +6,10 @@
#include "card.h"
#include "game.h"
#include "blind.h"
#include "joker.h"
#include "graphic_utils.h"
// Graphics
#include "deck_gfx.h"
#include "background_gfx.h"
#include "affine_background_gfx.h"
@@ -60,10 +60,6 @@ void init()
pal_bg_bank[14][15] = 0x213F; // Red
pal_bg_bank[15][15] = CLR_WHITE;
// Deck graphics
GRIT_CPY(&tile_mem[4], deck_gfxTiles);
GRIT_CPY(pal_obj_mem, deck_gfxPal);
// Set up the video mode
// BG0 is the TTE text layer
REG_BG0CNT = BG_PRIO(0) | BG_CBB(TTE_CBB) | BG_SBB(TTE_SBB) | BG_4BPP;
@@ -101,7 +97,9 @@ void init()
// Initialize subsystems
sprite_init();
blinds_init();
card_init();
blind_init();
joker_init();
game_init();
}