Refactor almost finished.

This commit is contained in:
2021-09-19 22:49:52 -07:00
parent a2c269ab33
commit b3e06a3837
25 changed files with 56 additions and 31 deletions

View File

@ -109,7 +109,7 @@ void _pokerGameActionBetOnEnd(
pokerDiscussionQueue(&discussion);
pokerBetResetBetter(
&game->poker, &game->poker.players, game->poker.roundSmallBlind
&game->poker.bet, game->poker.players, game->poker.roundSmallBlind
);
pokerGameActionRestackAdd(game);
pokerGameActionLookAdd(game, game->poker.bet.better);

View File

@ -7,9 +7,10 @@
#pragma once
#include "../../../libs.h"
#include "../../../util/math.h"
#include "action.h"
#include "../../../display/animation/queue.h"
#include "../pokergame.h"
#include "../../../display/animation/queue.h"
#include "../../../poker/turn.h"
#include "../../../poker/bet.h"
#include "../../../poker/actions/flop.h"

View File

@ -42,7 +42,7 @@ void _pokerGameActionRoundOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
// Begin Betting Round. This will queue for one player only and then the round
// will take over.
pokerBetResetBetter(
&game->poker, game->poker.players, game->poker.roundSmallBlind
&game->poker.bet, game->poker.players, game->poker.roundSmallBlind
);
pokerGameActionBetAdd(game);
}

View File

@ -71,14 +71,3 @@ void gameInstanceDispose(pokergame_t *game) {
// Unload all assets
pokerGameAssetsDispose(&game->assets);
}
void pokerGameQueueRestack(pokergame_t *pokerGame) {
arrayRewind(
sizeof(pokergameactiondata_t),
pokerGame->actionData,
ANIMATION_QUEUE_ITEM_MAX,
pokerGame->scene.conversation.actionQueue.current,
pokerGame->scene.conversation.actionQueue.count
);
queueRestack(&pokerGame->scene.conversation.actionQueue);
}

View File

@ -36,11 +36,4 @@ void gameInstanceUpdate(pokergame_t *game);
* Disposes a previously initialized poker game instance.
* @param game Game to dispose.
*/
void gameInstanceDispose(pokergame_t *game);
/**
* Restacks the poker game's stack.
*
* @param game Poker game to restack
*/
void pokerGameQueueRestack(pokergame_t *game);
void gameInstanceDispose(pokergame_t *game);

View File

@ -0,0 +1,19 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "pokergame.h"
void pokerGameQueueRestack(pokergame_t *pokerGame) {
arrayRewind(
sizeof(pokergameactiondata_t),
pokerGame->actionData,
ANIMATION_QUEUE_ITEM_MAX,
pokerGame->scene.conversation.actionQueue.current,
pokerGame->scene.conversation.actionQueue.count
);
queueRestack(&pokerGame->scene.conversation.actionQueue);
}

View File

@ -37,4 +37,11 @@ typedef struct {
/** Data for the actions */
pokergameactiondata_t actionData[ANIMATION_QUEUE_ITEM_MAX];
} pokergame_t;
} pokergame_t;
/**
* Restacks the poker game's stack.
*
* @param game Poker game to restack
*/
void pokerGameQueueRestack(pokergame_t *game);

View File

@ -77,7 +77,7 @@ void pokerUiUpdate(
);
// Bind the frame buffer
frameBufferUse(&ui->frames + j, true);
frameBufferUse(ui->frames+j, true);
// Render the VN character
shaderUse(shader);
@ -110,7 +110,7 @@ void pokerUiRender(
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
player = poker->players + j;
for(i = 0; i < player->cardCount; i++) {
pokerCardSetImage(&ui->card, &assets->cardTexture, player->cards[i]);
pokerUiSetImageToCard(&ui->card,&assets->cardTexture,player->cards[i]);
imageRender(&ui->card, &assets->shader, i * 64.0f, j * 100.0f);
}
}
@ -132,11 +132,11 @@ void pokerUiRender(
// Position the grid itself.
x = 0;
y = POKER_UI_PLAYER_HEIGHT * j;
y = (float)(POKER_UI_PLAYER_HEIGHT * j);
// Render face
gridGetChild(&ui->grid, 1, 0, 1, 2, &gx, &gy, &gw, &gh);
shaderUseTexture(&assets->shader, &ui->frames + j);
shaderUseTexture(&assets->shader, &(ui->frames + j)->texture);
shaderUsePosition(&assets->shader, x + gx, y + gy, 0, 0,0,0);
primitiveDraw(&ui->quad, 0, -1);
@ -194,8 +194,8 @@ void pokerUiSetImageToCard(image_t *image, texture_t *texture, card_t card) {
imageSetTextureAndCrop(
image, texture,
cardGetNumber(cardImageIndex) * 71,
cardGetSuit(card) * 96,
cardGetNumber(cardImageIndex) * 71.0f,
cardGetSuit(card) * 96.0f,
71, 96
);
}

View File

@ -91,4 +91,4 @@ void pokerUiDispose(pokerui_t *ui);
* @param texture Texture to use.
* @param card Card to set to.
*/
void pokerCardSetImage(image_t *image, texture_t *texture, card_t card);
void pokerUiSetImageToCard(image_t *image, texture_t *texture, card_t card);