}
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 );
}
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 ),
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 ) );
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 );
prop_count = VG_ARRAY_LEN(view->property_values);
}
+ _skateshop.charshop_row_max = prop_count+1;
+
for( u32 i=0; i<prop_count; i ++ )
{
editer_property *prop = af_arritm( &model->editer_property, i );
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;
}
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
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 ) )
{
{
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;
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;
(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 },
{
*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 );
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;
}
}
bool edited = 0;
- u32 option_count = strlen( options );
f32 w = (f32)box[2] / (f32)option_count;
char buf[2];
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 )
{
}
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 )