Minor bug fixing, added blinds round
This commit is contained in:
		| @@ -49,9 +49,6 @@ typedef struct { | |||||||
|   /** The current player that is the dealer */ |   /** The current player that is the dealer */ | ||||||
|   uint8_t roundDealer; |   uint8_t roundDealer; | ||||||
|  |  | ||||||
|   /** The current round the game is on */ |  | ||||||
|   uint8_t round; |  | ||||||
|  |  | ||||||
|   /** Which player is the small blind for this round */ |   /** Which player is the small blind for this round */ | ||||||
|   uint8_t roundSmallBlind; |   uint8_t roundSmallBlind; | ||||||
|   /** Which player is the big blind for this round */ |   /** Which player is the big blind for this round */ | ||||||
|   | |||||||
| @@ -85,6 +85,9 @@ void fontTextClamp(font_t *font, fonttextinfo_t *info, char *text, | |||||||
|   info->lines[0].start = 0; |   info->lines[0].start = 0; | ||||||
|   info->lines[0].length = 0; |   info->lines[0].length = 0; | ||||||
|  |  | ||||||
|  |   // Reset Dimensions | ||||||
|  |   info->width = 0, info->height = 0; | ||||||
|  |    | ||||||
|   // Setup the initial loop state, and X/Y coords for the quad. |   // Setup the initial loop state, and X/Y coords for the quad. | ||||||
|   i = 0; |   i = 0; | ||||||
|   x = 0; |   x = 0; | ||||||
|   | |||||||
| @@ -19,14 +19,20 @@ bool pokerGameInit(game_t *game) { | |||||||
|   // Prep the VN Conversation Engine. |   // Prep the VN Conversation Engine. | ||||||
|   vnSceneInit(&pokerGame->scene, &pokerGame->assets.font); |   vnSceneInit(&pokerGame->scene, &pokerGame->assets.font); | ||||||
|  |  | ||||||
|   vnConversationTalk(&pokerGame->scene.conversation, "Start Match", NULL); |   vnConversationTalk(&pokerGame->scene.conversation, "LOTS AND LOTS AND LOTS AND LOTS AND LOTS AND LOTS AND LOTS AND LOTS", NULL); | ||||||
|   pokerActionMatchAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); |   pokerActionMatchAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); | ||||||
|  |    | ||||||
|   vnConversationTalk(&pokerGame->scene.conversation, "Start Round", NULL); |   vnConversationTalk(&pokerGame->scene.conversation, "Start Round", NULL); | ||||||
|   pokerActionRoundAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); |   pokerActionRoundAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); | ||||||
|  |    | ||||||
|  |   vnConversationTalk(&pokerGame->scene.conversation, "Blinds Round", NULL); | ||||||
|  |   pokerActionBlindsAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); | ||||||
|  |  | ||||||
|   vnConversationTalk(&pokerGame->scene.conversation, "Deal Round", NULL); |   vnConversationTalk(&pokerGame->scene.conversation, "Deal Round", NULL); | ||||||
|   pokerActionDealAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); |   pokerActionDealAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); | ||||||
|  |    | ||||||
|   vnConversationTalk(&pokerGame->scene.conversation, "Betting Round", NULL); |   vnConversationTalk(&pokerGame->scene.conversation, "Betting Round", NULL); | ||||||
|   // Betting round |  | ||||||
|   vnConversationTalk(&pokerGame->scene.conversation, "Flop Round", NULL); |   vnConversationTalk(&pokerGame->scene.conversation, "Flop Round", NULL); | ||||||
|   pokerActionFlopAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); |   pokerActionFlopAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ | |||||||
| #include "../../poker/actions/round.h" | #include "../../poker/actions/round.h" | ||||||
| #include "../../poker/actions/flop.h" | #include "../../poker/actions/flop.h" | ||||||
| #include "../../poker/actions/deal.h" | #include "../../poker/actions/deal.h" | ||||||
|  | #include "../../poker/actions/blinds.h" | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Initializes the game state for the poker game. |  * Initializes the game state for the poker game. | ||||||
|   | |||||||
							
								
								
									
										26
									
								
								src/poker/actions/blinds.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/poker/actions/blinds.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | |||||||
|  | /** | ||||||
|  |  * Copyright (c) 2021 Dominic Masters | ||||||
|  |  *  | ||||||
|  |  * This software is released under the MIT License. | ||||||
|  |  * https://opensource.org/licenses/MIT | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "blinds.h" | ||||||
|  |  | ||||||
|  | void _pokerActionBlindsOnStart(queue_t *queue,queueaction_t *action,uint8_t i) { | ||||||
|  |   poker_t *poker; | ||||||
|  |   poker = (poker_t *)action->data; | ||||||
|  |  | ||||||
|  |   pokerBetTakeBlinds(poker); | ||||||
|  |   printf("Taken Blinds\n"); | ||||||
|  |   queueNext(queue); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | queueaction_t * pokerActionBlindsAdd(queue_t *queue, poker_t *poker) { | ||||||
|  |   queueaction_t *action; | ||||||
|  |   action = queueAdd(queue); | ||||||
|  |   action->data = (void *)poker; | ||||||
|  |   action->onStart = &_pokerActionBlindsOnStart; | ||||||
|  |   return action; | ||||||
|  | } | ||||||
							
								
								
									
										23
									
								
								src/poker/actions/blinds.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/poker/actions/blinds.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | /** | ||||||
|  |  * Copyright (c) 2021 Dominic Masters | ||||||
|  |  *  | ||||||
|  |  * This software is released under the MIT License. | ||||||
|  |  * https://opensource.org/licenses/MIT | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include <dawn/dawn.h> | ||||||
|  | #include "../../display/animation/queue.h" | ||||||
|  | #include "../bet.h" | ||||||
|  |  | ||||||
|  | /** Callback for the blinds action */ | ||||||
|  | void _pokerActionBlindsOnStart(queue_t *queue,queueaction_t *action,uint8_t i); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Adds a blinds action onto the specified queue. | ||||||
|  |  *  | ||||||
|  |  * @param queue Queue to add to. | ||||||
|  |   * @param poker Poker game instance to deal. | ||||||
|  |   * @return The queued action. | ||||||
|  |  */ | ||||||
|  | queueaction_t * pokerActionBlindsAdd(queue_t *queue, poker_t *poker); | ||||||
| @@ -10,6 +10,14 @@ | |||||||
| #include "../../display/animation/queue.h" | #include "../../display/animation/queue.h" | ||||||
| #include "../dealer.h" | #include "../dealer.h" | ||||||
|  |  | ||||||
|  | /** Callback for the deal action */ | ||||||
| void _pokerActionDealOnStart(queue_t *queue, queueaction_t *action, uint8_t i); | void _pokerActionDealOnStart(queue_t *queue, queueaction_t *action, uint8_t i); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Adds a deal action onto the specified queue. | ||||||
|  |  *  | ||||||
|  |  * @param queue Queue to add to. | ||||||
|  |   * @param poker Poker game instance to deal. | ||||||
|  |   * @return The queued action. | ||||||
|  |  */ | ||||||
| queueaction_t * pokerActionDealAdd(queue_t *queue, poker_t *poker); | queueaction_t * pokerActionDealAdd(queue_t *queue, poker_t *poker); | ||||||
| @@ -16,7 +16,6 @@ void _pokerActionMatchOnStart(queue_t *queue, queueaction_t *action, uint8_t i){ | |||||||
|   // Reset the main game state. This does not init the round. |   // Reset the main game state. This does not init the round. | ||||||
|   pokerBetInit(&poker->bet); |   pokerBetInit(&poker->bet); | ||||||
|   poker->roundDealer = POKER_PLAYER_COUNT-2; |   poker->roundDealer = POKER_PLAYER_COUNT-2; | ||||||
|   poker->round = POKER_ROUND_MATCH; |  | ||||||
|  |  | ||||||
|   for(x = 0; x < POKER_PLAYER_COUNT; x++) { |   for(x = 0; x < POKER_PLAYER_COUNT; x++) { | ||||||
|     poker->players[x].state = 0x00; |     poker->players[x].state = 0x00; | ||||||
|   | |||||||
| @@ -15,10 +15,7 @@ void _pokerActionRoundOnStart(queue_t *queue, queueaction_t *action ,uint8_t i){ | |||||||
|  |  | ||||||
|   poker = (poker_t *)action->data; |   poker = (poker_t *)action->data; | ||||||
|  |  | ||||||
|   poker->round = POKER_ROUND_START; |  | ||||||
|  |  | ||||||
|   // Prepare the initial game state |   // Prepare the initial game state | ||||||
|   poker->round = POKER_ROUND_DEAL; |  | ||||||
|   pokerBetReset(&poker->bet); |   pokerBetReset(&poker->bet); | ||||||
|   pokerDealerInit(&poker->dealer); |   pokerDealerInit(&poker->dealer); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user