projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
respawn UI
[carveJwlIkooP6JGAAIwe30JlM.git]
/
menu.h
diff --git
a/menu.h
b/menu.h
index 9f62242cc42de8589ea94d679bcca2260de0a7f3..71b3570d06190c70a133d386719f92369267be5d 100644
(file)
--- a/
menu.h
+++ b/
menu.h
@@
-9,11
+9,12
@@
#include "audio.h"
#include "input.h"
#include "workshop.h"
#include "audio.h"
#include "input.h"
#include "workshop.h"
+#include "respawn.h"
#define MENU_STACK_SIZE 8
struct {
#define MENU_STACK_SIZE 8
struct {
- int
active,
credits_open;
+ int credits_open;
int disable_open;
u32 page, /* current page index */
int disable_open;
u32 page, /* current page index */
@@
-95,8
+96,14
@@
static void menu_link(void)
}
}
}
}
-static void menu_init(void)
-{
+static void menu_close(void){
+ skaterift.activity = k_skaterift_default;
+ menu.page_depth = 0;
+ menu.page = 0xffffffff;
+ srinput.enabled = 0;
+}
+
+static void menu_init(void){
void *alloc = vg_mem.rtmemory;
mdl_open( &menu.model, "models/rs_menu.mdl", alloc );
void *alloc = vg_mem.rtmemory;
mdl_open( &menu.model, "models/rs_menu.mdl", alloc );
@@
-134,8
+141,7
@@
static void menu_back_page(void)
vg_info( "menu_back_page()\n" );
menu.page_depth --;
if( menu.page_depth == 0 ){
vg_info( "menu_back_page()\n" );
menu.page_depth --;
if( menu.page_depth == 0 ){
- menu.active = 0;
- menu.page = 0xffffffff;
+ menu_close();
}
else{
menu.page = menu.page_stack[ menu.page_depth ].page;
}
else{
menu.page = menu.page_stack[ menu.page_depth ].page;
@@
-205,23
+211,25
@@
static void menu_trigger_item( ent_menuitem *item )
if( MDL_CONST_PSTREQ( &menu.model, q, "quit" ) ){
vg.window_should_close = 1;
}
if( MDL_CONST_PSTREQ( &menu.model, q, "quit" ) ){
vg.window_should_close = 1;
}
+
+ /* DEPRECATED? */
else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_nearest" ) ){
localplayer_cmd_respawn( 0, NULL );
else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_nearest" ) ){
localplayer_cmd_respawn( 0, NULL );
-
- menu.page_depth = 0;
- menu.active = 0;
- menu.page = 0xffffffff;
+ menu_close();
}
}
+ /* DEPRECATED? */
else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_home" ) ){
else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_home" ) ){
- world_static.active_world = 0;
- world_static.active_trigger_volume_count = 0;
+ world_set_active_instance( 0 );
localplayer.viewable_world = world_current_instance();
localplayer_cmd_respawn( 1, (const char *[]){"start"} );
localplayer.viewable_world = world_current_instance();
localplayer_cmd_respawn( 1, (const char *[]){"start"} );
+ menu_close();
+ }
- menu.page_depth = 0;
- menu
.active = 0
;
-
menu.page = 0xffffffff
;
+ else if( MDL_CONST_PSTREQ( &menu.model, q, "reset" ) ){
+ menu
_close()
;
+
respawn_begin_chooser()
;
}
}
+
else if( MDL_CONST_PSTREQ( &menu.model, q, "credits" ) ){
menu.credits_open = 1;
}
else if( MDL_CONST_PSTREQ( &menu.model, q, "credits" ) ){
menu.credits_open = 1;
}
@@
-259,8
+267,7
@@
static f32 menu_slider_snap( f32 value, f32 old, f32 notch )
/*
* Run from vg_gui every frame
*/
/*
* Run from vg_gui every frame
*/
-static void menu_update(void)
-{
+static void menu_update(void){
if( workshop_form.page != k_workshop_form_hidden ){
return;
}
if( workshop_form.page != k_workshop_form_hidden ){
return;
}
@@
-274,16
+281,15
@@
static void menu_update(void)
}
if( button_down( k_srbind_mopen ) ){
}
if( button_down( k_srbind_mopen ) ){
- if(
!menu.active && !menu.disable_open
){
-
menu.active = 1
;
+ if(
skaterift.activity == k_skaterift_default
){
+
skaterift.activity = k_skaterift_menu
;
menu.page = 0xffffffff;
menu_open_page( "Main Menu" );
return;
}
}
menu.page = 0xffffffff;
menu_open_page( "Main Menu" );
return;
}
}
- if( !menu.active ) return;
-
+ if( skaterift.activity != k_skaterift_menu ) return;
enum menu_input_mode prev_mode = menu.input_mode;
/* get buttons inputs
enum menu_input_mode prev_mode = menu.input_mode;
/* get buttons inputs
@@
-511,8
+517,7
@@
static void menu_update(void)
/*
* Run from vg_gui when active
*/
/*
* Run from vg_gui when active
*/
-VG_STATIC void menu_render(void)
-{
+VG_STATIC void menu_render(void){
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );