/* =================== Cmd_ForwardToServer adds the current command line as a clc_stringcmd to the client message. things like godmode, noclip, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded. =================== */ void Cmd_ForwardToServer( void ) { char str[MAX_CMD_BUFFER]; if( cls.demoplayback ) { if( !Q_stricmp( Cmd_Argv( 0 ), "pause" )) cl.refdef.paused ^= 1; return; } if( cls.state != ca_connected && cls.state != ca_active ) { MsgDev( D_INFO, "Can't \"%s\", not connected\n", Cmd_Argv( 0 )); return; // not connected } BF_WriteByte( &cls.netchan.message, clc_stringcmd ); str[0] = 0; if( Q_stricmp( Cmd_Argv( 0 ), "cmd" )) { Q_strcat( str, Cmd_Argv( 0 )); Q_strcat( str, " " ); } if( Cmd_Argc() > 1 ) Q_strcat( str, Cmd_Args( )); else Q_strcat( str, "\n" ); BF_WriteString( &cls.netchan.message, str ); }
void SCR_InstallParticlePalette( void ) { rgbdata_t *pic; int i; // first check 'palette.lmp' then 'palette.pal' pic = FS_LoadImage( "gfx/palette.lmp", NULL, 0 ); if( !pic ) pic = FS_LoadImage( "gfx/palette.pal", NULL, 0 ); // NOTE: imagelib required this fakebuffer for loading internal palette if( !pic ) pic = FS_LoadImage( "#valve.pal", ((byte *)&i), 768 ); if( pic ) { for( i = 0; i < 256; i++ ) { clgame.palette[i][0] = pic->palette[i*4+0]; clgame.palette[i][1] = pic->palette[i*4+1]; clgame.palette[i][2] = pic->palette[i*4+2]; } FS_FreeImage( pic ); } else { for( i = 0; i < 256; i++ ) { clgame.palette[i][0] = i; clgame.palette[i][1] = i; clgame.palette[i][2] = i; } MsgDev( D_WARN, "CL_InstallParticlePalette: failed. Force to grayscale\n" ); } }
/* ================== CL_NextDemo Called when a demo or cinematic finishes If the "nextdemo" cvar is set, that command will be issued ================== */ qboolean CL_NextDemo( void ) { string str; if( cls.demonum == -1 ) return false; // don't play demos S_StopAllSounds(); if( !cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS ) { cls.demonum = 0; if( !cls.demos[cls.demonum][0] ) { MsgDev( D_INFO, "no demos listed with startdemos\n" ); cls.demonum = -1; return false; } } Q_snprintf( str, MAX_STRING, "playdemo %s\n", cls.demos[cls.demonum] ); Cbuf_InsertText( str ); cls.demonum++; return true; }
/* =============== SV_InitPhysicsAPI Initialize server external physics =============== */ qboolean SV_InitPhysicsAPI( void ) { #ifdef _DEDICATED return false; #else static PHYSICAPI pPhysIface; pPhysIface = (PHYSICAPI)Com_GetProcAddress( svgame.hInstance, "Server_GetPhysicsInterface" ); if( pPhysIface ) { if( pPhysIface( SV_PHYSICS_INTERFACE_VERSION, &gPhysicsAPI, &svgame.physFuncs )) { MsgDev( D_AICONSOLE, "SV_LoadProgs: ^2initailized extended PhysicAPI ^7ver. %i\n", SV_PHYSICS_INTERFACE_VERSION ); if( svgame.physFuncs.SV_CheckFeatures != NULL ) { // grab common engine features (it will be shared across the network) host.features = svgame.physFuncs.SV_CheckFeatures(); Host_PrintEngineFeatures (); } return true; } // make sure what physic functions is cleared Q_memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs )); return false; // just tell user about problems } // physic interface is missed return true; #endif }
/* ================= GL_SelectTexture ================= */ void GL_SelectTexture( GLint tmu ) { if( !GL_Support( GL_ARB_MULTITEXTURE )) return; // don't allow negative texture units if( tmu < 0 ) return; if( tmu >= GL_MaxTextureUnits( )) { MsgDev( D_ERROR, "GL_SelectTexture: bad tmu state %i\n", tmu ); return; } if( glState.activeTMU == tmu ) return; glState.activeTMU = tmu; if( pglActiveTextureARB ) { pglActiveTextureARB( tmu + GL_TEXTURE0_ARB ); if( tmu < glConfig.max_texture_coords ) pglClientActiveTextureARB( tmu + GL_TEXTURE0_ARB ); } #ifndef __ANDROID__ else if( pglSelectTextureSGIS ) { pglSelectTextureSGIS( tmu + GL_TEXTURE0_SGIS ); } #endif }
/* =============================================================================== SYSTEM LOG =============================================================================== */ void Sys_InitLog( void ) { const char *mode; if( host.change_game ) mode = "a"; else mode = "w"; // print log to stdout printf( "=================================================================================\n" ); printf( "\t%s (build %i) started at %s\n", s_wcd.title, Q_buildnum(), Q_timestamp( TIME_FULL )); printf( "=================================================================================\n" ); s_wcd.logfileno = -1; // create log if needed if( s_wcd.log_active ) { s_wcd.logfile = fopen( s_wcd.log_path, mode ); if( !s_wcd.logfile ) MsgDev( D_ERROR, "Sys_InitLog: can't create log file %s\n", s_wcd.log_path ); else s_wcd.logfileno = fileno( s_wcd.logfile ); fprintf( s_wcd.logfile, "=================================================================================\n" ); fprintf( s_wcd.logfile, "\t%s (build %i) started at %s\n", s_wcd.title, Q_buildnum(), Q_timestamp( TIME_FULL )); fprintf( s_wcd.logfile, "=================================================================================\n" ); } }
/* ================ VGUI_UploadTexture Upload texture into video memory ================ */ void VGUI_UploadTexture( int id, const char *buffer, int width, int height ) { rgbdata_t r_image; char texName[32]; if( id <= 0 || id >= VGUI_MAX_TEXTURES ) { MsgDev( D_ERROR, "VGUI_UploadTexture: bad texture %i. Ignored\n", id ); return; } Q_snprintf( texName, sizeof( texName ), "*vgui%i", id ); Q_memset( &r_image, 0, sizeof( r_image )); r_image.width = width; r_image.height = height; r_image.type = PF_RGBA_32; r_image.size = r_image.width * r_image.height * 4; r_image.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA; r_image.buffer = (byte *)buffer; g_textures[id] = GL_LoadTextureInternal( texName, &r_image, TF_IMAGE, false ); GL_SetTextureType( g_textures[id], TEX_VGUI ); g_iBoundTexture = id; }
void Key_EnumCmds_f( void ) { file_t *f; FS_AllowDirectPaths( true ); if( FS_FileExists( "../help.txt", false )) { Msg( "help.txt already exist\n" ); FS_AllowDirectPaths( false ); return; } f = FS_Open( "../help.txt", "w", false ); if( f ) { FS_Printf( f, "//=======================================================================\n"); FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY )); FS_Printf( f, "//\t\thelp.txt - xash commands and console variables\n"); FS_Printf( f, "//=======================================================================\n"); FS_Printf( f, "\n\n\t\t\tconsole variables\n\n"); Cvar_LookupVars( 0, NULL, f, Cmd_WriteHelp ); FS_Printf( f, "\n\n\t\t\tconsole commands\n\n"); Cmd_LookupCmds( NULL, f, Cmd_WriteHelp ); FS_Printf( f, "\n\n"); FS_Close( f ); Msg( "help.txt created\n" ); } else MsgDev( D_ERROR, "Couldn't write help.txt.\n"); FS_AllowDirectPaths( false ); }
/* =============== CL_InitClientMove =============== */ void CL_InitClientMove( void ) { int i; Pmove_Init (); clgame.pmove->server = false; // running at client clgame.pmove->movevars = &clgame.movevars; clgame.pmove->runfuncs = false; Mod_SetupHulls( clgame.player_mins, clgame.player_maxs ); // enumerate client hulls for( i = 0; i < MAX_MAP_HULLS; i++ ) { if( clgame.dllFuncs.pfnGetHullBounds( i, clgame.player_mins[i], clgame.player_maxs[i] )) MsgDev( D_NOTE, "CL: hull%i, player_mins: %g %g %g, player_maxs: %g %g %g\n", i, clgame.player_mins[i][0], clgame.player_mins[i][1], clgame.player_mins[i][2], clgame.player_maxs[i][0], clgame.player_maxs[i][1], clgame.player_maxs[i][2] ); } Q_memcpy( clgame.pmove->player_mins, clgame.player_mins, sizeof( clgame.player_mins )); Q_memcpy( clgame.pmove->player_maxs, clgame.player_maxs, sizeof( clgame.player_maxs )); // common utilities clgame.pmove->PM_Info_ValueForKey = Info_ValueForKey; clgame.pmove->PM_Particle = pfnParticle; clgame.pmove->PM_TestPlayerPosition = pfnTestPlayerPosition; clgame.pmove->Con_NPrintf = Con_NPrintf; clgame.pmove->Con_DPrintf = Con_DPrintf; clgame.pmove->Con_Printf = Con_Printf; clgame.pmove->Sys_FloatTime = Sys_DoubleTime; clgame.pmove->PM_StuckTouch = pfnStuckTouch; clgame.pmove->PM_PointContents = pfnPointContents; clgame.pmove->PM_TruePointContents = pfnTruePointContents; clgame.pmove->PM_HullPointContents = pfnHullPointContents; clgame.pmove->PM_PlayerTrace = pfnPlayerTrace; clgame.pmove->PM_TraceLine = pfnTraceLine; clgame.pmove->RandomLong = Com_RandomLong; clgame.pmove->RandomFloat = Com_RandomFloat; clgame.pmove->PM_GetModelType = pfnGetModelType; clgame.pmove->PM_GetModelBounds = pfnGetModelBounds; clgame.pmove->PM_HullForBsp = pfnHullForBsp; clgame.pmove->PM_TraceModel = pfnTraceModel; clgame.pmove->COM_FileSize = COM_FileSize; clgame.pmove->COM_LoadFile = COM_LoadFile; clgame.pmove->COM_FreeFile = COM_FreeFile; clgame.pmove->memfgets = COM_MemFgets; clgame.pmove->PM_PlaySound = pfnPlaySound; clgame.pmove->PM_TraceTexture = pfnTraceTexture; clgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull; clgame.pmove->PM_PlayerTraceEx = pfnPlayerTraceEx; clgame.pmove->PM_TestPlayerPositionEx = pfnTestPlayerPositionEx; clgame.pmove->PM_TraceLineEx = pfnTraceLineEx; clgame.pmove->PM_TraceSurface = pfnTraceSurface; // initalize pmove clgame.dllFuncs.pfnPlayerMoveInit( clgame.pmove ); }
/* ================ FS_OpenStream open and reading basic info from sound stream ================ */ stream_t *FS_OpenStream( const char *filename ) { const char *ext = FS_FileExtension( filename ); string path, loadname; qboolean anyformat = true; const streamfmt_t *format; stream_t *stream; Sound_Reset(); // clear old streaminfo Q_strncpy( loadname, filename, sizeof( loadname )); if( Q_stricmp( ext, "" )) { // we needs to compare file extension with list of supported formats // and be sure what is real extension, not a filename with dot for( format = sound.streamformat; format && format->formatstring; format++ ) { if( !Q_stricmp( format->ext, ext )) { FS_StripExtension( loadname ); anyformat = false; break; } } } // now try all the formats in the selected list for( format = sound.streamformat; format && format->formatstring; format++) { if( anyformat || !Q_stricmp( ext, format->ext )) { Q_sprintf( path, format->formatstring, loadname, "", format->ext ); if(( stream = format->openfunc( path )) != NULL ) { stream->format = format; return stream; // done } } } if( !sound.streamformat || sound.streamformat->ext == NULL ) MsgDev( D_NOTE, "FS_OpenStream: soundlib offline\n" ); else MsgDev( D_NOTE, "FS_OpenStream: couldn't open \"%s\"\n", loadname ); return NULL; }
/* =============== Host_WriteOpenGLConfig save opengl variables into opengl.cfg =============== */ void Host_WriteOpenGLConfig( void ) { file_t *f; MsgDev( D_NOTE, "Host_WriteGLConfig()\n" ); f = FS_Open( "opengl.cfg", "w", false ); if( f ) { FS_Printf( f, "//=======================================================================\n" ); FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY )); FS_Printf( f, "//\t\t opengl.cfg - archive of opengl extension cvars\n"); FS_Printf( f, "//=======================================================================\n" ); Cmd_WriteOpenGLVariables( f ); FS_Close( f ); } else MsgDev( D_ERROR, "can't update opengl.cfg.\n" ); }
/* ================= CL_ParseStatusMessage Handle a reply from a info ================= */ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg ) { char *s; s = BF_ReadString( msg ); MsgDev( D_NOTE, "Got info string: %s\n", s ); UI_AddServerToList( from, s ); }
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length ) { int msglen = 0; ASSERT( buffer != NULL ); ASSERT( length != NULL ); *length = 0; // assume we fail FS_Read( cls.demofile, &msglen, sizeof( int )); if( msglen < 0 ) { MsgDev( D_ERROR, "Demo message length < 0\n" ); CL_DemoCompleted(); return false; } if( msglen < 8 ) { MsgDev( D_NOTE, "read runt demo message\n" ); } if( msglen > NET_MAX_PAYLOAD ) { MsgDev( D_ERROR, "Demo message %i > %i\n", msglen, NET_MAX_PAYLOAD ); CL_DemoCompleted(); return false; } if( msglen > 0 ) { if( FS_Read( cls.demofile, buffer, msglen ) != msglen ) { MsgDev( D_ERROR, "Error reading demo message data\n" ); CL_DemoCompleted(); return false; } } *length = msglen; if( cls.state != ca_active ) Cbuf_Execute(); return true; }
/* =============== Host_WriteVideoConfig save render variables into video.cfg =============== */ void Host_WriteVideoConfig( void ) { file_t *f; MsgDev( D_NOTE, "Host_WriteVideoConfig()\n" ); f = FS_Open( "video.cfg", "w", false ); if( f ) { FS_Printf( f, "//=======================================================================\n" ); FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY )); FS_Printf( f, "//\t\tvideo.cfg - archive of renderer variables\n"); FS_Printf( f, "//=======================================================================\n" ); Cmd_WriteRenderVariables( f ); FS_Close( f ); } else MsgDev( D_ERROR, "can't update video.cfg.\n" ); }
/* ================ SV_CheckAllEnts ================ */ void SV_CheckAllEnts( void ) { edict_t *e; int i; if( !sv_check_errors->integer || sv.state != ss_active ) return; // check edicts errors for( i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ ) { e = EDICT_NUM( i ); // DEBUG: check 'gamestate' for using by mods if( e->v.gamestate != 0 ) { MsgDev( D_INFO, "Entity %s[%i] uses gamestate %i\n", SV_ClassName( e ), NUM_FOR_EDICT( e ), e->v.gamestate ); } if( e->free && e->pvPrivateData != NULL ) { MsgDev( D_ERROR, "Freed entity %s (%i) has private data.\n", SV_ClassName( e ), i ); continue; } if( !SV_IsValidEdict( e )) continue; if( !e->v.pContainingEntity || e->v.pContainingEntity != e ) { MsgDev( D_ERROR, "Entity %s (%i) has invalid container, fixed.\n", SV_ClassName( e ), i ); e->v.pContainingEntity = e; continue; } if( !e->pvPrivateData || !Mem_IsAllocatedExt( svgame.mempool, e->pvPrivateData )) { MsgDev( D_ERROR, "Entity %s (%i) trashed private data.\n", SV_ClassName( e ), i ); e->pvPrivateData = NULL; continue; } SV_CheckVelocity( e ); } }
/* ================= GL_CheckExtension ================= */ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cvarname, int r_ext ) { const dllfunc_t *func; convar_t *parm; MsgDev( D_NOTE, "GL_CheckExtension: %s ", name ); if( cvarname ) { // system config disable extensions parm = Cvar_Get( cvarname, "1", CVAR_GLCONFIG, va( "enable or disable %s", name )); if( parm->integer == 0 || ( gl_extensions->integer == 0 && r_ext != GL_OPENGL_110 )) { MsgDev( D_NOTE, "- disabled\n" ); GL_SetExtension( r_ext, 0 ); return; // nothing to process at } GL_SetExtension( r_ext, 1 ); } if(( name[2] == '_' || name[3] == '_' ) && !Q_strstr( glConfig.extensions_string, name )) { GL_SetExtension( r_ext, false ); // update render info MsgDev( D_NOTE, "- ^1failed\n" ); return; } // clear exports for( func = funcs; func && func->name; func++ ) *func->func = NULL; GL_SetExtension( r_ext, true ); // predict extension state for( func = funcs; func && func->name != NULL; func++ ) { // functions are cleared before all the extensions are evaluated if(!(*func->func = (void *)GL_GetProcAddress( func->name ))) GL_SetExtension( r_ext, false ); // one or more functions are invalid, extension will be disabled } if( GL_Support( r_ext )) MsgDev( D_NOTE, "- ^2enabled\n" ); else MsgDev( D_NOTE, "- ^1failed\n" ); }
/* ================= GL_UpdateContext ================= */ qboolean GL_UpdateContext( void ) { if(!( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ) ) ) { MsgDev(D_ERROR, "GL_UpdateContext: %s", SDL_GetError()); return GL_DeleteContext(); } return true; }
/* =============== GL_UpdateSwapInterval =============== */ void GL_UpdateSwapInterval( void ) { if( gl_swapInterval->modified ) { gl_swapInterval->modified = false; if( SDL_GL_SetSwapInterval( gl_swapInterval->integer ) ) MsgDev( D_ERROR, "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) ); } }
/* ==================== CL_StartupDemoHeader spooling demo header in case we record a demo on this level ==================== */ void CL_StartupDemoHeader( void ) { if( cls.demoheader ) { FS_Close( cls.demoheader ); } // Note: this is replacing tmpfile() cls.demoheader = FS_Open( "demoheader.tmp", "w+b", true ); if( !cls.demoheader ) { MsgDev( D_ERROR, "couldn't open temporary header file.\n" ); return; } MsgDev( D_INFO, "Spooling demo header.\n" ); }
/* ================ Sound_FreeSound free WAV buffer ================ */ void FS_FreeSound( wavdata_t *pack ) { if( pack ) { if( pack->buffer ) Mem_Free( pack->buffer ); Mem_Free( pack ); } else MsgDev( D_WARN, "FS_FreeSound: trying to free NULL sound\n" ); }
qboolean Sys_FreeLibrary( dll_info_t *dll ) { // invalid desc or alredy freed if( !dll || !dll->link ) return false; if( host.state == HOST_CRASHED ) { // we need to hold down all modules, while MSVC can find error MsgDev( D_NOTE, "Sys_FreeLibrary: hold %s for debugging\n", dll->name ); return false; } else MsgDev( D_NOTE, "Sys_FreeLibrary: Unloading %s\n", dll->name ); FreeLibrary( dll->link ); dll->link = NULL; return true; }
/* =================== R_SplitEntityOnNode =================== */ static void R_SplitEntityOnNode( mnode_t *node ) { efrag_t *ef; mplane_t *splitplane; mleaf_t *leaf; int sides; if( node->contents == CONTENTS_SOLID ) return; // add an efrag if the node is a leaf if( node->contents < 0 ) { if( !r_pefragtopnode ) r_pefragtopnode = node; leaf = (mleaf_t *)node; // grab an efrag off the free list ef = clgame.free_efrags; if( !ef ) { MsgDev( D_ERROR, "too many efrags!\n" ); return; // no free fragments... } clgame.free_efrags = clgame.free_efrags->entnext; ef->entity = r_addent; // add the entity link *lastlink = ef; lastlink = &ef->entnext; ef->entnext = NULL; // set the leaf links ef->leaf = leaf; ef->leafnext = leaf->efrags; leaf->efrags = ef; return; } // NODE_MIXED splitplane = node->plane; sides = BOX_ON_PLANE_SIDE( r_emins, r_emaxs, splitplane ); if( sides == 3 ) { // split on this plane // if this is the first splitter of this bmodel, remember it if( !r_pefragtopnode ) r_pefragtopnode = node; } // recurse down the contacted sides if( sides & 1 ) R_SplitEntityOnNode( node->children[0] ); if( sides & 2 ) R_SplitEntityOnNode( node->children[1] ); }
int SDLash_EventFilter( SDL_Event* event) { switch ( event->type ) { case SDL_MOUSEMOTION: IN_MouseEvent(0); break; case SDL_QUIT: Host_Shutdown(); break; case SDL_KEYDOWN: case SDL_KEYUP: SDLash_KeyEvent(event->key); break; case SDL_MOUSEWHEEL: SDLash_WheelEvent(event->wheel); break; case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: SDLash_MouseEvent(event->button); break; case SDL_TEXTEDITING: MsgDev(D_INFO, "Caught a text edit: %s %n %n\n", event->edit.text, event->edit.start, event->edit.length); break; case SDL_TEXTINPUT: SDLash_InputEvent(event->text); break; case SDL_WINDOWEVENT: if( host.state == HOST_SHUTDOWN ) break; // no need to activate if( host.state != HOST_RESTART ) { switch( event->window.type ) { case SDL_WINDOWEVENT_MINIMIZED: host.state = HOST_SLEEP; break; case SDL_WINDOWEVENT_FOCUS_LOST: host.state = HOST_NOFOCUS; IN_DeactivateMouse(); break; default: host.state = HOST_FRAME; IN_ActivateMouse(true); } } } VGUI_SurfaceWndProc(event); return 0; }
/* ================ Image_FreeImage free RGBA buffer ================ */ void FS_FreeImage( rgbdata_t *pack ) { if( pack ) { if( pack->buffer ) Mem_Free( pack->buffer ); if( pack->palette ) Mem_Free( pack->palette ); Mem_Free( pack ); } else MsgDev( D_WARN, "FS_FreeImage: trying to free NULL image\n" ); }
/* ====================== CL_PrepSound Call before entering a new level, or after changing dlls ====================== */ void CL_PrepSound( void ) { int i, sndcount, step; MsgDev( D_NOTE, "CL_PrepSound: %s\n", clgame.mapname ); for( i = 0, sndcount = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ ) sndcount++; // total num sounds step = sndcount/10; S_BeginRegistration(); for( i = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ ) { cl.sound_index[i+1] = S_RegisterSound( cl.sound_precache[i+1] ); Cvar_SetFloat( "scr_loading", scr_loading->value + 5.0f / sndcount ); if( step && !( i % step ) && ( cl_allow_levelshots->integer || cl.background )) SCR_UpdateScreen(); } S_EndRegistration(); if( host.soundList ) { // need to reapply all ambient sounds after restarting for( i = 0; i < host.numsounds; i++) { soundlist_t *entry = &host.soundList[i]; if( entry->looping && entry->entnum != -1 ) { MsgDev( D_NOTE, "Restarting sound %s...\n", entry->name ); S_AmbientSound( entry->origin, entry->entnum, S_RegisterSound( entry->name ), entry->volume, entry->attenuation, entry->pitch, 0 ); } } } host.soundList = NULL; host.numsounds = 0; cl.audio_prepped = true; }
/* ================= GL_CreateContext ================= */ qboolean GL_CreateContext( void ) { #ifdef XASH_SDL if( ( glw_state.context = SDL_GL_CreateContext( host.hWnd ) ) == NULL) { MsgDev(D_ERROR, "GL_CreateContext: %s\n", SDL_GetError()); return GL_DeleteContext(); } #endif return true; }
/* ================= Master_Add ================= */ void Master_Add( void ) { netadr_t adr; NET_Config( true ); // allow remote if( !NET_StringToAdr( MASTERSERVER_ADR, &adr )) MsgDev( D_INFO, "Can't resolve adr: %s\n", MASTERSERVER_ADR ); NET_SendPacket( NS_SERVER, 2, "\x4D\xFF", adr ); }
void VGUI_UploadTextureBlock( int id, int drawX, int drawY, const byte *rgba, int blockWidth, int blockHeight ) { if( id <= 0 || id >= VGUI_MAX_TEXTURES || g_textures[id] == 0 || g_textures[id] == cls.fillImage ) { MsgDev( D_ERROR, "VGUI_UploadTextureBlock: bad texture %i. Ignored\n", id ); return; } pglTexSubImage2D( GL_TEXTURE_2D, 0, drawX, drawY, blockWidth, blockHeight, GL_RGBA, GL_UNSIGNED_BYTE, rgba ); g_iBoundTexture = id; }
/* ==================== CL_ProcessFile A file has been received via the fragmentation/reassembly layer, put it in the right spot and see if we have finished downloading files. ==================== */ void CL_ProcessFile( qboolean successfully_received, const char *filename ) { if( successfully_received) MsgDev( D_INFO, "Received %s\n", filename ); else MsgDev( D_WARN, "Failed to download %s\n", filename ); if( cls.downloadfileid == cls.downloadcount - 1 ) { MsgDev( D_INFO, "Download completed, resuming connection\n" ); FS_Rescan(); BF_WriteByte( &cls.netchan.message, clc_stringcmd ); BF_WriteString( &cls.netchan.message, "continueloading" ); cls.downloadfileid = 0; cls.downloadcount = 0; return; } cls.downloadfileid++; }
/* ================== R_Init_OpenGL ================== */ qboolean R_Init_OpenGL( void ) { GL_SetupAttributes(); #ifdef XASH_SDL if( SDL_GL_LoadLibrary( NULL ) ) { MsgDev( D_ERROR, "Couldn't initialize OpenGL: %s\n", SDL_GetError()); return false; } #endif return VID_SetMode(); }