From: Randy McShandy Date: Tue, 18 Jun 2024 02:36:47 +0000 (-0500) Subject: Update hand asset and orb to be a bit bigger, start working on some antagonist spirit... X-Git-Url: http://git.mcshandy.xyz/gitweb.cgi?a=commitdiff_plain;h=833e5e0c2ffefcfc474575d571f189382d80fa42;p=barrow_crawler Update hand asset and orb to be a bit bigger, start working on some antagonist spirit thing --- diff --git a/bin/posix_BC b/bin/posix_BC index abf54b7..378bd79 100755 Binary files a/bin/posix_BC and b/bin/posix_BC differ diff --git a/src/main.c b/src/main.c index dd18531..bf43b64 100755 --- a/src/main.c +++ b/src/main.c @@ -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; } diff --git a/src/render_raylib.c b/src/render_raylib.c index 429fc82..51210ce 100644 --- a/src/render_raylib.c +++ b/src/render_raylib.c @@ -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)){} diff --git a/src/shaders/lighting.fs b/src/shaders/lighting.fs index 2867801..fb34caf 100644 --- a/src/shaders/lighting.fs +++ b/src/shaders/lighting.fs @@ -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 index 0000000..a34eef9 --- /dev/null +++ b/src/spirit.c @@ -0,0 +1,47 @@ +#include +#include +#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 index 0000000..9e2ebc3 --- /dev/null +++ b/src/spirit.h @@ -0,0 +1,22 @@ +#ifndef __SPIRIT__ +#define __SPIRIT__ + +#include +#include + +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__ */ + diff --git a/src/structs.c b/src/structs.c index 78c825f..91b6bda 100644 --- a/src/structs.c +++ b/src/structs.c @@ -1,3 +1,4 @@ +#include #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; + diff --git a/src/structs.h b/src/structs.h index 3be86c1..6e87c1d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -5,6 +5,7 @@ #define GRID_Y GRID_X #include +#include 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__ diff --git a/src/utils.c b/src/utils.c index 3a43541..2f65636 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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;