Refactoring some of the poker game logic again.

This commit is contained in:
2021-07-27 09:49:54 -07:00
parent 2a4b1fa8da
commit cf4d4cd710
36 changed files with 99 additions and 304 deletions

View File

@ -11,18 +11,8 @@
#include "dealer.h"
#include "player.h"
#include "card.h"
#include "render.h"
#include "winner.h"
#include "round/match.h"
#include "../display/camera.h"
#include "../display/shader.h"
#include "../display/texture.h"
#include "../display/tileset.h"
#include "../display/framebuffer.h"
#include "../display/primitive.h"
/** Rounds that the game can be in */
#define POKER_ROUND_MATCH 0x00
#define POKER_ROUND_START 0x01
@ -37,69 +27,33 @@
#define POKER_ROUND_BET3 0x0A
#define POKER_ROUND_WINNER 0x0B
/** GUI Height fix (To keep gui scaling nicely we use a fixed height) */
#define POKER_GUI_HEIGHT 2160
/** How many cards to deal each player during the deal round */
#define POKER_DEAL_CARD_EACH 2
/** How many cards are dealt for the flop, turn and river */
#define POKER_FLOP_CARD_COUNT 3
#define POKER_TURN_CARD_COUNT 1
#define POKER_RIVER_CARD_COUNT 1
typedef struct {
//////////////////////////////////////////////////////////////////////////////
// Poker Logic Variables
//////////////////////////////////////////////////////////////////////////////
typedef struct {
/** Poker betting state */
pokerbet_t bet;
/** Player States */
pokerdealer_t dealer;
pokerplayer_t players[POKER_PLAYER_COUNT];
/** Winning player states */
pokerwinner_t winner;
/** The current player that is the dealer */
uint8_t roundDealer;
uint8_t roundSmallBlind;
uint8_t roundBigBlind;
//////////////////////////////////////////////////////////////////////////////
// Round variables
//////////////////////////////////////////////////////////////////////////////
/** The current round the game is on */
uint8_t round;
/** For Betting round, which player is currently betting */
uint8_t roundBetCurrent;
uint32_t roundTextCounter;
pokerroundmatch_t roundMatch;
//////////////////////////////////////////////////////////////////////////////
// Rendering Variables
//////////////////////////////////////////////////////////////////////////////
/** Frames to hold the world and GUI render outputs */
framebuffer_t frameWorld, frameGui;
/** Game's Shader */
shader_t shader;
/** Camera for the world and the GUI */
camera_t cameraWorld, cameraGui;
/** Refer to POKER_GUI_HEIGHT */
float guiWidth;
texture_t chipTexture;
primitive_t chipPrimitive;
texture_t tableTexture;
primitive_t tablePrimitive;
texture_t cardTexture;
tileset_t cardTileset;
primitive_t cardPrimitive;
/** Which player is the small blind for this round */
uint8_t roundSmallBlind;
/** Which player is the big blind for this round */
uint8_t roundBigBlind;
} poker_t;