]> git.mcshandy.xyz Git - barrow_crawler/commitdiff
Load Game main menu option working.
authorRandy McShandy <randy@mcshandy.xyz>
Sun, 10 Aug 2025 00:07:10 +0000 (19:07 -0500)
committerRandy McShandy <randy@mcshandy.xyz>
Sun, 10 Aug 2025 00:07:10 +0000 (19:07 -0500)
src/menufuncs.c
src/render_raylib.c

index 1b95b6bc72de2b29bc19692d346c8e113e0de964..388e869472d668481c36a64cb91d94bf866882a7 100644 (file)
@@ -2,6 +2,7 @@
 #include <pthread.h>
 #include <raylib.h>
 #include <stdio.h>
+#include <string.h>
 
 #include "structs.h"
 
@@ -24,8 +25,24 @@ bool menu_action_MI_LOAD_GAME()
 {
   bool response = false;
 
+  ProcessInfo* process = &processes[SAVE_FILE_LOAD];
+  process->state     = WAITING;
 
+  const int success = load_game();
 
+  if ((success == 0 ) && timers[STATUS_TEXT_FADE_TIME].time == 0.0)
+  {
+    process->state = FINISHED;
+  }
+  else if (success != 0)
+  {
+    process->state = BAD;
+  }
+
+  memcpy(text_places[STATUS_TEXT_PLACE], process->info_text[process->state], 64);
+  timers[STATUS_TEXT_FADE_TIME].time = timers[STATUS_TEXT_FADE_TIME].max;
+
+  resource_state = CONTROL_RESOURCE_READY;
   return response;
 }
 
index 658ebc8aab7cac7039a9e7ba5e5e2056e5a295d5..3877989088db3909ff78fc949e3cf282709f2a7f 100644 (file)
@@ -569,7 +569,7 @@ void initialize_renderer()
        cam_reset_position.y = 1.0f;
 
   /* if not loading a save */
-  if (1)
+  if (processes[SAVE_FILE_LOAD].state == UNKNOWN)
   {
     playtime.cam             = (Camera3D){0};
     playtime.cam.position    = cam_reset_position;
@@ -581,7 +581,7 @@ void initialize_renderer()
   }
   else
   {
-    /* Load a save */
+    /* Use data from save */
   }
 
        /*