Slowly renaming things from Holdem to Poker
This commit is contained in:
@ -9,59 +9,59 @@
|
||||
|
||||
void holdemActionInit() {
|
||||
// Free up all actions
|
||||
memset(HOLDEM_GAME_STATE.actionQueue, (int32_t)NULL,
|
||||
sizeof(holdemaction_t) * HOLDEM_GAME_ACTION_QUEUE_SIZE
|
||||
memset(POKER_STATE.actionQueue, (int32_t)NULL,
|
||||
sizeof(pokeraction_t) * POKER_ACTION_QUEUE_SIZE
|
||||
);
|
||||
|
||||
// Free up all data
|
||||
memset(HOLDEM_GAME_STATE.actionData, (int32_t)NULL, sizeof(void *) *
|
||||
HOLDEM_GAME_ACTION_DATA_SIZE * HOLDEM_GAME_ACTION_QUEUE_SIZE
|
||||
memset(POKER_STATE.actionData, (int32_t)NULL, sizeof(void *) *
|
||||
POKER_ACTION_DATA_SIZE * POKER_ACTION_QUEUE_SIZE
|
||||
);
|
||||
}
|
||||
|
||||
int32_t holdemActionAdd(holdemaction_t action) {
|
||||
int32_t holdemActionAdd(pokeraction_t action) {
|
||||
int32_t i = -1;
|
||||
int32_t j = -1;
|
||||
|
||||
for(i = 0; i < HOLDEM_GAME_ACTION_QUEUE_SIZE; i++) {
|
||||
if(HOLDEM_GAME_STATE.actionQueue[i].init != NULL) continue;
|
||||
for(i = 0; i < POKER_ACTION_QUEUE_SIZE; i++) {
|
||||
if(POKER_STATE.actionQueue[i].init != NULL) continue;
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
if(j == -1) return j;
|
||||
|
||||
HOLDEM_GAME_STATE.actionQueue[j] = action;
|
||||
HOLDEM_GAME_STATE.actionInitState[j] = false;
|
||||
POKER_STATE.actionQueue[j] = action;
|
||||
POKER_STATE.actionInitState[j] = false;
|
||||
return j;
|
||||
}
|
||||
|
||||
void holdemActionRemove(int32_t index) {
|
||||
if(HOLDEM_GAME_STATE.actionQueue[index].dispose != NULL) {
|
||||
HOLDEM_GAME_STATE.actionQueue[index].dispose(
|
||||
index, HOLDEM_GAME_STATE.actionData + index
|
||||
if(POKER_STATE.actionQueue[index].dispose != NULL) {
|
||||
POKER_STATE.actionQueue[index].dispose(
|
||||
index, POKER_STATE.actionData + index
|
||||
);
|
||||
}
|
||||
|
||||
memset(HOLDEM_GAME_STATE.actionQueue+index, (int32_t)NULL,
|
||||
sizeof(holdemaction_t)
|
||||
memset(POKER_STATE.actionQueue+index, (int32_t)NULL,
|
||||
sizeof(pokeraction_t)
|
||||
);
|
||||
|
||||
memset(HOLDEM_GAME_STATE.actionData+index, (int32_t)NULL,
|
||||
sizeof(void *) * HOLDEM_GAME_ACTION_DATA_SIZE
|
||||
memset(POKER_STATE.actionData+index, (int32_t)NULL,
|
||||
sizeof(void *) * POKER_ACTION_DATA_SIZE
|
||||
);
|
||||
}
|
||||
|
||||
void holdemActionUpdate() {
|
||||
int32_t i;
|
||||
void **data;
|
||||
holdemaction_t *action;
|
||||
pokeraction_t *action;
|
||||
|
||||
for(i = 0; i < HOLDEM_GAME_ACTION_QUEUE_SIZE; i++) {
|
||||
action = HOLDEM_GAME_STATE.actionQueue + i;
|
||||
data = HOLDEM_GAME_STATE.actionData + i;
|
||||
for(i = 0; i < POKER_ACTION_QUEUE_SIZE; i++) {
|
||||
action = POKER_STATE.actionQueue + i;
|
||||
data = POKER_STATE.actionData + i;
|
||||
|
||||
if(action->init != NULL && !HOLDEM_GAME_STATE.actionInitState[i]) {
|
||||
HOLDEM_GAME_STATE.actionInitState[i] = true;
|
||||
if(action->init != NULL && !POKER_STATE.actionInitState[i]) {
|
||||
POKER_STATE.actionInitState[i] = true;
|
||||
action->init(i, data);
|
||||
}
|
||||
|
||||
@ -73,8 +73,8 @@ void holdemActionUpdate() {
|
||||
|
||||
void holdemActionDispose() {
|
||||
int32_t i;
|
||||
for(i = 0; i < HOLDEM_GAME_ACTION_QUEUE_SIZE; i++) {
|
||||
if(HOLDEM_GAME_STATE.actionQueue[i].dispose == NULL) continue;
|
||||
HOLDEM_GAME_STATE.actionQueue[i].dispose(i, HOLDEM_GAME_STATE.actionData+i);
|
||||
for(i = 0; i < POKER_ACTION_QUEUE_SIZE; i++) {
|
||||
if(POKER_STATE.actionQueue[i].dispose == NULL) continue;
|
||||
POKER_STATE.actionQueue[i].dispose(i, POKER_STATE.actionData+i);
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ void holdemActionInit();
|
||||
* @param action Action to add to the queue.
|
||||
* @returns The index of the action within the queue, or -1 if failure occured.
|
||||
*/
|
||||
int32_t holdemActionAdd(holdemaction_t action);
|
||||
int32_t holdemActionAdd(pokeraction_t action);
|
||||
|
||||
/**
|
||||
* Removes an action from the action queue.
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "ai.h"
|
||||
|
||||
holdemaction_t actionAi() {
|
||||
return (holdemaction_t){
|
||||
pokeraction_t actionAi() {
|
||||
return (pokeraction_t){
|
||||
.init = &actionAiInit,
|
||||
.update = &actionAiUpdate,
|
||||
.dispose = &actionAiDispose
|
||||
@ -33,7 +33,7 @@ void actionAiUpdate(int32_t index, void *data) {
|
||||
|
||||
void actionAiDispose(int32_t index, void *data) {
|
||||
// Do we need to do a flop?
|
||||
if(HOLDEM_GAME_STATE.cardsFacing < HOLDEM_DEALER_HAND) {
|
||||
if(POKER_STATE.cardsFacing < HOLDEM_DEALER_HAND) {
|
||||
holdemActionAdd(actionFlop());
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
#include "flop.h"
|
||||
#include "../../debug/log.h"
|
||||
|
||||
holdemaction_t actionAi();
|
||||
pokeraction_t actionAi();
|
||||
|
||||
void actionAiInit(int32_t index, void *data);
|
||||
void actionAiUpdate(int32_t index, void *data);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "deal.h"
|
||||
|
||||
holdemaction_t actionDeal() {
|
||||
return (holdemaction_t){
|
||||
pokeraction_t actionDeal() {
|
||||
return (pokeraction_t){
|
||||
.init = &actionDealInit,
|
||||
.update = &actionDealUpdate,
|
||||
.dispose = &actionDealDispose
|
||||
@ -17,18 +17,18 @@ holdemaction_t actionDeal() {
|
||||
|
||||
void actionDealInit(int32_t index, void *data) {
|
||||
uint8_t i, j;
|
||||
holdemplayer_t *player;
|
||||
pokerplayer_t *player;
|
||||
logText("Dealing Cards");
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
for(j = 0; j < HOLDEM_PLAYER_COUNT; j++) {
|
||||
player = HOLDEM_GAME_STATE.players + j;
|
||||
cardDeal(HOLDEM_GAME_STATE.deck,
|
||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||
player = POKER_STATE.players + j;
|
||||
cardDeal(POKER_STATE.deck,
|
||||
player->cards,
|
||||
HOLDEM_GAME_STATE.deckSize,
|
||||
POKER_STATE.deckSize,
|
||||
player->cardCount
|
||||
);
|
||||
HOLDEM_GAME_STATE.deckSize--;
|
||||
POKER_STATE.deckSize--;
|
||||
player->cardCount++;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "action.h"
|
||||
#include "ai.h"
|
||||
|
||||
holdemaction_t actionDeal();
|
||||
pokeraction_t actionDeal();
|
||||
|
||||
void actionDealInit(int32_t i, void *data);
|
||||
void actionDealUpdate(int32_t i, void *data);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "flop.h"
|
||||
|
||||
holdemaction_t actionFlop() {
|
||||
return (holdemaction_t){
|
||||
pokeraction_t actionFlop() {
|
||||
return (pokeraction_t){
|
||||
.init = &actionFlopInit,
|
||||
.update = &actionFlopUpdate,
|
||||
.dispose = &actionFlopDispose
|
||||
@ -20,22 +20,22 @@ void actionFlopInit(int32_t index, void *data) {
|
||||
logText("Flop");
|
||||
|
||||
// Look at the dealer
|
||||
holdemRenderLookHand(&HOLDEM_GAME_STATE.cameraLeft, HOLDEM_GAME_SEAT_DEALER);
|
||||
holdemRenderLookHand(&POKER_STATE.cameraLeft, HOLDEM_GAME_SEAT_DEALER);
|
||||
|
||||
// Do the flop
|
||||
// if(match->cardsFacing >= HOLDEM_DEALER_HAND) return;
|
||||
|
||||
// Burn the card off the top
|
||||
HOLDEM_GAME_STATE.deckSize -= 1;
|
||||
POKER_STATE.deckSize -= 1;
|
||||
|
||||
// Change count depending on facing
|
||||
count = HOLDEM_GAME_STATE.cardsFacing == 0 ? 0x03 : 0x01;
|
||||
count = POKER_STATE.cardsFacing == 0 ? 0x03 : 0x01;
|
||||
|
||||
// Deal
|
||||
for(i = 0; i < count; i++) {
|
||||
cardDeal(HOLDEM_GAME_STATE.deck, HOLDEM_GAME_STATE.cards, HOLDEM_GAME_STATE.deckSize, HOLDEM_GAME_STATE.cardsFacing);
|
||||
HOLDEM_GAME_STATE.deckSize -= 1;
|
||||
HOLDEM_GAME_STATE.cardsFacing += 1;
|
||||
cardDeal(POKER_STATE.deck, POKER_STATE.cards, POKER_STATE.deckSize, POKER_STATE.cardsFacing);
|
||||
POKER_STATE.deckSize -= 1;
|
||||
POKER_STATE.cardsFacing += 1;
|
||||
}
|
||||
|
||||
// Next action
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "action.h"
|
||||
#include "ai.h"
|
||||
|
||||
holdemaction_t actionFlop();
|
||||
pokeraction_t actionFlop();
|
||||
|
||||
void actionFlopInit(int32_t index, void *data);
|
||||
void actionFlopUpdate(int32_t index, void *data);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "round.h"
|
||||
|
||||
holdemaction_t actionRound() {
|
||||
return (holdemaction_t){
|
||||
pokeraction_t actionRound() {
|
||||
return (pokeraction_t){
|
||||
.init = &actionRoundInit,
|
||||
.update = &actionRoundUpdate,
|
||||
.dispose = &actionRoundDispose
|
||||
@ -17,27 +17,27 @@ holdemaction_t actionRound() {
|
||||
|
||||
void actionRoundInit(int32_t index, void *data) {
|
||||
uint8_t i;
|
||||
holdemplayer_t *player;
|
||||
pokerplayer_t *player;
|
||||
|
||||
logText("Round Start");
|
||||
|
||||
// Look at the dealer.
|
||||
holdemRenderLookHand(&HOLDEM_GAME_STATE.cameraLeft, HOLDEM_GAME_SEAT_DEALER);
|
||||
holdemRenderLookHand(&POKER_STATE.cameraLeft, HOLDEM_GAME_SEAT_DEALER);
|
||||
|
||||
// Init the round and shuffle the deck
|
||||
cardDeckFill(HOLDEM_GAME_STATE.deck);
|
||||
HOLDEM_GAME_STATE.deckSize = CARD_DECK_SIZE;
|
||||
HOLDEM_GAME_STATE.pot = 0;
|
||||
HOLDEM_GAME_STATE.cardsFacing = 0;
|
||||
cardDeckFill(POKER_STATE.deck);
|
||||
POKER_STATE.deckSize = CARD_DECK_SIZE;
|
||||
POKER_STATE.pot = 0;
|
||||
POKER_STATE.cardsFacing = 0;
|
||||
|
||||
// Reset the players
|
||||
for(i = 0; i < HOLDEM_PLAYER_COUNT; i++) {
|
||||
player = HOLDEM_GAME_STATE.players + i;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
player = POKER_STATE.players + i;
|
||||
|
||||
// Clear Round State(s)
|
||||
player->state &= ~(
|
||||
HOLDEM_STATE_FOLDED |
|
||||
HOLDEM_STATE_SHOWING
|
||||
POKER_STATE_FOLDED |
|
||||
POKER_STATE_SHOWING
|
||||
);
|
||||
|
||||
player->cardCount = 0;
|
||||
@ -58,6 +58,6 @@ void actionRoundAfterShuffle() {
|
||||
|
||||
void actionRoundDispose(int32_t index, void *data) {
|
||||
int32_t newI = holdemActionAdd(actionShuffle());
|
||||
shuffledata_t *newData=(shuffledata_t *)(HOLDEM_GAME_STATE.actionData + newI);
|
||||
shuffledata_t *newData=(shuffledata_t *)(POKER_STATE.actionData + newI);
|
||||
newData->done = &actionRoundAfterShuffle;
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
#include "shuffle.h"
|
||||
#include "deal.h"
|
||||
|
||||
holdemaction_t actionRound();
|
||||
pokeraction_t actionRound();
|
||||
|
||||
void actionRoundInit(int32_t index, void *data);
|
||||
void actionRoundUpdate(int32_t index, void *data);
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "shuffle.h"
|
||||
|
||||
holdemaction_t actionShuffle() {
|
||||
return (holdemaction_t){
|
||||
pokeraction_t actionShuffle() {
|
||||
return (pokeraction_t){
|
||||
.init = &actionShuffleInit,
|
||||
.update = &actionShuffleUpdate,
|
||||
.dispose = &actionShuffleDispose
|
||||
@ -17,7 +17,7 @@ holdemaction_t actionShuffle() {
|
||||
|
||||
void actionShuffleInit(int32_t index, void *data) {
|
||||
logText("Shuffle Deck");
|
||||
cardShuffle(HOLDEM_GAME_STATE.deck, HOLDEM_GAME_STATE.deckSize);
|
||||
cardShuffle(POKER_STATE.deck, POKER_STATE.deckSize);
|
||||
holdemActionRemove(index);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ typedef struct {
|
||||
void (*done)();
|
||||
} shuffledata_t;
|
||||
|
||||
holdemaction_t actionShuffle();
|
||||
pokeraction_t actionShuffle();
|
||||
|
||||
void actionShuffleInit(int32_t index, void *data);
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "start.h"
|
||||
|
||||
holdemaction_t actionStart() {
|
||||
holdemaction_t action = {
|
||||
pokeraction_t actionStart() {
|
||||
pokeraction_t action = {
|
||||
.init = &actionStartInit,
|
||||
.update = &actionStartUpdate,
|
||||
.dispose = &actionStartDispose
|
||||
@ -19,17 +19,17 @@ holdemaction_t actionStart() {
|
||||
|
||||
void actionStartInit(int32_t index, void *data) {
|
||||
uint8_t i;
|
||||
holdemplayer_t *player;
|
||||
pokerplayer_t *player;
|
||||
logText("Holdem Starting");
|
||||
|
||||
// Prepare the match
|
||||
HOLDEM_GAME_STATE.blindBig = 0;
|
||||
HOLDEM_GAME_STATE.blindSmall = 0;
|
||||
HOLDEM_GAME_STATE.pot = 0;
|
||||
POKER_STATE.blindBig = 0;
|
||||
POKER_STATE.blindSmall = 0;
|
||||
POKER_STATE.pot = 0;
|
||||
|
||||
// Reset the players
|
||||
for(i = 0; i < HOLDEM_PLAYER_COUNT; i++) {
|
||||
player = HOLDEM_GAME_STATE.players + i;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
player = POKER_STATE.players + i;
|
||||
player->state = 0x00;
|
||||
player->chips = 0;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "round.h"
|
||||
#include "../../debug/log.h"
|
||||
|
||||
holdemaction_t actionStart();
|
||||
pokeraction_t actionStart();
|
||||
|
||||
void actionStartInit(int32_t index, void *data);
|
||||
void actionStartUpdate(int32_t index, void *data);
|
||||
|
Reference in New Issue
Block a user