/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "round.h" pokeraction_t actionRound() { return (pokeraction_t){ .init = &actionRoundInit, .update = &actionRoundUpdate, .dispose = &actionRoundDispose }; } void actionRoundInit(int32_t index, void *data) { uint8_t i; pokerplayer_t *player; logText("Round Start"); // Look at the dealer. holdemRenderLookHand(&POKER_STATE.cameraLeft, HOLDEM_GAME_SEAT_DEALER); // Init the round and shuffle the deck 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 < POKER_PLAYER_COUNT; i++) { player = POKER_STATE.players + i; // Clear Round State(s) player->state &= ~( POKER_STATE_FOLDED | POKER_STATE_SHOWING ); player->cardCount = 0; player->currentBet = 0; } // Next action pokerActionRemove(index); } void actionRoundUpdate(int32_t index, void *data) { } void actionRoundAfterShuffle() { logText("Shuffle Done"); int32_t i = pokerActionAdd(actionDeal()); } void actionRoundDispose(int32_t index, void *data) { int32_t newI = pokerActionAdd(actionShuffle()); shuffledata_t *newData=(shuffledata_t *)(POKER_STATE.actionData + newI); newData->done = &actionRoundAfterShuffle; }