Did a lot of work on the engine
This commit is contained in:
@ -25,14 +25,37 @@
|
||||
/** State for whether or not a player is showing their hand */
|
||||
#define HOLDEM_STATE_SHOWING 0x02
|
||||
|
||||
/** Size of the Render frames */
|
||||
#define HOLDEM_GAME_FRAME_HEIGHT RENDER_STATE.height
|
||||
#define HOLDEM_GAME_FRAME_LEFT_WIDTH RENDER_STATE.width*0.65
|
||||
#define HOLDEM_GAME_FRAME_RIGHT_WIDTH (\
|
||||
RENDER_STATE.width - HOLDEM_GAME_FRAME_LEFT_WIDTH - 1\
|
||||
)
|
||||
#define HOLDEM_GAME_CARD_WIDTH 0.05
|
||||
#define HOLDEM_GAME_CARD_HEIGHT 0.07
|
||||
|
||||
/** Size of the rendered card */
|
||||
#define HOLDEM_GAME_CARD_WIDTH 0.04
|
||||
#define HOLDEM_GAME_CARD_HEIGHT HOLDEM_GAME_CARD_WIDTH/2.5*3.5
|
||||
#define HOLDEM_GAME_CARD_DEPTH 0.0005
|
||||
#define HOLDEM_GAME_CARD_PADDING 0.0125
|
||||
|
||||
/** Various seats at the table that people can sit */
|
||||
#define HOLDEM_GAME_SEAT_DEALER 0x00
|
||||
#define HOLDEM_GAME_SEAT_PLAYER0 0x04
|
||||
#define HOLDEM_GAME_SEAT_PLAYER1 0x06
|
||||
#define HOLDEM_GAME_SEAT_PLAYER2 0x05
|
||||
#define HOLDEM_GAME_SEAT_PLAYER3 0x03
|
||||
#define HOLDEM_GAME_SEAT_PLAYER4 0x02
|
||||
|
||||
/** Macro for the angle (Yaw) that the seat has */
|
||||
#define HOLDEM_GAME_SEAT_ANGLE(seat) mathDeg2Rad(-45 * seat)
|
||||
|
||||
#define HOLDEM_GAME_CARD_SLOT_HAND0 0x00
|
||||
#define HOLDEM_GAME_CARD_SLOT_HAND1 0x01
|
||||
#define HOLDEM_GAME_CARD_SLOT_FLOP0 0x02
|
||||
#define HOLDEM_GAME_CARD_SLOT_FLOP1 0x03
|
||||
#define HOLDEM_GAME_CARD_SLOT_FLOP2 0x04
|
||||
#define HOLDEM_GAME_CARD_SLOT_FLOP3 0x05
|
||||
#define HOLDEM_GAME_CARD_SLOT_FLOP4 0x06
|
||||
|
||||
/** How many actions the queue can hold */
|
||||
#define HOLDEM_GAME_ACTION_QUEUE_SIZE 12
|
||||
@ -40,6 +63,7 @@
|
||||
/** How much data (in length of sizeof size_t) each action has available */
|
||||
#define HOLDEM_GAME_ACTION_DATA_SIZE 256
|
||||
|
||||
|
||||
/** Texas Hold'em Player State */
|
||||
typedef struct {
|
||||
/** Cards in the players' hand */
|
||||
@ -99,6 +123,7 @@ typedef struct {
|
||||
/** Action and Allocated Data Space */
|
||||
holdemaction_t actionQueue[HOLDEM_GAME_ACTION_QUEUE_SIZE];
|
||||
void *actionData[HOLDEM_GAME_ACTION_DATA_SIZE*HOLDEM_GAME_ACTION_QUEUE_SIZE];
|
||||
bool actionInitState[HOLDEM_GAME_ACTION_DATA_SIZE];
|
||||
|
||||
/** Poker Table */
|
||||
primitive_t *tablePrimitive;
|
||||
@ -121,4 +146,10 @@ typedef struct {
|
||||
camera_t cameraRight;
|
||||
} holdemgame_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
float x, z;
|
||||
float yaw;
|
||||
} holdemrenderposition_t;
|
||||
|
||||
extern holdemgame_t HOLDEM_GAME_STATE;
|
@ -37,6 +37,8 @@
|
||||
|
||||
// Utility Objects
|
||||
#include "util/list.h"
|
||||
#include "util/math.h"
|
||||
#include "util/rand.h"
|
||||
|
||||
// 3D Tile Game World
|
||||
#include "world/entity/entity.h"
|
||||
|
18
include/dawn/util/math.h
Normal file
18
include/dawn/util/math.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (c) 2021 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Returns the modulous a result for b. Consdiders negative numbers correctly.
|
||||
* @param a Number to modulo against. (a % b)
|
||||
* @param b Number to modulo with. (a % b)
|
||||
*/
|
||||
#define mathMod(a,b) (a%b+b)%b
|
||||
#define mathMax(a,b) (a<b?b:a)
|
||||
#define mathMin(a,b) (a>b?b:a)
|
||||
#define mathAbs(n) (n<0?-n:n)
|
||||
#define mathDeg2Rad(n) (n * M_PI / 180.0)
|
||||
#define mathRad2Deg(n) (n * 180 / M_PI)
|
28
include/dawn/util/rand.h
Normal file
28
include/dawn/util/rand.h
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
|
||||
/**
|
||||
* Generate a number between 0 and max. (max exclusive)
|
||||
*
|
||||
* @param max Max number to generate
|
||||
* @return Number between 0 and max.
|
||||
*/
|
||||
#define u32rand(max) (rand()%max)
|
||||
#define u8rand(max) (uint8_t)u23rand(max)
|
||||
|
||||
/**
|
||||
* Generate a number between min and max. (max exclusive, min inclusive)
|
||||
*
|
||||
* @param min Min number to generate.
|
||||
* @param max Max number to generate.
|
||||
* @return Number between min and max.
|
||||
*/
|
||||
#define u32randRange(min, max) (u32rand(max-min)+min)
|
||||
#define u8randRange(min, max) (uint8_t)u32randRange(min,max)
|
Reference in New Issue
Block a user