Trying to put it all together.

This commit is contained in:
2021-08-24 08:54:27 -07:00
parent d9f11c764e
commit c198cd9908
18 changed files with 201 additions and 32 deletions

View File

@ -0,0 +1,24 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "look.h"
void _pokerGameActionLookOnStart(
queue_t *queue, queueaction_t *action, uint8_t i
) {
printf("Looking at %u\n", (uint8_t)action->data);
pokerWorldLookAtPlayer(action);
queueNext(queue);
}
queueaction_t * pokerGameActionLookAdd(pokergame_t *game, uint8_t playerIndex) {
queueaction_t *action = pokerGameActionAdd(game);
action->onStart = &_pokerGameActionLookOnStart;
return action;
}

View File

@ -0,0 +1,25 @@
/**
* 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"
#include "../../../display/animation/queue.h"
#include "../pokerworld.h"
void _pokerGameActionLookOnStart(
queue_t *queue, queueaction_t *action, uint8_t i
);
/**
* Queues a look action to the poker game.
*
* @param game Game to add to.
* @param playerIndex The player index to look at.
* @return The queued action.
*/
queueaction_t * pokerGameActionLookAdd(pokergame_t *game, uint8_t playerIndex);

View File

@ -11,37 +11,51 @@ void pokerDiscussionGet(
pokerdiscussion_t *discussion, pokerdiscussiondata_t *data
) {
discussion->count = 0;
memset(discussion->players, 0xFF,
sizeof(uint8_t) * POKER_DISCUSSION_MESSAGE_COUNT_MAX
);
switch(data->reason) {
// Match Start Conversations
case POKER_DISCUSSION_REASON_MATCH_START:
discussion->count++;
discussion->messages[0] = "Match Start";
discussion->players[0] = 0;
discussion->emotions[0] = VN_CHARACTER_EMOTION_ANGRY;
break;
// Round Start Conversations
case POKER_DISCUSSION_REASON_ROUND_START:
discussion->count++;
discussion->messages[0] = "Round Start";
discussion->players[0] = 0;
discussion->emotions[0] = VN_CHARACTER_EMOTION_XXXX_THINKING10;
break;
// Fallback
default:
discussion->count++;
discussion->messages[0] = "Hmm, this seems to be an error message.";
discussion->players[0] = 0;
discussion->emotions[0] = VN_CHARACTER_EMOTION_CONCERNED_WORRIED;
break;
}
}
void pokerDiscussionQueue(pokerdiscussiondata_t *data) {
pokerdiscussion_t discussion;
uint8_t i;
uint8_t i, player;
pokerDiscussionGet(&discussion, data);
for(i = 0; i < discussion.count; i++) {
player = discussion.players[i];
if(player != 0xFF) pokerGameActionLookAdd(data->poker, player);
vnConversationTalk(&data->poker->scene.conversation,
discussion.messages[i], NULL
discussion.messages[i],
player == 0xFF ? NULL : data->poker->scene.characters + player,
discussion.emotions[i]
);
}
}

View File

@ -9,6 +9,7 @@
#include <dawn/dawn.h>
#include "../../../vn/conversation/vnconversation.h"
#include "../../../vn/conversation/talk.h"
#include "../actions/look.h"
void pokerDiscussionGet(
pokerdiscussion_t *discussion, pokerdiscussiondata_t *data

View File

@ -22,17 +22,6 @@ bool pokerGameInit(game_t *game) {
// Initialize the world
pokerWorldInit(pokerGame);
vncharacter_t *character = pokerGame->scene.characters + 0;
vnCharacterInit(character, &pokerGame->assets.pennyTexture,
1000, 1920,
367,256, 280,280
);
character->y = -1.7f;
character->z = -0.3f;
pokerGame->scene.characterCount++;
// Initialize the UI.
pokerUiInit(pokerGame);

View File

@ -8,8 +8,54 @@
#include "pokerworld.h"
void pokerWorldInit(pokergame_t *game) {
vncharacter_t *character;
uint8_t i;
// Initialize the skywal
skywallInit(&game->world.skywall);
// Dealer (Penny)
character = game->scene.characters + POKER_GAME_SEAT_DEALER;
vnCharacterInit(character, &game->assets.pennyTexture,
POKER_GAME_PENNY_BASE_WIDTH, POKER_GAME_PENNY_BASE_HEIGHT,
POKER_GAME_PENNY_FACE_X, POKER_GAME_PENNY_FACE_Y,
POKER_GAME_PENNY_FACE_WIDTH, POKER_GAME_PENNY_FACE_HEIGHT
);
character->x = POKER_WORLD_SEAT_POSITION_X(POKER_GAME_SEAT_DEALER);
character->y = POKER_WORLD_SEAT_POSITION_Y;
character->z = POKER_WORLD_SEAT_POSITION_Z(POKER_GAME_SEAT_DEALER);
character->yaw = POKER_WORLD_SEAT_ROTATION(POKER_GAME_SEAT_DEALER);
game->scene.characterCount++;
// Initialize the players
for(i = 0x00; i < POKER_PLAYER_COUNT; i++) {
if(i == POKER_PLAYER_HUMAN_INDEX) continue;
character = game->scene.characters + game->scene.characterCount;
vnCharacterInit(character, &game->assets.pennyTexture,
POKER_GAME_PENNY_BASE_WIDTH, POKER_GAME_PENNY_BASE_HEIGHT,
POKER_GAME_PENNY_FACE_X, POKER_GAME_PENNY_FACE_Y,
POKER_GAME_PENNY_FACE_WIDTH, POKER_GAME_PENNY_FACE_HEIGHT
);
character->x = POKER_WORLD_SEAT_POSITION_X(POKER_GAME_SEAT_FOR_PLAYER(i));
character->y = POKER_WORLD_SEAT_POSITION_Y;
character->z = POKER_WORLD_SEAT_POSITION_Z(POKER_GAME_SEAT_FOR_PLAYER(i));
character->yaw = POKER_WORLD_SEAT_ROTATION(POKER_GAME_SEAT_FOR_PLAYER(i));
game->scene.characterCount++;
}
pokerWorldLookAtPlayer(&game->scene, 0x00);
}
void pokerWorldLookAtPlayer(vnscene_t *scene, uint8_t playerIndex) {
uint8_t seat;
seat = (
playerIndex >= POKER_PLAYER_COUNT || playerIndex == POKER_PLAYER_HUMAN_INDEX ?
POKER_GAME_SEAT_DEALER :
POKER_GAME_SEAT_FOR_PLAYER(playerIndex)
);
scene->cameraLookX = POKER_WORLD_SEAT_POSITION_X(seat);
scene->cameraLookZ = POKER_WORLD_SEAT_POSITION_Z(seat);
}
void pokerWorldRender(

View File

@ -11,6 +11,7 @@
#include "../../display/primitive.h"
#include "../../display/primitives/skywall.h"
#include "../../vn/vnscene.h"
#include "../../vn/vncharacter.h"
/**
* Initialize the poker renderer.
@ -19,6 +20,15 @@
*/
void pokerWorldInit(pokergame_t *game);
/**
* Adjusts the camera to look at a specific player. You can use this to look at
* the dealer by referencing the POKER_PLAYER_COUNT as the index.
*
* @param scene Scene to adjust.
* @param playerIndex Player index to look at.
*/
void pokerWorldLookAtPlayer(vnscene_t *scene, uint8_t playerIndex);
/**
* Render the poker world.
*