miniworld helpers
authorhgn <hgodden00@gmail.com>
Tue, 21 Nov 2023 04:24:56 +0000 (04:24 +0000)
committerhgn <hgodden00@gmail.com>
Tue, 21 Nov 2023 04:24:56 +0000 (04:24 +0000)
ent_miniworld.c

index 802bd8b6eaeebd6a7db39a30b090077cea8420af..c56fa180488f09f0b67be75feed49d56448b701d 100644 (file)
@@ -5,6 +5,26 @@
 #include "gui.h"
 #include "menu.h"
 
+static void miniworld_helper_default(void){
+   gui_helper_clear();
+   vg_str text;
+   if( gui_new_helper( input_button_list[k_srbind_miniworld_resume], &text ))
+      vg_strcat( &text, "Resume" );
+
+   if( gui_new_helper( input_button_list[k_srbind_miniworld_teleport],&text))
+      vg_strcat( &text, "Teleport" );
+}
+
+static void miniworld_helper_tele(void){
+   gui_helper_clear();
+   vg_str text;
+   if( gui_new_helper( input_button_list[k_srbind_miniworld_resume], &text ))
+      vg_strcat( &text, "Confirm" );
+
+   if( gui_new_helper( input_button_list[k_srbind_mback],&text))
+      vg_strcat( &text, "Cancel" );
+}
+
 static void ent_miniworld_call( world_instance *world, ent_call *call ){
    ent_miniworld *miniworld = mdl_arritm( &world->ent_miniworld, 
                                           mdl_entity_id_id(call->id) );
@@ -17,9 +37,11 @@ static void ent_miniworld_call( world_instance *world, ent_call *call ){
 
       mdl_transform_m4x3( &miniworld->transform, global_miniworld.mmdl );
       global_miniworld.active = miniworld;
+      miniworld_helper_default();
    }
    else if( call->function == 1 ){
       global_miniworld.active = NULL;
+      gui_helper_clear();
 
       if( miniworld->proxy ){
          ent_prop *prop = mdl_arritm( &world->ent_prop, 
@@ -141,6 +163,7 @@ static void ent_miniworld_preupdate(void){
          global_miniworld.mode = 0;
          menu.disable_open = 0;
          srinput.state = k_input_state_resume;
+         gui_helper_clear();
       }
       return;
    }
@@ -160,6 +183,7 @@ static void ent_miniworld_preupdate(void){
       global_miniworld.dest_spawn = NULL;
       srinput.state = k_input_state_resume;
       menu.disable_open = 0;
+      gui_helper_clear();
    }
    else {
       if( global_miniworld.mode == 1 ){
@@ -168,6 +192,7 @@ static void ent_miniworld_preupdate(void){
             global_miniworld.dest_spawn = NULL;
             menu.disable_open = 0;
             srinput.state = k_input_state_resume;
+            miniworld_helper_default();
          }
          else {
             m4x3f mmdl_inv;
@@ -181,6 +206,7 @@ static void ent_miniworld_preupdate(void){
          if( button_down( k_srbind_miniworld_teleport ) ){
             global_miniworld.mode = 1;
             menu.disable_open = 1;
+            miniworld_helper_tele();
          }
       }
    }