/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "round.h" holdemaction_t actionRound() { return (holdemaction_t){ .init = &actionRoundInit, .update = &actionRoundUpdate, .dispose = &actionRoundDispose }; } void actionRoundInit(int32_t index, void *data) { uint8_t i; holdemplayer_t *player; logText("Round Start"); // Look at the dealer. holdemRenderLookHand(&HOLDEM_GAME_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; // Reset the players for(i = 0; i < HOLDEM_PLAYER_COUNT; i++) { player = HOLDEM_GAME_STATE.players + i; // Clear Round State(s) player->state &= ~( HOLDEM_STATE_FOLDED | HOLDEM_STATE_SHOWING ); player->cardCount = 0; player->currentBet = 0; } // Next action holdemActionRemove(index); } void actionRoundUpdate(int32_t index, void *data) { } void actionRoundAfterShuffle() { logText("Shuffle Done"); int32_t i = holdemActionAdd(actionDeal()); } void actionRoundDispose(int32_t index, void *data) { int32_t newI = holdemActionAdd(actionShuffle()); shuffledata_t *newData=(shuffledata_t *)(HOLDEM_GAME_STATE.actionData + newI); newData->done = &actionRoundAfterShuffle; }