From: hgn Date: Sun, 15 Jun 2025 22:48:22 +0000 (+0100) Subject: smush X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=1ef1df216642049e0df827663934a476d1c0593f;p=carveJwlIkooP6JGAAIwe30JlM.git smush --- diff --git a/build.c b/build.c index 2459b42..9a3aeec 100644 --- a/build.c +++ b/build.c @@ -94,6 +94,15 @@ void build_game_metadata(void) write_generic_addon_inf( k_addon_type_player, "Ela", "ch_ela.mdl", "content_skaterift/playermodels/skaterift_ela/addon.inf", 0 ); + write_generic_addon_inf( k_addon_type_player, + "Custom", "ch_sr2t.mdl", + "content_skaterift/playermodels/sr2t/addon.inf", 0 ); + write_generic_addon_inf( k_addon_type_player, + "Pro", "ch_pro.mdl", + "content_skaterift/playermodels/skaterift_pro/addon.inf", 0 ); + write_generic_addon_inf( k_addon_type_player, + "Amin", "ch_amin.mdl", + "content_skaterift/playermodels/skaterift_amin/addon.inf", 0 ); write_generic_addon_inf( k_addon_type_player, "Jesus", "ch_jesus.mdl", diff --git a/content_skaterift/playermodels/skaterift_amin/addon.inf b/content_skaterift/playermodels/skaterift_amin/addon.inf new file mode 100644 index 0000000..4cb227f Binary files /dev/null and b/content_skaterift/playermodels/skaterift_amin/addon.inf differ diff --git a/content_skaterift/playermodels/skaterift_pro/addon.inf b/content_skaterift/playermodels/skaterift_pro/addon.inf new file mode 100644 index 0000000..22f2c6a Binary files /dev/null and b/content_skaterift/playermodels/skaterift_pro/addon.inf differ diff --git a/content_skaterift/playermodels/sr2t/addon.inf b/content_skaterift/playermodels/sr2t/addon.inf new file mode 100644 index 0000000..6d79c74 Binary files /dev/null and b/content_skaterift/playermodels/sr2t/addon.inf differ diff --git a/src/ent_skateshop.c b/src/ent_skateshop.c index c57f994..d39d8ee 100644 --- a/src/ent_skateshop.c +++ b/src/ent_skateshop.c @@ -526,8 +526,12 @@ entity_event_result ent_skateshop_event( ent_event *event ) } gui_helper_reset( k_gui_helper_mode_clear ); - ent_skateshop_helpers_pickable( "Pick" ); + + if( shop->type != k_skateshop_type_charshop ) + ent_skateshop_helpers_pickable( "Pick" ); + _skateshop.open = 1; + _skateshop.changed_playermodel = 1; skateshop_playermod( 1 ); } @@ -539,6 +543,8 @@ entity_event_result ent_skateshop_event( ent_event *event ) void charshop_gui( ui_context *ctx ) { ctx->font = &vgf_default_large; + + /* duplicated ----------!!!!!!!! */ int ml = button_press( k_srbind_mleft ), mr = button_press( k_srbind_mright ), mu = button_press( k_srbind_mup ), @@ -547,7 +553,17 @@ void charshop_gui( ui_context *ctx ) mv = mu-md, enter = button_down( k_srbind_maccept ); - i32 R = menu_nav( &_skateshop.charshop_row, mv, 8 ); + i32 R = menu_nav( &_skateshop.charshop_row, mv, _skateshop.charshop_row_max ); + + if( menu.repeater > 0.0f ) + { + menu.repeater -= vg_minf( vg.time_frame_delta, 0.5f ); + mv = 0; + mh = 0; + } + else + if( mv || mh ) + menu.repeater += R==0? 0.2f: 0.1f; ui_rect panel = { 8, 8, 350, vg.window_y }; ui_fill( ctx, panel, ui_opacity( GUI_COL_DARK, 0.35f ) ); @@ -561,33 +577,58 @@ void charshop_gui( ui_context *ctx ) ui_split( row, k_ui_axis_v, row[3], 4, bL, middle ); ui_split( middle, k_ui_axis_v, -row[3], 4, middle, bR ); - bool changed_playermodel = 0; + const char *title = _skateshop.render.item_title; + ui_text( ctx, middle, title? title: "Untitled", 1, k_ui_align_middle_center, 0 ); - if( menu_button_rect( ctx, bL, 0, 1, "<" ) ) + if( menu_button_rect( ctx, bL, 0, 1, "<" ) || ((R==0) && (mh > 0)) ) { u32 valid_count = _addon_filtered_count( k_addon_type_player, 0, ADDON_REG_HIDDEN ); if( _skateshop.selected_player_index > 0 ) _skateshop.selected_player_index --; else _skateshop.selected_player_index = valid_count-1; - changed_playermodel = 1; + _skateshop.changed_playermodel = 1; } - if( menu_button_rect( ctx, bR, 0, 1, ">" ) ) + if( menu_button_rect( ctx, bR, 0, 1, ">" ) || ((R==0) && (mh < 0)) ) { u32 valid_count = _addon_filtered_count( k_addon_type_player, 0, ADDON_REG_HIDDEN ); if( _skateshop.selected_player_index+1 < valid_count ) _skateshop.selected_player_index ++; else _skateshop.selected_player_index = 0; - changed_playermodel = 1; + _skateshop.changed_playermodel = 1; } - if( changed_playermodel ) + if( vg_input.display_input_method == k_input_method_controller ) + { + if( R == 0 ) + { + menu_decor_select( ctx, row ); + ui_outline( ctx, row, 1, GUI_COL_HI, 0 ); + } + } + + if( _skateshop.changed_playermodel ) { addon_id id = _addon_get_filtered( k_addon_type_player, _skateshop.selected_player_index, 0, ADDON_REG_HIDDEN ); if( id ) + { player__use_model( id ); + addon_reg *reg = addon_details( id ); + + vg_msg msg; + vg_msg_init( &msg, reg->metadata, reg->metadata_len ); + + if( vg_msg_seekframe( &msg, "workshop" ) ) + { + const char *title = vg_msg_getkvstr( &msg, "title" ); + if( title ) _skateshop.render.item_title = title; + vg_msg_skip_frame( &msg ); + } + } + + _skateshop.changed_playermodel = 0; } struct player_model *model = addon_cache_item_data( k_addon_type_player, localplayer.playermodel.cache_slot, 1 ); @@ -610,6 +651,8 @@ void charshop_gui( ui_context *ctx ) prop_count = VG_ARRAY_LEN(view->property_values); } + _skateshop.charshop_row_max = prop_count+1; + for( u32 i=0; iediter_property, i ); @@ -618,7 +661,7 @@ void charshop_gui( ui_context *ctx ) if( prop->ui_type == k_editer_type_toggle ) { i32 temp = view->property_values[i]._u32; - if( menu_checkbox( ctx, panel, 0, alias, &temp ) ) + if( menu_checkbox( ctx, panel, R == i+1, alias, &temp ) ) { view->property_values[i]._u32 = temp; edited = 1; @@ -626,17 +669,33 @@ void charshop_gui( ui_context *ctx ) } else if( prop->ui_type == k_editer_type_slider ) { + bool scuzzy = 0; + if( vg_input.display_input_method == k_input_method_controller ) + if( (R == i+1) && (mh != 0) ) + scuzzy = 1; + f32 normalized = view->property_values[i]._f32 / prop->max._f32; - if( menu_slider( ctx, panel, 0, alias, 0, 25, &normalized, "%.0f" ) ) + if( menu_slider( ctx, panel, R == i+1, alias, 0, 25, &normalized, "%.0f" ) || scuzzy ) { - view->property_values[i]._f32 = normalized * prop->max._f32; + if( vg_input.display_input_method == k_input_method_controller ) + { + /* hack kinda */ + if( mh > 0 ) + view->property_values[i]._f32 += -0.2f * (prop->max._f32/25.0f); + if( mh < 0 ) + view->property_values[i]._f32 += 1.2f * (prop->max._f32/25.0f); + } + else + view->property_values[i]._f32 = normalized * prop->max._f32; + view->property_values[i]._f32 = vg_clampf( view->property_values[i]._f32, 0.0f, prop->max._f32 ); edited = 1; } } else if( prop->ui_type == k_editer_type_selecter ) { const char *options = af_str( &model->mdl.af, prop->max.pstr_options ); - if( menu_options( ctx, panel, 0, 0, alias, options, &view->property_values[i]._u32 ) ) + if( menu_options( ctx, panel, R == i+1, &_skateshop.charshop_col, alias, options, + &view->property_values[i]._u32, mh, enter ) ) edited = 1; } else @@ -650,15 +709,19 @@ void charshop_gui( ui_context *ctx ) if( edited ) { playermodel_get_cpart( view, model, view->cpart ); - vg_info( "New cpart: %s\n", view->cpart ); view->cpart_dirty = 1; } } else + { + _skateshop.charshop_row_max = 1; menu_heading( ctx, panel, "Uncustomizable", 0 ); + } } + else + _skateshop.charshop_row_max = 1; - if( menu_button( ctx, panel, 0, model!=NULL, "Exit" ) ) + if( menu_button( ctx, panel, R == _skateshop.charshop_row_max, model!=NULL, "Exit" ) ) { if( world_clear_event( k_world_event_shop ) ) { @@ -674,9 +737,6 @@ void ent_skateshop_gui( ui_context *ctx ) { if( _skateshop.open ) { - if( vg_input.display_input_method != k_input_method_kbm ) - return; - ent_skateshop *shop = _skateshop.current_shop; if( (shop->type != k_skateshop_type_boardshop) && (shop->type != k_skateshop_type_charshop) ) return; @@ -689,6 +749,9 @@ void ent_skateshop_gui( ui_context *ctx ) return; } + if( vg_input.display_input_method != k_input_method_kbm ) + return; + world_instance *world = &_world.main; ent_marker *rack_marker = af_arritm( &world->ent_marker, mdl_entity_id_id(shop->boards.id_rack) ); m4x3f mmdl; diff --git a/src/ent_skateshop.h b/src/ent_skateshop.h index 4754265..31dc963 100644 --- a/src/ent_skateshop.h +++ b/src/ent_skateshop.h @@ -38,7 +38,10 @@ struct global_skateshop ent_skateshop *current_shop; bool open; - i32 charshop_row; + i32 charshop_row, charshop_col, charshop_row_max; + bool changed_playermodel; + + bool ugh; } extern _skateshop; diff --git a/src/input.h b/src/input.h index 78ae13c..4b33fac 100644 --- a/src/input.h +++ b/src/input.h @@ -280,7 +280,7 @@ static float axis_state( enum sr_axis axis ) { if( (skaterift.activity == k_skaterift_menu) && (axis < k_sraxis_mbrowse_h ) && - (vg_input.display_input_method != k_input_method_kbm) ) + (vg_input.display_input_method != k_input_method_kbm)) return 0; if( input_filter_generic() ) diff --git a/src/menu.c b/src/menu.c index bf8017a..a799a62 100644 --- a/src/menu.c +++ b/src/menu.c @@ -125,7 +125,7 @@ bool menu_viewing_map(void) (menu.main_index == k_menu_main_map); } -static void menu_decor_select( ui_context *ctx, ui_rect rect ) +void menu_decor_select( ui_context *ctx, ui_rect rect ) { ui_px b = ctx->font->sx, hb = b/2; ui_rect a0 = { rect[0] - 20 - hb, rect[1] + rect[3]/2 - hb, b,b }, @@ -166,6 +166,7 @@ bool menu_slider( ui_context *ctx, { *value += m * vg.time_frame_delta * (1.0f/2.0f); *value = vg_clampf( *value, 0, 1 ); + state |= k_ui_button_click; } menu_decor_select( ctx, rect ); @@ -324,17 +325,23 @@ bool menu_checkbox( ui_context *ctx, ui_rect inout_panel, bool select, const cha else return 0; } -bool menu_options( ui_context *ctx, ui_rect inout_panel, bool select, i32 subselect_x, const char *str_label, - const char *options, u32 *data ) +bool menu_options( ui_context *ctx, ui_rect inout_panel, bool select, i32 *subselect_x, const char *str_label, + const char *options, u32 *data, i32 mh, i32 enter ) { ui_rect rect, box; menu_standard_widget( ctx, inout_panel, rect, 1 ); + u32 option_count = strlen( options ); + if( vg_input.display_input_method == k_input_method_controller ) { if( select ) { menu_decor_select( ctx, rect ); + i32 v = (*subselect_x) - mh; + if( v >= (i32)option_count ) v = 0; + if( v < 0 ) v = ((i32)option_count)-1; + *subselect_x = v; } } @@ -342,7 +349,6 @@ bool menu_options( ui_context *ctx, ui_rect inout_panel, bool select, i32 subsel bool edited = 0; - u32 option_count = strlen( options ); f32 w = (f32)box[2] / (f32)option_count; char buf[2]; @@ -361,6 +367,16 @@ bool menu_options( ui_context *ctx, ui_rect inout_panel, bool select, i32 subsel enum ui_button_state state = k_ui_button_none; if( vg_input.display_input_method == k_input_method_kbm ) state = ui_checkbox_base( ctx, chex, &temp ); + else + { + if( select && ((*subselect_x) == j) ) + { + if( enter ) + state = k_ui_button_click; + else + state = k_ui_button_hover; + } + } if( state == k_ui_button_holding_inside ) { @@ -379,8 +395,8 @@ bool menu_options( ui_context *ctx, ui_rect inout_panel, bool select, i32 subsel } else { - ui_fill( ctx, chex, select? GUI_COL_ACTIVE: GUI_COL_DARK ); - ui_outline( ctx, chex, -1, select? GUI_COL_HI: GUI_COL_NORM, 0 ); + ui_fill( ctx, chex, GUI_COL_DARK ); + ui_outline( ctx, chex, -1, GUI_COL_NORM, 0 ); } if( temp ) diff --git a/src/menu.h b/src/menu.h index 6d6c728..7f4d424 100644 --- a/src/menu.h +++ b/src/menu.h @@ -101,5 +101,6 @@ bool menu_slider( ui_context *ctx, const f32 disp_min, const f32 disp_max, f32 *value, const char *format ); bool menu_checkbox( ui_context *ctx, ui_rect inout_panel, bool select, const char *str_label, i32 *data ); -bool menu_options( ui_context *ctx, ui_rect inout_panel, bool select, i32 subselect_x, const char *str_label, - const char *options, u32 *data ); +bool menu_options( ui_context *ctx, ui_rect inout_panel, bool select, i32 *subselect_x, const char *str_label, + const char *options, u32 *data, i32 mh, i32 menter ); +void menu_decor_select( ui_context *ctx, ui_rect rect );