projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix null reference
[carveJwlIkooP6JGAAIwe30JlM.git]
/
menu.h
diff --git
a/menu.h
b/menu.h
index 243bebfd70fb742ce7084aca2be32733a4892880..6df04dbf6da80e364b53f5fa6b94d7645d9be710 100644
(file)
--- a/
menu.h
+++ b/
menu.h
@@
-11,6
+11,7
@@
#include "workshop.h"
#include "respawn.h"
#include "gui.h"
#include "workshop.h"
#include "respawn.h"
#include "gui.h"
+#include "ent_miniworld.h"
#define MENU_STACK_SIZE 8
#define MENU_STACK_SIZE 8
@@
-129,7
+130,7
@@
static void menu_close(void){
skaterift.activity = k_skaterift_default;
menu.page_depth = 0;
menu.page = 0xffffffff;
skaterift.activity = k_skaterift_default;
menu.page_depth = 0;
menu.page = 0xffffffff;
- srinput.
enabled = 0
;
+ srinput.
state = k_input_state_resume
;
}
static void menu_init(void){
}
static void menu_init(void){
@@
-140,9
+141,9
@@
static void menu_init(void){
vg_linear_clear( vg_mem.scratch );
vg_linear_clear( vg_mem.scratch );
-
mdl_load_array( &menu.model, &menu.items, "ent_menuitem"
, alloc );
-
mdl_load_array( &menu.model, &menu.markers, "ent_marker"
, alloc );
-
mdl_load_array( &menu.model, &menu.cameras, "ent_camera"
, alloc );
+
MDL_LOAD_ARRAY( &menu.model, &menu.items, ent_menuitem
, alloc );
+
MDL_LOAD_ARRAY( &menu.model, &menu.markers, ent_marker
, alloc );
+
MDL_LOAD_ARRAY( &menu.model, &menu.cameras, ent_camera
, alloc );
vg_linear_clear( vg_mem.scratch );
vg_linear_clear( vg_mem.scratch );
@@
-153,7
+154,7
@@
static void menu_init(void){
void *data = vg_linear_alloc( vg_mem.scratch, tex0->file.pack_size );
mdl_fread_pack_file( &menu.model, &tex0->file, data );
void *data = vg_linear_alloc( vg_mem.scratch, tex0->file.pack_size );
mdl_fread_pack_file( &menu.model, &tex0->file, data );
- mdl_async_load_glmesh( &menu.model, &menu.mesh );
+ mdl_async_load_glmesh( &menu.model, &menu.mesh
, NULL
);
vg_tex2d_load_qoi_async( data, tex0->file.pack_size,
VG_TEX2D_LINEAR|VG_TEX2D_CLAMP,
&menu.texture );
vg_tex2d_load_qoi_async( data, tex0->file.pack_size,
VG_TEX2D_LINEAR|VG_TEX2D_CLAMP,
&menu.texture );
@@
-245,24
+246,18
@@
static void menu_trigger_item( ent_menuitem *item ){
vg.window_should_close = 1;
}
vg.window_should_close = 1;
}
- /* DEPRECATED? */
- else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_nearest" ) ){
- localplayer_cmd_respawn( 0, NULL );
- menu_close();
- }
- /* DEPRECATED? */
- else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_home" ) ){
- world_set_active_instance( 0 );
- localplayer.viewable_world = world_current_instance();
- localplayer_cmd_respawn( 1, (const char *[]){"start"} );
- menu_close();
- }
+ else if( MDL_CONST_PSTREQ( &menu.model, q, "map" ) ){
- else if( MDL_CONST_PSTREQ( &menu.model, q, "reset" ) ){
menu_close();
respawn_begin_chooser();
}
menu_close();
respawn_begin_chooser();
}
-
+ else if( MDL_CONST_PSTREQ( &menu.model, q, "hub" ) ){
+ if( world_static.active_instance == k_world_purpose_client ){
+ srinput.state = k_input_state_resume;
+ menu_close();
+ ent_miniworld_goback();
+ }
+ }
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;
}
@@
-430,7
+425,8
@@
static void menu_update(void){
ent_menuitem *item = mdl_arritm( &menu.items, i );
if( item->type == k_ent_menuitem_type_page ) continue;
ent_menuitem *item = mdl_arritm( &menu.items, i );
if( item->type == k_ent_menuitem_type_page ) continue;
- if( item->type == k_ent_menuitem_type_visual ) continue;
+ if( (item->type == k_ent_menuitem_type_visual) ||
+ (item->type == k_ent_menuitem_type_visual_nocol) ) continue;
if( item->type == k_ent_menuitem_type_binding ) continue;
if( !(item->groups & (0x1<<menu.page)) ) continue;
if( item->type == k_ent_menuitem_type_binding ) continue;
if( !(item->groups & (0x1<<menu.page)) ) continue;
@@
-489,6
+485,7
@@
static void menu_update(void){
if( (item->type != k_ent_menuitem_type_page) &&
(item->type != k_ent_menuitem_type_visual) &&
if( (item->type != k_ent_menuitem_type_page) &&
(item->type != k_ent_menuitem_type_visual) &&
+ (item->type != k_ent_menuitem_type_visual_nocol) &&
(item->groups & (0x1<<menu.page)) ){
menu.loc = item;
}
(item->groups & (0x1<<menu.page)) ){
menu.loc = item;
}
@@
-560,15
+557,15
@@
static void menu_update(void){
menu_setitem_type( menu.ctr_steam, k_ent_menuitem_type_disabled );
if( vg_input.display_input_method == k_input_method_kbm )
menu_setitem_type( menu.ctr_steam, k_ent_menuitem_type_disabled );
if( vg_input.display_input_method == k_input_method_kbm )
- menu_setitem_type( menu.ctr_kbm, k_ent_menuitem_type_visual );
+ menu_setitem_type( menu.ctr_kbm, k_ent_menuitem_type_visual
_nocol
);
else{
if( vg_input.display_input_type == SDL_CONTROLLER_TYPE_PS3 ||
vg_input.display_input_type == SDL_CONTROLLER_TYPE_PS4 ||
vg_input.display_input_type == SDL_CONTROLLER_TYPE_PS5 ){
else{
if( vg_input.display_input_type == SDL_CONTROLLER_TYPE_PS3 ||
vg_input.display_input_type == SDL_CONTROLLER_TYPE_PS4 ||
vg_input.display_input_type == SDL_CONTROLLER_TYPE_PS5 ){
- menu_setitem_type( menu.ctr_ps, k_ent_menuitem_type_visual );
+ menu_setitem_type( menu.ctr_ps, k_ent_menuitem_type_visual
_nocol
);
}
else {
}
else {
- menu_setitem_type( menu.ctr_xbox, k_ent_menuitem_type_visual );
+ menu_setitem_type( menu.ctr_xbox, k_ent_menuitem_type_visual
_nocol
);
}
/* FIXME: Steam/Deck controller detection? */
}
}
/* FIXME: Steam/Deck controller detection? */
}
@@
-612,11
+609,6
@@
static void menu_render(void){
ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
ui_text( title, "Mt.Zero Software", 1, k_ui_align_middle_center, 0 );
ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
ui_text( title, "Mt.Zero Software", 1, k_ui_align_middle_center, 0 );
- ui_split( panel, k_ui_axis_h, 8, 0, title, panel );
- ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
- ui_text( title, "A game by Harry Godden", 1,
- k_ui_align_middle_center, 0 );
-
ui_split( panel, k_ui_axis_h, 8, 0, title, panel );
ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
ui_text( title, "Free Software", 2, k_ui_align_middle_center, 0 );
ui_split( panel, k_ui_axis_h, 8, 0, title, panel );
ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
ui_text( title, "Free Software", 2, k_ui_align_middle_center, 0 );
@@
-646,7
+638,7
@@
static void menu_render(void){
v3f v0;
mdl_transform_vector( &menu.cam->transform, (v3f){0.0f,-1.0f,0.0f}, v0 );
v3f v0;
mdl_transform_vector( &menu.cam->transform, (v3f){0.0f,-1.0f,0.0f}, v0 );
-
player_vector_angles( target.angles, v0, 1.0f, 0.0f
);
+
v3_angles( v0, target.angles
);
camera_lerp( &menu.view, &target, rate, &menu.view );
camera_lerp( &menu.view, &target, rate, &menu.view );
@@
-707,7
+699,7
@@
static void menu_render(void){
}
}
}
}
- if( item->type == k_ent_menuitem_type_visual ){
+ if( item->type == k_ent_menuitem_type_visual
_nocol
){
shader_model_menu_uColour( (v4f){1.0f,1.0f,1.0f,1.0f} );
}
else{
shader_model_menu_uColour( (v4f){1.0f,1.0f,1.0f,1.0f} );
}
else{
@@
-761,7
+753,7
@@
static void menu_render(void){
m4x3f local;
m4x3_identity( local );
m4x3f local;
m4x3_identity( local );
- font3d_bind( &gui.font, &menu.view );
+ font3d_bind( &gui.font,
k_font_shader_default, 0, NULL,
&menu.view );
for( u32 i=0; i<text_count; i++ ){
ent_menuitem *item = text_list[ i ];
m4x3f transform;
for( u32 i=0; i<text_count; i++ ){
ent_menuitem *item = text_list[ i ];
m4x3f transform;
@@
-769,49
+761,42
@@
static void menu_render(void){
u32 variant = item->binding.font_variant;
menu_binding_string( buf, item->binding.pstr_bind );
u32 variant = item->binding.font_variant;
menu_binding_string( buf, item->binding.pstr_bind );
- f32 offset = font3d_string_width(
&gui.font,
variant, buf );
+ f32 offset = font3d_string_width( variant, buf );
local[3][0] = -0.5f * offset;
m4x3_mul( transform, local, transform );
local[3][0] = -0.5f * offset;
m4x3_mul( transform, local, transform );
- font3d_simple_draw( &gui.font, variant, k_font_shader_default, buf,
- &menu.view, transform );
+ font3d_simple_draw( variant, buf, &menu.view, transform );
}
}
static void menu_binding_string( char buf[128], u32 pstr ){
}
}
static void menu_binding_string( char buf[128], u32 pstr ){
- vg_strncpy( "error", buf, 128, k_strncpy_allow_cutoff );
+ vg_str str;
+ vg_strnull( &str, buf, 128 );
if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_jump" ) ){
if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_jump" ) ){
- vg_strncpy( button_display_string(k_srbind_jump), buf, 128,
- k_strncpy_allow_cutoff );
+ vg_input_string( &str, input_button_list[k_srbind_jump], 1 );
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_trick0" ) ){
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_trick0" ) ){
- vg_str str;
- vg_strnull( &str, buf, 128 );
vg_strcat( &str, "SHUVIT " );
vg_strcat( &str, "SHUVIT " );
- vg_
strcat( &str, button_display_string(k_srbind_trick0)
);
+ vg_
input_string( &str, input_button_list[k_srbind_trick0], 1
);
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_trick1" ) ){
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_trick1" ) ){
- vg_str str;
- vg_strnull( &str, buf, 128 );
vg_strcat( &str, "KICKFLIP " );
vg_strcat( &str, "KICKFLIP " );
- vg_
strcat( &str, button_display_string(k_srbind_trick1)
);
+ vg_
input_string( &str, input_button_list[k_srbind_trick1], 1
);
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_trick2" ) ){
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_trick2" ) ){
- vg_str str;
- vg_strnull( &str, buf, 128 );
vg_strcat( &str, "TREFLIP " );
vg_strcat( &str, "TREFLIP " );
- vg_
strcat( &str, button_display_string(k_srbind_trick2)
);
+ vg_
input_string( &str, input_button_list[k_srbind_trick2], 1
);
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_grab" ) ){
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_grab" ) ){
- vg_strncpy( axis_display_string(k_sraxis_grab), buf, 128,
- k_strncpy_allow_cutoff );
+ vg_input_string( &str, input_axis_list[k_sraxis_grab], 1 );
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_grab_mod" ) ){
}
else if( MDL_CONST_PSTREQ( &menu.model, pstr, "bind_grab_mod" ) ){
- vg_strncpy( joystick_display_string(k_srjoystick_grab, 2), buf, 128,
- k_strncpy_allow_cutoff );
+ vg_input_string( &str, input_joy_list[k_srjoystick_grab], 1 );
}
}
+ else
+ vg_strcat( &str, "error" );
}
#endif /* MENU_H */
}
#endif /* MENU_H */