Just writing code nothing special.

This commit is contained in:
2021-08-02 22:58:02 -07:00
parent 289e6fccfc
commit c451538def
19 changed files with 254 additions and 30 deletions

15
src/game/dawn/dawngame.h Normal file
View File

@ -0,0 +1,15 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
bool dawnGameInit(game_t *game);
void dawnGameUpdate(game_t *game);
void dawnGameDispose(game_t *game);

View File

@ -14,6 +14,8 @@ bool gameInit(game_t *game) {
// Send off to the game instance
#if SETTING_GAME == SETTING_GAME_POKER
return pokerGameInit(game);
#elif SETTING_GAME == SETTING_GAME_DAWN
return dawnGameInit(game);
#endif
}
@ -24,6 +26,8 @@ bool gameUpdate(game_t *game, float platformDelta) {
// Hand off to the game's logic
#if SETTING_GAME == SETTING_GAME_POKER
pokerGameUpdate(game);
#elif SETTING_GAME == SETTING_GAME_DAWN
dawnGameUpdate(game);
#endif
// Hand back to the engine.
@ -34,6 +38,8 @@ void gameDispose(game_t *game) {
// Cleanup the game
#if SETTING_GAME == SETTING_GAME_POKER
pokerGameDispose(game);
#elif SETTING_GAME == SETTING_GAME_DAWN
dawnGameDispose(game);
#endif
engineDispose(&game->engine, game);

View File

@ -9,6 +9,8 @@
#if SETTING_GAME == SETTING_GAME_POKER
#include "poker/pokergame.h"
#elif SETTING_GAME == SETTING_GAME_DAWN
#include "dawn/dawngame.h"
#endif
/**

View File

@ -0,0 +1,14 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "bet.h"
queueaction_t * pokerGameActionBetAdd(pokergame_t *game) {
queueaction_t *action = pokerGameActionAdd(game);
return action;
}

View File

@ -0,0 +1,12 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "action.h"
queueaction_t * pokerGameActionBetAdd(pokergame_t *game);

View File

@ -0,0 +1,46 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "round.h"
void _pokerGameActionRoundOnStart(
queue_t *queue, queueaction_t *action, uint8_t i
) {
queueNext(queue);
}
void _pokerGameActionRoundOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
pokerdiscussiondata_t data;
pokergame_t *game = (pokergame_t *)action->data;
// Start the round
pokerActionRoundAdd(queue, &game->poker);
// Speak
data.poker = game;
data.reason = POKER_DISCUSSION_REASON_ROUND_START;
pokerDiscussionQueue(&data);
// Take the blinds.
pokerActionBlindsAdd(queue, &game->poker);
// Speak
data.reason = POKER_DISCUSSION_REASON_BLINDS_TAKEN;
pokerDiscussionQueue(&data);
// Deal
pokerActionDealAdd(queue, &game->poker);
// Begin Betting Round
}
queueaction_t * pokerGameActionRoundAdd(pokergame_t *game) {
queueaction_t *action = pokerGameActionAdd(game);
action->onStart = &_pokerGameActionRoundOnStart;
action->onEnd = &_pokerGameActionRoundOnEnd;
return action;
}

View File

@ -5,4 +5,21 @@
#pragma once
#include <dawn/dawn.h>
#include "action.h"
#include "../../../poker/actions/round.h"
#include "../../../poker/actions/blinds.h"
#include "../../../poker/actions/deal.h"
void _pokerGameActionRoundOnStart(
queue_t *queue, queueaction_t *action, uint8_t i
);
void _pokerGameActionRoundOnEnd(queue_t *queue,queueaction_t *action,uint8_t i);
/**
* Queues the round starting action onto the game. Handles talking VN logic.
*
* @param game Game to add to.
* @return The queued action.
*/
queueaction_t * pokerGameActionRoundAdd(pokergame_t *game);

View File

@ -10,26 +10,28 @@
void _pokerGameActionStartOnStart(
queue_t *queue, queueaction_t *action, uint8_t i
) {
pokergame_t *game = (pokergame_t *)action->data;
queueNext(queue);
}
void _pokerGameActionStartOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
pokerdiscussiondata_t data;
pokergame_t *game = (pokergame_t *)action->data;
// Begin the match
pokerActionMatchAdd(&game->scene.conversation.actionQueue, &game->poker);
vnConversationTalk(&game->scene.conversation,
"The game is No Limits Texas Hold'em.", NULL
);
// Say that.
data.poker = game;
data.reason = POKER_DISCUSSION_REASON_MATCH_START;
pokerDiscussionQueue(&data);
// Begin Round.
pokerGameActionRoundAdd(game);
}
queueaction_t * pokerGameActionStartAdd(pokergame_t *game) {
queueaction_t *action = pokerGameActionAdd(game);
action->onStart = &_pokerGameActionStartOnStart;
action->onEnd = &_pokerGameActionStartOnEnd;
return action;
}

View File

@ -10,6 +10,7 @@
#include "../../../vn/conversation/talk.h"
#include "../../../display/animation/queue.h"
#include "../../../poker/actions/match.h"
#include "../discussion/pokerdiscussion.h"
#include "action.h"
void _pokerGameActionStartOnStart(
@ -18,4 +19,11 @@ void _pokerGameActionStartOnStart(
void _pokerGameActionStartOnEnd(queue_t *queue,queueaction_t *action,uint8_t i);
/**
* Queues a match starting action onto the queue, also handles game logic for
* speaking VN style.
*
* @param game Game to add to.
* @return The queued action.
*/
queueaction_t * pokerGameAcionStartAdd(pokergame_t *game);

View File

@ -0,0 +1,47 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "pokerdiscussion.h"
void pokerDiscussionGet(
pokerdiscussion_t *discussion, pokerdiscussiondata_t *data
) {
discussion->count = 0;
switch(data->reason) {
// Match Start Conversations
case POKER_DISCUSSION_REASON_MATCH_START:
discussion->count++;
discussion->messages[0] = "Match Start";
break;
// Round Start Conversations
case POKER_DISCUSSION_REASON_ROUND_START:
discussion->count++;
discussion->messages[0] = "Round Start";
break;
// Fallback
default:
discussion->count++;
discussion->messages[0] = "Hmm, this seems to be an error message.";
break;
}
}
void pokerDiscussionQueue(pokerdiscussiondata_t *data) {
pokerdiscussion_t discussion;
uint8_t i;
pokerDiscussionGet(&discussion, data);
for(i = 0; i < discussion.count; i++) {
vnConversationTalk(&data->poker->scene.conversation,
discussion.messages[i], NULL
);
}
}

View File

@ -0,0 +1,15 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
void pokerDiscussionGet(
pokerdiscussion_t *discussion, pokerdiscussiondata_t *data
);
void pokerDiscussionQueue(pokerdiscussiondata_t *data);