Trying to put it all together.
This commit is contained in:
		@@ -39,8 +39,9 @@
 | 
			
		||||
 | 
			
		||||
#include "game/dawn/dawngame.h"
 | 
			
		||||
 | 
			
		||||
#include "game/poker/pokergame.h"
 | 
			
		||||
#include "game/poker/pokerdiscussion.h"
 | 
			
		||||
#include "game/poker/pokergame.h"
 | 
			
		||||
#include "game/poker/pokergameaction.h"
 | 
			
		||||
#include "game/poker/pokergameassets.h"
 | 
			
		||||
#include "game/poker/pokerworld.h"
 | 
			
		||||
#include "game/poker/pokerui.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -9,10 +9,11 @@
 | 
			
		||||
#include "../../libs.h"
 | 
			
		||||
#include "pokergame.h"
 | 
			
		||||
 | 
			
		||||
/** Maximum number of messages that the discussion buffer can hold */
 | 
			
		||||
#define POKER_DISCUSSION_MESSAGE_COUNT_MAX 32
 | 
			
		||||
 | 
			
		||||
/** Why the discussion is happening */
 | 
			
		||||
#define POKER_DISCUSSION_REASON_TEST 0x00
 | 
			
		||||
 | 
			
		||||
#define POKER_DISCUSSION_REASON_MATCH_START 0x01
 | 
			
		||||
#define POKER_DISCUSSION_REASON_ROUND_START 0x02
 | 
			
		||||
#define POKER_DISCUSSION_REASON_BLINDS_TAKEN 0x03
 | 
			
		||||
@@ -26,5 +27,7 @@ typedef struct {
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  char *messages[POKER_DISCUSSION_MESSAGE_COUNT_MAX];
 | 
			
		||||
  uint8_t players[POKER_DISCUSSION_MESSAGE_COUNT_MAX];
 | 
			
		||||
  uint8_t emotions[POKER_DISCUSSION_MESSAGE_COUNT_MAX];
 | 
			
		||||
  uint8_t count;
 | 
			
		||||
} pokerdiscussion_t;
 | 
			
		||||
@@ -10,10 +10,25 @@
 | 
			
		||||
#include "pokergameassets.h"
 | 
			
		||||
#include "pokerworld.h"
 | 
			
		||||
#include "pokerui.h"
 | 
			
		||||
#include "pokergameaction.h"
 | 
			
		||||
#include "../../poker/poker.h"
 | 
			
		||||
#include "../../poker/player.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 0x00
 | 
			
		||||
 | 
			
		||||
#define POKER_GAME_PENNY_BASE_WIDTH 1000
 | 
			
		||||
#define POKER_GAME_PENNY_BASE_HEIGHT 1920
 | 
			
		||||
#define POKER_GAME_PENNY_FACE_X 367
 | 
			
		||||
#define POKER_GAME_PENNY_FACE_Y 256
 | 
			
		||||
#define POKER_GAME_PENNY_FACE_WIDTH 280
 | 
			
		||||
#define POKER_GAME_PENNY_FACE_HEIGHT 280
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  /** Poker Game State */
 | 
			
		||||
  poker_t poker;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								include/dawn/game/poker/pokergameaction.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								include/dawn/game/poker/pokergameaction.h
									
									
									
									
									
										Normal 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 "../../libs.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  pokergame_t *game;
 | 
			
		||||
  uint8_t player;
 | 
			
		||||
} pokergameactionlook_t;
 | 
			
		||||
@@ -9,6 +9,17 @@
 | 
			
		||||
#include "../../libs.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_POSITION_X(n) ( \
 | 
			
		||||
  POKER_WORLD_SEAT_DISTANCE * (float)sin(POKER_WORLD_SEAT_ROTATION(n)) \
 | 
			
		||||
)
 | 
			
		||||
#define POKER_WORLD_SEAT_POSITION_Y -0.2f
 | 
			
		||||
#define POKER_WORLD_SEAT_POSITION_Z(n) ( \
 | 
			
		||||
  POKER_WORLD_SEAT_DISTANCE * (float)cos(POKER_WORLD_SEAT_ROTATION(n)) \
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  primitive_t skywall;
 | 
			
		||||
} pokerworld_t;
 | 
			
		||||
@@ -22,6 +22,9 @@ typedef struct {
 | 
			
		||||
 | 
			
		||||
  /** Character this conversation piece belongs to */
 | 
			
		||||
  vncharacter_t *character;
 | 
			
		||||
 | 
			
		||||
  /** Character's emotion */
 | 
			
		||||
  uint8_t emotion;
 | 
			
		||||
} vnconversationitemdata_t;
 | 
			
		||||
 | 
			
		||||
/** Representation of a conversation, laid out similarly to a timeline. */
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,13 @@
 | 
			
		||||
#define VN_SCENE_CHARACTERS_MAX 6
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
  float cameraX;
 | 
			
		||||
  float cameraY;
 | 
			
		||||
  float cameraZ;
 | 
			
		||||
  float cameraLookX;
 | 
			
		||||
  float cameraLookY;
 | 
			
		||||
  float cameraLookZ;
 | 
			
		||||
 | 
			
		||||
  /** Camera used for rendering, updated frequently */
 | 
			
		||||
  camera_t camera;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								src/game/poker/actions/look.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/game/poker/actions/look.c
									
									
									
									
									
										Normal 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;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								src/game/poker/actions/look.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/game/poker/actions/look.h
									
									
									
									
									
										Normal 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);
 | 
			
		||||
@@ -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]
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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(
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 * 
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@ void _vnConversationTalkStart(queue_t *queue,queueaction_t *action,uint8_t i) {
 | 
			
		||||
  vnTextBoxSetText(&data->conversation->textbox, data->text);
 | 
			
		||||
 | 
			
		||||
  if(data->character != NULL) {
 | 
			
		||||
    data->character->emotion = data->emotion;
 | 
			
		||||
    data->character->talking = true;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -21,6 +22,7 @@ void _vnConversationTalkStart(queue_t *queue,queueaction_t *action,uint8_t i) {
 | 
			
		||||
void _vnConversationTalkUpdate(queue_t *queue,queueaction_t *action,uint8_t i) {
 | 
			
		||||
  vnconversationitemdata_t *data;
 | 
			
		||||
  data = (vnconversationitemdata_t *)action->data;
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  if(data->conversation->textbox.state & VN_TEXTBOX_STATE_CLOSED) {
 | 
			
		||||
    if(data->character != NULL) data->character->talking = false;
 | 
			
		||||
@@ -31,7 +33,8 @@ void _vnConversationTalkUpdate(queue_t *queue,queueaction_t *action,uint8_t i) {
 | 
			
		||||
queueaction_t * vnConversationTalk(
 | 
			
		||||
  vnconversation_t *conversation,
 | 
			
		||||
  char *text,
 | 
			
		||||
  vncharacter_t *character
 | 
			
		||||
  vncharacter_t *character,
 | 
			
		||||
  uint8_t emotion
 | 
			
		||||
) {
 | 
			
		||||
  queueaction_t *action;
 | 
			
		||||
  vnconversationitemdata_t *data;
 | 
			
		||||
@@ -43,6 +46,7 @@ queueaction_t * vnConversationTalk(
 | 
			
		||||
  data = (vnconversationitemdata_t *)action->data;
 | 
			
		||||
  data->text = text;
 | 
			
		||||
  data->character = character;
 | 
			
		||||
  data->emotion = emotion;
 | 
			
		||||
 | 
			
		||||
  return action;
 | 
			
		||||
}
 | 
			
		||||
@@ -27,5 +27,6 @@ void _vnConversationTalkUpdate(queue_t *q, queueaction_t *a, uint8_t i);
 | 
			
		||||
queueaction_t * vnConversationTalk(
 | 
			
		||||
  vnconversation_t *conversation,
 | 
			
		||||
  char *text,
 | 
			
		||||
  vncharacter_t *character
 | 
			
		||||
  vncharacter_t *character,
 | 
			
		||||
  uint8_t emotion
 | 
			
		||||
);
 | 
			
		||||
@@ -45,9 +45,7 @@ void vnCharacterInit(
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  // Buffer the base quad, this never changes (currently)
 | 
			
		||||
  _vnCharacterBuffer(character, 
 | 
			
		||||
    0, 0, baseWidth, baseHeight, 0, 0, 0
 | 
			
		||||
  );
 | 
			
		||||
  _vnCharacterBuffer(character, 0, 0, baseWidth, baseHeight, 0, 0, 0);
 | 
			
		||||
  _vnCharacterFaceBuffer(character, 0, VN_CHARACTER_QUAD_EYEBROWS);
 | 
			
		||||
  _vnCharacterFaceBuffer(character, 0, VN_CHARACTER_QUAD_EYES);
 | 
			
		||||
  _vnCharacterFaceBuffer(character, 0, VN_CHARACTER_QUAD_MOUTH);
 | 
			
		||||
@@ -62,11 +60,9 @@ void _vnCharacterBuffer(vncharacter_t *character,
 | 
			
		||||
  float tpx = 1.0f / (float)character->texture->width;
 | 
			
		||||
  float tpy = 1.0f / (float)character->texture->height;
 | 
			
		||||
 | 
			
		||||
  // Center on the X axis
 | 
			
		||||
  x -= (float)character->baseWidth / 2.0f;
 | 
			
		||||
 | 
			
		||||
  // Put on the feet
 | 
			
		||||
  y -= character->baseHeight;
 | 
			
		||||
  // Center inside the character
 | 
			
		||||
  x -= (float)character->baseWidth / 2;
 | 
			
		||||
  y += (float)character->baseHeight / 2;
 | 
			
		||||
 | 
			
		||||
  quadBuffer(&character->primitive, 0.001f * (float)i,
 | 
			
		||||
    (float)x * ps, 1 - (float)y * ps,
 | 
			
		||||
@@ -110,10 +106,6 @@ void vnCharacterUpdate(vncharacter_t *character, engine_t *engine) {
 | 
			
		||||
  }
 | 
			
		||||
  _vnCharacterFaceBuffer(character, mouth, VN_CHARACTER_QUAD_MOUTH);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // float n;
 | 
			
		||||
  // // Update the blinking frames
 | 
			
		||||
  // n = (engine->time.current - character->blinkStart) * 3.0f;
 | 
			
		||||
@@ -143,7 +135,7 @@ void vnCharacterUpdate(vncharacter_t *character, engine_t *engine) {
 | 
			
		||||
  // Update the scale frames for breathing / talk breathing
 | 
			
		||||
  float speed, amount;
 | 
			
		||||
  speed = 0.2f;
 | 
			
		||||
  amount = 300.0f;
 | 
			
		||||
  amount = 90.0f;
 | 
			
		||||
  t = animForwardAndBackwardScaled(
 | 
			
		||||
    mathModFloat(engine->time.current, 1 / speed) * speed
 | 
			
		||||
  );
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,13 @@ void vnSceneInit(vnscene_t *scene, font_t *font, texture_t *text) {
 | 
			
		||||
  vnConversationInit(&scene->conversation, font, text);
 | 
			
		||||
  scene->conversation.textbox.linesMax = 3;
 | 
			
		||||
 | 
			
		||||
  scene->cameraX = 0;
 | 
			
		||||
  scene->cameraY = 0;
 | 
			
		||||
  scene->cameraZ = 0;
 | 
			
		||||
  scene->cameraLookX = 0;
 | 
			
		||||
  scene->cameraLookY = 0;
 | 
			
		||||
  scene->cameraLookZ = -5;
 | 
			
		||||
 | 
			
		||||
  // Reset character count
 | 
			
		||||
  scene->characterCount = 0x00;
 | 
			
		||||
}
 | 
			
		||||
@@ -34,9 +41,10 @@ void vnSceneDispose(vnscene_t *scene) {
 | 
			
		||||
 | 
			
		||||
void vnSceneRenderWorld(vnscene_t *scene, engine_t *engine, shader_t *shader) {
 | 
			
		||||
  // Adjust 3D Space position
 | 
			
		||||
 | 
			
		||||
  cameraLookAt(&scene->camera,
 | 
			
		||||
    0, 0, 0.5f,
 | 
			
		||||
    0, 0, -0.5
 | 
			
		||||
    scene->cameraX, scene->cameraY, scene->cameraZ,
 | 
			
		||||
    scene->cameraLookX, scene->cameraLookY, scene->cameraLookZ
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  // Set Camera Perspective
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user