Started merging new poker code in.
This commit is contained in:
@ -7,9 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "../../../poker/actions/flop.h"
|
||||
#include "../../../poker/turn.h"
|
||||
#include "../../../poker/bet.h"
|
||||
#include "../pokerdiscussion.h"
|
||||
#include "action.h"
|
||||
#include "restack.h"
|
||||
|
@ -7,9 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "../../../poker/actions/flop.h"
|
||||
#include "../../../poker/turn.h"
|
||||
#include "../../../poker/bet.h"
|
||||
#include "../pokerdiscussion.h"
|
||||
#include "action.h"
|
||||
#include "restack.h"
|
||||
|
@ -11,9 +11,6 @@
|
||||
#include "action.h"
|
||||
#include "../pokergame.h"
|
||||
#include "../../../display/animation/queue.h"
|
||||
#include "../../../poker/turn.h"
|
||||
#include "../../../poker/bet.h"
|
||||
#include "../../../poker/actions/flop.h"
|
||||
|
||||
/** Callback for when the queue restack action stars. */
|
||||
void _pokerGameActionRestackOnStart(
|
||||
|
@ -6,10 +6,6 @@
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "action.h"
|
||||
#include "../../../poker/bet.h"
|
||||
#include "../../../poker/actions/round.h"
|
||||
#include "../../../poker/actions/blinds.h"
|
||||
#include "../../../poker/actions/deal.h"
|
||||
#include "../pokerdiscussion.h"
|
||||
#include "bet.h"
|
||||
|
||||
|
@ -18,7 +18,7 @@ void _pokerGameActionStartOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
|
||||
// Begin the match
|
||||
pokerActionMatchAdd(&game->scene.conversation.actionQueue, &game->poker);
|
||||
pokerInit(&game->poker);
|
||||
|
||||
// Say that.
|
||||
data.poker = game;
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "../../../libs.h"
|
||||
#include "../../../vn/conversation/talk.h"
|
||||
#include "../../../display/animation/queue.h"
|
||||
#include "../../../poker/actions/match.h"
|
||||
#include "../pokerdiscussion.h"
|
||||
#include "round.h"
|
||||
#include "action.h"
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "../../../poker/winner.h"
|
||||
#include "../../../poker/poker.h"
|
||||
#include "../pokerdiscussion.h"
|
||||
#include "action.h"
|
||||
#include "round.h"
|
||||
|
@ -20,7 +20,7 @@ void pokerDiscussionGet(
|
||||
case POKER_DISCUSSION_REASON_MATCH_START:
|
||||
discussion->count++;
|
||||
discussion->messages[0] = "Match Start";
|
||||
discussion->players[0] = POKER_DEALER_INDEX;
|
||||
discussion->players[0] = POKER_WORLD_DEALER_INDEX;
|
||||
discussion->emotions[0] = VN_CHARACTER_EMOTION_BORED;
|
||||
break;
|
||||
|
||||
@ -28,7 +28,7 @@ void pokerDiscussionGet(
|
||||
case POKER_DISCUSSION_REASON_ROUND_START:
|
||||
discussion->count++;
|
||||
discussion->messages[0] = "Round Start";
|
||||
discussion->players[0] = POKER_DEALER_INDEX;
|
||||
discussion->players[0] = POKER_WORLD_DEALER_INDEX;
|
||||
discussion->emotions[0] = VN_CHARACTER_EMOTION_BORED;
|
||||
break;
|
||||
|
||||
@ -36,7 +36,7 @@ void pokerDiscussionGet(
|
||||
case POKER_DISCUSSION_REASON_BLINDS_TAKEN:
|
||||
discussion->count++;
|
||||
discussion->messages[0] = "Blinds\nhave been taken.";
|
||||
discussion->players[0] = POKER_DEALER_INDEX;
|
||||
discussion->players[0] = POKER_WORLD_DEALER_INDEX;
|
||||
discussion->emotions[0] = VN_CHARACTER_EMOTION_BORED;
|
||||
break;
|
||||
|
||||
@ -44,7 +44,7 @@ void pokerDiscussionGet(
|
||||
case POKER_DISCUSSION_REASON_DEAL:
|
||||
discussion->count++;
|
||||
discussion->messages[0] = "Cards dealt.";
|
||||
discussion->players[0] = POKER_DEALER_INDEX;
|
||||
discussion->players[0] = POKER_WORLD_DEALER_INDEX;
|
||||
discussion->emotions[0] = VN_CHARACTER_EMOTION_BORED;
|
||||
break;
|
||||
|
||||
@ -88,14 +88,14 @@ void pokerDiscussionGet(
|
||||
case POKER_DISCUSSION_REASON_FLOP:
|
||||
discussion->count++;
|
||||
discussion->messages[0] = "Doing the flop.";
|
||||
discussion->players[0] = POKER_DEALER_INDEX;
|
||||
discussion->players[0] = POKER_WORLD_DEALER_INDEX;
|
||||
discussion->emotions[0] = VN_CHARACTER_EMOTION_ANIME_MOM;
|
||||
break;
|
||||
|
||||
case POKER_DISCUSSION_REASON_BETTING_DONE:
|
||||
discussion->count++;
|
||||
discussion->messages[0] = "Winner Winner Chicken Dinner";
|
||||
discussion->players[0] = POKER_DEALER_INDEX;
|
||||
discussion->players[0] = POKER_WORLD_DEALER_INDEX;
|
||||
discussion->emotions[0] = VN_CHARACTER_EMOTION_SMUG_VERY;
|
||||
break;
|
||||
|
||||
@ -103,7 +103,7 @@ void pokerDiscussionGet(
|
||||
default:
|
||||
discussion->count++;
|
||||
discussion->messages[0] = "Hmm, this seems to be an error message.";
|
||||
discussion->players[0] = POKER_DEALER_INDEX;
|
||||
discussion->players[0] = POKER_WORLD_DEALER_INDEX;
|
||||
discussion->emotions[0] = VN_CHARACTER_EMOTION_CONCERNED_WORRIED;
|
||||
break;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "../../vn/conversation/vnconversation.h"
|
||||
#include "../../vn/conversation/talk.h"
|
||||
#include "actions/look.h"
|
||||
#include "../../poker/turn.h"
|
||||
|
||||
/** Maximum number of messages that the discussion buffer can hold */
|
||||
#define POKER_DISCUSSION_MESSAGE_COUNT_MAX 32
|
||||
|
@ -35,7 +35,7 @@ void pokerUiInit(pokerui_t *ui) {
|
||||
labelInit(&ui->label);
|
||||
|
||||
// Initialize the frames for each player.
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
frameBufferInit(ui->frames + i,
|
||||
POKER_UI_PLAYER_IMAGE_RESOLUTION,
|
||||
POKER_UI_PLAYER_IMAGE_RESOLUTION
|
||||
@ -65,7 +65,7 @@ void pokerUiUpdate(
|
||||
// Render the face of each player.
|
||||
j = 0;
|
||||
shaderUse(shader);
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
player = players + j;
|
||||
|
||||
// Locate the XYZ position of the camera to look at the player
|
||||
@ -108,100 +108,102 @@ void pokerUiRender(
|
||||
scale = fontGetScale(FONT_SIZE_DEFAULT);
|
||||
|
||||
// <testing>
|
||||
if(poker->state >= POKER_STATE_DEALING) {
|
||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||
player = poker->players + j;
|
||||
for(i = 0; i < player->cardCount; i++) {
|
||||
pokerUiSetImageToCard(&ui->card,&assets->cardTexture,player->cards[i]);
|
||||
imageRender(&ui->card, &assets->shader, i * 64.0f, j * 100.0f);
|
||||
}
|
||||
}
|
||||
// if(poker->state >= POKER_STATE_DEALING) {
|
||||
// for(j = 0; j < POKER_PLAYER_COUNT_MAX; j++) {
|
||||
// player = poker->players + j;
|
||||
// for(i = 0; i < player->cardCount; i++) {
|
||||
// pokerUiSetImageToCard(&ui->card,&assets->cardTexture,player->cards[i]);
|
||||
// imageRender(&ui->card, &assets->shader, i * 64.0f, j * 100.0f);
|
||||
// }
|
||||
// }
|
||||
|
||||
for(j = 0; j < poker->dealer.cardsFacing; j++) {
|
||||
pokerUiSetImageToCard(
|
||||
&ui->card, &assets->cardTexture, poker->dealer.cards[j]
|
||||
);
|
||||
imageRender(&ui->card, &assets->shader, 200, j * 100.0f);
|
||||
}
|
||||
}
|
||||
// for(j = 0; j < poker->communitySize; j++) {
|
||||
// pokerUiSetImageToCard(
|
||||
// &ui->card, &assets->cardTexture, poker->community[j]
|
||||
// );
|
||||
// imageRender(&ui->card, &assets->shader, 200, j * 100.0f);
|
||||
// }
|
||||
// // }
|
||||
|
||||
// Betting UI
|
||||
if(ui->betShow) {
|
||||
sprintf(message, "Press down to fold, up to raise, right to check/call.");
|
||||
labelSetText(&ui->label, &assets->font, message);
|
||||
labelRender(&ui->label, &assets->shader, 300, 100);
|
||||
// // Betting UI
|
||||
// if(ui->betShow) {
|
||||
// sprintf(message, "Press down to fold, up to raise, right to check/call.");
|
||||
// labelSetText(&ui->label, &assets->font, message);
|
||||
// labelRender(&ui->label, &assets->shader, 300, 100);
|
||||
|
||||
if(inputIsPressed(&engine->input, INPUT_DOWN)) {
|
||||
ui->betTurn = pokerTurnFold(poker, poker->bet.better);
|
||||
ui->betTurnMade = true;
|
||||
} else if(inputIsPressed(&engine->input, INPUT_RIGHT)) {
|
||||
if(pokerTurnCanPlayerCheck(poker, poker->bet.better)) {
|
||||
ui->betTurn = pokerTurnCheck(poker, poker->bet.better);
|
||||
} else {
|
||||
ui->betTurn = pokerTurnCall(poker, poker->bet.better);
|
||||
}
|
||||
ui->betTurnMade = true;
|
||||
}
|
||||
// if(inputIsPressed(&engine->input, INPUT_DOWN)) {
|
||||
// ui->betTurn = pokerTurnFold(poker, poker->bet.better);
|
||||
// ui->betTurnMade = true;
|
||||
// } else if(inputIsPressed(&engine->input, INPUT_RIGHT)) {
|
||||
// if(pokerTurnCanPlayerCheck(poker, poker->bet.better)) {
|
||||
// ui->betTurn = pokerTurnCheck(poker, poker->bet.better);
|
||||
// } else {
|
||||
// ui->betTurn = pokerTurnCall(poker, poker->bet.better);
|
||||
// }
|
||||
// ui->betTurnMade = true;
|
||||
// }
|
||||
|
||||
if(ui->betTurnMade) ui->betShow = false;
|
||||
}
|
||||
// if(ui->betTurnMade) ui->betShow = false;
|
||||
// }
|
||||
|
||||
// Player UI
|
||||
j = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
// Get the player.
|
||||
player = poker->players + i;
|
||||
// // Player UI
|
||||
// j = 0;
|
||||
// for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
// // Get the player.
|
||||
// player = poker->players + i;
|
||||
|
||||
// Position the grid itself.
|
||||
x = engine->render.width - POKER_UI_PLAYER_WIDTH;
|
||||
y = (float)(POKER_UI_PLAYER_HEIGHT * j);
|
||||
// // Position the grid itself.
|
||||
// x = engine->render.width - POKER_UI_PLAYER_WIDTH;
|
||||
// y = (float)(POKER_UI_PLAYER_HEIGHT * j);
|
||||
|
||||
// Render face
|
||||
gridGetChild(&ui->grid, 1, 0, 1, 2, &gx, &gy, &gw, &gh);
|
||||
shaderUseTexture(&assets->shader, &(ui->frames + j)->texture);
|
||||
shaderUsePosition(&assets->shader, x + gx, y + gy, 0, 0,0,0);
|
||||
primitiveDraw(&ui->quad, 0, -1);
|
||||
// // Render face
|
||||
// gridGetChild(&ui->grid, 1, 0, 1, 2, &gx, &gy, &gw, &gh);
|
||||
// shaderUseTexture(&assets->shader, &(ui->frames + j)->texture);
|
||||
// shaderUsePosition(&assets->shader, x + gx, y + gy, 0, 0,0,0);
|
||||
// primitiveDraw(&ui->quad, 0, -1);
|
||||
|
||||
// Render chips
|
||||
sprintf(message, "$%i", player->chips);
|
||||
ui->label.maxWidth = -1;
|
||||
labelSetText(&ui->label, &assets->font, message);
|
||||
align = gridGetAndAlignChild(
|
||||
&ui->grid, 0, 0, 1, 1,
|
||||
ALIGN_POS_END|ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER|ALIGN_SIZE_ORIGINAL,
|
||||
ui->label.info.width, ui->label.info.height
|
||||
);
|
||||
labelRender(&ui->label, &assets->shader, x+align.x, y+align.y);
|
||||
// // Render chips
|
||||
// sprintf(message, "$%i", player->chips);
|
||||
// ui->label.maxWidth = -1;
|
||||
// labelSetText(&ui->label, &assets->font, message);
|
||||
// align = gridGetAndAlignChild(
|
||||
// &ui->grid, 0, 0, 1, 1,
|
||||
// ALIGN_POS_END|ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER|ALIGN_SIZE_ORIGINAL,
|
||||
// ui->label.info.width, ui->label.info.height
|
||||
// );
|
||||
// labelRender(&ui->label, &assets->shader, x+align.x, y+align.y);
|
||||
|
||||
// Render state
|
||||
if(player->state & POKER_PLAYER_STATE_OUT) {
|
||||
sprintf(message, "Out");
|
||||
} else if(player->state & POKER_PLAYER_STATE_FOLDED) {
|
||||
sprintf(message, "Folded");
|
||||
} else if(player->state & POKER_PLAYER_STATE_SHOWING) {
|
||||
sprintf(message, "Showing");
|
||||
} else if(poker->bet.better == j) {
|
||||
sprintf(message, "Thinking");
|
||||
} else {
|
||||
sprintf(message, "Whatever");
|
||||
}
|
||||
labelSetText(&ui->label, &assets->font, message);
|
||||
align = gridGetAndAlignChild(
|
||||
&ui->grid, 0, 1, 1, 1,
|
||||
ALIGN_POS_END | ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER | ALIGN_SIZE_ORIGINAL,
|
||||
ui->label.info.width, ui->label.info.height
|
||||
);
|
||||
labelRender(&ui->label, &assets->shader, x+align.x, y+align.y);
|
||||
// // Render state
|
||||
// if(player->state & POKER_PLAYER_STATE_OUT) {
|
||||
// sprintf(message, "Out");
|
||||
// } else if(player->state & POKER_PLAYER_STATE_FOLDED) {
|
||||
// sprintf(message, "Folded");
|
||||
// } else if(player->state & POKER_PLAYER_STATE_SHOWING) {
|
||||
// sprintf(message, "Showing");
|
||||
// } else if(poker->bet.better == j) {
|
||||
// sprintf(message, "Thinking");
|
||||
// } else {
|
||||
// sprintf(message, "Whatever");
|
||||
// }
|
||||
// labelSetText(&ui->label, &assets->font, message);
|
||||
// align = gridGetAndAlignChild(
|
||||
// &ui->grid, 0, 1, 1, 1,
|
||||
// ALIGN_POS_END | ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER | ALIGN_SIZE_ORIGINAL,
|
||||
// ui->label.info.width, ui->label.info.height
|
||||
// );
|
||||
// labelRender(&ui->label, &assets->shader, x+align.x, y+align.y);
|
||||
|
||||
// Increment.
|
||||
j++;
|
||||
}
|
||||
// // Increment.
|
||||
// j++;
|
||||
// }
|
||||
}
|
||||
|
||||
void pokerUiDispose(pokerui_t *ui) {
|
||||
uint8_t i;
|
||||
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) frameBufferDispose(ui->frames + i);
|
||||
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
frameBufferDispose(ui->frames + i);
|
||||
}
|
||||
labelDispose(&ui->label);
|
||||
primitiveDispose(&ui->quad);
|
||||
imageDispose(&ui->card);
|
||||
|
@ -20,11 +20,8 @@
|
||||
#include "../../vn/vncharacter.h"
|
||||
#include "../../ui/grid.h"
|
||||
#include "../../ui/align.h"
|
||||
#include "../../poker/player.h"
|
||||
#include "../../poker/poker.h"
|
||||
#include "../../poker/bet.h"
|
||||
#include "../../poker/turn.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
#include "../../poker/poker.h"
|
||||
#include "pokerworld.h"
|
||||
#include "pokergameassets.h"
|
||||
|
||||
@ -47,7 +44,7 @@ typedef struct {
|
||||
label_t label;
|
||||
grid_t grid;
|
||||
image_t card;
|
||||
framebuffer_t frames[POKER_PLAYER_COUNT];
|
||||
framebuffer_t frames[POKER_PLAYER_COUNT_MAX];
|
||||
|
||||
/** Betting UI */
|
||||
bool betShow;
|
||||
|
@ -22,7 +22,7 @@ void pokerWorldInit(
|
||||
skywallInit(&world->skywall);
|
||||
|
||||
// Initialize the players
|
||||
for(i = 0x00; i < POKER_PLAYER_COUNT; i++) {
|
||||
for(i = 0x00; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
character = scene->characters + scene->characterCount;
|
||||
vnCharacterInit(character, &assets->pennyTexture,
|
||||
POKER_WORLD_PENNY_BASE_WIDTH, POKER_WORLD_PENNY_BASE_HEIGHT,
|
||||
|
@ -13,9 +13,8 @@
|
||||
#include "../../display/primitives/skywall.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
#include "../../vn/vncharacter.h"
|
||||
#include "../../poker/player.h"
|
||||
#include "../../poker/dealer.h"
|
||||
#include "../../engine/engine.h"
|
||||
#include "../../poker/poker.h"
|
||||
#include "pokergameassets.h"
|
||||
|
||||
/** How far away from the camera are the characters distanced */
|
||||
@ -39,14 +38,16 @@
|
||||
#define POKER_WORLD_SEAT_COUNT 8
|
||||
|
||||
/** The seat index for a given player index */
|
||||
#define POKER_WORLD_SEAT_FOR_PLAYER(p) (p - (POKER_PLAYER_COUNT/2))
|
||||
#define POKER_WORLD_SEAT_FOR_PLAYER(p) (p - (POKER_PLAYER_COUNT_MAX/2))
|
||||
|
||||
/** The seat that the dealer occupies */
|
||||
#define POKER_WORLD_SEAT_DEALER POKER_WORLD_SEAT_FOR_PLAYER(POKER_DEALER_INDEX)
|
||||
#define POKER_WORLD_SEAT_DEALER POKER_WORLD_SEAT_FOR_PLAYER(\
|
||||
POKER_WORLD_DEALER_INDEX\
|
||||
)
|
||||
|
||||
/** The seat index for a given character index */
|
||||
#define pokerWorldSeatFromIndex(i) (\
|
||||
i == POKER_DEALER_INDEX ? \
|
||||
i == POKER_WORLD_DEALER_INDEX ? \
|
||||
POKER_WORLD_SEAT_DEALER : \
|
||||
POKER_WORLD_SEAT_FOR_PLAYER(i) \
|
||||
)
|
||||
|
Reference in New Issue
Block a user