projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move texture compiler to native code
[carveJwlIkooP6JGAAIwe30JlM.git]
/
player_remote.c
diff --git
a/player_remote.c
b/player_remote.c
index ba07abea312a44ebcae783bb00c9c16d792a05d6..f829ec0512de5585cc54a5a21c2feb1e53af0439 100644
(file)
--- a/
player_remote.c
+++ b/
player_remote.c
@@
-1,6
+1,7
@@
#include "player_remote.h"
#include "skeleton.h"
#include "player_render.h"
#include "player_remote.h"
#include "skeleton.h"
#include "player_render.h"
+#include "player_api.h"
#include "network_common.h"
#include "addon.h"
#include "font.h"
#include "network_common.h"
#include "addon.h"
#include "font.h"
@@
-8,10
+9,14
@@
#include "ent_miniworld.h"
#include "ent_region.h"
#include "shaders/model_entity.h"
#include "ent_miniworld.h"
#include "ent_region.h"
#include "shaders/model_entity.h"
+#include "vg/vg_steam_friends.h"
+
+struct global_netplayers netplayers;
static i32 k_show_own_name = 0;
static i32 k_show_own_name = 0;
-static void player_remote_clear( struct network_player *player ){
+static void player_remote_clear( struct network_player *player )
+{
addon_cache_unwatch( k_addon_type_player, player->playermodel_view_slot );
addon_cache_unwatch( k_addon_type_board, player->board_view_slot );
addon_cache_unwatch( k_addon_type_player, player->playermodel_view_slot );
addon_cache_unwatch( k_addon_type_board, player->board_view_slot );
@@
-53,7
+58,8
@@
static void relink_remote_player_worlds( u32 client_id ){
*
* Run if local worlds change
*/
*
* Run if local worlds change
*/
-static void relink_all_remote_player_worlds(void){
+void relink_all_remote_player_worlds(void)
+{
for( u32 i=0; i<vg_list_size(netplayers.list); i++ ){
struct network_player *player = &netplayers.list[i];
if( player->active )
for( u32 i=0; i<vg_list_size(netplayers.list); i++ ){
struct network_player *player = &netplayers.list[i];
if( player->active )
@@
-61,7
+67,8
@@
static void relink_all_remote_player_worlds(void){
}
}
}
}
-static void player_remote_update_friendflags( struct network_player *remote ){
+void player_remote_update_friendflags( struct network_player *remote )
+{
ISteamFriends *hSteamFriends = SteamAPI_SteamFriends();
remote->isfriend = SteamAPI_ISteamFriends_HasFriend( hSteamFriends,
remote->steamid, k_EFriendFlagImmediate );
ISteamFriends *hSteamFriends = SteamAPI_SteamFriends();
remote->isfriend = SteamAPI_ISteamFriends_HasFriend( hSteamFriends,
remote->steamid, k_EFriendFlagImmediate );
@@
-69,7
+76,8
@@
static void player_remote_update_friendflags( struct network_player *remote ){
remote->steamid, k_EFriendFlagBlocked );
}
remote->steamid, k_EFriendFlagBlocked );
}
-static void player_remote_rx_200_300( SteamNetworkingMessage_t *msg ){
+void player_remote_rx_200_300( SteamNetworkingMessage_t *msg )
+{
netmsg_blank *tmp = msg->m_pData;
if( tmp->inetmsg_id == k_inetmsg_playerjoin ){
netmsg_blank *tmp = msg->m_pData;
if( tmp->inetmsg_id == k_inetmsg_playerjoin ){
@@
-313,7
+321,8
@@
static void player_remote_rx_200_300( SteamNetworkingMessage_t *msg ){
/*
* Write localplayer pose to network
*/
/*
* Write localplayer pose to network
*/
-static void remote_player_send_playerframe(void){
+void remote_player_send_playerframe(void)
+{
u8 sysid = localplayer.subsystem;
if( sysid >= k_player_subsystem_max ) return;
u8 sysid = localplayer.subsystem;
if( sysid >= k_player_subsystem_max ) return;
@@
-386,7
+395,8
@@
static void remote_player_send_playerframe(void){
/*
* Updates network traffic stats
*/
/*
* Updates network traffic stats
*/
-static void remote_player_debug_update(void){
+void remote_player_debug_update(void)
+{
if( (vg.time_real - netplayers.last_data_measurement) > 1.0 ){
netplayers.last_data_measurement = vg.time_real;
u32 total_down = 0;
if( (vg.time_real - netplayers.last_data_measurement) > 1.0 ){
netplayers.last_data_measurement = vg.time_real;
u32 total_down = 0;
@@
-409,7
+419,8
@@
static void remote_player_debug_update(void){
/*
* Debugging information
*/
/*
* Debugging information
*/
-static void remote_player_network_imgui( m4x4f pv ){
+void remote_player_network_imgui( m4x4f pv )
+{
if( network_client.user_intent == k_server_intent_online ){
if( !(steam_ready &&
(network_client.state == k_ESteamNetworkingConnectionState_Connected)))
if( network_client.user_intent == k_server_intent_online ){
if( !(steam_ready &&
(network_client.state == k_ESteamNetworkingConnectionState_Connected)))
@@
-596,8
+607,8
@@
static void pose_remote_player( u32 index,
/*
* animate remote player and store in final_mtx
*/
/*
* animate remote player and store in final_mtx
*/
-static void animate_remote_player( u32 index ){
-
+void animate_remote_player( u32 index )
+{
/*
* Trys to keep the cursor inside the buffer
*/
/*
* Trys to keep the cursor inside the buffer
*/
@@
-652,7
+663,8
@@
static void animate_remote_player( u32 index ){
/*
* Update full final_mtx for all remote players
*/
/*
* Update full final_mtx for all remote players
*/
-static void animate_remote_players(void){
+void animate_remote_players(void)
+{
for( u32 i=0; i<vg_list_size(netplayers.list); i ++ ){
struct network_player *player = &netplayers.list[i];
if( !player->active ) continue;
for( u32 i=0; i<vg_list_size(netplayers.list); i ++ ){
struct network_player *player = &netplayers.list[i];
if( !player->active ) continue;
@@
-664,7
+676,8
@@
static void animate_remote_players(void){
/*
* Draw remote players
*/
/*
* Draw remote players
*/
-static void render_remote_players( world_instance *world, camera *cam ){
+void render_remote_players( world_instance *world, vg_camera *cam )
+{
u32 draw_list[ NETWORK_MAX_PLAYERS ],
draw_list_count = 0,
gliders = 0;
u32 draw_list[ NETWORK_MAX_PLAYERS ],
draw_list_count = 0,
gliders = 0;
@@
-774,7
+787,8
@@
static int remote_players_randomize( int argc, const char *argv[] ){
return 0;
}
return 0;
}
-static void remote_players_init(void){
+void remote_players_init(void)
+{
vg_console_reg_cmd( "add_test_players", remote_players_randomize, NULL );
vg_console_reg_var( "k_show_own_name", &k_show_own_name,
k_var_dtype_i32, 0 );
vg_console_reg_cmd( "add_test_players", remote_players_randomize, NULL );
vg_console_reg_var( "k_show_own_name", &k_show_own_name,
k_var_dtype_i32, 0 );
@@
-783,7
+797,8
@@
static void remote_players_init(void){
}
}
}
}
-static void remote_sfx_pre_update(void){
+void remote_sfx_pre_update(void)
+{
for( u32 i=0; i<NETWORK_SFX_QUEUE_LENGTH; i ++ ){
struct net_sfx *si = &netplayers.sfx_queue[i];
for( u32 i=0; i<NETWORK_SFX_QUEUE_LENGTH; i ++ ){
struct net_sfx *si = &netplayers.sfx_queue[i];
@@
-955,7
+970,8
@@
static void remote_player_gui_info( ui_rect box,
ui_text( bottom, activity, 1, k_ui_align_middle_center, fg );
}
ui_text( bottom, activity, 1, k_ui_align_middle_center, fg );
}
-static void remote_players_imgui_lobby(void){
+void remote_players_imgui_lobby(void)
+{
if( network_client.user_intent == k_server_intent_online ){
if( !(steam_ready &&
(network_client.state == k_ESteamNetworkingConnectionState_Connected)))
if( network_client.user_intent == k_server_intent_online ){
if( !(steam_ready &&
(network_client.state == k_ESteamNetworkingConnectionState_Connected)))
@@
-999,8
+1015,9
@@
static void remote_players_imgui_lobby(void){
}
}
}
}
-static void remote_players_imgui_world( world_instance *world, m4x4f pv,
- f32 max_dist, int geo_cull ){
+void remote_players_imgui_world( world_instance *world, m4x4f pv,
+ f32 max_dist, int geo_cull )
+{
ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y );
for( u32 i=0; i<NETWORK_MAX_PLAYERS; i++ ){
ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y );
for( u32 i=0; i<NETWORK_MAX_PLAYERS; i++ ){
@@
-1070,7
+1087,8
@@
static void chat_enter( char *buf, u32 len ){
chat_send_message( buf );
}
chat_send_message( buf );
}
-static void remote_players_chat_imgui(void){
+void remote_players_chat_imgui(void)
+{
if( netplayers.chatting == 1 ){
ui_rect box = { 0, 0, 400, 40 },
window = { 0, 0, vg.window_x, vg.window_y };
if( netplayers.chatting == 1 ){
ui_rect box = { 0, 0, 400, 40 },
window = { 0, 0, vg.window_x, vg.window_y };