Refactoring some of the poker game logic again.
This commit is contained in:
@ -36,20 +36,17 @@
|
||||
|
||||
// Game Logic
|
||||
#include "game/game.h"
|
||||
#include "game/poker/pokergame.h"
|
||||
|
||||
// Player Input
|
||||
#include "input/input.h"
|
||||
|
||||
// Poker Game Logic
|
||||
#include "poker/round/match.h"
|
||||
|
||||
#include "poker/bet.h"
|
||||
#include "poker/card.h"
|
||||
#include "poker/dealer.h"
|
||||
#include "poker/player.h"
|
||||
#include "poker/poker.h"
|
||||
#include "poker/render.h"
|
||||
#include "poker/strings.h"
|
||||
#include "poker/winner.h"
|
||||
|
||||
// Utility Objects
|
||||
|
@ -6,11 +6,7 @@
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
#include "../engine/engine.h"
|
||||
#include "../poker/poker.h"
|
||||
|
||||
/** Name of the current game */
|
||||
#define GAME_NAME "Dawn"
|
||||
|
||||
#include "poker/pokergame.h"
|
||||
|
||||
/** Describes the current game */
|
||||
typedef struct {
|
||||
@ -19,6 +15,6 @@ typedef struct {
|
||||
/** Engine for the game */
|
||||
engine_t engine;
|
||||
|
||||
/** Poker Game State */
|
||||
poker_t poker;
|
||||
/** Poker Game */
|
||||
pokergame_t pokerGame;
|
||||
} game_t;
|
@ -7,8 +7,12 @@
|
||||
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../../poker/poker.h"
|
||||
|
||||
/** Name of the Poker Game */
|
||||
#define POKER_GAME_NAME "Dawn Poker Game"
|
||||
|
||||
typedef struct {
|
||||
// Time when match started (for fade effect)
|
||||
float time;
|
||||
} pokerroundmatch_t;
|
||||
/** Poker Game State */
|
||||
poker_t poker;
|
||||
} pokergame_t;
|
@ -20,6 +20,9 @@
|
||||
typedef struct {
|
||||
/** Blinds */
|
||||
uint32_t blindSmall, blindBig;
|
||||
|
||||
/** For Betting round, which player is currently betting */
|
||||
uint8_t better;
|
||||
|
||||
/** Current pot of chips */
|
||||
uint32_t pot;
|
||||
|
@ -8,9 +8,6 @@
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
#include "card.h"
|
||||
#include "../display/texture.h"
|
||||
#include "../display/tileset.h"
|
||||
#include "../display/primitive.h"
|
||||
|
||||
/** How many cards the dealer can hold in their hand */
|
||||
#define POKER_DEALER_HAND_SIZE 5
|
||||
@ -31,11 +28,4 @@ typedef struct {
|
||||
/** Card grave (where spent cards go when burned */
|
||||
card_t grave[POKER_DEALER_GRAVE_SIZE];
|
||||
uint8_t graveSize;
|
||||
|
||||
|
||||
|
||||
// Rendering assets (unfinished)
|
||||
texture_t dealerTexture;
|
||||
tileset_t dealerTileset;
|
||||
primitive_t dealerPrimitive;
|
||||
} pokerdealer_t;
|
@ -10,10 +10,6 @@
|
||||
#include "bet.h"
|
||||
#include "dealer.h"
|
||||
#include "card.h"
|
||||
#include "../display/texture.h"
|
||||
#include "../display/primitive.h"
|
||||
#include "../display/tileset.h"
|
||||
|
||||
|
||||
/** How many cards a player can hold in their hand */
|
||||
#define POKER_PLAYER_HAND 2
|
||||
@ -56,12 +52,4 @@ typedef struct {
|
||||
|
||||
/** Current bet in current round player has placed */
|
||||
uint32_t currentBet;
|
||||
|
||||
|
||||
// Rendering assets
|
||||
texture_t bodyTexture;
|
||||
primitive_t bodyPrimitive;
|
||||
|
||||
texture_t faceTexture;
|
||||
primitive_t facePrimitive;
|
||||
} pokerplayer_t;
|
@ -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;
|
@ -1,54 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
#include "../display/tileset.h"
|
||||
#include "../display/primitive.h"
|
||||
#include "../display/texture.h"
|
||||
#include "../display/shader.h"
|
||||
#include "../display/camera.h"
|
||||
#include "../display/spritebatch.h"
|
||||
|
||||
/** Size of the Render frames */
|
||||
#define POKER_FRAME_HEIGHT RENDER_STATE.height
|
||||
#define POKER_FRAME_LEFT_WIDTH RENDER_STATE.width*0.65
|
||||
#define POKER_FRAME_RIGHT_WIDTH (\
|
||||
RENDER_STATE.width - POKER_FRAME_LEFT_WIDTH - 1\
|
||||
)
|
||||
|
||||
/** Size of the rendered card */
|
||||
#define POKER_CARD_WIDTH 0.04
|
||||
#define POKER_CARD_HEIGHT POKER_CARD_WIDTH/2.5*3.5
|
||||
#define POKER_CARD_DEPTH 0.0005
|
||||
#define POKER_CARD_PADDING 0.0125
|
||||
|
||||
/** Macro for the angle (Yaw) that the seat has */
|
||||
#define POKER_SEAT_ANGLE(seat) mathDeg2Rad(-45 * seat)
|
||||
|
||||
/** Slots where cards can render */
|
||||
#define POKER_CARD_SLOT_HAND0 0x00
|
||||
#define POKER_CARD_SLOT_HAND1 0x01
|
||||
#define POKER_CARD_SLOT_FLOP0 0x02
|
||||
#define POKER_CARD_SLOT_FLOP1 0x03
|
||||
#define POKER_CARD_SLOT_FLOP2 0x04
|
||||
#define POKER_CARD_SLOT_FLOP3 0x05
|
||||
#define POKER_CARD_SLOT_FLOP4 0x06
|
||||
|
||||
/** Various seats at the table that people can sit */
|
||||
#define POKER_SEAT_DEALER 0x00
|
||||
#define POKER_SEAT_PLAYER0 0x04
|
||||
#define POKER_SEAT_PLAYER1 0x06
|
||||
#define POKER_SEAT_PLAYER2 0x05
|
||||
#define POKER_SEAT_PLAYER3 0x03
|
||||
#define POKER_SEAT_PLAYER4 0x02
|
||||
|
||||
typedef struct {
|
||||
float x, z;
|
||||
float yaw;
|
||||
} pokerposition_t;
|
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
#define POKER_TALK_MATCH_START "The game is no-limits Texas Hold'em."
|
||||
#define POKER_TALK_MATCH_BUYIN "The buy-in for this match is $10,000."
|
@ -18,9 +18,9 @@ typedef struct {
|
||||
float x, y, z;
|
||||
float yaw, pitch, roll;
|
||||
float scaleX, scaleY;
|
||||
float blinkStart;
|
||||
|
||||
bool talking;
|
||||
float blinkStart;
|
||||
|
||||
tileset_t tilesetEyes;
|
||||
tileset_t tilesetMouth;
|
||||
|
Reference in New Issue
Block a user