]> git.mcshandy.xyz Git - barrow_crawler/commitdiff
Update hand asset and orb to be a bit bigger, start working on some antagonist spirit...
authorRandy McShandy <randy@mcshandy.xyz>
Tue, 18 Jun 2024 02:36:47 +0000 (21:36 -0500)
committerRandy McShandy <randy@mcshandy.xyz>
Tue, 18 Jun 2024 02:36:47 +0000 (21:36 -0500)
bin/posix_BC
src/main.c
src/render_raylib.c
src/shaders/lighting.fs
src/spirit.c [new file with mode: 0644]
src/spirit.h [new file with mode: 0644]
src/structs.c
src/structs.h
src/utils.c

index abf54b7ab6d676b0f791d36eb97ef26d740da064..378bd79aa3cffd11bfb0063ed5d6b311bd7b8008 100755 (executable)
Binary files a/bin/posix_BC and b/bin/posix_BC differ
index dd185318ca79fd6f9382a158233be5340923877e..bf43b6455a4b0d372f70a07537dcc4628c819d8c 100755 (executable)
@@ -15,8 +15,10 @@ void print_rlog(int logLevel, const char* text, va_list args)
 int main(int argc, char** argv)
 {
 
+       room_positions = (Vector3*)malloc(sizeof(Vector3)*(room_count + 1));
+
 /* TODO: Clean this up and integrate into platform system. */
-#define ENABLE_BARROWGEN 1
+#define ENABLE_BARROWGEN 0
 #if ENABLE_BARROWGEN
        barrow.max_iterations *= 1;
        IVec2 grid_size = {.x = GRID_X*2.0, .y = GRID_Y * 2.0};
@@ -42,6 +44,8 @@ int main(int argc, char** argv)
        start_render_loop();
 #endif /* ENABLE_BARROWGEN */
 
+       free(room_positions);
+
        return 0;
 }
 
index 429fc82af5a89414f2b5d94b6d8744fdc3c558fa..51210ce730b3fd6e7b1cab431aa05b3f3128033f 100644 (file)
@@ -119,11 +119,13 @@ void drawing_game_mode()
        DrawModelEx(barrow_model, barrow_position, barrow_rotation_axis, barrow_rotation, barrow_scale, DARKGRAY);
        DrawModelEx(floor_model, floor_position, floor_rotation_axis, floor_rotation, floor_scale, DARKGRAY);
 
+       DrawSphere(room_positions[0], 0.25, RED);
+
        EndShaderMode();
        EndMode3D();
 
        orb_normal_color = ColorNormalize(orb_color);
-       orb_intensity = 64.0f; /* TODO: normalized distance from center, but lighting shader already has this. */
+       orb_intensity = 84.0f; /* TODO: normalized distance from center, but lighting shader already has this. */
        orb_directionality = player_angles;
 
        DrawTextureEx(hand_01_texture, hand_position, hand_rotation, hand_scale, orb_color);
@@ -139,14 +141,14 @@ void drawing_game_mode()
                DrawText(TextFormat("tgt x %f\ntgt y %f\ntgt z %f", cam.target.x, cam.target.y, cam.target.z), 0, 128+64, 16, GREEN);
                DrawText(TextFormat("rot x %f\nrot y %f\nrot z %f", player_angles.x, player_angles.y, player_angles.z), 0, 128+(64*2), 16, GREEN);
                DrawText(TextFormat("ray hit %d\nlength %f", player_collision.hit, player_collision.distance), 0, 128+(64*3), 16, GREEN);
-               DrawText(TextFormat("vel x %f\nvel y %f\nvel z %f", player_velocity.x, player_velocity.y, player_velocity.z), 0, 128+(64*4), 16, GREEN);
+               DrawText(TextFormat("c x %f\nc y %f\nc z %f", room_positions[0].x, room_positions[0].y, room_positions[0].z), 0, 128+(64*4), 16, GREEN);
        }
 }
 
 void drawing_resource_ready_mode()
 {
        static int status_phase = 0;
-       const float font_size =32.0f;
+       const float font_size = 32.0f;
        const char format_string[] = "%s\n\n%3.2f%%";
        const char tribute_string[] = "This game is dedicated to the North American Muskrat, Ondatra Zibethicus";
 
@@ -308,6 +310,9 @@ void wait_initialize_resources()
                barrow_model.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = barrow_albedo;
                barrow_model.materials[0].shader = shader;
 
+               room_positions[0] = (Vector3){barrow_scale.x/2.0f, floor_position.y - 1.0f, -barrow_scale.z/2.0f};
+               printf("sphere %f %f %f\n", VEC3_UNROLL(room_positions[0]));
+
                while(!IsModelReady(barrow_model)){}
        }
 
@@ -342,7 +347,7 @@ void wait_initialize_resources()
                while(!IsModelReady(coffin_model)){}
                coffin_model.materials[0].shader = shader;
 
-               hand_01_image = LoadImage("./assets/hand_1.png");
+               hand_01_image = LoadImage("./assets/hand_2.png");
                while(!IsImageReady(hand_01_image)){}
                hand_01_texture = LoadTextureFromImage(hand_01_image);
                while(!IsTextureReady(hand_01_texture)){}
index 286780189ce40ab8db13110cf7b6c8a253585e05..fb34caf0d01708699e632e1fdfea9c95904f7a05 100644 (file)
@@ -25,7 +25,7 @@ const float max_lit_distance = 7.5f;
 const float max_center_distance = 8.0f;
 vec4 candle_color = vec4(228.0f/255.0f, 103.0f/255.0f, 1.0f/255.0f, 255.0f/255.0f);
 
-vec2 orb_pos = vec2(3.0 * (screen_dims.x/16), 8 * (screen_dims.y/16));
+vec2 orb_pos = vec2(5.0 * (screen_dims.x/16), 8 * (screen_dims.y/16));
 
 float lumWeight = 0.0f;
 
diff --git a/src/spirit.c b/src/spirit.c
new file mode 100644 (file)
index 0000000..a34eef9
--- /dev/null
@@ -0,0 +1,47 @@
+#include <raylib.h>
+#include <time.h>
+#include "spirit.h"
+
+spirit _spirit;
+
+void init_spirit(spirit* s)
+{
+
+}
+
+int spirit_check_need_popup(const spirit* s, const time_t _time)
+{
+       int need_popup = 0;
+
+       if ((_time % s->popup_time_seconds) == 0)
+       {
+
+       }
+
+       return need_popup;
+}
+
+size_t spirit_get_new_room(const spirit* s)
+{
+       size_t new_room = 0;
+
+       /*
+               Random selection here once I feel like it
+       */
+
+       return new_room;
+}
+
+void spirit_update_tick(spirit* s)
+{
+       time_t epoch_time = time(NULL);
+       int need_popup = spirit_check_need_popup(s, epoch_time);
+
+
+       if (need_popup)
+       {
+               s->active_room = spirit_get_new_room(s);
+       //      s->position =
+       }
+}
+
diff --git a/src/spirit.h b/src/spirit.h
new file mode 100644 (file)
index 0000000..9e2ebc3
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef __SPIRIT__
+#define __SPIRIT__
+
+#include <raylib.h>
+#include <stddef.h>
+
+typedef struct
+{
+       Model   model;
+       Vector3 position;
+       Vector3 scale;
+       Vector3 rotation_axis;
+       float   rotation;
+
+       size_t popup_time_seconds;
+       size_t active_room;
+} spirit;
+
+extern spirit _spirit;
+
+#endif /* __SPIRIT__ */
+
index 78c825f9b56a3cef9c56579e34669d386bbbd40a..91b6bdab07a5ff9e1fcf534e65b79260824efb19 100644 (file)
@@ -1,3 +1,4 @@
+#include <raylib.h>
 #include "structs.h"
 
 // Connectivity increases as time passes (iterations or time delta)?
@@ -80,3 +81,6 @@ const IVec2 img_export_scale = {.x = 2, .y = 2};
 float resource_generation_progress = 0.0f;
 int resource_state = 0;
 
+const int room_count = 7;
+Vector3* room_positions = NULL;
+
index 3be86c186572c7eee1a3399d0cbd62c1376dbde0..6e87c1da2452b4bbb0ab4ef549759c2c2cc0ebad 100644 (file)
@@ -5,6 +5,7 @@
 #define GRID_Y GRID_X
 
 #include <stddef.h>
+#include <raylib.h>
 
 typedef enum
 {
@@ -32,6 +33,13 @@ typedef struct
        int y;
 } IVec2;
 
+typedef struct
+{
+       float x;
+       float y;
+       float z;
+} Vec3;
+
 typedef struct
 {
        int max_iterations;
@@ -86,6 +94,9 @@ extern const IVec2 img_export_scale;
 extern float resource_generation_progress;
 extern int resource_state;
 
+extern const int room_count;
+extern Vector3* room_positions;
+
 //int generate_rd(int worker_count, RD_Opts active_opt, FVec2 **grid_buffer, IVec2 pgrid_size);
 void* generate_rd(void* args);
 #endif //__RD_STRUCTS__
index 3a43541d4713c6c5e565ff86139edaa04e821dbb..2f65636bf720d18771c024e9f3f7b310e20c48bc 100644 (file)
@@ -105,6 +105,7 @@ int initialize(int worker_count, RD_Opts active_opt)
        int center_x = grid_size.x/2;
        int center_y = grid_size.y/2;
        float central_chamber_radius = barrow_radius/6;
+       room_positions[0] = (Vector3){.x = center_x, .y = 0.0f, .z = center_y};
 
        for (int x = 0; x < grid_size.x; x++)
        {
@@ -133,7 +134,7 @@ int initialize(int worker_count, RD_Opts active_opt)
        }
 
        /* Set up seed-points to create connected rooms */
-       const int seed_count = 7;//sqrt(grid_size.x) * 2;
+       const int seed_count = room_count;
        const float small_room_radius = 10.0f;
        const float phase = ((rand() % 360)/(float)360) * (M_PI*2);
 
@@ -147,6 +148,9 @@ int initialize(int worker_count, RD_Opts active_opt)
                int seed_x = ((cosf(angle) * (dist_offset + (grid_size.x/4.0f))) + (grid_size.x/2.0f));
                int seed_y = ((sinf(angle) * (dist_offset + (grid_size.y/4.0f))) + (grid_size.y/2.0f));
 
+               // TODO: One of these will probably have to be mirrored.
+               room_positions[n+1] = (Vector3){.x = seed_x, .y = 0.0f, .z = seed_y};
+
                grid[seed_x][seed_y].b = 1.0f;
                grid[seed_x][seed_y].c = 0.0f;