X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_skateshop.c;h=a4cfe22d526afb8cf1a20e9bd9c07468b6085fc6;hb=d680579754c876a74bf77ac74a224900ce0b3ff9;hp=4c5817dd31e91ca1c9344adf8a450d515842f57b;hpb=c2b59441df0383807ba093295af2e4400e552f39;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_skateshop.c b/ent_skateshop.c index 4c5817d..a4cfe22 100644 --- a/ent_skateshop.c +++ b/ent_skateshop.c @@ -27,7 +27,7 @@ static inline int const_str_eq( u32 hash, const char *str, const char *cmp ) return 0; } -VG_STATIC void skateshop_update_viewpage(void){ +static void skateshop_update_viewpage(void){ u32 page = global_skateshop.selected_board_id/SKATESHOP_VIEW_SLOT_MAX; for( u32 i=0; ient_camera, @@ -185,7 +176,7 @@ VG_STATIC void global_skateshop_preupdate(void){ v3f dir = {0.0f,-1.0f,0.0f}; mdl_transform_vector( &ref->transform, dir, dir ); m3x3_mulv( localplayer.invbasis, dir, dir ); - player_vector_angles( global_skateshop.cam.angles, dir, 1.0f, 0.0f ); + player_vector_angles( world_static.focus_cam.angles, dir, 1.0f, 0.0f ); v3f lookat; if( shop->type == k_skateshop_type_boardshop || @@ -202,8 +193,8 @@ VG_STATIC void global_skateshop_preupdate(void){ q_axis_angle( localplayer.rb.q, (v3f){0.0f,1.0f,0.0f}, atan2f(lookat[0],lookat[2]) ); - v3_copy( ref->transform.co, global_skateshop.cam.pos ); - global_skateshop.cam.fov = ref->fov; + v3_copy( ref->transform.co, world_static.focus_cam.pos ); + world_static.focus_cam.fov = ref->fov; /* input */ if( shop->type == k_skateshop_type_boardshop ){ @@ -251,7 +242,7 @@ VG_STATIC void global_skateshop_preupdate(void){ addon_cache_watch( k_addon_type_board, cache_id ); localplayer.board_view_slot = cache_id; - global_skateshop_exit(); + world_entity_unfocus(); skaterift_autosave(1); return; } @@ -290,12 +281,12 @@ VG_STATIC void global_skateshop_preupdate(void){ } if( changed ){ - player__use_model( &localplayer, global_skateshop.selected_player_id ); + player__use_model( global_skateshop.selected_player_id ); skateshop_op_processview(); } if( button_down( k_srbind_maccept ) ){ - global_skateshop_exit(); + world_entity_unfocus(); } } else if( shop->type == k_skateshop_type_worldshop ){ @@ -377,15 +368,13 @@ VG_STATIC void global_skateshop_preupdate(void){ } if( button_down( k_srbind_mback ) ){ - global_skateshop_exit(); + world_entity_unfocus(); return; } } -VG_STATIC void skateshop_render_boardshop(void){ +static void skateshop_render_boardshop( ent_skateshop *shop ){ world_instance *world = world_current_instance(); - ent_skateshop *shop = global_skateshop.ptr_ent; - u32 slot_count = vg_list_size(global_skateshop.shop_view_slots); ent_marker *mark_rack = mdl_arritm( &world->ent_marker, @@ -549,15 +538,12 @@ fade_out:; SDL_AtomicUnlock( &addon_system.sl_cache_using_resources ); } -VG_STATIC void skateshop_render_charshop(void) -{ +static void skateshop_render_charshop( ent_skateshop *shop ){ } -VG_STATIC void skateshop_render_worldshop(void) -{ +static void skateshop_render_worldshop( ent_skateshop *shop ){ world_instance *world = world_current_instance(); - ent_skateshop *shop = global_skateshop.ptr_ent; ent_marker *mark_display = mdl_arritm( &world->ent_marker, mdl_entity_id_id(shop->worlds.id_display)), *mark_info = mdl_arritm( &world->ent_marker, @@ -659,30 +645,21 @@ VG_STATIC void skateshop_render_worldshop(void) /* * World: render event */ -VG_STATIC void skateshop_render(void){ - if( skaterift.activity != k_skaterift_skateshop ) return; - - ent_skateshop *shop = global_skateshop.ptr_ent; - - if( shop->type == k_skateshop_type_boardshop ){ - skateshop_render_boardshop(); - } - else if( shop->type == k_skateshop_type_charshop ){ - skateshop_render_charshop(); - } - else if( shop->type == k_skateshop_type_worldshop ){ - skateshop_render_worldshop(); - } - else{ +static void skateshop_render( ent_skateshop *shop ){ + if( shop->type == k_skateshop_type_boardshop ) + skateshop_render_boardshop( shop ); + else if( shop->type == k_skateshop_type_charshop ) + skateshop_render_charshop( shop ); + else if( shop->type == k_skateshop_type_worldshop ) + skateshop_render_worldshop( shop ); + else vg_fatal_error( "Unknown store (%u)\n", shop->type ); - } } /* * Entity logic: entrance event */ -VG_STATIC void ent_skateshop_call( world_instance *world, ent_call *call ) -{ +static void ent_skateshop_call( world_instance *world, ent_call *call ){ u32 index = mdl_entity_id_id( call->id ); ent_skateshop *shop = mdl_arritm( &world->ent_skateshop, index ); vg_info( "skateshop_call\n" ); @@ -695,6 +672,8 @@ VG_STATIC void ent_skateshop_call( world_instance *world, ent_call *call ) vg_info( "Entering skateshop\n" ); + world_entity_focus( call->id ); +#if 0 localplayer.immobile = 1; menu.disable_open = 1; skaterift.activity = k_skaterift_skateshop; @@ -703,6 +682,7 @@ VG_STATIC void ent_skateshop_call( world_instance *world, ent_call *call ) v3_zero( localplayer.rb.w ); localplayer._walk.move_speed = 0.0f; global_skateshop.ptr_ent = shop; +#endif if( shop->type == k_skateshop_type_boardshop ){ skateshop_update_viewpage(); @@ -718,15 +698,4 @@ VG_STATIC void ent_skateshop_call( world_instance *world, ent_call *call ) } } -/* - * Entity logic: exit event - */ -VG_STATIC void global_skateshop_exit(void){ - vg_info( "exit skateshop\n" ); - localplayer.immobile = 0; - skaterift.activity = k_skaterift_default; - menu.disable_open = 0; - srinput.enabled = 0; -} - #endif /* ENT_SKATESHOP_C */