diff --git a/include/dawn/game/poker/pokergame.h b/include/dawn/game/poker/pokergame.h index 624589d9..98c0e0bb 100644 --- a/include/dawn/game/poker/pokergame.h +++ b/include/dawn/game/poker/pokergame.h @@ -14,14 +14,13 @@ #include "pokergameaction.h" #include "../../poker/poker.h" #include "../../poker/player.h" +#include "../../poker/dealer.h" #include "../../vn/vnconversation.h" #include "../../vn/vnscene.h" #define POKER_GAME_SEAT_COUNT 8 -#define POKER_GAME_SEAT_FOR_PLAYER(p) (p < POKER_PLAYER_HUMAN_INDEX ? \ - p + 1 : POKER_GAME_SEAT_COUNT - (p - POKER_PLAYER_HUMAN_INDEX) \ -) -#define POKER_GAME_SEAT_DEALER POKER_PLAYER_COUNT +#define POKER_GAME_SEAT_FOR_PLAYER(p) (p - (POKER_PLAYER_COUNT/2)) +#define POKER_GAME_SEAT_DEALER POKER_GAME_SEAT_FOR_PLAYER(POKER_DEALER_INDEX) #define POKER_GAME_PENNY_BASE_WIDTH 1000 #define POKER_GAME_PENNY_BASE_HEIGHT 1920 diff --git a/include/dawn/game/poker/pokerworld.h b/include/dawn/game/poker/pokerworld.h index cba44afd..d671bef8 100644 --- a/include/dawn/game/poker/pokerworld.h +++ b/include/dawn/game/poker/pokerworld.h @@ -7,10 +7,11 @@ #pragma once #include "../../libs.h" +#include "../../util/math.h" #include "../../display/primitive.h" #define POKER_WORLD_SEAT_DISTANCE -1 -#define POKER_WORLD_SEAT_ROTATION(n) ((8 - n) * 0.785398) +#define POKER_WORLD_SEAT_ROTATION(n) (n * mathDeg2Rad(45.0f)) #define POKER_WORLD_SEAT_POSITION_X(n) ( \ POKER_WORLD_SEAT_DISTANCE * (float)sin(POKER_WORLD_SEAT_ROTATION(n)) \ diff --git a/include/dawn/poker/dealer.h b/include/dawn/poker/dealer.h index 925c8a5f..56061e32 100644 --- a/include/dawn/poker/dealer.h +++ b/include/dawn/poker/dealer.h @@ -16,7 +16,7 @@ #define POKER_DEALER_GRAVE_SIZE CARD_DECK_SIZE /** Which VN Character index is the dealer */ -#define POKER_DEALER_INDEX POKER_PLAYER_COUNT +#define POKER_DEALER_INDEX POKER_PLAYER_HUMAN_INDEX /** Representation of the dealer state */ typedef struct { diff --git a/src/game/poker/discussion/pokerdiscussion.c b/src/game/poker/discussion/pokerdiscussion.c index fe7980e1..6fee1c82 100644 --- a/src/game/poker/discussion/pokerdiscussion.c +++ b/src/game/poker/discussion/pokerdiscussion.c @@ -15,12 +15,23 @@ void pokerDiscussionGet( sizeof(uint8_t) * POKER_DISCUSSION_MESSAGE_COUNT_MAX ); + for(uint8_t i = 0; i < POKER_PLAYER_COUNT; i++) { + char *buffer = malloc(sizeof(char) * 50); + sprintf(buffer, "Player %u", i); + discussion->messages[discussion->count] = buffer; + discussion->emotions[discussion->count] = i * 16; + discussion->players[discussion->count] = i; + discussion->count++; + } + + return; + switch(data->reason) { // Match Start Conversations case POKER_DISCUSSION_REASON_MATCH_START: discussion->count++; discussion->messages[0] = "Match Start"; - discussion->players[0] = POKER_DEALER_INDEX; + discussion->players[0] = 0; discussion->emotions[0] = VN_CHARACTER_EMOTION_ANGRY; break; @@ -28,7 +39,7 @@ void pokerDiscussionGet( case POKER_DISCUSSION_REASON_ROUND_START: discussion->count++; discussion->messages[0] = "Round Start"; - discussion->players[0] = 2; + discussion->players[0] = 1; discussion->emotions[0] = VN_CHARACTER_EMOTION_ANIME_MOM; break; @@ -52,10 +63,9 @@ void pokerDiscussionQueue(pokerdiscussiondata_t *data) { player = discussion.players[i]; pokerGameActionLookAdd(data->poker, player); - vnConversationTalk(&data->poker->scene.conversation, discussion.messages[i], - player == 0xFF ? NULL : data->poker->scene.characters + player, + data->poker->scene.characters + player, discussion.emotions[i] ); } diff --git a/src/game/poker/pokerworld.c b/src/game/poker/pokerworld.c index 7301de2d..07027481 100644 --- a/src/game/poker/pokerworld.c +++ b/src/game/poker/pokerworld.c @@ -16,7 +16,6 @@ void pokerWorldInit(pokergame_t *game) { // 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, @@ -25,31 +24,16 @@ void pokerWorldInit(pokergame_t *game) { ); 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->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++; } - - // Dealer (Penny) - 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_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++; - - 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 ? + playerIndex == POKER_DEALER_INDEX ? POKER_GAME_SEAT_DEALER : POKER_GAME_SEAT_FOR_PLAYER(playerIndex) ); diff --git a/src/vn/vnscene.c b/src/vn/vnscene.c index 94518e4c..4637346b 100644 --- a/src/vn/vnscene.c +++ b/src/vn/vnscene.c @@ -41,19 +41,19 @@ void vnSceneDispose(vnscene_t *scene) { void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader) { // Adjust 3D Space position - - // cameraLookAt(&scene->camera, - // scene->cameraX, scene->cameraY, scene->cameraZ, - // scene->cameraLookX, scene->cameraLookY, scene->cameraLookZ - // ); - - float d = 2; - - cameraOrbit(&scene->camera, - 2, engine->time.current / 3.0f, mathDeg2Rad(35), - 0, 0, 0 + cameraLookAt(&scene->camera, + scene->cameraX, scene->cameraY, scene->cameraZ, + scene->cameraLookX, scene->cameraLookY, scene->cameraLookZ ); + if(false) { + float d = 2; + cameraOrbit(&scene->camera, + 2, engine->time.current / 3.0f, mathDeg2Rad(35), + 0, 0, 0 + ); + } + // Set Camera Perspective cameraPerspective(&scene->camera, 35, engine->render.width/engine->render.height,