{
THREAD_0;
- if( skaterift.demo_mode )
+ if( g_client.demo_mode )
{
vg_info( "Won't load workshop items in demo mode\n" );
return;
+++ /dev/null
-#include "entity.h"
-#include "ent_miniworld.h"
-#include "world_render.h"
-#include "world_load.h"
-#include "input.h"
-#include "gui.h"
-#include "menu.h"
-#include "audio.h"
-
-struct global_miniworld global_miniworld;
-
-entity_call_result ent_miniworld_call( world_instance *world, ent_call *call )
-{
-#if 0
- ent_miniworld *miniworld = af_arritm( &world->ent_miniworld,
- mdl_entity_id_id(call->id) );
-
- int world_id = world - _world.instances;
-
- if( call->function == 0 ) /* zone() */
- {
- const char *uid = af_str( &world->meta.af, miniworld->pstr_world );
- skaterift_load_world_command( 1, (const char *[]){ uid } );
-
- mdl_transform_m4x3( &miniworld->transform, global_miniworld.mmdl );
- global_miniworld.active = miniworld;
-
- gui_helper_reset( k_gui_helper_mode_black_bars );
- vg_str text;
-
- if( gui_new_helper( input_button_list[k_srbind_miniworld_resume], &text ))
- vg_strcat( &text, "Enter World" );
-
- return k_entity_call_result_OK;
- }
- else if( call->function == 1 )
- {
- global_miniworld.active = NULL;
- gui_helper_reset( k_gui_helper_mode_clear );
-
- if( miniworld->proxy )
- {
- ent_prop *prop = af_arritm( &world->ent_prop,
- mdl_entity_id_id(miniworld->proxy) );
- prop->flags &= ~0x1;
- }
-
- return k_entity_call_result_OK;
- }
- else
-#endif
- return k_entity_call_result_unhandled;
-}
-
-static void miniworld_icon( vg_camera *cam, enum gui_icon icon,
- v3f pos, f32 size)
-{
-#if 0
- m4x3f mmdl;
- v3_copy( cam->transform[2], mmdl[2] );
- mmdl[2][1] = 0.0f;
- v3_normalize( mmdl[2] );
- v3_copy( (v3f){0,1,0}, mmdl[1] );
- v3_cross( mmdl[1], mmdl[2], mmdl[0] );
- m4x3_mulv( global_miniworld.mmdl, pos, mmdl[3] );
-
- shader_model_font_uMdl( mmdl );
- shader_model_font_uOffset( (v4f){0,0,0,20.0f*size} );
-
- m4x4f m4mdl;
- m4x3_expand( mmdl, m4mdl );
- m4x4_mul( cam->mtx_prev.pv, m4mdl, m4mdl );
- shader_model_font_uPvmPrev( m4mdl );
-
- mdl_submesh *sm = gui.icons[ icon ];
- if( sm )
- mdl_draw_submesh( sm );
-#endif
-}
-
-void ent_miniworld_render( world_instance *host_world, vg_camera *cam )
-{
-#if 0
- if( host_world != &_world.instances[k_world_purpose_hub] )
- return;
-
- ent_miniworld *miniworld = global_miniworld.active;
-
- if( !miniworld )
- return;
-
- world_instance *dest_world = &_world.instances[k_world_purpose_client];
-
- int rendering = 1;
- if( dest_world->status != k_world_status_loaded )
- rendering = 0;
-
- if( miniworld->proxy ){
- ent_prop *prop = af_arritm( &host_world->ent_prop,
- mdl_entity_id_id(miniworld->proxy) );
- if( !rendering )
- prop->flags &= ~0x1;
- else
- prop->flags |= 0x1;
- }
-
-
- if( !rendering )
- return;
-
- render_world_override( dest_world, host_world, global_miniworld.mmdl, cam,
- NULL, (v4f){dest_world->tar_min,10000.0f,0.0f,0.0f} );
- render_world_routes( dest_world, host_world,
- global_miniworld.mmdl, cam, 0, 1 );
-
- /* icons
- * ---------------------*/
- font3d_bind( &gui.font, k_font_shader_default, 0, NULL, cam );
- mesh_bind( &gui.icons_mesh );
-
- glActiveTexture( GL_TEXTURE0 );
- glBindTexture( GL_TEXTURE_2D, gui.icons_texture );
- shader_model_font_uTexMain( 0 );
- shader_model_font_uColour( (v4f){1,1,1,1} );
-
- miniworld_icon( cam, k_gui_icon_player, dest_world->player_co,
- 1.0f + sinf(vg.time)*0.2f );
-
- for( u32 i=0; i<af_arrcount(&dest_world->ent_challenge); i++ ){
- ent_challenge *challenge = af_arritm( &dest_world->ent_challenge, i );
-
- enum gui_icon icon = k_gui_icon_exclaim;
- if( challenge->status )
- icon = k_gui_icon_tick;
-
- miniworld_icon( cam, icon, challenge->transform.co, 1.0f );
- }
-
- for( u32 i=0; i<af_arrcount(&dest_world->ent_route); i++ ){
- ent_route *route = af_arritm( &dest_world->ent_route, i );
-
- if( route->flags & k_ent_route_flag_achieve_gold ){
- miniworld_icon( cam, k_gui_icon_rift_run_gold,
- route->board_transform[3],1.0f);
- }
- else if( route->flags & k_ent_route_flag_achieve_silver ){
- miniworld_icon( cam, k_gui_icon_rift_run_silver,
- route->board_transform[3],1.0f);
- }
- }
-
- for( u32 i=0; i<af_arrcount(&dest_world->ent_route); i++ ){
- ent_route *route = af_arritm( &dest_world->ent_route, i );
-
- v4f colour;
- v4_copy( route->colour, colour );
- v3_muls( colour, 1.6666f, colour );
- shader_model_font_uColour( colour );
- miniworld_icon( cam, k_gui_icon_rift_run, route->board_transform[3],1.0f);
- }
-#endif
-}
-
-void ent_miniworld_preupdate(void)
-{
-#if 0
- world_instance *hub = world_current_instance(),
- *dest = &_world.instances[k_world_purpose_client];
-
- ent_miniworld *miniworld = global_miniworld.active;
-
- if( (localplayer.subsystem != k_player_subsystem_walk) ||
- (global_miniworld.transition) ||
- (_world.active_instance != k_world_purpose_hub) ||
- (!miniworld) ||
- (dest->status != k_world_status_loaded) ||
- (skaterift.activity != k_skaterift_default)) {
- return;
- }
-
- if( button_down( k_srbind_miniworld_resume ) )
- {
- if( skaterift.demo_mode )
- {
- if( _world.instance_addons[1]->flags & ADDON_REG_PREMIUM )
- {
- menu_open( k_menu_page_premium );
- return;
- }
- }
-
- global_miniworld.transition = 1;
- global_miniworld.t = 0.0f;
- global_miniworld.cam = g_render.cam;
-
- world_switch_instance(1);
- srinput.state = k_input_state_resume;
- menu.disable_open = 0;
- gui_helper_reset( k_gui_helper_mode_clear );
- audio_lock();
- audio_oneshot( &audio_ui[2], 1.0f, 0.0f );
- audio_unlock();
- }
-#endif
-}
-
-void ent_miniworld_goback(void)
-{
-#if 0
- audio_lock();
- audio_oneshot( &audio_ui[2], 1.0f, 0.0f );
- audio_unlock();
-
- global_miniworld.transition = -1;
- global_miniworld.t = 1.0f;
-
- global_miniworld.cam = g_render.cam;
- vg_m4x3_transform_camera( global_miniworld.mmdl, &global_miniworld.cam );
- world_switch_instance(0);
-#endif
-}
+++ /dev/null
-#pragma once
-#include "entity.h"
-
-struct global_miniworld
-{
- ent_miniworld *active;
- int transition;
- f32 t;
-
- m4x3f mmdl;
- vg_camera cam;
-}
-extern global_miniworld;
-
-entity_call_result ent_miniworld_call( world_instance *world, ent_call *call );
-void ent_miniworld_render( world_instance *host_world, vg_camera *cam );
-void ent_miniworld_goback(void);
-void ent_miniworld_preupdate(void);
vg_str text;
vg_strnull( &text, _skateshop.helper_toggle->text, sizeof(_skateshop.helper_toggle->text) );
- if( skaterift.demo_mode )
+ if( g_client.demo_mode )
{
vg_strcat( &text, "Not availible in demo" );
}
{
f64 delta = vg.time_real - network_client.last_intent_change;
- if( (delta > 5.0) && (!skaterift.demo_mode) )
+ if( (delta > 5.0) && (!g_client.demo_mode) )
{
_skateshop.helper_pick->greyed = 0;
if( button_down( k_srbind_maccept ) )
menu.page = k_menu_page_starter;
}
+static int cmd_menu_impromptu( int argc, const char *argv[] )
+{
+ if( argc == 0 )
+ return 0;
+ menu.impromptu_which = atoi( argv[0] );
+ menu_open( k_menu_page_impromptu_guide );
+ return 1;
+}
+
void menu_init(void)
{
vg_console_reg_var( "skip_starter_menu", &menu.skip_starter, k_var_dtype_i32, VG_VAR_PERSISTENT );
- vg_tex2d_load_qoi_async_file( "textures/prem.qoi", VG_TEX2D_CLAMP|VG_TEX2D_NOMIP|VG_TEX2D_NEAREST, &menu.prem_tex );
+ vg_console_reg_cmd( "menu_impromptu", cmd_menu_impromptu, NULL );
+
+ u32 flags = VG_TEX2D_CLAMP|VG_TEX2D_NOMIP|VG_TEX2D_NEAREST;
+ vg_tex2d_load_qoi_async_file( "textures/prem.qoi", flags, &menu.prem_tex );
+ vg_tex2d_load_qoi_async_file( "textures/guide_pump.qoi", flags, &menu.guide_pump_tex );
+ vg_tex2d_load_qoi_async_file( "textures/guide_fliptrick.qoi", flags, &menu.guide_fliptrick_tex );
}
static void menu_update_world_filter(void)
/* PAGE impromptu */
else if( menu.page == k_menu_page_impromptu_guide )
{
- ui_rect panel = { 0,0, 600, 400+240 },
- screen = { 0,0, vg.window_x,vg.window_y };
+ ui_rect screen = { 0,0, vg.window_x,vg.window_y };
+ ui_rect image = { 0,0, 780, 840 };
+ ui_rect panel;
+
+ ui_rect_center( screen, image );
+ rect_copy( image, panel );
+ panel[0] -= 8;
+ panel[1] -= (8+32);
+ panel[2] += 16;
+ panel[3] += 16 + 64;
+
+ ui_rect end_row = { panel[0], panel[1]+panel[3]-64, panel[2], 64 };
- ui_rect_center( screen, panel );
ui_fill( ctx, panel, ui_opacity( GUI_COL_DARK, 0.35f ) );
ui_outline( ctx, panel, 1, GUI_COL_NORM, 0 );
- ui_rect_pad( panel, (ui_px[]){8,8} );
- ui_rect title;
- ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
- ctx->font = &vgf_default_title;
- ui_text( ctx, title, "Welcome to Center Island", 1, k_ui_align_middle_center, 0 );
+ if( menu.impromptu_which == 0 )
+ ui_image( ctx, image, &menu.guide_pump_tex, 0 );
+ else
+ ui_image( ctx, image, &menu.guide_fliptrick_tex, 0 );
- ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
ctx->font = &vgf_default_large;
-
- ui_rect content;
- ui_split( panel, k_ui_axis_h, 456, 0, content, panel );
- ui_text( ctx, content,
- /*|------------------------------------------------| */
- "Here you can visit different locations and keep\n"
- "track of your progress.\n"
- "\n"
- "Visit the sandcastles to enter the worlds. Our\n"
- "story begins at the training volcano where you\n"
- "will learn to skate again!\n"
- "\n"
- "Come back here at any time using the world menu,\n"
- "if you want to change your character or boards\n"
- "too.\n"
- , 1, k_ui_align_left, 0 );
-
- ui_rect end = { panel[0], panel[1] + panel[3] - 48, panel[2], 48 };
- if( menu_button( ctx, end, 1, 1, "OK" ) || button_down( k_srbind_mback ) )
+ if( menu_button( ctx, end_row, 1, 1, "OK" ) || button_down( k_srbind_mback ) )
{
vg_audio_lock();
vg_audio_oneshot( &audio_ui[3], 1.0f, 0.0f, 0, 0 );
ui_split( inf, k_ui_axis_h, 28, 0, title, inf );
ctx->font = &vgf_default_large;
ui_text( ctx, inf,
- "Connection to the global server is managed by this radar\n"
- "dish in the hub island. Come back here to turn the\n"
- "connection on or off.\n"
+ "Connection to the global server is managed by the\n"
+ "'Online' Tab.\n"
"\n"
"You'll then see other players or your friends if you go\n"
"to the same location, and your highscores will be saved\n"
const char *web_link; /* if set; modal */
i32 web_choice;
- GLuint prem_tex;
+ GLuint prem_tex, guide_pump_tex, guide_fliptrick_tex;
addon_id world_list_entries[ MENU_WORLD_MAX_COUNT ];
const char *world_list_names[ MENU_WORLD_MAX_COUNT ];
addon_id clicked_world_id;
const char *clicked_world_name;
+
+ int impromptu_which;
}
extern menu;
void network_status_string( vg_str *str, u32 *colour )
{
- if( skaterift.demo_mode )
+ if( g_client.demo_mode )
{
- vg_strcat( str, "Offline" );
+ vg_strcat( str, "Unavailible in demo" );
*colour = 0xff0000a0;
return;
}
if( !steam_ready )
return;
+ if( g_client.demo_mode )
+ return;
+
ESteamNetworkingConnectionState state = network_client.state;
if( network_client.user_intent == k_server_intent_offline )
vg_loader_step( render_init, NULL );
/* please forgive me! */
- u32 sz; char *drm;
- if( (drm = vg_file_read_text( vg_mem.scratch, "DRM", &sz )) )
- if( !strcmp(drm, "blibby!") )
- g_client.demo_mode = 0;
+ if( g_client.demo_mode != 2 )
+ {
+ u32 sz; char *drm;
+ if( (drm = vg_file_read_text( vg_mem.scratch, "DRM", &sz )) )
+ if( !strcmp(drm, "blibby!") )
+ g_client.demo_mode = 0;
+ }
vg_loader_step( remote_players_init, NULL );
network_set_host( arg, NULL );
if( vg_long_opt( "demo", "Turn demo mode on" ) )
- g_client.demo_mode = 1;
+ g_client.demo_mode = 2;
if( vg_long_opt( "nosteam", "Disable steam integration (offline)" ) )
g_client.nosteam = 1;
GLuint rt_textures[k_skaterift_rt_max];
u32 achievements;
- int demo_mode;
i32 allow_replay_resume;
vg_signal_id sig_world;
u64 full_ready_mask;
void steam_set_achievement( const char *name )
{
- if( skaterift.demo_mode )
+ if( g_client.demo_mode )
return;
if( steam_ready && steam_stats_ready )
{
addon_id addon_id = _get_addon_by_alias( &q );
if( addon_id )
- skaterift_load_world_start( addon_id, 0 );
+ {
+ bool allowed = 1;
+ if( g_client.demo_mode )
+ {
+ addon_reg *reg = addon_details( addon_id );
+ if( reg )
+ {
+ if( reg->flags & ADDON_REG_PREMIUM )
+ {
+ menu_open( k_menu_page_premium );
+ allowed = 0;
+ }
+ }
+ }
+
+ if( allowed )
+ skaterift_load_world_start( addon_id, 0 );
+ else
+ vg_error( "That is a premium world and you are in the demo.! Sorry :(\n" );
+ }
else
vg_error( "Addon '%s' is not installed or not found.\n", argv[0] );
}
if( enter_location && menu.clicked_world_id )
{
+ bool allowed = 1;
+
if( menu.clicked_world_id != _world.main.addon_id )
{
- menu_close();
- skaterift_load_world_start( menu.clicked_world_id, 0 );
+ if( g_client.demo_mode )
+ {
+ addon_reg *reg = addon_details( menu.clicked_world_id );
+ if( reg )
+ {
+ if( reg->flags & ADDON_REG_PREMIUM )
+ {
+ menu_open( k_menu_page_premium );
+ allowed = 0;
+ }
+ }
+ }
+
+ if( allowed )
+ {
+ menu_close();
+ skaterift_load_world_start( menu.clicked_world_id, 0 );
+ }
}
- world_map.activity = k_map_activity_local_world;
- world_map.superworld_actual_world = world_map.superworld_list_selected;
+ if( allowed )
+ {
+ world_map.activity = k_map_activity_local_world;
+ world_map.superworld_actual_world = world_map.superworld_list_selected;
+ }
}
}