Merge pull request #133 from ricfehr3/refactor-blinds
Cleanup, Refactor blinds into a map
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 425 B |
Binary file not shown.
|
Before Width: | Height: | Size: 597 B |
@@ -0,0 +1 @@
|
||||
-gB4 -Mw4 -Mh4 -p!
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 402 B |
@@ -0,0 +1 @@
|
||||
-gB4 -Mw4 -Mh4 -p!
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 423 B |
+54
-25
@@ -5,46 +5,75 @@
|
||||
|
||||
#define MAX_ANTE 8 // The GBA's max uint value is around 4 billion, so we're going to not add endless mode for simplicity's sake
|
||||
|
||||
// +1 is added because we'll actually be indexing at 1, but if something causes you to go to ante 0, there will still be a value there.
|
||||
static const int ante_lut[MAX_ANTE + 1] = {100, 300, 800, 2000, 5000, 11000, 20000, 35000, 50000};
|
||||
|
||||
#define MAX_BLINDS 3
|
||||
|
||||
#define SMALL_BLIND 0
|
||||
#define BIG_BLIND 1
|
||||
#define BOSS_BLIND 2
|
||||
|
||||
#define SMALL_BLIND_PB 1
|
||||
#define BIG_BLIND_PB 2
|
||||
#define BOSS_BLIND_PB 3
|
||||
|
||||
#define BLIND_SPRITE_OFFSET 16
|
||||
#define BLIND_SPRITE_COPY_SIZE BLIND_SPRITE_OFFSET * 8 // 8 ints per tile
|
||||
#define SMALL_BLIND_TID 960
|
||||
#define BIG_BLIND_TID (BLIND_SPRITE_OFFSET + SMALL_BLIND_TID)
|
||||
#define BOSS_BLIND_TID (BLIND_SPRITE_OFFSET + BIG_BLIND_TID)
|
||||
|
||||
#define BLIND_TEXT_COLOR_INDEX 1
|
||||
#define BLIND_SHADOW_COLOR_INDEX 2
|
||||
#define BLIND_HIGHLIGHT_COLOR_INDEX 3
|
||||
#define BLIND_MAIN_COLOR_INDEX 4
|
||||
#define BLIND_BACKGROUND_MAIN_COLOR_INDEX 5
|
||||
#define BLIND_BACKGROUND_SECONDARY_COLOR_INDEX 6
|
||||
#define BLIND_BACKGROUND_SHADOW_COLOR_INDEX 7
|
||||
enum BlindColorIndex
|
||||
{
|
||||
BLIND_TEXT_COLOR_INDEX = 1,
|
||||
BLIND_SHADOW_COLOR_INDEX = 2,
|
||||
BLIND_HIGHLIGHT_COLOR_INDEX = 3,
|
||||
BLIND_MAIN_COLOR_INDEX = 4,
|
||||
BLIND_BACKGROUND_MAIN_COLOR_INDEX = 5,
|
||||
BLIND_BACKGROUND_SECONDARY_COLOR_INDEX = 6,
|
||||
BLIND_BACKGROUND_SHADOW_COLOR_INDEX = 7,
|
||||
};
|
||||
|
||||
#define BLIND_TYPE_INFO_TABLE \
|
||||
BLIND_INFO(SMALL, small, FIX_ONE, 3) \
|
||||
BLIND_INFO(BIG, big, (FIX_ONE * 3) / 2, 4) \
|
||||
BLIND_INFO(BOSS, boss, FIX_ONE * 2, 5)
|
||||
|
||||
enum BlindType
|
||||
{
|
||||
#define BLIND_INFO(NAME, name, multi, reward) \
|
||||
BLIND_TYPE_##NAME ,
|
||||
BLIND_TYPE_INFO_TABLE
|
||||
BLIND_TYPE_MAX,
|
||||
#undef BLIND_INFO
|
||||
};
|
||||
|
||||
enum BlindState
|
||||
{
|
||||
BLIND_CURRENT,
|
||||
BLIND_UPCOMING,
|
||||
BLIND_DEFEATED,
|
||||
BLIND_SKIPPED
|
||||
BLIND_STATE_CURRENT,
|
||||
BLIND_STATE_UPCOMING,
|
||||
BLIND_STATE_DEFEATED,
|
||||
BLIND_STATE_SKIPPED,
|
||||
BLIND_STATE_MAX,
|
||||
};
|
||||
|
||||
// TODO: Move this to a common interface for other palettes
|
||||
typedef struct
|
||||
{
|
||||
const unsigned int* tiles;
|
||||
const u16* palette;
|
||||
u32 tid;
|
||||
u32 pb;
|
||||
} BlindGfxInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
enum BlindType type;
|
||||
BlindGfxInfo gfx_info;
|
||||
FIXED score_req_multipler;
|
||||
s32 reward;
|
||||
} Blind;
|
||||
|
||||
void blind_init();
|
||||
|
||||
int blind_get_requirement(int type, int ante);
|
||||
int blind_get_reward(int type);
|
||||
u16 blind_get_color(int type, int index);
|
||||
void blind_set_boss_graphics(const unsigned int* tiles, const u16* palette);
|
||||
|
||||
Sprite *blind_token_new(int type, int x, int y, int sprite_index);
|
||||
int blind_get_requirement(enum BlindType type, int ante);
|
||||
int blind_get_reward(enum BlindType type);
|
||||
u16 blind_get_color(enum BlindType type, enum BlindColorIndex index);
|
||||
|
||||
#endif // BLIND_H
|
||||
Sprite *blind_token_new(enum BlindType type, int x, int y, int sprite_index);
|
||||
|
||||
#endif // BLIND_H
|
||||
|
||||
+71
-63
@@ -1,93 +1,101 @@
|
||||
#include <tonc.h>
|
||||
|
||||
#include "blind.h"
|
||||
#include "blinds_gfx.h"
|
||||
#include "small_blind_gfx.h"
|
||||
#include "big_blind_gfx.h"
|
||||
#include "boss_blind_gfx.h"
|
||||
#include "graphic_utils.h"
|
||||
|
||||
// +1 is added because we'll actually be indexing at 1, but if something causes you to go to ante 0, there will still be a value there.
|
||||
static const int ante_lut[MAX_ANTE + 1] = {100, 300, 800, 2000, 5000, 11000, 20000, 35000, 50000};
|
||||
|
||||
// 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, 0x4D0F, 0x2CC8, 0x3089}; // This variable is temporary, each boss blind will have its own unique palette
|
||||
|
||||
|
||||
static Blind _blind_type_map[BLIND_TYPE_MAX] =
|
||||
{
|
||||
#define BLIND_INFO(NAME, name, multi, _reward) \
|
||||
{ \
|
||||
.type = BLIND_TYPE_##NAME , \
|
||||
.gfx_info = \
|
||||
{ \
|
||||
.tiles = name##_blind_gfxTiles, \
|
||||
.palette = name##_blind_token_palette, \
|
||||
.tid = NAME##_BLIND_TID, \
|
||||
.pb = NAME##_BLIND_PB, \
|
||||
}, \
|
||||
.score_req_multipler = multi , \
|
||||
.reward = _reward , \
|
||||
},
|
||||
BLIND_TYPE_INFO_TABLE
|
||||
#undef BLIND_INFO
|
||||
};
|
||||
|
||||
static void blind_gfx_init(enum BlindType type)
|
||||
{
|
||||
// TODO: Re-add grit copy. You need to decouple the blind graphics first.
|
||||
// This will allow this function to change the boss graphics info
|
||||
//GRIT_CPY(&tile_mem[4][_blind_type_map[type].pal_info.tid], tiles);
|
||||
BlindGfxInfo* p_gfx = &_blind_type_map[type].gfx_info;
|
||||
memcpy32(&tile_mem[4][p_gfx->tid], p_gfx->tiles, BLIND_SPRITE_COPY_SIZE);
|
||||
memcpy16(&pal_obj_bank[p_gfx->pb], p_gfx->palette, PAL_ROW_LEN);
|
||||
}
|
||||
|
||||
|
||||
__attribute__((unused))
|
||||
void blind_set_boss_graphics(const unsigned int* tiles, const u16* palette)
|
||||
{
|
||||
// TODO: This function is unused and not fully fleshed out.
|
||||
// We need to support more boss blind graphics in the future.
|
||||
// The idea here is that we can call this function to set the boss up to
|
||||
// render new tiles
|
||||
//
|
||||
// This will eventually be in it's own map mapping graphic data to
|
||||
// boss types.
|
||||
|
||||
_blind_type_map[BLIND_TYPE_BOSS].gfx_info.tiles = tiles;
|
||||
_blind_type_map[BLIND_TYPE_BOSS].gfx_info.palette = palette;
|
||||
blind_gfx_init(BLIND_TYPE_BOSS);
|
||||
}
|
||||
|
||||
void blind_init()
|
||||
{
|
||||
// Blind graphics (fighting grit every step of the way as usual)
|
||||
GRIT_CPY(&tile_mem[4][SMALL_BLIND_TID], blinds_gfxTiles);
|
||||
for(int i = 0; i < BLIND_TYPE_MAX; i++)
|
||||
{
|
||||
blind_gfx_init(i);
|
||||
|
||||
}
|
||||
|
||||
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[PAL_ROW_LEN * BOSS_BLIND_PB], &boss_blind_token_palette, sizeof(boss_blind_token_palette) / 2);
|
||||
return;
|
||||
}
|
||||
|
||||
int blind_get_requirement(int type, int ante)
|
||||
int blind_get_requirement(enum BlindType type, int ante)
|
||||
{
|
||||
if (ante < 0 || ante > MAX_ANTE)
|
||||
{
|
||||
ante = 0; // Ensure ante is within valid range
|
||||
}
|
||||
if (ante < 0 || ante > MAX_ANTE) ante = 0; // Ensure ante is within valid range
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SMALL_BLIND:
|
||||
return ante_lut[ante];
|
||||
case BIG_BLIND:
|
||||
return (ante_lut[ante] * 3) / 2; // X1.5
|
||||
case BOSS_BLIND:
|
||||
return ante_lut[ante] * 2; // X2
|
||||
default:
|
||||
return 0; // Invalid type
|
||||
}
|
||||
return fx2int(_blind_type_map[type].score_req_multipler * ante_lut[ante]);
|
||||
}
|
||||
|
||||
int blind_get_reward(int type)
|
||||
int blind_get_reward(enum BlindType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SMALL_BLIND:
|
||||
return 3;
|
||||
case BIG_BLIND:
|
||||
return 4;
|
||||
case BOSS_BLIND:
|
||||
return 5;
|
||||
default:
|
||||
return 0; // Invalid type
|
||||
}
|
||||
return _blind_type_map[type].reward;
|
||||
}
|
||||
|
||||
u16 blind_get_color(int type, int index)
|
||||
u16 blind_get_color(enum BlindType type, enum BlindColorIndex index)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SMALL_BLIND:
|
||||
return small_blind_token_palette[index];
|
||||
case BIG_BLIND:
|
||||
return big_blind_token_palette[index];
|
||||
case BOSS_BLIND:
|
||||
return boss_blind_token_palette[index];
|
||||
default:
|
||||
return 0; // Invalid type
|
||||
}
|
||||
return _blind_type_map[type].gfx_info.palette[index];
|
||||
}
|
||||
|
||||
Sprite *blind_token_new(int type, int x, int y, int sprite_index)
|
||||
Sprite *blind_token_new(enum BlindType type, int x, int y, int sprite_index)
|
||||
{
|
||||
Sprite *sprite = NULL;
|
||||
u16 a0 = ATTR0_SQUARE | ATTR0_4BPP;
|
||||
u16 a1 = ATTR1_SIZE_32x32;
|
||||
u32 tid = _blind_type_map[type].gfx_info.tid, pb = _blind_type_map[type].gfx_info.pb;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SMALL_BLIND:
|
||||
sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, SMALL_BLIND_TID, SMALL_BLIND_PB, sprite_index);
|
||||
break;
|
||||
case BIG_BLIND:
|
||||
sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, BIG_BLIND_TID, BIG_BLIND_PB, sprite_index);
|
||||
break;
|
||||
case BOSS_BLIND:
|
||||
sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, BOSS_BLIND_TID, BOSS_BLIND_PB, sprite_index);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
Sprite* sprite = sprite_new(a0, a1, tid, pb, sprite_index);
|
||||
|
||||
sprite_position(sprite, x, y);
|
||||
|
||||
|
||||
+112
-94
@@ -78,10 +78,17 @@ static CardObject *main_menu_ace = NULL;
|
||||
static Sprite *playing_blind_token = NULL; // The sprite that displays the blind when in "GAME_PLAYING/GAME_ROUND_END" state
|
||||
static Sprite *round_end_blind_token = NULL; // The sprite that displays the blind when in "GAME_ROUND_END" state
|
||||
|
||||
static Sprite *blind_select_tokens[MAX_BLINDS] = {NULL}; // The sprites that display the blinds when in "GAME_BLIND_SELECT" state
|
||||
static Sprite *blind_select_tokens[BLIND_TYPE_MAX] = {NULL}; // The sprites that display the blinds when in "GAME_BLIND_SELECT" state
|
||||
|
||||
static int current_blind = SMALL_BLIND;
|
||||
static enum BlindState blinds[MAX_BLINDS] = {BLIND_CURRENT, BLIND_UPCOMING, BLIND_UPCOMING}; // The current state of the blinds, this is used to determine what the game is doing at any given time
|
||||
static int current_blind = BLIND_TYPE_SMALL;
|
||||
|
||||
// The current state of the blinds, this is used to determine what the game is doing at any given time
|
||||
static enum BlindState blinds[BLIND_TYPE_MAX] =
|
||||
{
|
||||
BLIND_STATE_CURRENT,
|
||||
BLIND_STATE_UPCOMING,
|
||||
BLIND_STATE_UPCOMING
|
||||
}; // The current state of the blinds, this is used to determine what the game is doing at any given time
|
||||
|
||||
// Red deck default (can later be moved to a deck.h file or something)
|
||||
static int max_hands = 4;
|
||||
@@ -334,7 +341,6 @@ static const BG_POINT MAIN_MENU_ACE_T = {88, 26};
|
||||
#define PITCH_STEP_DRAW_SFX 24
|
||||
#define PITCH_STEP_UNDISCARD_SFX 2*PITCH_STEP_DRAW_SFX
|
||||
|
||||
#define BLIND_COUNT 3
|
||||
#define TEN_K 10000
|
||||
#define ONE_K 1000
|
||||
|
||||
@@ -583,15 +589,15 @@ void change_background(int id)
|
||||
GRIT_CPY(&tile8_mem[MAIN_BG_CBB], background_gfxTiles);
|
||||
GRIT_CPY(&se_mem[MAIN_BG_SBB], background_gfxMap);
|
||||
|
||||
if (current_blind == BIG_BLIND) // Change text and palette depending on blind type
|
||||
if (current_blind == BLIND_TYPE_BIG) // Change text and palette depending on blind type
|
||||
{
|
||||
main_bg_se_copy_rect(BIG_BLIND_TITLE_SRC_RECT, TOP_LEFT_BLIND_TITLE_POINT);
|
||||
}
|
||||
else if (current_blind == BOSS_BLIND)
|
||||
else if (current_blind == BLIND_TYPE_BOSS)
|
||||
{
|
||||
main_bg_se_copy_rect(BOSS_BLIND_TITLE_SRC_RECT, TOP_LEFT_BLIND_TITLE_POINT);
|
||||
|
||||
affine_background_set_color(blind_get_color(BOSS_BLIND, BLIND_SHADOW_COLOR_INDEX));
|
||||
affine_background_set_color(blind_get_color(BLIND_TYPE_BOSS, BLIND_SHADOW_COLOR_INDEX));
|
||||
}
|
||||
|
||||
bg_copy_current_item_to_top_left_panel();
|
||||
@@ -659,14 +665,16 @@ void change_background(int id)
|
||||
}
|
||||
else if (id == BG_ID_BLIND_SELECT)
|
||||
{
|
||||
obj_unhide(blind_select_tokens[SMALL_BLIND]->obj, 0);
|
||||
obj_unhide(blind_select_tokens[BIG_BLIND]->obj, 0);
|
||||
obj_unhide(blind_select_tokens[BOSS_BLIND]->obj, 0);
|
||||
for(int i = 0; i < BLIND_TYPE_MAX; i++)
|
||||
{
|
||||
obj_unhide(blind_select_tokens[i]->obj, 0);
|
||||
}
|
||||
|
||||
const int default_y = 89 + (TILE_SIZE * 12); // Default y position for the blind select tokens. 12 is the amound of tiles the background is shifted down by
|
||||
sprite_position(blind_select_tokens[SMALL_BLIND], 80, default_y);
|
||||
sprite_position(blind_select_tokens[BIG_BLIND], 120, default_y);
|
||||
sprite_position(blind_select_tokens[BOSS_BLIND], 160, default_y);
|
||||
// TODO refactor magic numbers '80/120/160' into a map to loop with
|
||||
sprite_position(blind_select_tokens[BLIND_TYPE_SMALL], 80, default_y);
|
||||
sprite_position(blind_select_tokens[BLIND_TYPE_BIG], 120, default_y);
|
||||
sprite_position(blind_select_tokens[BLIND_TYPE_BOSS], 160, default_y);
|
||||
|
||||
toggle_windows(false, true);
|
||||
|
||||
@@ -675,8 +683,8 @@ void change_background(int id)
|
||||
GRIT_CPY(&se_mem[MAIN_BG_SBB], background_blind_select_gfxMap);
|
||||
|
||||
// Copy boss blind colors to blind select palette
|
||||
memset16(&pal_bg_mem[BOSS_BLIND_PRIMARY_PID], blind_get_color(BOSS_BLIND, BLIND_BACKGROUND_MAIN_COLOR_INDEX), 1);
|
||||
memset16(&pal_bg_mem[BOSS_BLIND_SHADOW_PID], blind_get_color(BOSS_BLIND, BLIND_BACKGROUND_SHADOW_COLOR_INDEX), 1);
|
||||
memset16(&pal_bg_mem[1], blind_get_color(BLIND_TYPE_BOSS, BLIND_BACKGROUND_MAIN_COLOR_INDEX), 1);
|
||||
memset16(&pal_bg_mem[7], blind_get_color(BLIND_TYPE_BOSS, BLIND_BACKGROUND_SHADOW_COLOR_INDEX), 1);
|
||||
|
||||
// Disable the button highlight colors
|
||||
// Select button PID is 15 and the outline is 18
|
||||
@@ -687,18 +695,20 @@ void change_background(int id)
|
||||
// effect.
|
||||
memcpy16(&pal_bg_mem[BLIND_SKIP_BTN_SELECTED_BORDER_PID], &pal_bg_mem[BLIND_SKIP_BTN_PID], 1);
|
||||
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
for (int i = 0; i < BLIND_TYPE_MAX; i++)
|
||||
{
|
||||
if (blinds[i] != BLIND_CURRENT && (i == SMALL_BLIND || i == BIG_BLIND)) // Make the skip button gray
|
||||
if (blinds[i] != BLIND_STATE_CURRENT &&
|
||||
(i == BLIND_TYPE_SMALL || i == BLIND_TYPE_BIG)) // Make the skip button gray
|
||||
{
|
||||
// TODO: Switch all the copies here to use main_bg_se_copy_rect()
|
||||
// Note, this is difficult as the tiles to copy are not aligned.
|
||||
int x_from = 0;
|
||||
int y_from = 24 + (i * 4);
|
||||
|
||||
int x_to = 9 + (i * 5);
|
||||
int y_to = 29;
|
||||
|
||||
for (int j = 0; j < BLIND_COUNT; j++)
|
||||
for (int j = 0; j < BLIND_TYPE_MAX; j++)
|
||||
{
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 5);
|
||||
y_from++;
|
||||
@@ -706,67 +716,75 @@ void change_background(int id)
|
||||
}
|
||||
}
|
||||
|
||||
if (blinds[i] == BLIND_CURRENT) // Raise the blind panel up a bit
|
||||
{
|
||||
int x_from = 0;
|
||||
int y_from = 27;
|
||||
|
||||
Rect blind_rect = SINGLE_BLIND_SELECT_RECT;
|
||||
|
||||
// There's no gap between them
|
||||
blind_rect.left += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
|
||||
blind_rect.right += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
|
||||
main_bg_se_copy_rect_1_tile_vert(blind_rect, SE_UP);
|
||||
|
||||
int x_to = blind_rect.left;
|
||||
int y_to = 31;
|
||||
|
||||
if (i == BIG_BLIND)
|
||||
switch(blinds[i]) {
|
||||
case BLIND_STATE_CURRENT: // Raise the blind panel up a bit
|
||||
{
|
||||
y_from = 31;
|
||||
int x_from = 0;
|
||||
int y_from = 27;
|
||||
|
||||
Rect blind_rect = SINGLE_BLIND_SELECT_RECT;
|
||||
|
||||
// There's no gap between them
|
||||
blind_rect.left += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
|
||||
blind_rect.right += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
|
||||
main_bg_se_copy_rect_1_tile_vert(blind_rect, SE_UP);
|
||||
|
||||
int x_to = blind_rect.left;
|
||||
int y_to = 31;
|
||||
|
||||
if (i == BLIND_TYPE_BIG)
|
||||
{
|
||||
y_from = 31;
|
||||
}
|
||||
else if (i == BLIND_TYPE_BOSS)
|
||||
{
|
||||
x_from = x_to;
|
||||
y_from = 30;
|
||||
}
|
||||
|
||||
// Copy plain tiles onto the bottom of the raised blind panel to fill the gap created by the raise
|
||||
Rect gap_fill_rect = {x_from, y_from, x_from + rect_width(&SINGLE_BLIND_SELECT_RECT) - 1, y_from}; // - 1 to stay within rect boundaries
|
||||
BG_POINT gap_fill_point = {x_to, y_to};
|
||||
main_bg_se_copy_rect(gap_fill_rect, gap_fill_point);
|
||||
|
||||
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - TILE_SIZE); // Move token up by a tile
|
||||
break;
|
||||
}
|
||||
else if (i == BOSS_BLIND)
|
||||
case BLIND_STATE_UPCOMING: // Change the select icon to "NEXT"
|
||||
{
|
||||
x_from = x_to;
|
||||
y_from = 30;
|
||||
int x_from = 0;
|
||||
int y_from = 20;
|
||||
|
||||
int x_to = 10 + (i * 5);
|
||||
int y_to = 20;
|
||||
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
|
||||
break;
|
||||
}
|
||||
case BLIND_STATE_SKIPPED: // Change the select icon to "SKIP"
|
||||
{
|
||||
int x_from = 3;
|
||||
int y_from = 20;
|
||||
|
||||
// Copy plain tiles onto the bottom of the raised blind panel to fill the gap created by the raise
|
||||
Rect gap_fill_rect = {x_from, y_from, x_from + rect_width(&SINGLE_BLIND_SELECT_RECT) - 1, y_from}; // - 1 to stay within rect boundaries
|
||||
BG_POINT gap_fill_point = {x_to, y_to};
|
||||
main_bg_se_copy_rect(gap_fill_rect, gap_fill_point);
|
||||
int x_to = 10 + (i * 5);
|
||||
int y_to = 20;
|
||||
|
||||
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - TILE_SIZE); // Move token up by a tile
|
||||
}
|
||||
else if (blinds[i] == BLIND_UPCOMING) // Change the select icon to "NEXT"
|
||||
{
|
||||
int x_from = 0;
|
||||
int y_from = 20;
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
|
||||
break;
|
||||
}
|
||||
case BLIND_STATE_DEFEATED: // Change the select icon to "DEFEATED"
|
||||
{
|
||||
int x_from = 6;
|
||||
int y_from = 20;
|
||||
|
||||
int x_to = 10 + (i * 5);
|
||||
int y_to = 20;
|
||||
int x_to = 10 + (i * 5);
|
||||
int y_to = 20;
|
||||
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
|
||||
}
|
||||
else if (blinds[i] == BLIND_SKIPPED) // Change the select icon to "SKIP"
|
||||
{
|
||||
int x_from = 3;
|
||||
int y_from = 20;
|
||||
|
||||
int x_to = 10 + (i * 5);
|
||||
int y_to = 20;
|
||||
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
|
||||
}
|
||||
else if (blinds[i] == BLIND_DEFEATED) // Change the select icon to "DEFEATED"
|
||||
{
|
||||
int x_from = 6;
|
||||
int y_from = 20;
|
||||
|
||||
int x_to = 10 + (i * 5);
|
||||
int y_to = 20;
|
||||
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1083,17 +1101,17 @@ void deck_shuffle()
|
||||
void increment_blind(enum BlindState increment_reason)
|
||||
{
|
||||
current_blind++;
|
||||
if (current_blind >= MAX_BLINDS)
|
||||
if (current_blind >= BLIND_TYPE_MAX)
|
||||
{
|
||||
current_blind = 0;
|
||||
blinds[0] = BLIND_CURRENT; // Reset the blinds to the first one
|
||||
blinds[1] = BLIND_UPCOMING; // Set the next blind to upcoming
|
||||
blinds[2] = BLIND_UPCOMING; // Set the next blind to upcoming
|
||||
blinds[0] = BLIND_STATE_CURRENT; // Reset the blinds to the first one
|
||||
blinds[1] = BLIND_STATE_UPCOMING; // Set the next blind to upcoming
|
||||
blinds[2] = BLIND_STATE_UPCOMING; // Set the next blind to upcoming
|
||||
}
|
||||
else
|
||||
{
|
||||
blinds[current_blind] = BLIND_CURRENT;
|
||||
blinds[current_blind - 1] = increment_reason;
|
||||
blinds[current_blind] = BLIND_STATE_CURRENT;
|
||||
blinds[current_blind - 1] = increment_reason;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1246,13 +1264,13 @@ void game_init()
|
||||
hands = max_hands;
|
||||
discards = max_discards;
|
||||
|
||||
blind_select_tokens[SMALL_BLIND] = blind_token_new(SMALL_BLIND, CUR_BLIND_TOKEN_POS.x, CUR_BLIND_TOKEN_POS.y, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 3);
|
||||
blind_select_tokens[BIG_BLIND] = blind_token_new(BIG_BLIND, CUR_BLIND_TOKEN_POS.x, CUR_BLIND_TOKEN_POS.y, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 4);
|
||||
blind_select_tokens[BOSS_BLIND] = blind_token_new(BOSS_BLIND, CUR_BLIND_TOKEN_POS.x, CUR_BLIND_TOKEN_POS.y, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 5);
|
||||
blind_select_tokens[BLIND_TYPE_SMALL] = blind_token_new(BLIND_TYPE_SMALL, CUR_BLIND_TOKEN_POS.x, CUR_BLIND_TOKEN_POS.y, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 3);
|
||||
blind_select_tokens[BLIND_TYPE_BIG] = blind_token_new(BLIND_TYPE_BIG, CUR_BLIND_TOKEN_POS.x, CUR_BLIND_TOKEN_POS.y, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 4);
|
||||
blind_select_tokens[BLIND_TYPE_BOSS] = blind_token_new(BLIND_TYPE_BOSS, CUR_BLIND_TOKEN_POS.x, CUR_BLIND_TOKEN_POS.y, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 5);
|
||||
|
||||
obj_hide(blind_select_tokens[SMALL_BLIND]->obj);
|
||||
obj_hide(blind_select_tokens[BIG_BLIND]->obj);
|
||||
obj_hide(blind_select_tokens[BOSS_BLIND]->obj);
|
||||
obj_hide(blind_select_tokens[BLIND_TYPE_SMALL]->obj);
|
||||
obj_hide(blind_select_tokens[BLIND_TYPE_BIG]->obj);
|
||||
obj_hide(blind_select_tokens[BLIND_TYPE_BOSS]->obj);
|
||||
|
||||
game_set_state(game_state);
|
||||
}
|
||||
@@ -1481,7 +1499,7 @@ static void game_playing_handle_round_over()
|
||||
|
||||
if (score >= blind_get_requirement(current_blind, ante))
|
||||
{
|
||||
if (current_blind == BOSS_BLIND)
|
||||
if (current_blind == BLIND_TYPE_BOSS)
|
||||
{
|
||||
if (ante < MAX_ANTE)
|
||||
{
|
||||
@@ -2171,7 +2189,7 @@ void game_round_end()
|
||||
obj_unhide(round_end_blind_token->obj, 0);
|
||||
|
||||
int current_ante = ante;
|
||||
if (current_blind == BOSS_BLIND) current_ante--; // Beating the boss blind increases the ante, so we need to display the previous ante value
|
||||
if (current_blind == BLIND_TYPE_BOSS) current_ante--; // Beating the boss blind increases the ante, so we need to display the previous ante value
|
||||
|
||||
Rect blind_req_rect = ROUND_END_BLIND_REQ_RECT;
|
||||
int blind_req = blind_get_requirement(current_blind, current_ante);
|
||||
@@ -2867,7 +2885,7 @@ void game_shop()
|
||||
|
||||
list_destroy(&shop_jokers);
|
||||
|
||||
increment_blind(BLIND_DEFEATED); // TODO: Move to game_round_end()?
|
||||
increment_blind(BLIND_STATE_DEFEATED); // TODO: Move to game_round_end()?
|
||||
game_set_state(GAME_BLIND_SELECT); // If we reach here, we should go to the blind select state
|
||||
|
||||
break;
|
||||
@@ -2883,7 +2901,7 @@ void game_blind_select()
|
||||
change_background(BG_ID_BLIND_SELECT);
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_UP);
|
||||
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
for (int i = 0; i < BLIND_TYPE_MAX; i++)
|
||||
{
|
||||
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - TILE_SIZE);
|
||||
}
|
||||
@@ -2898,7 +2916,7 @@ void game_blind_select()
|
||||
}
|
||||
case BLIND_SELECT: // Blind select input and selection
|
||||
{
|
||||
if (timer == TM_BLIND_SELECT_START && current_blind == BOSS_BLIND)
|
||||
if (timer == TM_BLIND_SELECT_START && current_blind == BLIND_TYPE_BOSS)
|
||||
{
|
||||
selection_y = 0;
|
||||
}
|
||||
@@ -2908,7 +2926,7 @@ void game_blind_select()
|
||||
{
|
||||
selection_y = 0;
|
||||
}
|
||||
else if (key_hit(KEY_DOWN) && current_blind != BOSS_BLIND)
|
||||
else if (key_hit(KEY_DOWN) && current_blind != BLIND_TYPE_BOSS)
|
||||
{
|
||||
selection_y = 1;
|
||||
}
|
||||
@@ -2920,9 +2938,9 @@ void game_blind_select()
|
||||
timer = TM_ZERO;
|
||||
display_round(++round);
|
||||
}
|
||||
else if (current_blind != BOSS_BLIND)
|
||||
else if (current_blind != BLIND_TYPE_BOSS)
|
||||
{
|
||||
increment_blind(BLIND_SKIPPED);
|
||||
increment_blind(BLIND_STATE_SKIPPED);
|
||||
|
||||
background = UNDEFINED; // Force refresh of the background
|
||||
change_background(BG_ID_BLIND_SELECT);
|
||||
@@ -2933,7 +2951,7 @@ void game_blind_select()
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_UP);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
for (int i = 0; i < BLIND_TYPE_MAX; i++)
|
||||
{
|
||||
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - (TILE_SIZE * 12));
|
||||
}
|
||||
@@ -2964,14 +2982,14 @@ void game_blind_select()
|
||||
blinds_rect.top -= 1; // Because of the raised blind
|
||||
main_bg_se_move_rect_1_tile_vert(blinds_rect, SE_DOWN);
|
||||
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
for (int i = 0; i < BLIND_TYPE_MAX; i++)
|
||||
{
|
||||
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y + TILE_SIZE);
|
||||
}
|
||||
}
|
||||
else if (timer >= MENU_POP_OUT_ANIM_FRAMES)
|
||||
{
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
for (int i = 0; i < BLIND_TYPE_MAX; i++)
|
||||
{
|
||||
obj_hide(blind_select_tokens[i]->obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user