From: hgn Date: Thu, 19 Jun 2025 15:18:39 +0000 (+0100) Subject: LAST MINUTE FAUCWWWWWWWWWWWWWW X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=04ba0f005d440f4ca5403d11f3df803e88a2dd64;p=carveJwlIkooP6JGAAIwe30JlM.git LAST MINUTE FAUCWWWWWWWWWWWWWW --- diff --git a/content_skaterift/maps/dev_tutorial/main.mdl b/content_skaterift/maps/dev_tutorial/main.mdl index 7484dce..629a60e 100644 Binary files a/content_skaterift/maps/dev_tutorial/main.mdl and b/content_skaterift/maps/dev_tutorial/main.mdl differ diff --git a/content_skaterift/textures/guide_fliptrick.qoi b/content_skaterift/textures/guide_fliptrick.qoi new file mode 100644 index 0000000..1fcc746 Binary files /dev/null and b/content_skaterift/textures/guide_fliptrick.qoi differ diff --git a/content_skaterift/textures/guide_pump.qoi b/content_skaterift/textures/guide_pump.qoi new file mode 100644 index 0000000..8e836da Binary files /dev/null and b/content_skaterift/textures/guide_pump.qoi differ diff --git a/src/addon.c b/src/addon.c index cf932b3..000ec14 100644 --- a/src/addon.c +++ b/src/addon.c @@ -702,7 +702,7 @@ void _mount_workshop_addons( vg_async_task *co_task ) { THREAD_0; - if( skaterift.demo_mode ) + if( g_client.demo_mode ) { vg_info( "Won't load workshop items in demo mode\n" ); return; diff --git a/src/ent_miniworld.c b/src/ent_miniworld.c deleted file mode 100644 index 0342926..0000000 --- a/src/ent_miniworld.c +++ /dev/null @@ -1,221 +0,0 @@ -#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; ient_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; ient_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; ient_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 -} diff --git a/src/ent_miniworld.h b/src/ent_miniworld.h deleted file mode 100644 index 278cf75..0000000 --- a/src/ent_miniworld.h +++ /dev/null @@ -1,18 +0,0 @@ -#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); diff --git a/src/ent_skateshop.c b/src/ent_skateshop.c index 4ec21e8..3573575 100644 --- a/src/ent_skateshop.c +++ b/src/ent_skateshop.c @@ -69,7 +69,7 @@ static void skateshop_server_helper_update(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" ); } @@ -277,7 +277,7 @@ void ent_skateshop_update(void) { 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 ) ) diff --git a/src/menu.c b/src/menu.c index a799a62..fff1190 100644 --- a/src/menu.c +++ b/src/menu.c @@ -24,10 +24,24 @@ void menu_at_begin(void) 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) @@ -893,40 +907,29 @@ void menu_gui( ui_context *ctx ) /* 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 ); @@ -1559,9 +1562,8 @@ n1: 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" diff --git a/src/menu.h b/src/menu.h index 7f4d424..4eda5a2 100644 --- a/src/menu.h +++ b/src/menu.h @@ -61,7 +61,7 @@ struct global_menu 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 ]; @@ -76,6 +76,8 @@ struct global_menu addon_id clicked_world_id; const char *clicked_world_name; + + int impromptu_which; } extern menu; diff --git a/src/network.c b/src/network.c index 0c5c2cf..5c27f31 100644 --- a/src/network.c +++ b/src/network.c @@ -202,9 +202,9 @@ static void network_disconnect(void) 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; } @@ -600,6 +600,9 @@ void network_update(void) if( !steam_ready ) return; + if( g_client.demo_mode ) + return; + ESteamNetworkingConnectionState state = network_client.state; if( network_client.user_intent == k_server_intent_offline ) diff --git a/src/skaterift.c b/src/skaterift.c index 4ac7b01..1ad64a4 100644 --- a/src/skaterift.c +++ b/src/skaterift.c @@ -101,10 +101,13 @@ static void game_load_co( vg_coroutine *co ) 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 ); @@ -700,7 +703,7 @@ int main( int argc, const char *argv[] ) 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; diff --git a/src/skaterift.h b/src/skaterift.h index 4aa5fd8..ed5ee37 100644 --- a/src/skaterift.h +++ b/src/skaterift.h @@ -30,7 +30,6 @@ struct skaterift_globals 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; diff --git a/src/steam.c b/src/steam.c index 72cbcbb..c030153 100644 --- a/src/steam.c +++ b/src/steam.c @@ -53,7 +53,7 @@ void steam_store_achievements(void) void steam_set_achievement( const char *name ) { - if( skaterift.demo_mode ) + if( g_client.demo_mode ) return; if( steam_ready && steam_stats_ready ) diff --git a/src/world_load.c b/src/world_load.c index 299e5e2..f775a95 100644 --- a/src/world_load.c +++ b/src/world_load.c @@ -574,7 +574,26 @@ int skaterift_load_world_command( int argc, const char *argv[] ) { 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] ); } diff --git a/src/world_map.c b/src/world_map.c index 69eaea3..b7a06a3 100644 --- a/src/world_map.c +++ b/src/world_map.c @@ -1070,14 +1070,35 @@ void world_map_gui( ui_context *ctx, ui_rect main_area, i32 mh, i32 mv, bool *al 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; + } } }