Fixed all in text display

This commit is contained in:
2022-04-27 20:17:08 -07:00
parent 1da7b6a8b4
commit f909451fba
5 changed files with 54 additions and 26 deletions

View File

@@ -78,6 +78,7 @@ void conversationQueueBeginBetting() {
} else {
conversationTextboxSetText(STR_POKER_GAME_AI_ALL_IN);
}
break;
case POKER_TURN_TYPE_CHECK:
if(turn.bluff) {

View File

@@ -22,7 +22,6 @@ inline void conversationTextboxInit() {
TEXTBOX_STATE = 0;
// Setup window data
// move_win(7, SCREENHEIGHT - (TEXTBOX_HEIGHT_IN_TILES * 8));
set_win_data(FONT_DATA_POSITION, FONT_IMAGE_TILES, FONT_IMAGE);
set_win_data(BORDER_DATA_POSITION, BORDER_IMAGE_TILES, BORDER_IMAGE);
}
@@ -89,7 +88,7 @@ void conversationTextboxSetText(char *text) {
inline void textboxFillBlank() {
uint8_t TEXTBOX_TILES[TEXTBOX_WIDTH_IN_TILES * TEXTBOX_HEIGHT_IN_TILES];
frameBuffer(TEXTBOX_TILES, TEXTBOX_WIDTH_IN_TILES, TEXTBOX_HEIGHT_IN_TILES, TEXTBOX_TILE_BLANK);
set_bkg_tiles(

View File

@@ -9,7 +9,7 @@
#include <gb/gb.h>
#include <gb/bgb_emu.h>
#include <stdint.h>
// #include <stdio.h>
#include <stdio.h>
#include <stdbool.h>
#include <rand.h>
#include <string.h>

View File

@@ -11,7 +11,7 @@ inline uint8_t mainGetChar(char c) {
return c - TEXTBOX_FONT_START + FONT_DATA_POSITION;
}
inline void mainBufferChar(uint8_t card, uint8_t *tiles) {
inline void mainBufferCard(uint8_t card, uint8_t *tiles) {
uint8_t suit, number;
if(card >= CARD_DECK_SIZE) {
@@ -82,40 +82,57 @@ inline void mainBufferChar(uint8_t card, uint8_t *tiles) {
}
inline void mainDebugDraw() {
uint8_t j;
uint8_t j, i, n;
// DEBUG DRAW
uint8_t tiles[10];
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
mainBufferChar(POKER_PLAYERS[j].hand[0], tiles);
mainBufferChar(POKER_PLAYERS[j].hand[1], tiles + 2);
uint8_t tiles[15];
char buffer[6];
buffer[0] = '\0';
tiles[4] = COMMON_TILE_3;
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
n = 0;
if(j == POKER_PLAYER_BETTER) {
tiles[n++] = mainGetChar('>');
} else {
tiles[n++] = COMMON_TILE_3;
}
mainBufferCard(POKER_PLAYERS[j].hand[0], tiles+n);
n+=2;
mainBufferCard(POKER_PLAYERS[j].hand[1], tiles+n);
n+=2;
tiles[n++] = COMMON_TILE_3;
if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_FOLDED) == 0) {
tiles[5] = COMMON_TILE_3;
tiles[n++] = COMMON_TILE_3;
} else {
tiles[5] = mainGetChar('F');
tiles[n++] = mainGetChar('F');
}
if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_HAS_BET_THIS_ROUND) == 0) {
tiles[6] = COMMON_TILE_3;
tiles[n++] = COMMON_TILE_3;
} else {
tiles[6] = mainGetChar('H');
tiles[n++] = mainGetChar('H');
}
if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_OUT) == 0) {
tiles[7] = COMMON_TILE_3;
tiles[n++] = COMMON_TILE_3;
} else {
tiles[7] = mainGetChar('O');
tiles[n++] = mainGetChar('O');
}
if(j == POKER_PLAYER_BETTER) {
tiles[8] = mainGetChar('<');
} else {
tiles[8] = COMMON_TILE_3;
tiles[n++] = COMMON_TILE_3;
// Print chips
sprintf(buffer, "%u", (uint16_t)POKER_PLAYERS[j].chips);
for(i = 0; i < strlen(buffer); i++) {
tiles[n++] = mainGetChar(buffer[i]);
}
set_bkg_tiles(0x00, j, 9, 1, tiles);
while(n < 15) tiles[n++] = COMMON_TILE_3;
set_bkg_tiles(0x00, j, n - 1, 1, tiles);
}
for(j = 0; j < POKER_COMMUNITY_SIZE_MAX; j++) {
@@ -123,11 +140,21 @@ inline void mainDebugDraw() {
tiles[j*2] = COMMON_TILE_3;
tiles[(j*2) + 1] = COMMON_TILE_3;
} else {
mainBufferChar(POKER_COMMUNITY[j], tiles + (j * 2));
mainBufferCard(POKER_COMMUNITY[j], tiles + (j * 2));
}
}
set_bkg_tiles(0x00, POKER_PLAYER_COUNT + 1, 10, 1, tiles);
set_bkg_tiles(0x00, POKER_PLAYER_COUNT + 1, POKER_COMMUNITY_SIZE_MAX * 2, 1, tiles);
// Print Pot
n = 0;
sprintf(buffer, "%u", (uint16_t)POKER_POTS[POKER_POT_CURRENT].chips);
for(i = 0; i < strlen(buffer); i++) {
tiles[n++] = mainGetChar(buffer[i]);
}
while(n < 5) tiles[n++] = COMMON_TILE_3;
set_bkg_tiles(0x00, POKER_PLAYER_COUNT + 2, n, 1, tiles);
}
void main() {
@@ -188,6 +215,6 @@ void main() {
// Update conversation fade effect
conversationFadeUpdate();
// mainDebugDraw();
mainDebugDraw();
}
}

View File

@@ -316,14 +316,15 @@ void pokerAi(uint8_t player, pokerturn_t *turn) {
turn->chips = amount;
turn->confidence = confidence;
if(amount == plyr->chips) {
BGB_printf("Player chips %u is %u", plyr->chips, amount);
if(plyr->chips == amount) {
turn->type = POKER_TURN_TYPE_ALL_IN;
} else if(amount == callBet) {
turn->type = POKER_TURN_TYPE_CALL;
} else {
turn->type = POKER_TURN_TYPE_BET;
}
} else if(pokerCanPlayerCheck(player)) {
turn->type = POKER_TURN_TYPE_CHECK;
turn->chips = 0;