int main(int argc, char** argv)
{
- IVec2 grid_size = {.x = GRID_X * 1.0, .y = GRID_Y * 1.0};
+ IVec2 grid_size = {.x = GRID_X * 1.5, .y = GRID_Y * 1.5};
FVec2 **grid = NULL;
grid = (FVec2**)malloc(grid_size.x * sizeof(FVec2*));
for (int n = 0; n < grid_size.x; n++)
Material barrow_material;
Matrix barrow_transform;
Vector3 barrow_position;
+Vector3 barrow_scale;
Vector3 player_velocity;
Vector3 player_rotation;
void initialize_renderer()
{
+ barrow_scale = (Vector3){64.0f, 8.0f, 64.0f};
barrow_position = (Vector3){-8.0f, 0.0f, -8.0f};
barrow_image = LoadImage("./barrow.png");
diffuse_texture = LoadTexture("./barrow_diffuse.png");
while(!IsTextureReady(barrow_texture)){}
while(!IsTextureReady(diffuse_texture)){}
- barrow_meshes[0U] = GenMeshHeightmap(barrow_image, (Vector3){64.0f, 8.0f, 64.0f});
+ barrow_meshes[0U] = GenMeshHeightmap(barrow_image, barrow_scale);
barrow_model = LoadModelFromMesh(barrow_meshes[0]);
barrow_model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = diffuse_texture;
cam.position.y += 3.0f;
cam.target = (Vector3){0.0f, cam.position.y * 0.66f, 0.0f};
cam.up = (Vector3){0.0f, 1.0f, 0.0f};
- cam.fovy = 45.0f;
+ cam.fovy = 75.0f;
cam.projection= CAMERA_PERSPECTIVE;
DisableCursor();
EndMode3D();
DrawTexture(barrow_texture, 64, 64, RAYWHITE);
+ DrawCircle(
+ 64+(cam.position.x) + (barrow_image.width/4.0f),
+ 64+(cam.position.z) + (barrow_image.height/4.0f),
+ 2.0f, RED);
DrawFPS(10, 10);
EndDrawing();
const char chars[6] = {' ', ' ', ' ', '+', '#', '@'};
const int max_chars = sizeof(chars) / sizeof(chars[0]) - 1;
-const IVec2 screen_dims = {.x = 1600, .y = 900};
+const IVec2 screen_dims = {.x = 1200, .y = 800};
const char* screen_title = "Barrow Crawler";
const int target_fps = 60;
}
/* Set up seed-points to create connected rooms */
- const int seed_count = sqrt(grid_size.x) * 2;
+ const int seed_count = 9;//sqrt(grid_size.x) * 2;
const int width = 12 * (grid_size.x/128);
const int height = width * 1;
+
+ float phase = ((rand() % 360)/(float)360) * (M_PI*2);
for (int n = 0; n < seed_count; n++)
{
- int rand_x = rand() % grid_size.x;
- int rand_y = rand() % grid_size.y;
- grid[rand_x][rand_y].b = 1.0f;
- grid[rand_x][rand_y].c = 0.0f;
+ /* Generate n seeds at even radial points, random phase offset */
+ float angle = ((float)n/(float)seed_count) * (M_PI * 2);
+ angle += phase;
+
+ int seed_x = ((cosf(angle) * (grid_size.x/4.0f)) + (grid_size.x/2.0f));
+ int seed_y = ((sinf(angle) * (grid_size.x/4.0f)) + (grid_size.x/2.0f));
+ grid[seed_x][seed_y].b = 1.0f;
+ grid[seed_x][seed_y].c = 0.0f;
- for (int x = rand_x-(width/2); x < rand_x+(width/2); x++)
+ for (int x = seed_x-(width/2); x < seed_x+(width/2); x++)
{
- for (int y = rand_y-(height/2); y < rand_y+(height/2); y++)
+ for (int y = seed_y-(height/2); y < seed_y+(height/2); y++)
{
if (y >= grid_size.y || x >= grid_size.x || y < 0 || x < 0)
continue;