Added more stuff to the end round, made the blind token a sprite and toned dow n the background animation a bit.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
@@ -1 +1 @@
|
|||||||
-gB8 -mR8 -mRtf -p!
|
-gB4 -Mw4 -Mh4 -p!
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 865 B After Width: | Height: | Size: 597 B |
@@ -1 +1 @@
|
|||||||
-gB4 -Mw4 -Mh4
|
-gB4 -Mw4 -Mh4 -m!
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef BLIND_H
|
||||||
|
#define BLIND_H
|
||||||
|
|
||||||
|
#include "sprite.h"
|
||||||
|
|
||||||
|
enum BlindType
|
||||||
|
{
|
||||||
|
SMALL_BLIND,
|
||||||
|
BIG_BLIND,
|
||||||
|
BOSS_BLIND
|
||||||
|
};
|
||||||
|
|
||||||
|
void blinds_init();
|
||||||
|
|
||||||
|
Sprite *blind_token_new(enum BlindType type, int x, int y, int sprite_index);
|
||||||
|
|
||||||
|
#endif // BLIND_H
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include <tonc.h>
|
||||||
|
|
||||||
|
#include "blind.h"
|
||||||
|
|
||||||
|
#include "blinds_gfx.h"
|
||||||
|
|
||||||
|
void blinds_init()
|
||||||
|
{
|
||||||
|
// Blind graphics
|
||||||
|
// Small Blind (fighting grit every step of the way as usual)
|
||||||
|
//memcpy(&tile_mem[4][832], blinds_gfxTiles, blinds_gfxTilesLen);
|
||||||
|
GRIT_CPY(&tile_mem[4][832], blinds_gfxTiles);
|
||||||
|
const u16 small_blind_token_palette[4] = {0x7FFF, 0x34A1, 0x5DCB, 0x5104};
|
||||||
|
memcpy16(&pal_obj_mem[17], &small_blind_token_palette, sizeof(small_blind_token_palette) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sprite *blind_token_new(enum BlindType type, int x, int y, int sprite_index)
|
||||||
|
{
|
||||||
|
Sprite *sprite = NULL;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case SMALL_BLIND:
|
||||||
|
sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, 832, 1, sprite_index);
|
||||||
|
break;
|
||||||
|
case BIG_BLIND:
|
||||||
|
// Use the big blind sprite
|
||||||
|
break;
|
||||||
|
case BOSS_BLIND:
|
||||||
|
// Use the boss blind sprite
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprite_position(sprite, x, y);
|
||||||
|
|
||||||
|
return sprite;
|
||||||
|
}
|
||||||
+22
-1
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "card.h"
|
#include "card.h"
|
||||||
|
#include "blind.h"
|
||||||
|
|
||||||
#include "background_gfx.h"
|
#include "background_gfx.h"
|
||||||
#include "background_play_gfx.h"
|
#include "background_play_gfx.h"
|
||||||
@@ -18,12 +19,15 @@ static int timer = 1; // This might already exist in libtonc but idk so i'm just
|
|||||||
static int game_speed = 1;
|
static int game_speed = 1;
|
||||||
static int background = 0;
|
static int background = 0;
|
||||||
|
|
||||||
static enum GameState game_state = GAME_PLAYING;
|
static enum GameState game_state = GAME_ROUND_END;
|
||||||
static enum HandState hand_state = HAND_DRAW;
|
static enum HandState hand_state = HAND_DRAW;
|
||||||
static enum PlayState play_state = PLAY_PLAYING;
|
static enum PlayState play_state = PLAY_PLAYING;
|
||||||
|
|
||||||
static enum HandType hand_type = NONE;
|
static enum HandType hand_type = NONE;
|
||||||
|
|
||||||
|
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 int hands = 4;
|
static int hands = 4;
|
||||||
static int discards = 4;
|
static int discards = 4;
|
||||||
|
|
||||||
@@ -549,6 +553,10 @@ void deck_shuffle()
|
|||||||
// Game functions
|
// Game functions
|
||||||
void game_init()
|
void game_init()
|
||||||
{
|
{
|
||||||
|
playing_blind_token = blind_token_new(SMALL_BLIND, 8, 18, 33); // Create the blind token sprite at the top left corner
|
||||||
|
round_end_blind_token = blind_token_new(SMALL_BLIND, 82, 78, 34); // Create the blind token sprite for round end
|
||||||
|
obj_hide(round_end_blind_token->obj); // Hide the blind token sprite for now
|
||||||
|
|
||||||
// Fill the deck with all the cards. Later on this can be replaced with a more dynamic system that allows for different decks and card types.
|
// Fill the deck with all the cards. Later on this can be replaced with a more dynamic system that allows for different decks and card types.
|
||||||
for (int suit = 0; suit < NUM_SUITS; suit++)
|
for (int suit = 0; suit < NUM_SUITS; suit++)
|
||||||
{
|
{
|
||||||
@@ -1304,6 +1312,19 @@ void game_round_end()
|
|||||||
const unsigned short tile_map5[17] = {se_mem[31][8 + 32 * y], 0x0001, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0401};
|
const unsigned short tile_map5[17] = {se_mem[31][8 + 32 * y], 0x0001, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0401};
|
||||||
memcpy(&se_mem[31][8 + 32 * y], tile_map5, sizeof(tile_map5));
|
memcpy(&se_mem[31][8 + 32 * y], tile_map5, sizeof(tile_map5));
|
||||||
}
|
}
|
||||||
|
else if (timer_offset == 30)
|
||||||
|
{
|
||||||
|
obj_unhide(round_end_blind_token->obj, 0);
|
||||||
|
tte_printf("#{P:112,88; cx:0xE000}%d", blind_requirement);
|
||||||
|
|
||||||
|
int y = 12;
|
||||||
|
|
||||||
|
unsigned short tile_map3[17] = {se_mem[31][8 + 32 * (y - 1)], 0x0001, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0015, 0x0401};
|
||||||
|
memcpy(&se_mem[31][8 + 32 * (y - 1)], tile_map3, sizeof(tile_map3));
|
||||||
|
|
||||||
|
const unsigned short tile_map4[17] = {se_mem[31][8 + 32 * y], 0x0001, 0x0054, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0055, 0x0454, 0x0401};
|
||||||
|
memcpy(&se_mem[31][8 + 32 * y], tile_map4, sizeof(tile_map4));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-15
@@ -5,12 +5,13 @@
|
|||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "card.h"
|
#include "card.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "blind.h"
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
#include "deck_gfx.h"
|
#include "deck_gfx.h"
|
||||||
#include "background_gfx.h"
|
#include "background_gfx.h"
|
||||||
#include "background_play_gfx.h"
|
#include "background_play_gfx.h"
|
||||||
#include "nums.h"
|
#include "affine_background_gfx.h"
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
#include "soundbank.h"
|
#include "soundbank.h"
|
||||||
@@ -25,16 +26,16 @@ void init_map() // Temp function ripped from libtonc example
|
|||||||
{
|
{
|
||||||
// Grit is fucking garbage and doesn't allow you to have a palette offset, they all get loaded at 0x0000. I have no manually change each tile's palette bank
|
// Grit is fucking garbage and doesn't allow you to have a palette offset, they all get loaded at 0x0000. I have no manually change each tile's palette bank
|
||||||
|
|
||||||
unsigned int correctedTiles[numsTilesLen / 4];
|
unsigned int correctedTiles[affine_background_gfxTilesLen / 4];
|
||||||
for (int i = 0; i < numsTilesLen / 4; i++)
|
for (int i = 0; i < affine_background_gfxTilesLen / 4; i++)
|
||||||
{
|
{
|
||||||
correctedTiles[i] = numsTiles[i] | 0xF0F0F0F0; // I brute forced this. I have no idea how this would and does work, but it does. We'll just leave this here for now.
|
correctedTiles[i] = affine_background_gfxTiles[i] | 0xF0F0F0F0; // I brute forced this. I have no idea how this would and does work, but it does. We'll just leave this here for now.
|
||||||
// Actually for future reference, each number seems to equate to an XY on the palette, so 0xF0F0F0F0 would just push everything down 15 colors, since the second number isn't set.
|
// Actually for future reference, each number seems to equate to an XY on the palette, so 0xF0F0F0F0 would just push everything down 15 colors, since the second number isn't set.
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&tile8_mem[2], correctedTiles, numsTilesLen);
|
memcpy(&tile8_mem[2], correctedTiles, affine_background_gfxTilesLen);
|
||||||
GRIT_CPY(&se_mem[2], numsMap);
|
GRIT_CPY(&se_mem[2], affine_background_gfxMap);
|
||||||
memcpy16(&pal_bg_mem[16 * 15], numsPal, 5);
|
memcpy16(&pal_bg_mem[16 * 15], affine_background_gfxPal, 5);
|
||||||
|
|
||||||
bgaff = bg_aff_default;
|
bgaff = bg_aff_default;
|
||||||
}
|
}
|
||||||
@@ -62,12 +63,12 @@ void init()
|
|||||||
// Load the tiles and palette
|
// Load the tiles and palette
|
||||||
// Background
|
// Background
|
||||||
memcpy(pal_bg_mem, background_gfxPal, 64); // This '64" isn't a specific number, I'm just using it to prevent the text colors from being overridden
|
memcpy(pal_bg_mem, background_gfxPal, 64); // This '64" isn't a specific number, I'm just using it to prevent the text colors from being overridden
|
||||||
memcpy(&tile8_mem[1], background_gfxTiles, background_gfxTilesLen); // Deadass i have no clue how any of these memory things work but I just messed with them until stuff worked
|
GRIT_CPY(&tile8_mem[1], background_gfxTiles); // Deadass i have no clue how any of these memory things work but I just messed with them until stuff worked
|
||||||
memcpy(&se_mem[31], background_gfxMap, background_gfxMapLen);
|
GRIT_CPY(&se_mem[31], background_gfxMap);
|
||||||
|
|
||||||
// Deck graphics
|
// Deck graphics
|
||||||
memcpy(&tile_mem[4], deck_gfxTiles, deck_gfxTilesLen);
|
GRIT_CPY(&tile_mem[4], deck_gfxTiles);
|
||||||
memcpy(pal_obj_mem, deck_gfxPal, deck_gfxPalLen);
|
GRIT_CPY(pal_obj_mem, deck_gfxPal);
|
||||||
|
|
||||||
// Set up the video mode
|
// Set up the video mode
|
||||||
REG_BG0CNT = BG_PRIO(0) | BG_CBB(0) | BG_SBB(30) | BG_4BPP;
|
REG_BG0CNT = BG_PRIO(0) | BG_CBB(0) | BG_SBB(30) | BG_4BPP;
|
||||||
@@ -103,6 +104,7 @@ void init()
|
|||||||
|
|
||||||
// Initialize subsystems
|
// Initialize subsystems
|
||||||
sprite_init();
|
sprite_init();
|
||||||
|
blinds_init();
|
||||||
game_init();
|
game_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,12 +112,13 @@ void background_update() // This needs to be called before update() and draw() b
|
|||||||
{
|
{
|
||||||
static uint timer = 0;
|
static uint timer = 0;
|
||||||
timer++;
|
timer++;
|
||||||
asx.alpha += 30;
|
|
||||||
asx.tex_x += 78;
|
// These values are not permament, just the current configuration for the affine background
|
||||||
|
asx.tex_x += 5;
|
||||||
asx.tex_y += 12;
|
asx.tex_y += 12;
|
||||||
asx.sx = (lu_sin(timer * 100) * 4 ) >> 8; // Scale the sine value to fit in a s16
|
asx.sx = (lu_sin(timer * 100)) >> 8; // Scale the sine value to fit in a s16
|
||||||
asx.sx += 256; // Add 256 to the sine value to make it positive
|
asx.sx += 256; // Add 256 to the sine value to make it positive
|
||||||
asx.sy = (lu_sin(timer * 100 + 0x4000) * 4 ) >> 8; // Scale the sine value to fit in a s16
|
asx.sy = (lu_sin(timer * 100 + 0x4000)) >> 8; // Scale the sine value to fit in a s16
|
||||||
asx.sy += 256; // Add 256 to the sine value to make it positive
|
asx.sy += 256; // Add 256 to the sine value to make it positive
|
||||||
bg_rotscale_ex(&bgaff, &asx);
|
bg_rotscale_ex(&bgaff, &asx);
|
||||||
REG_BG_AFFINE[2]= bgaff;
|
REG_BG_AFFINE[2]= bgaff;
|
||||||
|
|||||||
Reference in New Issue
Block a user