hate
This commit is contained in:
BIN
assets/images/card_back_small.png
Normal file
BIN
assets/images/card_back_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 178 B |
BIN
assets/images/card_back_small.pxo
Normal file
BIN
assets/images/card_back_small.pxo
Normal file
Binary file not shown.
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
void conversationQueueGameBegin() {
|
void conversationQueueGameBegin() {
|
||||||
char buffer[TEXTBOX_BUFFER_MAX];
|
char buffer[TEXTBOX_BUFFER_MAX];
|
||||||
sprintf(STR_GAME_BEGIN, POKER_GAME_BLINDS_CURRENT * 2, POKER_GAME_BLINDS_CURRENT);
|
sprintf(buffer, STR_GAME_BEGIN, POKER_GAME_BLINDS_CURRENT * 2, POKER_GAME_BLINDS_CURRENT);
|
||||||
conversationTextboxSetText(buffer);
|
conversationTextboxSetText(buffer);
|
||||||
|
QUEUE_ITEM = QUEUE_DEAL_CARDS;
|
||||||
}
|
}
|
@@ -23,7 +23,7 @@ void conversationQueueDebug() {
|
|||||||
|
|
||||||
void conversationQueueDealCards() {
|
void conversationQueueDealCards() {
|
||||||
QUEUE_ITEM = QUEUE_BEGIN_BETTING;
|
QUEUE_ITEM = QUEUE_BEGIN_BETTING;
|
||||||
conversationTextboxSetText(STR_POKER_GAME_CARDS_DEALT);
|
conversationQueueNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void conversationQueueStart() {
|
void conversationQueueStart() {
|
||||||
|
19
src/drawing/playerchips.c
Normal file
19
src/drawing/playerchips.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2022 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "playerchips.h"
|
||||||
|
|
||||||
|
// POKER_HUMAN_INDEX
|
||||||
|
inline void playerChipsDraw() {
|
||||||
|
char stringBuffer[24];
|
||||||
|
char tileBuffer[24];// TODO convert magics into a definition
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
sprintf(stringBuffer, STR_CHIPS_DISPLAY, POKER_PLAYERS[POKER_HUMAN_INDEX].chips);
|
||||||
|
i = spriteFontBufferStringToTiles(stringBuffer, tileBuffer);
|
||||||
|
spriteBufferBackground(0x00, 0x0C, i, 0x01, tileBuffer);
|
||||||
|
}
|
15
src/drawing/playerchips.h
Normal file
15
src/drawing/playerchips.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2022 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "../libs.h"
|
||||||
|
#include "../sprites/spritefont.h"
|
||||||
|
#include "../poker/poker.h"
|
||||||
|
#include "../strings.h"
|
||||||
|
#include "../sprites/sprites.h"
|
||||||
|
|
||||||
|
inline void playerChipsDraw();
|
15
src/drawing/playerdeal.c
Normal file
15
src/drawing/playerdeal.c
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2022 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "playerdeal.h"
|
||||||
|
|
||||||
|
const uint8_t DEAL_CARD_X = 0x00;
|
||||||
|
const uint8_t DEAL_CARD_Y = 0x00;
|
||||||
|
|
||||||
|
void playerDealCardRender() {
|
||||||
|
|
||||||
|
}
|
16
src/drawing/playerdeal.h
Normal file
16
src/drawing/playerdeal.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2022 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "../libs.h"
|
||||||
|
#include "../poker/poker.h"
|
||||||
|
|
||||||
|
#define PLAYER_DEAL_SPRITE_0 0x00
|
||||||
|
#define PLAYER_DEAL_SPRITE_1 PLAYER_DEAL_SPRITE_0 + 0x01
|
||||||
|
|
||||||
|
extern const uint8_t DEAL_CARD_X;
|
||||||
|
extern const uint8_t DEAL_CARD_Y;
|
@@ -10,6 +10,7 @@
|
|||||||
void interruptOnScanline() {
|
void interruptOnScanline() {
|
||||||
if(LYC_REG == 0) {
|
if(LYC_REG == 0) {
|
||||||
LCDC_REG |= LCDCF_BG8000;
|
LCDC_REG |= LCDCF_BG8000;
|
||||||
|
|
||||||
if((TEXTBOX_STATE & TEXTBOX_STATE_VISIBLE) != 0) {
|
if((TEXTBOX_STATE & TEXTBOX_STATE_VISIBLE) != 0) {
|
||||||
LYC_REG = INTERRUPT_TEXTBOX_VRAM;
|
LYC_REG = INTERRUPT_TEXTBOX_VRAM;
|
||||||
}
|
}
|
||||||
|
32
src/main.c
32
src/main.c
@@ -6,7 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "drawing/playerchips.h"
|
||||||
|
#include "sprites/sprites.h"
|
||||||
|
#include "sprites/spritecardsmall.h"
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
int16_t j;
|
int16_t j;
|
||||||
@@ -18,14 +20,7 @@ void main() {
|
|||||||
// Create a critical section for some video stuff
|
// Create a critical section for some video stuff
|
||||||
CRITICAL {
|
CRITICAL {
|
||||||
DISPLAY_OFF;
|
DISPLAY_OFF;
|
||||||
LCDC_REG = LCDCF_OFF | LCDCF_WIN9C00 | LCDCF_BG8000 | LCDCF_BG9800 | LCDCF_BGON;
|
LCDC_REG = LCDCF_OFF | LCDCF_WIN9C00 | LCDCF_BG8000 | LCDCF_BG9800 | LCDCF_BGON | LCDCF_OBJ16 | LCDCF_OBJON;
|
||||||
/*
|
|
||||||
* LCD = Off
|
|
||||||
* WindowBank = 0x9C00
|
|
||||||
* BG Chr = 0x8800
|
|
||||||
* BG Bank = 0x9800
|
|
||||||
* BG = On
|
|
||||||
*/
|
|
||||||
|
|
||||||
STAT_REG |= STATF_LYC;
|
STAT_REG |= STATF_LYC;
|
||||||
LYC_REG = 0x00;
|
LYC_REG = 0x00;
|
||||||
@@ -48,6 +43,7 @@ void main() {
|
|||||||
spriteCardsBuffer();
|
spriteCardsBuffer();
|
||||||
spriteFontBuffer();
|
spriteFontBuffer();
|
||||||
spriteBorderBuffer();
|
spriteBorderBuffer();
|
||||||
|
spriteCardSmallBuffer();
|
||||||
|
|
||||||
conversationTextboxInit();
|
conversationTextboxInit();
|
||||||
conversationQueueInit();
|
conversationQueueInit();
|
||||||
@@ -59,11 +55,6 @@ void main() {
|
|||||||
}
|
}
|
||||||
spriteBufferBackground(0x00, 0x00, GB_BACKGROUND_COLUMNS, GB_BACKGROUND_ROWS, filled);
|
spriteBufferBackground(0x00, 0x00, GB_BACKGROUND_COLUMNS, GB_BACKGROUND_ROWS, filled);
|
||||||
|
|
||||||
// Card Test
|
|
||||||
uint8_t cardTiles[SPRITE_CARD_TILE_COUNT];
|
|
||||||
spriteCardBufferTiles(cardTiles, CARD_SPADES_QUEEN);
|
|
||||||
spriteBufferBackground(0x00, 0x00, SPRITE_CARD_WIDTH, SPRITE_CARD_HEIGHT, cardTiles);
|
|
||||||
|
|
||||||
// Now turn the screen on
|
// Now turn the screen on
|
||||||
DISPLAY_ON;
|
DISPLAY_ON;
|
||||||
enable_interrupts();
|
enable_interrupts();
|
||||||
@@ -72,11 +63,21 @@ void main() {
|
|||||||
// Begin game
|
// Begin game
|
||||||
conversationQueueNext();
|
conversationQueueNext();
|
||||||
|
|
||||||
|
spriteBufferSprite(0x00, SPRITE_CARD_SMALL);
|
||||||
|
spriteBufferSprite(0x01, SPRITE_CARD_SMALL);
|
||||||
|
set_sprite_prop(0x01, S_FLIPX);
|
||||||
|
|
||||||
// Begin the loop
|
// Begin the loop
|
||||||
while(1) {
|
while(1) {
|
||||||
// Perform non-graphical code updates
|
// Perform non-graphical code updates
|
||||||
wait_vbl_done();
|
wait_vbl_done();
|
||||||
|
|
||||||
|
uint8_t posX, posY;
|
||||||
|
posX = 16;
|
||||||
|
posY = 16;
|
||||||
|
move_sprite(0x00, posX, posY);
|
||||||
|
move_sprite(0x01, posX + 0x08, posY);
|
||||||
|
|
||||||
// Update the input state
|
// Update the input state
|
||||||
INPUT_LAST = INPUT_STATE;
|
INPUT_LAST = INPUT_STATE;
|
||||||
INPUT_STATE = joypad();
|
INPUT_STATE = joypad();
|
||||||
@@ -94,7 +95,6 @@ void main() {
|
|||||||
|
|
||||||
// Update conversation fade effect
|
// Update conversation fade effect
|
||||||
conversationFadeUpdate();
|
conversationFadeUpdate();
|
||||||
// mainDebugDraw();
|
playerChipsDraw();
|
||||||
LCDC_REG |= LCDCF_BG8000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -13,6 +13,7 @@
|
|||||||
#include "../sprites.h"
|
#include "../sprites.h"
|
||||||
|
|
||||||
#define SPRITE_CARD_VRAM_START SPRITE_TILESET_VRAM_END_LOW
|
#define SPRITE_CARD_VRAM_START SPRITE_TILESET_VRAM_END_LOW
|
||||||
|
#define SPRITE_CARD_VRAM_END SPRITE_CARD_VRAM_START + CARDS_TILES_IMAGE_TILES
|
||||||
#define SPRITE_CARD_BLANK SPRITE_TILESET_WHITE_LOW
|
#define SPRITE_CARD_BLANK SPRITE_TILESET_WHITE_LOW
|
||||||
|
|
||||||
// Information about the card as a tilemap
|
// Information about the card as a tilemap
|
||||||
|
13
src/sprites/spritecardsmall.c
Normal file
13
src/sprites/spritecardsmall.c
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2022 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "spritecardsmall.h"
|
||||||
|
|
||||||
|
inline void spriteCardSmallBuffer() {
|
||||||
|
spriteBufferLow(SPRITE_CARD_SMALL_VRAM_START, CARD_BACK_SMALL_IMAGE_TILES, CARD_BACK_SMALL_IMAGE);
|
||||||
|
}
|
||||||
|
|
19
src/sprites/spritecardsmall.h
Normal file
19
src/sprites/spritecardsmall.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2022 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "../libs.h"
|
||||||
|
#include "sprites.h"
|
||||||
|
#include "CARD_BACK_SMALL.h"
|
||||||
|
#include "spritecards.h"
|
||||||
|
|
||||||
|
#define SPRITE_CARD_SMALL_VRAM_START SPRITE_CARD_VRAM_END
|
||||||
|
#define SPRITE_CARD_SMALL_VRAM_END SPRITE_CARD_SMALL_VRAM_START + CARD_BACK_SMALL_IMAGE_TILES
|
||||||
|
|
||||||
|
#define SPRITE_CARD_SMALL SPRITE_CARD_SMALL_VRAM_START
|
||||||
|
|
||||||
|
inline void spriteCardSmallBuffer();
|
@@ -14,3 +14,15 @@ inline void spriteFontBuffer() {
|
|||||||
inline uint8_t spriteFontTileFromChar(char character) {
|
inline uint8_t spriteFontTileFromChar(char character) {
|
||||||
return character - SPRITE_FONT_FIRST_CHARACTER + SPRITE_FONT_VRAM_START;
|
return character - SPRITE_FONT_FIRST_CHARACTER + SPRITE_FONT_VRAM_START;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint8_t spriteFontBufferStringToTiles(char *string, char *tiles) {
|
||||||
|
char c;
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while((c = string[i]) != '\0') {
|
||||||
|
tiles[i++] = spriteFontTileFromChar(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
@@ -29,3 +29,13 @@ inline void spriteFontBuffer();
|
|||||||
* @return The tile index for the given character.
|
* @return The tile index for the given character.
|
||||||
*/
|
*/
|
||||||
inline uint8_t spriteFontTileFromChar(char character);
|
inline uint8_t spriteFontTileFromChar(char character);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Buffers a character array into a tile array, does not care about length nor
|
||||||
|
* newlines, you will need to handle this yourself.
|
||||||
|
*
|
||||||
|
* @param string String to buffer.
|
||||||
|
* @param tiles Tile array to buffer in to.
|
||||||
|
* @return The length of the string.
|
||||||
|
*/
|
||||||
|
inline uint8_t spriteFontBufferStringToTiles(char *string, char *tiles);
|
@@ -44,3 +44,7 @@ inline void spriteBufferWindow(
|
|||||||
tiles
|
tiles
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void spriteBufferSprite(uint8_t spriteIndex, uint8_t tile) {
|
||||||
|
set_sprite_tile(spriteIndex, tile);
|
||||||
|
}
|
@@ -44,3 +44,5 @@ inline void spriteBufferWindow(
|
|||||||
uint8_t width, uint8_t height,
|
uint8_t width, uint8_t height,
|
||||||
uint8_t *tiles
|
uint8_t *tiles
|
||||||
);
|
);
|
||||||
|
|
||||||
|
inline void spriteBufferSprite(uint8_t spriteIndex, uint8_t tile);
|
@@ -7,16 +7,11 @@
|
|||||||
|
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
|
|
||||||
const char STR_GAME_BEGIN[] = "The blinds are set %u for the big, and %u for the small blinds.";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char STR_ERROR[] = "An error\nhas occured";
|
const char STR_ERROR[] = "An error\nhas occured";
|
||||||
|
const char STR_GAME_BEGIN[] = "The blinds are set %u for the big, and %u for the small blinds.";
|
||||||
|
const char STR_CHIPS_DISPLAY[] = "Chips $%u";
|
||||||
|
|
||||||
|
|
||||||
const char STR_HELLO[] = "Hello World, How are you today?\nGood thanks. Thank god!";
|
const char STR_HELLO[] = "Hello World, How are you today?\nGood thanks. Thank god!";
|
||||||
|
|
||||||
const char STR_POKER_GAME_START[] = "Poker game started";
|
const char STR_POKER_GAME_START[] = "Poker game started";
|
||||||
|
@@ -8,14 +8,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
|
|
||||||
extern const char STR_GAME_BEGIN[];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern const char STR_ERROR[];
|
extern const char STR_ERROR[];
|
||||||
|
extern const char STR_GAME_BEGIN[];
|
||||||
|
extern const char STR_CHIPS_DISPLAY[];
|
||||||
|
|
||||||
|
|
||||||
extern const char STR_HELLO[];
|
extern const char STR_HELLO[];
|
||||||
|
|
||||||
extern const char STR_POKER_GAME_START[];
|
extern const char STR_POKER_GAME_START[];
|
||||||
|
Reference in New Issue
Block a user