X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=steam.h;h=cbe88eef63b67d92cbdab643d61c421b46755403;hb=4fa9aa9a1e09940e91cc30e171e3de0606515ef3;hp=09e3935aecff37421f81fd31058136961a3bf3e6;hpb=4c95c9c3e6033cd1360adacef3c80fc4da933715;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/steam.h b/steam.h index 09e3935..cbe88ee 100644 --- a/steam.h +++ b/steam.h @@ -27,9 +27,9 @@ * nothing. */ -VG_STATIC char steam_username_at_startup[128]; +static char steam_username_at_startup[128] = "Unassigned"; -VG_STATIC void recv_steam_warning( int severity, const char *msg ) +static void recv_steam_warning( int severity, const char *msg ) { if( severity == 0 ) vg_low( "%s\n", msg ); @@ -37,30 +37,30 @@ VG_STATIC void recv_steam_warning( int severity, const char *msg ) vg_info( "%s\n", msg ); } -VG_STATIC int steam_ready = 0, +static int steam_ready = 0, steam_stats_ready = 0; -VG_STATIC void *hSteamNetworkingSockets, +static void *hSteamNetworkingSockets, *hSteamUser; -VG_STATIC ISteamUserStats *hSteamUserStats; -VG_STATIC HSteamPipe hSteamClientPipe; +static ISteamUserStats *hSteamUserStats; +static HSteamPipe hSteamClientPipe; -VG_STATIC const char *steam_achievement_names[] = +static const char *steam_achievement_names[] = { "ALBERT", "MARC", "ROUTE_MPY", "ROUTE_MPG", "ROUTE_MPB", "ROUTE_MPR", "ROUTE_TO", "ROUTE_TC" }; -VG_STATIC void steam_store_achievements(void) +static void steam_store_achievements(void) { if( steam_ready && steam_stats_ready ){ SteamAPI_ISteamUserStats_StoreStats( hSteamUserStats ); } } -VG_STATIC void steam_set_achievement( const char *name ) +static void steam_set_achievement( const char *name ) { if( steam_ready && steam_stats_ready ){ if( SteamAPI_ISteamUserStats_SetAchievement( hSteamUserStats, name ) ){ @@ -75,7 +75,7 @@ VG_STATIC void steam_set_achievement( const char *name ) } } -VG_STATIC void steam_clear_achievement( const char *name ) +static void steam_clear_achievement( const char *name ) { if( steam_ready && steam_stats_ready ){ if( SteamAPI_ISteamUserStats_ClearAchievement( hSteamUserStats, name ) ){ @@ -91,7 +91,7 @@ VG_STATIC void steam_clear_achievement( const char *name ) } -VG_STATIC void steam_print_all_achievements(void){ +static void steam_print_all_achievements(void){ vg_info( "Achievements: \n" ); if( steam_ready && steam_stats_ready ){ @@ -114,7 +114,7 @@ VG_STATIC void steam_print_all_achievements(void){ } } -VG_STATIC int steam_achievement_ccmd( int argc, char const *argv[] ) +static int steam_achievement_ccmd( int argc, char const *argv[] ) { if( !(steam_ready && steam_stats_ready) ) return 1; @@ -147,7 +147,7 @@ VG_STATIC int steam_achievement_ccmd( int argc, char const *argv[] ) return 1; } -VG_STATIC void steam_on_recieve_current_stats( CallbackMsg_t *msg ) +static void steam_on_recieve_current_stats( CallbackMsg_t *msg ) { UserStatsReceived_t *rec = (UserStatsReceived_t *)msg->m_pubParam; @@ -161,7 +161,7 @@ VG_STATIC void steam_on_recieve_current_stats( CallbackMsg_t *msg ) } } -VG_STATIC u32 utf8_byte0_byte_count( u8 char0 ) +static u32 utf8_byte0_byte_count( u8 char0 ) { for( u32 k=2; k<4; k++ ){ if( !(char0 & (0x80 >> k)) ) @@ -171,13 +171,12 @@ VG_STATIC u32 utf8_byte0_byte_count( u8 char0 ) return 0; } -VG_STATIC void str_utf8_collapse( const char *str, char *buf, u32 length ) -{ +static u32 str_utf8_collapse( const char *str, char *buf, u32 length ){ u8 *ustr = (u8 *)str; u32 utf32_code = 0x00000000; u32 i=0, j=0, utf32_byte_ct=0; - for(;i < length-1;){ + for(;j < length-1;){ if( ustr[i] == 0x00 ) break; @@ -210,11 +209,11 @@ VG_STATIC void str_utf8_collapse( const char *str, char *buf, u32 length ) } buf[j] = 0x00; + return j; } -VG_STATIC int steam_init(void) -{ - const char *username = NULL; +static int steam_init(void){ + const char *username = "offline player"; #ifdef SR_NETWORKED vg_info( "Initializing steamworks\n" ); @@ -266,14 +265,14 @@ VG_STATIC int steam_init(void) return 1; } -VG_STATIC void steam_update(void) +static void steam_update(void) { if( steam_ready ){ steamworks_event_loop( hSteamClientPipe ); } } -VG_STATIC void steam_end(void) +static void steam_end(void) { if( steam_ready ){ vg_info( "Shutting down\n..." );