/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "pokerworld.h" void pokerWorldInit(pokergame_t *game) { vncharacter_t *character; uint8_t i; // Initialize the skywal skywallInit(&game->world.skywall); // 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++; } // 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 ? 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( pokerworld_t *world, engine_t *engine, 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(pokergame_t *game) { primitiveDispose(&game->world.skywall); }