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 { } else {
conversationTextboxSetText(STR_POKER_GAME_AI_ALL_IN); conversationTextboxSetText(STR_POKER_GAME_AI_ALL_IN);
} }
break;
case POKER_TURN_TYPE_CHECK: case POKER_TURN_TYPE_CHECK:
if(turn.bluff) { if(turn.bluff) {

View File

@@ -22,7 +22,6 @@ inline void conversationTextboxInit() {
TEXTBOX_STATE = 0; TEXTBOX_STATE = 0;
// Setup window data // 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(FONT_DATA_POSITION, FONT_IMAGE_TILES, FONT_IMAGE);
set_win_data(BORDER_DATA_POSITION, BORDER_IMAGE_TILES, BORDER_IMAGE); set_win_data(BORDER_DATA_POSITION, BORDER_IMAGE_TILES, BORDER_IMAGE);
} }

View File

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

View File

@@ -11,7 +11,7 @@ inline uint8_t mainGetChar(char c) {
return c - TEXTBOX_FONT_START + FONT_DATA_POSITION; 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; uint8_t suit, number;
if(card >= CARD_DECK_SIZE) { if(card >= CARD_DECK_SIZE) {
@@ -82,40 +82,57 @@ inline void mainBufferChar(uint8_t card, uint8_t *tiles) {
} }
inline void mainDebugDraw() { inline void mainDebugDraw() {
uint8_t j; uint8_t j, i, n;
// DEBUG DRAW // DEBUG DRAW
uint8_t tiles[10]; uint8_t tiles[15];
for(j = 0; j < POKER_PLAYER_COUNT; j++) { char buffer[6];
mainBufferChar(POKER_PLAYERS[j].hand[0], tiles); buffer[0] = '\0';
mainBufferChar(POKER_PLAYERS[j].hand[1], tiles + 2);
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) { if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_FOLDED) == 0) {
tiles[5] = COMMON_TILE_3; tiles[n++] = COMMON_TILE_3;
} else { } else {
tiles[5] = mainGetChar('F'); tiles[n++] = mainGetChar('F');
} }
if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_HAS_BET_THIS_ROUND) == 0) { if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_HAS_BET_THIS_ROUND) == 0) {
tiles[6] = COMMON_TILE_3; tiles[n++] = COMMON_TILE_3;
} else { } else {
tiles[6] = mainGetChar('H'); tiles[n++] = mainGetChar('H');
} }
if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_OUT) == 0) { if((POKER_PLAYERS[j].state & POKER_PLAYER_STATE_OUT) == 0) {
tiles[7] = COMMON_TILE_3; tiles[n++] = COMMON_TILE_3;
} else { } else {
tiles[7] = mainGetChar('O'); tiles[n++] = mainGetChar('O');
} }
if(j == POKER_PLAYER_BETTER) { tiles[n++] = COMMON_TILE_3;
tiles[8] = mainGetChar('<');
} else { // Print chips
tiles[8] = COMMON_TILE_3; 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++) { 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] = COMMON_TILE_3;
tiles[(j*2) + 1] = COMMON_TILE_3; tiles[(j*2) + 1] = COMMON_TILE_3;
} else { } 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() { void main() {
@@ -188,6 +215,6 @@ void main() {
// Update conversation fade effect // Update conversation fade effect
conversationFadeUpdate(); conversationFadeUpdate();
// mainDebugDraw(); mainDebugDraw();
} }
} }

View File

@@ -316,14 +316,15 @@ void pokerAi(uint8_t player, pokerturn_t *turn) {
turn->chips = amount; turn->chips = amount;
turn->confidence = confidence; 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; turn->type = POKER_TURN_TYPE_ALL_IN;
} else if(amount == callBet) { } else if(amount == callBet) {
turn->type = POKER_TURN_TYPE_CALL; turn->type = POKER_TURN_TYPE_CALL;
} else { } else {
turn->type = POKER_TURN_TYPE_BET; turn->type = POKER_TURN_TYPE_BET;
} }
} else if(pokerCanPlayerCheck(player)) { } else if(pokerCanPlayerCheck(player)) {
turn->type = POKER_TURN_TYPE_CHECK; turn->type = POKER_TURN_TYPE_CHECK;
turn->chips = 0; turn->chips = 0;