update helpers/location to 'frosted' ui
[carveJwlIkooP6JGAAIwe30JlM.git] / world_map.c
index e2fbe7a2f8dc83f8b76dca47251ff76897743ab6..3465776c7bd6a5d44efba6752d19354f4489d90d 100644 (file)
@@ -1,14 +1,13 @@
-#ifndef RESPAWN_C
-#define RESPAWN_C
-
-#include "world_map.h"
 #include "skaterift.h"
+#include "world_map.h"
 #include "world.h"
 #include "input.h"
 #include "gui.h"
 #include "menu.h"
 #include "scene.h"
 
+struct world_map world_map;
+
 static void world_map_get_dir( v3f dir ){
    /* idk */
    dir[0] = -sqrtf(0.5f);
@@ -40,8 +39,8 @@ static void respawn_world_to_plane_pos( v3f pos, v2f plane_pos ){
    plane_pos[1] = co[2];
 }
 
-static void respawn_map_draw_icon( camera *cam, 
-                                      enum gui_icon icon, v3f pos ){
+static void respawn_map_draw_icon( vg_camera *cam, 
+                                   enum gui_icon icon, v3f pos ){
    v4f v;
    v3_copy( pos, v );
    v[3] = 1.0f;
@@ -51,7 +50,8 @@ static void respawn_map_draw_icon( camera *cam,
    gui_draw_icon( icon, (v2f){ v[0]*0.5f+0.5f,v[1]*0.5f+0.5f }, 1.0f );
 }
 
-static void world_map_pre_update(void){
+void world_map_pre_update(void)
+{
    if( skaterift.activity != k_skaterift_world_map ) return;
 
    if( button_down( k_srbind_mback ) ){
@@ -91,7 +91,7 @@ static void world_map_pre_update(void){
    v2_maxv( (v2f){ bbx[0][0], bbx[0][2] }, pos, pos );
 
    /* update camera */
-   camera *cam = &world_map.cam;
+   vg_camera *cam = &world_map.cam;
    v3f dir;
    world_map_get_dir(dir);
 
@@ -109,10 +109,10 @@ static void world_map_pre_update(void){
    cam->nearz = 10.0f;
    cam->fov = 40.0f;
 
-   camera_update_transform( cam );
-   camera_update_view( cam );
-   camera_update_projection( cam );
-   camera_finalize( cam );
+   vg_camera_update_transform( cam );
+   vg_camera_update_view( cam );
+   vg_camera_update_projection( cam );
+   vg_camera_finalize( cam );
 
    /* pick spawn */
    world_map.spawn = NULL;
@@ -173,9 +173,22 @@ static void world_map_pre_update(void){
       respawn_map_draw_icon( cam, k_gui_icon_rift_run_2d, 
                              route->board_transform[3] );
    }
+
+   for( u32 i=0; i<mdl_arrcount(&world->ent_glider); i ++ ){
+      ent_glider *glider = mdl_arritm( &world->ent_glider, i );
+
+      v4f colour = { 1,1,1,1 };
+
+      if( !(glider->flags & 0x1) )
+         v3_muls( colour, 0.5f, colour );
+      gui_icon_setcolour( colour );
+
+      respawn_map_draw_icon( cam, k_gui_icon_glider, glider->transform.co );
+   }
 }
 
-static void world_map_enter(void){
+void world_map_enter(void)
+{
    skaterift.activity = k_skaterift_world_map;
    world_map.world_id = world_static.active_instance;
 
@@ -190,13 +203,11 @@ static void world_map_enter(void){
 
    vg_str text;
    if( gui_new_helper( input_joy_list[k_srjoystick_steer], &text ) )
-      vg_strcat( &text, "move" );
+      vg_strcat( &text, "Move" );
 
    if( gui_new_helper( input_button_list[k_srbind_maccept], &text ) )
-      vg_strcat( &text, "spawn" );
+      vg_strcat( &text, "Spawn" );
 
    if( gui_new_helper( input_button_list[k_srbind_mback], &text ) )
-      vg_strcat( &text, "exit" );
+      vg_strcat( &text, "Exit" );
 }
-
-#endif /* RESPAWN_C */