66 lines
1.7 KiB
C
66 lines
1.7 KiB
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "pokerworld.h"
|
|
|
|
void pokerWorldInit(
|
|
pokerworld_t *world,
|
|
vnscene_t *scene,
|
|
pokergameassets_t *assets
|
|
) {
|
|
vncharacter_t *character;
|
|
texture_t *texture;
|
|
uint8_t i;
|
|
|
|
world->seat = POKER_WORLD_SEAT_DEALER;
|
|
world->seatTime = 0;
|
|
|
|
// Initialize the skywal
|
|
skywallInit(&world->skywall);
|
|
|
|
// Initialize the players
|
|
for(i = 0x00; i < POKER_PLAYER_COUNT_MAX; i++) {
|
|
character = scene->characters + scene->characterCount;
|
|
texture = assets->characterTextures + i;
|
|
assetTextureLoad(texture, POKER_CHARACTER_DEFINITIONS[i].fileTexture);
|
|
pokerCharacterInit(character, texture, i);
|
|
pokerWorldSitCharacter(character, POKER_WORLD_SEAT_FOR_PLAYER(i));
|
|
scene->characterCount++;
|
|
}
|
|
}
|
|
|
|
void pokerWorldSitCharacter(vncharacter_t *character, uint8_t seat) {
|
|
character->x = POKER_WORLD_SEAT_POSITION_X(seat);
|
|
character->y = POKER_WORLD_SEAT_POSITION_Y;
|
|
character->z = POKER_WORLD_SEAT_POSITION_Z(seat);
|
|
character->yaw = POKER_WORLD_SEAT_ROTATION(seat);
|
|
}
|
|
|
|
void pokerWorldLookAtPlayer(
|
|
vnscene_t *scene, uint8_t playerIndex
|
|
) {
|
|
vncharacter_t *character = scene->characters + playerIndex;
|
|
vnSceneLookAt(scene,
|
|
scene->cameraLook.x,
|
|
scene->cameraLook.y,
|
|
scene->cameraLook.z,
|
|
character->x,
|
|
scene->cameraLook.lookY,
|
|
character->z
|
|
);
|
|
}
|
|
|
|
void pokerWorldRender(pokerworld_t *world, pokergameassets_t *assets) {
|
|
// Render the wall
|
|
shaderUseTexture(&assets->shader, &assets->roomTexture);
|
|
shaderUsePosition(&assets->shader, 0,2,0, 0,0,0);
|
|
primitiveDraw(&world->skywall, 0, -1);
|
|
}
|
|
|
|
void pokerWorldDispose(pokerworld_t *world) {
|
|
primitiveDispose(&world->skywall);
|
|
} |