From f6a4be2f3c658ade1a644c2b7f2c5779a6019d7a Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Thu, 20 May 2021 22:35:50 -0700 Subject: [PATCH] Refactor struct part 2. --- src/{ => assets}/models/pokerchip.c | 9 +--- src/{ => assets}/models/pokerchip.h | 4 +- src/{ => assets}/models/pokertable.c | 9 +--- src/{ => assets}/models/pokertable.h | 4 +- src/display/debug/position.c | 81 ---------------------------- src/display/debug/position.h | 45 ---------------- src/display/framebuffer.c | 1 - src/display/primitives/cube.c | 7 ++- src/display/primitives/cube.h | 4 +- src/display/primitives/quad.c | 8 +-- src/display/primitives/quad.h | 4 +- src/display/shader.c | 24 +++------ src/display/shader.h | 14 +++-- src/display/tileset.c | 6 +-- src/engine/engine.c | 2 +- src/platform/glfw/glwfwplatform.c | 48 +++++++++-------- src/platform/glfw/glwfwplatform.h | 1 - src/poker/poker.c | 4 +- 18 files changed, 61 insertions(+), 214 deletions(-) rename src/{ => assets}/models/pokerchip.c (98%) rename src/{ => assets}/models/pokerchip.h (82%) rename src/{ => assets}/models/pokertable.c (99%) rename src/{ => assets}/models/pokertable.h (82%) delete mode 100644 src/display/debug/position.c delete mode 100644 src/display/debug/position.h diff --git a/src/models/pokerchip.c b/src/assets/models/pokerchip.c similarity index 98% rename from src/models/pokerchip.c rename to src/assets/models/pokerchip.c index 25359ac8..ee89e086 100644 --- a/src/models/pokerchip.c +++ b/src/assets/models/pokerchip.c @@ -7,7 +7,7 @@ #include "pokerchip.h" -primitive_t * pokerChipCreate() { +void pokerChipInit(primitive_t *primitive) { vertice_t vertices[POKER_CHIP_VERTICE_COUNT] = { { .x = 0, .y = 0.015, .z = -0.1, .u = 0.351562, .v = 0.28125 }, { .x = 0.0309017, .y = -0.015, .z = -0.09510570000000002, .u = 0.273438, .v = 0.21093799999999996 }, @@ -330,12 +330,7 @@ primitive_t * pokerChipCreate() { 48 }; - primitive_t *primitive = primitiveCreate( - POKER_CHIP_VERTICE_COUNT, - POKER_CHIP_INDICE_COUNT - ); - + primitiveInit(primitive, POKER_CHIP_VERTICE_COUNT, POKER_CHIP_INDICE_COUNT); primitiveBufferVertices(primitive, 0, POKER_CHIP_VERTICE_COUNT, vertices); primitiveBufferIndices(primitive, 0, POKER_CHIP_INDICE_COUNT, indices); - return primitive; } diff --git a/src/models/pokerchip.h b/src/assets/models/pokerchip.h similarity index 82% rename from src/models/pokerchip.h rename to src/assets/models/pokerchip.h index d2220a1d..5d1b7cd0 100644 --- a/src/models/pokerchip.h +++ b/src/assets/models/pokerchip.h @@ -17,6 +17,6 @@ /** * Generated Model Poker Chip * Generated at Wed, 19 May 2021 14:20:06 GMT - * @returns Poker Chip as a primitive. + * @param primitive Poker Chip primitive to init. */ -primitive_t * pokerChipCreate(); +void pokerChipInit(primitive_t *primitive); diff --git a/src/models/pokertable.c b/src/assets/models/pokertable.c similarity index 99% rename from src/models/pokertable.c rename to src/assets/models/pokertable.c index d6a1f90c..13dab39e 100644 --- a/src/models/pokertable.c +++ b/src/assets/models/pokertable.c @@ -7,7 +7,7 @@ #include "pokertable.h" -primitive_t * pokerTableCreate() { +void pokerTableCreate(primitive_t *primitive) { vertice_t vertices[POKER_TABLE_VERTICE_COUNT] = { { .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.836914, .v = 0.265625 }, { .x = 0.29349590000000003, .y = 0.0176777, .z = -0.12157000000000001, .u = 0.853516, .v = 0.06445299999999998 }, @@ -686,12 +686,7 @@ primitive_t * pokerTableCreate() { 182 }; - primitive_t *primitive = primitiveCreate( - POKER_TABLE_VERTICE_COUNT, - POKER_TABLE_INDICE_COUNT - ); - + primitiveInit(primitive, POKER_TABLE_VERTICE_COUNT, POKER_TABLE_INDICE_COUNT); primitiveBufferVertices(primitive, 0, POKER_TABLE_VERTICE_COUNT, vertices); primitiveBufferIndices(primitive, 0, POKER_TABLE_INDICE_COUNT, indices); - return primitive; } diff --git a/src/models/pokertable.h b/src/assets/models/pokertable.h similarity index 82% rename from src/models/pokertable.h rename to src/assets/models/pokertable.h index baa0464a..e2774002 100644 --- a/src/models/pokertable.h +++ b/src/assets/models/pokertable.h @@ -17,6 +17,6 @@ /** * Generated Model Poker Table * Generated at Sun, 09 May 2021 21:15:45 GMT - * @returns Poker Table as a primitive. + * @param primitive Poker Table primitive to init. */ -primitive_t * pokerTableCreate(); +void pokerTableInit(primitive_t *primitive); diff --git a/src/display/debug/position.c b/src/display/debug/position.c deleted file mode 100644 index 43f85bfe..00000000 --- a/src/display/debug/position.c +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) 2021 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#include "position.h" - -positiondebug_t positionDebugCreate( - primitive_t *debugPrimitive, - texture_t *fontTexture, tileset_t *fontTileset -) { - positiondebug_t debug = { - .primitive = debugPrimitive, - .textTexture = fontTexture, - .textTileset = fontTileset, - .x = 0, .y = 0, .z = 0, - .pitch = 0, .yaw = 0, .roll = 0, - .scaleX = 1, .scaleY = 1, .scaleZ = 1 - }; - - debug.textBatch = spriteBatchCreate(POSITION_DEBUG_FONT_CHARS_MAX); - - return debug; -} - -void positionDebugRender(shader_t *shader, positiondebug_t *debug) { - float speed = 0.5; - - // Update values. - if(inputIsDown(INPUT_DEBUG_FINE)) speed *= 0.1; - if(inputIsDown(INPUT_DEBUG_UP)) debug->z -= TIME_STATE.delta * speed; - if(inputIsDown(INPUT_DEBUG_DOWN)) debug->z += TIME_STATE.delta * speed; - if(inputIsDown(INPUT_DEBUG_LEFT)) debug->x -= TIME_STATE.delta * speed; - if(inputIsDown(INPUT_DEBUG_RIGHT)) debug->x += TIME_STATE.delta * speed; - if(inputIsDown(INPUT_DEBUG_LOWER)) debug->y -= TIME_STATE.delta * speed; - if(inputIsDown(INPUT_DEBUG_RAISE)) debug->y += TIME_STATE.delta * speed; - if(inputIsDown(INPUT_DEBUG_MINUS)) { - debug->scaleX -= TIME_STATE.delta * speed; - debug->scaleY -= TIME_STATE.delta * speed; - debug->scaleZ -= TIME_STATE.delta * speed; - } - if(inputIsDown(INPUT_DEBUG_PLUS)) { - debug->scaleX += TIME_STATE.delta * speed; - debug->scaleY += TIME_STATE.delta * speed; - debug->scaleZ += TIME_STATE.delta * speed; - } - - // Render object - shaderUsePositionAndScale(shader, - debug->x, debug->y, debug->z, - mathDeg2Rad(debug->pitch),mathDeg2Rad(debug->yaw),mathDeg2Rad(debug->roll), - debug->scaleX, debug->scaleY, debug->scaleZ - ); - primitiveDraw(debug->primitive, 0, -1); - - // Render debug text - char text[POSITION_DEBUG_FONT_CHARS_MAX]; - sprintf(text, "%.2f, %.2f, %.2f\n%.2f, %.2f, %.2f \n%.2f, %.2f, %.2f", - debug->x, debug->y, debug->z, - debug->pitch, debug->yaw, debug->roll, - debug->scaleX, debug->scaleY, debug->scaleZ - ); - - shaderUseTexture(shader, debug->textTexture); - shaderUsePosition(shader, - 0, 1, 0, - mathDeg2Rad(-90), mathDeg2Rad(0), 0 - ); - spriteBatchFlush(debug->textBatch); - fontSpriteBatchBuffer(debug->textBatch, debug->textTileset, text, - FONT_CENTER_X, FONT_CENTER_Y, 0, - -1, 0.1 - ); - spriteBatchDraw(debug->textBatch, 0, -1); -} - -void positionDebugDispose(positiondebug_t *debug) { - spriteBatchDispose(debug->textBatch); -} \ No newline at end of file diff --git a/src/display/debug/position.h b/src/display/debug/position.h deleted file mode 100644 index 1ee08a17..00000000 --- a/src/display/debug/position.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2021 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once - -#include -#include "../primitive.h" -#include "../texture.h" -#include "../tileset.h" -#include "../gui/font.h" -#include "../spritebatch.h" -#include "../shader.h" -#include "../../input/input.h" - -/** - * Creates a position debug tool. - * - * @param debugPrimitive Primitive to debug - * @param fontTexture Font Texture to use for debugging. - * @param fontTileset Tileset for for font to use for debugging. - * @return Pointer to debug renderer. - */ -positiondebug_t positionDebugCreate( - primitive_t *debugPrimitive, - texture_t *fontTexture, tileset_t *fontTileset -); - -/** - * Render a position debug tool. - * - * @param shader Shader to use. - * @param debug Debug tool to render. - */ -void positionDebugRender(shader_t *shader, positiondebug_t *debug); - -/** - * Dispose a previously created position debug tool. - * - * @param debug Debug tool to dispose. - */ -void positionDebugDispose(positiondebug_t *debug); \ No newline at end of file diff --git a/src/display/framebuffer.c b/src/display/framebuffer.c index 1a31e4fa..f95c14a5 100644 --- a/src/display/framebuffer.c +++ b/src/display/framebuffer.c @@ -63,5 +63,4 @@ void frameBufferDispose(framebuffer_t *frameBuffer) { glDeleteRenderbuffers(1, &frameBuffer->rboId); glDeleteFramebuffers(1, &frameBuffer->fboId); textureDispose(&frameBuffer->texture); - free(frameBuffer); } \ No newline at end of file diff --git a/src/display/primitives/cube.c b/src/display/primitives/cube.c index 301229bb..88cca026 100644 --- a/src/display/primitives/cube.c +++ b/src/display/primitives/cube.c @@ -101,12 +101,11 @@ void cubeBuffer(primitive_t *prim, free(indices); } -primitive_t * cubeCreate(float w, float h, float d) { - primitive_t *cube = primitiveCreate(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); - cubeBuffer(cube, +void cubeInit(primitive_t *primitive, float w, float h, float d) { + primitiveInit(primitive, CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); + cubeBuffer(primitive, -w/2, -h/2, -d/2, w, h, d, 0, 0 ); - return cube; } \ No newline at end of file diff --git a/src/display/primitives/cube.h b/src/display/primitives/cube.h index 38660c0f..8f0bc62a 100644 --- a/src/display/primitives/cube.h +++ b/src/display/primitives/cube.h @@ -31,9 +31,9 @@ void cubeBuffer(primitive_t *primitive, /** * Creates a cube primitive of given size. + * @param primitive Primitive to create into a cube. * @param w Width of cube. * @param h Height of cube. * @param d Depth of cube. - * @return Primitive of the cube. */ -primitive_t * cubeCreate(float w, float h, float d); \ No newline at end of file +void cubeInit(primitive_t *primitive, float w, float h, float d); \ No newline at end of file diff --git a/src/display/primitives/quad.c b/src/display/primitives/quad.c index 9a8e9085..8cb6e605 100644 --- a/src/display/primitives/quad.c +++ b/src/display/primitives/quad.c @@ -42,19 +42,15 @@ void quadBuffer(primitive_t *primitive, float z, free(indices); } -primitive_t * quadCreate(float z, +void quadInit(primitive_t *primitive, float z, float x0, float y0, float u0, float v0, float x1, float y1, float u1, float v1 ) { - primitive_t *primitive = primitiveCreate( - QUAD_VERTICE_COUNT, QUAD_INDICE_COUNT - ); + primitiveInit(primitive, QUAD_VERTICE_COUNT, QUAD_INDICE_COUNT); quadBuffer(primitive, z, x0, y0, u0, v0, x1, y1, u1, v1, 0, 0 ); - - return primitive; } \ No newline at end of file diff --git a/src/display/primitives/quad.h b/src/display/primitives/quad.h index ebe82142..6d84bafd 100644 --- a/src/display/primitives/quad.h +++ b/src/display/primitives/quad.h @@ -35,6 +35,7 @@ void quadBuffer(primitive_t *primitive, float z, /** * Creates a new quad primitive. * + * @param primitive Primitive to turn into a quad. * @param z The Z axis coordinate of the quad. * @param x0 The X lower coordinate. * @param y0 The Y lower coordinate. @@ -44,9 +45,8 @@ void quadBuffer(primitive_t *primitive, float z, * @param y1 The Y higher coordinate. * @param u1 The X higher texture coordinate. * @param v1 The Y higher texture coordinate. - * @return The quad primitive. */ -primitive_t * quadCreate(float z, +void quadInit(primitive_t *primitive, float z, float x0, float y0, float u0, float v0, float x1, float y1, float u1, float v1 ); \ No newline at end of file diff --git a/src/display/shader.c b/src/display/shader.c index c3eb17b2..7d094815 100644 --- a/src/display/shader.c +++ b/src/display/shader.c @@ -7,12 +7,13 @@ #include "shader.h" -shader_t * shaderCompile(char *vertexShaderSource, char* fragmentShaderSource) { +void shaderCompile(shader_t *shader, + char *vertexShaderSource, char* fragmentShaderSource +) { int isSuccess, maxLength; char *error; GLuint shaderVertex, shaderFragment, shaderProgram; - // Load the vertex shader first shaderVertex = glCreateShader(GL_VERTEX_SHADER); glShaderSource(shaderVertex, 1, &vertexShaderSource, 0); @@ -64,21 +65,14 @@ shader_t * shaderCompile(char *vertexShaderSource, char* fragmentShaderSource) { } // Everything is okay, let's create the encapsulated shader. - shader_t *shader = malloc(sizeof(shader_t)); - if(shader == NULL) { - glDeleteProgram(shaderProgram); - glDeleteShader(shaderVertex); - glDeleteShader(shaderFragment); - return NULL; - } shader->shaderVertex = shaderVertex; shader->shaderFrag = shaderFragment; shader->shaderProgram = shaderProgram; - shader->uniProj = glGetUniformLocation(shader->shaderProgram, SHADER_UNI_PROJ); - shader->uniView = glGetUniformLocation(shader->shaderProgram, SHADER_UNI_VIEW); - shader->uniText = glGetUniformLocation(shader->shaderProgram, SHADER_UNI_TEXT); - shader->uniModl = glGetUniformLocation(shader->shaderProgram, SHADER_UNI_MODL); + shader->uniProj = glGetUniformLocation(shader->shaderProgram,SHADER_UNI_PROJ); + shader->uniView = glGetUniformLocation(shader->shaderProgram,SHADER_UNI_VIEW); + shader->uniText = glGetUniformLocation(shader->shaderProgram,SHADER_UNI_TEXT); + shader->uniModl = glGetUniformLocation(shader->shaderProgram,SHADER_UNI_MODL); // Bind the shader shaderUse(shader); @@ -90,12 +84,10 @@ shader_t * shaderCompile(char *vertexShaderSource, char* fragmentShaderSource) { return shader; } -bool shaderDispose(shader_t *shader) { +void shaderDispose(shader_t *shader) { glDeleteProgram(shader->shaderProgram); glDeleteShader(shader->shaderVertex); glDeleteShader(shader->shaderFrag); - free(shader); - return true; } void shaderUse(shader_t *shader) { diff --git a/src/display/shader.h b/src/display/shader.h index 6b480f7a..aa392534 100644 --- a/src/display/shader.h +++ b/src/display/shader.h @@ -9,21 +9,20 @@ #include /** - * Create a shader from vertex and fragment shader code. - * + * Compiles a shader from vertex and fragment shader code. + * @param shader Shader to compile into. * @param vertexShaderSource The raw vertex shader code. * @param fragmentShaderSource The raw fragment shader code. - * @return Pointer to the loaded shader. */ -shader_t * shaderCompile(char *vertexShaderSource, char* fragmentShaderSource); +void shaderInit(shader_t *shader, + char *vertexShaderSource, char* fragmentShaderSource +); /** * Cleanup and unload a previously loaded shader. - * * @param shader The shader to unload - * @return True if successfully disposed. */ -bool shaderDispose(shader_t *shader); +void shaderDispose(shader_t *shader); /** * Attaches the supplied shader as the current shader. @@ -49,7 +48,6 @@ void shaderUseTexture(shader_t *shader, texture_t *texture); /** * Set's the current translation matrix onto the shader for the next * render to use. Rotation order is set to YZX. - * * @param shader Shader to attach to. * @param x X coordinate (world space). * @param y Y coordinate (world space). diff --git a/src/display/tileset.c b/src/display/tileset.c index 6fbe2ff8..d76f4e5e 100644 --- a/src/display/tileset.c +++ b/src/display/tileset.c @@ -7,7 +7,7 @@ #include "tileset.h" -tileset_t * tilesetInit(tileset_t *tileset, +void tilesetInit(tileset_t *tileset, int32_t columns, int32_t rows, int32_t width, int32_t height, int32_t gapX, int32_t gapY, @@ -18,10 +18,6 @@ tileset_t * tilesetInit(tileset_t *tileset, tileset->count = rows * columns; tileset->divisions = malloc(sizeof(tilesetdiv_t) * tileset->count); - if(tileset->divisions == NULL) { - free(tileset); - return NULL; - } tileset->columns = columns; tileset->rows = rows; diff --git a/src/engine/engine.c b/src/engine/engine.c index 740441a3..d1ed56c8 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -20,7 +20,7 @@ void engineUpdateStart(engine_t *engine, game_t *game, float delta) { } bool engineUpdateEnd(engine_t *engine, game_t *game) { - if(inputIsPressed(INPUT_NULL)) return false; + if(inputIsPressed(&engine->input, INPUT_NULL)) return false; return true; } diff --git a/src/platform/glfw/glwfwplatform.c b/src/platform/glfw/glwfwplatform.c index 299a996f..5b42fb2a 100644 --- a/src/platform/glfw/glwfwplatform.c +++ b/src/platform/glfw/glwfwplatform.c @@ -36,32 +36,35 @@ int32_t main() { // Prepare the game game_t *game = &GAME_STATE; + input_t *input = &game->engine.input; // Init the game if(gameInit(game)) { // Bind initial keys - inputBind(INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE); - inputBind(INPUT_DEBUG_UP, (inputsource_t)GLFW_KEY_W); - inputBind(INPUT_DEBUG_DOWN, (inputsource_t)GLFW_KEY_S); - inputBind(INPUT_DEBUG_LEFT, (inputsource_t)GLFW_KEY_A); - inputBind(INPUT_DEBUG_RIGHT, (inputsource_t)GLFW_KEY_D); - inputBind(INPUT_DEBUG_RAISE, (inputsource_t)GLFW_KEY_Q); - inputBind(INPUT_DEBUG_LOWER, (inputsource_t)GLFW_KEY_E); - inputBind(INPUT_DEBUG_FINE, (inputsource_t)GLFW_KEY_LEFT_CONTROL); - inputBind(INPUT_DEBUG_PLUS, (inputsource_t)GLFW_KEY_EQUAL); - inputBind(INPUT_DEBUG_MINUS, (inputsource_t)GLFW_KEY_MINUS); + inputBind(input, INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE); + inputBind(input, INPUT_DEBUG_UP, (inputsource_t)GLFW_KEY_W); + inputBind(input, INPUT_DEBUG_DOWN, (inputsource_t)GLFW_KEY_S); + inputBind(input, INPUT_DEBUG_LEFT, (inputsource_t)GLFW_KEY_A); + inputBind(input, INPUT_DEBUG_RIGHT, (inputsource_t)GLFW_KEY_D); + inputBind(input, INPUT_DEBUG_RAISE, (inputsource_t)GLFW_KEY_Q); + inputBind(input, INPUT_DEBUG_LOWER, (inputsource_t)GLFW_KEY_E); + inputBind(input, INPUT_DEBUG_FINE, (inputsource_t)GLFW_KEY_LEFT_CONTROL); + inputBind(input, INPUT_DEBUG_PLUS, (inputsource_t)GLFW_KEY_EQUAL); + inputBind(input, INPUT_DEBUG_MINUS, (inputsource_t)GLFW_KEY_MINUS); - inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_UP); - inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN); - inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT); - inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT); - inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_W); - inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_S); - inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_A); - inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_D); + inputBind(input, INPUT_UP, (inputsource_t)GLFW_KEY_UP); + inputBind(input, INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN); + inputBind(input, INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT); + inputBind(input, INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT); + inputBind(input, INPUT_UP, (inputsource_t)GLFW_KEY_W); + inputBind(input, INPUT_DOWN, (inputsource_t)GLFW_KEY_S); + inputBind(input, INPUT_LEFT, (inputsource_t)GLFW_KEY_A); + inputBind(input, INPUT_RIGHT, (inputsource_t)GLFW_KEY_D); // Init the render resolution - renderSetResolution(WINDOW_WIDTH_DEFAULT, WINDOW_HEIGHT_DEFAULT); + renderSetResolution(&game->engine.render, + WINDOW_WIDTH_DEFAULT, WINDOW_HEIGHT_DEFAULT + ); // Update the window title. glfwSetWindowTitle(window, GAME_STATE.name); @@ -95,16 +98,17 @@ int32_t main() { } void glfwOnResize(GLFWwindow *window, int32_t width, int32_t height) { - renderSetResolution(width, height); + renderSetResolution(&GAME_STATE.engine.render, width, height); } void glfwOnKey(GLFWwindow *window, int32_t key, int32_t scancode, int32_t action, int32_t mods ) { + input_t *input = &GAME_STATE.engine.input; if(action == GLFW_PRESS) { - INPUT_STATE.buffer[key] = 1; + input->buffer[key] = 1; } else if(action == GLFW_RELEASE) { - INPUT_STATE.buffer[key] = 0; + input->buffer[key] = 0; } } diff --git a/src/platform/glfw/glwfwplatform.h b/src/platform/glfw/glwfwplatform.h index cd5e3fb1..66e5ffc5 100644 --- a/src/platform/glfw/glwfwplatform.h +++ b/src/platform/glfw/glwfwplatform.h @@ -11,7 +11,6 @@ #include #include "../../display/render.h" #include "../../game/game.h" -#include "../../game/gametime.h" #include "../../input/input.h" #define WINDOW_WIDTH_DEFAULT 480 diff --git a/src/poker/poker.c b/src/poker/poker.c index 59aadad8..f7207b27 100644 --- a/src/poker/poker.c +++ b/src/poker/poker.c @@ -24,14 +24,14 @@ void pokerInit(poker_t *poker) { poker->players[x].currentBet = 0; } - pokerRoundInit(); + pokerRoundInit(poker); } void pokerRoundInit(poker_t *poker) { uint8_t x; // Refill the deck - cardDeckFill(&poker->deck); + cardDeckFill(poker->deck); poker->deckSize = CARD_DECK_SIZE; // Reset the players