diff --git a/cl_dll/Exports.h b/cl_dll/Exports.h new file mode 100644 index 0000000..29afe55 --- /dev/null +++ b/cl_dll/Exports.h @@ -0,0 +1,117 @@ +// CL_DLLEXPORT is the client version of dllexport. It's turned off for secure clients. +#ifdef _WIN32 +#define CL_DLLEXPORT __declspec(dllexport) +#else +#define CL_DLLEXPORT __attribute__ ((visibility("default"))) +#endif + +extern "C" +{ + // From hl_weapons + void CL_DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed ); + + // From cdll_int + int CL_DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ); + int CL_DLLEXPORT HUD_VidInit( void ); + void CL_DLLEXPORT HUD_Init( void ); + int CL_DLLEXPORT HUD_Redraw( float flTime, int intermission ); + int CL_DLLEXPORT HUD_UpdateClientData( client_data_t *cdata, float flTime ); + void CL_DLLEXPORT HUD_Reset ( void ); + void CL_DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server ); + void CL_DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove ); + char CL_DLLEXPORT HUD_PlayerMoveTexture( char *name ); + int CL_DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); + int CL_DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs ); + void CL_DLLEXPORT HUD_Frame( double time ); + void CL_DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking); + void CL_DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf ); + void CL_DLLEXPORT HUD_ChatInputPosition( int *x, int *y ); + + // From demo + void CL_DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer ); + + // From entity + int CL_DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname ); + void CL_DLLEXPORT HUD_CreateEntities( void ); + void CL_DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity ); + void CL_DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client ); + void CL_DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src ); + void CL_DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd ); + void CL_DLLEXPORT HUD_TempEntUpdate( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( struct cl_entity_s *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) ); + struct cl_entity_s CL_DLLEXPORT *HUD_GetUserEntity( int index ); + + // From in_camera + void CL_DLLEXPORT CAM_Think( void ); + int CL_DLLEXPORT CL_IsThirdPerson( void ); + void CL_DLLEXPORT CL_CameraOffset( float *ofs ); + + // From input + struct kbutton_s CL_DLLEXPORT *KB_Find( const char *name ); + void CL_DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int active ); + void CL_DLLEXPORT HUD_Shutdown( void ); + int CL_DLLEXPORT HUD_Key_Event( int eventcode, int keynum, const char *pszCurrentBinding ); + + // From inputw32 + void CL_DLLEXPORT IN_ActivateMouse( void ); + void CL_DLLEXPORT IN_DeactivateMouse( void ); + void CL_DLLEXPORT IN_MouseEvent (int mstate); + void CL_DLLEXPORT IN_Accumulate (void); + void CL_DLLEXPORT IN_ClearStates (void); + + // From tri + void CL_DLLEXPORT HUD_DrawNormalTriangles( void ); + void CL_DLLEXPORT HUD_DrawTransparentTriangles( void ); + + // From view + void CL_DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams ); + + // From GameStudioModelRenderer + int CL_DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio ); +} + +/* +extern cldll_func_dst_t *g_pcldstAddrs; + +// Macros for the client receiving calls from the engine +#define RecClInitialize(a, b) (g_pcldstAddrs->pInitFunc(&a, &b)) +#define RecClHudInit() (g_pcldstAddrs->pHudInitFunc()) +#define RecClHudVidInit() (g_pcldstAddrs->pHudVidInitFunc()) +#define RecClHudRedraw(a, b) (g_pcldstAddrs->pHudRedrawFunc(&a, &b)) +#define RecClHudUpdateClientData(a, b) (g_pcldstAddrs->pHudUpdateClientDataFunc(&a, &b)) +#define RecClHudReset() (g_pcldstAddrs->pHudResetFunc()) +#define RecClClientMove(a, b) (g_pcldstAddrs->pClientMove(&a, &b)) +#define RecClClientMoveInit(a) (g_pcldstAddrs->pClientMoveInit(&a)) +#define RecClClientTextureType(a) (g_pcldstAddrs->pClientTextureType(&a)) +#define RecClIN_ActivateMouse() (g_pcldstAddrs->pIN_ActivateMouse()) +#define RecClIN_DeactivateMouse() (g_pcldstAddrs->pIN_DeactivateMouse()) +#define RecClIN_MouseEvent(a) (g_pcldstAddrs->pIN_MouseEvent(&a)) +#define RecClIN_ClearStates() (g_pcldstAddrs->pIN_ClearStates()) +#define RecClIN_Accumulate() (g_pcldstAddrs->pIN_Accumulate()) +#define RecClCL_CreateMove(a, b, c) (g_pcldstAddrs->pCL_CreateMove(&a, &b, &c)) +#define RecClCL_IsThirdPerson() (g_pcldstAddrs->pCL_IsThirdPerson()) +#define RecClCL_GetCameraOffsets(a) (g_pcldstAddrs->pCL_GetCameraOffsets(&a)) +#define RecClFindKey(a) (g_pcldstAddrs->pFindKey(&a)) +#define RecClCamThink() (g_pcldstAddrs->pCamThink()) +#define RecClCalcRefdef(a) (g_pcldstAddrs->pCalcRefdef(&a)) +#define RecClAddEntity(a, b, c) (g_pcldstAddrs->pAddEntity(&a, &b, &c)) +#define RecClCreateEntities() (g_pcldstAddrs->pCreateEntities()) +#define RecClDrawNormalTriangles() (g_pcldstAddrs->pDrawNormalTriangles()) +#define RecClDrawTransparentTriangles() (g_pcldstAddrs->pDrawTransparentTriangles()) +#define RecClStudioEvent(a, b) (g_pcldstAddrs->pStudioEvent(&a, &b)) +#define RecClPostRunCmd(a, b, c, d, e, f) (g_pcldstAddrs->pPostRunCmd(&a, &b, &c, &d, &e, &f)) +#define RecClShutdown() (g_pcldstAddrs->pShutdown()) +#define RecClTxferLocalOverrides(a, b) (g_pcldstAddrs->pTxferLocalOverrides(&a, &b)) +#define RecClProcessPlayerState(a, b) (g_pcldstAddrs->pProcessPlayerState(&a, &b)) +#define RecClTxferPredictionData(a, b, c, d, e, f) (g_pcldstAddrs->pTxferPredictionData(&a, &b, &c, &d, &e, &f)) +#define RecClReadDemoBuffer(a, b) (g_pcldstAddrs->pReadDemoBuffer(&a, &b)) +#define RecClConnectionlessPacket(a, b, c, d) (g_pcldstAddrs->pConnectionlessPacket(&a, &b, &c, &d)) +#define RecClGetHullBounds(a, b, c) (g_pcldstAddrs->pGetHullBounds(&a, &b, &c)) +#define RecClHudFrame(a) (g_pcldstAddrs->pHudFrame(&a)) +#define RecClKeyEvent(a, b, c) (g_pcldstAddrs->pKeyEvent(&a, &b, &c)) +#define RecClTempEntUpdate(a, b, c, d, e, f, g) (g_pcldstAddrs->pTempEntUpdate(&a, &b, &c, &d, &e, &f, &g)) +#define RecClGetUserEntity(a) (g_pcldstAddrs->pGetUserEntity(&a)) +#define RecClVoiceStatus(a, b) (g_pcldstAddrs->pVoiceStatus(&a, &b)) +#define RecClDirectorMessage(a, b) (g_pcldstAddrs->pDirectorMessage(&a, &b)) +#define RecClStudioInterface(a, b, c) (g_pcldstAddrs->pStudioInterface(&a, &b, &c)) +#define RecClChatInputPosition(a, b) (g_pcldstAddrs->pChatInputPosition(&a, &b)) +*/ \ No newline at end of file diff --git a/cl_dll/GameStudioModelRenderer.cpp b/cl_dll/GameStudioModelRenderer.cpp index 56e6823..f1d6ed3 100644 --- a/cl_dll/GameStudioModelRenderer.cpp +++ b/cl_dll/GameStudioModelRenderer.cpp @@ -26,6 +26,7 @@ #include "StudioModelRenderer.h" #include "GameStudioModelRenderer.h" +#include "Exports.h" // // Override the StudioModelRender virtual member functions here to implement custom bone @@ -99,9 +100,10 @@ HUD_GetStudioModelInterface Export this function for the engine to use the studio renderer class to render objects. ==================== */ -#define DLLEXPORT __declspec( dllexport ) -extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio ) +int CL_DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio ) { +// RecClStudioInterface(version, ppinterface, pstudio); + if ( version != STUDIO_INTERFACE_VERSION ) return 0; diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp new file mode 100644 index 0000000..bcbc5ad --- /dev/null +++ b/cl_dll/MOTD.cpp @@ -0,0 +1,155 @@ +/*** +* +* Copyright (c) 1999, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// +// MOTD.cpp +// +// for displaying a server-sent message of the day +// + +#include "hud.h" +#include "cl_util.h" +#include "parsemsg.h" + +#include +#include + +//DECLARE_MESSAGE( m_MOTD, MOTD ); + +int CHudMOTD::MOTD_DISPLAY_TIME; + +int CHudMOTD :: Init( void ) +{ + gHUD.AddHudElem( this ); + + // HOOK_MESSAGE( MOTD ); + + CVAR_CREATE( "motd_display_time", "15", 0 ); + + m_iFlags &= ~HUD_ACTIVE; // start out inactive + m_szMOTD[0] = 0; + + return 1; +} + +int CHudMOTD :: VidInit( void ) +{ + // Load sprites here + + return 1; +} + +void CHudMOTD :: Reset( void ) +{ + m_iFlags &= ~HUD_ACTIVE; // start out inactive + m_szMOTD[0] = 0; + m_iLines = 0; + m_flActiveRemaining = 0; +} + +#define LINE_HEIGHT 13 + +int CHudMOTD :: Draw( float fTime ) +{ + static float sfLastTime; + float fElapsed; + + // Draw MOTD line-by-line + if ( m_flActiveRemaining <= 0.0 ) + { + // finished with MOTD, disable it + m_szMOTD[0] = 0; + m_iLines = 0; + m_iFlags &= ~HUD_ACTIVE; + m_flActiveRemaining = 0.0; + return 1; + } + + fElapsed = gHUD.m_flTime - sfLastTime; + + // Don't let time go negative ( level transition? ) + fElapsed = max( 0.0, fElapsed ); + // Don't let time go hugely positive ( first connection to active server ? ) + fElapsed = min( 1.0, fElapsed ); + + // Remember last timestamp + sfLastTime = gHUD.m_flTime; + + // Remove a bit of time + m_flActiveRemaining -= fElapsed; + + // find the top of where the MOTD should be drawn, so the whole thing is centered in the screen + int ypos = max(((ScreenHeight - (m_iLines * LINE_HEIGHT)) / 2) - 40, 30 ); // shift it up slightly + char *ch = m_szMOTD; + while ( *ch ) + { + int line_length = 0; // count the length of the current line + for ( char *next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ ) + line_length += gHUD.m_scrinfo.charWidths[ *next_line ]; + char *top = next_line; + if ( *top == '\n' ) + *top = 0; + else + top = NULL; + + // find where to start drawing the line + int xpos = (ScreenWidth - line_length) / 2; + + gHUD.DrawHudString( xpos, ypos, ScreenWidth, ch, 255, 180, 0 ); + + ypos += LINE_HEIGHT; + + if ( top ) // restore + *top = '\n'; + ch = next_line; + if ( *ch == '\n' ) + ch++; + + if ( ypos > (ScreenHeight - 20) ) + break; // don't let it draw too low + } + + return 1; +} + +int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ) +{ + if ( m_iFlags & HUD_ACTIVE ) + { + Reset(); // clear the current MOTD in prep for this one + } + + BEGIN_READ( pbuf, iSize ); + + int is_finished = READ_BYTE(); + strcat( m_szMOTD, READ_STRING() ); + + if ( is_finished ) + { + m_iFlags |= HUD_ACTIVE; + + MOTD_DISPLAY_TIME = max( 10, CVAR_GET_FLOAT( "motd_display_time" ) ); + + m_flActiveRemaining = MOTD_DISPLAY_TIME; + + for ( char *sz = m_szMOTD; *sz != 0; sz++ ) // count the number of lines in the MOTD + { + if ( *sz == '\n' ) + m_iLines++; + } + } + + return 1; +} + diff --git a/cl_dll/StudioModelRenderer.cpp b/cl_dll/StudioModelRenderer.cpp index e051fa9..ed5d87a 100644 --- a/cl_dll/StudioModelRenderer.cpp +++ b/cl_dll/StudioModelRenderer.cpp @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - // studio_model.cpp // routines for setting up to draw 3DStudio models @@ -29,6 +22,18 @@ #include "StudioModelRenderer.h" #include "GameStudioModelRenderer.h" +extern cvar_t *tfc_newmodels; + +extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; + +// team colors for old TFC models +#define TEAM1_COLOR 150 +#define TEAM2_COLOR 250 +#define TEAM3_COLOR 45 +#define TEAM4_COLOR 100 + +int m_nPlayerGaitSequences[MAX_CLIENTS]; + // Global engine <-> studio model rendering code interface engine_studio_api_t IEngineStudio; @@ -363,7 +368,7 @@ mstudioanim_t *CStudioModelRenderer::StudioGetAnim( model_t *m_pSubModel, mstudi if (pseqdesc->seqgroup == 0) { - return (mstudioanim_t *)((byte *)m_pStudioHeader + pseqgroup->data + pseqdesc->animindex); + return (mstudioanim_t *)((byte *)m_pStudioHeader + pseqdesc->animindex); } paSequences = (cache_user_t *)m_pSubModel->submodels; @@ -793,6 +798,22 @@ void CStudioModelRenderer::StudioSetupBones ( void ) pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence; + // always want new gait sequences to start on frame zero +/* if ( m_pPlayerInfo ) + { + int playerNum = m_pCurrentEntity->index - 1; + + // new jump gaitsequence? start from frame zero + if ( m_nPlayerGaitSequences[ playerNum ] != m_pPlayerInfo->gaitsequence ) + { + // m_pPlayerInfo->gaitframe = 0.0; + gEngfuncs.Con_Printf( "Setting gaitframe to 0\n" ); + } + + m_nPlayerGaitSequences[ playerNum ] = m_pPlayerInfo->gaitsequence; +// gEngfuncs.Con_Printf( "index: %d gaitsequence: %d\n",playerNum, m_pPlayerInfo->gaitsequence); + } +*/ f = StudioEstimateFrame( pseqdesc ); if (m_pCurrentEntity->latched.prevframe > f) @@ -842,6 +863,11 @@ void CStudioModelRenderer::StudioSetupBones ( void ) static vec4_t q1b[MAXSTUDIOBONES]; float s; + if (m_pCurrentEntity->latched.prevsequence >= m_pStudioHeader->numseq) + { + m_pCurrentEntity->latched.prevsequence = 0; + } + pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->latched.prevsequence; panim = StudioGetAnim( m_pRenderModel, pseqdesc ); // clip prevframe @@ -882,29 +908,49 @@ void CStudioModelRenderer::StudioSetupBones ( void ) pbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex); - // calc gait animation - if (m_pPlayerInfo && m_pPlayerInfo->gaitsequence != 0) + // bounds checking + if ( m_pPlayerInfo ) { - if (m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq) + if ( m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq ) + { + m_pPlayerInfo->gaitsequence = 0; + } + } + + // calc gait animation + if ( m_pPlayerInfo && m_pPlayerInfo->gaitsequence != 0 ) + { + if (m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq) { m_pPlayerInfo->gaitsequence = 0; } - pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pPlayerInfo->gaitsequence; + int copy = 1; + + pseqdesc = (mstudioseqdesc_t *)( (byte *)m_pStudioHeader + m_pStudioHeader->seqindex ) + m_pPlayerInfo->gaitsequence; panim = StudioGetAnim( m_pRenderModel, pseqdesc ); StudioCalcRotations( pos2, q2, pseqdesc, panim, m_pPlayerInfo->gaitframe ); - for (i = 0; i < m_pStudioHeader->numbones; i++) + for ( i = 0; i < m_pStudioHeader->numbones; i++ ) { - if (strcmp( pbones[i].name, "Bip01 Spine") == 0) - break; - memcpy( pos[i], pos2[i], sizeof( pos[i] )); - memcpy( q[i], q2[i], sizeof( q[i] )); + if ( !strcmp( pbones[i].name, "Bip01 Spine" ) ) + { + copy = 0; + } + else if ( !strcmp( pbones[ pbones[i].parent ].name, "Bip01 Pelvis" ) ) + { + copy = 1; + } + + if ( copy ) + { + memcpy( pos[i], pos2[i], sizeof( pos[i] ) ); + memcpy( q[i], q2[i], sizeof( q[i] ) ); + } } } - for (i = 0; i < m_pStudioHeader->numbones; i++) { QuaternionMatrix( q[i], bonematrix ); @@ -1052,6 +1098,52 @@ void CStudioModelRenderer::StudioMergeBones ( model_t *m_pSubModel ) } } +#if defined( _TFC ) +#include "pm_shared.h" +const Vector& GetTeamColor( int team_no ); +#define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || (g_iUser1 && (gHUD.m_Spectator.m_pip->value == INSET_IN_EYE)) ) + +int GetRemapColor( int iTeam, bool bTopColor ) +{ + int retVal = 0; + + switch( iTeam ) + { + default: + case 1: + if ( bTopColor ) + retVal = TEAM1_COLOR; + else + retVal = TEAM1_COLOR - 10; + + break; + case 2: + if ( bTopColor ) + retVal = TEAM2_COLOR; + else + retVal = TEAM2_COLOR - 10; + + break; + case 3: + if ( bTopColor ) + retVal = TEAM3_COLOR; + else + retVal = TEAM3_COLOR - 10; + + break; + case 4: + if ( bTopColor ) + retVal = TEAM4_COLOR; + else + retVal = TEAM4_COLOR - 10; + + break; + } + + return retVal; +} +#endif + /* ==================== StudioDrawModel @@ -1154,9 +1246,86 @@ int CStudioModelRenderer::StudioDrawModel( int flags ) IEngineStudio.StudioSetupLighting (&lighting); // get remap colors - m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF; +#if defined( _TFC ) + + m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF; m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8; + // use the old tfc colors for the models (view models) + // team 1 + if ( ( m_nTopColor < 155 ) && ( m_nTopColor > 135 ) ) + { + m_nTopColor = TEAM1_COLOR; + m_nBottomColor = TEAM1_COLOR - 10; + } + // team 2 + else if ( ( m_nTopColor < 260 ) && ( ( m_nTopColor > 240 ) || ( m_nTopColor == 5 ) ) ) + { + m_nTopColor = TEAM2_COLOR; + m_nBottomColor = TEAM2_COLOR - 10; + } + // team 3 + else if ( ( m_nTopColor < 50 ) && ( m_nTopColor > 40 ) ) + { + m_nTopColor = TEAM3_COLOR; + m_nBottomColor = TEAM3_COLOR - 10; + } + // team 4 + else if ( ( m_nTopColor < 110 ) && ( m_nTopColor > 75 ) ) + { + m_nTopColor = TEAM4_COLOR; + m_nBottomColor = TEAM4_COLOR - 10; + } + + // is this our view model and should it be glowing? we also fix a remap colors + // problem if we're spectating in first-person mode + if ( m_pCurrentEntity == gEngfuncs.GetViewModel() ) + { + cl_entity_t *pTarget = NULL; + + // we're spectating someone via first-person mode + if ( IS_FIRSTPERSON_SPEC ) + { + pTarget = gEngfuncs.GetEntityByIndex( g_iUser2 ); + + if ( pTarget ) + { + // we also need to correct the m_nTopColor and m_nBottomColor for the + // view model here. this is separate from the glowshell stuff, but + // the same conditions need to be met (this is the view model and we're + // in first-person spectator mode) + m_nTopColor = GetRemapColor( g_PlayerExtraInfo[pTarget->index].teamnumber, true ); + m_nBottomColor = GetRemapColor( g_PlayerExtraInfo[pTarget->index].teamnumber, false ); + } + } + // we're not spectating, this is OUR view model + else + { + pTarget = gEngfuncs.GetLocalPlayer(); + } + + if ( pTarget && pTarget->curstate.renderfx == kRenderFxGlowShell ) + { + m_pCurrentEntity->curstate.renderfx = kRenderFxGlowShell; + m_pCurrentEntity->curstate.rendercolor.r = pTarget->curstate.rendercolor.r; + m_pCurrentEntity->curstate.rendercolor.g = pTarget->curstate.rendercolor.g; + m_pCurrentEntity->curstate.rendercolor.b = pTarget->curstate.rendercolor.b; + } + else + { + m_pCurrentEntity->curstate.renderfx = kRenderFxNone; + m_pCurrentEntity->curstate.rendercolor.r = 0; + m_pCurrentEntity->curstate.rendercolor.g = 0; + m_pCurrentEntity->curstate.rendercolor.b = 0; + } + } + +#else + m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF; + m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8; + +#endif + IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor ); StudioRenderModel( ); @@ -1312,7 +1481,7 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer ) m_pCurrentEntity->angles[YAW] += 360; m_pCurrentEntity->latched.prevangles[YAW] = m_pCurrentEntity->angles[YAW]; - if (pplayer->gaitsequence >= m_pStudioHeader->numseq) + if (pplayer->gaitsequence >= m_pStudioHeader->numseq) { pplayer->gaitsequence = 0; } @@ -1335,6 +1504,149 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer ) m_pPlayerInfo->gaitframe += pseqdesc->numframes; } +#if defined _TFC + +#define PC_UNDEFINED 0 + +#define PC_SCOUT 1 +#define PC_SNIPER 2 +#define PC_SOLDIER 3 +#define PC_DEMOMAN 4 +#define PC_MEDIC 5 +#define PC_HVYWEAP 6 +#define PC_PYRO 7 +#define PC_SPY 8 +#define PC_ENGINEER 9 +#define PC_RANDOM 10 +#define PC_CIVILIAN 11 + +#define PC_LASTCLASS 12 + +#define TFC_MODELS_OLD 0 + +extern cvar_t *tfc_newmodels; + +char *sNewClassModelFiles[] = +{ + NULL, + "models/player/scout/scout.mdl", + "models/player/sniper/sniper.mdl", + "models/player/soldier/soldier.mdl", + "models/player/demo/demo.mdl", + "models/player/medic/medic.mdl", + "models/player/hvyweapon/hvyweapon.mdl", + "models/player/pyro/pyro.mdl", + "models/player/spy/spy.mdl", + "models/player/engineer/engineer.mdl", + "models/player/scout/scout.mdl", // PC_RANDOM + "models/player/civilian/civilian.mdl", +}; + +char *sOldClassModelFiles[] = +{ + NULL, + "models/player/scout/scout2.mdl", + "models/player/sniper/sniper2.mdl", + "models/player/soldier/soldier2.mdl", + "models/player/demo/demo2.mdl", + "models/player/medic/medic2.mdl", + "models/player/hvyweapon/hvyweapon2.mdl", + "models/player/pyro/pyro2.mdl", + "models/player/spy/spy2.mdl", + "models/player/engineer/engineer2.mdl", + "models/player/scout/scout2.mdl", // PC_RANDOM + "models/player/civilian/civilian.mdl", +}; + +#define NUM_WEAPON_PMODELS 18 + +char *sNewWeaponPModels[] = +{ + "models/p_9mmhandgun.mdl", + "models/p_crowbar.mdl", + "models/p_egon.mdl", + "models/p_glauncher.mdl", + "models/p_grenade.mdl", + "models/p_knife.mdl", + "models/p_medkit.mdl", + "models/p_mini.mdl", + "models/p_nailgun.mdl", + "models/p_srpg.mdl", + "models/p_shotgun.mdl", + "models/p_snailgun.mdl", + "models/p_sniper.mdl", + "models/p_spanner.mdl", + "models/p_umbrella.mdl", + "models/p_rpg.mdl", + "models/p_spygun.mdl", + "models/p_smallshotgun.mdl" +}; + +char *sOldWeaponPModels[] = +{ + "models/p_9mmhandgun2.mdl", + "models/p_crowbar2.mdl", + "models/p_egon2.mdl", + "models/p_glauncher2.mdl", + "models/p_grenade2.mdl", + "models/p_knife2.mdl", + "models/p_medkit2.mdl", + "models/p_mini2.mdl", + "models/p_nailgun2.mdl", + "models/p_rpg2.mdl", + "models/p_shotgun2.mdl", + "models/p_snailgun2.mdl", + "models/p_sniper2.mdl", + "models/p_spanner2.mdl", + "models/p_umbrella.mdl", + "models/p_rpg2.mdl", + "models/p_9mmhandgun2.mdl", + "models/p_shotgun2.mdl" +}; + + +int CStudioModelRenderer :: ReturnDiguisedClass ( int iPlayerIndex ) +{ + m_pRenderModel = IEngineStudio.SetupPlayerModel( iPlayerIndex ); + + if ( !m_pRenderModel ) + return PC_SCOUT; + + for ( int i = PC_SCOUT ; i < PC_LASTCLASS ; i++ ) + { + if ( !strcmp ( m_pRenderModel->name, sNewClassModelFiles[ i ] ) ) + return i; + } + + return PC_SCOUT; +} + +char * ReturnCorrectedModelString ( int iSwitchClass ) +{ + if ( tfc_newmodels->value == TFC_MODELS_OLD ) + { + if ( sOldClassModelFiles[ iSwitchClass ] ) + return sOldClassModelFiles[ iSwitchClass ]; + else + return sOldClassModelFiles[ PC_SCOUT ]; + } + else + { + if ( sNewClassModelFiles[ iSwitchClass ] ) + return sNewClassModelFiles[ iSwitchClass ]; + else + return sNewClassModelFiles[ PC_SCOUT ]; + } +} + +#endif + +#ifdef _TFC +float g_flSpinUpTime[ 33 ]; +float g_flSpinDownTime[ 33 ]; +#endif + + /* ==================== StudioDrawPlayer @@ -1351,18 +1663,36 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer ) IEngineStudio.GetViewInfo( m_vRenderOrigin, m_vUp, m_vRight, m_vNormal ); IEngineStudio.GetAliasScale( &m_fSoftwareXScale, &m_fSoftwareYScale ); - // Con_DPrintf("DrawPlayer %d\n", m_pCurrentEntity->blending[0] ); - - // Con_DPrintf("DrawPlayer %d %d (%d)\n", m_nFrameCount, pplayer->player_index, m_pCurrentEntity->curstate.sequence ); - - // Con_DPrintf("Player %.2f %.2f %.2f\n", pplayer->velocity[0], pplayer->velocity[1], pplayer->velocity[2] ); - m_nPlayerIndex = pplayer->number - 1; if (m_nPlayerIndex < 0 || m_nPlayerIndex >= gEngfuncs.GetMaxClients()) return 0; +#if defined( _TFC ) + + int modelindex; + int iSwitchClass = pplayer->playerclass; + + if ( iSwitchClass == PC_SPY ) + iSwitchClass = ReturnDiguisedClass( m_nPlayerIndex ); + + // do we have a "replacement_model" for this player? + if ( pplayer->fuser1 ) + { + m_pRenderModel = IEngineStudio.SetupPlayerModel( m_nPlayerIndex ); + } + else + { + // get the model pointer using a "corrected" model string based on tfc_newmodels + m_pRenderModel = gEngfuncs.CL_LoadModel( ReturnCorrectedModelString( iSwitchClass ), &modelindex ); + } + +#else + m_pRenderModel = IEngineStudio.SetupPlayerModel( m_nPlayerIndex ); + +#endif + if (m_pRenderModel == NULL) return 0; @@ -1458,9 +1788,48 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer ) m_pPlayerInfo = IEngineStudio.PlayerInfo( m_nPlayerIndex ); - // get remap colors - m_nTopColor = m_pPlayerInfo->topcolor; +#if defined _TFC + + m_nTopColor = m_pPlayerInfo->topcolor; m_nBottomColor = m_pPlayerInfo->bottomcolor; + + // get old remap colors + if ( tfc_newmodels->value == TFC_MODELS_OLD ) + { + // team 1 + if ( ( m_nTopColor < 155 ) && ( m_nTopColor > 135 ) ) + { + m_nTopColor = TEAM1_COLOR; + m_nBottomColor = TEAM1_COLOR - 10; + } + // team 2 + else if ( ( m_nTopColor < 260 ) && ( ( m_nTopColor > 240 ) || ( m_nTopColor == 5 ) ) ) + { + m_nTopColor = TEAM2_COLOR; + m_nBottomColor = TEAM2_COLOR - 10; + } + // team 3 + else if ( ( m_nTopColor < 50 ) && ( m_nTopColor > 40 ) ) + { + m_nTopColor = TEAM3_COLOR; + m_nBottomColor = TEAM3_COLOR - 10; + } + // team 4 + else if ( ( m_nTopColor < 110 ) && ( m_nTopColor > 75 ) ) + { + m_nTopColor = TEAM4_COLOR; + m_nBottomColor = TEAM4_COLOR - 10; + } + } + +#else + // get remap colors + m_nTopColor = m_pPlayerInfo->topcolor; + m_nBottomColor = m_pPlayerInfo->bottomcolor; + +#endif + + // bounds check if (m_nTopColor < 0) m_nTopColor = 0; if (m_nTopColor > 360) @@ -1481,10 +1850,77 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer ) model_t *pweaponmodel = IEngineStudio.GetModelByIndex( pplayer->weaponmodel ); +#if defined _TFC + if ( pweaponmodel ) + { + // if we want to see the old p_models + if ( tfc_newmodels->value == TFC_MODELS_OLD ) + { + for ( int i = 0 ; i < NUM_WEAPON_PMODELS ; ++i ) + { + if ( !stricmp( pweaponmodel->name, sNewWeaponPModels[i] ) ) + { + gEngfuncs.CL_LoadModel( sOldWeaponPModels[i] , &modelindex ); + pweaponmodel = IEngineStudio.GetModelByIndex( modelindex ); + break; + } + } + } + } +#endif m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata (pweaponmodel); IEngineStudio.StudioSetHeader( m_pStudioHeader ); - StudioMergeBones( pweaponmodel); +#ifdef _TFC + //Do spinning stuff for the HWGuy minigun + if ( strstr ( m_pStudioHeader->name, "p_mini.mdl" ) ) + { + if ( g_flSpinUpTime[ m_nPlayerIndex ] && g_flSpinUpTime[ m_nPlayerIndex ] > gEngfuncs.GetClientTime() ) + { + float flmod = ( g_flSpinUpTime[ m_nPlayerIndex ] - ( gEngfuncs.GetClientTime() + 3.5 ) ); + flmod *= -30; + + m_pCurrentEntity->curstate.frame = flmod; + m_pCurrentEntity->curstate.sequence = 2; + } + + else if ( g_flSpinUpTime[ m_nPlayerIndex ] && g_flSpinUpTime[ m_nPlayerIndex ] <= gEngfuncs.GetClientTime() ) + g_flSpinUpTime[ m_nPlayerIndex ] = 0.0; + + else if ( g_flSpinDownTime[ m_nPlayerIndex ] && g_flSpinDownTime[ m_nPlayerIndex ] > gEngfuncs.GetClientTime() && !g_flSpinUpTime[ m_nPlayerIndex ] ) + { + float flmod = ( g_flSpinDownTime[ m_nPlayerIndex ] - ( gEngfuncs.GetClientTime() + 3.5 ) ); + flmod *= -30; + + m_pCurrentEntity->curstate.frame = flmod; + m_pCurrentEntity->curstate.sequence = 3; + } + + else if ( g_flSpinDownTime[ m_nPlayerIndex ] && g_flSpinDownTime[ m_nPlayerIndex ] <= gEngfuncs.GetClientTime() && !g_flSpinUpTime[ m_nPlayerIndex ] ) + g_flSpinDownTime[ m_nPlayerIndex ] = 0.0; + + if ( m_pCurrentEntity->curstate.sequence == 70 || m_pCurrentEntity->curstate.sequence == 72 ) + { + if ( g_flSpinUpTime[ m_nPlayerIndex ] ) + g_flSpinUpTime[ m_nPlayerIndex ] = 0.0; + + m_pCurrentEntity->curstate.sequence = 1; + } + + StudioSetupBones( ); + } + else + { + if ( g_flSpinUpTime[ m_nPlayerIndex ] || g_flSpinDownTime[ m_nPlayerIndex ] ) + { + g_flSpinUpTime[ m_nPlayerIndex ] = 0.0; + g_flSpinDownTime[ m_nPlayerIndex ] = 0.0; + } + } + +#endif + + StudioMergeBones( pweaponmodel ); IEngineStudio.StudioSetupLighting (&lighting); @@ -1675,3 +2111,4 @@ void CStudioModelRenderer::StudioRenderFinal(void) } } + diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index 5084e08..1338b9e 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -308,9 +308,6 @@ void CHudAmmo::Reset(void) gWR.Reset(); gHR.Reset(); - - // VidInit(); - } int CHudAmmo::VidInit(void) @@ -674,7 +671,6 @@ int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf ) // Slot button pressed void CHudAmmo::SlotInput( int iSlot ) { - // Let the Viewport use it first, for menus if ( gViewPort && gViewPort->SlotInput( iSlot ) ) return; @@ -740,7 +736,7 @@ void CHudAmmo::UserCmd_Close(void) PlaySound("common/wpn_hudoff.wav", 1); } else - ClientCmd("escape"); + EngineClientCmd("escape"); } diff --git a/cl_dll/battery.cpp b/cl_dll/battery.cpp index 0ec4554..04b1c42 100644 --- a/cl_dll/battery.cpp +++ b/cl_dll/battery.cpp @@ -57,16 +57,26 @@ int CHudBattery::VidInit(void) int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf ) { m_iFlags |= HUD_ACTIVE; - BEGIN_READ( pbuf, iSize ); int x = READ_SHORT(); - if (x != m_iBat) +#if defined( _TFC ) + int y = READ_SHORT(); + + if ( x != m_iBat || y != m_iBatMax ) + { + m_fFade = FADE_TIME; + m_iBat = x; + m_iBatMax = y; + } +#else + if ( x != m_iBat ) { m_fFade = FADE_TIME; m_iBat = x; } +#endif return 1; } @@ -81,7 +91,17 @@ int CHudBattery::Draw(float flTime) wrect_t rc; rc = *m_prc2; + +#if defined( _TFC ) + float fScale = 0.0; + + if ( m_iBatMax > 0 ) + fScale = 1.0 / (float)m_iBatMax; + + rc.top += m_iHeight * ((float)(m_iBatMax-(min(m_iBatMax,m_iBat))) * fScale); // battery can go from 0 to m_iBatMax so * fScale goes from 0 to 1 +#else rc.top += m_iHeight * ((float)(100-(min(100,m_iBat))) * 0.01); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1 +#endif UnpackRGB(r,g,b, RGB_YELLOWISH); diff --git a/cl_dll/bench.h b/cl_dll/bench.h new file mode 100644 index 0000000..31e4e97 --- /dev/null +++ b/cl_dll/bench.h @@ -0,0 +1,26 @@ +#if !defined ( BENCHH ) +#define BENCHH +#pragma once + +#define FIRST_STAGE 1 +#define SECOND_STAGE 2 +#define THIRD_STAGE 3 +#define FOURTH_STAGE 4 +#define LAST_STAGE ( FOURTH_STAGE ) + +void Bench_CheckStart( void ); + +int Bench_InStage( int stage ); +int Bench_GetPowerPlay( void ); +int Bench_GetStage( void ); +void Bench_SetPowerPlay( int set ); +int Bench_Active( void ); + +void Bench_SetDotAdded( int dot ); +void Bench_SpotPosition( vec3_t dot, vec3_t target ); +void Bench_CheckEntity( int type, struct cl_entity_s *ent, const char *modelname ); +void Bench_AddObjects( void ); +void Bench_SetViewAngles( int recalc_wander, float *viewangles, float frametime, struct usercmd_s *cmd ); +void Bench_SetViewOrigin( float *vieworigin, float frametime ); + +#endif \ No newline at end of file diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index ee2a20f..4fd8380 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -21,7 +21,9 @@ #include "hud.h" #include "cl_util.h" #include "netadr.h" -#include "vgui_schememanager.h" +#undef INTERFACE_H +#include "../public/interface.h" +//#include "vgui_schememanager.h" extern "C" { @@ -33,42 +35,33 @@ extern "C" #include "vgui_int.h" #include "interface.h" -#define DLLEXPORT __declspec( dllexport ) - +#ifdef _WIN32 +#include "winsani_in.h" +#include +#include "winsani_out.h" +#endif +#include "Exports.h" +# +#include "tri.h" +#include "vgui_TeamFortressViewport.h" +#include "../public/interface.h" cl_enginefunc_t gEngfuncs; CHud gHUD; TeamFortressViewport *gViewPort = NULL; + +#include "particleman.h" +CSysModule *g_hParticleManModule = NULL; +IParticleMan *g_pParticleMan = NULL; + +void CL_LoadParticleMan( void ); +void CL_UnloadParticleMan( void ); + void InitInput (void); void EV_HookEvents( void ); void IN_Commands( void ); -/* -========================== - Initialize - -Called when the DLL is first loaded. -========================== -*/ -extern "C" -{ -int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ); -int DLLEXPORT HUD_VidInit( void ); -void DLLEXPORT HUD_Init( void ); -int DLLEXPORT HUD_Redraw( float flTime, int intermission ); -int DLLEXPORT HUD_UpdateClientData( client_data_t *cdata, float flTime ); -void DLLEXPORT HUD_Reset ( void ); -void DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server ); -void DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove ); -char DLLEXPORT HUD_PlayerMoveTexture( char *name ); -int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); -int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs ); -void DLLEXPORT HUD_Frame( double time ); -void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking); -void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf ); -} - /* ================================ HUD_GetHullBounds @@ -76,8 +69,10 @@ HUD_GetHullBounds Engine calls this to enumerate player collision hulls, for prediction. Return 0 if the hullnumber doesn't exist. ================================ */ -int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs ) +int CL_DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs ) { +// RecClGetHullBounds(hullnumber, mins, maxs); + int iret = 0; switch ( hullnumber ) @@ -110,8 +105,10 @@ HUD_ConnectionlessPacket size of the response_buffer, so you must zero it out if you choose not to respond. ================================ */ -int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ) +int CL_DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ) { +// RecClConnectionlessPacket(net_from, args, response_buffer, response_buffer_size); + // Parse stuff from args int max_buffer_size = *response_buffer_size; @@ -124,32 +121,42 @@ int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const c return 0; } -void DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove ) +void CL_DLLEXPORT HUD_PlayerMoveInit( struct playermove_s *ppmove ) { +// RecClClientMoveInit(ppmove); + PM_Init( ppmove ); } -char DLLEXPORT HUD_PlayerMoveTexture( char *name ) +char CL_DLLEXPORT HUD_PlayerMoveTexture( char *name ) { +// RecClClientTextureType(name); + return PM_FindTextureType( name ); } -void DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server ) +void CL_DLLEXPORT HUD_PlayerMove( struct playermove_s *ppmove, int server ) { +// RecClClientMove(ppmove, server); + PM_Move( ppmove, server ); } -int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ) +int CL_DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ) { gEngfuncs = *pEnginefuncs; +// RecClInitialize(pEnginefuncs, iVersion); + if (iVersion != CLDLL_INTERFACE_VERSION) return 0; memcpy(&gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t)); EV_HookEvents(); + CL_LoadParticleMan(); + // get tracker interface, if any return 1; } @@ -164,8 +171,9 @@ so the HUD can reinitialize itself. ========================== */ -int DLLEXPORT HUD_VidInit( void ) +int CL_DLLEXPORT HUD_VidInit( void ) { +// RecClHudVidInit(); gHUD.VidInit(); VGui_Startup(); @@ -183,8 +191,9 @@ the hud variables. ========================== */ -void DLLEXPORT HUD_Init( void ) +void CL_DLLEXPORT HUD_Init( void ) { +// RecClHudInit(); InitInput(); gHUD.Init(); Scheme_Init(); @@ -200,8 +209,10 @@ redraw the HUD. =========================== */ -int DLLEXPORT HUD_Redraw( float time, int intermission ) +int CL_DLLEXPORT HUD_Redraw( float time, int intermission ) { +// RecClHudRedraw(time, intermission); + gHUD.Redraw( time, intermission ); return 1; @@ -221,8 +232,10 @@ returns 1 if anything has been changed, 0 otherwise. ========================== */ -int DLLEXPORT HUD_UpdateClientData(client_data_t *pcldata, float flTime ) +int CL_DLLEXPORT HUD_UpdateClientData(client_data_t *pcldata, float flTime ) { +// RecClHudUpdateClientData(pcldata, flTime); + IN_Commands(); return gHUD.UpdateClientData(pcldata, flTime ); @@ -236,8 +249,10 @@ Called at start and end of demos to restore to "non"HUD state. ========================== */ -void DLLEXPORT HUD_Reset( void ) +void CL_DLLEXPORT HUD_Reset( void ) { +// RecClHudReset(); + gHUD.VidInit(); } @@ -249,8 +264,10 @@ Called by engine every frame that client .dll is loaded ========================== */ -void DLLEXPORT HUD_Frame( double time ) +void CL_DLLEXPORT HUD_Frame( double time ) { +// RecClHudFrame(time); + ServersThink( time ); GetClientVoiceMgr()->Frame(time); @@ -265,22 +282,166 @@ Called when a player starts or stops talking. ========================== */ -void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking) +void CL_DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking) { +//// RecClVoiceStatus(entindex, bTalking); + GetClientVoiceMgr()->UpdateSpeakerStatus(entindex, bTalking); } /* ========================== -HUD_DirectorEvent +HUD_DirectorMessage Called when a director event message was received ========================== */ -void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf ) +void CL_DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf ) { - gHUD.m_Spectator.DirectorMessage( iSize, pbuf ); +// RecClDirectorMessage(iSize, pbuf); + + gHUD.m_Spectator.DirectorMessage( iSize, pbuf ); } +void CL_UnloadParticleMan( void ) +{ + Sys_UnloadModule( g_hParticleManModule ); + g_pParticleMan = NULL; + g_hParticleManModule = NULL; +} + +void CL_LoadParticleMan( void ) +{ + char szPDir[512]; + + if ( gEngfuncs.COM_ExpandFilename( PARTICLEMAN_DLLNAME, szPDir, sizeof( szPDir ) ) == FALSE ) + { + g_pParticleMan = NULL; + g_hParticleManModule = NULL; + return; + } + + g_hParticleManModule = Sys_LoadModule( szPDir ); + CreateInterfaceFn particleManFactory = Sys_GetFactory( g_hParticleManModule ); + + if ( particleManFactory == NULL ) + { + g_pParticleMan = NULL; + g_hParticleManModule = NULL; + return; + } + + g_pParticleMan = (IParticleMan *)particleManFactory( PARTICLEMAN_INTERFACE, NULL); + + if ( g_pParticleMan ) + { + g_pParticleMan->SetUp( &gEngfuncs ); + + // Add custom particle classes here BEFORE calling anything else or you will die. + g_pParticleMan->AddCustomParticleClassSize ( sizeof ( CBaseParticle ) ); + } +} + +cldll_func_dst_t *g_pcldstAddrs; + +extern "C" void CL_DLLEXPORT F(void *pv) +{ + cldll_func_t *pcldll_func = (cldll_func_t *)pv; + + // Hack! + g_pcldstAddrs = ((cldll_func_dst_t *)pcldll_func->pHudVidInitFunc); + + cldll_func_t cldll_func = + { + Initialize, + HUD_Init, + HUD_VidInit, + HUD_Redraw, + HUD_UpdateClientData, + HUD_Reset, + HUD_PlayerMove, + HUD_PlayerMoveInit, + HUD_PlayerMoveTexture, + IN_ActivateMouse, + IN_DeactivateMouse, + IN_MouseEvent, + IN_ClearStates, + IN_Accumulate, + CL_CreateMove, + CL_IsThirdPerson, + CL_CameraOffset, + KB_Find, + CAM_Think, + V_CalcRefdef, + HUD_AddEntity, + HUD_CreateEntities, + HUD_DrawNormalTriangles, + HUD_DrawTransparentTriangles, + HUD_StudioEvent, + HUD_PostRunCmd, + HUD_Shutdown, + HUD_TxferLocalOverrides, + HUD_ProcessPlayerState, + HUD_TxferPredictionData, + Demo_ReadBuffer, + HUD_ConnectionlessPacket, + HUD_GetHullBounds, + HUD_Frame, + HUD_Key_Event, + HUD_TempEntUpdate, + HUD_GetUserEntity, + HUD_VoiceStatus, + HUD_DirectorMessage, + HUD_GetStudioModelInterface, + HUD_ChatInputPosition, + }; + + *pcldll_func = cldll_func; +} + +#include "cl_dll/IGameClientExports.h" + +//----------------------------------------------------------------------------- +// Purpose: Exports functions that are used by the gameUI for UI dialogs +//----------------------------------------------------------------------------- +class CClientExports : public IGameClientExports +{ +public: + // returns the name of the server the user is connected to, if any + virtual const char *GetServerHostName() + { + /*if (gViewPortInterface) + { + return gViewPortInterface->GetServerName(); + }*/ + return ""; + } + + // ingame voice manipulation + virtual bool IsPlayerGameVoiceMuted(int playerIndex) + { + if (GetClientVoiceMgr()) + return GetClientVoiceMgr()->IsPlayerBlocked(playerIndex); + return false; + } + + virtual void MutePlayerGameVoice(int playerIndex) + { + if (GetClientVoiceMgr()) + { + GetClientVoiceMgr()->SetPlayerBlockedState(playerIndex, true); + } + } + + virtual void UnmutePlayerGameVoice(int playerIndex) + { + if (GetClientVoiceMgr()) + { + GetClientVoiceMgr()->SetPlayerBlockedState(playerIndex, false); + } + } +}; + +EXPOSE_SINGLE_INTERFACE(CClientExports, IGameClientExports, GAMECLIENTEXPORTS_INTERFACE_VERSION); diff --git a/cl_dll/cl_dll.dsp b/cl_dll/cl_dll.dsp index 280392a..525e50b 100644 --- a/cl_dll/cl_dll.dsp +++ b/cl_dll/cl_dll.dsp @@ -23,8 +23,6 @@ CFG=cl_dll - Win32 Release # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -43,7 +41,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\utils\vgui\include" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /YX /FD /c +# ADD CPP /nologo /W3 /GR /GX /Zi /O2 /I "..\dlls" /I "." /I "..\tfc" /I "..\public" /I "..\common" /I "..\pm_shared" /I "..\engine" /I "..\utils\vgui\include" /I "..\game_shared" /I "..\external" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /D "HL_DLL" /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -53,7 +51,26 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:".\Release\client.dll" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ..\utils\vgui\lib\win32_vc6\vgui.lib wsock32.lib ..\lib\public\sdl2.lib /nologo /base:"0x01900000" /subsystem:windows /dll /map /debug /machine:I386 /nodefaultlib:"LIBCMTD" /nodefaultlib:"LIBCD" /out:".\Release\client.dll" +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build +InputDir=.\Release +ProjDir=. +InputPath=.\Release\client.dll +InputName=client +SOURCE="$(InputPath)" + +BuildCmds= \ + call ..\filecopy.bat $(InputDir)\$(InputName).dll $(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).dll \ + call ..\filecopy.bat $(InputDir)\$(InputName).pdb $(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).pdb \ + + +"$(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).pdb" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build !ELSEIF "$(CFG)" == "cl_dll - Win32 Debug" @@ -69,7 +86,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /G5 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\dlls" /I "..\common" /I "..\pm_shared" /I "..\engine" /I "..\utils\vgui\include" /I "..\game_shared" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c +# ADD CPP /nologo /G5 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\dlls" /I "." /I "..\tfc" /I "..\public" /I "..\common" /I "..\pm_shared" /I "..\engine" /I "..\utils\vgui\include" /I "..\game_shared" /I "..\external" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /D "_WINDLL" /D "HL_DLL" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -79,7 +96,26 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ../utils/vgui/lib/win32_vc6/vgui.lib wsock32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\client.dll" +# ADD LINK32 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib winmm.lib ..\utils\vgui\lib\win32_vc6\vgui.lib wsock32.lib ..\lib\public\sdl2.lib /nologo /base:"0x01900000" /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\client.dll" +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build +InputDir=.\Debug +ProjDir=. +InputPath=.\Debug\client.dll +InputName=client +SOURCE="$(InputPath)" + +BuildCmds= \ + call ..\filecopy.bat $(InputDir)\$(InputName).dll $(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).dll \ + call ..\filecopy.bat $(InputDir)\$(InputName).pdb $(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).pdb \ + + +"$(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\..\..\game\mod\cl_dlls\$(InputName).pdb" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build !ENDIF @@ -92,7 +128,7 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" # Begin Group "hl" -# PROP Default_Filter "*.CPP" +# PROP Default_Filter "*.cpp" # Begin Source File SOURCE=..\dlls\crossbow.cpp @@ -143,10 +179,6 @@ SOURCE=..\dlls\hornetgun.cpp # End Source File # Begin Source File -SOURCE=..\common\interface.cpp -# End Source File -# Begin Source File - SOURCE=..\dlls\mp5.cpp # End Source File # Begin Source File @@ -173,22 +205,6 @@ SOURCE=..\dlls\squeakgrenade.cpp SOURCE=..\dlls\tripmine.cpp # End Source File -# Begin Source File - -SOURCE=..\game_shared\vgui_scrollbar2.cpp -# End Source File -# Begin Source File - -SOURCE=..\game_shared\vgui_slider2.cpp -# End Source File -# Begin Source File - -SOURCE=..\game_shared\voice_banmgr.cpp -# End Source File -# Begin Source File - -SOURCE=..\game_shared\voice_status.cpp -# End Source File # End Group # Begin Source File @@ -225,6 +241,15 @@ SOURCE=.\demo.cpp # Begin Source File SOURCE=.\entity.cpp + +!IF "$(CFG)" == "cl_dll - Win32 Release" + +!ELSEIF "$(CFG)" == "cl_dll - Win32 Debug" + +# ADD CPP /MT + +!ENDIF + # End Source File # Begin Source File @@ -256,6 +281,14 @@ SOURCE=.\hud.cpp # End Source File # Begin Source File +SOURCE=.\hud_bench.cpp +# End Source File +# Begin Source File + +SOURCE=.\hud_benchtrace.cpp +# End Source File +# Begin Source File + SOURCE=.\hud_msg.cpp # End Source File # Begin Source File @@ -288,6 +321,14 @@ SOURCE=.\inputw32.cpp # End Source File # Begin Source File +SOURCE=..\public\interface.cpp +# End Source File +# Begin Source File + +SOURCE=.\interpolation.cpp +# End Source File +# Begin Source File + SOURCE=.\menu.cpp # End Source File # Begin Source File @@ -296,16 +337,7 @@ SOURCE=.\message.cpp # End Source File # Begin Source File -SOURCE=.\overview.cpp -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\parsemsg.cpp -# End Source File -# Begin Source File - -SOURCE=.\parsemsg.h +SOURCE=..\common\parsemsg.cpp # End Source File # Begin Source File @@ -365,10 +397,6 @@ SOURCE=.\vgui_ClassMenu.cpp # End Source File # Begin Source File -SOURCE=.\vgui_ConsolePanel.cpp -# End Source File -# Begin Source File - SOURCE=.\vgui_ControlConfigPanel.cpp # End Source File # Begin Source File @@ -409,10 +437,18 @@ SOURCE=.\vgui_ScorePanel.cpp # End Source File # Begin Source File +SOURCE=..\game_shared\vgui_scrollbar2.cpp +# End Source File +# Begin Source File + SOURCE=.\vgui_ServerBrowser.cpp # End Source File # Begin Source File +SOURCE=..\game_shared\vgui_slider2.cpp +# End Source File +# Begin Source File + SOURCE=.\vgui_SpectatorPanel.cpp # End Source File # Begin Source File @@ -421,12 +457,20 @@ SOURCE=.\vgui_TeamFortressViewport.cpp # End Source File # Begin Source File -SOURCE=.\vgui_teammenu.cpp +SOURCE=.\vgui_TeamMenu.cpp # End Source File # Begin Source File SOURCE=.\view.cpp # End Source File +# Begin Source File + +SOURCE=..\game_shared\voice_banmgr.cpp +# End Source File +# Begin Source File + +SOURCE=.\voice_status.cpp +# End Source File # End Group # Begin Group "Header Files" @@ -449,6 +493,10 @@ SOURCE=.\cl_dll.h # End Source File # Begin Source File +SOURCE=.\cl_util.h +# End Source File +# Begin Source File + SOURCE=.\com_weapons.h # End Source File # Begin Source File @@ -477,10 +525,6 @@ SOURCE=.\hud.h # End Source File # Begin Source File -SOURCE=.\hud_iface.h -# End Source File -# Begin Source File - SOURCE=.\hud_servers.h # End Source File # Begin Source File @@ -497,7 +541,7 @@ SOURCE=.\in_defs.h # End Source File # Begin Source File -SOURCE=..\common\itrackeruser.h +SOURCE=.\interpolation.h # End Source File # Begin Source File @@ -505,7 +549,7 @@ SOURCE=.\kbutton.h # End Source File # Begin Source File -SOURCE=.\overview.h +SOURCE=..\common\parsemsg.h # End Source File # Begin Source File @@ -533,15 +577,11 @@ SOURCE=..\pm_shared\pm_shared.h # End Source File # Begin Source File -SOURCE=.\studio_util.h -# End Source File -# Begin Source File - SOURCE=.\StudioModelRenderer.h # End Source File # Begin Source File -SOURCE=.\util.h +SOURCE=.\tri.h # End Source File # Begin Source File @@ -549,10 +589,6 @@ SOURCE=.\util_vector.h # End Source File # Begin Source File -SOURCE=.\vgui_ConsolePanel.h -# End Source File -# Begin Source File - SOURCE=.\vgui_ControlConfigPanel.h # End Source File # Begin Source File @@ -569,15 +605,19 @@ SOURCE=.\vgui_ScorePanel.h # End Source File # Begin Source File +SOURCE=..\game_shared\vgui_scrollbar2.h +# End Source File +# Begin Source File + SOURCE=.\vgui_ServerBrowser.h # End Source File # Begin Source File -SOURCE=.\vgui_SpectatorPanel.h +SOURCE=..\game_shared\vgui_slider2.h # End Source File # Begin Source File -SOURCE=.\vgui_TeamFortressViewport.h +SOURCE=.\vgui_SpectatorPanel.h # End Source File # Begin Source File @@ -593,10 +633,6 @@ SOURCE=..\game_shared\voice_status.h # End Source File # Begin Source File -SOURCE=..\game_shared\voice_vgui_tweakdlg.h -# End Source File -# Begin Source File - SOURCE=.\wrect.h # End Source File # End Group @@ -604,5 +640,9 @@ SOURCE=.\wrect.h # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" # End Group +# Begin Source File + +SOURCE=..\lib\public\game_controls.lib +# End Source File # End Target # End Project diff --git a/cl_dll/cl_dll.h b/cl_dll/cl_dll.h index 2bb3d1a..df109f8 100644 --- a/cl_dll/cl_dll.h +++ b/cl_dll/cl_dll.h @@ -31,7 +31,11 @@ typedef float vec_t; typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); #include "util_vector.h" +#ifdef _WIN32 #define EXPORT _declspec( dllexport ) +#else +#define EXPORT __attribute__ ((visibility("default"))) +#endif #include "../engine/cdll_int.h" #include "../dlls/cdll_dll.h" diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index f72d589..453f6c3 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -23,19 +23,23 @@ #define FALSE 0 #endif +#include // for safe_sprintf() +#include // " +#include // for strncpy() + // Macros to hook function calls into the HUD object #define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x ); #define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \ { \ - return gHUD.##y.MsgFunc_##x(pszName, iSize, pbuf ); \ + return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \ } #define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y ); #define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \ { \ - gHUD.##y.UserCmd_##x( ); \ + gHUD.y.UserCmd_##x( ); \ } inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); } @@ -67,17 +71,18 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl // ScreenWidth returns the width of the screen, in pixels #define ScreenWidth (gHUD.m_scrinfo.iWidth) -// Use this to set any co-ords in 640x480 space -#define XRES(x) ((int)(float(x) * ((float)ScreenWidth / 640.0f) + 0.5f)) -#define YRES(y) ((int)(float(y) * ((float)ScreenHeight / 480.0f) + 0.5f)) +#define BASE_XRES 640.f // use this to project world coordinates to screen coordinates #define XPROJECT(x) ( (1.0f+(x))*ScreenWidth*0.5f ) #define YPROJECT(y) ( (1.0f-(y))*ScreenHeight*0.5f ) +#define XRES(x) (x * ((float)ScreenWidth / 640)) +#define YRES(y) (y * ((float)ScreenHeight / 480)) + #define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo) #define ServerCmd (*gEngfuncs.pfnServerCmd) -#define ClientCmd (*gEngfuncs.pfnClientCmd) +#define EngineClientCmd (*gEngfuncs.pfnClientCmd) #define SetCrosshair (*gEngfuncs.pfnSetCrosshair) #define AngleVectors (*gEngfuncs.pfnAngleVectors) @@ -119,8 +124,39 @@ inline void CenterPrint( const char *string ) gEngfuncs.pfnCenterPrint( string ); } -// returns the players name of entity no. -#define GetPlayerInfo (*gEngfuncs.pfnGetPlayerInfo) + +inline char *safe_strcpy( char *dst, const char *src, int len_dst) +{ + if( len_dst <= 0 ) + { + return NULL; // this is bad + } + + strncpy(dst,src,len_dst); + dst[ len_dst - 1 ] = '\0'; + + return dst; +} + +inline int safe_sprintf( char *dst, int len_dst, const char *format, ...) +{ + if( len_dst <= 0 ) + { + return -1; // this is bad + } + + va_list v; + + va_start(v, format); + + _vsnprintf(dst,len_dst,format,v); + + va_end(v); + + dst[ len_dst - 1 ] = '\0'; + + return 0; +} // sound functions inline void PlaySound( char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); } diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index 66b1c82..61463d4 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -273,5 +273,5 @@ stub functions for such things as precaching. So we don't have to modify weapon int stub_PrecacheModel ( char* s ) { return 0; } int stub_PrecacheSound ( char* s ) { return 0; } unsigned short stub_PrecacheEvent ( int type, const char *s ) { return 0; } -const char *stub_NameForFunction ( unsigned long function ) { return "func"; } +const char *stub_NameForFunction ( uint32 function ) { return "func"; } void stub_SetModel ( edict_t *e, const char *m ) {} diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index e2fd274..8ebf7af 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -14,11 +14,7 @@ #endif #include "hud_iface.h" - -extern "C" -{ - void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed ); -} +#include "Exports.h" void COM_Log( char *pszFile, char *fmt, ...); int CL_IsDead( void ); @@ -34,7 +30,7 @@ void HUD_SetMaxSpeed( const struct edict_s *ed, float speed ); int stub_PrecacheModel( char* s ); int stub_PrecacheSound( char* s ); unsigned short stub_PrecacheEvent( int type, const char *s ); -const char *stub_NameForFunction ( unsigned long function ); +const char *stub_NameForFunction ( uint32 function ); void stub_SetModel ( struct edict_s *e, const char *m ); diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index 208f587..423218f 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -115,7 +115,7 @@ int CHudDeathNotice :: Draw( float flTime ) if ( gViewPort && gViewPort->AllowedToPrintText() ) { // Draw the death notice - y = YRES(DEATHNOTICE_TOP) + 2 + (20 * i); //!!! + y = DEATHNOTICE_TOP + 2 + (20 * i); //!!! int id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId; x = ScreenWidth - ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left); @@ -173,8 +173,8 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p gViewPort->DeathMsg( killer, victim ); gHUD.m_Spectator.DeathMessage(victim); - - for ( int i = 0; i < MAX_DEATHNOTICES; i++ ) + int i; + for ( i = 0; i < MAX_DEATHNOTICES; i++ ) { if ( rgDeathNoticeList[i].iId == 0 ) break; diff --git a/cl_dll/demo.cpp b/cl_dll/demo.cpp index 6968b38..9dea3ec 100644 --- a/cl_dll/demo.cpp +++ b/cl_dll/demo.cpp @@ -17,8 +17,7 @@ #include "demo.h" #include "demo_api.h" #include - -#define DLLEXPORT __declspec( dllexport ) +#include "Exports.h" int g_demosniper = 0; int g_demosniperdamage = 0; @@ -28,11 +27,6 @@ float g_demozoom; // FIXME: There should be buffer helper functions to avoid all of the *(int *)& crap. -extern "C" -{ - void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer ); -} - /* ===================== Demo_WriteBuffer @@ -60,8 +54,10 @@ Demo_ReadBuffer Engine wants us to parse some data from the demo stream ===================== */ -void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer ) +void CL_DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer ) { +// RecClReadDemoBuffer(size, buffer); + int type; int i = 0; diff --git a/cl_dll/entity.cpp b/cl_dll/entity.cpp index 6a209c8..1ebb61e 100644 --- a/cl_dll/entity.cpp +++ b/cl_dll/entity.cpp @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - // Client side entity management functions #include @@ -19,8 +12,11 @@ #include "pm_defs.h" #include "pmtrace.h" #include "pm_shared.h" +#include "bench.h" +#include "Exports.h" -#define DLLEXPORT __declspec( dllexport ) +#include "particleman.h" +extern IParticleMan *g_pParticleMan; void Game_AddObjects( void ); @@ -28,29 +24,21 @@ extern vec3_t v_origin; int g_iAlive = 1; -extern "C" -{ - int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname ); - void DLLEXPORT HUD_CreateEntities( void ); - void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity ); - void DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client ); - void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src ); - void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd ); - void DLLEXPORT HUD_TempEntUpdate( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( struct cl_entity_s *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) ); - struct cl_entity_s DLLEXPORT *HUD_GetUserEntity( int index ); -} - /* ======================== HUD_AddEntity Return 0 to filter entity from visible list for rendering ======================== */ -int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname ) +int CL_DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname ) { +// RecClAddEntity(type, ent, modelname); + switch ( type ) { case ET_NORMAL: + Bench_CheckEntity( type, ent, modelname ); + break; case ET_PLAYER: case ET_BEAM: case ET_TEMPENTITY: @@ -85,8 +73,10 @@ playerstate update in entity_state_t. In order for these overrides to eventuall structure, we need to copy them into the state structure at this point. ========================= */ -void DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client ) +void CL_DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client ) { +// RecClTxferLocalOverrides(state, client); + VectorCopy( client->origin, state->origin ); // Spectator @@ -108,8 +98,10 @@ We have received entity_state_t for this player over the network. We need to co playerstate structure ========================= */ -void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src ) +void CL_DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src ) { +// RecClProcessPlayerState(dst, src); + // Copy in network data VectorCopy( src->origin, dst->origin ); VectorCopy( src->angles, dst->angles ); @@ -151,6 +143,10 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct dst->team = src->team; dst->colormap = src->colormap; +#if defined( _TFC ) + dst->fuser1 = src->fuser1; +#endif + // Save off some data so other areas of the Client DLL can get to it cl_entity_t *player = gEngfuncs.GetLocalPlayer(); // Get the local player's index if ( dst->number == player->index ) @@ -174,8 +170,10 @@ Because we can predict an arbitrary number of frames before the server responds update is occupying. ========================= */ -void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd ) +void CL_DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd ) { +// RecClTxferPredictionData(ps, pps, pcd, ppcd, wd, pwd); + ps->oldbuttons = pps->oldbuttons; ps->flFallVelocity = pps->flFallVelocity; ps->iStepLeft = pps->iStepLeft; @@ -212,7 +210,6 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct pcd->iuser1 = g_iUser1; // observer mode pcd->iuser2 = g_iUser2; // first target pcd->iuser3 = g_iUser3; // second target - } // Fire prevention @@ -229,210 +226,6 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct memcpy( wd, pwd, 32 * sizeof( weapon_data_t ) ); } -/* -//#define TEST_IT -#if defined( TEST_IT ) - -cl_entity_t mymodel[9]; - -void MoveModel( void ) -{ - cl_entity_t *player; - int i, j; - int modelindex; - struct model_s *mod; - - // Load it up with some bogus data - player = gEngfuncs.GetLocalPlayer(); - if ( !player ) - return; - - mod = gEngfuncs.CL_LoadModel( "models/sentry3.mdl", &modelindex ); - for ( i = 0; i < 3; i++ ) - { - for ( j = 0; j < 3; j++ ) - { - // Don't draw over ourself... - if ( ( i == 1 ) && ( j == 1 ) ) - continue; - - mymodel[ i * 3 + j ] = *player; - - mymodel[ i * 3 + j ].player = 0; - - mymodel[ i * 3 + j ].model = mod; - mymodel[ i * 3 + j ].curstate.modelindex = modelindex; - - // Move it out a bit - mymodel[ i * 3 + j ].origin[0] = player->origin[0] + 50 * ( 1 - i ); - mymodel[ i * 3 + j ].origin[1] = player->origin[1] + 50 * ( 1 - j ); - - gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &mymodel[i*3+j] ); - } - } - -} - -#endif - -//#define TRACE_TEST -#if defined( TRACE_TEST ) - -extern int hitent; - -cl_entity_t hit; - -void TraceModel( void ) -{ - cl_entity_t *ent; - - if ( hitent <= 0 ) - return; - - // Load it up with some bogus data - ent = gEngfuncs.GetEntityByIndex( hitent ); - if ( !ent ) - return; - - hit = *ent; - //hit.curstate.rendermode = kRenderTransTexture; - //hit.curstate.renderfx = kRenderFxGlowShell; - //hit.curstate.renderamt = 100; - - hit.origin[2] += 40; - - gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &hit ); -} - -#endif -*/ - -/* -void ParticleCallback( struct particle_s *particle, float frametime ) -{ - int i; - - for ( i = 0; i < 3; i++ ) - { - particle->org[ i ] += particle->vel[ i ] * frametime; - } -} - -cvar_t *color = NULL; -void Particles( void ) -{ - static float lasttime; - float curtime; - - curtime = gEngfuncs.GetClientTime(); - - if ( ( curtime - lasttime ) < 2.0 ) - return; - - if ( !color ) - { - color = gEngfuncs.pfnRegisterVariable ( "color","255 0 0", 0 ); - } - - lasttime = curtime; - - // Create a few particles - particle_t *p; - int i, j; - - for ( i = 0; i < 1000; i++ ) - { - int r, g, b; - p = gEngfuncs.pEfxAPI->R_AllocParticle( ParticleCallback ); - if ( !p ) - break; - - for ( j = 0; j < 3; j++ ) - { - p->org[ j ] = v_origin[ j ] + gEngfuncs.pfnRandomFloat( -32.0, 32.0 );; - p->vel[ j ] = gEngfuncs.pfnRandomFloat( -100.0, 100.0 ); - } - - if ( color ) - { - sscanf( color->string, "%i %i %i", &r, &g, &b ); - } - else - { - r = 192; - g = 0; - b = 0; - } - - p->color = gEngfuncs.pEfxAPI->R_LookupColor( r, g, b ); - gEngfuncs.pEfxAPI->R_GetPackedColor( &p->packedColor, p->color ); - - // p->die is set to current time so all you have to do is add an additional time to it - p->die += 3.0; - } -} -*/ - -/* -void TempEntCallback ( struct tempent_s *ent, float frametime, float currenttime ) -{ - int i; - - for ( i = 0; i < 3; i++ ) - { - ent->entity.curstate.origin[ i ] += ent->entity.baseline.origin[ i ] * frametime; - } -} - -void TempEnts( void ) -{ - static float lasttime; - float curtime; - - curtime = gEngfuncs.GetClientTime(); - - if ( ( curtime - lasttime ) < 10.0 ) - return; - - lasttime = curtime; - - TEMPENTITY *p; - int i, j; - struct model_s *mod; - vec3_t origin; - int index; - - mod = gEngfuncs.CL_LoadModel( "sprites/laserdot.spr", &index ); - - for ( i = 0; i < 100; i++ ) - { - for ( j = 0; j < 3; j++ ) - { - origin[ j ] = v_origin[ j ]; - if ( j != 2 ) - { - origin[ j ] += 75; - } - } - - p = gEngfuncs.pEfxAPI->CL_TentEntAllocCustom( (float *)&origin, mod, 0, TempEntCallback ); - if ( !p ) - break; - - for ( j = 0; j < 3; j++ ) - { - p->entity.curstate.origin[ j ] = origin[ j ]; - - // Store velocity in baseline origin - p->entity.baseline.origin[ j ] = gEngfuncs.pfnRandomFloat( -100, 100 ); - } - - // p->die is set to current time so all you have to do is add an additional time to it - p->die += 10.0; - } -} -*/ - #if defined( BEAM_TEST ) // Note can't index beam[ 0 ] in Beam callback, so don't use that index // Room for 1 beam ( 0 can't be used ) @@ -511,37 +304,26 @@ HUD_CreateEntities Gives us a chance to add additional entities to the render this frame ========================= */ -void DLLEXPORT HUD_CreateEntities( void ) +void CL_DLLEXPORT HUD_CreateEntities( void ) { - // e.g., create a persistent cl_entity_t somewhere. - // Load an appropriate model into it ( gEngfuncs.CL_LoadModel ) - // Call gEngfuncs.CL_CreateVisibleEntity to add it to the visedicts list -/* -#if defined( TEST_IT ) - MoveModel(); -#endif - -#if defined( TRACE_TEST ) - TraceModel(); -#endif -*/ -/* - Particles(); -*/ -/* - TempEnts(); -*/ +// RecClCreateEntities(); #if defined( BEAM_TEST ) Beams(); #endif + Bench_AddObjects(); + // Add in any game specific objects Game_AddObjects(); GetClientVoiceMgr()->CreateEntities(); } +#if defined( _TFC ) +extern int g_bACSpinning[33]; +#endif + /* ========================= HUD_StudioEvent @@ -550,21 +332,36 @@ The entity's studio model description indicated an event was fired during this frame, handle the event by it's tag ( e.g., muzzleflash, sound ) ========================= */ -void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity ) +void CL_DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity ) { +// RecClStudioEvent(event, entity); + + int iMuzzleFlash = 1; + +#if defined( _TFC ) + + if ( g_bACSpinning[ entity->index - 1 ] ) + iMuzzleFlash = 0; + +#endif + switch( event->event ) { case 5001: - gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options) ); + if ( iMuzzleFlash ) + gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options) ); break; case 5011: - gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options) ); + if ( iMuzzleFlash ) + gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options) ); break; case 5021: - gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options) ); + if ( iMuzzleFlash ) + gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options) ); break; case 5031: - gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options) ); + if ( iMuzzleFlash ) + gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options) ); break; case 5002: gEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options), -100, 100 ); @@ -585,7 +382,7 @@ CL_UpdateTEnts Simulation and cleanup of temporary entities ================= */ -void DLLEXPORT HUD_TempEntUpdate ( +void CL_DLLEXPORT HUD_TempEntUpdate ( double frametime, // Simulation time double client_time, // Absolute time on client double cl_gravity, // True gravity on client @@ -594,11 +391,20 @@ void DLLEXPORT HUD_TempEntUpdate ( int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( TEMPENTITY *pTemp, float damp ) ) { +// RecClTempEntUpdate(frametime, client_time, cl_gravity, ppTempEntFree, ppTempEntActive, Callback_AddVisibleEntity, Callback_TempEntPlaySound); + static int gTempEntFrame = 0; int i; TEMPENTITY *pTemp, *pnext, *pprev; float freq, gravity, gravitySlow, life, fastFreq; + Vector vAngles; + + gEngfuncs.GetViewAngles( (float*)vAngles ); + + if ( g_pParticleMan ) + g_pParticleMan->SetVariables( cl_gravity, vAngles ); + // Nothing to simulate if ( !*ppTempEntActive ) return; @@ -957,8 +763,10 @@ If you specify negative numbers for beam start and end point entities, then Indices must start at 1, not zero. ================= */ -cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index ) +cl_entity_t CL_DLLEXPORT *HUD_GetUserEntity( int index ) { +// RecClGetUserEntity(index); + #if defined( BEAM_TEST ) // None by default, you would return a valic pointer if you create a client side // beam and attach it to a client side entity. diff --git a/cl_dll/ev_common.cpp b/cl_dll/ev_common.cpp index 224633d..8610342 100644 --- a/cl_dll/ev_common.cpp +++ b/cl_dll/ev_common.cpp @@ -202,4 +202,4 @@ void EV_MuzzleFlash( void ) // Or in the muzzle flash ent->curstate.effects |= EF_MUZZLEFLASH; -} \ No newline at end of file +} diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index ad9ba30..f89c1e6 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -39,7 +39,10 @@ extern engine_studio_api_t IEngineStudio; static int tracerCount[ 32 ]; -extern "C" char PM_FindTextureType( char *name ); +extern "C" +{ +#include "pm_shared.h" +} void V_PunchAxis( int axis, float punch ); void VectorAngles( const float *forward, float *angles ); @@ -86,6 +89,7 @@ void EV_TrainPitchAdjust( struct event_args_s *args ); #define VECTOR_CONE_15DEGREES Vector( 0.13053, 0.13053, 0.13053 ) #define VECTOR_CONE_20DEGREES Vector( 0.17365, 0.17365, 0.17365 ) + // play a strike sound based on the texture that was hit by the attack traceline. VecSrc/VecEnd are the // original traceline endpoints used by the attacker, iBulletType is the type of bullet that hit the texture. // returns volume of strike instrument (crowbar) to play diff --git a/cl_dll/geiger.cpp b/cl_dll/geiger.cpp index 6f5f984..738b8d7 100644 --- a/cl_dll/geiger.cpp +++ b/cl_dll/geiger.cpp @@ -68,14 +68,10 @@ int CHudGeiger::Draw (float flTime) int rg[3]; int i; - if (m_iGeigerRange < 1000 && m_iGeigerRange > 0) + if (m_iGeigerRange <= 800 && m_iGeigerRange > 0) { // peicewise linear is better than continuous formula for this - if (m_iGeigerRange > 800) - { - pct = 0; //Con_Printf ( "range > 800\n"); - } - else if (m_iGeigerRange > 600) + if (m_iGeigerRange > 600) { pct = 2; flvol = 0.4; //Con_Printf ( "range > 600\n"); diff --git a/cl_dll/global_consts.h b/cl_dll/global_consts.h new file mode 100644 index 0000000..f63935c --- /dev/null +++ b/cl_dll/global_consts.h @@ -0,0 +1,30 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= +#ifndef GLOBALCONSTS_H +#define GLOBALCONSTS_H +#ifdef _WIN32 +#pragma once +#endif + + + +enum +{ + MAX_PLAYERS = 64, + MAX_TEAMS = 64, + MAX_TEAM_NAME = 16, +}; + +#define MAX_SCORES 10 +#define MAX_SCOREBOARD_TEAMS 5 + +#define NUM_ROWS (MAX_PLAYERS + (MAX_SCOREBOARD_TEAMS * 2)) + +#define MAX_SERVERNAME_LENGTH 64 +#define MAX_TEAMNAME_SIZE 32 + +#endif // GLOBALCONSTS_H \ No newline at end of file diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index f5835e4..3de1fae 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -18,9 +18,9 @@ // implementation of CHudHealth class // -#include "STDIO.H" -#include "STDLIB.H" -#include "MATH.H" +#include "stdio.h" +#include "stdlib.h" +#include "math.h" #include "hud.h" #include "cl_util.h" @@ -379,7 +379,8 @@ int CHudHealth::DrawDamage(float flTime) ScaleColors(r, g, b, a); // Draw all the items - for (int i = 0; i < NUM_DMG_TYPES; i++) + int i; + for ( i = 0; i < NUM_DMG_TYPES; i++) { if (m_bitsDamage & giDmgFlags[i]) { diff --git a/cl_dll/hl/hl_baseentity.cpp b/cl_dll/hl/hl_baseentity.cpp index 547d553..c5f0a45 100644 --- a/cl_dll/hl/hl_baseentity.cpp +++ b/cl_dll/hl/hl_baseentity.cpp @@ -314,6 +314,7 @@ int CBasePlayerItem::Restore( class CRestore & ) { return 1; } int CBasePlayerItem::Save( class CSave & ) { return 1; } int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; } int CBasePlayerWeapon::Save( class CSave & ) { return 1; } +float CBasePlayerWeapon::GetNextAttackDelay( float flTime ) { return flTime; } void CBasePlayerItem :: SetObjectCollisionBox( void ) { } void CBasePlayerItem :: FallInit( void ) { } void CBasePlayerItem::FallThink ( void ) { } diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 820e49f..ce79d81 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -563,22 +563,6 @@ void UTIL_ParticleLine( CBasePlayer *player, float *start, float *end, float lif gEngfuncs.pEfxAPI->R_ParticleLine( start, end, r, g, b, life ); } -/* -===================== -CBasePlayerWeapon::PrintState - -For debugging, print out state variables to log file -===================== -*/ -void CBasePlayerWeapon::PrintState( void ) -{ - COM_Log( "c:\\hl.log", "%.4f ", gpGlobals->time ); - COM_Log( "c:\\hl.log", "%.4f ", m_pPlayer->m_flNextAttack ); - COM_Log( "c:\\hl.log", "%.4f ", m_flNextPrimaryAttack ); - COM_Log( "c:\\hl.log", "%.4f ", m_flTimeWeaponIdle - gpGlobals->time); - COM_Log( "c:\\hl.log", "%i ", m_iClip ); -} - /* ===================== HUD_InitClientWeapons @@ -867,7 +851,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm ( ( CRpg * )player.m_pActiveItem)->m_cActiveRockets = (int)from->client.vuser2[ 2 ]; } - // Don't go firing anything if we have died. + // Don't go firing anything if we have died or are spectating // Or if we don't have a weapon model deployed if ( ( player.pev->deadflag != ( DEAD_DISCARDBODY + 1 ) ) && !CL_IsDead() && player.pev->viewmodel && !g_iUser1 ) @@ -1067,8 +1051,10 @@ runfuncs is 1 if this is the first time we've predicted this command. If so, so be ignored ===================== */ -void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed ) +void CL_DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed ) { +// RecClPostRunCmd(from, to, cmd, runfuncs, time, random_seed); + g_runfuncs = runfuncs; #if defined( CLIENT_WEAPONS ) diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index e06b11d..d8a2d85 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -29,9 +29,10 @@ #include "demo.h" #include "demo_api.h" -#include "vgui_scorepanel.h" - +#include "vgui_ScorePanel.h" +hud_player_info_t g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine +extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll class CHLVoiceStatusHelper : public IVoiceStatusHelper { @@ -258,13 +259,27 @@ int __MsgFunc_Spectator(const char *pszName, int iSize, void *pbuf) return 0; } +int __MsgFunc_SpecFade(const char *pszName, int iSize, void *pbuf) +{ + if (gViewPort) + return gViewPort->MsgFunc_SpecFade( pszName, iSize, pbuf ); + return 0; +} + +int __MsgFunc_ResetFade(const char *pszName, int iSize, void *pbuf) +{ + if (gViewPort) + return gViewPort->MsgFunc_ResetFade( pszName, iSize, pbuf ); + return 0; +} + int __MsgFunc_AllowSpec(const char *pszName, int iSize, void *pbuf) { if (gViewPort) return gViewPort->MsgFunc_AllowSpec( pszName, iSize, pbuf ); return 0; } - + // This is called every time the DLL is loaded void CHud :: Init( void ) { @@ -297,6 +312,9 @@ void CHud :: Init( void ) HOOK_MESSAGE( Spectator ); HOOK_MESSAGE( AllowSpec ); + + HOOK_MESSAGE( SpecFade ); + HOOK_MESSAGE( ResetFade ); // VGUI Menus HOOK_MESSAGE( VGUIMenu ); @@ -423,7 +441,8 @@ void CHud :: VidInit( void ) // count the number of sprites of the appropriate res m_iSpriteCount = 0; client_sprite_t *p = m_pSpriteList; - for ( int j = 0; j < m_iSpriteCountAllRes; j++ ) + int j; + for ( j = 0; j < m_iSpriteCountAllRes; j++ ) { if ( p->iRes == m_iRes ) m_iSpriteCount++; diff --git a/cl_dll/hud.h b/cl_dll/hud.h index 7d49e53..be6858b 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -25,6 +25,10 @@ #define RGB_REDISH 0x00FF1010 //255,160,0 #define RGB_GREENISH 0x0000A000 //0,160,0 +#ifndef _WIN32 +#define _cdecl +#endif + #include "wrect.h" #include "cl_dll.h" #include "ammo.h" @@ -40,12 +44,7 @@ typedef struct { int x, y; } POSITION; -enum -{ - MAX_PLAYERS = 64, - MAX_TEAMS = 64, - MAX_TEAM_NAME = 16, -}; +#include "global_consts.h" typedef struct { unsigned char r,g,b,a; @@ -90,7 +89,7 @@ struct HUDLIST { // //----------------------------------------------------- // -#include "..\game_shared\voice_status.h" +#include "voice_status.h" // base voice handling class #include "hud_spectator.h" @@ -203,30 +202,6 @@ private: }; -// -//----------------------------------------------------- -// -// REMOVED: Vgui has replaced this. -// -/* -class CHudMOTD : public CHudBase -{ -public: - int Init( void ); - int VidInit( void ); - int Draw( float flTime ); - void Reset( void ); - - int MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ); - -protected: - static int MOTD_DISPLAY_TIME; - char m_szMOTD[ MAX_MOTD_LENGTH ]; - float m_flActiveRemaining; - int m_iLines; -}; -*/ - // //----------------------------------------------------- // @@ -246,7 +221,7 @@ protected: enum { MAX_STATUSTEXT_LENGTH = 128, MAX_STATUSBAR_VALUES = 8, - MAX_STATUSBAR_LINES = 2, + MAX_STATUSBAR_LINES = 3, }; char m_szStatusText[MAX_STATUSBAR_LINES][MAX_STATUSTEXT_LENGTH]; // a text string describing how the status bar is to be drawn @@ -259,46 +234,13 @@ protected: float *m_pflNameColors[MAX_STATUSBAR_LINES]; }; -// -//----------------------------------------------------- -// -// REMOVED: Vgui has replaced this. -// -/* -class CHudScoreboard: public CHudBase -{ -public: - int Init( void ); - void InitHUDData( void ); - int VidInit( void ); - int Draw( float flTime ); - int DrawPlayers( int xoffset, float listslot, int nameoffset = 0, char *team = NULL ); // returns the ypos where it finishes drawing - void UserCmd_ShowScores( void ); - void UserCmd_HideScores( void ); - int MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf ); - int MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf ); - int MsgFunc_TeamScore( const char *pszName, int iSize, void *pbuf ); - void DeathMsg( int killer, int victim ); - - int m_iNumTeams; - - int m_iLastKilledBy; - int m_fLastKillTime; - int m_iPlayerNum; - int m_iShowscoresHeld; - - void GetAllPlayersInfo( void ); -private: - struct cvar_s *cl_showpacketloss; - -}; -*/ - struct extra_player_info_t { short frags; short deaths; short playerclass; + short health; // UNUSED currently, spectator UI would like this + bool dead; // UNUSED currently, spectator UI would like this short teamnumber; char teamname[MAX_TEAM_NAME]; }; @@ -317,11 +259,7 @@ struct team_info_t int teamnumber; }; -extern hud_player_info_t g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine -extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll -extern team_info_t g_TeamInfo[MAX_TEAMS+1]; -extern int g_IsSpectator[MAX_PLAYERS+1]; - +#include "player_info.h" // //----------------------------------------------------- @@ -398,6 +336,7 @@ private: wrect_t *m_prc1; wrect_t *m_prc2; int m_iBat; + int m_iBatMax; float m_fFade; int m_iHeight; // width of the battery innards }; @@ -476,6 +415,7 @@ public: int VidInit( void ); int Draw(float flTime); int MsgFunc_HudText(const char *pszName, int iSize, void *pbuf); + int MsgFunc_HudTextPro(const char *pszName, int iSize, void *pbuf); int MsgFunc_GameTitle(const char *pszName, int iSize, void *pbuf); float FadeBlend( float fadein, float fadeout, float hold, float localTime ); @@ -542,7 +482,60 @@ private: // //----------------------------------------------------- // +class CHudBenchmark : public CHudBase +{ +public: + int Init( void ); + int VidInit( void ); + int Draw( float flTime ); + void SetScore( float score ); + + void Think( void ); + + void StartNextSection( int section ); + + int MsgFunc_Bench(const char *pszName, int iSize, void *pbuf); + + void CountFrame( float dt ); + + int GetObjects( void ) { return m_nObjects; }; + + void SetCompositeScore( void ); + + void Restart( void ); + + int Bench_ScoreForValue( int stage, float raw ); + +private: + float m_fDrawTime; + float m_fDrawScore; + float m_fAvgScore; + + float m_fSendTime; + float m_fReceiveTime; + + int m_nFPSCount; + float m_fAverageFT; + float m_fAvgFrameRate; + + int m_nSentFinish; + float m_fStageStarted; + + float m_StoredLatency; + float m_StoredPacketLoss; + int m_nStoredHopCount; + int m_nTraceDone; + + int m_nObjects; + + int m_nScoreComputed; + int m_nCompositeScore; +}; + +// +//----------------------------------------------------- +// class CHud @@ -617,6 +610,7 @@ public: CHudAmmoSecondary m_AmmoSecondary; CHudTextMessage m_TextMessage; CHudStatusIcons m_StatusIcons; + CHudBenchmark m_Benchmark; void Init( void ); void VidInit( void ); @@ -654,10 +648,7 @@ public: }; -class TeamFortressViewport; - extern CHud gHUD; -extern TeamFortressViewport *gViewPort; extern int g_iPlayerClass; extern int g_iTeamNumber; diff --git a/cl_dll/hud_bench.cpp b/cl_dll/hud_bench.cpp new file mode 100644 index 0000000..ed850d2 --- /dev/null +++ b/cl_dll/hud_bench.cpp @@ -0,0 +1,1129 @@ +// +//----------------------------------------------------- +// +#define BENCH_TIME 10.0 + +#include "hud.h" +#include "cl_util.h" + +#include "const.h" +#include "entity_state.h" +#include "cl_entity.h" +#include "usercmd.h" +#include "pm_defs.h" +#include "event_api.h" + +#include "bench.h" + +#include +#include +#include "parsemsg.h" + +#include "con_nprint.h" + +#include "netadr.h" +#include "hud_benchtrace.h" + +#include "net_api.h" + +#include "entity_types.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h +#endif + +#define NUM_BENCH_OBJ 12 +#define BENCH_CYCLE_TIME 10.0 +#define BENCH_INNER_CYCLE_TIME 4.0 +#define BENCH_VIEW_CYCLE_TIME 7.1 +#define BENCH_SWEEP 360.0 +#define BENCH_RADIUS 80.0 +#define BENCH_VIEW_OFFSET 250.0 +#define BLEND_IN_SPEED 150.0 +#define BENCH_BALLHEIGHT 72.0 +#define BENCH_BALL_VIEWDRIFT 60.0; +#define BENCH_RANGE 60.0 +// Scale: +// 0 - 100 +// 0 is worst +// 100 is best +// PP has 40 - 100 range +// Non-pp has 0 - 60 range +const float weights[3] = { 0.2, 0.3, 0.5 }; + +const char *g_title = "PowerPlay QoS Test"; //uality of Service Test"; +const char *pp_strings[2] = +{ + " PowerPlay Detected", + " PowerPlay Not Detected" , +}; +const char *g_stage1[2] = +{ + " Stage 1: Testing System Connectivity...", + " Stage 1: %i", +}; +const char *g_stage2[2] = +{ + " Stage 2: Testing System Performance...", + " Stage 2: %i", +}; +const char *g_stage3[2] = +{ + " Stage 3: Testing Tracking Accuracy...", + " Stage 3: %i", +}; +const char *g_stage4 = " Composite Score: %i"; + +extern vec3_t v_origin; + +static int g_isPowerPlay = 0; +static int g_currentstage = 0; +static int g_renderedBenchmarkDot = 0; +static float g_benchSwitchTime = 0.0; +static float g_benchSwitchTimes[ LAST_STAGE + 1 ] = { 0.0, 10.0, 12.0, 10.0, 5.0 }; + +#define SCORE_TIME_UP 1.5 + +DECLARE_MESSAGE(m_Benchmark, Bench); + +void VectorAngles( const float *forward, float *angles ); + +void Bench_SetStage( int stage ) +{ + g_currentstage = stage; +} + +int Bench_GetStage( void ) +{ + return g_currentstage; +} + +float Bench_GetSwitchTime( void ) +{ + return g_benchSwitchTimes[ min( Bench_GetStage(), LAST_STAGE ) ]; +} + +int Bench_InStage( int stage ) +{ + return ( Bench_GetStage() == stage ) ? 1 : 0; +} + +void Bench_SetPowerPlay( int set ) +{ + g_isPowerPlay = set ? 1 : 0; +} + +int Bench_GetPowerPlay( void ) +{ + return g_isPowerPlay; +} + +int Bench_Active( void ) +{ + return g_currentstage != 0 ? 1 : 0; +} + +void __CmdFunc_BenchMark( void ) +{ + gHUD.m_Benchmark.Restart(); +} + + +void CHudBenchmark::Restart( void ) +{ + Bench_SetStage( FIRST_STAGE ); + g_benchSwitchTime = gHUD.m_flTime + g_benchSwitchTimes[ FIRST_STAGE ]; + StartNextSection( FIRST_STAGE ); + + gHUD.m_Benchmark.m_iFlags |= HUD_ACTIVE; + gHUD.m_Benchmark.m_fDrawTime = gHUD.m_flTime + BENCH_TIME; +} + +int CHudBenchmark::MsgFunc_Bench(const char *pszName, int iSize, void *pbuf) +{ + int section = READ_BYTE(); + + m_fReceiveTime = gHUD.m_flTime; + m_StoredLatency = ( m_fReceiveTime - m_fSendTime ); + + m_StoredLatency = min( 1.0, m_StoredLatency ); + m_StoredLatency = max( 0.0, m_StoredLatency ); + + m_StoredPacketLoss = 0.0; + + { + char sz[ 256 ]; + netadr_t adr; + net_status_t status; + + gEngfuncs.pNetAPI->Status( &status ); + + if ( status.connected ) + { + adr = status.remote_address; + + sprintf( sz, "%i.%i.%i.%i", + adr.ip[ 0 ], adr.ip[ 1 ], adr.ip[ 2 ], adr.ip[ 3 ] ); + + if ( adr.type == NA_IP ) + { + Trace_StartTrace( &m_nStoredHopCount, &m_nTraceDone, (const char *)sz ); + } + else + { + m_nStoredHopCount = 0; + } + } + } + + return 1; +} + +void CHudBenchmark::StartNextSection( int section ) +{ + net_status_t status; + + switch ( section ) + { + case 1: + // Stage 2 requires that we tell the server to "drop" an item + m_fSendTime = gHUD.m_flTime; + m_fReceiveTime = 0.0; + m_StoredLatency = 0.0; + m_StoredPacketLoss = 0.0; + m_nStoredHopCount = 0; + m_nTraceDone = 0; + ServerCmd( "ppdemo 1 start\n" ); + break; + case 2: + if ( m_nTraceDone ) + { + gEngfuncs.pNetAPI->Status( &status ); + + gEngfuncs.Con_Printf( "Hops == %i\n", m_nStoredHopCount ); + m_StoredPacketLoss = status.packet_loss; + gEngfuncs.Con_Printf( "PL == %i\n", (int)m_StoredPacketLoss ); + + } + m_nSentFinish = 0; // added by minman + ServerCmd( "ppdemo 2\n" ); + break; + case 3: + m_nSentFinish = 0; // added by minman + ServerCmd( "ppdemo 3\n" ); + break; + default: + break; + } + + m_fStageStarted = gHUD.m_flTime; + g_benchSwitchTime = gHUD.m_flTime + Bench_GetSwitchTime(); +} + +void CHudBenchmark::CountFrame( float dt ) +{ + m_nFPSCount++; + m_fAverageFT += dt; +} + + +static int started = 0; + +void Bench_CheckStart( void ) +{ + const char *level; + if ( !started && !Bench_Active() ) + { + level = gEngfuncs.pfnGetLevelName(); + if ( level && level[0] && !stricmp( level, "maps/ppdemo.bsp" ) ) + { + started = 1; + EngineClientCmd( "ppdemostart\n" ); + } + } +} + +void CHudBenchmark::Think( void ) +{ + if ( !Bench_Active() ) + return; + + Trace_Think(); + + if ( started ) + { + started = 0; + + // Clear variable + m_fReceiveTime = 0.0; + m_nFPSCount = 0; + m_fAverageFT = 0.0; + m_nSentFinish = 0; + m_StoredLatency = 0.0; + m_StoredPacketLoss = 0.0; + m_nStoredHopCount = 0; + m_nTraceDone = 0; + m_nObjects = 0; + m_nScoreComputed = 0; + m_nCompositeScore = 0; + m_fAvgScore = 0; + m_fDrawScore = 0.0; + m_fAvgFrameRate = 0.0; + } + + if ( gHUD.m_flTime > g_benchSwitchTime ) + { + Bench_SetStage( Bench_GetStage() + 1 ); + StartNextSection( Bench_GetStage() ); + } + + if ( Bench_InStage( FIRST_STAGE ) ) + { + // Assume 1000 ms lag is the max and that would take all but 2 seconds of this interval to traverse + if ( m_fReceiveTime ) + { + float latency = 2.0 * m_StoredLatency; + float switch_time; + float total_time; + + latency = max( 0.0, latency ); + latency = min( 1.0, latency ); + + total_time = Bench_GetSwitchTime(); + total_time -= 2.0; + + switch_time = m_fStageStarted + latency * total_time; + switch_time += 1.0; + + if ( gHUD.m_flTime >= switch_time ) + { + if ( !m_nSentFinish ) + { + g_benchSwitchTime = gHUD.m_flTime + 1.0 + SCORE_TIME_UP; + + ServerCmd( "ppdemo 1 finish\n" ); + m_nSentFinish = 1; + } + } + else + { + g_benchSwitchTime = gHUD.m_flTime + 10.0; + } + } + } + + if ( Bench_InStage( SECOND_STAGE ) ) + { + // frametime + static float lasttime; + float elapsed; + float total; + float frac; + float switch_time; // added by minman + + if ( lasttime ) + { + float dt; + + dt = gHUD.m_flTime - lasttime; + if ( dt > 0 ) + { + CountFrame( dt ); + } + } + lasttime = gHUD.m_flTime; + + elapsed = gHUD.m_flTime - m_fStageStarted; + total = Bench_GetSwitchTime(); + if ( total ) + { + frac = elapsed / total; + + // Only takes 1/2 time to get up to maximum speed + frac *= 2.0; + frac = max( 0.0, frac ); + frac = min( 1.0, frac ); + + m_nObjects = (int)(NUM_BENCH_OBJ * frac); + } + switch_time = m_fStageStarted + total; + + /* BELOW ADDED BY minman */ + if (gHUD.m_flTime >= switch_time) + { + if ( !m_nSentFinish) + { + g_benchSwitchTime = gHUD.m_flTime + SCORE_TIME_UP; + m_nSentFinish = 1; + } + } + else + g_benchSwitchTime = gHUD.m_flTime + 10.0; + } + + /* BELOW ADDED BY minman */ + if ( Bench_InStage (THIRD_STAGE)) + { + float switch_time = m_fStageStarted + Bench_GetSwitchTime(); + + if (gHUD.m_flTime >= switch_time) + { + if ( !m_nSentFinish) + { + g_benchSwitchTime = gHUD.m_flTime + SCORE_TIME_UP; + m_nSentFinish = 1; + } + } + else + g_benchSwitchTime = gHUD.m_flTime + 10.0; + } + + if ( Bench_InStage( FOURTH_STAGE ) ) + { + if ( !m_nScoreComputed ) + { + m_nScoreComputed = 1; + gHUD.m_Benchmark.SetCompositeScore(); + } + } + + if ( Bench_GetStage() > LAST_STAGE ) + { + m_iFlags &= ~HUD_ACTIVE; + EngineClientCmd( "quit\n" ); + } +} + + +int CHudBenchmark::Init( void ) +{ + gHUD.AddHudElem( this ); + + HOOK_COMMAND( "ppdemostart", BenchMark ); + + HOOK_MESSAGE(Bench); + + return 1; +} + +int CHudBenchmark::VidInit( void ) +{ + return 1; +} + +int CHudBenchmark::Bench_ScoreForValue( int stage, float raw ) +{ + int score = 100.0; + int power_play = Bench_GetPowerPlay() ? 1 : 0; + + switch ( stage ) + { + case 1: // ping + score = 100.0 * ( m_StoredLatency ); + score = max( score, 0 ); + score = min( score, 100 ); + + // score is inverted + score = 100 - score; + + break; + case 2: // framerate/performance + score = (int)( 100 * m_fAvgFrameRate ) / 72; + score = min( score, 100 ); + score = max( score, 0 ); + + score *= BENCH_RANGE/100.0; + if ( power_play ) + { + score += ( 100 - BENCH_RANGE ); + } + break; + case 3: // tracking + score = (100 * m_fAvgScore) / 40; + score = max( score, 0 ); + score = min( score, 100 ); + + // score is inverted + score = 100 - score; + + score *= BENCH_RANGE/100.0; + if ( power_play ) + { + score += ( 100 - BENCH_RANGE ); + } + break; + } + + return score; +} + +void CHudBenchmark::SetCompositeScore( void ) +{ + int tracking_score = Bench_ScoreForValue( THIRD_STAGE, m_fAvgScore ); + int ping_score = Bench_ScoreForValue( FIRST_STAGE, m_StoredLatency ); + int frame_score = Bench_ScoreForValue( SECOND_STAGE, m_fAvgFrameRate ); + + int composite = ( ping_score * weights[ 0 ] + frame_score * weights[ 1 ] + tracking_score * weights[ 2 ] ); + + composite = min( 100, composite ); + composite = max( 0, composite ); + + m_nCompositeScore = composite; +} + +int CHudBenchmark::Draw( float flTime ) +{ + char sz[ 256 ]; + int x, y; + + if ( m_fDrawTime < flTime || !Bench_Active() ) + { + m_iFlags &= ~HUD_ACTIVE; + return 1; + } + + x = 10; + y = 25; //480 - 150; + + sprintf( sz, "%s: %s", g_title , pp_strings[ Bench_GetPowerPlay() ? 0 : 1]); + + gHUD.DrawHudString( x, y, 320, sz, 251, 237, 7);// , 200, 200); //255, 255, 255 ); + + y += 20; + +// sprintf( sz, pp_strings[ Bench_GetPowerPlay() ? 0 : 1 ] ); + +// gHUD.DrawHudString( x, y, 320, sz, 31, 200, 200 ); + +// y += 20; + + + if ( Bench_InStage( FIRST_STAGE) /*|| Bench_InStage( SECOND_STAGE ) || Bench_InStage( THIRD_STAGE )*/ || Bench_InStage( FOURTH_STAGE ) ) + { + if ( m_fReceiveTime && m_nSentFinish ) + { + sprintf( sz, g_stage1[1], Bench_ScoreForValue( FIRST_STAGE, m_StoredLatency )); + } + else + { + sprintf( sz, g_stage1[0] ); + } + gHUD.DrawHudString( x, y, 320, sz, 255, 255, 255 ); + + y += 20; + + } + + + if ( Bench_InStage( SECOND_STAGE )/* || Bench_InStage( THIRD_STAGE )*/ || Bench_InStage( FOURTH_STAGE ) ) + { + float avg = 0.0; + + if ( m_nFPSCount > 0 ) + { + avg = m_fAverageFT / (float)m_nFPSCount; + m_fAvgFrameRate = 1.0 / avg; + } + + if ( m_nSentFinish /* Bench_InStage( THIRD_STAGE ) */|| Bench_InStage( FOURTH_STAGE ) ) + { + sprintf( sz, g_stage2[1], Bench_ScoreForValue( SECOND_STAGE, m_fAvgFrameRate ) ); + } + else + { + sprintf( sz, g_stage2[0] ); + } + gHUD.DrawHudString( x, y, 320, sz, 255, 255, 255 ); + y += 20; + } + + + if ( Bench_InStage( THIRD_STAGE ) || Bench_InStage( FOURTH_STAGE ) ) + { + if ( m_nSentFinish || Bench_InStage( FOURTH_STAGE ) ) + { + sprintf( sz, g_stage3[1], Bench_ScoreForValue( THIRD_STAGE, m_fAvgScore ) ); + } + else + { + sprintf( sz, g_stage3[0] ); + } + + gHUD.DrawHudString( x, y, 320, sz, 255, 255, 255 ); + + y += 20; + } + + if ( Bench_InStage( FOURTH_STAGE ) ) + { + sprintf( sz, g_stage4, m_nCompositeScore ); + gHUD.DrawHudString( x, y, 320, sz, 31, 200, 200 ); + } + + m_fDrawTime = gHUD.m_flTime + BENCH_TIME; + + return 1; +} + +#define SCORE_AVG 0.9 + +void CHudBenchmark::SetScore( float score ) +{ + // added by minman + if (m_nSentFinish) + return; + + m_fDrawScore = score; + m_fDrawTime = gHUD.m_flTime + BENCH_TIME; + + m_fAvgScore = ( SCORE_AVG ) * m_fAvgScore + ( 1.0 - SCORE_AVG ) * m_fDrawScore; +} + +void Bench_SetDotAdded( int dot ) +{ + g_renderedBenchmarkDot = dot; +} + +int Bench_GetDotAdded( void ) +{ + return g_renderedBenchmarkDot; +} + +void Bench_SpotPosition( vec3_t dot, vec3_t target ) +{ + // Compute new score + vec3_t delta; + + VectorSubtract( target, dot, delta ); + + gHUD.m_Benchmark.SetScore( delta.Length() ); +} + +typedef struct model_s +{ + char name[64]; + qboolean needload; // bmodels and sprites don't cache normally + + int type; + int numframes; + int synctype; + + int flags; + +// +// volume occupied by the model +// + vec3_t mins, maxs; +} model_t; + +static vec3_t g_dotorg; +vec3_t g_aimorg; +float g_fZAdjust = 0.0; + +void Bench_CheckEntity( int type, struct cl_entity_s *ent, const char *modelname ) +{ + if ( Bench_InStage( THIRD_STAGE ) && !stricmp( modelname, "*3" ) ) + { + model_t *pmod; + vec3_t v; + pmod = (model_t *)( ent->model ); + + VectorAdd( pmod->mins, pmod->maxs, v ); + VectorScale( v, 0.5, v ); + + VectorAdd( v, ent->origin, g_aimorg ); + } + + if ( Bench_InStage( THIRD_STAGE ) && strstr( modelname, "ppdemodot" ) ) + { + Bench_SetDotAdded( 1 ); + VectorCopy( ent->origin, g_dotorg ); + + // Adjust end position + if ( Bench_Active() && Bench_InStage( THIRD_STAGE ) ) + { + static float fZAdjust = 0.0; + static float fLastTime; + float dt; + float fRate = Bench_GetPowerPlay() ? 4.0 : 8.0; + float fBounds = Bench_GetPowerPlay() ? 8.0 : 15.0; + + dt = gHUD.m_flTime - fLastTime; + if ( dt > 0.0 && dt < 1.0 ) + { + fZAdjust += gEngfuncs.pfnRandomFloat( -fRate, fRate ); + fZAdjust = min( fBounds, fZAdjust ); + fZAdjust = max( -fBounds, fZAdjust ); + + ent->origin[2] += fZAdjust; + + g_fZAdjust = fZAdjust; + } + fLastTime = gHUD.m_flTime; + } + } +} + + +void NormalizeVector( vec3_t v ) +{ + int i; + for ( i = 0; i < 3; i++ ) + { + while ( v[i] < -180.0 ) + { + v[i] += 360.0; + } + + while ( v[i] > 180.0 ) + { + v[i] -= 360.0; + } + } +} + +float g_flStartTime; +int HUD_SetupBenchObjects( cl_entity_t *bench, int plindex, vec3_t origin ) +{ + int i, j; + vec3_t ang; + float offset; + struct model_s *mdl; + int index; + vec3_t forward, right, up; + vec3_t farpoint; + vec3_t centerspot; + pmtrace_t tr; + + ang = vec3_origin; + //ang[1] = 90.0; + + // Determine forward vector + AngleVectors ( ang, forward, right, up ); + + // Try to find the laserdot sprite model and retrieve the modelindex for it + mdl = gEngfuncs.CL_LoadModel( "models/spikeball.mdl", &index ); + if ( !mdl ) + return 0; + + gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true ); + + // Store off the old count + gEngfuncs.pEventAPI->EV_PushPMStates(); + + // Now add in all of the players. + gEngfuncs.pEventAPI->EV_SetSolidPlayers ( plindex ); + + gEngfuncs.pEventAPI->EV_SetTraceHull( 2 ); + + centerspot = origin; + centerspot[2] -= 512; + + gEngfuncs.pEventAPI->EV_PlayerTrace( (float *)&origin, (float *)¢erspot, PM_NORMAL, -1, &tr ); + + centerspot = tr.endpos; + centerspot[2] += BENCH_BALLHEIGHT; + + // Move center out from here + centerspot = centerspot + BENCH_VIEW_OFFSET * forward; + + g_flStartTime = gHUD.m_flTime; + + for ( i = 0; i < NUM_BENCH_OBJ; i++ ) + { + offset = ( float ) i / (float) ( NUM_BENCH_OBJ - 1 ); + + ang[ 0 ] = 0; + ang[ 2 ] = 0; + ang[ 1 ] = BENCH_SWEEP * offset; + + // normalize + NormalizeVector( ang ); + + // Determine forward vector + AngleVectors ( ang, forward, right, up ); + + bench[ i ].model = mdl; + + bench[ i ].curstate.modelindex = index; + + // Set up dot info. + bench[ i ].curstate.movetype = MOVETYPE_NONE; + bench[ i ].curstate.solid = SOLID_NOT; + + // Get a far point for ray trace + farpoint = centerspot + BENCH_RADIUS * forward; + + gEngfuncs.pEventAPI->EV_PlayerTrace( (float *)¢erspot, (float *)&farpoint, PM_NORMAL, -1, &tr ); + + // Move dot to trace endpoint + bench[ i ].origin = tr.endpos; + bench[ i ].curstate.origin = bench[ i ].origin; + //bench[ i ].curstate.gravity = 0.5; + for ( j = 0; j < 2; j++ ) + { + // bench[ i ].curstate.velocity[ j ] = gEngfuncs.pfnRandomLong( -300, 300 ); + } + //bench[ i ].curstate.velocity[ 2 ] = gEngfuncs.pfnRandomLong( 0, 50 ); + bench[ i ].curstate.velocity = vec3_origin; + + bench[ i ].curstate.angles[ 2 ] = 0.0; + bench[ i ].curstate.angles[ 0 ] = 0.0; + bench[ i ].curstate.angles[ 1 ] = 0.0; // gEngfuncs.pfnRandomLong( -180, 180 ); + + for ( j = 0; j < 3; j++ ) + { + // angular velocity + bench[ i ].baseline.angles[ 0 ] = gEngfuncs.pfnRandomLong( -300, 300 ); + //bench[ i ].baseline.angles[ 0 ] = 0; + bench[ i ].baseline.angles[ 2 ] = 0; + bench[ i ].baseline.angles[ 1 ] = gEngfuncs.pfnRandomLong( -300, 300 ); + } + + bench[ i ].curstate.renderamt = 0; + + // Force no interpolation, etc., probably not necessary + bench[ i ].prevstate = bench[ i ].curstate; + } + + gEngfuncs.pEventAPI->EV_PopPMStates(); + + return 1; +} + +void HUD_CreateBenchObjects( vec3_t origin ) +{ + static cl_entity_t bench[ NUM_BENCH_OBJ ]; + cl_entity_t *player; + vec3_t forward, right, up; + vec3_t farpoint; + vec3_t centerspot; + static int first = true; + static int failed = false; + static float last_time; + float frametime; + float frac; + float frac2; + float dt; + + pmtrace_t tr; + int i = 0; + + if ( gHUD.m_flTime == last_time ) + return; + + frametime = gHUD.m_flTime - last_time; + last_time = gHUD.m_flTime; + + if ( frametime <= 0.0 ) + return; + + if ( failed ) + return; + + player = gEngfuncs.GetLocalPlayer(); + if ( !player ) + { + failed = true; + return; + } + + if ( first ) + { + first = false; + + if ( !HUD_SetupBenchObjects( bench, player->index - 1, origin ) ) + { + failed = true; + return; + } + } + + gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true ); + + // Store off the old count + gEngfuncs.pEventAPI->EV_PushPMStates(); + + // Now add in all of the players. + gEngfuncs.pEventAPI->EV_SetSolidPlayers ( player->index - 1 ); + + gEngfuncs.pEventAPI->EV_SetTraceHull( 2 ); + + dt = gHUD.m_flTime - g_flStartTime; + if ( dt < 0 ) + return; + + frac = dt / BENCH_CYCLE_TIME; + if ( frac > 1.0 ) + { + frac = frac - (float)(int)frac; + } + + frac2 = dt /BENCH_INNER_CYCLE_TIME; + if ( frac2 > 1.0 ) + { + frac2 = frac2 - (float)(int)frac2; + } + + // Determine forward vector + AngleVectors ( vec3_origin, forward, right, up ); + + centerspot = origin; + centerspot[2] -= 512; + + gEngfuncs.pEventAPI->EV_PlayerTrace( (float *)&origin, (float *)¢erspot, PM_NORMAL, -1, &tr ); + + centerspot = tr.endpos; + centerspot[2] += BENCH_BALLHEIGHT; + + // Move center out from here + centerspot = centerspot + BENCH_VIEW_OFFSET * forward; + + for ( i = 0; i < NUM_BENCH_OBJ; i++ ) + { + int j; + float jitter = 0.0; + float jfrac; + float offset; + float ofs_radius = 5.0; + + vec3_t ang; + offset = ( float ) i / (float) ( NUM_BENCH_OBJ - 1 ); + + ang[ 0 ] = 0; + ang[ 2 ] = 0; + ang[ 1 ] = BENCH_SWEEP * offset + frac * 360.0; + // normalize + NormalizeVector( ang ); + + // Determine forward vector + AngleVectors ( ang, forward, right, up ); + + // Get a far point for ray trace + farpoint = centerspot + ( BENCH_RADIUS + ofs_radius * sin( BENCH_SWEEP * offset + frac2 * 2 * M_PI ) ) * forward; + farpoint[2] += 10 * cos( BENCH_SWEEP * offset + frac2 * 2 * M_PI ); + + gEngfuncs.pEventAPI->EV_PlayerTrace( (float *)¢erspot, (float *)&farpoint, PM_NORMAL, -1, &tr ); + + // Add angular velocity + VectorMA( bench[ i ].curstate.angles, frametime, bench[ i ].baseline.angles, bench[ i ].curstate.angles ); + + NormalizeVector( bench[ i ].curstate.angles ); + + jfrac = ( (float)gHUD.m_Benchmark.GetObjects() / (float)NUM_BENCH_OBJ ); + + // Adjust velocity + //bench[ i ].curstate.velocity[ 2 ] -= bench[ i ].curstate.gravity * frametime * 800; + + /* + // Did we hit something? + if ( tr.fraction != 1.0 && !tr.inwater ) + { + float damp; + float proj; + vec3_t traceNormal; + int j; + + traceNormal = tr.plane.normal; + + damp = 0.9; + + // Reflect velocity + if ( damp != 0 ) + { + proj = DotProduct( bench[ i ].curstate.velocity, traceNormal ); + VectorMA( bench[ i ].curstate.velocity, -proj*2, traceNormal, bench[ i ].curstate.velocity ); + // Reflect rotation (fake) + + for ( j = 0 ; j < 3; j++ ) + { + if ( bench[ i ].curstate.velocity[ j ] > 1000.0 ) + { + bench[ i ].curstate.velocity[ j ] = 1000.0; + } + else if ( bench[ i ].curstate.velocity[ j ] < -1000.0 ) + { + bench[ i ].curstate.velocity[ j ] = -1000.0; + } + } + + bench[ i ].baseline.angles[1] = -bench[ i ].baseline.angles[1]; + + VectorScale( bench[ i ].curstate.velocity, damp, bench[ i ].curstate.velocity ); + } + } + */ + + if ( i == ( NUM_BENCH_OBJ - 1 ) ) + { + g_aimorg = tr.endpos; + } + + if ( Bench_GetPowerPlay() ) + { + jitter = 0.5; + } + else + { + jitter = 8.0; + } + + jitter *= jfrac; + + for ( j = 0; j < 2; j++ ) + { + tr.endpos[ j ] += gEngfuncs.pfnRandomFloat( -jitter, jitter ); + } + + // Add to visedicts list for rendering + // Move dot to trace endpoint + bench[ i ].origin = tr.endpos; + bench[ i ].curstate.origin = bench[ i ].origin; + bench[ i ].angles = bench[ i ].curstate.angles; + + // Force no interpolation, etc., probably not necessary + bench[ i ].prevstate = bench[ i ].curstate; + + if ( ( NUM_BENCH_OBJ - i - 1 ) < gHUD.m_Benchmark.GetObjects() ) + { + if ( bench[ i ].curstate.renderamt == 255 ) + { + bench[i].curstate.rendermode = kRenderNormal; + } + else + { + bench[i].curstate.renderamt += BLEND_IN_SPEED * frametime; + bench[i].curstate.renderamt = min( 255, bench[i].curstate.renderamt ); + bench[i].curstate.rendermode = kRenderTransAlpha; + } + + gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &bench[ i ] ); + } + } + + gEngfuncs.pEventAPI->EV_PopPMStates(); +} + +void Bench_AddObjects( void ) +{ + if ( Bench_GetDotAdded() ) + { + Bench_SpotPosition( g_dotorg, g_aimorg ); + Bench_SetDotAdded( 0 ); + } + + if ( Bench_InStage( SECOND_STAGE ) ) + { + HUD_CreateBenchObjects( v_origin ); + } +} + + +static vec3_t v_stochastic; + +void Bench_SetViewAngles( int recalc_wander, float *viewangles, float frametime, struct usercmd_s *cmd ) +{ + if ( !Bench_Active() ) + return; + + int i; + vec3_t lookdir; + + // Clear stochastic offset between runs + if ( Bench_InStage( FIRST_STAGE ) ) + { + VectorCopy( vec3_origin, v_stochastic ); + } + + if ( Bench_InStage( SECOND_STAGE ) || Bench_InStage( THIRD_STAGE ) ) + { + VectorSubtract( g_aimorg, v_origin, lookdir ); + VectorNormalize( lookdir ); + VectorAngles( (float *)&lookdir, viewangles ); + + viewangles[0] = -viewangles[0]; + + /* + if ( recalc_wander ) + { + float fmag = 2.0; + if ( Bench_GetPowerPlay() ) + { + fmag = 10.0; + } + + for ( i = 0; i < 2; i++ ) + { + v_stochastic[ i ] += frametime * gEngfuncs.pfnRandomFloat( -fmag, fmag ); + v_stochastic[ i ] = max( -15.0, v_stochastic[ i ] ); + v_stochastic[ i ] = min( 15.0, v_stochastic[ i ] ); + } + + v_stochastic[ 2 ] = 0.0; + } + */ + + VectorAdd( viewangles, v_stochastic, viewangles ); + + for ( i = 0; i < 3; i++ ) + { + if ( viewangles[ i ] > 180 ) + viewangles[ i ] -= 360; + if ( viewangles[ i ] < -180 ) + viewangles[ i ] += 360; + } + } + else + { + VectorCopy( vec3_origin, viewangles ) + + if ( Bench_InStage( FIRST_STAGE ) ) + { + viewangles[ 1 ] = -90; + } + } + + if ( cmd ) + { + if ( Bench_InStage( THIRD_STAGE ) ) + { + cmd->buttons = IN_ATTACK; + } + else + { + cmd->buttons = 0; + } + } +} + +void Bench_SetViewOrigin( float *vieworigin, float frametime ) +{ + float dt; + float frac; + float offset_amt = BENCH_BALL_VIEWDRIFT; + float drift; + vec3_t ang, right; + vec3_t move; + + if ( !Bench_InStage( SECOND_STAGE ) ) + return; + + dt = gHUD.m_flTime - g_flStartTime; + if ( dt < 0 ) + return; + + frac = dt / BENCH_VIEW_CYCLE_TIME; + frac *= 2 * M_PI; + + drift = sin( frac ) * offset_amt; + + ang = vec3_origin; + + AngleVectors( ang, NULL, right, NULL ); + + // offset along right axis + move = right * drift; + + VectorAdd( vieworigin, move, vieworigin ); +} + diff --git a/cl_dll/hud_benchtrace.cpp b/cl_dll/hud_benchtrace.cpp new file mode 100644 index 0000000..03ce866 --- /dev/null +++ b/cl_dll/hud_benchtrace.cpp @@ -0,0 +1,236 @@ +// hud_benchtrace.cpp +// Functions for spawning a thread to get a hopcount to a particular ip address and returning the result in a specified +// variable + +#ifdef _WIN32 +#include "winsani_in.h" +#include +#include "winsani_out.h" +#else +#include "port.h" +#include +#endif + +// For tracking the trace threads +typedef struct +{ + // Inputs + char server[ 256 ]; + + // Outputs + int *p_nresults; + int *p_ndone; + + // Local variables + DWORD hThreadId; + HANDLE hThread; + HANDLE hEventDone; +} trace_params_t; + +// Static forces it to be zeroed out +static trace_params_t tp; + +// For doing the actual traceroute +struct trace_options_s +{ + unsigned char ucTTL; + unsigned char a[7]; +}; + +struct +{ + DWORD dwAddress; + unsigned long ulStatus, ulRoundTripTime; + unsigned char a[8]; + struct trace_options_s Options; +} traceReturn; + +/* +============== +Trace_GetHopCount + +Performs a synchronous hopcount on the specified server +============== +*/ +int Trace_GetHopCount( char *pServer, int nMaxHops ) +{ +#ifdef _WIN32 + HMODULE hICMP; // Handle to ICMP .dll + HANDLE hIP; // Handle to icmp session + DWORD *dwIPAddr; // remote IP Address as a DWORD + struct hostent *pHostEnt; // Name of remote host + struct trace_options_s traceOptions; // Input options + int c; // Hop counter + + // Prototypes + HANDLE ( WINAPI *pfnICMPCreateFile ) ( VOID ); + BOOL ( WINAPI *pfnICMPCloseFile ) ( HANDLE ); + DWORD (WINAPI *pfnICMPSendEcho) ( HANDLE, DWORD, LPVOID, WORD, LPVOID, LPVOID, DWORD, DWORD ); + + hICMP = ::LoadLibrary( "ICMP.DLL" ); + + pfnICMPCreateFile = ( HANDLE ( WINAPI *)(VOID ) )::GetProcAddress( hICMP,"IcmpCreateFile"); + pfnICMPCloseFile = ( BOOL ( WINAPI *) ( HANDLE ) )::GetProcAddress( hICMP,"IcmpCloseHandle"); + pfnICMPSendEcho = ( DWORD ( WINAPI * ) ( HANDLE, DWORD, LPVOID, WORD, LPVOID, LPVOID, DWORD,DWORD ) )::GetProcAddress( hICMP,"IcmpSendEcho" ); + + if ( !pfnICMPCreateFile || + !pfnICMPCloseFile || + !pfnICMPSendEcho ) + { + return -1; + } + + hIP = pfnICMPCreateFile(); + if ( !hIP ) + { + return -1; + } + + // DNS lookup on remote host + pHostEnt = gethostbyname( pServer ); + if ( !pHostEnt ) + { + return -1; + } + + // Take first IP address returned + dwIPAddr = ( DWORD * )( *pHostEnt->h_addr_list ); + + // Fixme: If not tracing, can use a "binary search" method to do the trace route + for ( c = 1; c <= nMaxHops ; c++) + { + // Set TTL correctly + traceOptions.ucTTL = (unsigned char)c; + + // Clear out return structure + memset( &traceReturn, 0, sizeof( traceReturn ) ); + + // Send echo request, 2000 milliseconds maximum waiting time + pfnICMPSendEcho ( hIP, *dwIPAddr, 0, 0, &traceOptions, &traceReturn, sizeof(traceReturn), 2000 ); + + // Found requrested remote address, c contains the correct hopcount + if ( traceReturn.dwAddress == *dwIPAddr ) + break; + } + + /* + // This is how you do a raw ping + npings = 1; + pfnICMPSendEcho( hIP, *dwIPAddr, 0, 0, NULL, &E, sizeof( E ), 2000 ); + *ping = (double)E.RoundTripTime / 1000.0; + */ + + // Clean up file and dll handles + pfnICMPCloseFile( hIP ); + + ::FreeLibrary( hICMP ); + + // Failure? + if ( c > nMaxHops ) + { + return -1; + } + + return c; +#else + return -1; +#endif +} + +/* +============== +Trace_Cleanup + +Destroys thread and event handle when trace is done, or when restarting a new trace +============== +*/ +void Trace_Cleanup( void ) +{ +#ifdef _WIN32 + if ( tp.hThread ) + { + TerminateThread( tp.hThread, 0 ); + CloseHandle( tp.hThread ); + tp.hThread = (HANDLE)0; + } + + if ( tp.hEventDone ) + { + CloseHandle( tp.hEventDone ); + tp.hEventDone = (HANDLE)0; + } +#endif +} + +#ifdef _WIN32 + +/* +============== +Trace_ThreadFunction + +Performs a trace, sets finish event and exits +============== +*/ +DWORD WINAPI Trace_ThreadFunction( LPVOID p ) +{ + int *results; + + results = ( int * )p; + + *results = Trace_GetHopCount( tp.server, 30 ); + SetEvent( tp.hEventDone ); + + return 0; +} +#endif + +/* +============== +Trace_StartTrace + +Create finish event, sets up data, and starts thread to do a traceroute. +============== +*/ +void Trace_StartTrace( int *results, int *finished, const char *server ) +{ +#ifdef _WIN32 + tp.p_nresults = results; + strcpy( tp.server, server ); + + *results = -1; + + Trace_Cleanup(); + + tp.hEventDone = CreateEvent( NULL, TRUE, FALSE, NULL ); + if ( !tp.hEventDone ) + { + return; + } + + tp.p_ndone = finished; + *tp.p_ndone = 0; + + tp.hThread = CreateThread( NULL, 0, Trace_ThreadFunction, results, 0, &tp.hThreadId ); +#endif +} + +/* +============== +Trace_Think + +Invoked by general frame loop on client to periodically check if the traceroute thread has completed. +============== +*/ +void Trace_Think( void ) +{ +#ifdef _WIN32 + if ( !tp.hEventDone ) + return; + + if ( WaitForSingleObject( tp.hEventDone, 0 ) == WAIT_OBJECT_0 ) + { + Trace_Cleanup(); + *tp.p_ndone = 1; + } +#endif +} \ No newline at end of file diff --git a/cl_dll/hud_benchtrace.h b/cl_dll/hud_benchtrace.h new file mode 100644 index 0000000..feeca57 --- /dev/null +++ b/cl_dll/hud_benchtrace.h @@ -0,0 +1,8 @@ +#if !defined( HUD_BENCHTRACEH ) +#define HUD_BENCHTRACEH +#pragma once + +void Trace_StartTrace( int *results, int *finished, const char *pszServer ); +void Trace_Think( void ); + +#endif // !HUD_BENCHTRACEH \ No newline at end of file diff --git a/cl_dll/hud_iface.h b/cl_dll/hud_iface.h index d08763c..7dd4ae4 100644 --- a/cl_dll/hud_iface.h +++ b/cl_dll/hud_iface.h @@ -9,9 +9,6 @@ #define HUD_IFACEH #pragma once -#define EXPORT _declspec( dllexport ) -#define _DLLEXPORT __declspec( dllexport ) - typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); #include "wrect.h" #include "../engine/cdll_int.h" diff --git a/cl_dll/hud_msg.cpp b/cl_dll/hud_msg.cpp index 0505d17..8550d87 100644 --- a/cl_dll/hud_msg.cpp +++ b/cl_dll/hud_msg.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -21,10 +21,19 @@ #include "parsemsg.h" #include "r_efx.h" +#include "particleman.h" +extern IParticleMan *g_pParticleMan; + #define MAX_CLIENTS 32 +#if !defined( _TFC ) extern BEAM *pBeam; extern BEAM *pBeam2; +#endif + +#if defined( _TFC ) +void ClearEventList( void ); +#endif /// USER-DEFINED SERVER MESSAGE HANDLERS @@ -70,8 +79,20 @@ void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf ) pList = pList->pNext; } +#if defined( _TFC ) + ClearEventList(); + + // catch up on any building events that are going on + gEngfuncs.pfnServerCmd("sendevents"); +#endif + + if ( g_pParticleMan ) + g_pParticleMan->ResetParticles(); + +#if !defined( _TFC ) //Probably not a good place to put this. pBeam = pBeam2 = NULL; +#endif } diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index 903fbdd..4fce92a 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -18,6 +18,7 @@ #include #include "hud.h" #include "cl_util.h" +#include "bench.h" #include "vgui_TeamFortressViewport.h" @@ -40,6 +41,9 @@ extern cvar_t *sensitivity; // Think void CHud::Think(void) { + m_scrinfo.iSize = sizeof(m_scrinfo); + GetScreenInfo(&m_scrinfo); + int newfov; HUDLIST *pList = m_pHudList; @@ -79,6 +83,13 @@ void CHud::Think(void) { // only let players adjust up in fov, and only if they are not overriden by something else m_iFOV = max( default_fov->value, 90 ); } + + if ( gEngfuncs.IsSpectateOnly() ) + { + m_iFOV = gHUD.m_Spectator.GetFOV(); // default_fov->value; + } + + Bench_CheckStart(); } // Redraw @@ -89,7 +100,7 @@ int CHud :: Redraw( float flTime, int intermission ) m_fOldTime = m_flTime; // save time of previous redraw m_flTime = flTime; m_flTimeDelta = (double)m_flTime - m_fOldTime; - static m_flShotTime = 0; + static float m_flShotTime = 0; // Clock was reset, reset delta if ( m_flTimeDelta < 0 ) @@ -131,21 +142,34 @@ int CHud :: Redraw( float flTime, int intermission ) // if no redrawing is necessary // return 0; + // draw all registered HUD elements if ( m_pCvarDraw->value ) { HUDLIST *pList = m_pHudList; while (pList) { - if ( !intermission ) + if ( !Bench_Active() ) { - if ( (pList->p->m_iFlags & HUD_ACTIVE) && !(m_iHideHUDDisplay & HIDEHUD_ALL) ) - pList->p->Draw(flTime); + if ( !intermission ) + { + if ( (pList->p->m_iFlags & HUD_ACTIVE) && !(m_iHideHUDDisplay & HIDEHUD_ALL) ) + pList->p->Draw(flTime); + } + else + { // it's an intermission, so only draw hud elements that are set to draw during intermissions + if ( pList->p->m_iFlags & HUD_INTERMISSION ) + pList->p->Draw( flTime ); + } } else - { // it's an intermission, so only draw hud elements that are set to draw during intermissions - if ( pList->p->m_iFlags & HUD_INTERMISSION ) - pList->p->Draw( flTime ); + { + if ( ( pList->p == &m_Benchmark ) && + ( pList->p->m_iFlags & HUD_ACTIVE ) && + !( m_iHideHUDDisplay & HIDEHUD_ALL ) ) + { + pList->p->Draw(flTime); + } } pList = pList->pNext; @@ -208,18 +232,7 @@ void ScaleColors( int &r, int &g, int &b, int a ) int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b ) { - // draw the string until we hit the null character or a newline character - for ( ; *szIt != 0 && *szIt != '\n'; szIt++ ) - { - int next = xpos + gHUD.m_scrinfo.charWidths[ *szIt ]; // variable-width fonts look cool - if ( next > iMaxX ) - return xpos; - - TextMessageDrawChar( xpos, ypos, *szIt, r, g, b ); - xpos = next; - } - - return xpos; + return xpos + gEngfuncs.pfnDrawString( xpos, ypos, szIt, r, g, b); } int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ) @@ -233,23 +246,7 @@ int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int // draws a string from right to left (right-aligned) int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ) { - // find the end of the string - for ( char *szIt = szString; *szIt != 0; szIt++ ) - { // we should count the length? - } - - // iterate throug the string in reverse - for ( szIt--; szIt != (szString-1); szIt-- ) - { - int next = xpos - gHUD.m_scrinfo.charWidths[ *szIt ]; // variable-width fonts look cool - if ( next < iMinX ) - return xpos; - xpos = next; - - TextMessageDrawChar( xpos, ypos, *szIt, r, g, b ); - } - - return xpos; + return xpos - gEngfuncs.pfnDrawStringReverse( xpos, ypos, szString, r, g, b); } int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b) diff --git a/cl_dll/hud_servers.cpp b/cl_dll/hud_servers.cpp index 8bd42d3..d536bc9 100644 --- a/cl_dll/hud_servers.cpp +++ b/cl_dll/hud_servers.cpp @@ -12,17 +12,23 @@ #include "hud_servers.h" #include "net_api.h" #include +#ifdef _WIN32 +#include "winsani_in.h" #include - +#include "winsani_out.h" +#else +#define __cdecl +#include +#endif static int context_id; -// Default master server address in case we can't read any from woncomm.lst file +// Default master server address in case we can't read any from valvecomm.lst file #define VALVE_MASTER_ADDRESS "half-life.east.won.net" #define PORT_MASTER 27010 #define PORT_SERVER 27015 // File where we really should look for master servers -#define MASTER_PARSE_FILE "woncomm.lst" +#define MASTER_PARSE_FILE "valvecomm.lst" #define MAX_QUERIES 20 @@ -599,7 +605,7 @@ int CompareField( CHudServers::server_t *p1, CHudServers::server_t *p2, const ch return stricmp( sz1, sz2 ); } -int CALLBACK ServerListCompareFunc( CHudServers::server_t *p1, CHudServers::server_t *p2, const char *fieldname ) +int ServerListCompareFunc( CHudServers::server_t *p1, CHudServers::server_t *p2, const char *fieldname ) { if (!p1 || !p2) // No meaningful comparison return 0; @@ -1227,4 +1233,4 @@ void ServerPlayers( int server ) { g_pServers->ServerPlayers( server ); } -} \ No newline at end of file +} diff --git a/cl_dll/hud_spectator.cpp b/cl_dll/hud_spectator.cpp index 1df426a..c9fe1f1 100644 --- a/cl_dll/hud_spectator.cpp +++ b/cl_dll/hud_spectator.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -37,8 +37,6 @@ extern "C" float vJumpAngles[3]; extern void V_GetInEyePos(int entity, float * origin, float * angles ); extern void V_ResetChaseCam(); extern void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles); -extern void VectorAngles( const float *forward, float *angles ); -extern "C" void NormalizeAngles( float *angles ); extern float * GetClientColor( int clientIndex ); extern vec3_t v_origin; // last view origin @@ -46,6 +44,37 @@ extern vec3_t v_angles; // last view angle extern vec3_t v_cl_angles; // last client/mouse angle extern vec3_t v_sim_org; // last sim origin +#if 0 +const char *GetSpectatorLabel ( int iMode ) +{ + switch ( iMode ) + { + case OBS_CHASE_LOCKED: + return "#OBS_CHASE_LOCKED"; + + case OBS_CHASE_FREE: + return "#OBS_CHASE_FREE"; + + case OBS_ROAMING: + return "#OBS_ROAMING"; + + case OBS_IN_EYE: + return "#OBS_IN_EYE"; + + case OBS_MAP_FREE: + return "#OBS_MAP_FREE"; + + case OBS_MAP_CHASE: + return "#OBS_MAP_CHASE"; + + case OBS_NONE: + default: + return "#OBS_NONE"; + } +} + +#endif + void SpectatorMode(void) { @@ -142,6 +171,7 @@ int CHudSpectator::Init() m_flNextObserverInput = 0.0f; m_zoomDelta = 0.0f; m_moveDelta = 0.0f; + m_FOV = 90.0f; m_chatEnabled = (gHUD.m_SayText.m_HUD_saytext->value!=0); iJumpSpectator = 0; @@ -359,6 +389,182 @@ void CHudSpectator::SetSpectatorStartPosition() iJumpSpectator = 1; // jump anyway } + +void CHudSpectator::SetCameraView( vec3_t pos, vec3_t angle, float fov) +{ + m_FOV = fov; + VectorCopy(pos, vJumpOrigin); + VectorCopy(angle, vJumpAngles); + gEngfuncs.SetViewAngles( vJumpAngles ); + iJumpSpectator = 1; // jump anyway +} + +void CHudSpectator::AddWaypoint( float time, vec3_t pos, vec3_t angle, float fov, int flags ) +{ + if ( !flags == 0 && time == 0.0f) + { + // switch instantly to this camera view + SetCameraView( pos, angle, fov ); + return; + } + + if ( m_NumWayPoints >= MAX_CAM_WAYPOINTS ) + { + gEngfuncs.Con_Printf( "Too many camera waypoints!\n" ); + return; + } + + VectorCopy( angle, m_CamPath[ m_NumWayPoints ].angle ); + VectorCopy( pos, m_CamPath[ m_NumWayPoints ].position ); + m_CamPath[ m_NumWayPoints ].flags = flags; + m_CamPath[ m_NumWayPoints ].fov = fov; + m_CamPath[ m_NumWayPoints ].time = time; + + gEngfuncs.Con_DPrintf("Added waypoint %i\n", m_NumWayPoints ); + + m_NumWayPoints++; +} + +void CHudSpectator::SetWayInterpolation(cameraWayPoint_t * prev, cameraWayPoint_t * start, cameraWayPoint_t * end, cameraWayPoint_t * next) +{ + m_WayInterpolation.SetViewAngles( start->angle, end->angle ); + + m_WayInterpolation.SetFOVs( start->fov, end->fov ); + + m_WayInterpolation.SetSmoothing( ( start->flags & DRC_FLAG_SLOWSTART ) != 0, + ( start->flags & DRC_FLAG_SLOWEND ) != 0); + + if ( prev && next ) + { + m_WayInterpolation.SetWaypoints(&prev->position, start->position, end->position, &next->position); + } + else if ( prev ) + { + m_WayInterpolation.SetWaypoints(&prev->position, start->position, end->position, NULL ); + } + else if ( next ) + { + m_WayInterpolation.SetWaypoints(NULL, start->position, end->position, &next->position ); + } + else + { + m_WayInterpolation.SetWaypoints(NULL, start->position, end->position, NULL ); + } +} + +bool CHudSpectator::GetDirectorCamera(vec3_t &position, vec3_t &angle) +{ + float now = gHUD.m_flTime; + float fov = 90.0f; + + if ( m_ChaseEntity ) + { + cl_entity_t * ent = gEngfuncs.GetEntityByIndex( m_ChaseEntity ); + + if ( ent ) + { + vec3_t vt = ent->curstate.origin; + + if ( m_ChaseEntity <= gEngfuncs.GetMaxClients() ) + { + if ( ent->curstate.solid == SOLID_NOT ) + { + vt[2]+= -8 ; // PM_DEAD_VIEWHEIGHT + } + else if (ent->curstate.usehull == 1 ) + { + vt[2]+= 12; // VEC_DUCK_VIEW; + } + else + { + vt[2]+= 28; // DEFAULT_VIEWHEIGHT + } + } + + vt = vt - position; + VectorAngles(vt, angle); + angle[0] = -angle[0]; + return true; + } + else + { + return false; + } + } + + if ( !m_IsInterpolating ) + return false; + + if ( m_WayPoint < 0 || m_WayPoint >= (m_NumWayPoints-1) ) + return false; + + cameraWayPoint_t * wp1 = &m_CamPath[m_WayPoint]; + cameraWayPoint_t * wp2 = &m_CamPath[m_WayPoint+1]; + + if ( now < wp1->time ) + return false; + + while ( now > wp2->time ) + { + // go to next waypoint, if possible + m_WayPoint++; + + if ( m_WayPoint >= (m_NumWayPoints-1) ) + { + m_IsInterpolating = false; + return false; // there is no following waypoint + } + + wp1 = wp2; + wp2 = &m_CamPath[m_WayPoint+1]; + + if ( m_WayPoint > 0 ) + { + // we have a predecessor + + if ( m_WayPoint < (m_NumWayPoints-1) ) + { + // we have also a successor + SetWayInterpolation( &m_CamPath[m_WayPoint-1], wp1, wp2, &m_CamPath[m_WayPoint+2] ); + } + else + { + SetWayInterpolation( &m_CamPath[m_WayPoint-1], wp1, wp2, NULL ); + } + } + else if ( m_WayPoint < (m_NumWayPoints-1) ) + { + // we only have a successor + SetWayInterpolation( NULL, wp1, wp2, &m_CamPath[m_WayPoint+2] ); + + } + else + { + // we have only two waypoints + SetWayInterpolation( NULL, wp1, wp2, NULL ); + } + } + + if ( wp2->time <= wp1->time ) + return false; + + float fraction = (now - wp1->time) / (wp2->time - wp1->time); + + if ( fraction < 0.0f ) + fraction = 0.0f; + else if ( fraction > 1.0f ) + fraction = 1.0f; + + m_WayInterpolation.Interpolate( fraction, position, angle, &fov ); + + // gEngfuncs.Con_Printf("Interpolate time: %.2f, fraction %.2f, point : %.2f,%.2f,%.2f\n", now, fraction, position[0], position[1], position[2] ); + + SetCameraView( position, angle, fov ); + + return true; + +} + //----------------------------------------------------------------------------- // Purpose: Loads new icons //----------------------------------------------------------------------------- @@ -373,9 +579,21 @@ int CHudSpectator::VidInit() m_hsprCamera = SPR_Load("sprites/camera.spr"); m_hCrosshair = SPR_Load("sprites/crosshairs.spr"); + m_lastPrimaryObject = m_lastSecondaryObject = 0; + m_flNextObserverInput = 0.0f; + m_lastHudMessage = 0; + m_iSpectatorNumber = 0; + iJumpSpectator = 0; + g_iUser1 = g_iUser2 = 0; + return 1; } +float CHudSpectator::GetFOV() +{ + return m_FOV; +} + //----------------------------------------------------------------------------- // Purpose: // Input : flTime - @@ -462,8 +680,10 @@ int CHudSpectator::Draw(float flTime) void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) { - float value; + float f1,f2; char * string; + vec3_t v1,v2; + int i1,i2,i3; BEGIN_READ( pbuf, iSize ); @@ -482,7 +702,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) break; - case DRC_CMD_EVENT : + case DRC_CMD_EVENT : // old director style message m_lastPrimaryObject = READ_WORD(); m_lastSecondaryObject = READ_WORD(); m_iObserverFlags = READ_LONG(); @@ -494,11 +714,12 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) g_iUser2 = m_lastPrimaryObject; g_iUser3 = m_lastSecondaryObject; + m_IsInterpolating = false; + m_ChaseEntity = 0; } // gEngfuncs.Con_Printf("Director Camera: %i %i\n", firstObject, secondObject); break; - case DRC_CMD_MODE : if ( m_autoDirector->value ) { @@ -506,20 +727,23 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) } break; + case DRC_CMD_CAMERA : + v1[0] = READ_COORD(); // position + v1[1] = READ_COORD(); + v1[2] = READ_COORD(); // vJumpOrigin + + v2[0] = READ_COORD(); // view angle + v2[1] = READ_COORD(); // vJumpAngles + v2[2] = READ_COORD(); + f1 = READ_BYTE(); // fov + i1 = READ_WORD(); // target + if ( m_autoDirector->value ) { - vJumpOrigin[0] = READ_COORD(); // position - vJumpOrigin[1] = READ_COORD(); - vJumpOrigin[2] = READ_COORD(); - - vJumpAngles[0] = READ_COORD(); // view angle - vJumpAngles[1] = READ_COORD(); - vJumpAngles[2] = READ_COORD(); - - gEngfuncs.SetViewAngles( vJumpAngles ); - - iJumpSpectator = 1; + SetModes( OBS_ROAMING, -1 ); + SetCameraView(v1, v2, f1); + m_ChaseEntity = i1; } break; @@ -560,15 +784,15 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) case DRC_CMD_SOUND : string = READ_STRING(); - value = READ_FLOAT(); + f1 = READ_FLOAT(); // gEngfuncs.Con_Printf("DRC_CMD_FX_SOUND: %s %.2f\n", string, value ); - gEngfuncs.pEventAPI->EV_PlaySound(0, v_origin, CHAN_BODY, string, value, ATTN_NORM, 0, PITCH_NORM ); + gEngfuncs.pEventAPI->EV_PlaySound(0, v_origin, CHAN_BODY, string, f1, ATTN_NORM, 0, PITCH_NORM ); break; case DRC_CMD_TIMESCALE : - value = READ_FLOAT(); + f1 = READ_FLOAT(); // ignore this command (maybe show slowmo sign) break; @@ -587,11 +811,69 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) gViewPort->UpdateSpectatorPanel(); break; - case DRC_CMD_FADE: + case DRC_CMD_STUFFTEXT: + EngineClientCmd( READ_STRING() ); break; - case DRC_CMD_STUFFTEXT: - ClientCmd( READ_STRING() ); + case DRC_CMD_CAMPATH: + v1[0] = READ_COORD(); // position + v1[1] = READ_COORD(); + v1[2] = READ_COORD(); // vJumpOrigin + + v2[0] = READ_COORD(); // view angle + v2[1] = READ_COORD(); // vJumpAngles + v2[2] = READ_COORD(); + f1 = READ_BYTE(); // FOV + i1 = READ_BYTE(); // flags + + if ( m_autoDirector->value ) + { + SetModes( OBS_ROAMING, -1 ); + SetCameraView(v1, v2, f1); + } + break; + + case DRC_CMD_WAYPOINTS : + i1 = READ_BYTE(); + m_NumWayPoints = 0; + m_WayPoint = 0; + for ( i2=0; i2value ) + { + // ignore waypoints + m_NumWayPoints = 0; + break; + } + + SetModes( OBS_ROAMING, -1 ); + + m_IsInterpolating = true; + + if ( m_NumWayPoints > 2 ) + { + SetWayInterpolation( NULL, &m_CamPath[0], &m_CamPath[1], &m_CamPath[2] ); + } + else + { + SetWayInterpolation( NULL, &m_CamPath[0], &m_CamPath[1], NULL ); + } break; default : gEngfuncs.Con_DPrintf("CHudSpectator::DirectorMessage: unknown command %i.\n", cmd ); @@ -667,7 +949,67 @@ void CHudSpectator::FindNextPlayer(bool bReverse) VectorCopy ( pEnt->origin, vJumpOrigin ); VectorCopy ( pEnt->angles, vJumpAngles ); } + iJumpSpectator = 1; + gViewPort->MsgFunc_ResetFade( NULL, 0, NULL ); +} + + +void CHudSpectator::FindPlayer(const char *name) +{ + // MOD AUTHORS: Modify the logic of this function if you want to restrict the observer to watching + // only a subset of the players. e.g. Make it check the target's team. + + // if we are NOT in HLTV mode, spectator targets are set on server + if ( !gEngfuncs.IsSpectateOnly() ) + { + char cmdstring[32]; + // forward command to server + sprintf(cmdstring,"follow %s",name); + gEngfuncs.pfnServerCmd(cmdstring); + return; + } + + g_iUser2 = 0; + + // make sure we have player info + gViewPort->GetAllPlayersInfo(); + + cl_entity_t * pEnt = NULL; + + for (int i = 1; i < MAX_PLAYERS; i++ ) + { + + pEnt = gEngfuncs.GetEntityByIndex( i ); + + if ( !IsActivePlayer( pEnt ) ) + continue; + + if(!stricmp(g_PlayerInfoList[pEnt->index].name,name)) + { + g_iUser2 = i; + break; + } + + } + + // Did we find a target? + if ( !g_iUser2 ) + { + gEngfuncs.Con_DPrintf( "No observer targets.\n" ); + // take save camera position + VectorCopy(m_cameraOrigin, vJumpOrigin); + VectorCopy(m_cameraAngles, vJumpAngles); + } + else + { + // use new entity position for roaming + VectorCopy ( pEnt->origin, vJumpOrigin ); + VectorCopy ( pEnt->angles, vJumpAngles ); + } + + iJumpSpectator = 1; + gViewPort->MsgFunc_ResetFade( NULL, 0, NULL ); } void CHudSpectator::HandleButtonsDown( int ButtonPressed ) @@ -678,6 +1020,7 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed ) int newInsetMode = m_pip->value; // gEngfuncs.Con_Printf(" HandleButtons:%i\n", ButtonPressed ); + if ( !gViewPort ) return; @@ -743,7 +1086,7 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed ) iJumpSpectator = 1; } - // lease directed mode if player want to see another player + // release directed mode if player wants to see another player m_autoDirector->value = 0.0f; } } @@ -800,17 +1143,24 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode) gEngfuncs.Con_Printf("Invalid spectator mode.\n"); return; } + + m_IsInterpolating = false; + m_ChaseEntity = 0; - // main modes ettings will override inset window settings + // main mode settings will override inset window settings if ( iNewMainMode != g_iUser1 ) { // if we are NOT in HLTV mode, main spectator mode is set on server if ( !gEngfuncs.IsSpectateOnly() ) { + char cmdstring[32]; + // forward command to server + sprintf(cmdstring,"specmode %i",iNewMainMode ); + gEngfuncs.pfnServerCmd(cmdstring); return; } - if ( !g_iUser2 && (iNewMainMode !=OBS_ROAMING ) ) // make sure we have a target + if ( !g_iUser2 && (iNewMainMode != OBS_ROAMING ) ) // make sure we have a target { // choose last Director object if still available if ( IsActivePlayer( gEngfuncs.GetEntityByIndex( m_lastPrimaryObject ) ) ) @@ -871,6 +1221,8 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode) SetCrosshair( 0, m_crosshairRect, 0, 0, 0 ); } + gViewPort->MsgFunc_ResetFade( NULL, 0, NULL ); + char string[128]; sprintf(string, "#Spec_Mode%d", g_iUser1 ); sprintf(string, "%c%s", HUD_PRINTCENTER, CHudTextMessage::BufferedLocaliseTextString( string )); @@ -928,7 +1280,7 @@ bool CHudSpectator::ParseOverviewFile( ) if (!pfile) { - gEngfuncs.Con_Printf("Couldn't open file %s. Using default values for overiew mode.\n", filename ); + gEngfuncs.Con_DPrintf("Couldn't open file %s. Using default values for overiew mode.\n", filename ); return false; } @@ -1076,7 +1428,7 @@ void CHudSpectator::DrawOverviewLayer() if ( hasMapImage) { i = m_MapSprite->numframes / (4*3); - i = sqrt(i); + i = sqrt((float)i); xTiles = i*4; yTiles = i*3; } @@ -1591,6 +1943,12 @@ void CHudSpectator::Reset() memset( &m_OverviewEntities, 0, sizeof(m_OverviewEntities)); + m_FOV = 90.0f; + + m_IsInterpolating = false; + + m_ChaseEntity = 0; + SetSpectatorStartPosition(); } @@ -1613,7 +1971,7 @@ void CHudSpectator::InitHUDData() Reset(); - SetModes( OBS_CHASE_FREE, INSET_OFF ); + SetModes( OBS_CHASE_LOCKED, INSET_OFF ); g_iUser2 = 0; // fake not target until first camera command diff --git a/cl_dll/hud_spectator.h b/cl_dll/hud_spectator.h index 7f1a361..72be387 100644 --- a/cl_dll/hud_spectator.h +++ b/cl_dll/hud_spectator.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -10,7 +10,7 @@ #pragma once #include "cl_entity.h" - +#include "interpolation.h" #define INSET_OFF 0 @@ -21,11 +21,12 @@ #define MAX_SPEC_HUD_MESSAGES 8 - - #define OVERVIEW_TILE_SIZE 128 // don't change this #define OVERVIEW_MAX_LAYERS 1 +extern void VectorAngles( const float *forward, float *angles ); +extern "C" void NormalizeAngles( float *angles ); + //----------------------------------------------------------------------------- // Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it ) //----------------------------------------------------------------------------- @@ -52,7 +53,17 @@ typedef struct overviewEntity_s { double killTime; } overviewEntity_t; +typedef struct cameraWayPoint_s +{ + float time; + vec3_t position; + vec3_t angle; + float fov; + int flags; +} cameraWayPoint_t; + #define MAX_OVERVIEW_ENTITIES 128 +#define MAX_CAM_WAYPOINTS 32 class CHudSpectator : public CHudBase { @@ -76,6 +87,7 @@ public: void HandleButtonsDown(int ButtonPressed); void HandleButtonsUp(int ButtonPressed); void FindNextPlayer( bool bReverse ); + void FindPlayer(const char *name); void DirectorMessage( int iSize, void *pbuf ); void SetSpectatorStartPosition(); int Init(); @@ -83,6 +95,13 @@ public: int Draw(float flTime); + void AddWaypoint( float time, vec3_t pos, vec3_t angle, float fov, int flags ); + void SetCameraView( vec3_t pos, vec3_t angle, float fov); + float GetFOV(); + bool GetDirectorCamera(vec3_t &position, vec3_t &angle); + void SetWayInterpolation(cameraWayPoint_t * prev, cameraWayPoint_t * start, cameraWayPoint_t * end, cameraWayPoint_t * next); + + int m_iDrawCycle; client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES]; char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128]; @@ -99,13 +118,15 @@ public: cvar_t * m_drawstatus; cvar_t * m_autoDirector; cvar_t * m_pip; - - qboolean m_chatEnabled; - + + qboolean m_IsInterpolating; + int m_ChaseEntity; // if != 0, follow this entity with viewangles + int m_WayPoint; // current waypoint 1 + int m_NumWayPoints; // current number of waypoints vec3_t m_cameraOrigin; // a help camera vec3_t m_cameraAngles; // and it's angles - + CInterpolation m_WayInterpolation; private: vec3_t m_vPlayerPos[MAX_PLAYERS]; @@ -123,10 +144,13 @@ private: struct model_s * m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame float m_flNextObserverInput; + float m_FOV; float m_zoomDelta; float m_moveDelta; int m_lastPrimaryObject; int m_lastSecondaryObject; + + cameraWayPoint_t m_CamPath[MAX_CAM_WAYPOINTS]; }; #endif // SPECTATOR_H diff --git a/cl_dll/in_camera.cpp b/cl_dll/in_camera.cpp index 96dbdc7..0d77d51 100644 --- a/cl_dll/in_camera.cpp +++ b/cl_dll/in_camera.cpp @@ -14,18 +14,13 @@ #include "const.h" #include "camera.h" #include "in_defs.h" +#include "Exports.h" -#include "windows.h" +#include "SDL2/SDL_mouse.h" +#include "port.h" float CL_KeyState (kbutton_t *key); -extern "C" -{ - void DLLEXPORT CAM_Think( void ); - int DLLEXPORT CL_IsThirdPerson( void ); - void DLLEXPORT CL_CameraOffset( float *ofs ); -} - extern cl_enginefunc_t gEngfuncs; //-------------------------------------------------- Constants @@ -88,6 +83,15 @@ void CAM_ToFirstPerson(void); void CAM_StartDistance(void); void CAM_EndDistance(void); +void SDL_GetCursorPos( POINT *p ) +{ + gEngfuncs.GetMousePosition( (int *)&p->x, (int *)&p->y ); +// SDL_GetMouseState( (int *)&p->x, (int *)&p->y ); +} + +void SDL_SetCursorPos( const int x, const int y ) +{ +} //-------------------------------------------------- Local Functions @@ -146,8 +150,10 @@ typedef struct extern trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end); -void DLLEXPORT CAM_Think( void ) +void CL_DLLEXPORT CAM_Think( void ) { +// RecClCamThink(); + vec3_t origin; vec3_t ext, pnt, camForward, camRight, camUp; moveclip_t clip; @@ -194,7 +200,7 @@ void DLLEXPORT CAM_Think( void ) if (cam_mousemove) { //get windows cursor position - GetCursorPos (&cam_mouse); + SDL_GetCursorPos (&cam_mouse); //check for X delta values and adjust accordingly //eventually adjust YAW based on amount of movement //don't do any movement of the cam using YAW/PITCH if we are zooming in/out the camera @@ -269,7 +275,7 @@ void DLLEXPORT CAM_Think( void ) cam_old_mouse_x=cam_mouse.x; cam_old_mouse_y=cam_mouse.y; } - SetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY()); + SDL_SetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY()); } } @@ -327,7 +333,7 @@ void DLLEXPORT CAM_Think( void ) //since we are done with the mouse cam_old_mouse_x=cam_mouse.x*gHUD.GetSensitivity(); cam_old_mouse_y=cam_mouse.y*gHUD.GetSensitivity(); - SetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY()); + SDL_SetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY()); } #ifdef LATER if( cam_contain->value ) @@ -540,7 +546,7 @@ void CAM_StartMouseMove(void) { cam_mousemove=1; iMouseInUse=1; - GetCursorPos (&cam_mouse); + SDL_GetCursorPos (&cam_mouse); if ( ( flSensitivity = gHUD.GetSensitivity() ) != 0 ) { @@ -587,7 +593,7 @@ void CAM_StartDistance(void) cam_distancemove=1; cam_mousemove=1; iMouseInUse=1; - GetCursorPos (&cam_mouse); + SDL_GetCursorPos (&cam_mouse); cam_old_mouse_x=cam_mouse.x*gHUD.GetSensitivity(); cam_old_mouse_y=cam_mouse.y*gHUD.GetSensitivity(); } @@ -610,12 +616,16 @@ void CAM_EndDistance(void) iMouseInUse=0; } -int DLLEXPORT CL_IsThirdPerson( void ) +int CL_DLLEXPORT CL_IsThirdPerson( void ) { +// RecClCL_IsThirdPerson(); + return (cam_thirdperson ? 1 : 0) || (g_iUser1 && (g_iUser2 == gEngfuncs.GetLocalPlayer()->index) ); } -void DLLEXPORT CL_CameraOffset( float *ofs ) +void CL_DLLEXPORT CL_CameraOffset( float *ofs ) { +// RecClCL_GetCameraOffsets(ofs); + VectorCopy( cam_ofs, ofs ); -} \ No newline at end of file +} diff --git a/cl_dll/in_defs.h b/cl_dll/in_defs.h index f559189..c84cef9 100644 --- a/cl_dll/in_defs.h +++ b/cl_dll/in_defs.h @@ -16,6 +16,5 @@ // fall over #define ROLL 2 -#define DLLEXPORT __declspec( dllexport ) #endif \ No newline at end of file diff --git a/cl_dll/input.cpp b/cl_dll/input.cpp index ab9efba..42807b6 100644 --- a/cl_dll/input.cpp +++ b/cl_dll/input.cpp @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - // cl.input.c -- builds an intended movement command to send to the server //xxxxxx Move bob and pitch drifting code here and other stuff from view if needed @@ -24,20 +17,14 @@ extern "C" #include "camera.h" #include "in_defs.h" #include "view.h" +#include "bench.h" #include #include +#include "Exports.h" #include "vgui_TeamFortressViewport.h" -extern "C" -{ - struct kbutton_s DLLEXPORT *KB_Find( const char *name ); - void DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int active ); - void DLLEXPORT HUD_Shutdown( void ); - int DLLEXPORT HUD_Key_Event( int eventcode, int keynum, const char *pszCurrentBinding ); -} - extern int g_iAlive; extern int g_weaponselect; @@ -219,8 +206,10 @@ KB_Find Allows the engine to get a kbutton_t directly ( so it can check +mlook state, etc ) for saving out to .cfg files ============ */ -struct kbutton_s DLLEXPORT *KB_Find( const char *name ) +struct kbutton_s CL_DLLEXPORT *KB_Find( const char *name ) { +// RecClFindKey(name); + kblist_t *p; p = g_kbkeys; while ( p ) @@ -376,8 +365,10 @@ HUD_Key_Event Return 1 to allow engine to process the key, otherwise, act on it as needed ============ */ -int DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBinding ) +int CL_DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBinding ) { +// RecClKeyEvent(down, keynum, pszCurrentBinding); + if (gViewPort) return gViewPort->KeyInput(down, keynum, pszCurrentBinding); @@ -462,6 +453,10 @@ void IN_Attack2Down(void) { KeyDown(&in_attack2); +#ifdef _TFC + __CmdFunc_InputPlayerSpecial(); +#endif + gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK2 ); } @@ -662,13 +657,15 @@ if active == 1 then we are 1) not playing back demos ( where our commands are ig 2 ) we have finished signing on to server ================ */ -void DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int active ) +void CL_DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int active ) { +// RecClCL_CreateMove(frametime, cmd, active); + float spd; vec3_t viewangles; static vec3_t oldangles; - if ( active ) + if ( active && !Bench_Active() ) { //memset( viewangles, 0, sizeof( vec3_t ) ); //viewangles[ 0 ] = viewangles[ 1 ] = viewangles[ 2 ] = 0.0; @@ -766,6 +763,7 @@ void DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int activ VectorCopy( oldangles, cmd->viewangles ); } + Bench_SetViewAngles( 1, (float *)&cmd->viewangles, frametime, cmd ); } /* @@ -1022,7 +1020,22 @@ void ShutdownInput (void) KB_Shutdown(); } -void DLLEXPORT HUD_Shutdown( void ) +#include "interface.h" +void CL_UnloadParticleMan( void ); + +#if defined( _TFC ) +void ClearEventList( void ); +#endif + +void CL_DLLEXPORT HUD_Shutdown( void ) { +// RecClShutdown(); + ShutdownInput(); + +#if defined( _TFC ) + ClearEventList(); +#endif + + CL_UnloadParticleMan(); } diff --git a/cl_dll/inputw32.cpp b/cl_dll/inputw32.cpp index 7176746..2fc1f56 100644 --- a/cl_dll/inputw32.cpp +++ b/cl_dll/inputw32.cpp @@ -8,6 +8,8 @@ // in_win.c -- windows 95 mouse and joystick code // 02/21/97 JCB Added extended DirectInput code to support external controllers. +#include "port.h" + #include "hud.h" #include "cl_util.h" #include "camera.h" @@ -17,26 +19,19 @@ #include "const.h" #include "camera.h" #include "in_defs.h" -#include "../engine/keydefs.h" +#include "../public/keydefs.h" #include "view.h" -#include "windows.h" +#include "Exports.h" + +#include +#include #define MOUSE_BUTTON_COUNT 5 // Set this to 1 to show mouse cursor. Experimental int g_iVisibleMouse = 0; -extern "C" -{ - void DLLEXPORT IN_ActivateMouse( void ); - void DLLEXPORT IN_DeactivateMouse( void ); - void DLLEXPORT IN_MouseEvent (int mstate); - void DLLEXPORT IN_Accumulate (void); - void DLLEXPORT IN_ClearStates (void); -} - extern cl_enginefunc_t gEngfuncs; - extern int iMouseInUse; extern kbutton_t in_strafe; @@ -59,18 +54,39 @@ extern cvar_t *cl_forwardspeed; extern cvar_t *cl_pitchspeed; extern cvar_t *cl_movespeedkey; + +static double s_flRawInputUpdateTime = 0.0f; +static bool m_bRawInput = false; +static bool m_bMouseThread = false; +extern globalvars_t *gpGlobals; + // mouse variables cvar_t *m_filter; cvar_t *sensitivity; +// Custom mouse acceleration (0 disable, 1 to enable, 2 enable with separate yaw/pitch rescale) +static cvar_t *m_customaccel; +//Formula: mousesensitivity = ( rawmousedelta^m_customaccel_exponent ) * m_customaccel_scale + sensitivity +// If mode is 2, then x and y sensitivity are scaled by m_pitch and m_yaw respectively. +// Custom mouse acceleration value. +static cvar_t *m_customaccel_scale; +//Max mouse move scale factor, 0 for no limit +static cvar_t *m_customaccel_max; +//Mouse move is raised to this power before being scaled by scale factor +static cvar_t *m_customaccel_exponent; + +// if threaded mouse is enabled then the time to sleep between polls +static cvar_t *m_mousethread_sleep; + int mouse_buttons; int mouse_oldbuttonstate; POINT current_pos; -int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum; +int old_mouse_x, old_mouse_y, mx_accum, my_accum; +float mouse_x, mouse_y; static int restore_spi; static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1}; -static int mouseactive; +static int mouseactive = 0; int mouseinitialized; static int mouseparmsvalid; static int mouseshowtoggle = 1; @@ -96,19 +112,17 @@ enum _ControlList AxisTurn }; -DWORD dwAxisFlags[JOY_MAX_AXES] = -{ - JOY_RETURNX, - JOY_RETURNY, - JOY_RETURNZ, - JOY_RETURNR, - JOY_RETURNU, - JOY_RETURNV -}; + DWORD dwAxisMap[ JOY_MAX_AXES ]; DWORD dwControlMap[ JOY_MAX_AXES ]; -PDWORD pdwRawValue[ JOY_MAX_AXES ]; +int pdwRawValue[ JOY_MAX_AXES ]; +DWORD joy_oldbuttonstate, joy_oldpovstate; + +int joy_id; +DWORD joy_numbuttons; + +SDL_GameController *s_pJoystick = NULL; // none of these cvars are saved over a session // this means that advanced controller configuration needs to be executed @@ -136,13 +150,13 @@ cvar_t *joy_wwhack1; cvar_t *joy_wwhack2; int joy_avail, joy_advancedinit, joy_haspov; -DWORD joy_oldbuttonstate, joy_oldpovstate; -int joy_id; -DWORD joy_flags; -DWORD joy_numbuttons; - -static JOYINFOEX ji; +#ifdef _WIN32 +DWORD s_hMouseThreadId = 0; +HANDLE s_hMouseThread = 0; +HANDLE s_hMouseQuitEvent = 0; +HANDLE s_hMouseDoneQuitEvent = 0; +#endif /* =========== @@ -161,33 +175,84 @@ void Force_CenterView_f (void) } } +#ifdef _WIN32 +long s_mouseDeltaX = 0; +long s_mouseDeltaY = 0; +POINT old_mouse_pos; + +long ThreadInterlockedExchange( long *pDest, long value ) +{ + return InterlockedExchange( pDest, value ); +} + + +DWORD WINAPI MousePos_ThreadFunction( LPVOID p ) +{ + s_hMouseDoneQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + + while ( 1 ) + { + if ( WaitForSingleObject( s_hMouseQuitEvent, (int)m_mousethread_sleep->value ) == WAIT_OBJECT_0 ) + { + return 0; + } + + if ( mouseactive ) + { + POINT mouse_pos; + GetCursorPos(&mouse_pos); + + volatile int mx = mouse_pos.x - old_mouse_pos.x + s_mouseDeltaX; + volatile int my = mouse_pos.y - old_mouse_pos.y + s_mouseDeltaY; + + ThreadInterlockedExchange( &old_mouse_pos.x, mouse_pos.x ); + ThreadInterlockedExchange( &old_mouse_pos.y, mouse_pos.y ); + + ThreadInterlockedExchange( &s_mouseDeltaX, mx ); + ThreadInterlockedExchange( &s_mouseDeltaY, my ); + } + } + + SetEvent( s_hMouseDoneQuitEvent ); + + return 0; +} +#endif + /* =========== IN_ActivateMouse =========== */ -void DLLEXPORT IN_ActivateMouse (void) +void CL_DLLEXPORT IN_ActivateMouse (void) { if (mouseinitialized) { +#ifdef _WIN32 if (mouseparmsvalid) restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); + +#endif mouseactive = 1; } } + /* =========== IN_DeactivateMouse =========== */ -void DLLEXPORT IN_DeactivateMouse (void) +void CL_DLLEXPORT IN_DeactivateMouse (void) { if (mouseinitialized) { +#ifdef _WIN32 if (restore_spi) SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0); +#endif + mouseactive = 0; } } @@ -203,6 +268,7 @@ void IN_StartupMouse (void) return; mouseinitialized = 1; +#ifdef _WIN32 mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0); if (mouseparmsvalid) @@ -223,7 +289,8 @@ void IN_StartupMouse (void) newmouseparms[2] = originalmouseparms[2]; } } - +#endif + mouse_buttons = MOUSE_BUTTON_COUNT; } @@ -235,6 +302,34 @@ IN_Shutdown void IN_Shutdown (void) { IN_DeactivateMouse (); + +#ifdef _WIN32 + if ( s_hMouseQuitEvent ) + { + SetEvent( s_hMouseQuitEvent ); + WaitForSingleObject( s_hMouseDoneQuitEvent, 100 ); + } + + if ( s_hMouseThread ) + { + TerminateThread( s_hMouseThread, 0 ); + CloseHandle( s_hMouseThread ); + s_hMouseThread = (HANDLE)0; + } + + if ( s_hMouseQuitEvent ) + { + CloseHandle( s_hMouseQuitEvent ); + s_hMouseQuitEvent = (HANDLE)0; + } + + + if ( s_hMouseDoneQuitEvent ) + { + CloseHandle( s_hMouseDoneQuitEvent ); + s_hMouseDoneQuitEvent = (HANDLE)0; + } +#endif } /* @@ -258,7 +353,22 @@ FIXME: Call through to engine? */ void IN_ResetMouse( void ) { - SetCursorPos ( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() ); + // no work to do in SDL +#ifdef _WIN32 + if ( !m_bRawInput && mouseactive && gEngfuncs.GetWindowCenterX && gEngfuncs.GetWindowCenterY ) + { + + SetCursorPos ( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() ); + ThreadInterlockedExchange( &old_mouse_pos.x, gEngfuncs.GetWindowCenterX() ); + ThreadInterlockedExchange( &old_mouse_pos.y, gEngfuncs.GetWindowCenterY() ); + } + + if ( gpGlobals && gpGlobals->time - s_flRawInputUpdateTime > 1.0f ) + { + s_flRawInputUpdateTime = gpGlobals->time; + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + } +#endif } /* @@ -266,7 +376,7 @@ void IN_ResetMouse( void ) IN_MouseEvent =========== */ -void DLLEXPORT IN_MouseEvent (int mstate) +void CL_DLLEXPORT IN_MouseEvent (int mstate) { int i; @@ -292,6 +402,55 @@ void DLLEXPORT IN_MouseEvent (int mstate) mouse_oldbuttonstate = mstate; } +//----------------------------------------------------------------------------- +// Purpose: Allows modulation of mouse scaling/senstivity value and application +// of custom algorithms. +// Input : *x - +// *y - +//----------------------------------------------------------------------------- +void IN_ScaleMouse( float *x, float *y ) +{ + float mx = *x; + float my = *y; + + // This is the default sensitivity + float mouse_senstivity = ( gHUD.GetSensitivity() != 0 ) ? gHUD.GetSensitivity() : sensitivity->value; + + // Using special accleration values + if ( m_customaccel->value != 0 ) + { + float raw_mouse_movement_distance = sqrt( mx * mx + my * my ); + float acceleration_scale = m_customaccel_scale->value; + float accelerated_sensitivity_max = m_customaccel_max->value; + float accelerated_sensitivity_exponent = m_customaccel_exponent->value; + float accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_senstivity ); + + if ( accelerated_sensitivity_max > 0.0001f && + accelerated_sensitivity > accelerated_sensitivity_max ) + { + accelerated_sensitivity = accelerated_sensitivity_max; + } + + *x *= accelerated_sensitivity; + *y *= accelerated_sensitivity; + + // Further re-scale by yaw and pitch magnitude if user requests alternate mode 2 + // This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default + // to 0.022 + if ( m_customaccel->value == 2 ) + { + *x *= m_yaw->value; + *y *= m_pitch->value; + } + } + else + { + // Just apply the default + *x *= mouse_senstivity; + *y *= mouse_senstivity; + } +} + /* =========== IN_MouseMove @@ -311,17 +470,57 @@ void IN_MouseMove ( float frametime, usercmd_t *cmd) //jjb - this disbles normal mouse control if the user is trying to // move the camera, or if the mouse cursor is visible or if we're in intermission - if ( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission ) + if ( !iMouseInUse && !gHUD.m_iIntermission && !g_iVisibleMouse ) { - GetCursorPos (¤t_pos); - - mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum; - my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum; - + int deltaX, deltaY; +#ifdef _WIN32 + if ( !m_bRawInput ) + { + if ( m_bMouseThread ) + { + ThreadInterlockedExchange( ¤t_pos.x, s_mouseDeltaX ); + ThreadInterlockedExchange( ¤t_pos.y, s_mouseDeltaY ); + ThreadInterlockedExchange( &s_mouseDeltaX, 0 ); + ThreadInterlockedExchange( &s_mouseDeltaY, 0 ); + } + else + { + GetCursorPos (¤t_pos); + } + } + else +#endif + { + SDL_GetRelativeMouseState( &deltaX, &deltaY ); + current_pos.x = deltaX; + current_pos.y = deltaY; + } + +#ifdef _WIN32 + if ( !m_bRawInput ) + { + if ( m_bMouseThread ) + { + mx = current_pos.x; + my = current_pos.y; + } + else + { + mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum; + my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum; + } + } + else +#endif + { + mx = deltaX + mx_accum; + my = deltaY + my_accum; + } + mx_accum = 0; my_accum = 0; - if (m_filter->value) + if (m_filter && m_filter->value) { mouse_x = (mx + old_mouse_x) * 0.5; mouse_y = (my + old_mouse_y) * 0.5; @@ -335,16 +534,8 @@ void IN_MouseMove ( float frametime, usercmd_t *cmd) old_mouse_x = mx; old_mouse_y = my; - if ( gHUD.GetSensitivity() != 0 ) - { - mouse_x *= gHUD.GetSensitivity(); - mouse_y *= gHUD.GetSensitivity(); - } - else - { - mouse_x *= sensitivity->value; - mouse_y *= sensitivity->value; - } + // Apply custom mouse scaling/acceleration + IN_ScaleMouse( &mouse_x, &mouse_y ); // add mouse X/Y movement to cmd if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) @@ -399,20 +590,35 @@ void IN_MouseMove ( float frametime, usercmd_t *cmd) IN_Accumulate =========== */ -void DLLEXPORT IN_Accumulate (void) +void CL_DLLEXPORT IN_Accumulate (void) { //only accumulate mouse if we are not moving the camera with the mouse - if ( !iMouseInUse && !g_iVisibleMouse ) + if ( !iMouseInUse && !g_iVisibleMouse) { if (mouseactive) { - GetCursorPos (¤t_pos); - - mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); - my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); - +#ifdef _WIN32 + if ( !m_bRawInput ) + { + if ( !m_bMouseThread ) + { + GetCursorPos (¤t_pos); + + mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); + my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); + } + } + else +#endif + { + int deltaX, deltaY; + SDL_GetRelativeMouseState( &deltaX, &deltaY ); + mx_accum += deltaX; + my_accum += deltaY; + } // force the mouse to the center, so there's room to move IN_ResetMouse(); + } } @@ -423,7 +629,7 @@ void DLLEXPORT IN_Accumulate (void) IN_ClearStates =================== */ -void DLLEXPORT IN_ClearStates (void) +void CL_DLLEXPORT IN_ClearStates (void) { if ( !mouseactive ) return; @@ -440,93 +646,66 @@ IN_StartupJoystick */ void IN_StartupJoystick (void) { - int numdevs; - JOYCAPS jc; - MMRESULT mmr; - - // assume no joystick - joy_avail = 0; - // abort startup if user requests no joystick if ( gEngfuncs.CheckParm ("-nojoy", NULL ) ) return; - // verify joystick driver is present - if ((numdevs = joyGetNumDevs ()) == 0) + // assume no joystick + joy_avail = 0; + + int nJoysticks = SDL_NumJoysticks(); + if ( nJoysticks > 0 ) + { + for ( int i = 0; i < nJoysticks; i++ ) + { + if ( SDL_IsGameController( i ) ) + { + s_pJoystick = SDL_GameControllerOpen( i ); + if ( s_pJoystick ) + { + //save the joystick's number of buttons and POV status + joy_numbuttons = SDL_CONTROLLER_BUTTON_MAX; + joy_haspov = 0; + + // old button and POV states default to no buttons pressed + joy_oldbuttonstate = joy_oldpovstate = 0; + + // mark the joystick as available and advanced initialization not completed + // this is needed as cvars are not available during initialization + gEngfuncs.Con_Printf ("joystick found\n\n", SDL_GameControllerName(s_pJoystick)); + joy_avail = 1; + joy_advancedinit = 0; + break; + } + + } + } + } + else { gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); - return; } - - // cycle through the joystick ids for the first valid one - for (joy_id=0 ; joy_idvalue != 0.0) - { - ji.dwUpos += 100; - } - return 1; - } - else - { - // read error occurred - // turning off the joystick seems too harsh for 1 read error,\ - // but what should be done? - // Con_Printf ("IN_ReadJoystick: no response\n"); - // joy_avail = 0; - return 0; - } + SDL_JoystickUpdate(); + return 1; } @@ -750,9 +898,7 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd ) for (i = 0; i < JOY_MAX_AXES; i++) { // get the floating point zero-centered, potentially-inverted data for the current axis - fAxisValue = (float) *pdwRawValue[i]; - // move centerpoint to zero - fAxisValue -= 32768.0; + fAxisValue = (float)pdwRawValue[i]; if (joy_wwhack2->value != 0.0) { @@ -891,7 +1037,6 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd ) viewangles[PITCH] = -cl_pitchup->value; gEngfuncs.SetViewAngles( (float *)viewangles ); - } /* @@ -939,9 +1084,31 @@ void IN_Init (void) joy_wwhack1 = gEngfuncs.pfnRegisterVariable ( "joywwhack1", "0.0", 0 ); joy_wwhack2 = gEngfuncs.pfnRegisterVariable ( "joywwhack2", "0.0", 0 ); + m_customaccel = gEngfuncs.pfnRegisterVariable ( "m_customaccel", "0", FCVAR_ARCHIVE ); + m_customaccel_scale = gEngfuncs.pfnRegisterVariable ( "m_customaccel_scale", "0.04", FCVAR_ARCHIVE ); + m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE ); + m_customaccel_exponent = gEngfuncs.pfnRegisterVariable ( "m_customaccel_exponent", "1", FCVAR_ARCHIVE ); + +#ifdef _WIN32 + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) > 0; + m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL; + m_mousethread_sleep = gEngfuncs.pfnRegisterVariable ( "m_mousethread_sleep", "10", FCVAR_ARCHIVE ); + + if ( !m_bRawInput && m_bMouseThread && m_mousethread_sleep ) + { + s_mouseDeltaX = s_mouseDeltaY = 0; + + s_hMouseQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + if ( s_hMouseQuitEvent ) + { + s_hMouseThread = CreateThread( NULL, 0, MousePos_ThreadFunction, NULL, 0, &s_hMouseThreadId ); + } + } +#endif + gEngfuncs.pfnAddCommand ("force_centerview", Force_CenterView_f); gEngfuncs.pfnAddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f); IN_StartupMouse (); IN_StartupJoystick (); -} \ No newline at end of file +} diff --git a/cl_dll/interpolation.cpp b/cl_dll/interpolation.cpp new file mode 100644 index 0000000..4424ab7 --- /dev/null +++ b/cl_dll/interpolation.cpp @@ -0,0 +1,222 @@ +/************ (C) Copyright 2003 Valve, L.L.C. All rights reserved. *********** +** +** The copyright to the contents herein is the property of Valve, L.L.C. +** The contents may be used and/or copied only with the written permission of +** Valve, L.L.C., or in accordance with the terms and conditions stipulated in +** the agreement/contract under which the contents have been supplied. +** +******************************************************************************* +** +** Contents: +** +** interpolation.cpp: implementation of the interpolation class +** +******************************************************************************/ + +#include "hud.h" +#include "cl_util.h" +#include "interpolation.h" + +// = determinant of matrix a,b,c +#define Determinant(a,b,c) ( (a)[2] * ( (b)[0]*(c)[1] - (b)[1]*(c)[0] ) + \ + (a)[1] * ( (b)[2]*(c)[0] - (b)[0]*(c)[2] ) + \ + (a)[0] * ( (b)[1]*(c)[2] - (b)[2]*(c)[1] ) ) + +// slove 3 vector linear system of equations v0 = x*v1 + y*v2 + z*v3 (if possible) +bool SolveLSE (vec3_t v0, vec3_t v1, vec3_t v2, vec3_t v3, float * x, float * y, float * z) +{ + float d = Determinant(v1,v2,v3); + + if (d==0.0f) + return false; + + if ( x ) + *x = Determinant(v0,v2,v3) / d; + + if ( y ) + *y= Determinant(v1,v0,v3) / d; + + if ( z ) + *z= Determinant(v1,v2,v0) / d; + + return true; +} + +// p = closest point between vector lines a1+x*m1 and a2+x*m2 +bool GetPointBetweenLines(vec3_t &p, vec3_t a1, vec3_t m1, vec3_t a2, vec3_t m2 ) +{ + float x,z; + + vec3_t t1 = CrossProduct(m1, m2); + vec3_t t2 = a2 - a1; + + if ( !SolveLSE( t2, m1, t1, m2, &x , NULL, &z ) ) + return false; + + t1 = a1 + x*m1; + t2 = a2 + (-z)*m2; + + p = ( t1 + t2 ) / 2.0f; + + return true; +} + +// Bernstein Poynom B(u) with n = 2, i = 0 +#define BernsteinPolynom20(u) ((1.0f-u)*(1.0f-u)) +#define BernsteinPolynom21(u) (2.0f*u*(1.0f-u)) +#define BernsteinPolynom22(u) (u*u) + +CInterpolation::CInterpolation() +{ +} + +CInterpolation::~CInterpolation() +{ + m_SmoothStart = m_SmoothEnd = false; +} + +void CInterpolation::SetViewAngles( vec3_t start, vec3_t end ) +{ + m_StartAngle = start; + m_EndAngle = end; + NormalizeAngles( m_StartAngle ); + NormalizeAngles( m_EndAngle ); +} + +void CInterpolation::SetFOVs(float start, float end) +{ + m_StartFov = start; + m_EndFov = end; +} + +void CInterpolation::SetWaypoints( vec3_t * prev, vec3_t start, vec3_t end, vec3_t * next) +{ + m_StartPoint = start; + m_EndPoint = end; + + + vec3_t a,b,c,d; + + if ( !prev && !next ) + { + // no direction given, straight linear interpolation + m_Center = (m_StartPoint + m_EndPoint) / 2.0f; + } + else if ( !prev ) + { + a = start - end; + float dist = a.Length() / 2.0f; + a = a.Normalize(); + b = *next - end; + b = b.Normalize(); + c = a - b; + c = c.Normalize(); + m_Center = end + c*dist; + + } + else if ( !next ) + { + a = *prev - start; + a = a.Normalize(); + b = end - start; + float dist = b.Length() / 2.0f; + b = b.Normalize(); + c = b - a; + c = c.Normalize(); + m_Center = start + c*dist; + } + else + { + // we have a previous and a next point, great! + a = *prev - start; + a = a.Normalize(); + b = end - start; + b = b.Normalize(); + c = b - a; + + a = start - end; + a = a.Normalize(); + b = *next - end; + b = b.Normalize(); + d = a - b; + + GetPointBetweenLines( m_Center, start, c, end, d); + } +} + +void CInterpolation::Interpolate( float t, vec3_t &point, vec3_t &angle, float * fov) +{ + + if ( m_SmoothStart && m_SmoothEnd ) + { + t = (1.0f-t)*(t*t)+t*(1.0f-((t-1.0f)*(t-1.0f))); + } + else if ( m_SmoothStart ) + { + t = t*t; + } + else if ( m_SmoothEnd ) + { + t = t - 1.0f; + t = -(t*t)+1; + } + + if ( point ) + { + BezierInterpolatePoint(t, point); + } + + if ( angle ) + { + InterpolateAngle(t, angle); + } + + if ( fov ) + { + *fov = m_StartFov + (t * (m_EndFov-m_StartFov)); + } +} + +void CInterpolation::BezierInterpolatePoint( float t, vec3_t &point ) +{ + point = m_StartPoint * BernsteinPolynom20(t); + point = point + m_Center * BernsteinPolynom21(t); + point = point + m_EndPoint * BernsteinPolynom22(t); +} + +void CInterpolation::SetSmoothing(bool start, bool end) +{ + m_SmoothStart = start; + m_SmoothEnd = end; + +} + +void CInterpolation::InterpolateAngle( float t, vec3_t &angle ) +{ + int i; + float ang1, ang2; + float d; + + for ( i = 0 ; i < 3 ; i++ ) + { + ang1 = m_StartAngle[i]; + ang2 = m_EndAngle[i]; + + d = ang2 - ang1; + if ( d > 180 ) + { + d -= 360; + } + else if ( d < -180 ) + { + d += 360; + } + + angle[i] = ang1 + d * t; + } + + NormalizeAngles( angle ); +} + + + diff --git a/cl_dll/interpolation.h b/cl_dll/interpolation.h new file mode 100644 index 0000000..1eb5b7f --- /dev/null +++ b/cl_dll/interpolation.h @@ -0,0 +1,56 @@ +/************ (C) Copyright 2003 Valve, L.L.C. All rights reserved. *********** +** +** The copyright to the contents herein is the property of Valve, L.L.C. +** The contents may be used and/or copied only with the written permission of +** Valve, L.L.C., or in accordance with the terms and conditions stipulated in +** the agreement/contract under which the contents have been supplied. +** +******************************************************************************* +** +** Contents: +** +** interpolation.h: Bezier inpolation classes +** +******************************************************************************/ + +#ifndef INTERPOLATION_H +#define INTERPOLATION_H +#ifdef _WIN32 +#pragma once +#endif + + +// interpolation class +class CInterpolation +{ +public: + + CInterpolation(); + virtual ~CInterpolation(); + + void SetWaypoints(vec3_t * prev, vec3_t start, vec3_t end, vec3_t * next); + void SetViewAngles( vec3_t start, vec3_t end ); + void SetFOVs(float start, float end); + void SetSmoothing(bool start, bool end); + + // get interpolated point 0 =< t =< 1, 0 = start, 1 = end + void Interpolate(float t, vec3_t &point, vec3_t &angle, float * fov); + +protected: + + void BezierInterpolatePoint( float t, vec3_t &point ); + void InterpolateAngle( float t, vec3_t &angle ); + + vec3_t m_StartPoint; + vec3_t m_EndPoint; + vec3_t m_StartAngle; + vec3_t m_EndAngle; + vec3_t m_Center; + float m_StartFov; + float m_EndFov; + + bool m_SmoothStart; + bool m_SmoothEnd; +}; + +#endif // INTERPOLATION_H \ No newline at end of file diff --git a/cl_dll/menu.cpp b/cl_dll/menu.cpp index 1f0196b..a1ace59 100644 --- a/cl_dll/menu.cpp +++ b/cl_dll/menu.cpp @@ -63,6 +63,69 @@ int CHudMenu :: VidInit( void ) return 1; } + +/*================================= + ParseEscapeToken + + Interprets the given escape token (backslash followed by a letter). The + first character of the token must be a backslash. The second character + specifies the operation to perform: + + \w : White text (this is the default) + \d : Dim (gray) text + \y : Yellow text + \r : Red text + \R : Right-align (just for the remainder of the current line) +=================================*/ + +static int menu_r, menu_g, menu_b, menu_x, menu_ralign; + +static inline const char* ParseEscapeToken( const char* token ) +{ + if ( *token != '\\' ) + return token; + + token++; + + switch ( *token ) + { + case '\0': + return token; + + case 'w': + menu_r = 255; + menu_g = 255; + menu_b = 255; + break; + + case 'd': + menu_r = 100; + menu_g = 100; + menu_b = 100; + break; + + case 'y': + menu_r = 255; + menu_g = 210; + menu_b = 64; + break; + + case 'r': + menu_r = 210; + menu_g = 24; + menu_b = 0; + break; + + case 'R': + menu_x = ScreenWidth/2; + menu_ralign = TRUE; + break; + } + + return ++token; +} + + int CHudMenu :: Draw( float flTime ) { // check for if menu is set to disappear @@ -84,7 +147,8 @@ int CHudMenu :: Draw( float flTime ) // count the number of newlines int nlc = 0; - for ( int i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ ) + int i; + for ( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ ) { if ( g_szMenuString[i] == '\n' ) nlc++; @@ -92,18 +156,50 @@ int CHudMenu :: Draw( float flTime ) // center it int y = (ScreenHeight/2) - ((nlc/2)*12) - 40; // make sure it is above the say text - int x = 20; - i = 0; - while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' ) + menu_r = 255; + menu_g = 255; + menu_b = 255; + menu_x = 20; + menu_ralign = FALSE; + + const char* sptr = g_szMenuString; + + while ( *sptr != '\0' ) { - gHUD.DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 ); - y += 12; - - while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' ) - i++; - if ( g_szMenuString[i] == '\n' ) - i++; + if ( *sptr == '\\' ) + { + sptr = ParseEscapeToken( sptr ); + } + else if ( *sptr == '\n' ) + { + menu_ralign = FALSE; + menu_x = 20; + y += (12); + + sptr++; + } + else + { + char menubuf[ 80 ]; + const char *ptr = sptr; + while ( *sptr != '\0' && *sptr != '\n' && *sptr != '\\') + { + sptr++; + } + strncpy( menubuf, ptr, min( ( sptr - ptr), (int)sizeof( menubuf ) )); + menubuf[ min( ( sptr - ptr), (int)(sizeof( menubuf )-1) ) ] = '\0'; + + if ( menu_ralign ) + { + // IMPORTANT: Right-to-left rendered text does not parse escape tokens! + menu_x = gHUD.DrawHudStringReverse( menu_x, y, 0, menubuf, menu_r, menu_g, menu_b ); + } + else + { + menu_x = gHUD.DrawHudString( menu_x, y, 320, menubuf, menu_r, menu_g, menu_b ); + } + } } return 1; @@ -117,7 +213,7 @@ void CHudMenu :: SelectMenuItem( int menu_item ) { char szbuf[32]; sprintf( szbuf, "menuselect %d\n", menu_item ); - ClientCmd( szbuf ); + EngineClientCmd( szbuf ); // remove the menu m_fMenuDisplayed = 0; diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index 61ea55a..c5062dd 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -147,13 +147,13 @@ void CHudMessage::MessageScanNextChar( void ) srcGreen = m_parms.pMessage->g1; srcBlue = m_parms.pMessage->b1; blend = 0; // Pure source + destRed = destGreen = destBlue = 0; switch( m_parms.pMessage->effect ) { // Fade-in / Fade-out case 0: case 1: - destRed = destGreen = destBlue = 0; blend = m_parms.fadeBlend; break; @@ -168,7 +168,6 @@ void CHudMessage::MessageScanNextChar( void ) { float deltaTime = m_parms.time - m_parms.charTime; - destRed = destGreen = destBlue = 0; if ( m_parms.time > m_parms.fadeTime ) { blend = m_parms.fadeBlend; diff --git a/cl_dll/player_info.h b/cl_dll/player_info.h new file mode 100644 index 0000000..2ad9004 --- /dev/null +++ b/cl_dll/player_info.h @@ -0,0 +1,20 @@ +/*** +* +* Copyright (c) 2003', Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ + +extern hud_player_info_t g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine +extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll +extern team_info_t g_TeamInfo[MAX_TEAMS+1]; +extern int g_IsSpectator[MAX_PLAYERS+1]; + diff --git a/cl_dll/saytext.cpp b/cl_dll/saytext.cpp index 7f24cf4..937fd16 100644 --- a/cl_dll/saytext.cpp +++ b/cl_dll/saytext.cpp @@ -24,6 +24,7 @@ #include #include +#include // _alloca #include "vgui_TeamFortressViewport.h" @@ -129,16 +130,25 @@ int CHudSayText :: Draw( float flTime ) if ( *g_szLineBuffer[i] == 2 && g_pflNameColors[i] ) { // it's a saytext string - static char buf[MAX_PLAYER_NAME_LENGTH+32]; + char *buf = static_cast( _alloca( strlen( g_szLineBuffer[i] ) ) ); + if ( buf ) + { + //char buf[MAX_PLAYER_NAME_LENGTH+32]; - // draw the first x characters in the player color - strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) ); - buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0; - gEngfuncs.pfnDrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); - int x = DrawConsoleString( LINE_START, y, buf ); - - // color is reset after each string draw - DrawConsoleString( x, y, g_szLineBuffer[i] + g_iNameLengths[i] ); + // draw the first x characters in the player color + strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) ); + buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0; + gEngfuncs.pfnDrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); + int x = DrawConsoleString( LINE_START, y, buf + 1 ); // don't draw the control code at the start + strncpy( buf, g_szLineBuffer[i] + g_iNameLengths[i], strlen( g_szLineBuffer[i] )); + buf[ strlen( g_szLineBuffer[i] + g_iNameLengths[i] ) - 1 ] = '\0'; + // color is reset after each string draw + DrawConsoleString( x, y, buf ); + } + else + { + assert( "Not able to alloca chat buffer!\n"); + } } else { @@ -150,7 +160,6 @@ int CHudSayText :: Draw( float flTime ) y += line_height; } - return 1; } @@ -173,8 +182,9 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn return; } + int i; // find an empty string slot - for ( int i = 0; i < MAX_LINES; i++ ) + for ( i = 0; i < MAX_LINES; i++ ) { if ( ! *g_szLineBuffer[i] ) break; @@ -192,7 +202,7 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn // if it's a say message, search for the players name in the string if ( *pszBuf == 2 && clientIndex > 0 ) { - GetPlayerInfo( clientIndex, &g_PlayerInfoList[clientIndex] ); + gEngfuncs.pfnGetPlayerInfo( clientIndex, &g_PlayerInfoList[clientIndex] ); const char *pName = g_PlayerInfoList[clientIndex].name; if ( pName ) @@ -207,7 +217,7 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn } } - strncpy( g_szLineBuffer[i], pszBuf, max(iBufSize -1, MAX_CHARS_PER_LINE-1) ); + strncpy( g_szLineBuffer[i], pszBuf, max(iBufSize , MAX_CHARS_PER_LINE) ); // make sure the text fits in one line EnsureTextFitsInOneLineAndWrapIfHaveTo( i ); @@ -221,12 +231,7 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn m_iFlags |= HUD_ACTIVE; PlaySound( "misc/talk.wav", 1 ); - if ( ScreenHeight >= 480 ) - Y_START = ScreenHeight - 60; - else - Y_START = ScreenHeight - 45; - Y_START -= (line_height * (MAX_LINES+1)); - + Y_START = ScreenHeight - 60 - ( line_height * (MAX_LINES+2) ); } void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line ) @@ -318,4 +323,4 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line ) } } } -} \ No newline at end of file +} diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp new file mode 100644 index 0000000..397c91e --- /dev/null +++ b/cl_dll/scoreboard.cpp @@ -0,0 +1,586 @@ +/*** +* +* Copyright (c) 1999, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// +// Scoreboard.cpp +// +// implementation of CHudScoreboard class +// + +#include "hud.h" +#include "cl_util.h" +#include "parsemsg.h" + +#include +#include +#include "vgui_TeamFortressViewport.h" + +DECLARE_COMMAND( m_Scoreboard, ShowScores ); +DECLARE_COMMAND( m_Scoreboard, HideScores ); + +DECLARE_MESSAGE( m_Scoreboard, ScoreInfo ); +DECLARE_MESSAGE( m_Scoreboard, TeamInfo ); +DECLARE_MESSAGE( m_Scoreboard, TeamScore ); + +int CHudScoreboard :: Init( void ) +{ + gHUD.AddHudElem( this ); + + // Hook messages & commands here + //HOOK_COMMAND( "+showscores", ShowScores ); + //HOOK_COMMAND( "-showscores", HideScores ); + + HOOK_MESSAGE( ScoreInfo ); + HOOK_MESSAGE( TeamScore ); + HOOK_MESSAGE( TeamInfo ); + + InitHUDData(); + + cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE ); + + return 1; +} + + +int CHudScoreboard :: VidInit( void ) +{ + // Load sprites here + + return 1; +} + +void CHudScoreboard :: InitHUDData( void ) +{ + memset( g_PlayerExtraInfo, 0, sizeof g_PlayerExtraInfo ); + m_iLastKilledBy = 0; + m_fLastKillTime = 0; + m_iPlayerNum = 0; + m_iNumTeams = 0; + memset( g_TeamInfo, 0, sizeof g_TeamInfo ); + + m_iFlags &= ~HUD_ACTIVE; // starts out inactive + + m_iFlags |= HUD_INTERMISSION; // is always drawn during an intermission +} + +/* The scoreboard +We have a minimum width of 1-320 - we could have the field widths scale with it? +*/ + +// X positions +// relative to the side of the scoreboard +#define NAME_RANGE_MIN 20 +#define NAME_RANGE_MAX 145 +#define KILLS_RANGE_MIN 130 +#define KILLS_RANGE_MAX 170 +#define DIVIDER_POS 180 +#define DEATHS_RANGE_MIN 185 +#define DEATHS_RANGE_MAX 210 +#define PING_RANGE_MIN 245 +#define PING_RANGE_MAX 295 +#define PL_RANGE_MIN 315 +#define PL_RANGE_MAX 375 + +int SCOREBOARD_WIDTH = 320; + + +// Y positions +#define ROW_GAP 13 +#define ROW_RANGE_MIN 15 +#define ROW_RANGE_MAX ( ScreenHeight - 50 ) + +int CHudScoreboard :: Draw( float fTime ) +{ + int can_show_packetloss = 0; + int FAR_RIGHT; + + if ( !m_iShowscoresHeld && gHUD.m_Health.m_iHealth > 0 && !gHUD.m_iIntermission ) + return 1; + + GetAllPlayersInfo(); + + // Packetloss removed on Kelly 'shipping nazi' Bailey's orders + if ( cl_showpacketloss && cl_showpacketloss->value && ( ScreenWidth >= 400 ) ) + { + can_show_packetloss = 1; + SCOREBOARD_WIDTH = 400; + } + else + { + SCOREBOARD_WIDTH = 320; + } + + // just sort the list on the fly + // list is sorted first by frags, then by deaths + float list_slot = 0; + int xpos_rel = (ScreenWidth - SCOREBOARD_WIDTH) / 2; + + // print the heading line + int ypos = ROW_RANGE_MIN + (list_slot * ROW_GAP); + int xpos = NAME_RANGE_MIN + xpos_rel; + + if ( !gHUD.m_Teamplay ) + gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 ); + else + gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 ); + + gHUD.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 ); + gHUD.DrawHudString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 ); + gHUD.DrawHudString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 ); + gHUD.DrawHudString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 ); + + if ( can_show_packetloss ) + { + gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 ); + } + + FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX; + FAR_RIGHT += 5; + + list_slot += 1.2; + ypos = ROW_RANGE_MIN + (list_slot * ROW_GAP); + xpos = NAME_RANGE_MIN + xpos_rel; + FillRGBA( xpos - 5, ypos, FAR_RIGHT, 1, 255, 140, 0, 255); // draw the seperator line + + list_slot += 0.8; + + if ( !gHUD.m_Teamplay ) + { + // it's not teamplay, so just draw a simple player list + DrawPlayers( xpos_rel, list_slot ); + return 1; + } + + // clear out team scores + for ( int i = 1; i <= m_iNumTeams; i++ ) + { + if ( !g_TeamInfo[i].scores_overriden ) + g_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0; + g_TeamInfo[i].ping = g_TeamInfo[i].packetloss = 0; + } + + // recalc the team scores, then draw them + for ( i = 1; i < MAX_PLAYERS; i++ ) + { + if ( g_PlayerInfoList[i].name == NULL ) + continue; // empty player slot, skip + + if ( g_PlayerExtraInfo[i].teamname[0] == 0 ) + continue; // skip over players who are not in a team + + // find what team this player is in + for ( int j = 1; j <= m_iNumTeams; j++ ) + { + if ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) ) + break; + } + if ( j > m_iNumTeams ) // player is not in a team, skip to the next guy + continue; + + if ( !g_TeamInfo[j].scores_overriden ) + { + g_TeamInfo[j].frags += g_PlayerExtraInfo[i].frags; + g_TeamInfo[j].deaths += g_PlayerExtraInfo[i].deaths; + } + + g_TeamInfo[j].ping += g_PlayerInfoList[i].ping; + g_TeamInfo[j].packetloss += g_PlayerInfoList[i].packetloss; + + if ( g_PlayerInfoList[i].thisplayer ) + g_TeamInfo[j].ownteam = TRUE; + else + g_TeamInfo[j].ownteam = FALSE; + } + + // find team ping/packetloss averages + for ( i = 1; i <= m_iNumTeams; i++ ) + { + g_TeamInfo[i].already_drawn = FALSE; + + if ( g_TeamInfo[i].players > 0 ) + { + g_TeamInfo[i].ping /= g_TeamInfo[i].players; // use the average ping of all the players in the team as the teams ping + g_TeamInfo[i].packetloss /= g_TeamInfo[i].players; // use the average ping of all the players in the team as the teams ping + } + } + + // Draw the teams + while ( 1 ) + { + int highest_frags = -99999; int lowest_deaths = 99999; + int best_team = 0; + + for ( i = 1; i <= m_iNumTeams; i++ ) + { + if ( g_TeamInfo[i].players < 0 ) + continue; + + if ( !g_TeamInfo[i].already_drawn && g_TeamInfo[i].frags >= highest_frags ) + { + if ( g_TeamInfo[i].frags > highest_frags || g_TeamInfo[i].deaths < lowest_deaths ) + { + best_team = i; + lowest_deaths = g_TeamInfo[i].deaths; + highest_frags = g_TeamInfo[i].frags; + } + } + } + + // draw the best team on the scoreboard + if ( !best_team ) + break; + + // draw out the best team + team_info_t *team_info = &g_TeamInfo[best_team]; + + ypos = ROW_RANGE_MIN + (list_slot * ROW_GAP); + + // check we haven't drawn too far down + if ( ypos > ROW_RANGE_MAX ) // don't draw to close to the lower border + break; + + xpos = NAME_RANGE_MIN + xpos_rel; + int r = 255, g = 225, b = 55; // draw the stuff kinda yellowish + + if ( team_info->ownteam ) // if it is their team, draw the background different color + { + // overlay the background in blue, then draw the score text over it + FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 ); + } + + // draw their name (left to right) + gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b ); + + // draw kills (right to left) + xpos = KILLS_RANGE_MAX + xpos_rel; + gHUD.DrawHudNumberString( xpos, ypos, KILLS_RANGE_MIN + xpos_rel, team_info->frags, r, g, b ); + + // draw divider + xpos = DIVIDER_POS + xpos_rel; + gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b ); + + // draw deaths + xpos = DEATHS_RANGE_MAX + xpos_rel; + gHUD.DrawHudNumberString( xpos, ypos, DEATHS_RANGE_MIN + xpos_rel, team_info->deaths, r, g, b ); + + // draw ping + // draw ping & packetloss + static char buf[64]; + sprintf( buf, "%d", team_info->ping ); + xpos = ((PING_RANGE_MAX - PING_RANGE_MIN) / 2) + PING_RANGE_MIN + xpos_rel + 25; + UnpackRGB( r, g, b, RGB_YELLOWISH ); + gHUD.DrawHudStringReverse( xpos, ypos, xpos - 50, buf, r, g, b ); + + // Packetloss removed on Kelly 'shipping nazi' Bailey's orders + if ( can_show_packetloss ) + { + xpos = ((PL_RANGE_MAX - PL_RANGE_MIN) / 2) + PL_RANGE_MIN + xpos_rel + 25; + + sprintf( buf, " %d", team_info->packetloss ); + gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b ); + } + + team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again + list_slot++; + + // draw all the players that belong to this team, indented slightly + list_slot = DrawPlayers( xpos_rel, list_slot, 10, team_info->name ); + } + + // draw all the players who are not in a team + list_slot += 0.5; + DrawPlayers( xpos_rel, list_slot, 0, "" ); + + return 1; +} + +// returns the ypos where it finishes drawing +int CHudScoreboard :: DrawPlayers( int xpos_rel, float list_slot, int nameoffset, char *team ) +{ + int can_show_packetloss = 0; + int FAR_RIGHT; + + // Packetloss removed on Kelly 'shipping nazi' Bailey's orders + if ( cl_showpacketloss && cl_showpacketloss->value && ( ScreenWidth >= 400 ) ) + { + can_show_packetloss = 1; + SCOREBOARD_WIDTH = 400; + } + else + { + SCOREBOARD_WIDTH = 320; + } + + FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX; + FAR_RIGHT += 5; + + // draw the players, in order, and restricted to team if set + while ( 1 ) + { + // Find the top ranking player + int highest_frags = -99999; int lowest_deaths = 99999; + int best_player = 0; + + for ( int i = 1; i < MAX_PLAYERS; i++ ) + { + if ( g_PlayerInfoList[i].name && g_PlayerExtraInfo[i].frags >= highest_frags ) + { + if ( !(team && stricmp(g_PlayerExtraInfo[i].teamname, team)) ) // make sure it is the specified team + { + extra_player_info_t *pl_info = &g_PlayerExtraInfo[i]; + if ( pl_info->frags > highest_frags || pl_info->deaths < lowest_deaths ) + { + best_player = i; + lowest_deaths = pl_info->deaths; + highest_frags = pl_info->frags; + } + } + } + } + + if ( !best_player ) + break; + + // draw out the best player + hud_player_info_t *pl_info = &g_PlayerInfoList[best_player]; + + int ypos = ROW_RANGE_MIN + (list_slot * ROW_GAP); + + // check we haven't drawn too far down + if ( ypos > ROW_RANGE_MAX ) // don't draw to close to the lower border + break; + + int xpos = NAME_RANGE_MIN + xpos_rel; + int r = 255, g = 255, b = 255; + if ( best_player == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime ) + { + if ( pl_info->thisplayer ) + { // green is the suicide color? i wish this could do grey... + FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 80, 155, 0, 70 ); + } + else + { // Highlight the killers name - overlay the background in red, then draw the score text over it + FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 255, 0, 0, ((float)15 * (float)(m_fLastKillTime - gHUD.m_flTime)) ); + } + } + else if ( pl_info->thisplayer ) // if it is their name, draw it a different color + { + // overlay the background in blue, then draw the score text over it + FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 ); + } + + // draw their name (left to right) + gHUD.DrawHudString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b ); + + // draw kills (right to left) + xpos = KILLS_RANGE_MAX + xpos_rel; + gHUD.DrawHudNumberString( xpos, ypos, KILLS_RANGE_MIN + xpos_rel, g_PlayerExtraInfo[best_player].frags, r, g, b ); + + // draw divider + xpos = DIVIDER_POS + xpos_rel; + gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b ); + + // draw deaths + xpos = DEATHS_RANGE_MAX + xpos_rel; + gHUD.DrawHudNumberString( xpos, ypos, DEATHS_RANGE_MIN + xpos_rel, g_PlayerExtraInfo[best_player].deaths, r, g, b ); + + // draw ping & packetloss + static char buf[64]; + sprintf( buf, "%d", g_PlayerInfoList[best_player].ping ); + xpos = ((PING_RANGE_MAX - PING_RANGE_MIN) / 2) + PING_RANGE_MIN + xpos_rel + 25; + gHUD.DrawHudStringReverse( xpos, ypos, xpos - 50, buf, r, g, b ); + + // Packetloss removed on Kelly 'shipping nazi' Bailey's orders + if ( can_show_packetloss ) + { + if ( g_PlayerInfoList[best_player].packetloss >= 63 ) + { + UnpackRGB( r, g, b, RGB_REDISH ); + sprintf( buf, " !!!!" ); + } + else + { + sprintf( buf, " %d", g_PlayerInfoList[best_player].packetloss ); + } + + xpos = ((PL_RANGE_MAX - PL_RANGE_MIN) / 2) + PL_RANGE_MIN + xpos_rel + 25; + + gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b ); + } + + pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again + list_slot++; + } + + return list_slot; +} + + +void CHudScoreboard :: GetAllPlayersInfo( void ) +{ + for ( int i = 1; i < MAX_PLAYERS; i++ ) + { + GetPlayerInfo( i, &g_PlayerInfoList[i] ); + + if ( g_PlayerInfoList[i].thisplayer ) + m_iPlayerNum = i; // !!!HACK: this should be initialized elsewhere... maybe gotten from the engine + } +} + +int CHudScoreboard :: MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf ) +{ + m_iFlags |= HUD_ACTIVE; + + BEGIN_READ( pbuf, iSize ); + short cl = READ_BYTE(); + short frags = READ_SHORT(); + short deaths = READ_SHORT(); + short playerclass = READ_SHORT(); + short teamnumber = READ_SHORT(); + + if ( cl > 0 && cl <= MAX_PLAYERS ) + { + g_PlayerExtraInfo[cl].frags = frags; + g_PlayerExtraInfo[cl].deaths = deaths; + g_PlayerExtraInfo[cl].playerclass = playerclass; + g_PlayerExtraInfo[cl].teamnumber = teamnumber; + + gViewPort->UpdateOnPlayerInfo(); + } + + return 1; +} + +// Message handler for TeamInfo message +// accepts two values: +// byte: client number +// string: client team name +int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf ) +{ + BEGIN_READ( pbuf, iSize ); + short cl = READ_BYTE(); + + if ( cl > 0 && cl <= MAX_PLAYERS ) + { // set the players team + strncpy( g_PlayerExtraInfo[cl].teamname, READ_STRING(), MAX_TEAM_NAME ); + } + + // rebuild the list of teams + + // clear out player counts from teams + for ( int i = 1; i <= m_iNumTeams; i++ ) + { + g_TeamInfo[i].players = 0; + } + + // rebuild the team list + GetAllPlayersInfo(); + m_iNumTeams = 0; + for ( i = 1; i < MAX_PLAYERS; i++ ) + { + if ( g_PlayerInfoList[i].name == NULL ) + continue; + + if ( g_PlayerExtraInfo[i].teamname[0] == 0 ) + continue; // skip over players who are not in a team + + // is this player in an existing team? + for ( int j = 1; j <= m_iNumTeams; j++ ) + { + if ( g_TeamInfo[j].name[0] == '\0' ) + break; + + if ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) ) + break; + } + + if ( j > m_iNumTeams ) + { // they aren't in a listed team, so make a new one + // search through for an empty team slot + for ( int j = 1; j <= m_iNumTeams; j++ ) + { + if ( g_TeamInfo[j].name[0] == '\0' ) + break; + } + m_iNumTeams = max( j, m_iNumTeams ); + + strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME ); + g_TeamInfo[j].players = 0; + } + + g_TeamInfo[j].players++; + } + + // clear out any empty teams + for ( i = 1; i <= m_iNumTeams; i++ ) + { + if ( g_TeamInfo[i].players < 1 ) + memset( &g_TeamInfo[i], 0, sizeof(team_info_t) ); + } + + return 1; +} + +// Message handler for TeamScore message +// accepts three values: +// string: team name +// short: teams kills +// short: teams deaths +// if this message is never received, then scores will simply be the combined totals of the players. +int CHudScoreboard :: MsgFunc_TeamScore( const char *pszName, int iSize, void *pbuf ) +{ + BEGIN_READ( pbuf, iSize ); + char *TeamName = READ_STRING(); + + // find the team matching the name + for ( int i = 1; i <= m_iNumTeams; i++ ) + { + if ( !stricmp( TeamName, g_TeamInfo[i].name ) ) + break; + } + if ( i > m_iNumTeams ) + return 1; + + // use this new score data instead of combined player scores + g_TeamInfo[i].scores_overriden = TRUE; + g_TeamInfo[i].frags = READ_SHORT(); + g_TeamInfo[i].deaths = READ_SHORT(); + + return 1; +} + +void CHudScoreboard :: DeathMsg( int killer, int victim ) +{ + // if we were the one killed, or the world killed us, set the scoreboard to indicate suicide + if ( victim == m_iPlayerNum || killer == 0 ) + { + m_iLastKilledBy = killer ? killer : m_iPlayerNum; + m_fLastKillTime = gHUD.m_flTime + 10; // display who we were killed by for 10 seconds + + if ( killer == m_iPlayerNum ) + m_iLastKilledBy = m_iPlayerNum; + } +} + + + +void CHudScoreboard :: UserCmd_ShowScores( void ) +{ + m_iShowscoresHeld = TRUE; +} + +void CHudScoreboard :: UserCmd_HideScores( void ) +{ + m_iShowscoresHeld = FALSE; +} diff --git a/cl_dll/status_icons.cpp b/cl_dll/status_icons.cpp index 5bbcec8..eaa0d42 100644 --- a/cl_dll/status_icons.cpp +++ b/cl_dll/status_icons.cpp @@ -106,8 +106,9 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p // add the icon to the icon list, and set it's drawing color void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue ) { + int i; // check to see if the sprite is in the current list - for ( int i = 0; i < MAX_ICONSPRITES; i++ ) + for ( i = 0; i < MAX_ICONSPRITES; i++ ) { if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) ) break; @@ -155,7 +156,7 @@ void CHudStatusIcons::DisableIcon( char *pszIconName ) if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) ) { // clear the item from the list - memset( &m_IconList[i], 0, sizeof icon_sprite_t ); + memset( &m_IconList[i], 0, sizeof(icon_sprite_t) ); return; } } diff --git a/cl_dll/statusbar.cpp b/cl_dll/statusbar.cpp index 28018da..23e1f0b 100644 --- a/cl_dll/statusbar.cpp +++ b/cl_dll/statusbar.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -29,7 +29,11 @@ DECLARE_MESSAGE( m_StatusBar, StatusText ); DECLARE_MESSAGE( m_StatusBar, StatusValue ); +#ifdef _TFC +#define STATUSBAR_ID_LINE 2 +#else #define STATUSBAR_ID_LINE 1 +#endif float *GetClientColor( int clientIndex ); extern float g_ColorYellow[3]; @@ -138,7 +142,7 @@ void CHudStatusBar :: ParseStatusString( int line_num ) switch ( valtype ) { case 'p': // player name - GetPlayerInfo( indexval, &g_PlayerInfoList[indexval] ); + gEngfuncs.pfnGetPlayerInfo( indexval, &g_PlayerInfoList[indexval] ); if ( g_PlayerInfoList[indexval].name != NULL ) { strncpy( szRepString, g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH ); @@ -184,15 +188,15 @@ int CHudStatusBar :: Draw( float fTime ) m_bReparseString = FALSE; } - int Y_START = ScreenHeight - YRES(32 + 4); - + int Y_START = ScreenHeight - 52; + // Draw the status bar lines for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) { int TextHeight, TextWidth; GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight ); - - int x = 4; + + int x = 8; int y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen // let user set status ID bar centering @@ -229,17 +233,13 @@ int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *p int line = READ_BYTE(); - if ( line < 0 || line >= MAX_STATUSBAR_LINES ) + if ( line < 0 || line > MAX_STATUSBAR_LINES ) return 1; strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH ); m_szStatusText[line][MAX_STATUSTEXT_LENGTH-1] = 0; // ensure it's null terminated ( strncpy() won't null terminate if read string too long) - if ( m_szStatusText[0] == 0 ) - m_iFlags &= ~HUD_ACTIVE; - else - m_iFlags |= HUD_ACTIVE; // we have status text, so turn on the status bar - + m_iFlags |= HUD_ACTIVE; m_bReparseString = TRUE; return 1; @@ -254,7 +254,7 @@ int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void * BEGIN_READ( pbuf, iSize ); int index = READ_BYTE(); - if ( index < 1 || index >= MAX_STATUSBAR_VALUES ) + if ( index < 1 || index > MAX_STATUSBAR_VALUES ) return 1; // index out of range m_iStatusValues[index] = READ_SHORT(); diff --git a/cl_dll/text_message.cpp b/cl_dll/text_message.cpp index c18dd25..a6bc8e9 100644 --- a/cl_dll/text_message.cpp +++ b/cl_dll/text_message.cpp @@ -163,22 +163,23 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf int msg_dest = READ_BYTE(); - static char szBuf[6][128]; +#define MSG_BUF_SIZE 128 + static char szBuf[6][MSG_BUF_SIZE]; char *msg_text = LookupString( READ_STRING(), &msg_dest ); - msg_text = strcpy( szBuf[0], msg_text ); + msg_text = safe_strcpy( szBuf[0], msg_text , MSG_BUF_SIZE); // keep reading strings and using C format strings for subsituting the strings into the localised text string char *sstr1 = LookupString( READ_STRING() ); - sstr1 = strcpy( szBuf[1], sstr1 ); + sstr1 = safe_strcpy( szBuf[1], sstr1 , MSG_BUF_SIZE); StripEndNewlineFromString( sstr1 ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines char *sstr2 = LookupString( READ_STRING() ); - sstr2 = strcpy( szBuf[2], sstr2 ); + sstr2 = safe_strcpy( szBuf[2], sstr2 , MSG_BUF_SIZE); StripEndNewlineFromString( sstr2 ); char *sstr3 = LookupString( READ_STRING() ); - sstr3 = strcpy( szBuf[3], sstr3 ); + sstr3 = safe_strcpy( szBuf[3], sstr3 , MSG_BUF_SIZE); StripEndNewlineFromString( sstr3 ); char *sstr4 = LookupString( READ_STRING() ); - sstr4 = strcpy( szBuf[4], sstr4 ); + sstr4 = safe_strcpy( szBuf[4], sstr4 , MSG_BUF_SIZE); StripEndNewlineFromString( sstr4 ); char *psz = szBuf[5]; @@ -188,23 +189,23 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf switch ( msg_dest ) { case HUD_PRINTCENTER: - sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 ); + safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 ); CenterPrint( ConvertCRtoNL( psz ) ); break; case HUD_PRINTNOTIFY: psz[0] = 1; // mark this message to go into the notify buffer - sprintf( psz+1, msg_text, sstr1, sstr2, sstr3, sstr4 ); + safe_sprintf( psz+1, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 ); ConsolePrint( ConvertCRtoNL( psz ) ); break; case HUD_PRINTTALK: - sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 ); + safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 ); gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 ); break; case HUD_PRINTCONSOLE: - sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 ); + safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 ); ConsolePrint( ConvertCRtoNL( psz ) ); break; } diff --git a/cl_dll/tri.cpp b/cl_dll/tri.cpp index fc7fb8f..3da5307 100644 --- a/cl_dll/tri.cpp +++ b/cl_dll/tri.cpp @@ -16,80 +16,11 @@ #include "entity_state.h" #include "cl_entity.h" #include "triangleapi.h" +#include "Exports.h" -#define DLLEXPORT __declspec( dllexport ) - -extern "C" -{ - void DLLEXPORT HUD_DrawNormalTriangles( void ); - void DLLEXPORT HUD_DrawTransparentTriangles( void ); -}; - -//#define TEST_IT -#if defined( TEST_IT ) - -/* -================= -Draw_Triangles - -Example routine. Draws a sprite offset from the player origin. -================= -*/ -void Draw_Triangles( void ) -{ - cl_entity_t *player; - vec3_t org; - - // Load it up with some bogus data - player = gEngfuncs.GetLocalPlayer(); - if ( !player ) - return; - - org = player->origin; - - org.x += 50; - org.y += 50; - - if (gHUD.m_hsprCursor == 0) - { - char sz[256]; - sprintf( sz, "sprites/cursor.spr" ); - gHUD.m_hsprCursor = SPR_Load( sz ); - } - - if ( !gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( gHUD.m_hsprCursor ), 0 )) - { - return; - } - - // Create a triangle, sigh - gEngfuncs.pTriAPI->RenderMode( kRenderNormal ); - gEngfuncs.pTriAPI->CullFace( TRI_NONE ); - gEngfuncs.pTriAPI->Begin( TRI_QUADS ); - // Overload p->color with index into tracer palette, p->packedColor with brightness - gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 ); - // UNDONE: This gouraud shading causes tracers to disappear on some cards (permedia2) - gEngfuncs.pTriAPI->Brightness( 1 ); - gEngfuncs.pTriAPI->TexCoord2f( 0, 0 ); - gEngfuncs.pTriAPI->Vertex3f( org.x, org.y, org.z ); - - gEngfuncs.pTriAPI->Brightness( 1 ); - gEngfuncs.pTriAPI->TexCoord2f( 0, 1 ); - gEngfuncs.pTriAPI->Vertex3f( org.x, org.y + 50, org.z ); - - gEngfuncs.pTriAPI->Brightness( 1 ); - gEngfuncs.pTriAPI->TexCoord2f( 1, 1 ); - gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y + 50, org.z ); - - gEngfuncs.pTriAPI->Brightness( 1 ); - gEngfuncs.pTriAPI->TexCoord2f( 1, 0 ); - gEngfuncs.pTriAPI->Vertex3f( org.x + 50, org.y, org.z ); - - gEngfuncs.pTriAPI->End(); - gEngfuncs.pTriAPI->RenderMode( kRenderNormal ); -} - -#endif +#include "particleman.h" +#include "tri.h" +extern IParticleMan *g_pParticleMan; /* ================= @@ -98,16 +29,17 @@ HUD_DrawNormalTriangles Non-transparent triangles-- add them here ================= */ -void DLLEXPORT HUD_DrawNormalTriangles( void ) +void CL_DLLEXPORT HUD_DrawNormalTriangles( void ) { +// RecClDrawNormalTriangles(); gHUD.m_Spectator.DrawOverview(); - -#if defined( TEST_IT ) -// Draw_Triangles(); -#endif } +#if defined( _TFC ) +void RunEventList( void ); +#endif + /* ================= HUD_DrawTransparentTriangles @@ -115,10 +47,14 @@ HUD_DrawTransparentTriangles Render any triangles with transparent rendermode needs here ================= */ -void DLLEXPORT HUD_DrawTransparentTriangles( void ) +void CL_DLLEXPORT HUD_DrawTransparentTriangles( void ) { +// RecClDrawTransparentTriangles(); -#if defined( TEST_IT ) -// Draw_Triangles(); +#if defined( _TFC ) + RunEventList(); #endif -} \ No newline at end of file + + if ( g_pParticleMan ) + g_pParticleMan->Update(); +} diff --git a/cl_dll/tri.h b/cl_dll/tri.h new file mode 100644 index 0000000..0dfbeb1 --- /dev/null +++ b/cl_dll/tri.h @@ -0,0 +1,13 @@ +#ifndef TRI_H +#define TRI_H + +#include "particleman.h" + +extern IParticleMan *g_pParticleMan; + + + + + + +#endif //TRI_H \ No newline at end of file diff --git a/cl_dll/util.cpp b/cl_dll/util.cpp index f2e3f31..4ff7096 100644 --- a/cl_dll/util.cpp +++ b/cl_dll/util.cpp @@ -18,9 +18,9 @@ // implementation of class-less helper functions // -#include "STDIO.H" -#include "STDLIB.H" -#include "MATH.H" +#include "stdio.h" +#include "stdlib.h" +#include "math.h" #include "hud.h" #include "cl_util.h" diff --git a/cl_dll/util_vector.h b/cl_dll/util_vector.h index 4a1ba9c..05829a0 100644 --- a/cl_dll/util_vector.h +++ b/cl_dll/util_vector.h @@ -17,13 +17,13 @@ // // Misc C-runtime library headers -#include "STDIO.H" -#include "STDLIB.H" -#include "MATH.H" +#include "stdio.h" +#include "stdlib.h" +#include "math.h" // Header file containing definition of globalvars_t and entvars_t -typedef int func_t; // -typedef int string_t; // from engine's pr_comp.h; +typedef unsigned int func_t; // +typedef unsigned int string_t; // from engine's pr_comp.h; typedef float vec_t; // needed before including progdefs.h //========================================================= @@ -61,6 +61,7 @@ public: vec_t x, y; }; +#undef DotProduct inline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); } inline Vector2D operator*(float fl, const Vector2D& v) { return v * fl; } @@ -118,4 +119,7 @@ inline Vector operator*(float fl, const Vector& v) { return v * fl; } inline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); } inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ); } +#ifndef DID_VEC3_T_DEFINE +#define DID_VEC3_T_DEFINE #define vec3_t Vector +#endif diff --git a/cl_dll/vgui_ClassMenu.cpp b/cl_dll/vgui_ClassMenu.cpp index ba94fd0..13c48c0 100644 --- a/cl_dll/vgui_ClassMenu.cpp +++ b/cl_dll/vgui_ClassMenu.cpp @@ -102,6 +102,7 @@ CClassMenuPanel::CClassMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide m_pScrollPanel->validate(); // Create the Class buttons +#ifdef _TFC for (int i = 0; i <= PC_RANDOM; i++) { char sz[256]; @@ -153,7 +154,7 @@ CClassMenuPanel::CClassMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide pNameLabel->setBgColor( r, g, b, a ); pNameLabel->setContentAlignment( vgui::Label::a_west ); //pNameLabel->setBorder(new LineBorder()); - pNameLabel->setText(localName); + pNameLabel->setText( "%s", localName); // Create the Class Image if ( bShowClassGraphic ) @@ -239,7 +240,7 @@ CClassMenuPanel::CClassMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide //m_pClassInfoPanel[i]->setBorder(new LineBorder()); } - +#endif // Create the Cancel button m_pCancelButton = new CommandButton( gHUD.m_TextMessage.BufferedLocaliseTextString( "#Menu_Cancel" ), CLASSMENU_TOPLEFT_BUTTON_X, 0, CLASSMENU_BUTTON_SIZE_X, CLASSMENU_BUTTON_SIZE_Y); m_pCancelButton->setParent( this ); @@ -260,6 +261,7 @@ void CClassMenuPanel::Update() int iYPos = CLASSMENU_TOPLEFT_BUTTON_Y; // Cycle through the rest of the buttons +#ifdef _TFC for (int i = 0; i <= PC_RANDOM; i++) { bool bCivilian = (gViewPort->GetValidClasses(g_iTeamNumber) == -1); @@ -318,7 +320,7 @@ void CClassMenuPanel::Update() char sz[256]; sprintf(sz, m_sPlayersOnTeamString, iTotal); - m_pPlayers[i]->setText( sz ); + m_pPlayers[i]->setText( "%s", sz ); // Set the text color to the teamcolor m_pPlayers[i]->setFgColor( iTeamColors[g_iTeamNumber % iNumberOfTeamColors][0], @@ -346,6 +348,7 @@ void CClassMenuPanel::Update() } } } +#endif // If the player already has a class, make the cancel button visible if ( g_iPlayerClass ) @@ -413,6 +416,7 @@ void CClassMenuPanel::Initialize( void ) void CClassMenuPanel::SetActiveInfo( int iInput ) { // Remove all the Info panels and bring up the specified one +#ifdef _TFC for (int i = 0; i <= PC_RANDOM; i++) { m_pButtons[i]->setArmed( false ); @@ -420,6 +424,7 @@ void CClassMenuPanel::SetActiveInfo( int iInput ) } if ( iInput > PC_RANDOM || iInput < 0 ) +#endif iInput = 0; m_pButtons[iInput]->setArmed( true ); diff --git a/cl_dll/vgui_CustomObjects.cpp b/cl_dll/vgui_CustomObjects.cpp index 441a50e..66bffb6 100644 --- a/cl_dll/vgui_CustomObjects.cpp +++ b/cl_dll/vgui_CustomObjects.cpp @@ -1,4 +1,4 @@ -//=========== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. =========== +//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. =========== // // The copyright to the contents herein is the property of Valve, L.L.C. // The contents may be used and/or copied only with the written permission of @@ -32,7 +32,7 @@ #include "vgui_int.h" #include "vgui_TeamFortressViewport.h" #include "vgui_ServerBrowser.h" -#include "..\game_shared\vgui_LoadTGA.h" +#include "vgui_loadtga.h" // Arrow filenames char *sArrowFilenames[] = @@ -305,15 +305,21 @@ int ClassButton::IsNotValid() } // Is it an illegal class? +#ifdef _TFC if ((gViewPort->GetValidClasses(0) & sTFValidClassInts[ m_iPlayerClass ]) || (gViewPort->GetValidClasses(g_iTeamNumber) & sTFValidClassInts[ m_iPlayerClass ])) return true; +#endif // Only check current class if they've got autokill on bool bAutoKill = CVAR_GET_FLOAT( "hud_classautokill" ) != 0; if ( bAutoKill ) { // Is it the player's current class? - if ( (gViewPort->IsRandomPC() && m_iPlayerClass == PC_RANDOM) || (!gViewPort->IsRandomPC() && (m_iPlayerClass == g_iPlayerClass)) ) + if ( +#ifdef _TFC + (gViewPort->IsRandomPC() && m_iPlayerClass == PC_RANDOM) || +#endif + (!gViewPort->IsRandomPC() && (m_iPlayerClass == g_iPlayerClass)) ) return true; } @@ -529,8 +535,13 @@ void CMenuHandler_StringCommandClassSelect::actionPerformed(Panel* panel) { CMenuHandler_StringCommand::actionPerformed( panel ); + // THIS IS NOW BEING DONE ON THE TFC SERVER TO AVOID KILLING SOMEONE THEN + // HAVE THE SERVER SAY "SORRY...YOU CAN'T BE THAT CLASS". + +#if !defined _TFC bool bAutoKill = CVAR_GET_FLOAT( "hud_classautokill" ) != 0; if ( bAutoKill && g_iPlayerClass != 0 ) gEngfuncs.pfnClientCmd("kill"); +#endif } diff --git a/cl_dll/vgui_MOTDWindow.cpp b/cl_dll/vgui_MOTDWindow.cpp index b6f46dd..cca567d 100644 --- a/cl_dll/vgui_MOTDWindow.cpp +++ b/cl_dll/vgui_MOTDWindow.cpp @@ -99,7 +99,7 @@ CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitl pSchemes->getBgColor( hTitleScheme, r, g, b, a ); pLabel->setBgColor( r, g, b, a ); pLabel->setContentAlignment( vgui::Label::a_west ); - pLabel->setText(szTitle); + pLabel->setText( "%s", szTitle); // Create the Scroll panel ScrollPanel *pScrollPanel = new CTFScrollPanel( iXPos + XRES(16), iYPos + MOTD_TITLE_Y*2 + YRES(16), iXSize - XRES(32), iYSize - (YRES(48) + BUTTON_SIZE_Y*2) ); @@ -120,7 +120,7 @@ CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitl pText->setFgColor( r, g, b, a ); pSchemes->getBgColor( hMOTDText, r, g, b, a ); pText->setBgColor( r, g, b, a ); - pText->setText(szMOTD); + pText->setText( szMOTD); // Get the total size of the MOTD text and resize the text panel int iScrollSizeX, iScrollSizeY; diff --git a/cl_dll/vgui_SchemeManager.cpp b/cl_dll/vgui_SchemeManager.cpp index 571dca3..b12eb44 100644 --- a/cl_dll/vgui_SchemeManager.cpp +++ b/cl_dll/vgui_SchemeManager.cpp @@ -395,7 +395,19 @@ buildDefaultFont: if(g_CV_BitmapFonts && g_CV_BitmapFonts->value) { - sprintf(fontFilename, "gfx\\vgui\\fonts\\%d_%s.tga", m_xRes, m_pSchemeList[i].schemeName); + int fontRes = 640; + if ( m_xRes >= 1600 ) + fontRes = 1600; + else if ( m_xRes >= 1280 ) + fontRes = 1280; + else if ( m_xRes >= 1152 ) + fontRes = 1152; + else if ( m_xRes >= 1024 ) + fontRes = 1024; + else if ( m_xRes >= 800 ) + fontRes = 800; + + sprintf(fontFilename, "gfx\\vgui\\fonts\\%d_%s.tga", fontRes, m_pSchemeList[i].schemeName); pFontData = gEngfuncs.COM_LoadFile( fontFilename, 5, &fontFileLength ); if(!pFontData) gEngfuncs.Con_Printf("Missing bitmap font: %s\n", fontFilename); diff --git a/cl_dll/vgui_ScorePanel.cpp b/cl_dll/vgui_ScorePanel.cpp index bea050d..bd18053 100644 --- a/cl_dll/vgui_ScorePanel.cpp +++ b/cl_dll/vgui_ScorePanel.cpp @@ -1,4 +1,4 @@ -//=========== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. =========== +//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. =========== // // The copyright to the contents herein is the property of Valve, L.L.C. // The contents may be used and/or copied only with the written permission of @@ -26,12 +26,13 @@ #include "cl_entity.h" #include "vgui_TeamFortressViewport.h" #include "vgui_ScorePanel.h" -#include "..\game_shared\vgui_helpers.h" -#include "..\game_shared\vgui_loadtga.h" +#include "vgui_helpers.h" +#include "vgui_loadtga.h" +#include "voice_status.h" #include "vgui_SpectatorPanel.h" -hud_player_info_t g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine -extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll +extern hud_player_info_t g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine +extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll team_info_t g_TeamInfo[MAX_TEAMS+1]; int g_IsSpectator[MAX_PLAYERS+1]; @@ -56,7 +57,7 @@ public: SBColumnInfo g_ColumnInfo[NUM_COLUMNS] = { - {NULL, 24, Label::a_east}, + {NULL, 24, Label::a_east}, // tracker column {NULL, 140, Label::a_east}, // name {NULL, 56, Label::a_east}, // class {"#SCORE", 40, Label::a_east}, @@ -102,6 +103,8 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall) m_pCurrentHighlightLabel = NULL; m_iHighlightRow = -1; + //m_pTrackerIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga"); + // Initialize the top title. m_TitleLabel.setFont(tfont); m_TitleLabel.setText(""); @@ -149,6 +152,7 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall) } else if (i == 0) { + // tracker icon cell xwide -= 8; } } @@ -202,7 +206,6 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall) } pGridRow->setBgColor(0,0,0,255); -// pGridRow->SetSpacing(2, 0); pGridRow->SetSpacing(0, 0); pGridRow->CopyColumnWidths(&m_HeaderGrid); pGridRow->AutoSetRowHeights(); @@ -249,7 +252,7 @@ void ScorePanel::Initialize( void ) bool HACK_GetPlayerUniqueID( int iPlayer, char playerID[16] ) { - return !!gEngfuncs.GetPlayerUniqueID( iPlayer, playerID ); + return !!gEngfuncs.GetPlayerUniqueID( iPlayer, playerID ); // TODO remove after testing } //----------------------------------------------------------------------------- @@ -257,6 +260,8 @@ bool HACK_GetPlayerUniqueID( int iPlayer, char playerID[16] ) //----------------------------------------------------------------------------- void ScorePanel::Update() { + int i; + // Set the title if (gViewPort->m_szServerName) { @@ -269,10 +274,13 @@ void ScorePanel::Update() gViewPort->GetAllPlayersInfo(); // Clear out sorts - for (int i = 0; i < NUM_ROWS; i++) + for (i = 0; i < NUM_ROWS; i++) { m_iSortedRows[i] = 0; m_iIsATeam[i] = TEAM_NO; + } + for (i = 0; i < MAX_PLAYERS; i++) + { m_bHasBeenSorted[i] = false; } @@ -303,7 +311,8 @@ void ScorePanel::Update() void ScorePanel::SortTeams() { // clear out team scores - for ( int i = 1; i <= m_iNumTeams; i++ ) + int i; + for ( i = 1; i <= m_iNumTeams; i++ ) { if ( !g_TeamInfo[i].scores_overriden ) g_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0; @@ -320,7 +329,8 @@ void ScorePanel::SortTeams() continue; // skip over players who are not in a team // find what team this player is in - for ( int j = 1; j <= m_iNumTeams; j++ ) + int j; + for ( j = 1; j <= m_iNumTeams; j++ ) { if ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) ) break; @@ -462,7 +472,8 @@ void ScorePanel::SortPlayers( int iTeam, char *team ) void ScorePanel::RebuildTeams() { // clear out player counts from teams - for ( int i = 1; i <= m_iNumTeams; i++ ) + int i; + for ( i = 1; i <= m_iNumTeams; i++ ) { g_TeamInfo[i].players = 0; } @@ -479,7 +490,8 @@ void ScorePanel::RebuildTeams() continue; // skip over players who are not in a team // is this player in an existing team? - for ( int j = 1; j <= m_iNumTeams; j++ ) + int j; + for ( j = 1; j <= m_iNumTeams; j++ ) { if ( g_TeamInfo[j].name[0] == '\0' ) break; @@ -540,8 +552,8 @@ void ScorePanel::FillGrid() } bool bNextRowIsGap = false; - - for(int row=0; row < NUM_ROWS; row++) + int row; + for(row=0; row < NUM_ROWS; row++) { CGrid *pGridRow = &m_PlayerGrids[row]; pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0); @@ -742,15 +754,24 @@ void ScorePanel::FillGrid() switch (col) { case COLUMN_NAME: + /* + if (g_pTrackerUser) + { + int playerSlot = m_iSortedRows[row]; + int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot); + const char *trackerName = g_pTrackerUser->GetUserName(trackerID); + if (trackerName && *trackerName) + { + sprintf(sz, " (%s)", trackerName); + pLabel->setText2(sz); + } + } + */ sprintf(sz, "%s ", pl_info->name); break; case COLUMN_VOICE: sz[0] = 0; - // in HLTV mode allow spectator to turn on/off commentator voice - if (!pl_info->thisplayer || gEngfuncs.IsSpectateOnly() ) - { - GetClientVoiceMgr()->UpdateSpeakerImage(pLabel, m_iSortedRows[row]); - } + GetClientVoiceMgr()->UpdateSpeakerImage(pLabel, m_iSortedRows[row]); break; case COLUMN_CLASS: // No class for other team's members (unless allied or spectator) @@ -759,6 +780,11 @@ void ScorePanel::FillGrid() // Don't show classes if this client hasnt picked a team yet if ( g_iTeamNumber == 0 ) bShowClass = false; +#ifdef _TFC + // in TFC show all classes in spectator mode + if ( g_iUser1 ) + bShowClass = true; +#endif if (bShowClass) { @@ -782,7 +808,36 @@ void ScorePanel::FillGrid() break; case COLUMN_TRACKER: + /* + if (g_pTrackerUser) + { + int playerSlot = m_iSortedRows[row]; + int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot); + + if (g_pTrackerUser->IsFriend(trackerID) && trackerID != g_pTrackerUser->GetTrackerID()) + { + pLabel->setImage(m_pTrackerIcon); + pLabel->setFgColorAsImageColor(false); + m_pTrackerIcon->setColor(Color(255, 255, 255, 0)); + } + } + */ break; + +#ifdef _TFC + case COLUMN_KILLS: + if (g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber) + sprintf(sz, "%d", g_PlayerExtraInfo[ m_iSortedRows[row] ].frags ); + break; + case COLUMN_DEATHS: + if (g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber) + sprintf(sz, "%d", g_PlayerExtraInfo[ m_iSortedRows[row] ].deaths ); + break; + case COLUMN_LATENCY: + if (g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber) + sprintf(sz, "%d", g_PlayerInfoList[ m_iSortedRows[row] ].ping ); + break; +#else case COLUMN_KILLS: sprintf(sz, "%d", g_PlayerExtraInfo[ m_iSortedRows[row] ].frags ); break; @@ -792,6 +847,7 @@ void ScorePanel::FillGrid() case COLUMN_LATENCY: sprintf(sz, "%d", g_PlayerInfoList[ m_iSortedRows[row] ].ping ); break; +#endif default: break; } diff --git a/cl_dll/vgui_ScorePanel.h b/cl_dll/vgui_ScorePanel.h index f7a8543..2117c34 100644 --- a/cl_dll/vgui_ScorePanel.h +++ b/cl_dll/vgui_ScorePanel.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -14,7 +14,7 @@ #include #include #include -#include "..\game_shared\vgui_listbox.h" +#include "../game_shared/vgui_listbox.h" #include @@ -222,8 +222,8 @@ private: class ScoreTablePanel; -#include "..\game_shared\vgui_grid.h" -#include "..\game_shared\vgui_defaultinputsignal.h" +#include "../game_shared/vgui_grid.h" +#include "../game_shared/vgui_defaultinputsignal.h" //----------------------------------------------------------------------------- // Purpose: Scoreboard back panel @@ -304,7 +304,7 @@ public: virtual void mousePressed(MouseCode code, Panel* panel); virtual void cursorMoved(int x, int y, Panel *panel); - friend CLabelHeader; + friend class CLabelHeader; }; #endif diff --git a/cl_dll/vgui_ServerBrowser.cpp b/cl_dll/vgui_ServerBrowser.cpp index 6e90259..5b4b9eb 100644 --- a/cl_dll/vgui_ServerBrowser.cpp +++ b/cl_dll/vgui_ServerBrowser.cpp @@ -115,7 +115,7 @@ public: void DoCancel( void ) { - ClientCmd( "togglebrowser\n" ); + EngineClientCmd( "togglebrowser\n" ); } void DoConnect( void ) @@ -133,7 +133,7 @@ public: sprintf( sz, "connect %s\n", address ); - ClientCmd( sz ); + EngineClientCmd( sz ); DoCancel(); } diff --git a/cl_dll/vgui_SpectatorPanel.cpp b/cl_dll/vgui_SpectatorPanel.cpp index 582a319..7a0cc8f 100644 --- a/cl_dll/vgui_SpectatorPanel.cpp +++ b/cl_dll/vgui_SpectatorPanel.cpp @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - // vgui_SpectatorPanel.cpp: implementation of the SpectatorPanel class. // ////////////////////////////////////////////////////////////////////// @@ -17,17 +10,34 @@ #include "pm_shared.h" #include "vgui_TeamFortressViewport.h" #include "vgui_SpectatorPanel.h" -#include "vgui_scorepanel.h" +#include "vgui_ScorePanel.h" -#define PANEL_HEIGHT 32 +#include "Exports.h" +/* +========================== +HUD_ChatInputPosition -#define BANNER_WIDTH 256 -#define BANNER_HEIGHT 64 +Sets the location of the input for chat text +========================== +*/ +void CL_DLLEXPORT HUD_ChatInputPosition( int *x, int *y ) +{ +// RecClChatInputPosition( x, y ); -#define OPTIONS_BUTTON_X 96 -#define CAMOPTIONS_BUTTON_X 200 + if ( g_iUser1 != 0 || gEngfuncs.IsSpectateOnly() ) + { + if ( gHUD.m_Spectator.m_pip->value == INSET_OFF ) + { + *y = YRES( PANEL_HEIGHT ); + } + else + { + *y = YRES( gHUD.m_Spectator.m_OverviewData.insetWindowHeight + 5 ); + } + } +} ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -57,6 +67,9 @@ void SpectatorPanel::ActionSignal(int cmd) case SPECTATOR_PANEL_CMD_PREVPLAYER : gHUD.m_Spectator.FindNextPlayer(false); break; + case SPECTATOR_PANEL_CMD_PLAYERS : gViewPort->ShowCommandMenu( gViewPort->m_PlayerMenu ); + break; + case SPECTATOR_PANEL_CMD_HIDEMENU : ShowMenu(false); break; @@ -84,15 +97,15 @@ void SpectatorPanel::Initialize() SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle( "Team Info Text" ); - m_TopBorder = new CTransparentPanel(64, 0, 0, ScreenWidth, YRES(PANEL_HEIGHT)); + m_TopBorder = new CTransparentPanel(64, 0, 0, ScreenWidth, PANEL_HEIGHT); m_TopBorder->setParent(this); - m_BottomBorder = new CTransparentPanel(64, 0, ScreenHeight - YRES(32), ScreenWidth, YRES(PANEL_HEIGHT)); + m_BottomBorder = new CTransparentPanel(64, 0, ScreenHeight - PANEL_HEIGHT, ScreenWidth, PANEL_HEIGHT); m_BottomBorder->setParent(this); setPaintBackgroundEnabled(false); - m_ExtraInfo = new Label( "Extra Info", 0, 0, wide, YRES(PANEL_HEIGHT) ); + m_ExtraInfo = new Label( "Extra Info", 0, 0, wide, PANEL_HEIGHT ); m_ExtraInfo->setParent(m_TopBorder); m_ExtraInfo->setFont( pSchemes->getFont(hSmallScheme) ); @@ -108,7 +121,7 @@ void SpectatorPanel::Initialize() m_TopBanner = new CImageLabel( "banner", 0, 0, XRES(BANNER_WIDTH), YRES(BANNER_HEIGHT) ); m_TopBanner->setParent(this); - m_CurrentTime = new Label( "00:00", 0, 0, wide, YRES(PANEL_HEIGHT) ); + m_CurrentTime = new Label( "00:00", 0, 0, wide, PANEL_HEIGHT ); m_CurrentTime->setParent(m_TopBorder); m_CurrentTime->setFont( pSchemes->getFont(hSmallScheme) ); m_CurrentTime->setPaintBackgroundEnabled(false); @@ -122,7 +135,7 @@ void SpectatorPanel::Initialize() for ( int j= 0; j < TEAM_NUMBER; j++ ) { - m_TeamScores[j] = new Label( " ", 0, 0, wide, YRES(PANEL_HEIGHT) ); + m_TeamScores[j] = new Label( " ", 0, 0, wide, PANEL_HEIGHT ); m_TeamScores[j]->setParent( m_TopBorder ); m_TeamScores[j]->setFont( pSchemes->getFont(hSmallScheme) ); m_TeamScores[j]->setPaintBackgroundEnabled(false); @@ -133,7 +146,8 @@ void SpectatorPanel::Initialize() // Initialize command buttons. - m_OptionButton = new ColorButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false ); +// m_OptionButton = new ColorButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false ); + m_OptionButton = new DropDownButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false ); m_OptionButton->setParent( m_BottomBorder ); m_OptionButton->setContentAlignment( vgui::Label::a_center ); m_OptionButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name @@ -143,7 +157,7 @@ void SpectatorPanel::Initialize() m_OptionButton->setUnArmedColor ( 143, 143, 54, 0 ); m_OptionButton->setArmedColor ( 194, 202, 54, 0 ); - m_CamButton = new ColorButton( CHudTextMessage::BufferedLocaliseTextString( "#CAM_OPTIONS" ), ScreenWidth - ( XRES ( CAMOPTIONS_BUTTON_X ) + 15 ), YRES(6), XRES ( CAMOPTIONS_BUTTON_X ), YRES(20), false, false ); + m_CamButton = new DropDownButton( CHudTextMessage::BufferedLocaliseTextString( "#CAM_OPTIONS" ), ScreenWidth - ( XRES ( CAMOPTIONS_BUTTON_X ) + 15 ), YRES(6), XRES ( CAMOPTIONS_BUTTON_X ), YRES(20), false, false ); m_CamButton->setParent( m_BottomBorder ); m_CamButton->setContentAlignment( vgui::Label::a_center ); m_CamButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name @@ -153,7 +167,8 @@ void SpectatorPanel::Initialize() m_CamButton->setUnArmedColor ( 143, 143, 54, 0 ); m_CamButton->setArmedColor ( 194, 202, 54, 0 ); - m_PrevPlayerButton= new ColorButton("<", XRES( 15 + OPTIONS_BUTTON_X + 15 ), YRES(6), XRES(24), YRES(20), false, false ); +// m_PrevPlayerButton= new ColorButton("<", XRES( 15 + OPTIONS_BUTTON_X + 15 ), YRES(6), XRES(24), YRES(20), false, false ); + m_PrevPlayerButton= new CImageButton("arrowleft", XRES( 15 + OPTIONS_BUTTON_X + 15 ), YRES(6), XRES(24), YRES(20), false, false ); m_PrevPlayerButton->setParent( m_BottomBorder ); m_PrevPlayerButton->setContentAlignment( vgui::Label::a_center ); m_PrevPlayerButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name @@ -163,7 +178,8 @@ void SpectatorPanel::Initialize() m_PrevPlayerButton->setUnArmedColor ( 143, 143, 54, 0 ); m_PrevPlayerButton->setArmedColor ( 194, 202, 54, 0 ); - m_NextPlayerButton= new ColorButton(">", (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ), YRES(6), XRES(24), YRES(20),false, false ); +// m_NextPlayerButton= new ColorButton(">", (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ), YRES(6), XRES(24), YRES(20),false, false ); + m_NextPlayerButton= new CImageButton("arrowright", (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ), YRES(6), XRES(24), YRES(20),false, false ); m_NextPlayerButton->setParent( m_BottomBorder ); m_NextPlayerButton->setContentAlignment( vgui::Label::a_center ); m_NextPlayerButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name @@ -177,13 +193,33 @@ void SpectatorPanel::Initialize() float flLabelSize = ( (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ) ) - XRES( (15 + OPTIONS_BUTTON_X + 15) + 38 ); - m_BottomMainLabel = new Label( "Spectator Bottom", XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6), flLabelSize, YRES(20) ); + m_BottomMainButton = new DropDownButton("Spectator Bottom", + XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6), flLabelSize, YRES(20), + false, false ); + + m_BottomMainButton->setParent(m_BottomBorder); + m_BottomMainButton->setPaintBackgroundEnabled(false); + m_BottomMainButton->setFgColor( Scheme::sc_primary1 ); + m_BottomMainButton->setContentAlignment( vgui::Label::a_center ); + m_BottomMainButton->setBorder( new LineBorder( Color( 59, 58, 34, 48 ) ) ); + m_BottomMainButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name + m_BottomMainButton->addActionSignal( new CSpectatorHandler_Command(this,SPECTATOR_PANEL_CMD_PLAYERS) ); + m_BottomMainButton->setUnArmedBorderColor ( 59, 58, 34, 48 ); + m_BottomMainButton->setArmedBorderColor ( 194, 202, 54, 0 ); + m_BottomMainButton->setUnArmedColor ( 143, 143, 54, 0 ); + m_BottomMainButton->setArmedColor ( 194, 202, 54, 0 ); + + + m_BottomMainLabel = new Label("Spectator Bottom", + XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6), flLabelSize, YRES(20)); + m_BottomMainLabel->setParent(m_BottomBorder); m_BottomMainLabel->setPaintBackgroundEnabled(false); m_BottomMainLabel->setFgColor( Scheme::sc_primary1 ); m_BottomMainLabel->setContentAlignment( vgui::Label::a_center ); - m_BottomMainLabel->setBorder( new LineBorder( Color( 59, 58, 34, 48 ) ) ); - + m_BottomMainLabel->setBorder( NULL ); + m_BottomMainLabel->setVisible(false); + m_InsetViewButton = new ColorButton("", XRES(2), YRES(2), XRES(240), YRES(180), false, false ); m_InsetViewButton->setParent( this ); m_InsetViewButton->setBoundKey( (char)255 ); @@ -215,15 +251,22 @@ void SpectatorPanel::ShowMenu(bool isVisible) m_CamButton->setVisible(isVisible); m_CamButton->setArmed( false ); m_NextPlayerButton->setVisible(isVisible); m_NextPlayerButton->setArmed( false ); m_PrevPlayerButton->setVisible(isVisible); m_PrevPlayerButton->setArmed( false ); - + if ( !isVisible ) { int iLabelSizeX, iLabelSizeY; + m_BottomMainLabel->setVisible(true); + m_BottomMainButton->setVisible(false); + m_BottomMainLabel->getSize( iLabelSizeX, iLabelSizeY ); m_BottomMainLabel->setPos( ( ScreenWidth / 2 ) - (iLabelSizeX/2), YRES(6) ); } else - m_BottomMainLabel->setPos( XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6) ); + { + m_BottomMainButton->setPos( XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6) ); + m_BottomMainLabel->setVisible(false); + m_BottomMainButton->setVisible(true); + } if ( !isVisible ) { @@ -288,7 +331,7 @@ void SpectatorPanel::EnableInsetView(bool isEnabled) if ( isEnabled ) { // short black bar to see full inset - m_TopBorder->setBounds( XRES(offset), 0, XRES(640 - offset ), YRES(PANEL_HEIGHT) ); + m_TopBorder->setBounds( XRES(offset), 0, XRES(640 - offset ), PANEL_HEIGHT ); if ( gEngfuncs.IsSpectateOnly() ) { @@ -298,8 +341,8 @@ void SpectatorPanel::EnableInsetView(bool isEnabled) else m_TopBanner->setVisible( false ); - m_InsetViewButton->setBounds( XRES( x ), YRES( y ), - XRES( wide ), YRES( tall ) ); + m_InsetViewButton->setBounds( XRES( x -1 ), YRES( y ), + XRES( wide +2), YRES( tall ) ); m_InsetViewButton->setVisible(true); } else @@ -314,7 +357,7 @@ void SpectatorPanel::EnableInsetView(bool isEnabled) else m_TopBanner->setVisible( false ); - m_TopBorder->setBounds( 0, 0, ScreenWidth, YRES(PANEL_HEIGHT) ); + m_TopBorder->setBounds( 0, 0, ScreenWidth, PANEL_HEIGHT ); m_InsetViewButton->setVisible(false); } @@ -356,28 +399,28 @@ void SpectatorPanel::Update() m_ExtraInfo->getTextSize( iTextWidth, iTextHeight ); m_CurrentTime->getTextSize( iTimeWidth, iTimeHeight ); - iTimeWidth += XRES ( 14 ); // +timer icon - iTimeWidth += ( 4-(iTimeWidth%4) ); + iTimeWidth += XRES ( SEPERATOR_WIDTH*2 + 1 ); // +timer icon + iTimeWidth += ( SEPERATOR_WIDTH-(iTimeWidth%SEPERATOR_WIDTH) ); if ( iTimeWidth > iTextWidth ) iTextWidth = iTimeWidth; - int xPos = ScreenWidth - ( iTextWidth + XRES ( 4 + offset ) ); + int xPos = ScreenWidth - ( iTextWidth + XRES ( SEPERATOR_WIDTH + offset ) ); - m_ExtraInfo->setBounds( xPos, YRES( 1 ), iTextWidth, iTextHeight ); + m_ExtraInfo->setBounds( xPos, YRES( SEPERATOR_HEIGHT ), iTextWidth, iTextHeight ); - m_TimerImage->setBounds( xPos, YRES( 2 ) + iTextHeight , XRES(14), YRES(14) ); + m_TimerImage->setBounds( xPos, YRES( SEPERATOR_HEIGHT ) + iTextHeight , XRES(SEPERATOR_WIDTH*2 + 1), YRES(SEPERATOR_HEIGHT + 1) ); - m_CurrentTime->setBounds( xPos + XRES ( 14 + 1 ), YRES( 2 ) + iTextHeight , iTimeWidth, iTimeHeight ); + m_CurrentTime->setBounds( xPos + XRES ( SEPERATOR_WIDTH*2 + 1 ), YRES( SEPERATOR_HEIGHT ) + iTextHeight , iTimeWidth, iTimeHeight ); - m_Separator->setPos( ScreenWidth - ( iTextWidth + XRES ( 4+2+4+offset ) ) , YRES( 1 ) ); - m_Separator->setSize( XRES( 4 ), YRES( PANEL_HEIGHT - 2 ) ); + m_Separator->setPos( ScreenWidth - ( iTextWidth + XRES ( 2*SEPERATOR_WIDTH+SEPERATOR_WIDTH/2+offset ) ) , YRES( 5 ) ); + m_Separator->setSize( XRES( 1 ), PANEL_HEIGHT - 10 ); for ( j= 0; j < TEAM_NUMBER; j++ ) { int iwidth, iheight; m_TeamScores[j]->getTextSize( iwidth, iheight ); - m_TeamScores[j]->setBounds( ScreenWidth - ( iTextWidth + XRES ( 4+2+4+2+offset ) + iwidth ), YRES( 1 ) + ( iheight * j ), iwidth, iheight ); + m_TeamScores[j]->setBounds( ScreenWidth - ( iTextWidth + XRES ( 2*SEPERATOR_WIDTH+2*SEPERATOR_WIDTH/2+offset ) + iwidth ), YRES( SEPERATOR_HEIGHT ) + ( iheight * j ), iwidth, iheight ); } } diff --git a/cl_dll/vgui_SpectatorPanel.h b/cl_dll/vgui_SpectatorPanel.h index d77e900..1484f2f 100644 --- a/cl_dll/vgui_SpectatorPanel.h +++ b/cl_dll/vgui_SpectatorPanel.h @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - // vgui_SpectatorPanel.h: interface for the SpectatorPanel class. // ////////////////////////////////////////////////////////////////////// @@ -26,6 +19,21 @@ using namespace vgui; #define SPECTATOR_PANEL_CMD_HIDEMENU 4 #define SPECTATOR_PANEL_CMD_TOGGLE_INSET 5 #define SPECTATOR_PANEL_CMD_CAMERA 6 +#define SPECTATOR_PANEL_CMD_PLAYERS 7 + +// spectator panel sizes +#define PANEL_HEIGHT 64 + +#define BANNER_WIDTH 256 +#define BANNER_HEIGHT 64 + +#define OPTIONS_BUTTON_X 96 +#define CAMOPTIONS_BUTTON_X 200 + + +#define SEPERATOR_WIDTH 15 +#define SEPERATOR_HEIGHT 15 + #define TEAM_NUMBER 2 @@ -50,20 +58,22 @@ public: void EnableInsetView(bool isEnabled); void ShowMenu(bool isVisible); - - ColorButton * m_OptionButton; + DropDownButton * m_OptionButton; // CommandButton * m_HideButton; - ColorButton * m_PrevPlayerButton; - ColorButton * m_NextPlayerButton; - ColorButton * m_CamButton; + //ColorButton * m_PrevPlayerButton; + //ColorButton * m_NextPlayerButton; + CImageButton * m_PrevPlayerButton; + CImageButton * m_NextPlayerButton; + DropDownButton * m_CamButton; CTransparentPanel * m_TopBorder; CTransparentPanel * m_BottomBorder; ColorButton *m_InsetViewButton; - Label *m_BottomMainLabel; + DropDownButton *m_BottomMainButton; CImageLabel *m_TimerImage; + Label *m_BottomMainLabel; Label *m_CurrentTime; Label *m_ExtraInfo; Panel *m_Separator; diff --git a/cl_dll/vgui_TeamFortressViewport.cpp b/cl_dll/vgui_TeamFortressViewport.cpp index 20331c2..6c3ccc1 100644 --- a/cl_dll/vgui_TeamFortressViewport.cpp +++ b/cl_dll/vgui_TeamFortressViewport.cpp @@ -1,4 +1,4 @@ -//=========== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. =========== +//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. =========== // // The copyright to the contents herein is the property of Valve, L.L.C. // The contents may be used and/or copied only with the written permission of @@ -45,7 +45,7 @@ #include "in_defs.h" #include "parsemsg.h" #include "pm_shared.h" -#include "../engine/keydefs.h" +#include "keydefs.h" #include "demo.h" #include "demo_api.h" @@ -55,13 +55,16 @@ #include "vgui_ScorePanel.h" #include "vgui_SpectatorPanel.h" +#include "shake.h" +#include "screenfade.h" + extern int g_iVisibleMouse; class CCommandMenu; int g_iPlayerClass; int g_iTeamNumber; -int g_iUser1; -int g_iUser2; -int g_iUser3; +int g_iUser1 = 0; +int g_iUser2 = 0; +int g_iUser3 = 0; // Scoreboard positions #define SBOARD_INDENT_X XRES(104) @@ -140,10 +143,12 @@ char *sTFClassSelection[] = "civilian", }; +#ifdef _TFC int iBuildingCosts[] = { BUILD_COST_DISPENSER, - BUILD_COST_SENTRYGUN + BUILD_COST_SENTRYGUN, + BUILD_COST_TELEPORTER }; // This maps class numbers to the Invalid Class bit. @@ -163,6 +168,7 @@ int sTFValidClassInts[] = TF_ILL_ENGINEER, TF_ILL_RANDOMPC, }; +#endif // Get the name of TGA file, based on GameDir char* GetVGUITGAName(const char *pszName) @@ -208,6 +214,27 @@ void CCommandMenu::AddButton( CommandButton *pButton ) } } +void CCommandMenu::RemoveAllButtons(void) +{ + /* + for(int i=0;iGetDirection(); } - CCommandMenu *pMenu = new CCommandMenu(pParentMenu, iDirection, iXPos, iYPos, iWide, iTall ); + CCommandMenu *pMenu = new CCommandMenu(pParentMenu, iDirection, iXPos, iYPos, iWide, iTall ); pMenu->setParent(this); pButton->AddSubMenu( pMenu ); pButton->setFont( Scheme::sf_primary3 ); @@ -445,13 +472,13 @@ CCommandMenu *TeamFortressViewport::CreateSubMenu( CommandButton *pButton, CComm pButton->addInputSignal(pISignal); // Put a > to show it's a submenu - CImageLabel *pLabel = new CImageLabel( "arrow", CMENU_SIZE_X - SUBMENU_SIZE_X, SUBMENU_SIZE_Y ); + CImageLabel *pLabel = new CImageLabel( "arrowright", XRES(CMENU_SIZE_X - SUBMENU_SIZE_X), YRES(SUBMENU_SIZE_Y) ); pLabel->setParent(pButton); pLabel->addInputSignal(pISignal); // Reposition pLabel->getPos( iXPos, iYPos ); - pLabel->setPos( CMENU_SIZE_X - pLabel->getImageWide(), (BUTTON_SIZE_Y - pLabel->getImageTall()) / 2 ); + pLabel->setPos( pButton->getWide() - pLabel->getImageWide()-4, -4 ); // Create the mouse off signal for the Label too if (!pButton->m_bNoHighlight) @@ -584,9 +611,26 @@ TeamFortressViewport::TeamFortressViewport(int x,int y,int wide,int tall) : Pane m_iCurrentTeamNumber = m_iUser1 = m_iUser2 = m_iUser3 = 0; m_StandardMenu = CreateCommandMenu("commandmenu.txt", 0, CMENU_TOP, false, CMENU_SIZE_X, BUTTON_SIZE_Y, 0 ); - m_SpectatorOptionsMenu = CreateCommandMenu("spectatormenu.txt", 1, YRES(32), true, CMENU_SIZE_X, BUTTON_SIZE_Y / 2, 0 ); // above bottom bar, flat design - m_SpectatorCameraMenu = CreateCommandMenu("spectcammenu.txt", 1, YRES(32), true, XRES( 200 ), BUTTON_SIZE_Y / 2, ScreenWidth - ( XRES ( 200 ) + 15 ) ); // above bottom bar, flat design + m_SpectatorOptionsMenu = CreateCommandMenu("spectatormenu.txt", 1, PANEL_HEIGHT, true, CMENU_SIZE_X, BUTTON_SIZE_Y / 2, 0 ); // above bottom bar, flat design + m_SpectatorCameraMenu = CreateCommandMenu("spectcammenu.txt", 1, PANEL_HEIGHT, true, XRES( 200 ), BUTTON_SIZE_Y / 2, ScreenWidth - ( XRES ( 200 ) + 15 ) ); // above bottom bar, flat design + + m_PlayerMenu = m_iNumMenus; + m_iNumMenus++; + + float flLabelSize = ( (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ) ) - XRES( (15 + OPTIONS_BUTTON_X + 15) + 38 ); + + m_pCommandMenus[m_PlayerMenu] = new CCommandMenu(NULL, 1, + XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ),PANEL_HEIGHT, flLabelSize,300); + m_pCommandMenus[m_PlayerMenu]->setParent(this); + m_pCommandMenus[m_PlayerMenu]->setVisible(false); + m_pCommandMenus[m_PlayerMenu]->m_flButtonSizeY = BUTTON_SIZE_Y /2; + m_pCommandMenus[m_PlayerMenu]->m_iSpectCmdMenu = 1; + + UpdatePlayerMenu(m_PlayerMenu); + CreateServerBrowser(); + + } //----------------------------------------------------------------------------- @@ -636,7 +680,7 @@ void TeamFortressViewport::Initialize( void ) strcpy(m_sTeamNames[i], ""); } - App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::SchemeCursor::scu_none) ); + App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::scu_none) ); } class CException; @@ -669,8 +713,10 @@ int TeamFortressViewport::CreateCommandMenu( char * menuFile, int direction, int return newIndex; } +#ifdef _WIN32 try { +#endif // First, read in the localisation strings // Detpack strings @@ -749,6 +795,7 @@ try else { // See if it's a Class +#ifdef _TFC for (int i = 1; i <= PC_ENGINEER; i++) { if ( !strcmp(token, sTFClasses[i]) ) @@ -761,6 +808,7 @@ try break; } } +#endif } // Get the button bound key @@ -875,6 +923,7 @@ try pfile = gEngfuncs.COM_ParseFile(pfile, token); } +#ifdef _WIN32 } catch( CException *e ) { @@ -884,6 +933,7 @@ catch( CException *e ) m_iInitialized = false; return newIndex; } +#endif SetCurrentMenu( NULL ); SetCurrentCommandMenu( NULL ); @@ -906,6 +956,7 @@ CCommandMenu *TeamFortressViewport::CreateDisguiseSubmenu( CommandButton *pButto m_iNumMenus++; // create the class choice buttons +#ifdef _TFC for ( int i = PC_SCOUT; i <= PC_ENGINEER; i++ ) { CommandButton *pDisguiseButton = new CommandButton( CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[i] ), 0, BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y ); @@ -916,7 +967,8 @@ CCommandMenu *TeamFortressViewport::CreateDisguiseSubmenu( CommandButton *pButto pMenu->AddButton( pDisguiseButton ); } - +#endif + return pMenu; } @@ -973,6 +1025,7 @@ CommandButton *TeamFortressViewport::CreateCustomButton( char *pButtonText, char m_pCommandMenus[m_iNumMenus] = pMenu; m_iNumMenus++; +#ifdef _TFC for (int i = PC_SCOUT; i <= PC_RANDOM; i++ ) { char sz[256]; @@ -985,7 +1038,9 @@ CommandButton *TeamFortressViewport::CreateCustomButton( char *pButtonText, char pClassButton->addActionSignal(new CMenuHandler_StringCommandClassSelect(sz)); pMenu->AddButton( pClassButton ); } +#endif } +#ifdef _TFC // Map Briefing else if ( !strcmp( pButtonName, "!MAPBRIEFING" ) ) { @@ -1166,6 +1221,48 @@ CommandButton *TeamFortressViewport::CreateCustomButton( char *pButtonText, char // Create an input signal that'll popup the current menu pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); } + else if ( !strcmp( pButtonName, "!BUILDENTRYTELEPORTER" ) ) + { + pButton = new BuildButton( BUILDSTATE_CANBUILD, BuildButton::ENTRY_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y); + pButton->addActionSignal(new CMenuHandler_StringCommand("build 4")); + // Create an input signal that'll popup the current menu + pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); + } + else if ( !strcmp( pButtonName, "!DISMANTLEENTRYTELEPORTER" ) ) + { + pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::ENTRY_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y); + pButton->addActionSignal(new CMenuHandler_StringCommand("dismantle 4")); + // Create an input signal that'll popup the current menu + pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); + } + else if ( !strcmp( pButtonName, "!DETONATEENTRYTELEPORTER" ) ) + { + pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::ENTRY_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y); + pButton->addActionSignal(new CMenuHandler_StringCommand("detentryteleporter")); + // Create an input signal that'll popup the current menu + pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); + } + else if ( !strcmp( pButtonName, "!BUILDEXITTELEPORTER" ) ) + { + pButton = new BuildButton( BUILDSTATE_CANBUILD, BuildButton::EXIT_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y); + pButton->addActionSignal(new CMenuHandler_StringCommand("build 5")); + // Create an input signal that'll popup the current menu + pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); + } + else if ( !strcmp( pButtonName, "!DISMANTLEEXITTELEPORTER" ) ) + { + pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::EXIT_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y); + pButton->addActionSignal(new CMenuHandler_StringCommand("dismantle 5")); + // Create an input signal that'll popup the current menu + pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); + } + else if ( !strcmp( pButtonName, "!DETONATEEXITTELEPORTER" ) ) + { + pButton = new BuildButton( BUILDSTATE_HASBUILDING, BuildButton::EXIT_TELEPORTER, pButtonText, 0, BUTTON_SIZE_Y * 2, CMENU_SIZE_X, BUTTON_SIZE_Y); + pButton->addActionSignal(new CMenuHandler_StringCommand("detexitteleporter")); + // Create an input signal that'll popup the current menu + pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); + } // Stop building else if ( !strcmp( pButtonName, "!BUILDSTOP" ) ) { @@ -1174,6 +1271,7 @@ CommandButton *TeamFortressViewport::CreateCustomButton( char *pButtonText, char // Create an input signal that'll popup the current menu pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCurrentCommandMenu) ); } +#endif return pButton; } @@ -1281,6 +1379,12 @@ void TeamFortressViewport::HideCommandMenu() m_pCommandMenus[m_SpectatorCameraMenu]->ClearButtonsOfArmedState(); } + if ( m_pCommandMenus[m_PlayerMenu] ) + { + m_pCommandMenus[m_PlayerMenu]->ClearButtonsOfArmedState(); + } + + m_flMenuOpenTime = 0.0f; SetCurrentCommandMenu( NULL ); UpdateCursorState(); @@ -1341,6 +1445,7 @@ void TeamFortressViewport::InputPlayerSpecial( void ) if (!m_iInitialized) return; +#ifdef _TFC if ( g_iPlayerClass == PC_ENGINEER || g_iPlayerClass == PC_SPY ) { ShowCommandMenu( gViewPort->m_StandardMenu ); @@ -1351,9 +1456,10 @@ void TeamFortressViewport::InputPlayerSpecial( void ) } } else +#endif { // if it's any other class, just send the command down to the server - ClientCmd( "_special" ); + EngineClientCmd( "_special" ); } } @@ -1371,10 +1477,60 @@ void TeamFortressViewport::SetCurrentCommandMenu( CCommandMenu *pNewMenu ) void TeamFortressViewport::UpdateCommandMenu(int menuIndex) { + // if its the player menu update the player list + if(menuIndex==m_PlayerMenu) + { + m_pCommandMenus[m_PlayerMenu]->RemoveAllButtons(); + UpdatePlayerMenu(m_PlayerMenu); + } + m_pCommandMenus[menuIndex]->RecalculateVisibles( 0, false ); m_pCommandMenus[menuIndex]->RecalculatePositions( 0 ); + } +void TeamFortressViewport::UpdatePlayerMenu(int menuIndex) +{ + + cl_entity_t * pEnt = NULL; + float flLabelSize = ( (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ) ) - XRES( (15 + OPTIONS_BUTTON_X + 15) + 38 ); + gViewPort->GetAllPlayersInfo(); + + + for (int i = 1; i < MAX_PLAYERS; i++ ) + { + //if ( g_PlayerInfoList[i].name == NULL ) + // continue; // empty player slot, skip + + pEnt = gEngfuncs.GetEntityByIndex( i ); + + if ( !gHUD.m_Spectator.IsActivePlayer( pEnt ) ) + continue; + + //if ( g_PlayerExtraInfo[i].teamname[0] == 0 ) + // continue; // skip over players who are not in a team + + SpectButton *pButton = new SpectButton(1 , g_PlayerInfoList[pEnt->index].name , + XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ),PANEL_HEIGHT+(i-1)*CMENU_SIZE_X, flLabelSize, BUTTON_SIZE_Y /2 ); + + pButton->setBoundKey( (char)255 ); + pButton->setContentAlignment( vgui::Label::a_center ); + m_pCommandMenus[menuIndex]->AddButton( pButton ); + pButton->setParentMenu( m_pCommandMenus[menuIndex] ); + + // Override font in CommandMenu + pButton->setFont( Scheme::sf_primary3 ); + + pButton->addActionSignal(new CMenuHandler_SpectateFollow( g_PlayerInfoList[pEnt->index].name)); + // Create an input signal that'll popup the current menu + pButton->addInputSignal( new CMenuHandler_PopupSubMenuInput(pButton, m_pCommandMenus[menuIndex]) ); + + } + +} + + + void COM_FileBase ( const char *in, char *out); void TeamFortressViewport::UpdateSpectatorPanel() @@ -1392,6 +1548,7 @@ void TeamFortressViewport::UpdateSpectatorPanel() char helpString2[128]; char tempString[128]; char * name; + char *pBottomText = NULL; int player = 0; // check if spectator combinations are still valid @@ -1429,7 +1586,13 @@ void TeamFortressViewport::UpdateSpectatorPanel() // create player & health string if ( player && name ) { - strcpy( bottomText, name ); + strncpy( bottomText, name, sizeof(bottomText) ); + bottomText[ sizeof(bottomText) - 1 ] = 0; + pBottomText = bottomText; + } + else + { + pBottomText = CHudTextMessage::BufferedLocaliseTextString( bottomText ); } // in first person mode colorize player names @@ -1442,10 +1605,12 @@ void TeamFortressViewport::UpdateSpectatorPanel() // set team color, a bit transparent m_pSpectatorPanel->m_BottomMainLabel->setFgColor(r,g,b,0); + m_pSpectatorPanel->m_BottomMainButton->setFgColor(r,g,b,0); } else { // restore GUI color m_pSpectatorPanel->m_BottomMainLabel->setFgColor( 143, 143, 54, 0 ); + m_pSpectatorPanel->m_BottomMainButton->setFgColor( 143, 143, 54, 0 ); } // add sting auto if we are in auto directed mode @@ -1456,7 +1621,8 @@ void TeamFortressViewport::UpdateSpectatorPanel() strcpy( helpString2, tempString ); } - m_pSpectatorPanel->m_BottomMainLabel->setText( CHudTextMessage::BufferedLocaliseTextString( bottomText ) ); + m_pSpectatorPanel->m_BottomMainLabel->setText( "%s", pBottomText ); + m_pSpectatorPanel->m_BottomMainButton->setText( pBottomText ); // update extra info field @@ -1504,7 +1670,7 @@ void TeamFortressViewport::UpdateSpectatorPanel() } } - m_flSpectatorPanelLastUpdated = gHUD.m_flTime + 1.0; // update every seconds + m_flSpectatorPanelLastUpdated = gHUD.m_flTime + 1.0; // update every second } //====================================================================== @@ -1548,6 +1714,10 @@ void TeamFortressViewport::SetCurrentMenu( CMenuPanel *pMenu ) m_pCurrentMenu->Open(); } + else + { + gEngfuncs.pfnClientCmd( "closemenus;" ); + } } //================================================================ @@ -1557,7 +1727,7 @@ CMenuPanel* TeamFortressViewport::CreateTextWindow( int iTextToShow ) char sz[256]; char *cText; char *pfile = NULL; - static const int MAX_TITLE_LENGTH = 32; + static const int MAX_TITLE_LENGTH = 64; char cTitle[MAX_TITLE_LENGTH]; if ( iTextToShow == SHOW_MOTD ) @@ -1565,8 +1735,8 @@ CMenuPanel* TeamFortressViewport::CreateTextWindow( int iTextToShow ) if (!m_szServerName || !m_szServerName[0]) strcpy( cTitle, "Half-Life" ); else - strncpy( cTitle, m_szServerName, MAX_TITLE_LENGTH ); - cTitle[MAX_TITLE_LENGTH-1] = 0; + strncpy( cTitle, m_szServerName, sizeof(cTitle) ); + cTitle[sizeof(cTitle)-1] = 0; cText = m_szMOTD; } else if ( iTextToShow == SHOW_MAPBRIEFING ) @@ -1615,6 +1785,7 @@ CMenuPanel* TeamFortressViewport::CreateTextWindow( int iTextToShow ) strncpy( cTitle, m_sMapName, MAX_TITLE_LENGTH ); cTitle[MAX_TITLE_LENGTH-1] = 0; } +#ifdef _TFC else if ( iTextToShow == SHOW_CLASSDESC ) { switch ( g_iPlayerClass ) @@ -1657,6 +1828,7 @@ CMenuPanel* TeamFortressViewport::CreateTextWindow( int iTextToShow ) cText = pfile; } } +#endif else if ( iTextToShow == SHOW_SPECHELP ) { CHudTextMessage::LocaliseTextString( "#Spec_Help_Title", cTitle, MAX_TITLE_LENGTH ); @@ -1889,7 +2061,7 @@ void TeamFortressViewport::UpdateCursorState() if ( m_pSpectatorPanel->m_menuVisible || m_pCurrentMenu || m_pTeamMenu->isVisible() || m_pServerBrowser->isVisible() || GetClientVoiceMgr()->IsInSquelchMode() ) { g_iVisibleMouse = true; - App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::SchemeCursor::scu_arrow) ); + App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::scu_arrow) ); return; } else if ( m_pCurrentCommandMenu ) @@ -1898,7 +2070,7 @@ void TeamFortressViewport::UpdateCursorState() if ( gHUD.m_pCvarStealMouse->value != 0.0f ) { g_iVisibleMouse = true; - App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::SchemeCursor::scu_arrow) ); + App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::scu_arrow) ); return; } } @@ -1910,7 +2082,7 @@ void TeamFortressViewport::UpdateCursorState() } g_iVisibleMouse = false; - App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::SchemeCursor::scu_none) ); + App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::scu_none) ); } void TeamFortressViewport::UpdateHighlights() @@ -1923,7 +2095,7 @@ void TeamFortressViewport::GetAllPlayersInfo( void ) { for ( int i = 1; i < MAX_PLAYERS; i++ ) { - GetPlayerInfo( i, &g_PlayerInfoList[i] ); + gEngfuncs.pfnGetPlayerInfo( i, &g_PlayerInfoList[i] ); if ( g_PlayerInfoList[i].thisplayer ) m_pScoreBoard->m_iPlayerNum = i; // !!!HACK: this should be initialized elsewhere... maybe gotten from the engine @@ -1932,6 +2104,9 @@ void TeamFortressViewport::GetAllPlayersInfo( void ) void TeamFortressViewport::paintBackground() { + int wide, tall; + getParent()->getSize( wide, tall ); + setSize( wide, tall ); if (m_pScoreBoard) { int x, y; @@ -2229,7 +2404,7 @@ int TeamFortressViewport::MsgFunc_BuildSt( const char *pszName, int iSize, void { BEGIN_READ( pbuf, iSize ); - m_iBuildState = READ_BYTE(); + m_iBuildState = READ_SHORT(); // Force the menu to update UpdateCommandMenu( m_StandardMenu ); @@ -2250,7 +2425,8 @@ int TeamFortressViewport::MsgFunc_ServerName( const char *pszName, int iSize, vo { BEGIN_READ( pbuf, iSize ); - strncpy( m_szServerName, READ_STRING(), MAX_SERVERNAME_LENGTH ); + strncpy( m_szServerName, READ_STRING(), sizeof(m_szServerName) ); + m_szServerName[sizeof(m_szServerName) - 1] = 0; return 1; } @@ -2293,7 +2469,8 @@ int TeamFortressViewport::MsgFunc_TeamScore( const char *pszName, int iSize, voi char *TeamName = READ_STRING(); // find the team matching the name - for ( int i = 1; i <= m_pScoreBoard->m_iNumTeams; i++ ) + int i; + for ( i = 1; i <= m_pScoreBoard->m_iNumTeams; i++ ) { if ( !stricmp( TeamName, g_TeamInfo[i].name ) ) break; @@ -2367,3 +2544,101 @@ int TeamFortressViewport::MsgFunc_AllowSpec( const char *pszName, int iSize, voi return 1; } + +#if defined( _TFC ) +const Vector& GetTeamColor( int team_no ); +extern globalvars_t *gpGlobals; +#endif + +// used to reset the player's screen immediately +int TeamFortressViewport::MsgFunc_ResetFade( const char *pszName, int iSize, void *pbuf ) +{ +#if defined( _TFC ) + if ( !gpGlobals ) + return 0; + + screenfade_t sf; + gEngfuncs.pfnGetScreenFade( &sf ); + + sf.fader = 0; + sf.fadeg = 0; + sf.fadeb = 0; + sf.fadealpha = 0; + + sf.fadeEnd = 0.1; + sf.fadeReset = 0.0; + sf.fadeSpeed = 0.0; + + sf.fadeFlags = FFADE_IN; + + sf.fadeReset += gpGlobals->time; + sf.fadeEnd += sf.fadeReset; + + gEngfuncs.pfnSetScreenFade( &sf ); +#endif + + return 1; +} + +// used to fade a player's screen out/in when they're spectating someone who is teleported +int TeamFortressViewport::MsgFunc_SpecFade( const char *pszName, int iSize, void *pbuf ) +{ +#if defined( _TFC ) + BEGIN_READ( pbuf, iSize ); + + int iIndex = READ_BYTE(); + + // we're in first-person spectator mode (...not first-person in the PIP) + if ( g_iUser1 == OBS_IN_EYE ) + { + // this is the person we're watching + if ( g_iUser2 == iIndex ) + { + int iFade = READ_BYTE(); + int iTeam = READ_BYTE(); + float flTime = ( (float)READ_SHORT() / 100.0 ); + int iAlpha = READ_BYTE(); + + Vector team = GetTeamColor( iTeam ); + + screenfade_t sf; + gEngfuncs.pfnGetScreenFade( &sf ); + + sf.fader = team[0]; + sf.fadeg = team[1]; + sf.fadeb = team[2]; + sf.fadealpha = iAlpha; + + sf.fadeEnd = flTime; + sf.fadeReset = 0.0; + sf.fadeSpeed = 0.0; + + if ( iFade == BUILD_TELEPORTER_FADE_OUT ) + { + sf.fadeFlags = FFADE_OUT; + sf.fadeReset = flTime; + + if ( sf.fadeEnd ) + sf.fadeSpeed = -(float)sf.fadealpha / sf.fadeEnd; + + sf.fadeTotalEnd = sf.fadeEnd += gpGlobals->time; + sf.fadeReset += sf.fadeEnd; + } + else + { + sf.fadeFlags = FFADE_IN; + + if ( sf.fadeEnd ) + sf.fadeSpeed = (float)sf.fadealpha / sf.fadeEnd; + + sf.fadeReset += gpGlobals->time; + sf.fadeEnd += sf.fadeReset; + } + + gEngfuncs.pfnSetScreenFade( &sf ); + } + } +#endif + + return 1; +} diff --git a/cl_dll/vgui_TeamFortressViewport.h b/cl_dll/vgui_TeamFortressViewport.h index c87258a..9c6c50b 100644 --- a/cl_dll/vgui_TeamFortressViewport.h +++ b/cl_dll/vgui_TeamFortressViewport.h @@ -1,9 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= #ifndef TEAMFORTRESSVIEWPORT_H #define TEAMFORTRESSVIEWPORT_H @@ -32,8 +26,21 @@ #include "vgui_SchemeManager.h" #define TF_DEFS_ONLY -#include "tf_defs.h" - +#ifdef _TFC +#include "../tfc/tf_defs.h" +#else +#define PC_LASTCLASS 10 +#define PC_UNDEFINED 0 +#define MENU_DEFAULT 1 +#define MENU_TEAM 2 +#define MENU_CLASS 3 +#define MENU_MAPBRIEFING 4 +#define MENU_INTRO 5 +#define MENU_CLASSHELP 6 +#define MENU_CLASSHELP2 7 +#define MENU_REPEATHELP 8 +#define MENU_SPECHELP 9 +#endif using namespace vgui; class Cursor; @@ -50,6 +57,7 @@ class DragNDropPanel; class CTransparentPanel; class CClassMenuPanel; class CTeamMenuPanel; +class TeamFortressViewport; char* GetVGUITGAName(const char *pszName); BitmapTGA *LoadTGAForRes(const char* pImageName); @@ -59,8 +67,8 @@ extern int sTFValidClassInts[]; extern char *sLocalisedClasses[]; extern int iTeamColors[5][3]; extern int iNumberOfTeamColors; +extern TeamFortressViewport *gViewPort; -#define MAX_SERVERNAME_LENGTH 32 // Command Menu positions #define MAX_MENUS 80 @@ -74,7 +82,7 @@ extern int iNumberOfTeamColors; #define CMENU_TOP (BUTTON_SIZE_Y * 4) -#define MAX_TEAMNAME_SIZE 64 +//#define MAX_TEAMNAME_SIZE 64 #define MAX_BUTTON_SIZE 32 // Map Briefing Window @@ -377,6 +385,7 @@ public: m_iDirection = 0; } + CCommandMenu( CCommandMenu *pParentMenu, int direction, int x,int y,int wide,int tall ) : Panel(x,y,wide,tall) { m_pParentMenu = pParentMenu; @@ -402,12 +411,81 @@ public: void ClearButtonsOfArmedState( void ); + void RemoveAllButtons(void); + bool KeyInput( int keyNum ); virtual void paintBackground(); }; +//============================================================================== +// Command menu root button (drop down box style) + +class DropDownButton : public ColorButton +{ +private: + CImageLabel *m_pOpenButton; + +public: + + DropDownButton( const char* text,int x,int y,int wide,int tall, bool bNoHighlight, bool bFlat ) : + ColorButton( text, x, y, wide, tall, bNoHighlight, bFlat ) + { + // Put a > to show it's a submenu + m_pOpenButton = new CImageLabel( "arrowup", XRES( CMENU_SIZE_X-2 ) , YRES( BUTTON_SIZE_Y-2 ) ); + m_pOpenButton->setParent(this); + + int textwide, texttall; + getSize( textwide, texttall); + + // Reposition + m_pOpenButton->setPos( textwide-(m_pOpenButton->getImageWide()+6), -2 /*(tall - m_pOpenButton->getImageTall()*2) / 2*/ ); + m_pOpenButton->setVisible(true); + + } + + virtual void setVisible(bool state) + { + m_pOpenButton->setVisible(state); + ColorButton::setVisible(state); + } + + +}; + +//============================================================================== +// Button with image instead of text + +class CImageButton : public ColorButton +{ +private: + CImageLabel *m_pOpenButton; + +public: + + CImageButton( const char* text,int x,int y,int wide,int tall, bool bNoHighlight, bool bFlat ) : + ColorButton( " ", x, y, wide, tall, bNoHighlight, bFlat ) + { + m_pOpenButton = new CImageLabel( text,1,1,wide-2 , tall-2 ); + m_pOpenButton->setParent(this); + + // Reposition + // m_pOpenButton->setPos( x+1,y+1 ); + // m_pOpenButton->setSize(wide-2,tall-2); + + m_pOpenButton->setVisible(true); + } + + virtual void setVisible(bool state) + { + m_pOpenButton->setVisible(state); + ColorButton::setVisible(state); + } + + +}; + //============================================================================== class TeamFortressViewport : public Panel { @@ -467,6 +545,10 @@ private: char m_sDetpackStrings[3][MAX_BUTTON_SIZE]; char m_sMapName[64]; + + // helper function to update the player menu entries + void UpdatePlayerMenu(int menuIndex); + public: TeamFortressViewport(int x,int y,int wide,int tall); void Initialize( void ); @@ -535,6 +617,8 @@ public: int MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf ); int MsgFunc_Spectator( const char *pszName, int iSize, void *pbuf ); int MsgFunc_AllowSpec( const char *pszName, int iSize, void *pbuf ); + int MsgFunc_SpecFade( const char *pszName, int iSize, void *pbuf ); + int MsgFunc_ResetFade( const char *pszName, int iSize, void *pbuf ); // Input bool SlotInput( int iSlot ); @@ -553,6 +637,7 @@ public: int m_StandardMenu; // indexs in m_pCommandMenus int m_SpectatorOptionsMenu; int m_SpectatorCameraMenu; + int m_PlayerMenu; // a list of current player CClassMenuPanel *m_pClassMenu; ScorePanel *m_pScoreBoard; SpectatorPanel * m_pSpectatorPanel; @@ -751,11 +836,37 @@ public: else m_cvar->value = 1.0f; + // hide the menu + gViewPort->HideCommandMenu(); + gViewPort->UpdateSpectatorPanel(); } }; + + + +class CMenuHandler_SpectateFollow : public ActionSignal +{ +protected: + char m_szplayer[MAX_COMMAND_SIZE]; +public: + CMenuHandler_SpectateFollow( char *player ) + { + strncpy( m_szplayer, player, MAX_COMMAND_SIZE); + m_szplayer[MAX_COMMAND_SIZE-1] = '\0'; + } + + virtual void actionPerformed(Panel* panel) + { + gHUD.m_Spectator.FindPlayer(m_szplayer); + gViewPort->HideCommandMenu(); + } +}; + + + class CDragNDropHandler : public InputSignal { private: @@ -922,12 +1033,13 @@ public: virtual int IsNotValid() { // Only visible for spies +#ifdef _TFC if (g_iPlayerClass != PC_SPY) return true; +#endif if (m_iFeignState == gViewPort->GetIsFeigning()) return false; - return true; } }; @@ -967,9 +1079,11 @@ public: virtual int IsNotValid() { +#ifdef _TFC // Only visible for spies if ( g_iPlayerClass != PC_SPY ) return true; +#endif // if it's not tied to a specific team, then always show (for spies) if ( !m_iValidTeamsBits ) @@ -979,7 +1093,6 @@ public: int iTmp = 1 << (gViewPort->GetNumberOfTeams() - 1); if ( m_iValidTeamsBits & iTmp ) return false; - return true; } }; @@ -996,9 +1109,11 @@ public: virtual int IsNotValid() { +#ifdef _TFC // Only visible for demomen if (g_iPlayerClass != PC_DEMOMAN) return true; +#endif if (m_iDetpackState == gViewPort->GetIsSettingDetpack()) return false; @@ -1008,10 +1123,10 @@ public: }; extern int iBuildingCosts[]; -#define BUILDSTATE_HASBUILDING (1<<0) // Data is building ID (1 = Dispenser, 2 = Sentry) +#define BUILDSTATE_HASBUILDING (1<<0) // Data is building ID (1 = Dispenser, 2 = Sentry, 3 = Entry Teleporter, 4 = Exit Teleporter) #define BUILDSTATE_BUILDING (1<<1) #define BUILDSTATE_BASE (1<<2) -#define BUILDSTATE_CANBUILD (1<<3) // Data is building ID (0 = Dispenser, 1 = Sentry) +#define BUILDSTATE_CANBUILD (1<<3) // Data is building ID (1 = Dispenser, 2 = Sentry, 3 = Entry Teleporter, 4 = Exit Teleporter) class BuildButton : public CommandButton { @@ -1024,6 +1139,8 @@ public: { DISPENSER = 0, SENTRYGUN = 1, + ENTRY_TELEPORTER = 2, + EXIT_TELEPORTER = 3 }; BuildButton( int iState, int iData, const char* text,int x,int y,int wide,int tall ) : CommandButton( text,x,y,wide,tall) @@ -1034,6 +1151,7 @@ public: virtual int IsNotValid() { +#ifdef _TFC // Only visible for engineers if (g_iPlayerClass != PC_ENGINEER) return true; @@ -1055,7 +1173,7 @@ public: if (m_iBuildState & BUILDSTATE_BASE) { // Only appear if we've got enough metal to build something, or something already built - if ( gViewPort->GetBuildState() & (BS_HAS_SENTRYGUN | BS_HAS_DISPENSER | BS_CANB_SENTRYGUN | BS_CANB_DISPENSER) ) + if ( gViewPort->GetBuildState() & (BS_HAS_SENTRYGUN | BS_HAS_DISPENSER | BS_CANB_SENTRYGUN | BS_CANB_DISPENSER | BS_HAS_ENTRY_TELEPORTER | BS_HAS_EXIT_TELEPORTER | BS_CANB_ENTRY_TELEPORTER | BS_CANB_EXIT_TELEPORTER) ) return false; return true; @@ -1068,6 +1186,10 @@ public: return true; if ( m_iBuildData == BuildButton::SENTRYGUN && !(gViewPort->GetBuildState() & BS_HAS_SENTRYGUN) ) return true; + if ( m_iBuildData == BuildButton::ENTRY_TELEPORTER && !(gViewPort->GetBuildState() & BS_HAS_ENTRY_TELEPORTER) ) + return true; + if ( m_iBuildData == BuildButton::EXIT_TELEPORTER && !(gViewPort->GetBuildState() & BS_HAS_EXIT_TELEPORTER) ) + return true; } // Can build something @@ -1078,10 +1200,14 @@ public: return false; if ( m_iBuildData == BuildButton::SENTRYGUN && (gViewPort->GetBuildState() & BS_CANB_SENTRYGUN) ) return false; + if ( m_iBuildData == BuildButton::ENTRY_TELEPORTER && (gViewPort->GetBuildState() & BS_CANB_ENTRY_TELEPORTER) ) + return false; + if ( m_iBuildData == BuildButton::EXIT_TELEPORTER && (gViewPort->GetBuildState() & BS_CANB_EXIT_TELEPORTER) ) + return false; return true; } - +#endif return false; } }; @@ -1132,29 +1258,6 @@ public: return CommandButton::IsNotValid(); } - - virtual void paintBackground() - { - if ( isArmed() ) - { - drawSetColor( 143,143, 54, 125 ); - drawFilledRect( 5, 0,_size[0] - 5,_size[1]); - } - } - - virtual void paint( void ) - { - if ( isArmed() ) - { - setFgColor( 194, 202, 54, 0 ); - } - else - { - setFgColor( 143, 143, 54, 15 ); - } - - Button::paint(); - } }; //----------------------------------------------------------------------------- diff --git a/cl_dll/vgui_teammenu.cpp b/cl_dll/vgui_teammenu.cpp index a137079..a8f3691 100644 --- a/cl_dll/vgui_teammenu.cpp +++ b/cl_dll/vgui_teammenu.cpp @@ -69,7 +69,7 @@ CTeamMenuPanel::CTeamMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide,i pSchemes->getBgColor( hTitleScheme, r, g, b, a ); pLabel->setBgColor( r, g, b, a ); pLabel->setContentAlignment( vgui::Label::a_west ); - pLabel->setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Title_SelectYourTeam")); + pLabel->setText( "%s", gHUD.m_TextMessage.BufferedLocaliseTextString("#Title_SelectYourTeam")); // Create the Info Window m_pTeamWindow = new CTransparentPanel( 255, TEAMMENU_WINDOW_X, TEAMMENU_WINDOW_Y, TEAMMENU_WINDOW_SIZE_X, TEAMMENU_WINDOW_SIZE_Y ); @@ -286,7 +286,7 @@ void CTeamMenuPanel::Update( void ) strcpy( szTitle, ch+1 ); ch = strchr( szTitle, '.' ); *ch = '\0'; - m_pMapTitle->setText( szTitle ); + m_pMapTitle->setText( "%s", szTitle ); *ch = '.'; // Update the map briefing diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index 02af24a..d7efc8d 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - // view/refresh setup functions #include "hud.h" @@ -22,51 +15,45 @@ #include "pm_defs.h" #include "event_api.h" #include "pmtrace.h" +#include "bench.h" #include "screenfade.h" #include "shake.h" #include "hltv.h" +#include "Exports.h" -// Spectator Mode -extern "C" -{ - float vecNewViewAngles[3]; - int iHasNewViewAngles; - float vecNewViewOrigin[3]; - int iHasNewViewOrigin; - int iIsSpectator; -} #ifndef M_PI #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif -extern "C" -{ int CL_IsThirdPerson( void ); void CL_CameraOffset( float *ofs ); - void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams ); + void CL_DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams ); void PM_ParticleLine( float *start, float *end, int pcolor, float life, float vert); int PM_GetVisEntInfo( int ent ); - int PM_GetPhysEntInfo( int ent ); + extern "C" int PM_GetPhysEntInfo( int ent ); void InterpolateAngles( float * start, float * end, float * output, float frac ); void NormalizeAngles( float * angles ); - float Distance(const float * v1, const float * v2); + extern "C" float Distance(const float * v1, const float * v2); float AngleBetweenVectors( const float * v1, const float * v2 ); float vJumpOrigin[3]; float vJumpAngles[3]; -} + void V_DropPunchAngle ( float frametime, float *ev_punchangle ); void VectorAngles( const float *forward, float *angles ); #include "r_studioint.h" #include "com_model.h" +#include "kbutton.h" extern engine_studio_api_t IEngineStudio; +extern kbutton_t in_mlook; + /* The view is allowed to move slightly from it's true position for bobbing, but if it exceeds 8 pixels linear distance (spherical, not box), the list of @@ -303,18 +290,30 @@ void V_DriftPitch ( struct ref_params_s *pparams ) } // don't count small mouse motion - if (pd.nodrift) + if ( pd.nodrift) { - if ( fabs( pparams->cmd->forwardmove ) < cl_forwardspeed->value ) - pd.driftmove = 0; - else - pd.driftmove += pparams->frametime; - - if ( pd.driftmove > v_centermove->value) - { - V_StartPitchDrift (); + if ( v_centermove->value > 0 && !(in_mlook.state & 1) ) + { + // this is for lazy players. if they stopped, looked around and then continued + // to move the view will be centered automatically if they move more than + // v_centermove units. + + if ( fabs( pparams->cmd->forwardmove ) < cl_forwardspeed->value ) + pd.driftmove = 0; + else + pd.driftmove += pparams->frametime; + + if ( pd.driftmove > v_centermove->value) + { + V_StartPitchDrift (); + } + else + { + return; // player didn't move enough + } } - return; + + return; // don't drift view } delta = pparams->idealpitch - pparams->cl_viewangles[PITCH]; @@ -326,7 +325,8 @@ void V_DriftPitch ( struct ref_params_s *pparams ) } move = pparams->frametime * pd.pitchvel; - pd.pitchvel += pparams->frametime * v_centerspeed->value; + + pd.pitchvel *= (1.0f+(pparams->frametime*0.25f)); // get faster by time if (delta > 0) { @@ -393,7 +393,7 @@ void V_AddIdle ( struct ref_params_s *pparams ) pparams->viewangles[YAW] += v_idlescale * sin(pparams->time*v_iyaw_cycle.value) * v_iyaw_level.value; } - + /* ============== V_CalcViewRoll @@ -1388,6 +1388,26 @@ int V_FindViewModelByWeaponModel(int weaponindex) { static char * modelmap[][2] = { + +# ifdef _TFC // TFC models override HL models + { "models/p_mini.mdl", "models/v_tfac.mdl" }, + { "models/p_sniper.mdl", "models/v_tfc_sniper.mdl" }, + { "models/p_umbrella.mdl", "models/v_umbrella.mdl" }, + { "models/p_crowbar.mdl", "models/v_tfc_crowbar.mdl" }, + { "models/p_spanner.mdl", "models/v_tfc_spanner.mdl" }, + { "models/p_knife.mdl", "models/v_tfc_knife.mdl" }, + { "models/p_medkit.mdl", "models/v_tfc_medkit.mdl" }, + { "models/p_egon.mdl", "models/v_flame.mdl" }, + { "models/p_glauncher.mdl", "models/v_tfgl.mdl" }, + { "models/p_rpg.mdl", "models/v_tfc_rpg.mdl" }, + { "models/p_nailgun.mdl", "models/v_tfc_nailgun.mdl" }, + { "models/p_snailgun.mdl", "models/v_tfc_supernailgun.mdl" }, + { "models/p_9mmhandgun.mdl", "models/v_tfc_railgun.mdl" }, + { "models/p_srpg.mdl", "models/v_tfc_rpg.mdl" }, + { "models/p_smallshotgun.mdl", "models/v_tfc_12gauge.mdl" }, + { "models/p_shotgun.mdl", "models/v_tfc_shotgun.mdl" }, + { "models/p_spygun.mdl", "models/v_tfc_pistol.mdl" }, +#endif { "models/p_crossbow.mdl", "models/v_crossbow.mdl" }, { "models/p_crowbar.mdl", "models/v_crowbar.mdl" }, { "models/p_egon.mdl", "models/v_egon.mdl" }, @@ -1473,7 +1493,11 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams ) } // predict missing client data and set weapon model ( in HLTV mode or inset in eye mode ) +#ifdef _TFC + if ( gEngfuncs.IsSpectateOnly() || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) +#else if ( gEngfuncs.IsSpectateOnly() ) +#endif { V_GetInEyePos( g_iUser2, pparams->simorg, pparams->cl_viewangles ); @@ -1536,6 +1560,9 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams ) case OBS_ROAMING : VectorCopy (v_cl_angles, v_angles); VectorCopy (v_sim_org, v_origin); + + // override values if director is active + gHUD.m_Spectator.GetDirectorCamera(v_origin, v_angles); break; case OBS_IN_EYE : V_CalcNormalRefdef ( pparams ); @@ -1602,8 +1629,10 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams ) -void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams ) +void CL_DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams ) { +// RecClCalcRefdef(pparams); + // intermission / finale rendering if ( pparams->intermission ) { diff --git a/cl_dll/voice_status.cpp b/cl_dll/voice_status.cpp new file mode 100644 index 0000000..fe24653 --- /dev/null +++ b/cl_dll/voice_status.cpp @@ -0,0 +1,885 @@ +//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// There are hud.h's coming out of the woodwork so this ensures that we get the right one. +#if defined(THREEWAVE) || defined(DMC_BUILD) + #include "../dmc/cl_dll/hud.h" +#elif defined(CSTRIKE) + #include "../cstrike/cl_dll/hud.h" +#elif defined(DOD) + #include "../dod/cl_dll/hud.h" +#else + #include "hud.h" +#endif + +#include "cl_util.h" +#include +#include +#include +#include "parsemsg.h" +#include "hud_servers.h" +#include "demo.h" +#include "demo_api.h" +#include "voice_status.h" +#include "r_efx.h" +#include "entity_types.h" +#include "VGUI_ActionSignal.h" +#include "VGUI_Scheme.h" +#include "VGUI_TextImage.h" +#include "vgui_loadtga.h" +#include "vgui_helpers.h" +#include "VGUI_MouseCode.h" + + + +using namespace vgui; + + +extern int cam_thirdperson; + + +#define VOICE_MODEL_INTERVAL 0.3 +#define SCOREBOARD_BLINK_FREQUENCY 0.3 // How often to blink the scoreboard icons. +#define SQUELCHOSCILLATE_PER_SECOND 2.0f + + +extern BitmapTGA *LoadTGA( const char* pImageName ); + + + +// ---------------------------------------------------------------------- // +// The voice manager for the client. +// ---------------------------------------------------------------------- // +CVoiceStatus g_VoiceStatus; + +CVoiceStatus* GetClientVoiceMgr() +{ + return &g_VoiceStatus; +} + + + +// ---------------------------------------------------------------------- // +// CVoiceStatus. +// ---------------------------------------------------------------------- // + +static CVoiceStatus *g_pInternalVoiceStatus = NULL; + +int __MsgFunc_VoiceMask(const char *pszName, int iSize, void *pbuf) +{ + if(g_pInternalVoiceStatus) + g_pInternalVoiceStatus->HandleVoiceMaskMsg(iSize, pbuf); + + return 1; +} + +int __MsgFunc_ReqState(const char *pszName, int iSize, void *pbuf) +{ + if(g_pInternalVoiceStatus) + g_pInternalVoiceStatus->HandleReqStateMsg(iSize, pbuf); + + return 1; +} + + +int g_BannedPlayerPrintCount; +void ForEachBannedPlayer(char id[16]) +{ + char str[256]; + sprintf(str, "Ban %d: %2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x\n", + g_BannedPlayerPrintCount++, + id[0], id[1], id[2], id[3], + id[4], id[5], id[6], id[7], + id[8], id[9], id[10], id[11], + id[12], id[13], id[14], id[15] + ); +#ifdef _WIN32 + strupr(str); +#endif + gEngfuncs.pfnConsolePrint(str); +} + + +void ShowBannedCallback() +{ + if(g_pInternalVoiceStatus) + { + g_BannedPlayerPrintCount = 0; + gEngfuncs.pfnConsolePrint("------- BANNED PLAYERS -------\n"); + g_pInternalVoiceStatus->m_BanMgr.ForEachBannedPlayer(ForEachBannedPlayer); + gEngfuncs.pfnConsolePrint("------------------------------\n"); + } +} + + +// ---------------------------------------------------------------------- // +// CVoiceStatus. +// ---------------------------------------------------------------------- // + +CVoiceStatus::CVoiceStatus() +{ + m_bBanMgrInitialized = false; + m_LastUpdateServerState = 0; + + m_pSpeakerLabelIcon = NULL; + m_pScoreboardNeverSpoken = NULL; + m_pScoreboardNotSpeaking = NULL; + m_pScoreboardSpeaking = NULL; + m_pScoreboardSpeaking2 = NULL; + m_pScoreboardSquelch = NULL; + m_pScoreboardBanned = NULL; + + m_pLocalBitmap = NULL; + m_pAckBitmap = NULL; + + m_bTalking = m_bServerAcked = false; + + memset(m_pBanButtons, 0, sizeof(m_pBanButtons)); + + m_pParentPanel = NULL; + + m_bServerModEnable = -1; + + m_pchGameDir = NULL; +} + + +CVoiceStatus::~CVoiceStatus() +{ + g_pInternalVoiceStatus = NULL; + + for(int i=0; i < MAX_VOICE_SPEAKERS; i++) + { + delete m_Labels[i].m_pLabel; + m_Labels[i].m_pLabel = NULL; + + delete m_Labels[i].m_pIcon; + m_Labels[i].m_pIcon = NULL; + + delete m_Labels[i].m_pBackground; + m_Labels[i].m_pBackground = NULL; + } + + delete m_pLocalLabel; + m_pLocalLabel = NULL; + + FreeBitmaps(); + + if(m_pchGameDir) + { + if(m_bBanMgrInitialized) + { + m_BanMgr.SaveState(m_pchGameDir); + } + + free(m_pchGameDir); + } +} + + +int CVoiceStatus::Init( + IVoiceStatusHelper *pHelper, + Panel **pParentPanel) +{ + // Setup the voice_modenable cvar. + gEngfuncs.pfnRegisterVariable("voice_modenable", "1", FCVAR_ARCHIVE); + + gEngfuncs.pfnRegisterVariable("voice_clientdebug", "0", 0); + + gEngfuncs.pfnAddCommand("voice_showbanned", ShowBannedCallback); + + if(gEngfuncs.pfnGetGameDirectory()) + { + m_BanMgr.Init(gEngfuncs.pfnGetGameDirectory()); + m_bBanMgrInitialized = true; + } + + assert(!g_pInternalVoiceStatus); + g_pInternalVoiceStatus = this; + + m_BlinkTimer = 0; + m_VoiceHeadModel = NULL; + memset(m_Labels, 0, sizeof(m_Labels)); + + for(int i=0; i < MAX_VOICE_SPEAKERS; i++) + { + CVoiceLabel *pLabel = &m_Labels[i]; + + pLabel->m_pBackground = new Label(""); + + if(pLabel->m_pLabel = new Label("")) + { + pLabel->m_pLabel->setVisible( true ); + pLabel->m_pLabel->setFont( Scheme::sf_primary2 ); + pLabel->m_pLabel->setTextAlignment( Label::a_east ); + pLabel->m_pLabel->setContentAlignment( Label::a_east ); + pLabel->m_pLabel->setParent( pLabel->m_pBackground ); + } + + if( pLabel->m_pIcon = new ImagePanel( NULL ) ) + { + pLabel->m_pIcon->setVisible( true ); + pLabel->m_pIcon->setParent( pLabel->m_pBackground ); + } + + pLabel->m_clientindex = -1; + } + + m_pLocalLabel = new ImagePanel(NULL); + + m_bInSquelchMode = false; + + m_pHelper = pHelper; + m_pParentPanel = pParentPanel; + gHUD.AddHudElem(this); + m_iFlags = HUD_ACTIVE; + HOOK_MESSAGE(VoiceMask); + HOOK_MESSAGE(ReqState); + + // Cache the game directory for use when we shut down + const char *pchGameDirT = gEngfuncs.pfnGetGameDirectory(); + m_pchGameDir = (char *)malloc(strlen(pchGameDirT) + 1); + strcpy(m_pchGameDir, pchGameDirT); + + return 1; +} + + +int CVoiceStatus::VidInit() +{ + FreeBitmaps(); + + + if( m_pLocalBitmap = vgui_LoadTGA("gfx/vgui/icntlk_pl.tga") ) + { + m_pLocalBitmap->setColor(Color(255,255,255,135)); + } + + if( m_pAckBitmap = vgui_LoadTGA("gfx/vgui/icntlk_sv.tga") ) + { + m_pAckBitmap->setColor(Color(255,255,255,135)); // Give just a tiny bit of translucency so software draws correctly. + } + + m_pLocalLabel->setImage( m_pLocalBitmap ); + m_pLocalLabel->setVisible( false ); + + + if( m_pSpeakerLabelIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/speaker4.tga" ) ) + m_pSpeakerLabelIcon->setColor( Color(255,255,255,1) ); // Give just a tiny bit of translucency so software draws correctly. + + if (m_pScoreboardNeverSpoken = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker1.tga")) + m_pScoreboardNeverSpoken->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. + + if(m_pScoreboardNotSpeaking = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker2.tga")) + m_pScoreboardNotSpeaking->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. + + if(m_pScoreboardSpeaking = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker3.tga")) + m_pScoreboardSpeaking->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. + + if(m_pScoreboardSpeaking2 = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker4.tga")) + m_pScoreboardSpeaking2->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. + + if(m_pScoreboardSquelch = vgui_LoadTGA("gfx/vgui/icntlk_squelch.tga")) + m_pScoreboardSquelch->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. + + if(m_pScoreboardBanned = vgui_LoadTGA("gfx/vgui/640_voiceblocked.tga")) + m_pScoreboardBanned->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. + + // Figure out the voice head model height. + m_VoiceHeadModelHeight = 45; + char *pFile = (char *)gEngfuncs.COM_LoadFile("scripts/voicemodel.txt", 5, NULL); + if(pFile) + { + char token[4096]; + gEngfuncs.COM_ParseFile(pFile, token); + if(token[0] >= '0' && token[0] <= '9') + { + m_VoiceHeadModelHeight = (float)atof(token); + } + + gEngfuncs.COM_FreeFile(pFile); + } + + m_VoiceHeadModel = gEngfuncs.pfnSPR_Load("sprites/voiceicon.spr"); + return TRUE; +} + + +void CVoiceStatus::Frame(double frametime) +{ + // check server banned players once per second + if(gEngfuncs.GetClientTime() - m_LastUpdateServerState > 1) + { + UpdateServerState(false); + } + + m_BlinkTimer += frametime; + + // Update speaker labels. + if( m_pHelper->CanShowSpeakerLabels() ) + { + for( int i=0; i < MAX_VOICE_SPEAKERS; i++ ) + m_Labels[i].m_pBackground->setVisible( m_Labels[i].m_clientindex != -1 ); + } + else + { + for( int i=0; i < MAX_VOICE_SPEAKERS; i++ ) + m_Labels[i].m_pBackground->setVisible( false ); + } + + for(int i=0; i < VOICE_MAX_PLAYERS; i++) + UpdateBanButton(i); +} + + +void CVoiceStatus::CreateEntities() +{ + if(!m_VoiceHeadModel) + return; + + cl_entity_t *localPlayer = gEngfuncs.GetLocalPlayer(); + + int iOutModel = 0; + for(int i=0; i < VOICE_MAX_PLAYERS; i++) + { + if(!m_VoicePlayers[i]) + continue; + + cl_entity_s *pClient = gEngfuncs.GetEntityByIndex(i+1); + + // Don't show an icon if the player is not in our PVS. + if(!pClient || pClient->curstate.messagenum < localPlayer->curstate.messagenum) + continue; + + // Don't show an icon for dead or spectating players (ie: invisible entities). + if(pClient->curstate.effects & EF_NODRAW) + continue; + + // Don't show an icon for the local player unless we're in thirdperson mode. + if(pClient == localPlayer && !cam_thirdperson) + continue; + + cl_entity_s *pEnt = &m_VoiceHeadModels[iOutModel]; + ++iOutModel; + + memset(pEnt, 0, sizeof(*pEnt)); + + pEnt->curstate.rendermode = kRenderTransAdd; + pEnt->curstate.renderamt = 255; + pEnt->baseline.renderamt = 255; + pEnt->curstate.renderfx = kRenderFxNoDissipation; + pEnt->curstate.framerate = 1; + pEnt->curstate.frame = 0; + pEnt->model = (struct model_s*)gEngfuncs.GetSpritePointer(m_VoiceHeadModel); + pEnt->angles[0] = pEnt->angles[1] = pEnt->angles[2] = 0; + pEnt->curstate.scale = 0.5f; + + pEnt->origin[0] = pEnt->origin[1] = 0; + pEnt->origin[2] = 45; + + VectorAdd(pEnt->origin, pClient->origin, pEnt->origin); + + // Tell the engine. + gEngfuncs.CL_CreateVisibleEntity(ET_NORMAL, pEnt); + } +} + + +void CVoiceStatus::UpdateSpeakerStatus( int entindex, qboolean bTalking ) +{ + cvar_t *pVoiceLoopback = NULL; + + if ( !m_pParentPanel || !*m_pParentPanel ) + { + return; + } + + if ( gEngfuncs.pfnGetCvarFloat( "voice_clientdebug" ) ) + { + char msg[256]; + _snprintf( msg, sizeof( msg ), "CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\n", entindex, bTalking ); + gEngfuncs.pfnConsolePrint( msg ); + } + + int iLocalPlayerIndex = gEngfuncs.GetLocalPlayer()->index; + + // Is it the local player talking? + if ( entindex == -1 ) + { + m_bTalking = !!bTalking; + if( bTalking ) + { + // Enable voice for them automatically if they try to talk. + gEngfuncs.pfnClientCmd( "voice_modenable 1" ); + } + + // now set the player index to the correct index for the local player + // this will allow us to have the local player's icon flash in the scoreboard + entindex = iLocalPlayerIndex; + + pVoiceLoopback = gEngfuncs.pfnGetCvarPointer( "voice_loopback" ); + } + else if ( entindex == -2 ) + { + m_bServerAcked = !!bTalking; + } + + if ( entindex >= 0 && entindex <= VOICE_MAX_PLAYERS ) + { + int iClient = entindex - 1; + if ( iClient < 0 ) + { + return; + } + + CVoiceLabel *pLabel = FindVoiceLabel( iClient ); + if ( bTalking ) + { + m_VoicePlayers[iClient] = true; + m_VoiceEnabledPlayers[iClient] = true; + + // If we don't have a label for this guy yet, then create one. + if ( !pLabel ) + { + // if this isn't the local player (unless they have voice_loopback on) + if ( ( entindex != iLocalPlayerIndex ) || ( pVoiceLoopback && pVoiceLoopback->value ) ) + { + if ( pLabel = GetFreeVoiceLabel() ) + { + // Get the name from the engine. + hud_player_info_t info; + memset( &info, 0, sizeof( info ) ); + gEngfuncs.pfnGetPlayerInfo( entindex, &info ); + + char paddedName[512]; + _snprintf( paddedName, sizeof( paddedName ), "%s ", info.name ); + + int color[3]; + m_pHelper->GetPlayerTextColor( entindex, color ); + + if ( pLabel->m_pBackground ) + { + pLabel->m_pBackground->setBgColor( color[0], color[1], color[2], 135 ); + pLabel->m_pBackground->setParent( *m_pParentPanel ); + pLabel->m_pBackground->setVisible( m_pHelper->CanShowSpeakerLabels() ); + } + + if ( pLabel->m_pLabel ) + { + pLabel->m_pLabel->setFgColor( 255, 255, 255, 0 ); + pLabel->m_pLabel->setBgColor( 0, 0, 0, 255 ); + pLabel->m_pLabel->setText( "%s", paddedName ); + } + + pLabel->m_clientindex = iClient; + } + } + } + } + else + { + m_VoicePlayers[iClient] = false; + + // If we have a label for this guy, kill it. + if ( pLabel ) + { + pLabel->m_pBackground->setVisible( false ); + pLabel->m_clientindex = -1; + } + } + } + + RepositionLabels(); +} + + +void CVoiceStatus::UpdateServerState(bool bForce) +{ + // Can't do anything when we're not in a level. + char const *pLevelName = gEngfuncs.pfnGetLevelName(); + if( pLevelName[0] == 0 ) + { + if( gEngfuncs.pfnGetCvarFloat("voice_clientdebug") ) + { + gEngfuncs.pfnConsolePrint( "CVoiceStatus::UpdateServerState: pLevelName[0]==0\n" ); + } + + return; + } + + int bCVarModEnable = !!gEngfuncs.pfnGetCvarFloat("voice_modenable"); + if(bForce || m_bServerModEnable != bCVarModEnable) + { + m_bServerModEnable = bCVarModEnable; + + char str[256]; + _snprintf(str, sizeof(str), "VModEnable %d", m_bServerModEnable); + ServerCmd(str); + + if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + char msg[256]; + sprintf(msg, "CVoiceStatus::UpdateServerState: Sending '%s'\n", str); + gEngfuncs.pfnConsolePrint(msg); + } + } + + char str[2048]; + sprintf(str, "vban"); + bool bChange = false; + + for(unsigned long dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++) + { + unsigned long serverBanMask = 0; + unsigned long banMask = 0; + for(unsigned long i=0; i < 32; i++) + { + char playerID[16]; + if(!gEngfuncs.GetPlayerUniqueID(i+1, playerID)) + continue; + + if(m_BanMgr.GetPlayerBan(playerID)) + banMask |= 1 << i; + + if(m_ServerBannedPlayers[dw*32 + i]) + serverBanMask |= 1 << i; + } + + if(serverBanMask != banMask) + bChange = true; + + // Ok, the server needs to be updated. + char numStr[512]; + sprintf(numStr, " %x", banMask); + strcat(str, numStr); + } + + if(bChange || bForce) + { + if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + char msg[256]; + sprintf(msg, "CVoiceStatus::UpdateServerState: Sending '%s'\n", str); + gEngfuncs.pfnConsolePrint(msg); + } + + gEngfuncs.pfnServerCmdUnreliable(str); // Tell the server.. + } + else + { + if (gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + gEngfuncs.pfnConsolePrint( "CVoiceStatus::UpdateServerState: no change\n" ); + } + } + + m_LastUpdateServerState = gEngfuncs.GetClientTime(); +} + +void CVoiceStatus::UpdateSpeakerImage(Label *pLabel, int iPlayer) +{ + m_pBanButtons[iPlayer-1] = pLabel; + UpdateBanButton(iPlayer-1); +} + +void CVoiceStatus::UpdateBanButton(int iClient) +{ + Label *pPanel = m_pBanButtons[iClient]; + + if (!pPanel) + return; + + char playerID[16]; + extern bool HACK_GetPlayerUniqueID( int iPlayer, char playerID[16] ); + if(!HACK_GetPlayerUniqueID(iClient+1, playerID)) + return; + + // Figure out if it's blinking or not. + bool bBlink = fmod(m_BlinkTimer, SCOREBOARD_BLINK_FREQUENCY*2) < SCOREBOARD_BLINK_FREQUENCY; + bool bTalking = !!m_VoicePlayers[iClient]; + bool bBanned = m_BanMgr.GetPlayerBan(playerID); + bool bNeverSpoken = !m_VoiceEnabledPlayers[iClient]; + + // Get the appropriate image to display on the panel. + if (bBanned) + { + pPanel->setImage(m_pScoreboardBanned); + } + else if (bTalking) + { + if (bBlink) + { + pPanel->setImage(m_pScoreboardSpeaking2); + } + else + { + pPanel->setImage(m_pScoreboardSpeaking); + } + pPanel->setFgColor(255, 170, 0, 1); + } + else if (bNeverSpoken) + { + pPanel->setImage(m_pScoreboardNeverSpoken); + pPanel->setFgColor(100, 100, 100, 1); + } + else + { + pPanel->setImage(m_pScoreboardNotSpeaking); + } +} + + +void CVoiceStatus::HandleVoiceMaskMsg(int iSize, void *pbuf) +{ + BEGIN_READ( pbuf, iSize ); + + unsigned long dw; + for(dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++) + { + m_AudiblePlayers.SetDWord(dw, (unsigned long)READ_LONG()); + m_ServerBannedPlayers.SetDWord(dw, (unsigned long)READ_LONG()); + + if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + char str[256]; + gEngfuncs.pfnConsolePrint("CVoiceStatus::HandleVoiceMaskMsg\n"); + + sprintf(str, " - m_AudiblePlayers[%d] = %lu\n", dw, m_AudiblePlayers.GetDWord(dw)); + gEngfuncs.pfnConsolePrint(str); + + sprintf(str, " - m_ServerBannedPlayers[%d] = %lu\n", dw, m_ServerBannedPlayers.GetDWord(dw)); + gEngfuncs.pfnConsolePrint(str); + } + } + + m_bServerModEnable = READ_BYTE(); +} + +void CVoiceStatus::HandleReqStateMsg(int iSize, void *pbuf) +{ + if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + gEngfuncs.pfnConsolePrint("CVoiceStatus::HandleReqStateMsg\n"); + } + + UpdateServerState(true); +} + +void CVoiceStatus::StartSquelchMode() +{ + if(m_bInSquelchMode) + return; + + m_bInSquelchMode = true; + m_pHelper->UpdateCursorState(); +} + +void CVoiceStatus::StopSquelchMode() +{ + m_bInSquelchMode = false; + m_pHelper->UpdateCursorState(); +} + +bool CVoiceStatus::IsInSquelchMode() +{ + return m_bInSquelchMode; +} + +CVoiceLabel* CVoiceStatus::FindVoiceLabel(int clientindex) +{ + for(int i=0; i < MAX_VOICE_SPEAKERS; i++) + { + if(m_Labels[i].m_clientindex == clientindex) + return &m_Labels[i]; + } + + return NULL; +} + + +CVoiceLabel* CVoiceStatus::GetFreeVoiceLabel() +{ + return FindVoiceLabel(-1); +} + + +void CVoiceStatus::RepositionLabels() +{ + // find starting position to draw from, along right-hand side of screen + int y = ScreenHeight / 2; + + int iconWide = 8, iconTall = 8; + if( m_pSpeakerLabelIcon ) + { + m_pSpeakerLabelIcon->getSize( iconWide, iconTall ); + } + + // Reposition active labels. + for(int i = 0; i < MAX_VOICE_SPEAKERS; i++) + { + CVoiceLabel *pLabel = &m_Labels[i]; + + if( pLabel->m_clientindex == -1 || !pLabel->m_pLabel ) + { + if( pLabel->m_pBackground ) + pLabel->m_pBackground->setVisible( false ); + + continue; + } + + int textWide, textTall; + pLabel->m_pLabel->getContentSize( textWide, textTall ); + + // Don't let it stretch too far across their screen. + if( textWide > (ScreenWidth*2)/3 ) + textWide = (ScreenWidth*2)/3; + + // Setup the background label to fit everything in. + int border = 2; + int bgWide = textWide + iconWide + border*3; + int bgTall = max( textTall, iconTall ) + border*2; + pLabel->m_pBackground->setBounds( ScreenWidth - bgWide - 8, y, bgWide, bgTall ); + + // Put the text at the left. + pLabel->m_pLabel->setBounds( border, (bgTall - textTall) / 2, textWide, textTall ); + + // Put the icon at the right. + int iconLeft = border + textWide + border; + int iconTop = (bgTall - iconTall) / 2; + if( pLabel->m_pIcon ) + { + pLabel->m_pIcon->setImage( m_pSpeakerLabelIcon ); + pLabel->m_pIcon->setBounds( iconLeft, iconTop, iconWide, iconTall ); + } + + y += bgTall + 2; + } + + if( m_pLocalBitmap && m_pAckBitmap && m_pLocalLabel && (m_bTalking || m_bServerAcked) ) + { + m_pLocalLabel->setParent(*m_pParentPanel); + m_pLocalLabel->setVisible( true ); + + if( m_bServerAcked && !!gEngfuncs.pfnGetCvarFloat("voice_clientdebug") ) + m_pLocalLabel->setImage( m_pAckBitmap ); + else + m_pLocalLabel->setImage( m_pLocalBitmap ); + + int sizeX, sizeY; + m_pLocalBitmap->getSize(sizeX, sizeY); + + int local_xPos = ScreenWidth - sizeX - 10; + int local_yPos = m_pHelper->GetAckIconHeight() - sizeY; + + m_pLocalLabel->setPos( local_xPos, local_yPos ); + } + else + { + m_pLocalLabel->setVisible( false ); + } +} + + +void CVoiceStatus::FreeBitmaps() +{ + // Delete all the images we have loaded. + delete m_pLocalBitmap; + m_pLocalBitmap = NULL; + + delete m_pAckBitmap; + m_pAckBitmap = NULL; + + delete m_pSpeakerLabelIcon; + m_pSpeakerLabelIcon = NULL; + + delete m_pScoreboardNeverSpoken; + m_pScoreboardNeverSpoken = NULL; + + delete m_pScoreboardNotSpeaking; + m_pScoreboardNotSpeaking = NULL; + + delete m_pScoreboardSpeaking; + m_pScoreboardSpeaking = NULL; + + delete m_pScoreboardSpeaking2; + m_pScoreboardSpeaking2 = NULL; + + delete m_pScoreboardSquelch; + m_pScoreboardSquelch = NULL; + + delete m_pScoreboardBanned; + m_pScoreboardBanned = NULL; + + // Clear references to the images in panels. + for(int i=0; i < VOICE_MAX_PLAYERS; i++) + { + if (m_pBanButtons[i]) + { + m_pBanButtons[i]->setImage(NULL); + } + } + + if(m_pLocalLabel) + m_pLocalLabel->setImage(NULL); +} + +//----------------------------------------------------------------------------- +// Purpose: returns true if the target client has been banned +// Input : playerID - +// Output : Returns true on success, false on failure. +//----------------------------------------------------------------------------- +bool CVoiceStatus::IsPlayerBlocked(int iPlayer) +{ + char playerID[16]; + if (!gEngfuncs.GetPlayerUniqueID(iPlayer, playerID)) + return false; + + return m_BanMgr.GetPlayerBan(playerID); +} + +//----------------------------------------------------------------------------- +// Purpose: returns true if the player can't hear the other client due to game rules (eg. the other team) +// Input : playerID - +// Output : Returns true on success, false on failure. +//----------------------------------------------------------------------------- +bool CVoiceStatus::IsPlayerAudible(int iPlayer) +{ + return !!m_AudiblePlayers[iPlayer-1]; +} + +//----------------------------------------------------------------------------- +// Purpose: blocks/unblocks the target client from being heard +// Input : playerID - +// Output : Returns true on success, false on failure. +//----------------------------------------------------------------------------- +void CVoiceStatus::SetPlayerBlockedState(int iPlayer, bool blocked) +{ + if (gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + gEngfuncs.pfnConsolePrint( "CVoiceStatus::SetPlayerBlockedState part 1\n" ); + } + + char playerID[16]; + if (!gEngfuncs.GetPlayerUniqueID(iPlayer, playerID)) + return; + + if (gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + gEngfuncs.pfnConsolePrint( "CVoiceStatus::SetPlayerBlockedState part 2\n" ); + } + + // Squelch or (try to) unsquelch this player. + if (gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) + { + char str[256]; + sprintf(str, "CVoiceStatus::SetPlayerBlockedState: setting player %d ban to %d\n", iPlayer, !m_BanMgr.GetPlayerBan(playerID)); + gEngfuncs.pfnConsolePrint(str); + } + + m_BanMgr.SetPlayerBan( playerID, blocked ); + UpdateServerState(false); +} diff --git a/cl_dll/voice_status.h b/cl_dll/voice_status.h new file mode 100644 index 0000000..d4ad2ee --- /dev/null +++ b/cl_dll/voice_status.h @@ -0,0 +1,228 @@ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef VOICE_STATUS_H +#define VOICE_STATUS_H +#pragma once + + +#include "VGUI_Label.h" +#include "VGUI_LineBorder.h" +#include "VGUI_ImagePanel.h" +#include "VGUI_BitmapTGA.h" +#include "VGUI_InputSignal.h" +#include "VGUI_Button.h" +#include "voice_common.h" +#include "cl_entity.h" +#include "voice_banmgr.h" +#include "vgui_checkbutton2.h" +#include "vgui_defaultinputsignal.h" + + +class CVoiceStatus; + + +class CVoiceLabel +{ +public: + vgui::Label *m_pLabel; + vgui::Label *m_pBackground; + vgui::ImagePanel *m_pIcon; // Voice icon next to player name. + int m_clientindex; // Client index of the speaker. -1 if this label isn't being used. +}; + + +// This is provided by each mod to access data that may not be the same across mods. +class IVoiceStatusHelper +{ +public: + virtual ~IVoiceStatusHelper() {} + + // Get RGB color for voice status text about this player. + virtual void GetPlayerTextColor(int entindex, int color[3]) = 0; + + // Force it to update the cursor state. + virtual void UpdateCursorState() = 0; + + // Return the height above the bottom that the voice ack icons should be drawn at. + virtual int GetAckIconHeight() = 0; + + // Return true if the voice manager is allowed to show speaker labels + // (mods usually return false when the scoreboard is up). + virtual bool CanShowSpeakerLabels() = 0; +}; + +//----------------------------------------------------------------------------- +// Purpose: Holds a color for the shared image +//----------------------------------------------------------------------------- +class VoiceImagePanel : public vgui::ImagePanel +{ + virtual void paintBackground() + { + if (_image!=null) + { + vgui::Color col; + getFgColor(col); + _image->setColor(col); + _image->doPaint(this); + } + } +}; + + +class CVoiceStatus : public CHudBase, public vgui::CDefaultInputSignal +{ +public: + CVoiceStatus(); + virtual ~CVoiceStatus(); + +// CHudBase overrides. +public: + + // Initialize the cl_dll's voice manager. + virtual int Init( + IVoiceStatusHelper *m_pHelper, + vgui::Panel **pParentPanel); + + // ackPosition is the bottom position of where CVoiceStatus will draw the voice acknowledgement labels. + virtual int VidInit(); + + +public: + + // Call from HUD_Frame each frame. + void Frame(double frametime); + + // Called when a player starts or stops talking. + // entindex is -1 to represent the local client talking (before the data comes back from the server). + // When the server acknowledges that the local client is talking, then entindex will be gEngfuncs.GetLocalPlayer(). + // entindex is -2 to represent the local client's voice being acked by the server. + void UpdateSpeakerStatus(int entindex, qboolean bTalking); + + // sets the correct image in the label for the player + void UpdateSpeakerImage(vgui::Label *pLabel, int iPlayer); + + // Call from the HUD_CreateEntities function so it can add sprites above player heads. + void CreateEntities(); + + // Called when the server registers a change to who this client can hear. + void HandleVoiceMaskMsg(int iSize, void *pbuf); + + // The server sends this message initially to tell the client to send their state. + void HandleReqStateMsg(int iSize, void *pbuf); + + +// Squelch mode functions. +public: + + // When you enter squelch mode, pass in + void StartSquelchMode(); + void StopSquelchMode(); + bool IsInSquelchMode(); + + // returns true if the target client has been banned + // playerIndex is of range 1..maxplayers + bool IsPlayerBlocked(int iPlayerIndex); + + // returns false if the player can't hear the other client due to game rules (eg. the other team) + bool IsPlayerAudible(int iPlayerIndex); + + // blocks the target client from being heard + void SetPlayerBlockedState(int iPlayerIndex, bool blocked); + +public: + + CVoiceLabel* FindVoiceLabel(int clientindex); // Find a CVoiceLabel representing the specified speaker. + // Returns NULL if none. + // entindex can be -1 if you want a currently-unused voice label. + CVoiceLabel* GetFreeVoiceLabel(); // Get an unused voice label. Returns NULL if none. + + void RepositionLabels(); + + void FreeBitmaps(); + + void UpdateServerState(bool bForce); + + // Update the button artwork to reflect the client's current state. + void UpdateBanButton(int iClient); + + +public: + + enum {MAX_VOICE_SPEAKERS=7}; + + float m_LastUpdateServerState; // Last time we called this function. + int m_bServerModEnable; // What we've sent to the server about our "voice_modenable" cvar. + + vgui::Panel **m_pParentPanel; + CPlayerBitVec m_VoicePlayers; // Who is currently talking. Indexed by client index. + + // This is the gamerules-defined list of players that you can hear. It is based on what teams people are on + // and is totally separate from the ban list. Indexed by client index. + CPlayerBitVec m_AudiblePlayers; + + // Players who have spoken at least once in the game so far + CPlayerBitVec m_VoiceEnabledPlayers; + + // This is who the server THINKS we have banned (it can become incorrect when a new player arrives on the server). + // It is checked periodically, and the server is told to squelch or unsquelch the appropriate players. + CPlayerBitVec m_ServerBannedPlayers; + + cl_entity_s m_VoiceHeadModels[VOICE_MAX_PLAYERS]; // These aren't necessarily in the order of players. They are just + // a place for it to put data in during CreateEntities. + + IVoiceStatusHelper *m_pHelper; // Each mod provides an implementation of this. + + + // Scoreboard icons. + double m_BlinkTimer; // Blink scoreboard icons.. + vgui::BitmapTGA *m_pScoreboardNeverSpoken; + vgui::BitmapTGA *m_pScoreboardNotSpeaking; + vgui::BitmapTGA *m_pScoreboardSpeaking; + vgui::BitmapTGA *m_pScoreboardSpeaking2; + vgui::BitmapTGA *m_pScoreboardSquelch; + vgui::BitmapTGA *m_pScoreboardBanned; + + vgui::Label *m_pBanButtons[VOICE_MAX_PLAYERS]; // scoreboard buttons. + + // Squelch mode stuff. + bool m_bInSquelchMode; + + HSPRITE m_VoiceHeadModel; // Voice head model (goes above players who are speaking). + float m_VoiceHeadModelHeight; // Height above their head to place the model. + + vgui::Image *m_pSpeakerLabelIcon; // Icon next to speaker labels. + + // Lower-right icons telling when the local player is talking.. + vgui::BitmapTGA *m_pLocalBitmap; // Represents the local client talking. + vgui::BitmapTGA *m_pAckBitmap; // Represents the server ack'ing the client talking. + vgui::ImagePanel *m_pLocalLabel; // Represents the local client talking. + + bool m_bTalking; // Set to true when the client thinks it's talking. + bool m_bServerAcked; // Set to true when the server knows the client is talking. + +public: + + CVoiceBanMgr m_BanMgr; // Tracks which users we have squelched and don't want to hear. + +public: + + bool m_bBanMgrInitialized; + + // Labels telling who is speaking. + CVoiceLabel m_Labels[MAX_VOICE_SPEAKERS]; + + // Cache the game directory for use when we shut down + char * m_pchGameDir; +}; + + +// Get the (global) voice manager. +CVoiceStatus* GetClientVoiceMgr(); + + +#endif // VOICE_STATUS_H diff --git a/common/Sequence.h b/common/Sequence.h new file mode 100644 index 0000000..dff3ef5 --- /dev/null +++ b/common/Sequence.h @@ -0,0 +1,201 @@ +//--------------------------------------------------------------------------- +// +// S c r i p t e d S e q u e n c e s +// +//--------------------------------------------------------------------------- +#ifndef _INCLUDE_SEQUENCE_H_ +#define _INCLUDE_SEQUENCE_H_ + + +#ifndef _DEF_BYTE_ +typedef unsigned char byte; +#endif + +//--------------------------------------------------------------------------- +// client_textmessage_t +//--------------------------------------------------------------------------- +typedef struct client_textmessage_s +{ + int effect; + byte r1, g1, b1, a1; // 2 colors for effects + byte r2, g2, b2, a2; + float x; + float y; + float fadein; + float fadeout; + float holdtime; + float fxtime; + const char *pName; + const char *pMessage; +} client_textmessage_t; + + +//-------------------------------------------------------------------------- +// sequenceDefaultBits_e +// +// Enumerated list of possible modifiers for a command. This enumeration +// is used in a bitarray controlling what modifiers are specified for a command. +//--------------------------------------------------------------------------- +enum sequenceModifierBits +{ + SEQUENCE_MODIFIER_EFFECT_BIT = (1 << 1), + SEQUENCE_MODIFIER_POSITION_BIT = (1 << 2), + SEQUENCE_MODIFIER_COLOR_BIT = (1 << 3), + SEQUENCE_MODIFIER_COLOR2_BIT = (1 << 4), + SEQUENCE_MODIFIER_FADEIN_BIT = (1 << 5), + SEQUENCE_MODIFIER_FADEOUT_BIT = (1 << 6), + SEQUENCE_MODIFIER_HOLDTIME_BIT = (1 << 7), + SEQUENCE_MODIFIER_FXTIME_BIT = (1 << 8), + SEQUENCE_MODIFIER_SPEAKER_BIT = (1 << 9), + SEQUENCE_MODIFIER_LISTENER_BIT = (1 << 10), + SEQUENCE_MODIFIER_TEXTCHANNEL_BIT = (1 << 11), +}; +typedef enum sequenceModifierBits sequenceModifierBits_e ; + + +//--------------------------------------------------------------------------- +// sequenceCommandEnum_e +// +// Enumerated sequence command types. +//--------------------------------------------------------------------------- +enum sequenceCommandEnum_ +{ + SEQUENCE_COMMAND_ERROR = -1, + SEQUENCE_COMMAND_PAUSE = 0, + SEQUENCE_COMMAND_FIRETARGETS, + SEQUENCE_COMMAND_KILLTARGETS, + SEQUENCE_COMMAND_TEXT, + SEQUENCE_COMMAND_SOUND, + SEQUENCE_COMMAND_GOSUB, + SEQUENCE_COMMAND_SENTENCE, + SEQUENCE_COMMAND_REPEAT, + SEQUENCE_COMMAND_SETDEFAULTS, + SEQUENCE_COMMAND_MODIFIER, + SEQUENCE_COMMAND_POSTMODIFIER, + SEQUENCE_COMMAND_NOOP, + + SEQUENCE_MODIFIER_EFFECT, + SEQUENCE_MODIFIER_POSITION, + SEQUENCE_MODIFIER_COLOR, + SEQUENCE_MODIFIER_COLOR2, + SEQUENCE_MODIFIER_FADEIN, + SEQUENCE_MODIFIER_FADEOUT, + SEQUENCE_MODIFIER_HOLDTIME, + SEQUENCE_MODIFIER_FXTIME, + SEQUENCE_MODIFIER_SPEAKER, + SEQUENCE_MODIFIER_LISTENER, + SEQUENCE_MODIFIER_TEXTCHANNEL, +}; +typedef enum sequenceCommandEnum_ sequenceCommandEnum_e; + + +//--------------------------------------------------------------------------- +// sequenceCommandType_e +// +// Typeerated sequence command types. +//--------------------------------------------------------------------------- +enum sequenceCommandType_ +{ + SEQUENCE_TYPE_COMMAND, + SEQUENCE_TYPE_MODIFIER, +}; +typedef enum sequenceCommandType_ sequenceCommandType_e; + + +//--------------------------------------------------------------------------- +// sequenceCommandMapping_s +// +// A mapping of a command enumerated-value to its name. +//--------------------------------------------------------------------------- +typedef struct sequenceCommandMapping_ sequenceCommandMapping_s; +struct sequenceCommandMapping_ +{ + sequenceCommandEnum_e commandEnum; + const char* commandName; + sequenceCommandType_e commandType; +}; + + +//--------------------------------------------------------------------------- +// sequenceCommandLine_s +// +// Structure representing a single command (usually 1 line) from a +// .SEQ file entry. +//--------------------------------------------------------------------------- +typedef struct sequenceCommandLine_ sequenceCommandLine_s; +struct sequenceCommandLine_ +{ + int commandType; // Specifies the type of command + client_textmessage_t clientMessage; // Text HUD message struct + char* speakerName; // Targetname of speaking entity + char* listenerName; // Targetname of entity being spoken to + char* soundFileName; // Name of sound file to play + char* sentenceName; // Name of sentences.txt to play + char* fireTargetNames; // List of targetnames to fire + char* killTargetNames; // List of targetnames to remove + float delay; // Seconds 'till next command + int repeatCount; // If nonzero, reset execution pointer to top of block (N times, -1 = infinite) + int textChannel; // Display channel on which text message is sent + int modifierBitField; // Bit field to specify what clientmessage fields are valid + sequenceCommandLine_s* nextCommandLine; // Next command (linked list) +}; + + +//--------------------------------------------------------------------------- +// sequenceEntry_s +// +// Structure representing a single command (usually 1 line) from a +// .SEQ file entry. +//--------------------------------------------------------------------------- +typedef struct sequenceEntry_ sequenceEntry_s; +struct sequenceEntry_ +{ + char* fileName; // Name of sequence file without .SEQ extension + char* entryName; // Name of entry label in file + sequenceCommandLine_s* firstCommand; // Linked list of commands in entry + sequenceEntry_s* nextEntry; // Next loaded entry + qboolean isGlobal; // Is entry retained over level transitions? +}; + + + +//--------------------------------------------------------------------------- +// sentenceEntry_s +// Structure representing a single sentence of a group from a .SEQ +// file entry. Sentences are identical to entries in sentences.txt, but +// can be unique per level and are loaded/unloaded with the level. +//--------------------------------------------------------------------------- +typedef struct sentenceEntry_ sentenceEntry_s; +struct sentenceEntry_ +{ + char* data; // sentence data (ie "We have hostiles" ) + sentenceEntry_s* nextEntry; // Next loaded entry + qboolean isGlobal; // Is entry retained over level transitions? + unsigned int index; // this entry's position in the file. +}; + +//-------------------------------------------------------------------------- +// sentenceGroupEntry_s +// Structure representing a group of sentences found in a .SEQ file. +// A sentence group is defined by all sentences with the same name, ignoring +// the number at the end of the sentence name. Groups enable a sentence +// to be picked at random across a group. +//-------------------------------------------------------------------------- +typedef struct sentenceGroupEntry_ sentenceGroupEntry_s; +struct sentenceGroupEntry_ +{ + char* groupName; // name of the group (ie CT_ALERT ) + unsigned int numSentences; // number of sentences in group + sentenceEntry_s* firstSentence; // head of linked list of sentences in group + sentenceGroupEntry_s* nextEntry; // next loaded group +}; + +//--------------------------------------------------------------------------- +// Function declarations +//--------------------------------------------------------------------------- +sequenceEntry_s* SequenceGet( const char* fileName, const char* entryName ); +void Sequence_ParseFile( const char* fileName, qboolean isGlobal ); +void Sequence_OnLevelLoad( const char* mapName ); +sentenceEntry_s* SequencePickSentence( const char *groupName, int pickMethod, int *picked ); + +#endif // _INCLUDE_SEQUENCE_H_ diff --git a/common/con_nprint.h b/common/con_nprint.h index caf4000..d9a4021 100644 --- a/common/con_nprint.h +++ b/common/con_nprint.h @@ -18,6 +18,10 @@ #pragma once #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef struct con_nprint_s { int index; // Row # @@ -27,5 +31,8 @@ typedef struct con_nprint_s void Con_NPrintf( int idx, char *fmt, ... ); void Con_NXPrintf( struct con_nprint_s *info, char *fmt, ... ); +#ifdef __cplusplus +} +#endif #endif diff --git a/common/const.h b/common/const.h index e2cf6bc..2c90dc5 100644 --- a/common/const.h +++ b/common/const.h @@ -109,6 +109,10 @@ #define EF_NOINTERP 32 // don't interpolate the next frame #define EF_LIGHT 64 // rocket flare glow sprite #define EF_NODRAW 128 // don't draw entity +#define EF_NIGHTVISION 256 // player nightvision +#define EF_SNIPERLASER 512 // sniper laser effect +#define EF_FIBERCAMERA 1024// fiber camera + // entity flags #define EFLAG_SLERP 1 // do studio interpolation of this entity @@ -520,6 +524,7 @@ #define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration. #define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque #define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube. +#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive #define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent) // byte (entity index of player) @@ -592,7 +597,7 @@ #define CONTENTS_TRANSLUCENT -15 */ -#define CONTENTS_LADDER -16 +#define CONTENTS_LADDER -16 #define CONTENT_FLYFIELD -17 #define CONTENT_GRAVITY_FLYFIELD -18 @@ -615,6 +620,7 @@ #define CHAN_STATIC 6 // allocate channel from the static area #define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network #define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). +#define CHAN_BOT 501 // channel used for bot chatter. // attenuation values #define ATTN_NONE 0 @@ -706,11 +712,12 @@ enum kRenderFxExplode, // Scale up really big! kRenderFxGlowShell, // Glowing Shell kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!) + kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier }; -typedef int func_t; -typedef int string_t; +typedef unsigned int func_t; +typedef unsigned int string_t; typedef unsigned char byte; typedef unsigned short word; diff --git a/common/crc.h b/common/crc.h index 15fdb0d..d210277 100644 --- a/common/crc.h +++ b/common/crc.h @@ -19,6 +19,8 @@ #pragma once #endif +#include "archtypes.h" // DAL + // MD5 Hash typedef struct { @@ -28,13 +30,24 @@ typedef struct } MD5Context_t; -typedef unsigned long CRC32_t; +#ifdef _WIN32 +typedef uint32 CRC32_t; +#else +typedef uint32 CRC32_t; +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif void CRC32_Init(CRC32_t *pulCRC); CRC32_t CRC32_Final(CRC32_t pulCRC); void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len); void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); int CRC_File(CRC32_t *crcvalue, char *pszFileName); - +#ifdef __cplusplus +} +#endif unsigned char COM_BlockSequenceCRCByte (unsigned char *base, int length, int sequence); void MD5Init(MD5Context_t *context); diff --git a/common/cvardef.h b/common/cvardef.h index 9e34363..53eb806 100644 --- a/common/cvardef.h +++ b/common/cvardef.h @@ -24,6 +24,7 @@ #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. #define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). #define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log +#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar typedef struct cvar_s { diff --git a/common/entity_state.h b/common/entity_state.h index 4625848..ef5d856 100644 --- a/common/entity_state.h +++ b/common/entity_state.h @@ -187,7 +187,7 @@ typedef struct local_state_s { entity_state_t playerstate; clientdata_t client; - weapon_data_t weapondata[ 32 ]; + weapon_data_t weapondata[ 64 ]; } local_state_t; #endif // !ENTITY_STATEH diff --git a/common/enums.h b/common/enums.h new file mode 100644 index 0000000..459405e --- /dev/null +++ b/common/enums.h @@ -0,0 +1,27 @@ +/*** + * + * Copyright (c) 2009, Valve LLC. All rights reserved. + * + * This product contains software technology licensed from Id + * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. + * All Rights Reserved. + * + * Use, distribution, and modification of this source code and/or resulting + * object code is restricted to non-commercial enhancements to products from + * Valve LLC. All other use, distribution, or modification is prohibited + * without written permission from Valve LLC. + * + ****/ + +#ifndef ENUMS_H +#define ENUMS_H + +typedef enum netsrc_s + { + NS_CLIENT, + NS_SERVER, + NS_MULTICAST // xxxMO + } netsrc_t; + +#endif + diff --git a/common/hltv.h b/common/hltv.h index ff00d24..8093a60 100644 --- a/common/hltv.h +++ b/common/hltv.h @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - // hltv.h // all shared consts between server, clients and proxy @@ -15,31 +8,34 @@ #define TYPE_PROXY 1 // client is another proxy #define TYPE_COMMENTATOR 3 // client is a commentator #define TYPE_DEMO 4 // client is a demo file + // sub commands of svc_hltv: #define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands #define HLTV_STATUS 1 // send status infos about proxy #define HLTV_LISTEN 2 // tell client to listen to a multicast stream -// sub commands of svc_director: +// director command types: #define DRC_CMD_NONE 0 // NULL director command #define DRC_CMD_START 1 // start director mode #define DRC_CMD_EVENT 2 // informs about director command #define DRC_CMD_MODE 3 // switches camera modes -#define DRC_CMD_CAMERA 4 // sets camera registers +#define DRC_CMD_CAMERA 4 // set fixed camera #define DRC_CMD_TIMESCALE 5 // sets time scale #define DRC_CMD_MESSAGE 6 // send HUD centerprint #define DRC_CMD_SOUND 7 // plays a particular sound -#define DRC_CMD_STATUS 8 // status info about broadcast -#define DRC_CMD_BANNER 9 // banner file name for HLTV gui -#define DRC_CMD_FADE 10 // send screen fade command -#define DRC_CMD_SHAKE 11 // send screen shake command -#define DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command +#define DRC_CMD_STATUS 8 // HLTV broadcast status +#define DRC_CMD_BANNER 9 // set GUI banner +#define DRC_CMD_STUFFTEXT 10 // like the normal svc_stufftext but as director command +#define DRC_CMD_CHASE 11 // chase a certain player +#define DRC_CMD_INEYE 12 // view player through own eyes +#define DRC_CMD_MAP 13 // show overview map +#define DRC_CMD_CAMPATH 14 // define camera waypoint +#define DRC_CMD_WAYPOINTS 15 // start moving camera, inetranl message -#define DRC_CMD_LAST 12 +#define DRC_CMD_LAST 15 - -// HLTV_EVENT event flags +// DRC_CMD_EVENT event flags #define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important) #define DRC_FLAG_SIDE (1<<4) // #define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene @@ -50,8 +46,9 @@ #define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data -#define MAX_DIRECTOR_CMD_PARAMETERS 4 -#define MAX_DIRECTOR_CMD_STRING 128 - +// DRC_CMD_WAYPOINT flags +#define DRC_FLAG_STARTPATH 1 // end with speed 0.0 +#define DRC_FLAG_SLOWSTART 2 // start with speed 0.0 +#define DRC_FLAG_SLOWEND 4 // end with speed 0.0 #endif // HLTV_H diff --git a/common/ivoicetweak.h b/common/ivoicetweak.h index 9bdb2bd..82f937d 100644 --- a/common/ivoicetweak.h +++ b/common/ivoicetweak.h @@ -15,7 +15,8 @@ typedef enum { MicrophoneVolume=0, // values 0-1. - OtherSpeakerScale // values 0-1. Scales how loud other players are. + OtherSpeakerScale, // values 0-1. Scales how loud other players are. + MicBoost, // 20 db gain to voice input } VoiceTweakControl; @@ -29,6 +30,8 @@ typedef struct IVoiceTweak_s // Get/set control values. void (*SetControlFloat)(VoiceTweakControl iControl, float value); float (*GetControlFloat)(VoiceTweakControl iControl); + + int (*GetSpeakingVolume)(); } IVoiceTweak; diff --git a/common/mathlib.h b/common/mathlib.h index 9fe0bff..7e493a6 100644 --- a/common/mathlib.h +++ b/common/mathlib.h @@ -15,7 +15,10 @@ // mathlib.h typedef float vec_t; +#ifndef DID_VEC3_T_DEFINE +#define DID_VEC3_T_DEFINE typedef vec_t vec3_t[3]; +#endif typedef vec_t vec4_t[4]; // x,y,z,w typedef vec_t vec5_t[5]; @@ -27,7 +30,6 @@ typedef vec_s_t vec5s_t[5]; typedef int fixed4_t; typedef int fixed8_t; typedef int fixed16_t; - #ifndef M_PI #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif diff --git a/common/nowin.h b/common/nowin.h index d386fb9..b245ba6 100644 --- a/common/nowin.h +++ b/common/nowin.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -10,6 +10,7 @@ #ifndef _WIN32 #include +#include #endif //!_WIN32 -#endif //INC_NOWIN_H \ No newline at end of file +#endif //INC_NOWIN_H diff --git a/common/parsemsg.cpp b/common/parsemsg.cpp new file mode 100644 index 0000000..fa96324 --- /dev/null +++ b/common/parsemsg.cpp @@ -0,0 +1,259 @@ +/*** +* +* Copyright (c) 1999, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// +// parsemsg.cpp +// +//-------------------------------------------------------------------------------------------------------------- +#include "parsemsg.h" +#include + +typedef unsigned char byte; +#define true 1 + +static byte *gpBuf; +static int giSize; +static int giRead; +static int giBadRead; + +int READ_OK( void ) +{ + return !giBadRead; +} + +void BEGIN_READ( void *buf, int size ) +{ + giRead = 0; + giBadRead = 0; + giSize = size; + gpBuf = (byte*)buf; +} + + +int READ_CHAR( void ) +{ + int c; + + if (giRead + 1 > giSize) + { + giBadRead = true; + return -1; + } + + c = (signed char)gpBuf[giRead]; + giRead++; + + return c; +} + +int READ_BYTE( void ) +{ + int c; + + if (giRead+1 > giSize) + { + giBadRead = true; + return -1; + } + + c = (unsigned char)gpBuf[giRead]; + giRead++; + + return c; +} + +int READ_SHORT( void ) +{ + int c; + + if (giRead+2 > giSize) + { + giBadRead = true; + return -1; + } + + c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) ); + + giRead += 2; + + return c; +} + +int READ_WORD( void ) +{ + return READ_SHORT(); +} + + +int READ_LONG( void ) +{ + int c; + + if (giRead+4 > giSize) + { + giBadRead = true; + return -1; + } + + c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24); + + giRead += 4; + + return c; +} + +float READ_FLOAT( void ) +{ + union + { + byte b[4]; + float f; + int l; + } dat; + + dat.b[0] = gpBuf[giRead]; + dat.b[1] = gpBuf[giRead+1]; + dat.b[2] = gpBuf[giRead+2]; + dat.b[3] = gpBuf[giRead+3]; + giRead += 4; + +// dat.l = LittleLong (dat.l); + + return dat.f; +} + +char* READ_STRING( void ) +{ + static char string[2048]; + int l,c; + + string[0] = 0; + + l = 0; + do + { + if ( giRead+1 > giSize ) + break; // no more characters + + c = READ_CHAR(); + if (c == -1 || c == 0) + break; + string[l] = c; + l++; + } while (l < sizeof(string)-1); + + string[l] = 0; + + return string; +} + +float READ_COORD( void ) +{ + return (float)(READ_SHORT() * (1.0/8)); +} + +float READ_ANGLE( void ) +{ + return (float)(READ_CHAR() * (360.0/256)); +} + +float READ_HIRESANGLE( void ) +{ + return (float)(READ_SHORT() * (360.0/65536)); +} + +//-------------------------------------------------------------------------------------------------------------- +BufferWriter::BufferWriter() +{ + Init( NULL, 0 ); +} + +//-------------------------------------------------------------------------------------------------------------- +BufferWriter::BufferWriter( unsigned char *buffer, int bufferLen ) +{ + Init( buffer, bufferLen ); +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::Init( unsigned char *buffer, int bufferLen ) +{ + m_overflow = false; + m_buffer = buffer; + m_remaining = bufferLen; + m_overallLength = bufferLen; +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::WriteByte( unsigned char data ) +{ + if (!m_buffer || !m_remaining) + { + m_overflow = true; + return; + } + + *m_buffer = data; + ++m_buffer; + --m_remaining; +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::WriteLong( int data ) +{ + if (!m_buffer || m_remaining < 4) + { + m_overflow = true; + return; + } + + m_buffer[0] = data&0xff; + m_buffer[1] = (data>>8)&0xff; + m_buffer[2] = (data>>16)&0xff; + m_buffer[3] = data>>24; + m_buffer += 4; + m_remaining -= 4; +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::WriteString( const char *str ) +{ + if (!m_buffer || !m_remaining) + { + m_overflow = true; + return; + } + + if (!str) + str = ""; + + int len = strlen(str)+1; + if ( len > m_remaining ) + { + m_overflow = true; + str = ""; + len = 1; + } + + strcpy((char *)m_buffer, str); + m_remaining -= len; + m_buffer += len; +} + +//-------------------------------------------------------------------------------------------------------------- +int BufferWriter::GetSpaceUsed() +{ + return m_overallLength - m_remaining; +} + +//-------------------------------------------------------------------------------------------------------------- diff --git a/common/parsemsg.h b/common/parsemsg.h new file mode 100644 index 0000000..194f844 --- /dev/null +++ b/common/parsemsg.h @@ -0,0 +1,66 @@ +/*** +* +* Copyright (c) 1999, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// +// parsemsg.h +// MDC - copying from cstrike\cl_dll so career-mode stuff can catch messages +// in this dll. (and C++ifying it) +// + +#ifndef PARSEMSG_H +#define PARSEMSG_H + +#define ASSERT( x ) +//-------------------------------------------------------------------------------------------------------------- +void BEGIN_READ( void *buf, int size ); +int READ_CHAR( void ); +int READ_BYTE( void ); +int READ_SHORT( void ); +int READ_WORD( void ); +int READ_LONG( void ); +float READ_FLOAT( void ); +char* READ_STRING( void ); +float READ_COORD( void ); +float READ_ANGLE( void ); +float READ_HIRESANGLE( void ); +int READ_OK( void ); + +//-------------------------------------------------------------------------------------------------------------- +class BufferWriter +{ +public: + BufferWriter(); + BufferWriter( unsigned char *buffer, int bufferLen ); + void Init( unsigned char *buffer, int bufferLen ); + + void WriteByte( unsigned char data ); + void WriteLong( int data ); + void WriteString( const char *str ); + + bool HasOverflowed(); + int GetSpaceUsed(); + +protected: + unsigned char *m_buffer; + int m_remaining; + bool m_overflow; + int m_overallLength; +}; + +//-------------------------------------------------------------------------------------------------------------- + +#endif // PARSEMSG_H + + + diff --git a/common/port.h b/common/port.h new file mode 100644 index 0000000..9d9c8b9 --- /dev/null +++ b/common/port.h @@ -0,0 +1,124 @@ +// port.h: portability helper +// +////////////////////////////////////////////////////////////////////// + +#if !defined PORT_H +#define PORT_H + +#include "archtypes.h" // DAL + +#ifdef _WIN32 + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_EXTRA_LEAN + +#include "winsani_in.h" +#include +#include "winsani_out.h" + +#include +#include +#include + +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +#else // _WIN32 + +#include +#include +#include // exit() +#include // strncpy() +#include // tolower() +#include +#include +#include +#include + +typedef unsigned char BYTE; +typedef short int WORD; +typedef unsigned int DWORD; +typedef int32 LONG; +//typedef uint32 ULONG; +#ifndef ARCHTYPES_H +typedef uint32 ULONG; +#endif +typedef void *HANDLE; +#ifndef HMODULE +typedef void *HMODULE; +#endif +typedef char * LPSTR; + +#define __cdecl + + +//const int MAX_PATH = PATH_MAX; +#define MAX_PATH PATH_MAX + +#ifdef LINUX +typedef struct POINT_s +{ + int x; + int y; +} POINT; +typedef void *HINSTANCE; +typedef void *HWND; +typedef void *HDC; +typedef void *HGLRC; + +typedef struct RECT_s +{ + int left; + int right; + int top; + int bottom; +} RECT; +#endif + + +#ifdef __cplusplus + +//#undef FALSE +//#undef TRUE + +#ifdef OSX +//#else +//const bool FALSE = false; +//const bool TRUE = true; +#endif +#endif + +#ifndef NULL + #ifdef __cplusplus + #define NULL 0 + #else + #define NULL ((void *)0) + #endif +#endif + +#ifdef __cplusplus +inline int ioctlsocket( int d, int cmd, uint32 *argp ) { return ioctl( d, cmd, argp ); } +inline int closesocket( int fd ) { return close( fd ); } +inline char * GetCurrentDirectory( size_t size, char * buf ) { return getcwd( buf, size ); } +inline int WSAGetLastError() { return errno; } + +inline void DebugBreak( void ) { exit( 1 ); } +#endif + +extern char g_szEXEName[ 4096 ]; + +#define _snprintf snprintf + +#if defined(OSX) +#define SO_ARCH_SUFFIX ".dylib" +#else +#if defined ( __x86_64__ ) +#define SO_ARCH_SUFFIX "_amd64.so" +#else +#define SO_ARCH_SUFFIX ".so" +#endif +#endif +#endif + +#endif // PORT_H diff --git a/common/qfont.h b/common/qfont.h index 14d846e..010b5be 100644 --- a/common/qfont.h +++ b/common/qfont.h @@ -21,6 +21,7 @@ // Font stuff #define NUM_GLYPHS 256 +// does not exist: // #include "basetypes.h" typedef struct { @@ -34,7 +35,7 @@ typedef struct qfont_s int rowcount; int rowheight; charinfo fontinfo[ NUM_GLYPHS ]; - byte data[4]; + unsigned char data[4]; } qfont_t; #endif // qfont.h diff --git a/common/r_efx.h b/common/r_efx.h index 3db1084..9f1b182 100644 --- a/common/r_efx.h +++ b/common/r_efx.h @@ -85,7 +85,6 @@ color24 gTracerColors[] = #define FTENT_NOMODEL 0x00040000 // Doesn't have a model, never try to draw ( it just triggers other things ) #define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things ) -typedef struct tempent_s TEMPENTITY; typedef struct tempent_s { int flags; @@ -99,7 +98,7 @@ typedef struct tempent_s int hitSound; void ( *hitcallback ) ( struct tempent_s *ent, struct pmtrace_s *ptr ); void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime ); - TEMPENTITY *next; + struct tempent_s *next; int priority; short clientIndex; // if attached, this is the index of the client to stick to // if COLLIDEALL, this is the index of the client to ignore @@ -190,6 +189,7 @@ struct efx_api_s void ( *R_GetPackedColor ) ( short *packed, short color ); short ( *R_LookupColor ) ( unsigned char r, unsigned char g, unsigned char b ); void ( *R_DecalRemoveAll ) ( int textureIndex ); //textureIndex points to the decal index in the array, not the actual texture index. + void ( *R_FireCustomDecal ) ( int textureIndex, int entity, int modelIndex, float * position, int flags, float scale ); }; extern efx_api_t efx; diff --git a/common/r_studioint.h b/common/r_studioint.h index 17e20b3..7b1f1b8 100644 --- a/common/r_studioint.h +++ b/common/r_studioint.h @@ -1,10 +1,3 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - #if !defined( R_STUDIOINT_H ) #define R_STUDIOINT_H #if defined( _WIN32 ) @@ -101,6 +94,10 @@ typedef struct engine_studio_api_s // Only called by hardware interface void ( *GL_StudioDrawShadow ) ( void ); void ( *GL_SetRenderMode ) ( int mode ); + + void ( *StudioSetRenderamt ) (int iRenderamt); //!!!CZERO added for rendering glass on viewmodels + void ( *StudioSetCullState ) ( int iCull ); + void ( *StudioRenderShadow ) ( int iSprite, float *p1, float *p2, float *p3, float *p4 ); } engine_studio_api_t; typedef struct server_studio_api_s @@ -131,17 +128,17 @@ extern r_studio_interface_t *pStudioAPI; typedef struct sv_blending_interface_s { - int version; + int version; - void ( *SV_StudioSetupBones )( struct model_s *pModel, - float frame, - int sequence, - const vec3_t angles, - const vec3_t origin, - const byte *pcontroller, - const byte *pblending, - int iBone, - const edict_t *pEdict ); + void ( *SV_StudioSetupBones ) ( struct model_s *pModel, + float frame, + int sequence, + const vec3_t angles, + const vec3_t origin, + const byte *pcontroller, + const byte *pblending, + int iBone, + const edict_t *pEdict ); } sv_blending_interface_t; -#endif // R_STUDIOINT_H \ No newline at end of file +#endif // R_STUDIOINT_H diff --git a/common/triangleapi.h b/common/triangleapi.h index 7a4679f..db2d849 100644 --- a/common/triangleapi.h +++ b/common/triangleapi.h @@ -51,8 +51,13 @@ typedef struct triangleapi_s void ( *CullFace ) ( TRICULLSTYLE style ); int ( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame ); int ( *WorldToScreen ) ( float *world, float *screen ); // Returns 1 if it's z clipped - void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b. + void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); // Works just like GL_FOG, flFogColor is r/g/b. void ( *ScreenToWorld ) ( float *screen, float *world ); + void ( *GetMatrix ) ( const int pname, float *matrix ); + int ( *BoxInPVS ) ( float *mins, float *maxs ); + void ( *LightAtPoint ) ( float *pos, float *value ); + void ( *Color4fRendermode ) ( float r, float g, float b, float a, int rendermode ); + void ( *FogParams ) ( float flDensity, int iFogSkybox ); // Used with Fog()...sets fog density and whether the fog should be applied to the skybox } triangleapi_t; diff --git a/common/winsani_in.h b/common/winsani_in.h new file mode 100644 index 0000000..e2bb599 --- /dev/null +++ b/common/winsani_in.h @@ -0,0 +1,7 @@ +#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008) +#pragma push_macro("ARRAYSIZE") +#ifdef ARRAYSIZE +#undef ARRAYSIZE +#endif +#define HSPRITE WINDOWS_HSPRITE +#endif diff --git a/common/winsani_out.h b/common/winsani_out.h new file mode 100644 index 0000000..3d9cef0 --- /dev/null +++ b/common/winsani_out.h @@ -0,0 +1,4 @@ +#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008) +#undef HSPRITE +#pragma pop_macro("ARRAYSIZE") +#endif diff --git a/dlls/activity.h b/dlls/activity.h index 37c82b6..5c33ac8 100644 --- a/dlls/activity.h +++ b/dlls/activity.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/activitymap.h b/dlls/activitymap.h index b72c4e4..6cfe2a4 100644 --- a/dlls/activitymap.h +++ b/dlls/activitymap.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/aflock.cpp b/dlls/aflock.cpp index ab6139c..eae74ca 100644 --- a/dlls/aflock.cpp +++ b/dlls/aflock.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -14,6 +14,8 @@ ****/ //========================================================= //========================================================= +#include "archtypes.h" // DAL + #include "extdll.h" #include "util.h" #include "cbase.h" @@ -211,7 +213,7 @@ void CFlockingFlyerFlock :: SpawnFlock( void ) pBoid->pev->frame = 0; pBoid->pev->nextthink = gpGlobals->time + 0.2; - pBoid->SetThink( CFlockingFlyer :: IdleThink ); + pBoid->SetThink( &CFlockingFlyer :: IdleThink ); if ( pBoid != pLeader ) { @@ -229,7 +231,7 @@ void CFlockingFlyer :: Spawn( ) pev->frame = 0; pev->nextthink = gpGlobals->time + 0.1; - SetThink( IdleThink ); + SetThink( &CFlockingFlyer::IdleThink ); } //========================================================= @@ -292,7 +294,7 @@ void CFlockingFlyer :: Killed( entvars_t *pevAttacker, int iGib ) UTIL_SetSize( pev, Vector(0,0,0), Vector(0,0,0) ); pev->movetype = MOVETYPE_TOSS; - SetThink ( FallHack ); + SetThink ( &CFlockingFlyer::FallHack ); pev->nextthink = gpGlobals->time + 0.1; } @@ -366,7 +368,7 @@ void CFlockingFlyer :: IdleThink( void ) // see if there's a client in the same pvs as the monster if ( !FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) ) { - SetThink( Start ); + SetThink( &CFlockingFlyer::Start ); pev->nextthink = gpGlobals->time + 0.1; } } @@ -380,11 +382,11 @@ void CFlockingFlyer :: Start( void ) if ( IsLeader() ) { - SetThink( FlockLeaderThink ); + SetThink( &CFlockingFlyer::FlockLeaderThink ); } else { - SetThink( FlockFollowerThink ); + SetThink( &CFlockingFlyer::FlockFollowerThink ); } /* @@ -438,7 +440,7 @@ void CFlockingFlyer :: FormFlock( void ) } } - SetThink( IdleThink );// now that flock is formed, go to idle and wait for a player to come along. + SetThink( &CFlockingFlyer::IdleThink );// now that flock is formed, go to idle and wait for a player to come along. pev->nextthink = gpGlobals->time; } @@ -673,7 +675,7 @@ void CFlockingFlyer :: FlockFollowerThink( void ) if ( IsLeader() || !InSquad() ) { // the leader has been killed and this flyer suddenly finds himself the leader. - SetThink ( FlockLeaderThink ); + SetThink ( &CFlockingFlyer::FlockLeaderThink ); return; } diff --git a/dlls/agrunt.cpp b/dlls/agrunt.cpp index ff31e8c..df2ab8e 100644 --- a/dlls/agrunt.cpp +++ b/dlls/agrunt.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/airtank.cpp b/dlls/airtank.cpp index a356744..07ff9ec 100644 --- a/dlls/airtank.cpp +++ b/dlls/airtank.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -58,8 +58,8 @@ void CAirtank :: Spawn( void ) UTIL_SetSize(pev, Vector( -16, -16, 0), Vector(16, 16, 36)); UTIL_SetOrigin( pev, pev->origin ); - SetTouch( TankTouch ); - SetThink( TankThink ); + SetTouch( &CAirtank::TankTouch ); + SetThink( &CAirtank::TankThink ); pev->flags |= FL_MONSTER; pev->takedamage = DAMAGE_YES; diff --git a/dlls/animating.cpp b/dlls/animating.cpp index 6afc395..a0d29c5 100644 --- a/dlls/animating.cpp +++ b/dlls/animating.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/animation.cpp b/dlls/animation.cpp index bc7a135..0fa0e0e 100644 --- a/dlls/animation.cpp +++ b/dlls/animation.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -321,6 +321,7 @@ int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEve float SetController( void *pmodel, entvars_t *pev, int iController, float flValue ) { studiohdr_t *pstudiohdr; + int i; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) @@ -329,7 +330,7 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu mstudiobonecontroller_t *pbonecontroller = (mstudiobonecontroller_t *)((byte *)pstudiohdr + pstudiohdr->bonecontrollerindex); // find first controller that matches the index - for (int i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++) + for ( i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++) { if (pbonecontroller->index == iController) break; @@ -524,4 +525,4 @@ int GetBodygroup( void *pmodel, entvars_t *pev, int iGroup ) int iCurrent = (pev->body / pbodypart->base) % pbodypart->nummodels; return iCurrent; -} \ No newline at end of file +} diff --git a/dlls/animation.h b/dlls/animation.h index 7728167..d9810d7 100644 --- a/dlls/animation.h +++ b/dlls/animation.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/apache.cpp b/dlls/apache.cpp index 2b8d4ed..10e2ceb 100644 --- a/dlls/apache.cpp +++ b/dlls/apache.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -139,12 +139,12 @@ void CApache :: Spawn( void ) if (pev->spawnflags & SF_WAITFORTRIGGER) { - SetUse( StartupUse ); + SetUse( &CApache::StartupUse ); } else { - SetThink( HuntThink ); - SetTouch( FlyTouch ); + SetThink( &CApache::HuntThink ); + SetTouch( &CApache::FlyTouch ); pev->nextthink = gpGlobals->time + 1.0; } @@ -186,8 +186,8 @@ void CApache::NullThink( void ) void CApache::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetThink( HuntThink ); - SetTouch( FlyTouch ); + SetThink( &CApache::HuntThink ); + SetTouch( &CApache::FlyTouch ); pev->nextthink = gpGlobals->time + 0.1; SetUse( NULL ); } @@ -200,8 +200,8 @@ void CApache :: Killed( entvars_t *pevAttacker, int iGib ) STOP_SOUND( ENT(pev), CHAN_STATIC, "apache/ap_rotor2.wav" ); UTIL_SetSize( pev, Vector( -32, -32, -64), Vector( 32, 32, 0) ); - SetThink( DyingThink ); - SetTouch( CrashTouch ); + SetThink( &CApache::DyingThink ); + SetTouch( &CApache::CrashTouch ); pev->nextthink = gpGlobals->time + 0.1; pev->health = 0; pev->takedamage = DAMAGE_NO; @@ -402,7 +402,7 @@ void CApache :: DyingThink( void ) WRITE_BYTE( BREAK_METAL ); MESSAGE_END(); - SetThink( SUB_Remove ); + SetThink( &CApache::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; } } @@ -972,8 +972,8 @@ void CApacheHVR :: Spawn( void ) UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0)); UTIL_SetOrigin( pev, pev->origin ); - SetThink( IgniteThink ); - SetTouch( ExplodeTouch ); + SetThink( &CApacheHVR::IgniteThink ); + SetTouch( &CApacheHVR::ExplodeTouch ); UTIL_MakeAimVectors( pev->angles ); m_vecForward = gpGlobals->v_forward; @@ -1019,7 +1019,7 @@ void CApacheHVR :: IgniteThink( void ) MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS) // set to accelerate - SetThink( AccelerateThink ); + SetThink( &CApacheHVR::AccelerateThink ); pev->nextthink = gpGlobals->time + 0.1; } @@ -1047,4 +1047,4 @@ void CApacheHVR :: AccelerateThink( void ) } -#endif \ No newline at end of file +#endif diff --git a/dlls/barnacle.cpp b/dlls/barnacle.cpp index 67b1b94..0630622 100644 --- a/dlls/barnacle.cpp +++ b/dlls/barnacle.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -124,7 +124,7 @@ void CBarnacle :: Spawn() SetActivity ( ACT_IDLE ); - SetThink ( BarnacleThink ); + SetThink ( &CBarnacle::BarnacleThink ); pev->nextthink = gpGlobals->time + 0.5; UTIL_SetOrigin ( pev, pev->origin ); @@ -349,7 +349,7 @@ void CBarnacle :: Killed( entvars_t *pevAttacker, int iGib ) StudioFrameAdvance( 0.1 ); pev->nextthink = gpGlobals->time + 0.1; - SetThink ( WaitTillDead ); + SetThink ( &CBarnacle::WaitTillDead ); } //========================================================= diff --git a/dlls/barney.cpp b/dlls/barney.cpp index 76eba8d..1464b2e 100644 --- a/dlls/barney.cpp +++ b/dlls/barney.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -424,7 +424,7 @@ void CBarney :: Spawn() m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP; MonsterInit(); - SetUse( FollowerUse ); + SetUse( &CBarney::FollowerUse ); } //========================================================= diff --git a/dlls/basemonster.h b/dlls/basemonster.h index 04fbce9..83b8703 100644 --- a/dlls/basemonster.h +++ b/dlls/basemonster.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/bigmomma.cpp b/dlls/bigmomma.cpp index ca7a1bf..1aacc4f 100644 --- a/dlls/bigmomma.cpp +++ b/dlls/bigmomma.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -1198,7 +1198,7 @@ CBMortar *CBMortar::Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocity pSpit->pev->velocity = vecVelocity; pSpit->pev->owner = pOwner; pSpit->pev->scale = 2.5; - pSpit->SetThink ( Animate ); + pSpit->SetThink ( &CBMortar::Animate ); pSpit->pev->nextthink = gpGlobals->time + 0.1; return pSpit; diff --git a/dlls/bloater.cpp b/dlls/bloater.cpp index 889b866..5e57676 100644 --- a/dlls/bloater.cpp +++ b/dlls/bloater.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/bmodels.cpp b/dlls/bmodels.cpp index cfb41bb..8e96975 100644 --- a/dlls/bmodels.cpp +++ b/dlls/bmodels.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -419,7 +419,7 @@ void CFuncRotating :: Spawn( ) UTIL_SetOrigin(pev, pev->origin); SET_MODEL( ENT(pev), STRING(pev->model) ); - SetUse( RotatingUse ); + SetUse( &CFuncRotating::RotatingUse ); // did level designer forget to assign speed? if (pev->speed <= 0) pev->speed = 0; @@ -431,13 +431,13 @@ void CFuncRotating :: Spawn( ) // instant-use brush? if ( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_INSTANT) ) { - SetThink( SUB_CallUseToggle ); + SetThink( &CFuncRotating::SUB_CallUseToggle ); pev->nextthink = pev->ltime + 1.5; // leave a magic delay for client to start up } // can this brush inflict pain? if ( FBitSet (pev->spawnflags, SF_BRUSH_HURT) ) { - SetTouch( HurtTouch ); + SetTouch( &CFuncRotating::HurtTouch ); } Precache( ); @@ -504,7 +504,7 @@ void CFuncRotating :: Precache( void ) // if fan was spinning, and we went through transition or save/restore, // make sure we restart the sound. 1.5 sec delay is magic number. KDB - SetThink ( SpinUp ); + SetThink ( &CFuncRotating::SpinUp ); pev->nextthink = pev->ltime + 1.5; } } @@ -600,7 +600,7 @@ void CFuncRotating :: SpinUp( void ) EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning), m_flVolume, m_flAttenuation, SND_CHANGE_PITCH | SND_CHANGE_VOL, FANPITCHMAX); - SetThink( Rotate ); + SetThink( &CFuncRotating::Rotate ); Rotate(); } else @@ -641,7 +641,7 @@ void CFuncRotating :: SpinDown( void ) EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning /* Stop */), 0, 0, SND_STOP, m_pitch); - SetThink( Rotate ); + SetThink( &CFuncRotating::Rotate ); Rotate(); } else @@ -666,7 +666,7 @@ void CFuncRotating :: RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller // fan is spinning, so stop it. if ( pev->avelocity != g_vecZero ) { - SetThink ( SpinDown ); + SetThink ( &CFuncRotating::SpinDown ); //EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, (char *)STRING(pev->noiseStop), // m_flVolume, m_flAttenuation, 0, m_pitch); @@ -674,7 +674,7 @@ void CFuncRotating :: RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller } else// fan is not moving, so start it { - SetThink ( SpinUp ); + SetThink ( &CFuncRotating::SpinUp ); EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning), 0.01, m_flAttenuation, 0, FANPITCHMIN); @@ -686,7 +686,7 @@ void CFuncRotating :: RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller if ( pev->avelocity != g_vecZero ) { // play stopping sound here - SetThink ( SpinDown ); + SetThink ( &CFuncRotating::SpinDown ); // EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, (char *)STRING(pev->noiseStop), // m_flVolume, m_flAttenuation, 0, m_pitch); @@ -700,7 +700,7 @@ void CFuncRotating :: RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller m_flVolume, m_flAttenuation, 0, FANPITCHMAX); pev->avelocity = pev->movedir * pev->speed; - SetThink( Rotate ); + SetThink( &CFuncRotating::Rotate ); Rotate(); } } @@ -812,15 +812,15 @@ void CPendulum :: Spawn( void ) if ( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_INSTANT) ) { - SetThink( SUB_CallUseToggle ); + SetThink( &CPendulum::SUB_CallUseToggle ); pev->nextthink = gpGlobals->time + 0.1; } pev->speed = 0; - SetUse( PendulumUse ); + SetUse( &CPendulum::PendulumUse ); if ( FBitSet( pev->spawnflags, SF_PENDULUM_SWING ) ) { - SetTouch ( RopeTouch ); + SetTouch ( &CPendulum::RopeTouch ); } } @@ -837,7 +837,7 @@ void CPendulum :: PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, US pev->avelocity = m_maxSpeed * pev->movedir; pev->nextthink = pev->ltime + (delta / m_maxSpeed); - SetThink( Stop ); + SetThink( &CPendulum::Stop ); } else { @@ -850,7 +850,7 @@ void CPendulum :: PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, US { pev->nextthink = pev->ltime + 0.1; // Start the pendulum moving m_time = gpGlobals->time; // Save time to calculate dt - SetThink( Swing ); + SetThink( &CPendulum::Swing ); m_dampSpeed = m_maxSpeed; } } diff --git a/dlls/bullsquid.cpp b/dlls/bullsquid.cpp index c8518b6..3c426a8 100644 --- a/dlls/bullsquid.cpp +++ b/dlls/bullsquid.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -121,7 +121,7 @@ void CSquidSpit::Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity pSpit->pev->velocity = vecVelocity; pSpit->pev->owner = ENT(pevOwner); - pSpit->SetThink ( Animate ); + pSpit->SetThink ( &CSquidSpit::Animate ); pSpit->pev->nextthink = gpGlobals->time + 0.1; } @@ -172,7 +172,7 @@ void CSquidSpit :: Touch ( CBaseEntity *pOther ) pOther->TakeDamage ( pev, pev, gSkillData.bullsquidDmgSpit, DMG_GENERIC ); } - SetThink ( SUB_Remove ); + SetThink ( &CSquidSpit::SUB_Remove ); pev->nextthink = gpGlobals->time; } diff --git a/dlls/buttons.cpp b/dlls/buttons.cpp index e493267..cbed84f 100644 --- a/dlls/buttons.cpp +++ b/dlls/buttons.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -26,6 +26,9 @@ #include "saverestore.h" #include "doors.h" +#if !defined ( _WIN32 ) +#include // memset()))) +#endif #define SF_BUTTON_DONTMOVE 1 #define SF_ROTBUTTON_NOTSOLID 1 @@ -173,7 +176,7 @@ void CMultiSource::Spawn() pev->movetype = MOVETYPE_NONE; pev->nextthink = gpGlobals->time + 0.1; pev->spawnflags |= SF_MULTI_INIT; // Until it's initialized - SetThink(Register); + SetThink(&CMultiSource::Register); } void CMultiSource::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) @@ -240,7 +243,7 @@ void CMultiSource::Register(void) m_iTotal = 0; memset( m_rgEntities, 0, MS_MAX_TARGETS * sizeof(EHANDLE) ); - SetThink(SUB_DoNothing); + SetThink(&CMultiSource::SUB_DoNothing); // search for all entities which target this multisource (pev->targetname) @@ -455,7 +458,7 @@ void CBaseButton::Spawn( ) if ( FBitSet ( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )// this button should spark in OFF state { - SetThink ( ButtonSpark ); + SetThink ( &CBaseButton::ButtonSpark ); pev->nextthink = gpGlobals->time + 0.5;// no hurry, make sure everything else spawns } @@ -495,12 +498,12 @@ void CBaseButton::Spawn( ) if ( FBitSet ( pev->spawnflags, SF_BUTTON_TOUCH_ONLY ) ) // touchable button { - SetTouch( ButtonTouch ); + SetTouch( &CBaseButton::ButtonTouch ); } else { SetTouch ( NULL ); - SetUse ( ButtonUse ); + SetUse ( &CBaseButton::ButtonUse ); } } @@ -567,7 +570,7 @@ void DoSpark(entvars_t *pev, const Vector &location ) void CBaseButton::ButtonSpark ( void ) { - SetThink ( ButtonSpark ); + SetThink ( &CBaseButton::ButtonSpark ); pev->nextthink = gpGlobals->time + ( 0.1 + RANDOM_FLOAT ( 0, 1.5 ) );// spark again at random interval DoSpark( pev, pev->mins ); @@ -680,7 +683,7 @@ void CBaseButton::ButtonActivate( ) ASSERT(m_toggle_state == TS_AT_BOTTOM); m_toggle_state = TS_GOING_UP; - SetMoveDone( TriggerAndWait ); + SetMoveDone( &CBaseButton::TriggerAndWait ); if (!m_fRotating) LinearMove( m_vecPosition2, pev->speed); else @@ -709,12 +712,12 @@ void CBaseButton::TriggerAndWait( void ) SetTouch ( NULL ); } else - SetTouch( ButtonTouch ); + SetTouch( &CBaseButton::ButtonTouch ); } else { pev->nextthink = pev->ltime + m_flWait; - SetThink( ButtonReturn ); + SetThink( &CBaseButton::ButtonReturn ); } pev->frame = 1; // use alternate textures @@ -732,7 +735,7 @@ void CBaseButton::ButtonReturn( void ) ASSERT(m_toggle_state == TS_AT_TOP); m_toggle_state = TS_GOING_DOWN; - SetMoveDone( ButtonBackHome ); + SetMoveDone( &CBaseButton::ButtonBackHome ); if (!m_fRotating) LinearMove( m_vecPosition1, pev->speed); else @@ -784,12 +787,12 @@ void CBaseButton::ButtonBackHome( void ) SetTouch ( NULL ); } else - SetTouch( ButtonTouch ); + SetTouch( &CBaseButton::ButtonTouch ); // reset think for a sparking button if ( FBitSet ( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) ) { - SetThink ( ButtonSpark ); + SetThink ( &CBaseButton::ButtonSpark ); pev->nextthink = gpGlobals->time + 0.5;// no hurry. } } @@ -857,10 +860,10 @@ void CRotButton::Spawn( void ) if ( !FBitSet ( pev->spawnflags, SF_BUTTON_TOUCH_ONLY ) ) { SetTouch ( NULL ); - SetUse ( ButtonUse ); + SetUse ( &CRotButton::ButtonUse ); } else // touchable button - SetTouch( ButtonTouch ); + SetTouch( &CRotButton::ButtonTouch ); //SetTouch( ButtonTouch ); } @@ -986,7 +989,12 @@ void CMomentaryRotButton::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, US pev->ideal_yaw = CBaseToggle::AxisDelta( pev->spawnflags, pev->angles, m_start ) / m_flMoveDistance; UpdateAllButtons( pev->ideal_yaw, 1 ); - UpdateTarget( pev->ideal_yaw ); + + // Calculate destination angle and use it to predict value, this prevents sending target in wrong direction on retriggering + Vector dest = pev->angles + pev->avelocity * (pev->nextthink - pev->ltime); + float value1 = CBaseToggle::AxisDelta( pev->spawnflags, dest, m_start ) / m_flMoveDistance; + UpdateTarget( value1 ); + } void CMomentaryRotButton::UpdateAllButtons( float value, int start ) @@ -1049,7 +1057,7 @@ void CMomentaryRotButton::UpdateSelf( float value ) pev->nextthink += 0.1; pev->avelocity = (m_direction * pev->speed) * pev->movedir; - SetThink( Off ); + SetThink( &CMomentaryRotButton::Off ); } void CMomentaryRotButton::UpdateTarget( float value ) @@ -1077,7 +1085,7 @@ void CMomentaryRotButton::Off( void ) m_lastUsed = 0; if ( FBitSet( pev->spawnflags, SF_PENDULUM_AUTO_RETURN ) && m_returnSpeed > 0 ) { - SetThink( Return ); + SetThink( &CMomentaryRotButton::Return ); pev->nextthink = pev->ltime + 0.1; m_direction = -1; } @@ -1154,14 +1162,14 @@ void CEnvSpark::Spawn(void) { if (FBitSet(pev->spawnflags, 64)) // Start on { - SetThink(SparkThink); // start sparking - SetUse(SparkStop); // set up +USE to stop sparking + SetThink(&CEnvSpark::SparkThink); // start sparking + SetUse(&CEnvSpark::SparkStop); // set up +USE to stop sparking } else - SetUse(SparkStart); + SetUse(&CEnvSpark::SparkStart); } else - SetThink(SparkThink); + SetThink(&CEnvSpark::SparkThink); pev->nextthink = gpGlobals->time + ( 0.1 + RANDOM_FLOAT ( 0, 1.5 ) ); @@ -1208,14 +1216,14 @@ void EXPORT CEnvSpark::SparkThink(void) void EXPORT CEnvSpark::SparkStart(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetUse(SparkStop); - SetThink(SparkThink); + SetUse(&CEnvSpark::SparkStop); + SetThink(&CEnvSpark::SparkThink); pev->nextthink = gpGlobals->time + (0.1 + RANDOM_FLOAT ( 0, m_flDelay)); } void EXPORT CEnvSpark::SparkStop(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetUse(SparkStart); + SetUse(&CEnvSpark::SparkStart); SetThink(NULL); } diff --git a/dlls/cbase.cpp b/dlls/cbase.cpp index 73c63ae..fc893b5 100644 --- a/dlls/cbase.cpp +++ b/dlls/cbase.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -97,10 +97,9 @@ static DLL_FUNCTIONS gFunctionTable = static void SetObjectCollisionBox( entvars_t *pev ); -#ifndef _WIN32 extern "C" { -#endif -int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ) + + int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ) { if ( !pFunctionTable || interfaceVersion != INTERFACE_VERSION ) { @@ -124,9 +123,7 @@ int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ) return TRUE; } -#ifndef _WIN32 } -#endif int DispatchSpawn( edict_t *pent ) diff --git a/dlls/cbase.h b/dlls/cbase.h index d3e13d0..a97d9d0 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -42,6 +42,7 @@ CBaseEntity // UNDONE: This will ignore transition volumes (trigger_transition), but not the PVS!!! #define FCAP_FORCE_TRANSITION 0x00000080 // ALWAYS goes across transitions +#include "archtypes.h" // DAL #include "saverestore.h" #include "schedule.h" @@ -51,14 +52,18 @@ CBaseEntity // C functions for external declarations that call the appropriate C++ methods +#ifndef CBASE_DLLEXPORT #ifdef _WIN32 -#define EXPORT _declspec( dllexport ) +#define CBASE_DLLEXPORT _declspec( dllexport ) #else -#define EXPORT /* */ +#define CBASE_DLLEXPORT __attribute__ ((visibility("default"))) +#endif #endif -extern "C" EXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); -extern "C" EXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); +#define EXPORT CBASE_DLLEXPORT + +extern "C" CBASE_DLLEXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); +extern "C" CBASE_DLLEXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); extern int DispatchSpawn( edict_t *pent ); extern void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd ); @@ -282,8 +287,8 @@ public: #ifdef _DEBUG void FunctionCheck( void *pFunction, char *name ) { - if (pFunction && !NAME_FOR_FUNCTION((unsigned long)(pFunction)) ) - ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING(pev->classname), name, (unsigned long)pFunction ); + if (pFunction && !NAME_FOR_FUNCTION((uint32)pFunction) ) + ALERT( at_error, "No EXPORT: %s:%s (%08lx)\n", STRING(pev->classname), name, (uint32)pFunction ); } BASEPTR ThinkSet( BASEPTR func, char *name ) diff --git a/dlls/cdll_dll.h b/dlls/cdll_dll.h index 2293a27..00241fa 100644 --- a/dlls/cdll_dll.h +++ b/dlls/cdll_dll.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -43,4 +43,4 @@ #define WEAPON_SUIT 31 -#endif \ No newline at end of file +#endif diff --git a/dlls/client.cpp b/dlls/client.cpp index ec3bedc..49e9be8 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -38,6 +38,11 @@ #include "weaponinfo.h" #include "usercmd.h" #include "netadr.h" +#include "pm_shared.h" + +#if !defined ( _WIN32 ) +#include +#endif extern DLL_GLOBAL ULONG g_ulModelIndexPlayer; extern DLL_GLOBAL BOOL g_fGameOver; @@ -48,6 +53,8 @@ extern void CopyToBodyQue(entvars_t* pev); extern int giPrecacheGrunt; extern int gmsgSayText; +extern cvar_t allow_spectators; + extern int g_teamplay; void LinkUserMessages( void ); @@ -101,8 +108,10 @@ void ClientDisconnect( edict_t *pEntity ) if (g_fGameOver) return; - char text[256]; - sprintf( text, "- %s has left the game\n", STRING(pEntity->v.netname) ); + char text[256] = "" ; + if ( pEntity->v.netname ) + _snprintf( text, sizeof(text), "- %s has left the game\n", STRING(pEntity->v.netname) ); + text[ sizeof(text) - 1 ] = 0; MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); WRITE_BYTE( ENTINDEX(pEntity) ); WRITE_STRING( text ); @@ -197,11 +206,129 @@ void ClientPutInServer( edict_t *pEntity ) // Reset interpolation during first frame pPlayer->pev->effects |= EF_NOINTERP; + + pPlayer->pev->iuser1 = 0; // disable any spec modes + pPlayer->pev->iuser2 = 0; } #include "voice_gamemgr.h" extern CVoiceGameMgr g_VoiceGameMgr; + + +#if defined( _MSC_VER ) || defined( WIN32 ) +typedef wchar_t uchar16; +typedef unsigned int uchar32; +#else +typedef unsigned short uchar16; +typedef wchar_t uchar32; +#endif + +//----------------------------------------------------------------------------- +// Purpose: determine if a uchar32 represents a valid Unicode code point +//----------------------------------------------------------------------------- +bool Q_IsValidUChar32( uchar32 uVal ) +{ + // Values > 0x10FFFF are explicitly invalid; ditto for UTF-16 surrogate halves, + // values ending in FFFE or FFFF, or values in the 0x00FDD0-0x00FDEF reserved range + return ( uVal < 0x110000u ) && ( (uVal - 0x00D800u) > 0x7FFu ) && ( (uVal & 0xFFFFu) < 0xFFFEu ) && ( ( uVal - 0x00FDD0u ) > 0x1Fu ); +} + + +// Decode one character from a UTF-8 encoded string. Treats 6-byte CESU-8 sequences +// as a single character, as if they were a correctly-encoded 4-byte UTF-8 sequence. +int Q_UTF8ToUChar32( const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut ) +{ + const uint8 *pUTF8 = (const uint8 *)pUTF8_; + + int nBytes = 1; + uint32 uValue = pUTF8[0]; + uint32 uMinValue = 0; + + // 0....... single byte + if ( uValue < 0x80 ) + goto decodeFinishedNoCheck; + + // Expecting at least a two-byte sequence with 0xC0 <= first <= 0xF7 (110...... and 11110...) + if ( (uValue - 0xC0u) > 0x37u || ( pUTF8[1] & 0xC0 ) != 0x80 ) + goto decodeError; + + uValue = (uValue << 6) - (0xC0 << 6) + pUTF8[1] - 0x80; + nBytes = 2; + uMinValue = 0x80; + + // 110..... two-byte lead byte + if ( !( uValue & (0x20 << 6) ) ) + goto decodeFinished; + + // Expecting at least a three-byte sequence + if ( ( pUTF8[2] & 0xC0 ) != 0x80 ) + goto decodeError; + + uValue = (uValue << 6) - (0x20 << 12) + pUTF8[2] - 0x80; + nBytes = 3; + uMinValue = 0x800; + + // 1110.... three-byte lead byte + if ( !( uValue & (0x10 << 12) ) ) + goto decodeFinishedMaybeCESU8; + + // Expecting a four-byte sequence, longest permissible in UTF-8 + if ( ( pUTF8[3] & 0xC0 ) != 0x80 ) + goto decodeError; + + uValue = (uValue << 6) - (0x10 << 18) + pUTF8[3] - 0x80; + nBytes = 4; + uMinValue = 0x10000; + + // 11110... four-byte lead byte. fall through to finished. + +decodeFinished: + if ( uValue >= uMinValue && Q_IsValidUChar32( uValue ) ) + { +decodeFinishedNoCheck: + uValueOut = uValue; + bErrorOut = false; + return nBytes; + } +decodeError: + uValueOut = '?'; + bErrorOut = true; + return nBytes; + +decodeFinishedMaybeCESU8: + // Do we have a full UTF-16 surrogate pair that's been UTF-8 encoded afterwards? + // That is, do we have 0xD800-0xDBFF followed by 0xDC00-0xDFFF? If so, decode it all. + if ( ( uValue - 0xD800u ) < 0x400u && pUTF8[3] == 0xED && (uint8)( pUTF8[4] - 0xB0 ) < 0x10 && ( pUTF8[5] & 0xC0 ) == 0x80 ) + { + uValue = 0x10000 + ( ( uValue - 0xD800u ) << 10 ) + ( (uint8)( pUTF8[4] - 0xB0 ) << 6 ) + pUTF8[5] - 0x80; + nBytes = 6; + uMinValue = 0x10000; + } + goto decodeFinished; +} + + + +//----------------------------------------------------------------------------- +// Purpose: Returns true if UTF-8 string contains invalid sequences. +//----------------------------------------------------------------------------- +bool Q_UnicodeValidate( const char *pUTF8 ) +{ + bool bError = false; + while ( *pUTF8 ) + { + uchar32 uVal; + // Our UTF-8 decoder silently fixes up 6-byte CESU-8 (improperly re-encoded UTF-16) sequences. + // However, these are technically not valid UTF-8. So if we eat 6 bytes at once, it's an error. + int nCharSize = Q_UTF8ToUChar32( pUTF8, uVal, bError ); + if ( bError || nCharSize == 6 ) + return false; + pUTF8 += nCharSize; + } + return true; +} + //// HOST_SAY // String comes in as // say blah blah blah @@ -264,19 +391,15 @@ void Host_Say( edict_t *pEntity, int teamonly ) } // make sure the text has content - for ( char *pc = p; pc != NULL && *pc != 0; pc++ ) - { - if ( isprint( *pc ) && !isspace( *pc ) ) - { - pc = NULL; // we've found an alphanumeric character, so text is valid - break; - } - } - if ( pc != NULL ) + + if ( !p || !p[0] || !Q_UnicodeValidate ( p ) ) return; // no character found, so say nothing // turn on color set 2 (color on, no sound) - if ( teamonly ) + // turn on color set 2 (color on, no sound) + if ( player->IsObserver() && ( teamonly ) ) + sprintf( text, "%c(SPEC) %s: ", 2, STRING( pEntity->v.netname ) ); + else if ( teamonly ) sprintf( text, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) ); else sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) ); @@ -312,9 +435,14 @@ void Host_Say( edict_t *pEntity, int teamonly ) if ( g_VoiceGameMgr.PlayerHasBlockedPlayer( client, player ) ) continue; - if ( teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE ) + if ( !player->IsObserver() && teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE ) continue; + // Spectators can only talk to other specs + if ( player->IsObserver() && teamonly ) + if ( !client->IsObserver() ) + continue; + MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, client->pev ); WRITE_BYTE( ENTINDEX(pEntity) ); WRITE_STRING( text ); @@ -430,12 +558,41 @@ void ClientCommand( edict_t *pEntity ) { GetClassPtr((CBasePlayer *)pev)->SelectLastItem(); } - else if ( FStrEq( pcmd, "spectate" ) && (pev->flags & FL_PROXY) ) // added for proxy support + else if ( FStrEq( pcmd, "spectate" ) ) // clients wants to become a spectator + { + // always allow proxies to become a spectator + if ( (pev->flags & FL_PROXY) || allow_spectators.value ) + { + CBasePlayer * pPlayer = GetClassPtr((CBasePlayer *)pev); + + edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer ); + pPlayer->StartObserver( pev->origin, VARS(pentSpawnSpot)->angles); + + // notify other clients of player switching to spectator mode + UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs( "%s switched to spectator mode\n", + ( pev->netname && STRING(pev->netname)[0] != 0 ) ? STRING(pev->netname) : "unconnected" ) ); + } + else + ClientPrint( pev, HUD_PRINTCONSOLE, "Spectator mode is disabled.\n" ); + + } + else if ( FStrEq( pcmd, "specmode" ) ) // new spectator mode { CBasePlayer * pPlayer = GetClassPtr((CBasePlayer *)pev); - edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer ); - pPlayer->StartObserver( pev->origin, VARS(pentSpawnSpot)->angles); + if ( pPlayer->IsObserver() ) + pPlayer->Observer_SetMode( atoi( CMD_ARGV(1) ) ); + } + else if ( FStrEq(pcmd, "closemenus" ) ) + { + // just ignore it + } + else if ( FStrEq( pcmd, "follownext" ) ) // follow next player + { + CBasePlayer * pPlayer = GetClassPtr((CBasePlayer *)pev); + + if ( pPlayer->IsObserver() ) + pPlayer->Observer_FindNextPlayer( atoi( CMD_ARGV(1) )?true:false ); } else if ( g_pGameRules->ClientCommand( GetClassPtr((CBasePlayer *)pev), pcmd ) ) { @@ -491,12 +648,15 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) // Set the name g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName ); - char text[256]; - sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) ); - MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); - WRITE_BYTE( ENTINDEX(pEntity) ); - WRITE_STRING( text ); - MESSAGE_END(); + if (gpGlobals->maxClients > 1) + { + char text[256]; + sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) ); + MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); + WRITE_BYTE( ENTINDEX(pEntity) ); + WRITE_STRING( text ); + MESSAGE_END(); + } // team match? if ( g_teamplay ) @@ -937,7 +1097,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h int i; // don't send if flagged for NODRAW and it's not the host getting the message - if ( ( ent->v.effects == EF_NODRAW ) && + if ( ( ent->v.effects & EF_NODRAW ) && ( ent != host ) ) return 0; @@ -1428,7 +1588,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) int i; weapon_data_t *item; entvars_t *pev = &player->v; - CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); + CBasePlayer *pl = dynamic_cast< CBasePlayer *>( CBasePlayer::Instance( pev ) ); CBasePlayerWeapon *gun; ItemInfo II; @@ -1448,7 +1608,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) while ( pPlayerItem ) { - gun = (CBasePlayerWeapon *)pPlayerItem->GetWeaponPtr(); + gun = dynamic_cast( pPlayerItem->GetWeaponPtr() ); if ( gun && gun->UseDecrement() ) { // Get The ID. @@ -1496,43 +1656,72 @@ Data sent to current client only engine sets cd to 0 before calling. ================= */ -void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ) +void UpdateClientData ( const edict_t *ent, int sendweapons, struct clientdata_s *cd ) { - cd->flags = ent->v.flags; - cd->health = ent->v.health; + if ( !ent || !ent->pvPrivateData ) + return; + entvars_t * pev = (entvars_t *)&ent->v; + CBasePlayer * pl = dynamic_cast< CBasePlayer *>(CBasePlayer::Instance( pev )); + entvars_t * pevOrg = NULL; - cd->viewmodel = MODEL_INDEX( STRING( ent->v.viewmodel ) ); + // if user is spectating different player in First person, override some vars + if ( pl && pl->pev->iuser1 == OBS_IN_EYE ) + { + if ( pl->m_hObserverTarget ) + { + pevOrg = pev; + pev = pl->m_hObserverTarget->pev; + pl = dynamic_cast< CBasePlayer *>(CBasePlayer::Instance( pev ) ); + } + } - cd->waterlevel = ent->v.waterlevel; - cd->watertype = ent->v.watertype; - cd->weapons = ent->v.weapons; + cd->flags = pev->flags; + cd->health = pev->health; + + cd->viewmodel = MODEL_INDEX( STRING( pev->viewmodel ) ); + + cd->waterlevel = pev->waterlevel; + cd->watertype = pev->watertype; + cd->weapons = pev->weapons; // Vectors - cd->origin = ent->v.origin; - cd->velocity = ent->v.velocity; - cd->view_ofs = ent->v.view_ofs; - cd->punchangle = ent->v.punchangle; + cd->origin = pev->origin; + cd->velocity = pev->velocity; + cd->view_ofs = pev->view_ofs; + cd->punchangle = pev->punchangle; - cd->bInDuck = ent->v.bInDuck; - cd->flTimeStepSound = ent->v.flTimeStepSound; - cd->flDuckTime = ent->v.flDuckTime; - cd->flSwimTime = ent->v.flSwimTime; - cd->waterjumptime = ent->v.teleport_time; + cd->bInDuck = pev->bInDuck; + cd->flTimeStepSound = pev->flTimeStepSound; + cd->flDuckTime = pev->flDuckTime; + cd->flSwimTime = pev->flSwimTime; + cd->waterjumptime = pev->teleport_time; strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) ); - cd->maxspeed = ent->v.maxspeed; - cd->fov = ent->v.fov; - cd->weaponanim = ent->v.weaponanim; + cd->maxspeed = pev->maxspeed; + cd->fov = pev->fov; + cd->weaponanim = pev->weaponanim; - cd->pushmsec = ent->v.pushmsec; + cd->pushmsec = pev->pushmsec; + + //Spectator mode + if ( pevOrg != NULL ) + { + // don't use spec vars from chased player + cd->iuser1 = pevOrg->iuser1; + cd->iuser2 = pevOrg->iuser2; + } + else + { + cd->iuser1 = pev->iuser1; + cd->iuser2 = pev->iuser2; + } + + #if defined( CLIENT_WEAPONS ) if ( sendweapons ) { - entvars_t *pev = (entvars_t *)&ent->v; - CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); - if ( pl ) { cd->m_flNextAttack = pl->m_flNextAttack; @@ -1573,7 +1762,7 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien } } } - } + } #endif } @@ -1588,7 +1777,7 @@ This is the time to examine the usercmd for anything extra. This call happens e void CmdStart( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ) { entvars_t *pev = (entvars_t *)&player->v; - CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); + CBasePlayer *pl = dynamic_cast< CBasePlayer *>( CBasePlayer::Instance( pev ) ); if( !pl ) return; @@ -1611,7 +1800,7 @@ Each cmdstart is exactly matched with a cmd end, clean up any group trace flags, void CmdEnd ( const edict_t *player ) { entvars_t *pev = (entvars_t *)&player->v; - CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); + CBasePlayer *pl = dynamic_cast< CBasePlayer *>( CBasePlayer::Instance( pev ) ); if( !pl ) return; diff --git a/dlls/client.h b/dlls/client.h index 2e0b38e..2c3d09e 100644 --- a/dlls/client.h +++ b/dlls/client.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/combat.cpp b/dlls/combat.cpp index 5f57b2c..c884f83 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -115,7 +115,7 @@ void CGib :: SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs pGib->pev->movetype = MOVETYPE_TOSS; pGib->pev->solid = SOLID_BBOX; UTIL_SetSize ( pGib->pev, Vector ( 0, 0 ,0 ), Vector ( 0, 0, 0 ) ); - pGib->SetTouch ( StickyGibTouch ); + pGib->SetTouch ( &CGib::StickyGibTouch ); pGib->SetThink (NULL); } pGib->LimitVelocity(); @@ -331,7 +331,7 @@ void CBaseMonster :: GibMonster( void ) if ( gibbed ) { // don't remove players! - SetThink ( SUB_Remove ); + SetThink ( &CBaseMonster::SUB_Remove ); pev->nextthink = gpGlobals->time; } else @@ -654,7 +654,7 @@ void CBaseEntity :: SUB_StartFadeOut ( void ) pev->avelocity = g_vecZero; pev->nextthink = gpGlobals->time + 0.1; - SetThink ( SUB_FadeOut ); + SetThink ( &CBaseEntity::SUB_FadeOut ); } void CBaseEntity :: SUB_FadeOut ( void ) @@ -668,7 +668,7 @@ void CBaseEntity :: SUB_FadeOut ( void ) { pev->renderamt = 0; pev->nextthink = gpGlobals->time + 0.2; - SetThink ( SUB_Remove ); + SetThink ( &CBaseEntity::SUB_Remove ); } } @@ -688,7 +688,7 @@ void CGib :: WaitTillLand ( void ) if ( pev->velocity == g_vecZero ) { - SetThink (SUB_StartFadeOut); + SetThink (&CGib::SUB_StartFadeOut); pev->nextthink = gpGlobals->time + m_lifeTime; // If you bleed, you stink! @@ -756,7 +756,7 @@ void CGib :: StickyGibTouch ( CBaseEntity *pOther ) Vector vecSpot; TraceResult tr; - SetThink ( SUB_Remove ); + SetThink ( &CGib::SUB_Remove ); pev->nextthink = gpGlobals->time + 10; if ( !FClassnameIs( pOther->pev, "worldspawn" ) ) @@ -797,8 +797,8 @@ void CGib :: Spawn( const char *szGibModel ) pev->nextthink = gpGlobals->time + 4; m_lifeTime = 25; - SetThink ( WaitTillLand ); - SetTouch ( BounceGibTouch ); + SetThink ( &CGib::WaitTillLand ); + SetTouch ( &CGib::BounceGibTouch ); m_material = matNone; m_cBloodDecals = 5;// how many blood decals this gib can place (1 per bounce until none remain). diff --git a/dlls/controller.cpp b/dlls/controller.cpp index 8cf0272..1b8b260 100644 --- a/dlls/controller.cpp +++ b/dlls/controller.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -1170,8 +1170,8 @@ void CControllerHeadBall :: Spawn( void ) UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0)); UTIL_SetOrigin( pev, pev->origin ); - SetThink( HuntThink ); - SetTouch( BounceTouch ); + SetThink( &CControllerHeadBall::HuntThink ); + SetTouch( &CControllerHeadBall::BounceTouch ); m_vecIdeal = Vector( 0, 0, 0 ); @@ -1257,7 +1257,7 @@ void CControllerHeadBall :: HuntThink( void ) m_flNextAttack = gpGlobals->time + 3.0; - SetThink( DieThink ); + SetThink( &CControllerHeadBall::DieThink ); pev->nextthink = gpGlobals->time + 0.3; } @@ -1364,8 +1364,8 @@ void CControllerZapBall :: Spawn( void ) UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0)); UTIL_SetOrigin( pev, pev->origin ); - SetThink( AnimateThink ); - SetTouch( ExplodeTouch ); + SetThink( &CControllerZapBall::AnimateThink ); + SetTouch( &CControllerZapBall::ExplodeTouch ); m_hOwner = Instance( pev->owner ); pev->dmgtime = gpGlobals->time; // keep track of when ball spawned diff --git a/dlls/crossbow.cpp b/dlls/crossbow.cpp index 5fe0a78..543f23a 100644 --- a/dlls/crossbow.cpp +++ b/dlls/crossbow.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -71,8 +71,8 @@ void CCrossbowBolt::Spawn( ) UTIL_SetOrigin( pev, pev->origin ); UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); - SetTouch( BoltTouch ); - SetThink( BubbleThink ); + SetTouch( &CCrossbowBolt::BoltTouch ); + SetThink( &CCrossbowBolt::BubbleThink ); pev->nextthink = gpGlobals->time + 0.2; } @@ -139,7 +139,7 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) { EMIT_SOUND_DYN(ENT(pev), CHAN_BODY, "weapons/xbow_hit1.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 98 + RANDOM_LONG(0,7)); - SetThink( SUB_Remove ); + SetThink( &CCrossbowBolt::SUB_Remove ); pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit. if ( FClassnameIs( pOther->pev, "worldspawn" ) ) @@ -164,7 +164,7 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) if ( g_pGameRules->IsMultiplayer() ) { - SetThink( ExplodeThink ); + SetThink( &CCrossbowBolt::ExplodeThink ); pev->nextthink = gpGlobals->time + 0.1; } } @@ -335,7 +335,7 @@ void CCrossbow::PrimaryAttack( void ) // this function only gets called in multiplayer void CCrossbow::FireSniperBolt() { - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75; + m_flNextPrimaryAttack = GetNextAttackDelay(0.75); if (m_iClip == 0) { @@ -433,7 +433,7 @@ void CCrossbow::FireBolt() // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75; + m_flNextPrimaryAttack = GetNextAttackDelay(0.75); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75; @@ -545,4 +545,4 @@ LINK_ENTITY_TO_CLASS( ammo_crossbow, CCrossbowAmmo ); -#endif \ No newline at end of file +#endif diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index f301de7..7e85c8c 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -147,7 +147,7 @@ void CCrowbar::PrimaryAttack() { if (! Swing( 1 )) { - SetThink( SwingAgain ); + SetThink( &CCrowbar::SwingAgain ); pev->nextthink = gpGlobals->time + 0.1; } } @@ -203,7 +203,7 @@ int CCrowbar::Swing( int fFirst ) if (fFirst) { // miss - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextPrimaryAttack = GetNextAttackDelay(0.5); // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); @@ -304,9 +304,9 @@ int CCrowbar::Swing( int fFirst ) m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME; #endif - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; + m_flNextPrimaryAttack = GetNextAttackDelay(0.25); - SetThink( Smack ); + SetThink( &CCrowbar::Smack ); pev->nextthink = UTIL_WeaponTimeBase() + 0.2; diff --git a/dlls/decals.h b/dlls/decals.h index 0f8ff4e..47d99c2 100644 --- a/dlls/decals.h +++ b/dlls/decals.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/defaultai.cpp b/dlls/defaultai.cpp index efc0087..bbbdc38 100644 --- a/dlls/defaultai.cpp +++ b/dlls/defaultai.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/defaultai.h b/dlls/defaultai.h index 271ac7a..ae2e78c 100644 --- a/dlls/defaultai.h +++ b/dlls/defaultai.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/doors.cpp b/dlls/doors.cpp index 08511d7..1916101 100644 --- a/dlls/doors.cpp +++ b/dlls/doors.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -50,7 +50,7 @@ public: virtual int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; - + virtual void SetToggleState( int state ); // used to selectivly override defaults @@ -320,7 +320,7 @@ void CBaseDoor::Spawn( ) SetTouch ( NULL ); } else // touchable button - SetTouch( DoorTouch ); + SetTouch( &CBaseDoor::DoorTouch ); } @@ -571,11 +571,14 @@ void CBaseDoor::DoorGoUp( void ) // emit door moving and stop sounds on CHAN_STATIC so that the multicast doesn't // filter them out and leave a client stuck with looping door sounds! if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) - EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM); + { + if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN ) + EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM); + } m_toggle_state = TS_GOING_UP; - SetMoveDone( DoorHitTop ); + SetMoveDone( &CBaseDoor::DoorHitTop ); if ( FClassnameIs(pev, "func_door_rotating")) // !!! BUGBUG Triggered doors don't work with this yet { float sign = 1.0; @@ -624,13 +627,13 @@ void CBaseDoor::DoorHitTop( void ) { // Re-instate touch method, movement is complete if ( !FBitSet ( pev->spawnflags, SF_DOOR_USE_ONLY ) ) - SetTouch( DoorTouch ); + SetTouch( &CBaseDoor::DoorTouch ); } else { // In flWait seconds, DoorGoDown will fire, unless wait is -1, then door stays open pev->nextthink = pev->ltime + m_flWait; - SetThink( DoorGoDown ); + SetThink( &CBaseDoor::DoorGoDown ); if ( m_flWait == -1 ) { @@ -652,14 +655,17 @@ void CBaseDoor::DoorHitTop( void ) void CBaseDoor::DoorGoDown( void ) { if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) - EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM); + { + if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN ) + EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM); + } #ifdef DOOR_ASSERT ASSERT(m_toggle_state == TS_AT_TOP); #endif // DOOR_ASSERT m_toggle_state = TS_GOING_DOWN; - SetMoveDone( DoorHitBottom ); + SetMoveDone( &CBaseDoor::DoorHitBottom ); if ( FClassnameIs(pev, "func_door_rotating"))//rotating door AngularMove( m_vecAngle1, pev->speed); else @@ -686,7 +692,7 @@ void CBaseDoor::DoorHitBottom( void ) SetTouch ( NULL ); } else // touchable door - SetTouch( DoorTouch ); + SetTouch( &CBaseDoor::DoorTouch ); SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); // this isn't finished @@ -754,6 +760,9 @@ void CBaseDoor::Blocked( CBaseEntity *pOther ) } } + if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) + STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) ); + if ( pDoor->m_toggle_state == TS_GOING_DOWN) pDoor->DoorGoUp(); else @@ -860,7 +869,7 @@ void CRotDoor::Spawn( void ) SetTouch ( NULL ); } else // touchable button - SetTouch( DoorTouch ); + SetTouch( &CRotDoor::DoorTouch ); } @@ -889,6 +898,8 @@ public: virtual int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; + void EXPORT DoorMoveDone( void ); + BYTE m_bMoveSnd; // sound a door makes while moving }; @@ -1008,19 +1019,34 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP if ( value > 1.0 ) value = 1.0; + if ( value < 0.0 ) + value = 0.0; + Vector move = m_vecPosition1 + (value * (m_vecPosition2 - m_vecPosition1)); Vector delta = move - pev->origin; - float speed = delta.Length() * 10; + //float speed = delta.Length() * 10; + float speed = delta.Length() / 0.1; // move there in 0.1 sec + if ( speed == 0 ) + return; - if ( speed != 0 ) - { - // This entity only thinks when it moves, so if it's thinking, it's in the process of moving - // play the sound when it starts moving - if ( pev->nextthink < pev->ltime || pev->nextthink == 0 ) - EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM); + // This entity only thinks when it moves, so if it's thinking, it's in the process of moving + // play the sound when it starts moving (not yet thinking) + if ( pev->nextthink < pev->ltime || pev->nextthink == 0 ) + EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM); + // If we already moving to designated point, return + else if (move == m_vecFinalDest) + return; + + SetMoveDone( &CMomentaryDoor::DoorMoveDone ); + LinearMove( move, speed ); +} - LinearMove( move, speed ); - } - -} \ No newline at end of file +// +// The door has reached needed position. +// +void CMomentaryDoor::DoorMoveDone( void ) +{ + STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) ); + EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseArrived), 1, ATTN_NORM); +} diff --git a/dlls/doors.h b/dlls/doors.h index 55a853f..dcf571c 100644 --- a/dlls/doors.h +++ b/dlls/doors.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/effects.cpp b/dlls/effects.cpp index 5d7a1b3..d4f6ced 100644 --- a/dlls/effects.cpp +++ b/dlls/effects.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -87,7 +87,7 @@ void CBubbling::Spawn( void ) if ( !(pev->spawnflags & SF_BUBBLES_STARTOFF) ) { - SetThink( FizzThink ); + SetThink( &CBubbling::FizzThink ); pev->nextthink = gpGlobals->time + 2.0; m_state = 1; } @@ -108,7 +108,7 @@ void CBubbling::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use if ( m_state ) { - SetThink( FizzThink ); + SetThink( & CBubbling::FizzThink ); pev->nextthink = gpGlobals->time + 0.1; } else @@ -427,7 +427,7 @@ LINK_ENTITY_TO_CLASS( trip_beam, CTripBeam ); void CTripBeam::Spawn( void ) { CLightning::Spawn(); - SetTouch( TriggerTouch ); + SetTouch( &CTripBeam::TriggerTouch ); pev->solid = SOLID_TRIGGER; RelinkBeam(); } @@ -459,7 +459,7 @@ void CLightning::Spawn( void ) { if ( FStringNull( m_iszSpriteName ) ) { - SetThink( SUB_Remove ); + SetThink( &CLightning::SUB_Remove ); return; } pev->solid = SOLID_NOT; // Remove model & collisions @@ -472,7 +472,7 @@ void CLightning::Spawn( void ) SetThink( NULL ); if ( pev->dmg > 0 ) { - SetThink( DamageThink ); + SetThink( &CLightning::DamageThink ); pev->nextthink = gpGlobals->time + 0.1; } if ( pev->targetname ) @@ -486,7 +486,7 @@ void CLightning::Spawn( void ) else m_active = 1; - SetUse( ToggleUse ); + SetUse( &CLightning::ToggleUse ); } } else @@ -494,11 +494,11 @@ void CLightning::Spawn( void ) m_active = 0; if ( !FStringNull(pev->targetname) ) { - SetUse( StrikeUse ); + SetUse( &CLightning::StrikeUse ); } if ( FStringNull(pev->targetname) || FBitSet(pev->spawnflags, SF_BEAM_STARTON) ) { - SetThink( StrikeThink ); + SetThink( &CLightning::StrikeThink ); pev->nextthink = gpGlobals->time + 1.0; } } @@ -616,7 +616,7 @@ void CLightning::StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T } else { - SetThink( StrikeThink ); + SetThink( &CLightning::StrikeThink ); pev->nextthink = gpGlobals->time + 0.1; } @@ -961,13 +961,13 @@ void CLaser::Spawn( void ) { if ( FStringNull( pev->model ) ) { - SetThink( SUB_Remove ); + SetThink( &CLaser::SUB_Remove ); return; } pev->solid = SOLID_NOT; // Remove model & collisions Precache( ); - SetThink( StrikeThink ); + SetThink( &CLaser::StrikeThink ); pev->flags |= FL_CUSTOMENTITY; PointsInit( pev->origin, pev->origin ); @@ -1003,7 +1003,7 @@ void CLaser::KeyValue( KeyValueData *pkvd ) } else if (FStrEq(pkvd->szKeyName, "width")) { - SetWidth( atof(pkvd->szValue) ); + SetWidth( (int) atof(pkvd->szValue) ); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "NoiseAmplitude")) @@ -1264,7 +1264,7 @@ void CSprite::Expand( float scaleSpeed, float fadeSpeed ) { pev->speed = scaleSpeed; pev->health = fadeSpeed; - SetThink( ExpandThink ); + SetThink( &CSprite::ExpandThink ); pev->nextthink = gpGlobals->time; m_lastTime = gpGlobals->time; @@ -1319,7 +1319,7 @@ void CSprite::TurnOn( void ) pev->effects = 0; if ( (pev->framerate && m_maxFrame > 1.0) || (pev->spawnflags & SF_SPRITE_ONCE) ) { - SetThink( AnimateThink ); + SetThink( &CSprite::AnimateThink ); pev->nextthink = gpGlobals->time; m_lastTime = gpGlobals->time; } @@ -1426,7 +1426,7 @@ void CGibShooter::KeyValue( KeyValueData *pkvd ) void CGibShooter::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetThink( ShootThink ); + SetThink( &CGibShooter::ShootThink ); pev->nextthink = gpGlobals->time; } @@ -1516,7 +1516,7 @@ void CGibShooter :: ShootThink ( void ) } else { - SetThink ( SUB_Remove ); + SetThink ( &CGibShooter::SUB_Remove ); pev->nextthink = gpGlobals->time; } } @@ -1708,7 +1708,7 @@ void CTestEffect::TestThink( void ) void CTestEffect::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetThink( TestThink ); + SetThink( &CTestEffect::TestThink ); pev->nextthink = gpGlobals->time + 0.1; m_flStartTime = gpGlobals->time; } @@ -2129,7 +2129,7 @@ void CEnvFunnel::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us MESSAGE_END(); - SetThink( SUB_Remove ); + SetThink( &CEnvFunnel::SUB_Remove ); pev->nextthink = gpGlobals->time; } @@ -2228,7 +2228,7 @@ void CItemSoda::Spawn( void ) SET_MODEL ( ENT(pev), "models/can.mdl" ); UTIL_SetSize ( pev, Vector ( 0, 0, 0 ), Vector ( 0, 0, 0 ) ); - SetThink (CanThink); + SetThink (&CItemSoda::CanThink); pev->nextthink = gpGlobals->time + 0.5; } @@ -2239,7 +2239,7 @@ void CItemSoda::CanThink ( void ) pev->solid = SOLID_TRIGGER; UTIL_SetSize ( pev, Vector ( -8, -8, 0 ), Vector ( 8, 8, 8 ) ); SetThink ( NULL ); - SetTouch ( CanTouch ); + SetTouch ( &CItemSoda::CanTouch ); } void CItemSoda::CanTouch ( CBaseEntity *pOther ) @@ -2263,6 +2263,6 @@ void CItemSoda::CanTouch ( CBaseEntity *pOther ) pev->movetype = MOVETYPE_NONE; pev->effects = EF_NODRAW; SetTouch ( NULL ); - SetThink ( SUB_Remove ); + SetThink ( &CItemSoda::SUB_Remove ); pev->nextthink = gpGlobals->time; -} \ No newline at end of file +} diff --git a/dlls/effects.h b/dlls/effects.h index 1464d6a..3d18ae1 100644 --- a/dlls/effects.h +++ b/dlls/effects.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -79,7 +79,7 @@ public: inline void AnimateAndDie( float framerate ) { - SetThink(AnimateUntilDead); + SetThink(&CSprite::AnimateUntilDead); pev->framerate = framerate; pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate); pev->nextthink = gpGlobals->time; @@ -168,7 +168,7 @@ public: static CBeam *BeamCreate( const char *pSpriteName, int width ); - inline void LiveForTime( float time ) { SetThink(SUB_Remove); pev->nextthink = gpGlobals->time + time; } + inline void LiveForTime( float time ) { SetThink(&CBeam::SUB_Remove); pev->nextthink = gpGlobals->time + time; } inline void BeamDamageInstant( TraceResult *ptr, float damage ) { pev->dmg = damage; diff --git a/dlls/egon.cpp b/dlls/egon.cpp index 43cde79..46211c2 100644 --- a/dlls/egon.cpp +++ b/dlls/egon.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/enginecallback.h b/dlls/enginecallback.h index aad3724..0d8a817 100644 --- a/dlls/enginecallback.h +++ b/dlls/enginecallback.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -155,4 +155,4 @@ inline void *GET_PRIVATE( edict_t *pent ) #define PLAYER_CNX_STATS ( *g_engfuncs.pfnGetPlayerStats ) -#endif //ENGINECALLBACK_H \ No newline at end of file +#endif //ENGINECALLBACK_H diff --git a/dlls/explode.cpp b/dlls/explode.cpp index 55dcb1c..c884fa5 100644 --- a/dlls/explode.cpp +++ b/dlls/explode.cpp @@ -217,7 +217,7 @@ void CEnvExplosion::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE RadiusDamage ( pev, pev, m_iMagnitude, CLASS_NONE, DMG_BLAST ); } - SetThink( Smoke ); + SetThink( &CEnvExplosion::Smoke ); pev->nextthink = gpGlobals->time + 0.3; // draw sparks diff --git a/dlls/explode.h b/dlls/explode.h index 3d8c410..4ddeeb6 100644 --- a/dlls/explode.h +++ b/dlls/explode.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/extdll.h b/dlls/extdll.h index 31e4855..f39eba5 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -32,6 +32,8 @@ #pragma warning(disable : 4514) // unreferenced inline function removed #pragma warning(disable : 4100) // unreferenced formal parameter +#include "archtypes.h" // DAL + // Prevent tons of unused windows definitions #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -39,16 +41,19 @@ #define NOSERVICE #define NOMCX #define NOIME +#include "winsani_in.h" #include "windows.h" +#include "winsani_out.h" #else // _WIN32 #define FALSE 0 #define TRUE (!FALSE) -typedef unsigned long ULONG; +typedef uint32 ULONG; typedef unsigned char BYTE; typedef int BOOL; #define MAX_PATH PATH_MAX #include #include +#include // memset #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif @@ -64,8 +69,8 @@ typedef int BOOL; #include "math.h" // Header file containing definition of globalvars_t and entvars_t -typedef int func_t; // -typedef int string_t; // from engine's pr_comp.h; +typedef unsigned int func_t; // +typedef unsigned int string_t; // from engine's pr_comp.h; typedef float vec_t; // needed before including progdefs.h // Vector class diff --git a/dlls/flyingmonster.cpp b/dlls/flyingmonster.cpp index 9a0774f..544ddcc 100644 --- a/dlls/flyingmonster.cpp +++ b/dlls/flyingmonster.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/flyingmonster.h b/dlls/flyingmonster.h index 752f56e..5b6358b 100644 --- a/dlls/flyingmonster.h +++ b/dlls/flyingmonster.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index 096bde7..392f868 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -164,7 +164,7 @@ void CBreakable::Spawn( void ) SET_MODEL(ENT(pev), STRING(pev->model) );//set size and link into world. - SetTouch( BreakTouch ); + SetTouch( &CBreakable::BreakTouch ); if ( FBitSet( pev->spawnflags, SF_BREAK_TRIGGER_ONLY ) ) // Only break on trigger SetTouch( NULL ); @@ -459,7 +459,7 @@ void CBreakable::BreakTouch( CBaseEntity *pOther ) // play creaking sound here. DamageSound(); - SetThink ( Die ); + SetThink ( &CBreakable::Die ); SetTouch( NULL ); if ( m_flDelay == 0 ) @@ -743,7 +743,7 @@ void CBreakable::Die( void ) // Fire targets on break SUB_UseTargets( NULL, USE_TOGGLE, 0 ); - SetThink( SUB_Remove ); + SetThink( &CBreakable::SUB_Remove ); pev->nextthink = pev->ltime + 0.1; if ( m_iszSpawnObject ) CBaseEntity::Create( (char *)STRING(m_iszSpawnObject), VecBModelOrigin(pev), pev->angles, edict() ); diff --git a/dlls/func_break.h b/dlls/func_break.h index 2441f75..7591675 100644 --- a/dlls/func_break.h +++ b/dlls/func_break.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/func_tank.cpp b/dlls/func_tank.cpp index 459d21a..085db64 100644 --- a/dlls/func_tank.cpp +++ b/dlls/func_tank.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/game.cpp b/dlls/game.cpp index b4b6da7..f48b96a 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -39,6 +39,8 @@ cvar_t teamoverride = {"mp_teamoverride","1" }; cvar_t defaultteam = {"mp_defaultteam","0" }; cvar_t allowmonsters={"mp_allowmonsters","0", FCVAR_SERVER }; +cvar_t allow_spectators = { "allow_spectators", "0.0", FCVAR_SERVER }; // 0 prevents players from being spectators + cvar_t mp_chattime = {"mp_chattime","10", FCVAR_SERVER }; // Engine Cvars @@ -459,6 +461,7 @@ void GameDLLInit( void ) g_footsteps = CVAR_GET_POINTER( "mp_footsteps" ); CVAR_REGISTER (&displaysoundlist); + CVAR_REGISTER( &allow_spectators ); CVAR_REGISTER (&teamplay); CVAR_REGISTER (&fraglimit); diff --git a/dlls/game.h b/dlls/game.h index 7bd9dce..31f4e34 100644 --- a/dlls/game.h +++ b/dlls/game.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/gamerules.cpp b/dlls/gamerules.cpp index 34bb491..a9b4831 100644 --- a/dlls/gamerules.cpp +++ b/dlls/gamerules.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/gamerules.h b/dlls/gamerules.h index 2e85304..9d97f87 100644 --- a/dlls/gamerules.h +++ b/dlls/gamerules.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/gargantua.cpp b/dlls/gargantua.cpp index 1c23d43..55bf0d5 100644 --- a/dlls/gargantua.cpp +++ b/dlls/gargantua.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -161,7 +161,7 @@ void CStomp::Think( void ) pSprite->pev->velocity = Vector(RANDOM_FLOAT(-200,200),RANDOM_FLOAT(-200,200),175); // pSprite->AnimateAndDie( RANDOM_FLOAT( 8.0, 12.0 ) ); pSprite->pev->nextthink = gpGlobals->time + 0.3; - pSprite->SetThink( SUB_Remove ); + pSprite->SetThink( &CSprite::SUB_Remove ); pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast ); } } @@ -1126,7 +1126,7 @@ void CGargantua::RunTask( Task_t *pTask ) pev->rendercolor.z = 0; StopAnimation(); pev->nextthink = gpGlobals->time + 0.15; - SetThink( SUB_Remove ); + SetThink( &CGargantua::SUB_Remove ); int i; int parts = MODEL_FRAMES( gGargGibModel ); for ( i = 0; i < 10; i++ ) @@ -1145,7 +1145,7 @@ void CGargantua::RunTask( Task_t *pTask ) pGib->pev->origin = pev->origin; pGib->pev->velocity = UTIL_RandomBloodVector() * RANDOM_FLOAT( 300, 500 ); pGib->pev->nextthink = gpGlobals->time + 1.25; - pGib->SetThink( SUB_FadeOut ); + pGib->SetThink( &CGib::SUB_FadeOut ); } MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin ); WRITE_BYTE( TE_BREAKMODEL); @@ -1359,10 +1359,10 @@ void SpawnExplosion( Vector center, float randomRange, float time, int magnitude pExplosion->pev->spawnflags |= SF_ENVEXPLOSION_NODAMAGE; pExplosion->Spawn(); - pExplosion->SetThink( CBaseEntity::SUB_CallUseToggle ); + pExplosion->SetThink( &CBaseEntity::SUB_CallUseToggle ); pExplosion->pev->nextthink = gpGlobals->time + time; } -#endif \ No newline at end of file +#endif diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index d89a41c..d993aba 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -147,7 +147,7 @@ void CGauss::PrimaryAttack() if ( m_pPlayer->pev->waterlevel == 3 ) { PlayEmptySound( ); - m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; + m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.15); return; } @@ -185,7 +185,7 @@ void CGauss::SecondaryAttack() PlayEmptySound( ); } - m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5); return; } diff --git a/dlls/genericmonster.cpp b/dlls/genericmonster.cpp index 8f40be6..1d38eea 100644 --- a/dlls/genericmonster.cpp +++ b/dlls/genericmonster.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/ggrenade.cpp b/dlls/ggrenade.cpp index bed9129..390b8b1 100644 --- a/dlls/ggrenade.cpp +++ b/dlls/ggrenade.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -113,7 +113,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) } pev->effects |= EF_NODRAW; - SetThink( Smoke ); + SetThink( &CGrenade::Smoke ); pev->velocity = g_vecZero; pev->nextthink = gpGlobals->time + 0.3; @@ -156,7 +156,7 @@ void CGrenade::Killed( entvars_t *pevAttacker, int iGib ) // Timed grenade, this think is called when time runs out. void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetThink( Detonate ); + SetThink( &CGrenade::Detonate ); pev->nextthink = gpGlobals->time; } @@ -164,7 +164,7 @@ void CGrenade::PreDetonate( void ) { CSoundEnt::InsertSound ( bits_SOUND_DANGER, pev->origin, 400, 0.3 ); - SetThink( Detonate ); + SetThink( &CGrenade::Detonate ); pev->nextthink = gpGlobals->time + 1; } @@ -331,7 +331,7 @@ void CGrenade :: TumbleThink( void ) if (pev->dmgtime <= gpGlobals->time) { - SetThink( Detonate ); + SetThink( &CGrenade::Detonate ); } if (pev->waterlevel != 0) { @@ -368,14 +368,14 @@ CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector v pGrenade->pev->owner = ENT(pevOwner); // make monsters afaid of it while in the air - pGrenade->SetThink( DangerSoundThink ); + pGrenade->SetThink( &CGrenade::DangerSoundThink ); pGrenade->pev->nextthink = gpGlobals->time; // Tumble in air pGrenade->pev->avelocity.x = RANDOM_FLOAT ( -100, -500 ); // Explode on contact - pGrenade->SetTouch( ExplodeTouch ); + pGrenade->SetTouch( &CGrenade::ExplodeTouch ); pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade; @@ -392,14 +392,14 @@ CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector v pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity); pGrenade->pev->owner = ENT(pevOwner); - pGrenade->SetTouch( BounceTouch ); // Bounce if touched + pGrenade->SetTouch( &CGrenade::BounceTouch ); // Bounce if touched // Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate // will insert a DANGER sound into the world sound list and delay detonation for one second so that // the grenade explodes after the exact amount of time specified in the call to ShootTimed(). pGrenade->pev->dmgtime = gpGlobals->time + time; - pGrenade->SetThink( TumbleThink ); + pGrenade->SetThink( &CGrenade::TumbleThink ); pGrenade->pev->nextthink = gpGlobals->time + 0.1; if (time < 0.1) { @@ -442,9 +442,9 @@ CGrenade * CGrenade :: ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, pGrenade->pev->owner = ENT(pevOwner); // Detonate in "time" seconds - pGrenade->SetThink( SUB_DoNothing ); - pGrenade->SetUse( DetonateUse ); - pGrenade->SetTouch( SlideTouch ); + pGrenade->SetThink( &CGrenade::SUB_DoNothing ); + pGrenade->SetUse( &CGrenade::DetonateUse ); + pGrenade->SetTouch( &CGrenade::SlideTouch ); pGrenade->pev->spawnflags = SF_DETONATE; pGrenade->pev->friction = 0.9; diff --git a/dlls/globals.cpp b/dlls/globals.cpp index be31ef9..2cfa7f3 100644 --- a/dlls/globals.cpp +++ b/dlls/globals.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/glock.cpp b/dlls/glock.cpp index b0a04b9..cbf5c50 100644 --- a/dlls/glock.cpp +++ b/dlls/glock.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/gman.cpp b/dlls/gman.cpp index 77a1bd8..ca13e58 100644 --- a/dlls/gman.cpp +++ b/dlls/gman.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/h_ai.cpp b/dlls/h_ai.cpp index f24a988..edd03a0 100644 --- a/dlls/h_ai.cpp +++ b/dlls/h_ai.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/h_battery.cpp b/dlls/h_battery.cpp index 3f2a9a2..db822de 100644 --- a/dlls/h_battery.cpp +++ b/dlls/h_battery.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -129,7 +129,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use } pev->nextthink = pev->ltime + 0.25; - SetThink(Off); + SetThink(&CRecharge::Off); // Time to recharge yet? @@ -179,7 +179,7 @@ void CRecharge::Recharge(void) { m_iJuice = gSkillData.suitchargerCapacity; pev->frame = 0; - SetThink( SUB_DoNothing ); + SetThink( &CRecharge::SUB_DoNothing ); } void CRecharge::Off(void) @@ -193,8 +193,8 @@ void CRecharge::Off(void) if ((!m_iJuice) && ( ( m_iReactivate = g_pGameRules->FlHEVChargerRechargeTime() ) > 0) ) { pev->nextthink = pev->ltime + m_iReactivate; - SetThink(Recharge); + SetThink(&CRecharge::Recharge); } else - SetThink( SUB_DoNothing ); -} \ No newline at end of file + SetThink( &CRecharge::SUB_DoNothing ); +} diff --git a/dlls/h_cine.cpp b/dlls/h_cine.cpp index 7f68192..7b6547f 100644 --- a/dlls/h_cine.cpp +++ b/dlls/h_cine.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -124,7 +124,7 @@ void CLegacyCineMonster :: CineSpawn( char *szModel ) // if no targetname, start now if ( FStringNull(pev->targetname) ) { - SetThink( CineThink ); + SetThink( &CLegacyCineMonster::CineThink ); pev->nextthink += 1.0; } } @@ -136,7 +136,7 @@ void CLegacyCineMonster :: CineSpawn( char *szModel ) void CLegacyCineMonster :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { pev->animtime = 0; // reset the sequence - SetThink( CineThink ); + SetThink( &CLegacyCineMonster::CineThink ); pev->nextthink = gpGlobals->time; } @@ -145,7 +145,7 @@ void CLegacyCineMonster :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, U // void CLegacyCineMonster :: Die( void ) { - SetThink( SUB_Remove ); + SetThink( &CLegacyCineMonster::SUB_Remove ); } // @@ -228,14 +228,14 @@ void CCineBlood :: BloodGush ( void ) void CCineBlood :: BloodStart ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetThink( BloodGush ); + SetThink( &CCineBlood::BloodGush ); pev->nextthink = gpGlobals->time;// now! } void CCineBlood :: Spawn ( void ) { pev->solid = SOLID_NOT; - SetUse ( BloodStart ); + SetUse ( &CCineBlood::BloodStart ); pev->health = 20;//hacked health to count iterations } diff --git a/dlls/h_cycler.cpp b/dlls/h_cycler.cpp index a306359..50f61a2 100644 --- a/dlls/h_cycler.cpp +++ b/dlls/h_cycler.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -334,7 +334,7 @@ void CWeaponCycler::Spawn( ) UTIL_SetOrigin( pev, pev->origin ); UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 16)); - SetTouch( DefaultTouch ); + SetTouch( &CWeaponCycler::DefaultTouch ); } diff --git a/dlls/h_export.cpp b/dlls/h_export.cpp index 96a57fd..e6f0015 100644 --- a/dlls/h_export.cpp +++ b/dlls/h_export.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -29,6 +29,12 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; +#undef DLLEXPORT +#ifdef _WIN32 +#define DLLEXPORT __stdcall +#else +#define DLLEXPORT __attribute__ ((visibility("default"))) +#endif #ifdef _WIN32 @@ -46,24 +52,12 @@ BOOL WINAPI DllMain( } return TRUE; } - -void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) -{ - memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); - gpGlobals = pGlobals; -} - - -#else - -extern "C" { - -void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) -{ - memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); - gpGlobals = pGlobals; -} - -} - #endif + +extern "C" void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) +{ + memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); + gpGlobals = pGlobals; +} + + diff --git a/dlls/handgrenade.cpp b/dlls/handgrenade.cpp index 007ad66..9baa5b3 100644 --- a/dlls/handgrenade.cpp +++ b/dlls/handgrenade.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -103,7 +103,7 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ ) { // no more grenades! m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; } @@ -175,7 +175,7 @@ void CHandGrenade::WeaponIdle( void ) m_flReleaseThrow = 0; m_flStartThrow = 0; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextPrimaryAttack = GetNextAttackDelay(0.5); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ]--; @@ -185,7 +185,7 @@ void CHandGrenade::WeaponIdle( void ) // just threw last grenade // set attack times in the future, and weapon idle in the future so we can see the whole throw // animation, weapon idle will automatically retire the weapon for us. - m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;// ensure that the animation can finish playing + m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay(0.5);// ensure that the animation can finish playing } return; } diff --git a/dlls/hassassin.cpp b/dlls/hassassin.cpp index da8f677..8cfe288 100644 --- a/dlls/hassassin.cpp +++ b/dlls/hassassin.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/headcrab.cpp b/dlls/headcrab.cpp index 9adc877..116532a 100644 --- a/dlls/headcrab.cpp +++ b/dlls/headcrab.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -385,7 +385,7 @@ void CHeadCrab :: StartTask ( Task_t *pTask ) { EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pAttackSounds[0], GetSoundVolue(), ATTN_IDLE, 0, GetVoicePitch() ); m_IdealActivity = ACT_RANGE_ATTACK1; - SetTouch ( LeapTouch ); + SetTouch ( &CHeadCrab::LeapTouch ); break; } default: diff --git a/dlls/healthkit.cpp b/dlls/healthkit.cpp index 73931f2..779c418 100644 --- a/dlls/healthkit.cpp +++ b/dlls/healthkit.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -207,7 +207,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u } pev->nextthink = pev->ltime + 0.25; - SetThink(Off); + SetThink(&CWallHealth::Off); // Time to recharge yet? @@ -243,7 +243,7 @@ void CWallHealth::Recharge(void) EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM ); m_iJuice = gSkillData.healthchargerCapacity; pev->frame = 0; - SetThink( SUB_DoNothing ); + SetThink( &CWallHealth::SUB_DoNothing ); } void CWallHealth::Off(void) @@ -257,8 +257,8 @@ void CWallHealth::Off(void) if ((!m_iJuice) && ( ( m_iReactivate = g_pGameRules->FlHealthChargerRechargeTime() ) > 0) ) { pev->nextthink = pev->ltime + m_iReactivate; - SetThink(Recharge); + SetThink(&CWallHealth::Recharge); } else - SetThink( SUB_DoNothing ); -} \ No newline at end of file + SetThink( &CWallHealth::SUB_DoNothing ); +} diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 0d2ca6c..68711b0 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -2393,7 +2393,7 @@ void CHGruntRepel::Spawn( void ) Precache( ); pev->solid = SOLID_NOT; - SetUse( RepelUse ); + SetUse( &CHGruntRepel::RepelUse ); } void CHGruntRepel::Precache( void ) @@ -2423,7 +2423,7 @@ void CHGruntRepel::RepelUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE pBeam->PointEntInit( pev->origin + Vector(0,0,112), pGrunt->entindex() ); pBeam->SetFlags( BEAM_FSOLID ); pBeam->SetColor( 255, 255, 255 ); - pBeam->SetThink( SUB_Remove ); + pBeam->SetThink( &CBeam::SUB_Remove ); pBeam->pev->nextthink = gpGlobals->time + -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5; UTIL_Remove( this ); diff --git a/dlls/hl.dsp b/dlls/hl.dsp index 2e4882b..d744580 100644 --- a/dlls/hl.dsp +++ b/dlls/hl.dsp @@ -19,13 +19,10 @@ CFG=hl - Win32 Release !MESSAGE !MESSAGE "hl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "hl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "hl - Win32 Profile" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -41,9 +38,10 @@ RSC=rc.exe # PROP Use_Debug_Libraries 0 # PROP Output_Dir ".\Releasehl" # PROP Intermediate_Dir ".\Releasehl" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /G5 /MT /W3 /Zi /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /Fr /YX /FD /c +# ADD CPP /nologo /G5 /MT /W3 /GR /Zi /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /I "..\public" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /Fr /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -55,6 +53,24 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /def:".\hl.def" # SUBTRACT LINK32 /profile +# Begin Custom Build +InputDir=.\Releasehl +ProjDir=. +InputPath=.\Releasehl\hl.dll +InputName=hl +SOURCE="$(InputPath)" + +BuildCmds= \ + call ..\filecopy.bat $(InputPath) $(ProjDir)\..\..\game\mod\dlls\$(InputName).dll \ + call ..\filecopy.bat $(InputDir)\$(InputName).pdb $(ProjDir)\..\..\game\mod\dlls\$(InputName).pdb \ + + +"$(ProjDir)\..\..\game\mod\dlls\$(InputName).dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\..\..\game\mod\dlls\$(InputName).pdb" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build !ELSEIF "$(CFG)" == "hl - Win32 Debug" @@ -70,7 +86,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /G5 /MTd /W3 /Gm /ZI /Od /I "..\dlls" /I "..\engine" /I "..\common" /I "..\game_shared" /I "..\pm_shared" /I "..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c +# ADD CPP /nologo /G5 /MTd /W3 /Gm /ZI /Od /I "..\\" /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /I "..\public" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -82,34 +98,16 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 # ADD LINK32 user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /def:".\hl.def" /implib:".\Debug\hl.lib" # SUBTRACT LINK32 /profile +# Begin Custom Build +ProjDir=. +InputPath=.\debughl\hl.dll +InputName=hl +SOURCE="$(InputPath)" -!ELSEIF "$(CFG)" == "hl - Win32 Profile" +"$(ProjDir)\..\..\game\mod\dlls\$(InputName).dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + call ..\filecopy.bat $(InputPath) $(ProjDir)\..\..\game\mod\dlls\$(InputName).dll -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\hl___Win" -# PROP BASE Intermediate_Dir ".\hl___Win" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\Profilehl" -# PROP Intermediate_Dir ".\Profilehl" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /I "..\engine" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /YX /c -# SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /G5 /MT /W3 /Zi /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /def:".\hl.def" -# SUBTRACT BASE LINK32 /profile -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /profile /debug /machine:I386 /def:".\hl.def" +# End Custom Build !ENDIF @@ -117,413 +115,1334 @@ LINK32=link.exe # Name "hl - Win32 Release" # Name "hl - Win32 Debug" -# Name "hl - Win32 Profile" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" # Begin Source File SOURCE=.\aflock.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\agrunt.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\airtank.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\animating.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\animation.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\apache.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\barnacle.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\barney.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\bigmomma.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\bloater.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\bmodels.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\bullsquid.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\buttons.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\cbase.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\client.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\combat.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\controller.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\crossbow.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\crowbar.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\defaultai.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\doors.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\effects.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\egon.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\explode.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\flyingmonster.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\func_break.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\func_tank.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\game.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\gamerules.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\gargantua.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\gauss.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\genericmonster.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\ggrenade.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\globals.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\gman.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\h_ai.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\h_battery.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\h_cine.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\h_cycler.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\h_export.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\handgrenade.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\hassassin.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\headcrab.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\healthkit.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\hgrunt.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\wpn_shared\hl_wpn_glock.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\hornet.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\hornetgun.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\houndeye.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\ichthyosaur.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\islave.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\items.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\leech.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\lights.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\maprules.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\monstermaker.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\monsters.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\monsterstate.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\mortar.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\mp5.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\multiplay_gamerules.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\nihilanth.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\nodes.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\observer.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\osprey.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\pathcorner.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\plane.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\plats.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\player.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=..\pm_shared\pm_debug.c + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=..\pm_shared\pm_math.c + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=..\pm_shared\pm_shared.c + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\python.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\rat.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\roach.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\rpg.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\satchel.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\schedule.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\scientist.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\scripted.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\shotgun.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\singleplay_gamerules.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\skill.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\sound.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\soundent.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\spectator.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\squadmonster.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\squeakgrenade.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\subs.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\talkmonster.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\teamplay_gamerules.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\tempmonster.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\tentacle.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\triggers.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\tripmine.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\turret.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\util.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=..\game_shared\voice_gamemgr.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\weapons.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\world.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\xen.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # Begin Source File SOURCE=.\zombie.cpp + +!IF "$(CFG)" == "hl - Win32 Release" + +!ELSEIF "$(CFG)" == "hl - Win32 Debug" + +# ADD CPP /GR + +!ENDIF + # End Source File # End Group # Begin Group "Header Files" diff --git a/dlls/hornet.cpp b/dlls/hornet.cpp index 288a7db..fd5ecaf 100644 --- a/dlls/hornet.cpp +++ b/dlls/hornet.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -93,8 +93,8 @@ void CHornet :: Spawn( void ) SET_MODEL(ENT( pev ), "models/hornet.mdl"); UTIL_SetSize( pev, Vector( -4, -4, -4 ), Vector( 4, 4, 4 ) ); - SetTouch( DieTouch ); - SetThink( StartTrack ); + SetTouch( &CHornet::DieTouch ); + SetThink( &CHornet::StartTrack ); edict_t *pSoundEnt = pev->owner; if ( !pSoundEnt ) @@ -169,8 +169,8 @@ void CHornet :: StartTrack ( void ) { IgniteTrail(); - SetTouch( TrackTouch ); - SetThink( TrackTarget ); + SetTouch( &CHornet::TrackTouch ); + SetThink( &CHornet::TrackTarget ); pev->nextthink = gpGlobals->time + 0.1; } @@ -182,9 +182,9 @@ void CHornet :: StartDart ( void ) { IgniteTrail(); - SetTouch( DartTouch ); + SetTouch( &CHornet::DartTouch ); - SetThink( SUB_Remove ); + SetThink( &CHornet::SUB_Remove ); pev->nextthink = gpGlobals->time + 4; } @@ -257,7 +257,7 @@ void CHornet :: TrackTarget ( void ) if (gpGlobals->time > m_flStopAttack) { SetTouch( NULL ); - SetThink( SUB_Remove ); + SetThink( &CHornet::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; return; } @@ -413,7 +413,7 @@ void CHornet::DieTouch ( CBaseEntity *pOther ) pev->modelindex = 0;// so will disappear for the 0.1 secs we wait until NEXTTHINK gets rid pev->solid = SOLID_NOT; - SetThink ( SUB_Remove ); + SetThink ( &CHornet::SUB_Remove ); pev->nextthink = gpGlobals->time + 1;// stick around long enough for the sound to finish! } diff --git a/dlls/hornet.h b/dlls/hornet.h index f069c3d..c0eee3a 100644 --- a/dlls/hornet.h +++ b/dlls/hornet.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/hornetgun.cpp b/dlls/hornetgun.cpp index 76b4889..d9caabc 100644 --- a/dlls/hornetgun.cpp +++ b/dlls/hornetgun.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -167,7 +167,7 @@ void CHgun::PrimaryAttack() // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.25; + m_flNextPrimaryAttack = GetNextAttackDelay(0.25); if (m_flNextPrimaryAttack < UTIL_WeaponTimeBase() ) { @@ -235,7 +235,7 @@ void CHgun::SecondaryAttack( void ) pHornet->pev->velocity = gpGlobals->v_forward * 1200; pHornet->pev->angles = UTIL_VecToAngles( pHornet->pev->velocity ); - pHornet->SetThink( CHornet::StartDart ); + pHornet->SetThink( &CHornet::StartDart ); m_flRechargeTime = gpGlobals->time + 0.5; #endif @@ -302,4 +302,4 @@ void CHgun::WeaponIdle( void ) SendWeaponAnim( iAnim ); } -#endif \ No newline at end of file +#endif diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index e8bfacf..71f8301 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -97,7 +97,7 @@ public: BOOL FValidateHintType ( short sHint ); BOOL FCanActiveIdle ( void ); Schedule_t *GetScheduleOfType ( int Type ); - Schedule_t *CHoundeye :: GetSchedule( void ); + Schedule_t *GetSchedule( void ); int Save( CSave &save ); int Restore( CRestore &restore ); diff --git a/dlls/ichthyosaur.cpp b/dlls/ichthyosaur.cpp index b88abf1..c6ea201 100644 --- a/dlls/ichthyosaur.cpp +++ b/dlls/ichthyosaur.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -494,8 +494,8 @@ void CIchthyosaur :: Spawn() MonsterInit(); - SetTouch( BiteTouch ); - SetUse( CombatUse ); + SetTouch( &CIchthyosaur::BiteTouch ); + SetUse( &CIchthyosaur::CombatUse ); m_idealDist = 384; m_flMinSpeed = 80; @@ -1105,4 +1105,4 @@ Vector CIchthyosaur::DoProbe(const Vector &Probe) return Vector(0, 0, 0); } -#endif \ No newline at end of file +#endif diff --git a/dlls/islave.cpp b/dlls/islave.cpp index 037001c..a56e8be 100644 --- a/dlls/islave.cpp +++ b/dlls/islave.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/items.cpp b/dlls/items.cpp index 449be85..a012458 100644 --- a/dlls/items.cpp +++ b/dlls/items.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -93,7 +93,7 @@ void CItem::Spawn( void ) pev->solid = SOLID_TRIGGER; UTIL_SetOrigin( pev, pev->origin ); UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 16)); - SetTouch(ItemTouch); + SetTouch(&CItem::ItemTouch); if (DROP_TO_FLOOR(ENT(pev)) == 0) { @@ -151,7 +151,7 @@ CBaseEntity* CItem::Respawn( void ) UTIL_SetOrigin( pev, g_pGameRules->VecItemRespawnSpot( this ) );// blip to whereever you should respawn. - SetThink ( Materialize ); + SetThink ( &CItem::Materialize ); pev->nextthink = g_pGameRules->FlItemRespawnTime( this ); return this; } @@ -166,7 +166,7 @@ void CItem::Materialize( void ) pev->effects |= EF_MUZZLEFLASH; } - SetTouch( ItemTouch ); + SetTouch( &CItem::ItemTouch ); } #define SF_SUIT_SHORTLOGON 0x0001 diff --git a/dlls/items.h b/dlls/items.h index 04905fc..dbfbe5f 100644 --- a/dlls/items.h +++ b/dlls/items.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/leech.cpp b/dlls/leech.cpp index 4f1ebc9..7ec6271 100644 --- a/dlls/leech.cpp +++ b/dlls/leech.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -196,7 +196,7 @@ void CLeech::Spawn( void ) m_flFieldOfView = -0.5; // 180 degree FOV m_flDistLook = 750; MonsterInit(); - SetThink( SwimThink ); + SetThink( &CLeech::SwimThink ); SetUse( NULL ); SetTouch( NULL ); pev->view_ofs = g_vecZero; @@ -717,7 +717,7 @@ void CLeech::Killed(entvars_t *pevAttacker, int iGib) pev->movetype = MOVETYPE_TOSS; pev->takedamage = DAMAGE_NO; - SetThink( DeadThink ); + SetThink( &CLeech::DeadThink ); } diff --git a/dlls/lights.cpp b/dlls/lights.cpp index 147dfdf..c24755b 100644 --- a/dlls/lights.cpp +++ b/dlls/lights.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/maprules.cpp b/dlls/maprules.cpp index 9402f31..f5f7f69 100644 --- a/dlls/maprules.cpp +++ b/dlls/maprules.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/maprules.h b/dlls/maprules.h index 975dafa..1591a03 100644 --- a/dlls/maprules.h +++ b/dlls/maprules.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/monsterevent.h b/dlls/monsterevent.h index 58357e1..ee2d634 100644 --- a/dlls/monsterevent.h +++ b/dlls/monsterevent.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/monstermaker.cpp b/dlls/monstermaker.cpp index 1b4b62a..c5c6f80 100644 --- a/dlls/monstermaker.cpp +++ b/dlls/monstermaker.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -111,29 +111,29 @@ void CMonsterMaker :: Spawn( ) { if ( pev->spawnflags & SF_MONSTERMAKER_CYCLIC ) { - SetUse ( CyclicUse );// drop one monster each time we fire + SetUse ( &CMonsterMaker::CyclicUse );// drop one monster each time we fire } else { - SetUse ( ToggleUse );// so can be turned on/off + SetUse ( &CMonsterMaker::ToggleUse );// so can be turned on/off } if ( FBitSet ( pev->spawnflags, SF_MONSTERMAKER_START_ON ) ) {// start making monsters as soon as monstermaker spawns m_fActive = TRUE; - SetThink ( MakerThink ); + SetThink ( &CMonsterMaker::MakerThink ); } else {// wait to be activated. m_fActive = FALSE; - SetThink ( SUB_DoNothing ); + SetThink ( &CMonsterMaker::SUB_DoNothing ); } } else {// no targetname, just start. pev->nextthink = gpGlobals->time + m_flDelay; m_fActive = TRUE; - SetThink ( MakerThink ); + SetThink ( &CMonsterMaker::MakerThink ); } if ( m_cNumMonsters == 1 ) @@ -259,7 +259,7 @@ void CMonsterMaker :: ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, else { m_fActive = TRUE; - SetThink ( MakerThink ); + SetThink ( &CMonsterMaker::MakerThink ); } pev->nextthink = gpGlobals->time; diff --git a/dlls/monsters.cpp b/dlls/monsters.cpp index e9e9443..c381c1f 100644 --- a/dlls/monsters.cpp +++ b/dlls/monsters.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -2044,9 +2044,9 @@ void CBaseMonster :: MonsterInit ( void ) // set eye position SetEyePosition(); - SetThink( MonsterInitThink ); + SetThink( &CBaseMonster::MonsterInitThink ); pev->nextthink = gpGlobals->time + 0.1; - SetUse ( MonsterUse ); + SetUse ( &CBaseMonster::MonsterUse ); } //========================================================= @@ -2146,7 +2146,7 @@ void CBaseMonster :: StartMonster ( void ) // Delay drop to floor to make sure each door in the level has had its chance to spawn // Spread think times so that they don't all happen at the same time (Carmack) - SetThink ( CallMonsterThink ); + SetThink ( &CBaseMonster::CallMonsterThink ); pev->nextthink += RANDOM_FLOAT(0.1, 0.4); // spread think times. if ( !FStringNull(pev->targetname) )// wait until triggered @@ -3289,7 +3289,7 @@ void CBaseMonster :: MonsterInitDead( void ) // Setup health counters, etc. BecomeDead(); - SetThink( CorpseFallThink ); + SetThink( &CBaseMonster::CorpseFallThink ); pev->nextthink = gpGlobals->time + 0.5; } diff --git a/dlls/monsters.h b/dlls/monsters.h index 75c945f..f107510 100644 --- a/dlls/monsters.h +++ b/dlls/monsters.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/monsterstate.cpp b/dlls/monsterstate.cpp index aca95b3..12a0b19 100644 --- a/dlls/monsterstate.cpp +++ b/dlls/monsterstate.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/mortar.cpp b/dlls/mortar.cpp index e23d7b6..34b1836 100644 --- a/dlls/mortar.cpp +++ b/dlls/mortar.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -105,7 +105,7 @@ void CFuncMortarField :: Spawn( void ) SET_MODEL(ENT(pev), STRING(pev->model)); // set size and link into world pev->movetype = MOVETYPE_NONE; SetBits( pev->effects, EF_NODRAW ); - SetUse( FieldUse ); + SetUse( & CFuncMortarField::FieldUse ); Precache(); } @@ -209,7 +209,7 @@ void CMortar::Spawn( ) pev->dmg = 200; - SetThink( MortarExplode ); + SetThink( &CMortar::MortarExplode ); pev->nextthink = 0; Precache( ); @@ -300,7 +300,7 @@ void CMortar::MortarExplode( void ) } */ - SetThink( SUB_Remove ); + SetThink( &CMortar::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; #endif @@ -320,4 +320,4 @@ void CMortar::ShootTimed( EVARS *pevOwner, Vector vecStart, float time ) UTIL_SetOrigin( pMortar->pev, tr.vecEndPos ); } -#endif \ No newline at end of file +#endif diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index 8ee2ce8..6328336 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -185,7 +185,7 @@ void CMP5::PrimaryAttack() // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; + m_flNextPrimaryAttack = GetNextAttackDelay(0.1); if ( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() ) m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; @@ -238,7 +238,7 @@ void CMP5::SecondaryAttack( void ) PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 ); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1; + m_flNextPrimaryAttack = GetNextAttackDelay(1); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting. diff --git a/dlls/mpstubb.cpp b/dlls/mpstubb.cpp index 673c51b..f31eb4f 100644 --- a/dlls/mpstubb.cpp +++ b/dlls/mpstubb.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 2e2cab7..477e2c3 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -28,6 +28,10 @@ #include "voice_gamemgr.h" #include "hltv.h" +#if !defined ( _WIN32 ) +#include +#endif + extern DLL_GLOBAL CGameRules *g_pGameRules; extern DLL_GLOBAL BOOL g_fGameOver; extern int gmsgDeathMsg; // client dll messages @@ -86,17 +90,7 @@ CHalfLifeMultiplay :: CHalfLifeMultiplay() // share a single config file. (sjb) if ( IS_DEDICATED_SERVER() ) { - // dedicated server - char *servercfgfile = (char *)CVAR_GET_STRING( "servercfgfile" ); - - if ( servercfgfile && servercfgfile[0] ) - { - char szCommand[256]; - - ALERT( at_console, "Executing dedicated server config file\n" ); - sprintf( szCommand, "exec %s\n", servercfgfile ); - SERVER_COMMAND( szCommand ); - } + // this code has been moved into engine, to only run server.cfg once } else { diff --git a/dlls/nihilanth.cpp b/dlls/nihilanth.cpp index 061c9a5..c99013d 100644 --- a/dlls/nihilanth.cpp +++ b/dlls/nihilanth.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -300,7 +300,7 @@ void CNihilanth :: Spawn( void ) InitBoneControllers(); - SetThink( StartupThink ); + SetThink( &CNihilanth::StartupThink ); pev->nextthink = gpGlobals->time + 0.1; m_vecDesired = Vector( 1, 0, 0 ); @@ -378,9 +378,9 @@ void CNihilanth::NullThink( void ) void CNihilanth::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - SetThink( HuntThink ); + SetThink( &CNihilanth::HuntThink ); pev->nextthink = gpGlobals->time + 0.1; - SetUse( CommandUse ); + SetUse( &CNihilanth::CommandUse ); } @@ -410,8 +410,8 @@ void CNihilanth::StartupThink( void ) } m_hRecharger = NULL; - SetThink( HuntThink); - SetUse( CommandUse ); + SetThink( &CNihilanth::HuntThink); + SetUse( &CNihilanth::CommandUse ); pev->nextthink = gpGlobals->time + 0.1; } @@ -846,7 +846,7 @@ void CNihilanth :: HuntThink( void ) // if dead, force cancelation of current animation if (pev->health <= 0) { - SetThink( DyingThink ); + SetThink( &CNihilanth::DyingThink ); m_fSequenceFinished = TRUE; return; } @@ -1019,7 +1019,8 @@ BOOL CNihilanth :: EmitSphere( void ) void CNihilanth :: TargetSphere( USE_TYPE useType, float value ) { CBaseMonster *pSphere; - for (int i = 0; i < N_SPHERES; i++) + int i; + for (i = 0; i < N_SPHERES; i++) { if (m_hSphere[i] != NULL) { @@ -1196,9 +1197,24 @@ void CNihilanth::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ { case USE_OFF: { - CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, m_szDeadTouch ); - if ( pTouch && m_hEnemy != NULL ) - pTouch->Touch( m_hEnemy ); + CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, m_szDeadTouch ); + + if ( pTouch ) + { + if ( m_hEnemy != NULL ) + { + pTouch->Touch( m_hEnemy ); + } + // if the player is using "notarget", the ending sequence won't fire unless we catch it here + else + { + CBaseEntity *pEntity = UTIL_FindEntityByClassname( NULL, "player" ); + if ( pEntity != NULL && pEntity->IsAlive() ) + { + pTouch->Touch( pEntity ); + } + } + } } break; case USE_ON: @@ -1330,8 +1346,8 @@ void CNihilanthHVR :: CircleInit( CBaseEntity *pTarget ) UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0)); UTIL_SetOrigin( pev, pev->origin ); - SetThink( HoverThink ); - SetTouch( BounceTouch ); + SetThink( &CNihilanthHVR::HoverThink ); + SetTouch( &CNihilanthHVR::BounceTouch ); pev->nextthink = gpGlobals->time + 0.1; m_hTargetEnt = pTarget; @@ -1433,8 +1449,8 @@ void CNihilanthHVR :: ZapInit( CBaseEntity *pEnemy ) pev->velocity = (pEnemy->pev->origin - pev->origin).Normalize() * 200; m_hEnemy = pEnemy; - SetThink( ZapThink ); - SetTouch( ZapTouch ); + SetThink( &CNihilanthHVR::ZapThink ); + SetTouch( &CNihilanthHVR::ZapTouch ); pev->nextthink = gpGlobals->time + 0.1; EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 ); @@ -1559,8 +1575,8 @@ void CNihilanthHVR :: TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBa m_hTargetEnt = pTarget; m_hTouch = pTouch; - SetThink( TeleportThink ); - SetTouch( TeleportTouch ); + SetThink( &CNihilanthHVR::TeleportThink ); + SetTouch( &CNihilanthHVR::TeleportTouch ); pev->nextthink = gpGlobals->time + 0.1; EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "x/x_teleattack1.wav", 1, 0.2, 0, 100 ); @@ -1579,7 +1595,7 @@ void CNihilanthHVR :: GreenBallInit( ) SET_MODEL(edict(), "sprites/exit1.spr"); - SetTouch( RemoveTouch ); + SetTouch( &CNihilanthHVR::RemoveTouch ); } @@ -1631,7 +1647,7 @@ void CNihilanthHVR :: TeleportThink( void ) void CNihilanthHVR :: AbsorbInit( void ) { - SetThink( DissipateThink ); + SetThink( &CNihilanthHVR::DissipateThink ); pev->renderamt = 255; MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); @@ -1833,4 +1849,4 @@ void CNihilanthHVR::BounceTouch( CBaseEntity *pOther ) -#endif \ No newline at end of file +#endif diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index 6b01750..511e2f9 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -24,6 +24,13 @@ #include "animation.h" #include "doors.h" +#if !defined ( _WIN32 ) +#include +#include +#include +#include // mkdir +#endif + #define HULL_STEP_SIZE 16// how far the test hull moves on each step #define NODE_HEIGHT 8 // how high to lift nodes off the ground after we drop them all (make stair/ramp mapping easier) @@ -40,7 +47,7 @@ CGraph WorldGraph; LINK_ENTITY_TO_CLASS( info_node, CNodeEnt ); LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt ); -#ifdef __linux__ +#ifdef _LINUX #include #define CreateDirectory(p, n) mkdir(p, 0777) #endif @@ -655,7 +662,8 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull, // Mark all the nodes as unvisited. // - for ( int i = 0; i < m_cNodes; i++) + int i; + for ( i = 0; i < m_cNodes; i++) { m_pNodes[ i ].m_flClosestSoFar = -1.0; } @@ -1458,12 +1466,12 @@ void CTestHull :: Spawn( entvars_t *pevMasterNode ) if ( WorldGraph.m_fGraphPresent ) {// graph loaded from disk, so we don't need the test hull - SetThink ( SUB_Remove ); + SetThink ( &CTestHull::SUB_Remove ); pev->nextthink = gpGlobals->time; } else { - SetThink ( DropDelay ); + SetThink ( &CTestHull::DropDelay ); pev->nextthink = gpGlobals->time + 1; } @@ -1479,11 +1487,11 @@ void CTestHull :: Spawn( entvars_t *pevMasterNode ) //========================================================= void CTestHull::DropDelay ( void ) { - UTIL_CenterPrintAll( "Node Graph out of Date. Rebuilding..." ); +// UTIL_CenterPrintAll( "Node Graph out of Date. Rebuilding..." ); UTIL_SetOrigin ( VARS(pev), WorldGraph.m_pNodes[ 0 ].m_vecOrigin ); - SetThink ( CallBuildNodeGraph ); + SetThink ( &CTestHull::CallBuildNodeGraph ); pev->nextthink = gpGlobals->time + 1; } @@ -1631,7 +1639,7 @@ void CTestHull :: BuildNodeGraph( void ) float flDist; int step; - SetThink ( SUB_Remove );// no matter what happens, the hull gets rid of itself. + SetThink ( &CTestHull::SUB_Remove );// no matter what happens, the hull gets rid of itself. pev->nextthink = gpGlobals->time; // malloc a swollen temporary connection pool that we trim down after we know exactly how many connections there are. @@ -1743,7 +1751,7 @@ void CTestHull :: BuildNodeGraph( void ) { ALERT ( at_aiconsole, "**ConnectVisibleNodes FAILED!\n" ); - SetThink ( ShowBadNode );// send the hull off to show the offending node. + SetThink ( &CTestHull::ShowBadNode );// send the hull off to show the offending node. //pev->solid = SOLID_NOT; pev->origin = WorldGraph.m_pNodes[ iBadNode ].m_vecOrigin; @@ -2732,7 +2740,8 @@ void CGraph::HashChoosePrimes(int TableSize) // We divide this interval into 16 equal sized zones. We want to find // one prime number that best represents that zone. // - for (int iZone = 1, iPrime = 0; iPrime < 16; iZone += Spacing) + int iPrime,iZone;; + for (iZone = 1, iPrime = 0; iPrime < 16; iZone += Spacing) { // Search for a prime number that is less than the target zone // number given by iZone. @@ -2789,8 +2798,10 @@ void CGraph::SortNodes(void) // things and patchup the links. // int iNodeCnt = 0; + int i; m_pNodes[0].m_iPreviousNode = iNodeCnt++; - for (int i = 1; i < m_cNodes; i++) + + for (i = 1; i < m_cNodes; i++) { m_pNodes[i].m_iPreviousNode = UNNUMBERED_NODE; } @@ -2855,7 +2866,8 @@ void CGraph::BuildLinkLookups(void) ALERT(at_aiconsole, "Couldn't allocated Link Lookup Table.\n"); return; } - for (int i = 0; i < m_nHashLinks; i++) + int i; + for (i = 0; i < m_nHashLinks; i++) { m_pHashLinks[i] = ENTRY_STATE_EMPTY; } @@ -2895,7 +2907,8 @@ void CGraph::BuildRegionTables(void) // Calculate regions for all the nodes. // // - for (int i = 0; i < 3; i++) + int i; + for (i = 0; i < 3; i++) { m_RegionMin[i] = 999999999.0; // just a big number out there; m_RegionMax[i] = -999999999.0; // just a big number out there; @@ -2925,7 +2938,8 @@ void CGraph::BuildRegionTables(void) for (i = 0; i < 3; i++) { - for (int j = 0; j < NUM_RANGES; j++) + int j; + for (j = 0; j < NUM_RANGES; j++) { m_RangeStart[i][j] = 255; m_RangeEnd[i][j] = 0; @@ -3059,7 +3073,8 @@ void CGraph :: ComputeStaticRoutingTables( void ) // Initialize Routing table to uncalculated. // - for (int iFrom = 0; iFrom < m_cNodes; iFrom++) + int iFrom; + for (iFrom = 0; iFrom < m_cNodes; iFrom++) { for (int iTo = 0; iTo < m_cNodes; iTo++) { @@ -3275,7 +3290,8 @@ void CGraph :: ComputeStaticRoutingTables( void ) int nRoute = p - pRoute; if (m_pRouteInfo) { - for (int i = 0; i < m_nRouteInfo - nRoute; i++) + int i; + for (i = 0; i < m_nRouteInfo - nRoute; i++) { if (memcmp(m_pRouteInfo + i, pRoute, nRoute) == 0) { @@ -3367,7 +3383,8 @@ void CGraph :: TestRoutingTables( void ) // #if 1 float flDistance1 = 0.0; - for (int i = 0; i < cPathSize1-1; i++) + int i; + for (i = 0; i < cPathSize1-1; i++) { // Find the link from pMyPath[i] to pMyPath[i+1] // @@ -3558,7 +3575,7 @@ void CNodeViewer::Spawn( ) ALERT( at_aiconsole, "%d nodes\n", m_nVisited ); m_iDraw = 0; - SetThink( DrawThink ); + SetThink( &CNodeViewer::DrawThink ); pev->nextthink = gpGlobals->time; } diff --git a/dlls/nodes.h b/dlls/nodes.h index 6b6739d..90325d2 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/observer.cpp b/dlls/observer.cpp new file mode 100644 index 0000000..c994e1e --- /dev/null +++ b/dlls/observer.cpp @@ -0,0 +1,280 @@ +//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. =========== +// +// The copyright to the contents herein is the property of Valve, L.L.C. +// The contents may be used and/or copied only with the written permission of +// Valve, L.L.C., or in accordance with the terms and conditions stipulated in +// the agreement/contract under which the contents have been supplied. +// +// Purpose: Functionality for the observer chase camera +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//============================================================================= +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "player.h" +#include "weapons.h" +#include "pm_shared.h" + +extern int gmsgCurWeapon; +extern int gmsgSetFOV; +// Find the next client in the game for this player to spectate +void CBasePlayer::Observer_FindNextPlayer( bool bReverse ) +{ + // MOD AUTHORS: Modify the logic of this function if you want to restrict the observer to watching + // only a subset of the players. e.g. Make it check the target's team. + + int iStart; + if ( m_hObserverTarget ) + iStart = ENTINDEX( m_hObserverTarget->edict() ); + else + iStart = ENTINDEX( edict() ); + int iCurrent = iStart; + m_hObserverTarget = NULL; + int iDir = bReverse ? -1 : 1; + + do + { + iCurrent += iDir; + + // Loop through the clients + if (iCurrent > gpGlobals->maxClients) + iCurrent = 1; + if (iCurrent < 1) + iCurrent = gpGlobals->maxClients; + + CBaseEntity *pEnt = UTIL_PlayerByIndex( iCurrent ); + if ( !pEnt ) + continue; + if ( pEnt == this ) + continue; + // Don't spec observers or players who haven't picked a class yet + if ( ((CBasePlayer*)pEnt)->IsObserver() || (pEnt->pev->effects & EF_NODRAW) ) + continue; + + // MOD AUTHORS: Add checks on target here. + + m_hObserverTarget = pEnt; + break; + + } while ( iCurrent != iStart ); + + // Did we find a target? + if ( m_hObserverTarget ) + { + // Move to the target + UTIL_SetOrigin( pev, m_hObserverTarget->pev->origin ); + + // ALERT( at_console, "Now Tracking %s\n", STRING( m_hObserverTarget->pev->netname ) ); + + // Store the target in pev so the physics DLL can get to it + if (pev->iuser1 != OBS_ROAMING) + pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() ); + + + + } +} + +// Handle buttons in observer mode +void CBasePlayer::Observer_HandleButtons() +{ + // Slow down mouse clicks + if ( m_flNextObserverInput > gpGlobals->time ) + return; + + // Jump changes from modes: Chase to Roaming + if ( m_afButtonPressed & IN_JUMP ) + { + if ( pev->iuser1 == OBS_CHASE_LOCKED ) + Observer_SetMode( OBS_CHASE_FREE ); + + else if ( pev->iuser1 == OBS_CHASE_FREE ) + Observer_SetMode( OBS_IN_EYE ); + + else if ( pev->iuser1 == OBS_IN_EYE ) + Observer_SetMode( OBS_ROAMING ); + + else if ( pev->iuser1 == OBS_ROAMING ) + Observer_SetMode( OBS_MAP_FREE ); + + else if ( pev->iuser1 == OBS_MAP_FREE ) + Observer_SetMode( OBS_MAP_CHASE ); + + else + Observer_SetMode( OBS_CHASE_FREE ); // don't use OBS_CHASE_LOCKED anymore + + m_flNextObserverInput = gpGlobals->time + 0.2; + } + + // Attack moves to the next player + if ( m_afButtonPressed & IN_ATTACK )//&& pev->iuser1 != OBS_ROAMING ) + { + Observer_FindNextPlayer( false ); + + m_flNextObserverInput = gpGlobals->time + 0.2; + } + + // Attack2 moves to the prev player + if ( m_afButtonPressed & IN_ATTACK2)// && pev->iuser1 != OBS_ROAMING ) + { + Observer_FindNextPlayer( true ); + + m_flNextObserverInput = gpGlobals->time + 0.2; + } +} + +void CBasePlayer::Observer_CheckTarget() +{ + if( pev->iuser1 == OBS_ROAMING ) + return; + + // try to find a traget if we have no current one + if ( m_hObserverTarget == NULL) + { + Observer_FindNextPlayer( false ); + + if (m_hObserverTarget == NULL) + { + // no target found at all + + int lastMode = pev->iuser1; + + Observer_SetMode( OBS_ROAMING ); + + m_iObserverLastMode = lastMode; // don't overwrite users lastmode + + return; // we still have np target return + } + } + + CBasePlayer* target = (CBasePlayer*)(UTIL_PlayerByIndex( ENTINDEX(m_hObserverTarget->edict()))); + + if ( !target ) + { + Observer_FindNextPlayer( false ); + return; + } + + // check taget + if (target->pev->deadflag == DEAD_DEAD) + { + if ( (target->m_fDeadTime + 2.0f ) < gpGlobals->time ) + { + // 3 secs after death change target + Observer_FindNextPlayer( false ); + return; + } + } +} + +void CBasePlayer::Observer_CheckProperties() +{ + // try to find a traget if we have no current one + if ( pev->iuser1 == OBS_IN_EYE && m_hObserverTarget != NULL) + { + CBasePlayer* target = (CBasePlayer*)(UTIL_PlayerByIndex( ENTINDEX(m_hObserverTarget->edict()))); + + if (!target ) + return; + + int weapon = (target->m_pActiveItem!=NULL)?target->m_pActiveItem->m_iId:0; + // use fov of tracked client + if ( m_iFOV != target->m_iFOV || m_iObserverWeapon != weapon ) + { + m_iFOV = target->m_iFOV; + m_iClientFOV = m_iFOV; + // write fov before wepon data, so zoomed crosshair is set correctly + MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, pev ); + WRITE_BYTE( m_iFOV ); + MESSAGE_END(); + + + m_iObserverWeapon = weapon; + //send weapon update + MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev ); + WRITE_BYTE( 1 ); // 1 = current weapon, not on target + WRITE_BYTE( m_iObserverWeapon ); + WRITE_BYTE( 0 ); // clip + MESSAGE_END(); + } + } + else + { + m_iFOV = 90; + + if ( m_iObserverWeapon != 0 ) + { + m_iObserverWeapon = 0; + + MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev ); + WRITE_BYTE( 1 ); // 1 = current weapon + WRITE_BYTE( m_iObserverWeapon ); + WRITE_BYTE( 0 ); // clip + MESSAGE_END(); + } + } +} + +// Attempt to change the observer mode +void CBasePlayer::Observer_SetMode( int iMode ) +{ + + // Just abort if we're changing to the mode we're already in + if ( iMode == pev->iuser1 ) + return; + + // is valid mode ? + if ( iMode < OBS_CHASE_LOCKED || iMode > OBS_MAP_CHASE ) + iMode = OBS_IN_EYE; // now it is + // verify observer target again + if ( m_hObserverTarget != NULL) + { + CBaseEntity *pEnt = m_hObserverTarget; + + if ( (pEnt == this) || (pEnt == NULL) ) + m_hObserverTarget = NULL; + else if ( ((CBasePlayer*)pEnt)->IsObserver() || (pEnt->pev->effects & EF_NODRAW) ) + m_hObserverTarget = NULL; + } + + // set spectator mode + pev->iuser1 = iMode; + + // if we are not roaming, we need a valid target to track + if ( (iMode != OBS_ROAMING) && (m_hObserverTarget == NULL) ) + { + Observer_FindNextPlayer( false ); + + // if we didn't find a valid target switch to roaming + if (m_hObserverTarget == NULL) + { + ClientPrint( pev, HUD_PRINTCENTER, "#Spec_NoTarget" ); + pev->iuser1 = OBS_ROAMING; + } + } + + // set target if not roaming + if (pev->iuser1 == OBS_ROAMING) + { + pev->iuser2 = 0; + } + else + pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() ); + + pev->iuser3 = 0; // clear second target from death cam + + // print spepctaor mode on client screen + + char modemsg[16]; + sprintf(modemsg,"#Spec_Mode%i", pev->iuser1 ); + ClientPrint( pev, HUD_PRINTCENTER, modemsg ); + + m_iObserverLastMode = iMode; +} diff --git a/dlls/osprey.cpp b/dlls/osprey.cpp index 435107e..d85443b 100644 --- a/dlls/osprey.cpp +++ b/dlls/osprey.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -167,8 +167,8 @@ void COsprey :: Spawn( void ) InitBoneControllers(); - SetThink( FindAllThink ); - SetUse( CommandUse ); + SetThink( &COsprey::FindAllThink ); + SetUse( &COsprey::CommandUse ); if (!(pev->spawnflags & SF_WAITFORTRIGGER)) { @@ -225,7 +225,7 @@ void COsprey :: FindAllThink( void ) UTIL_Remove( this ); return; } - SetThink( FlyThink ); + SetThink( &COsprey::FlyThink ); pev->nextthink = gpGlobals->time + 0.1; m_startTime = gpGlobals->time; } @@ -257,7 +257,7 @@ void COsprey :: DeployThink( void ) vecSrc = pev->origin + vecForward * -64 + vecRight * -100 + vecUp * -96; m_hRepel[3] = MakeGrunt( vecSrc ); - SetThink( HoverThink ); + SetThink( &COsprey::HoverThink ); pev->nextthink = gpGlobals->time + 0.1; } @@ -308,7 +308,7 @@ CBaseMonster *COsprey :: MakeGrunt( Vector vecSrc ) pBeam->PointEntInit( vecSrc + Vector(0,0,112), pGrunt->entindex() ); pBeam->SetFlags( BEAM_FSOLID ); pBeam->SetColor( 255, 255, 255 ); - pBeam->SetThink( SUB_Remove ); + pBeam->SetThink( &CBeam::SUB_Remove ); pBeam->pev->nextthink = gpGlobals->time + -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5; // ALERT( at_console, "%d at %.0f %.0f %.0f\n", i, m_vecOrigin[i].x, m_vecOrigin[i].y, m_vecOrigin[i].z ); @@ -336,7 +336,7 @@ void COsprey :: HoverThink( void ) if (i == 4) { m_startTime = gpGlobals->time; - SetThink( FlyThink ); + SetThink( &COsprey::FlyThink ); } pev->nextthink = gpGlobals->time + 0.1; @@ -396,7 +396,7 @@ void COsprey::FlyThink( void ) { if (m_pGoalEnt->pev->speed == 0) { - SetThink( DeployThink ); + SetThink( &COsprey::DeployThink ); } do { m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME ( NULL, STRING( m_pGoalEnt->pev->target ) ) ); @@ -518,8 +518,8 @@ void COsprey :: Killed( entvars_t *pevAttacker, int iGib ) STOP_SOUND( ENT(pev), CHAN_STATIC, "apache/ap_rotor4.wav" ); UTIL_SetSize( pev, Vector( -32, -32, -64), Vector( 32, 32, 0) ); - SetThink( DyingThink ); - SetTouch( CrashTouch ); + SetThink( &COsprey::DyingThink ); + SetTouch( &COsprey::CrashTouch ); pev->nextthink = gpGlobals->time + 0.1; pev->health = 0; pev->takedamage = DAMAGE_NO; diff --git a/dlls/pathcorner.cpp b/dlls/pathcorner.cpp index b721672..7bb0998 100644 --- a/dlls/pathcorner.cpp +++ b/dlls/pathcorner.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/plane.cpp b/dlls/plane.cpp index ff5518c..7c2d3dc 100644 --- a/dlls/plane.cpp +++ b/dlls/plane.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/plane.h b/dlls/plane.h index a54f245..f2d0030 100644 --- a/dlls/plane.h +++ b/dlls/plane.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/plats.cpp b/dlls/plats.cpp index a566d7f..f945c38 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -328,7 +328,7 @@ void CFuncPlat :: Spawn( ) { UTIL_SetOrigin (pev, m_vecPosition1); m_toggle_state = TS_AT_TOP; - SetUse( PlatUse ); + SetUse( &CFuncPlat::PlatUse ); } else { @@ -385,7 +385,7 @@ void CPlatTrigger :: Touch( CBaseEntity *pOther ) return; // Ignore touches by corpses - if (!pOther->IsAlive()) + if (!pOther->IsAlive()||!m_pPlatform||!m_pPlatform->pev) return; // Make linked platform go up/down. @@ -435,7 +435,7 @@ void CFuncPlat :: GoDown( void ) ASSERT(m_toggle_state == TS_AT_TOP || m_toggle_state == TS_GOING_UP); m_toggle_state = TS_GOING_DOWN; - SetMoveDone(CallHitBottom); + SetMoveDone(&CFuncPlat::CallHitBottom); LinearMove(m_vecPosition2, pev->speed); } @@ -466,7 +466,7 @@ void CFuncPlat :: GoUp( void ) ASSERT(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN); m_toggle_state = TS_GOING_UP; - SetMoveDone(CallHitTop); + SetMoveDone(&CFuncPlat::CallHitTop); LinearMove(m_vecPosition1, pev->speed); } @@ -488,7 +488,7 @@ void CFuncPlat :: HitTop( void ) if ( !IsTogglePlat() ) { // After a delay, the platform will automatically start going down again. - SetThink( CallGoDown ); + SetThink( &CFuncPlat::CallGoDown ); pev->nextthink = pev->ltime + 3; } } @@ -738,7 +738,7 @@ void CFuncTrain :: Wait( void ) STOP_SOUND( edict(), CHAN_STATIC, (char*)STRING(pev->noiseMovement) ); if ( pev->noiseStopMoving ) EMIT_SOUND (ENT(pev), CHAN_VOICE, (char*)STRING(pev->noiseStopMoving), m_volume, ATTN_NORM); - SetThink( Next ); + SetThink( &CFuncTrain::Next ); } else { @@ -802,7 +802,7 @@ void CFuncTrain :: Next( void ) if ( pev->noiseMovement ) EMIT_SOUND (ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMovement), m_volume, ATTN_NORM); ClearBits(pev->effects, EF_NOINTERP); - SetMoveDone( Wait ); + SetMoveDone( &CFuncTrain::Wait ); LinearMove (pTarg->pev->origin - (pev->mins + pev->maxs)* 0.5, pev->speed); } } @@ -824,7 +824,7 @@ void CFuncTrain :: Activate( void ) if ( FStringNull(pev->targetname) ) { // not triggered, so start immediately pev->nextthink = pev->ltime + 0.1; - SetThink( Next ); + SetThink( &CFuncTrain::Next ); } else pev->spawnflags |= SF_TRAIN_WAIT_RETRIGGER; @@ -920,7 +920,7 @@ void CFuncTrain::OverrideReset( void ) } else // Keep moving for 0.1 secs, then find path_corner again and restart { - SetThink( Next ); + SetThink( &CFuncTrain::Next ); pev->nextthink = pev->ltime + 0.1; } } @@ -1262,7 +1262,7 @@ void CFuncTrackTrain :: Next( void ) } } - SetThink( Next ); + SetThink( &CFuncTrackTrain::Next ); NextThink( pev->ltime + time, TRUE ); } else // end of path, stop @@ -1284,7 +1284,7 @@ void CFuncTrackTrain :: Next( void ) // no, how long to get there? time = distance / m_oldSpeed; pev->velocity = pev->velocity * (m_oldSpeed / distance); - SetThink( DeadEnd ); + SetThink( &CFuncTrackTrain::DeadEnd ); NextThink( pev->ltime + time, FALSE ); } else @@ -1402,7 +1402,7 @@ void CFuncTrackTrain :: Find( void ) pev->angles.x = 0; UTIL_SetOrigin( pev, nextPos ); NextThink( pev->ltime + 0.1, FALSE ); - SetThink( Next ); + SetThink( &CFuncTrackTrain::Next ); pev->speed = m_startSpeed; UpdateSound(); @@ -1452,7 +1452,7 @@ void CFuncTrackTrain :: NearestPath( void ) if ( pev->speed != 0 ) { NextThink( pev->ltime + 0.1, FALSE ); - SetThink( Next ); + SetThink( &CFuncTrackTrain::Next ); } } @@ -1460,7 +1460,7 @@ void CFuncTrackTrain :: NearestPath( void ) void CFuncTrackTrain::OverrideReset( void ) { NextThink( pev->ltime + 0.1, FALSE ); - SetThink( NearestPath ); + SetThink( &CFuncTrackTrain::NearestPath ); } @@ -1519,7 +1519,7 @@ void CFuncTrackTrain :: Spawn( void ) // start trains on the next frame, to make sure their targets have had // a chance to spawn/activate NextThink( pev->ltime + 0.1, FALSE ); - SetThink( Find ); + SetThink( &CFuncTrackTrain::Find ); Precache(); } @@ -1589,7 +1589,7 @@ void CFuncTrainControls :: Spawn( void ) UTIL_SetSize( pev, pev->mins, pev->maxs ); UTIL_SetOrigin( pev, pev->origin ); - SetThink( Find ); + SetThink(&CFuncTrainControls::Find ); pev->nextthink = gpGlobals->time; } @@ -1701,7 +1701,7 @@ void CFuncTrackChange :: Spawn( void ) EnableUse(); pev->nextthink = pev->ltime + 2.0; - SetThink( Find ); + SetThink( &CFuncTrackChange::Find ); Precache(); } @@ -1752,7 +1752,7 @@ void CFuncTrackChange :: KeyValue( KeyValueData *pkvd ) void CFuncTrackChange::OverrideReset( void ) { pev->nextthink = pev->ltime + 1.0; - SetThink( Find ); + SetThink( &CFuncTrackChange::Find ); } void CFuncTrackChange :: Find( void ) @@ -1862,14 +1862,14 @@ void CFuncTrackChange :: GoDown( void ) // If ROTMOVE, move & rotate if ( FBitSet( pev->spawnflags, SF_TRACK_DONT_MOVE ) ) { - SetMoveDone( CallHitBottom ); + SetMoveDone( &CFuncTrackChange::CallHitBottom ); m_toggle_state = TS_GOING_DOWN; AngularMove( m_start, pev->speed ); } else { CFuncPlat :: GoDown(); - SetMoveDone( CallHitBottom ); + SetMoveDone( &CFuncTrackChange::CallHitBottom ); RotMove( m_start, pev->nextthink - pev->ltime ); } // Otherwise, rotate first, move second @@ -1898,14 +1898,14 @@ void CFuncTrackChange :: GoUp( void ) if ( FBitSet( pev->spawnflags, SF_TRACK_DONT_MOVE ) ) { m_toggle_state = TS_GOING_UP; - SetMoveDone( CallHitTop ); + SetMoveDone( &CFuncTrackChange::CallHitTop ); AngularMove( m_end, pev->speed ); } else { // If ROTMOVE, move & rotate CFuncPlat :: GoUp(); - SetMoveDone( CallHitTop ); + SetMoveDone( &CFuncTrackChange::CallHitTop ); RotMove( m_end, pev->nextthink - pev->ltime ); } @@ -2160,7 +2160,7 @@ void CGunTarget::Spawn( void ) if ( pev->spawnflags & FGUNTARGET_START_ON ) { - SetThink( Start ); + SetThink( &CGunTarget::Start ); pev->nextthink = pev->ltime + 0.3; } } @@ -2198,7 +2198,7 @@ void CGunTarget::Next( void ) Stop(); return; } - SetMoveDone( Wait ); + SetMoveDone( &CGunTarget::Wait ); LinearMove( pTarget->pev->origin - (pev->mins + pev->maxs) * 0.5, pev->speed ); } @@ -2224,7 +2224,7 @@ void CGunTarget::Wait( void ) m_flWait = pTarget->GetDelay(); pev->target = pTarget->pev->target; - SetThink( Next ); + SetThink( &CGunTarget::Next ); if (m_flWait != 0) {// -1 wait will wait forever! pev->nextthink = pev->ltime + m_flWait; diff --git a/dlls/player.cpp b/dlls/player.cpp index 3dbe22c..d49e74e 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -34,6 +34,7 @@ #include "decals.h" #include "gamerules.h" #include "game.h" +#include "pm_shared.h" #include "hltv.h" // #define DUCKFIX @@ -206,7 +207,8 @@ void LinkUserMessages( void ) gmsgDamage = REG_USER_MSG( "Damage", 12 ); gmsgBattery = REG_USER_MSG( "Battery", 2); gmsgTrain = REG_USER_MSG( "Train", 1); - gmsgHudText = REG_USER_MSG( "HudText", -1 ); + //gmsgHudText = REG_USER_MSG( "HudTextPro", -1 ); + gmsgHudText = REG_USER_MSG( "HudText", -1 ); // we don't use the message but 3rd party addons may! gmsgSayText = REG_USER_MSG( "SayText", -1 ); gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 ); gmsgWeaponList = REG_USER_MSG("WeaponList", -1); @@ -687,7 +689,7 @@ void CBasePlayer::PackDeadPlayerItems( void ) int iPW = 0;// index into packweapons array int iPA = 0;// index into packammo array - memset(rgpPackWeapons, NULL, sizeof(rgpPackWeapons) ); + memset(rgpPackWeapons, 0, sizeof(rgpPackWeapons) ); memset(iPackAmmo, -1, sizeof(iPackAmmo) ); // get the game rules @@ -774,7 +776,7 @@ void CBasePlayer::PackDeadPlayerItems( void ) pWeaponBox->pev->angles.x = 0;// don't let weaponbox tilt. pWeaponBox->pev->angles.z = 0; - pWeaponBox->SetThink( CWeaponBox::Kill ); + pWeaponBox->SetThink( &CWeaponBox::Kill ); pWeaponBox->pev->nextthink = gpGlobals->time + 120; // back these two lists up to their first elements @@ -813,6 +815,12 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit ) m_pLastItem = NULL; + if ( m_pTank != NULL ) + { + m_pTank->Use( this, this, USE_OFF, 0 ); + m_pTank = NULL; + } + int i; CBasePlayerItem *pPendingItem; for (i = 0; i < MAX_ITEM_TYPES; i++) @@ -933,7 +941,7 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib ) pev->angles.x = 0; pev->angles.z = 0; - SetThink(PlayerDeathThink); + SetThink(&CBasePlayer::PlayerDeathThink); pev->nextthink = gpGlobals->time + 0.1; } @@ -1327,6 +1335,9 @@ void CBasePlayer::PlayerDeathThink(void) // go to dead camera. StartDeathCam(); } + + if ( pev->iuser1 ) // player is in spectator mode + return; // wait for any button down, or mp_forcerespawn is set and the respawn time is up if (!fAnyButtonDown @@ -1377,7 +1388,9 @@ void CBasePlayer::StartDeathCam( void ) } CopyToBodyQue( pev ); - StartObserver( pSpot->v.origin, pSpot->v.v_angle ); + + UTIL_SetOrigin( pev, pSpot->v.origin ); + pev->angles = pev->v_angle = pSpot->v.v_angle; } else { @@ -1385,23 +1398,90 @@ void CBasePlayer::StartDeathCam( void ) TraceResult tr; CopyToBodyQue( pev ); UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, 128 ), ignore_monsters, edict(), &tr ); - StartObserver( tr.vecEndPos, UTIL_VecToAngles( tr.vecEndPos - pev->origin ) ); - return; + + UTIL_SetOrigin( pev, tr.vecEndPos ); + pev->angles = pev->v_angle = UTIL_VecToAngles( tr.vecEndPos - pev->origin ); } + + // start death cam + + m_afPhysicsFlags |= PFLAG_OBSERVER; + pev->view_ofs = g_vecZero; + pev->fixangle = TRUE; + pev->solid = SOLID_NOT; + pev->takedamage = DAMAGE_NO; + pev->movetype = MOVETYPE_NONE; + pev->modelindex = 0; } void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) { - m_afPhysicsFlags |= PFLAG_OBSERVER; + // clear any clientside entities attached to this player + MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); + WRITE_BYTE( TE_KILLPLAYERATTACHMENTS ); + WRITE_BYTE( (BYTE)entindex() ); + MESSAGE_END(); + // Holster weapon immediately, to allow it to cleanup + if (m_pActiveItem) + m_pActiveItem->Holster( ); + + if ( m_pTank != NULL ) + { + m_pTank->Use( this, this, USE_OFF, 0 ); + m_pTank = NULL; + } + + // clear out the suit message cache so we don't keep chattering + SetSuitUpdate(NULL, FALSE, 0); + + // Tell Ammo Hud that the player is dead + MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev ); + WRITE_BYTE(0); + WRITE_BYTE(0XFF); + WRITE_BYTE(0xFF); + MESSAGE_END(); + + // reset FOV + m_iFOV = m_iClientFOV = 0; + pev->fov = m_iFOV; + MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, pev ); + WRITE_BYTE(0); + MESSAGE_END(); + + // Setup flags + m_iHideHUD = (HIDEHUD_HEALTH | HIDEHUD_WEAPONS); + m_afPhysicsFlags |= PFLAG_OBSERVER; + pev->effects = EF_NODRAW; pev->view_ofs = g_vecZero; pev->angles = pev->v_angle = vecViewAngle; pev->fixangle = TRUE; pev->solid = SOLID_NOT; pev->takedamage = DAMAGE_NO; pev->movetype = MOVETYPE_NONE; - pev->modelindex = 0; + ClearBits( m_afPhysicsFlags, PFLAG_DUCKING ); + ClearBits( pev->flags, FL_DUCKING ); + pev->deadflag = DEAD_RESPAWNABLE; + pev->health = 1; + + // Clear out the status bar + m_fInitHUD = TRUE; + + pev->team = 0; + MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo ); + WRITE_BYTE( ENTINDEX(edict()) ); + WRITE_STRING( "" ); + MESSAGE_END(); + + // Remove all the player's stuff + RemoveAllItems( FALSE ); + + // Move them to the new position UTIL_SetOrigin( pev, vecPosition ); + + // Find a player to watch + m_flNextObserverInput = 0; + Observer_SetMode( m_iObserverLastMode ); } // @@ -1411,6 +1491,9 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) void CBasePlayer::PlayerUse ( void ) { + if ( IsObserver() ) + return; + // Was use pressed or released? if ( ! ((pev->button | m_afButtonPressed | m_afButtonReleased) & IN_USE) ) return; @@ -1795,6 +1878,16 @@ void CBasePlayer::PreThink(void) CheckSuitUpdate(); + // Observer Button Handling + if ( IsObserver() ) + { + Observer_HandleButtons(); + Observer_CheckTarget(); + Observer_CheckProperties(); + pev->impulse = 0; + return; + } + if (pev->deadflag >= DEAD_DYING) { PlayerDeathThink(); @@ -2563,9 +2656,6 @@ void CBasePlayer::PostThink() UpdatePlayerSound(); - // Track button info so we can detect 'pressed' and 'released' buttons next frame - m_afButtonLast = pev->button; - pt_end: #if defined( CLIENT_WEAPONS ) // Decay timers on weapons @@ -2629,11 +2719,10 @@ pt_end: if ( m_flAmmoStartCharge < -0.001 ) m_flAmmoStartCharge = -0.001; } - - -#else - return; #endif + + // Track button info so we can detect 'pressed' and 'released' buttons next frame + m_afButtonLast = pev->button; } @@ -3207,7 +3296,7 @@ void CBloodSplat::Spawn ( entvars_t *pevOwner ) pev->angles = pevOwner->v_angle; pev->owner = ENT(pevOwner); - SetThink ( Spray ); + SetThink ( &CBloodSplat::Spray ); pev->nextthink = gpGlobals->time + 0.1; } @@ -3222,7 +3311,7 @@ void CBloodSplat::Spray ( void ) UTIL_BloodDecalTrace( &tr, BLOOD_COLOR_RED ); } - SetThink ( SUB_Remove ); + SetThink ( &CBloodSplat::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; } @@ -3585,7 +3674,7 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse ) if ( pEntity ) { if ( pEntity->pev->takedamage ) - pEntity->SetThink(SUB_Remove); + pEntity->SetThink(&CBaseEntity::SUB_Remove); } break; } @@ -3863,7 +3952,7 @@ void CBasePlayer :: UpdateClientData( void ) { m_fInitHUD = FALSE; gInitHUD = FALSE; - + MESSAGE_BEGIN( MSG_ONE, gmsgResetHUD, NULL, pev ); WRITE_BYTE( 0 ); MESSAGE_END(); @@ -3875,6 +3964,9 @@ void CBasePlayer :: UpdateClientData( void ) g_pGameRules->InitHUD( this ); m_fGameHUDInitialized = TRUE; + + m_iObserverLastMode = OBS_ROAMING; + if ( g_pGameRules->IsMultiplayer() ) { FireTargets( "game_playerjoin", this, this, USE_TOGGLE, 0 ); @@ -3915,7 +4007,10 @@ void CBasePlayer :: UpdateClientData( void ) if (pev->health != m_iClientHealth) { - int iHealth = max( pev->health, 0 ); // make sure that no negative health values are sent +#define clamp( val, min, max ) ( ((val) > (max)) ? (max) : ( ((val) < (min)) ? (min) : (val) ) ) + int iHealth = clamp( pev->health, 0, 255 ); // make sure that no negative health values are sent + if ( pev->health > 0.0f && pev->health <= 1.0f ) + iHealth = 1; // send "health" update message MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, pev ); @@ -4461,7 +4556,8 @@ void CBasePlayer::DropPlayerItem ( char *pszItemName ) // item we want to drop and hit a BREAK; pWeapon is the item. if ( pWeapon ) { - g_pGameRules->GetNextBestWeapon( this, pWeapon ); + if ( !g_pGameRules->GetNextBestWeapon( this, pWeapon ) ) + return; // can't drop the item they asked for, may be our last item or something we can't holster UTIL_MakeVectors ( pev->angles ); @@ -4724,7 +4820,7 @@ void CRevertSaved :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP { UTIL_ScreenFadeAll( pev->rendercolor, Duration(), HoldTime(), pev->renderamt, FFADE_OUT ); pev->nextthink = gpGlobals->time + MessageTime(); - SetThink( MessageThink ); + SetThink( &CRevertSaved::MessageThink ); } @@ -4735,7 +4831,7 @@ void CRevertSaved :: MessageThink( void ) if ( nextThink > 0 ) { pev->nextthink = gpGlobals->time + nextThink; - SetThink( LoadThink ); + SetThink( &CRevertSaved::LoadThink ); } else LoadThink(); diff --git a/dlls/player.h b/dlls/player.h index cbf9580..726e2ce 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -88,6 +88,19 @@ enum sbar_data class CBasePlayer : public CBaseMonster { public: + + // Spectator camera + void Observer_FindNextPlayer( bool bReverse ); + void Observer_HandleButtons(); + void Observer_SetMode( int iMode ); + void Observer_CheckTarget(); + void Observer_CheckProperties(); + EHANDLE m_hObserverTarget; + float m_flNextObserverInput; + int m_iObserverWeapon; // weapon of current tracked target + int m_iObserverLastMode;// last used observer mode + int IsObserver() { return pev->iuser1; }; + int random_seed; // See that is shared between client & server for shared weapons code int m_iPlayerSound;// the index of the sound list slot reserved for this player @@ -292,7 +305,7 @@ public: void SetCustomDecalFrames( int nFrames ); int GetCustomDecalFrames( void ); - void CBasePlayer::TabulateAmmo( void ); + void TabulateAmmo( void ); float m_flStartCharge; float m_flAmmoStartCharge; diff --git a/dlls/playermonster.cpp b/dlls/playermonster.cpp index bb0a86a..a67af8c 100644 --- a/dlls/playermonster.cpp +++ b/dlls/playermonster.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: New version of the slider bar // diff --git a/dlls/python.cpp b/dlls/python.cpp index 89d6231..4ab731b 100644 --- a/dlls/python.cpp +++ b/dlls/python.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -233,10 +233,7 @@ void CPython::Reload( void ) bUseScope = g_pGameRules->IsMultiplayer(); #endif - if (DefaultReload( 6, PYTHON_RELOAD, 2.0, bUseScope )) - { - m_flSoundDelay = 1.5; - } + DefaultReload( 6, PYTHON_RELOAD, 2.0, bUseScope ); } @@ -246,18 +243,11 @@ void CPython::WeaponIdle( void ) m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); - // ALERT( at_console, "%.2f\n", gpGlobals->time - m_flSoundDelay ); - if (m_flSoundDelay != 0 && m_flSoundDelay <= UTIL_WeaponTimeBase() ) - { - EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/357_reload1.wav", RANDOM_FLOAT(0.8, 0.9), ATTN_NORM); - m_flSoundDelay = 0; - } - if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) return; int iAnim; - float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); + float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); if (flRand <= 0.5) { iAnim = PYTHON_IDLE1; @@ -290,7 +280,6 @@ void CPython::WeaponIdle( void ) } - class CPythonAmmo : public CBasePlayerAmmo { void Spawn( void ) diff --git a/dlls/rat.cpp b/dlls/rat.cpp index 0d4c8fb..0bdf955 100644 --- a/dlls/rat.cpp +++ b/dlls/rat.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/roach.cpp b/dlls/roach.cpp index 3c13bf1..4e15dd2 100644 --- a/dlls/roach.cpp +++ b/dlls/roach.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index dcda157..803539b 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -80,7 +80,7 @@ void CLaserSpot::Suspend( float flSuspendTime ) { pev->effects |= EF_NODRAW; - SetThink( Revive ); + SetThink( &CLaserSpot::Revive ); pev->nextthink = gpGlobals->time + flSuspendTime; } @@ -110,7 +110,7 @@ CRpgRocket *CRpgRocket::CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBa UTIL_SetOrigin( pRocket->pev, vecOrigin ); pRocket->pev->angles = vecAngles; pRocket->Spawn(); - pRocket->SetTouch( CRpgRocket::RocketTouch ); + pRocket->SetTouch( &CRpgRocket::RocketTouch ); pRocket->m_pLauncher = pLauncher;// remember what RPG fired me. pRocket->m_pLauncher->m_cActiveRockets++;// register this missile as active for the launcher pRocket->pev->owner = pOwner->edict(); @@ -133,8 +133,8 @@ void CRpgRocket :: Spawn( void ) pev->classname = MAKE_STRING("rpg_rocket"); - SetThink( IgniteThink ); - SetTouch( ExplodeTouch ); + SetThink( &CRpgRocket::IgniteThink ); + SetTouch( &CRpgRocket::ExplodeTouch ); pev->angles.x -= 30; UTIL_MakeVectors( pev->angles ); @@ -200,7 +200,7 @@ void CRpgRocket :: IgniteThink( void ) m_flIgniteTime = gpGlobals->time; // set to follow laser spot - SetThink( FollowThink ); + SetThink( &CRpgRocket::FollowThink ); pev->nextthink = gpGlobals->time + 0.1; } @@ -305,7 +305,7 @@ void CRpg::Reload( void ) // Set the next attack time into the future so that WeaponIdle will get called more often // than reload, allowing the RPG LTD to be updated - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextPrimaryAttack = GetNextAttackDelay(0.5); if ( m_cActiveRockets && m_fSpotActive ) { @@ -479,7 +479,7 @@ void CRpg::PrimaryAttack() m_iClip--; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.5; + m_flNextPrimaryAttack = GetNextAttackDelay(1.5); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5; } else @@ -614,4 +614,4 @@ class CRpgAmmo : public CBasePlayerAmmo }; LINK_ENTITY_TO_CLASS( ammo_rpgclip, CRpgAmmo ); -#endif \ No newline at end of file +#endif diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 7c5ff45..f2f58a2 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -77,9 +77,9 @@ void CSatchelCharge :: Spawn( void ) UTIL_SetSize(pev, Vector( -4, -4, -4), Vector(4, 4, 4)); // Uses point-sized, and can be stepped over UTIL_SetOrigin( pev, pev->origin ); - SetTouch( SatchelSlide ); - SetUse( DetonateUse ); - SetThink( SatchelThink ); + SetTouch( &CSatchelCharge::SatchelSlide ); + SetUse( &CSatchelCharge::DetonateUse ); + SetThink( &CSatchelCharge::SatchelThink ); pev->nextthink = gpGlobals->time + 0.1; pev->gravity = 0.5; @@ -322,7 +322,7 @@ void CSatchel::Holster( int skiplocal /* = 0 */ ) if ( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && !m_chargeReady ) { m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; } } @@ -359,7 +359,7 @@ void CSatchel::PrimaryAttack() } m_chargeReady = 2; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextPrimaryAttack = GetNextAttackDelay(0.5); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; break; @@ -411,7 +411,7 @@ void CSatchel::Throw( void ) m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.0; + m_flNextPrimaryAttack = GetNextAttackDelay(1.0); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; } } @@ -454,7 +454,7 @@ void CSatchel::WeaponIdle( void ) // use tripmine animations strcpy( m_pPlayer->m_szAnimExtention, "trip" ); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextPrimaryAttack = GetNextAttackDelay(0.5); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; m_chargeReady = 0; break; @@ -491,4 +491,4 @@ void DeactivateSatchels( CBasePlayer *pOwner ) } } -#endif \ No newline at end of file +#endif diff --git a/dlls/saverestore.h b/dlls/saverestore.h index c774b62..649b990 100644 --- a/dlls/saverestore.h +++ b/dlls/saverestore.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -60,7 +60,7 @@ public: void WriteVector( const char *pname, const float *value, int count ); // Save a vector void WritePositionVector( const char *pname, const Vector &value ); // Offset for landmark if necessary void WritePositionVector( const char *pname, const float *value, int count ); // array of pos vectors - void WriteFunction( const char *pname, const int *value, int count ); // Save a function pointer + void WriteFunction( const char *pname, void **value, int count ); // Save a function pointer int WriteEntVars( const char *pname, entvars_t *pev ); // Save entvars_t (entvars_t) int WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); diff --git a/dlls/schedule.cpp b/dlls/schedule.cpp index 9b4fe6c..518410d 100644 --- a/dlls/schedule.cpp +++ b/dlls/schedule.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/schedule.h b/dlls/schedule.h index f73e895..7d9ff17 100644 --- a/dlls/schedule.h +++ b/dlls/schedule.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index ab37d9c..87a64fe 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -686,7 +686,7 @@ void CScientist :: Spawn( void ) pev->skin = 1; MonsterInit(); - SetUse( FollowerUse ); + SetUse( &CScientist::FollowerUse ); } //========================================================= @@ -1240,7 +1240,7 @@ void CSittingScientist :: Spawn( ) pev->sequence = m_baseSequence + RANDOM_LONG(0,4); ResetSequenceInfo( ); - SetThink (SittingThink); + SetThink (&CSittingScientist::SittingThink); pev->nextthink = gpGlobals->time + 0.1; DROP_TO_FLOOR ( ENT(pev) ); diff --git a/dlls/scripted.cpp b/dlls/scripted.cpp index 9661f78..d386c8a 100644 --- a/dlls/scripted.cpp +++ b/dlls/scripted.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -142,7 +142,7 @@ void CCineMonster :: Spawn( void ) // if no targetname, start now if ( FStringNull(pev->targetname) || !FStringNull( m_iszIdle ) ) { - SetThink( CineThink ); + SetThink( &CCineMonster::CineThink ); pev->nextthink = gpGlobals->time + 1.0; // Wait to be used? if ( pev->targetname ) @@ -198,7 +198,7 @@ void CCineMonster :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP else { // if not, try finding them - SetThink( CineThink ); + SetThink( &CCineMonster::CineThink ); pev->nextthink = gpGlobals->time; } } @@ -253,7 +253,7 @@ void CCineMonster :: Touch( CBaseEntity *pOther ) // void CCineMonster :: Die( void ) { - SetThink( SUB_Remove ); + SetThink( &CCineMonster::SUB_Remove ); } // @@ -564,7 +564,7 @@ void CCineMonster :: SequenceDone ( CBaseMonster *pMonster ) if ( !( pev->spawnflags & SF_SCRIPT_REPEATABLE ) ) { - SetThink( SUB_Remove ); + SetThink( &CCineMonster::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; } @@ -1026,7 +1026,7 @@ void CScriptedSentence :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, US if ( !m_active ) return; // ALERT( at_console, "Firing sentence: %s\n", STRING(m_iszSentence) ); - SetThink( FindThink ); + SetThink( &CScriptedSentence::FindThink ); pev->nextthink = gpGlobals->time; } @@ -1039,7 +1039,7 @@ void CScriptedSentence :: Spawn( void ) // if no targetname, start now if ( !pev->targetname ) { - SetThink( FindThink ); + SetThink( &CScriptedSentence::FindThink ); pev->nextthink = gpGlobals->time + 1.0; } @@ -1078,7 +1078,7 @@ void CScriptedSentence :: FindThink( void ) StartSentence( pMonster ); if ( pev->spawnflags & SF_SENTENCE_ONCE ) UTIL_Remove( this ); - SetThink( DelayThink ); + SetThink( &CScriptedSentence::DelayThink ); pev->nextthink = gpGlobals->time + m_flDuration + m_flRepeat; m_active = FALSE; // ALERT( at_console, "%s: found monster %s\n", STRING(m_iszSentence), STRING(m_iszEntity) ); @@ -1096,7 +1096,7 @@ void CScriptedSentence :: DelayThink( void ) m_active = TRUE; if ( !pev->targetname ) pev->nextthink = gpGlobals->time + 0.1; - SetThink( FindThink ); + SetThink( &CScriptedSentence::FindThink ); } @@ -1219,7 +1219,7 @@ LINK_ENTITY_TO_CLASS( monster_furniture, CFurniture ); //========================================================= void CFurniture :: Die ( void ) { - SetThink ( SUB_Remove ); + SetThink ( &CFurniture::SUB_Remove ); pev->nextthink = gpGlobals->time; } diff --git a/dlls/scripted.h b/dlls/scripted.h index 67a2eb1..db9d5dd 100644 --- a/dlls/scripted.h +++ b/dlls/scripted.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/scriptevent.h b/dlls/scriptevent.h index 9a02bd6..0f33f26 100644 --- a/dlls/scriptevent.h +++ b/dlls/scriptevent.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index dfa084b..ee669c7 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -122,7 +122,7 @@ void CShotgun::PrimaryAttack() if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; + m_flNextPrimaryAttack = GetNextAttackDelay(0.15); return; } @@ -178,7 +178,7 @@ void CShotgun::PrimaryAttack() if (m_iClip != 0) m_flPumpTime = gpGlobals->time + 0.5; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75; + m_flNextPrimaryAttack = GetNextAttackDelay(0.75); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75; if (m_iClip != 0) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0; @@ -194,7 +194,7 @@ void CShotgun::SecondaryAttack( void ) if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15; + m_flNextPrimaryAttack = GetNextAttackDelay(0.15); return; } @@ -252,7 +252,7 @@ void CShotgun::SecondaryAttack( void ) if (m_iClip != 0) m_flPumpTime = gpGlobals->time + 0.95; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.5; + m_flNextPrimaryAttack = GetNextAttackDelay(1.5); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5; if (m_iClip != 0) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 6.0; @@ -280,7 +280,7 @@ void CShotgun::Reload( void ) m_fInSpecialReload = 1; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.6; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.0; + m_flNextPrimaryAttack = GetNextAttackDelay(1.0); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0; return; } diff --git a/dlls/singleplay_gamerules.cpp b/dlls/singleplay_gamerules.cpp index b71b96a..96f9d74 100644 --- a/dlls/singleplay_gamerules.cpp +++ b/dlls/singleplay_gamerules.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/skill.cpp b/dlls/skill.cpp index 7c0b852..bb94a6e 100644 --- a/dlls/skill.cpp +++ b/dlls/skill.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/skill.h b/dlls/skill.h index 4434071..8246b61 100644 --- a/dlls/skill.h +++ b/dlls/skill.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 174e5f9..95d34f7 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -24,6 +24,10 @@ #include "talkmonster.h" #include "gamerules.h" +#if !defined ( _WIN32 ) +#include +#endif + static char *memfgets( byte *pMemFile, int fileSize, int &filePos, char *pBuffer, int bufferSize ); @@ -193,7 +197,7 @@ void CAmbientGeneric :: Spawn( void ) { ALERT( at_error, "EMPTY AMBIENT AT: %f, %f, %f\n", pev->origin.x, pev->origin.y, pev->origin.z ); pev->nextthink = gpGlobals->time + 0.1; - SetThink( SUB_Remove ); + SetThink( &CAmbientGeneric::SUB_Remove ); return; } pev->solid = SOLID_NOT; @@ -203,12 +207,12 @@ void CAmbientGeneric :: Spawn( void ) // of ambient sound's pitch or volume. Don't // start thinking yet. - SetThink(RampThink); + SetThink(&CAmbientGeneric::RampThink); pev->nextthink = 0; // allow on/off switching via 'use' function. - SetUse ( ToggleUse ); + SetUse ( &CAmbientGeneric::ToggleUse ); m_fActive = FALSE; @@ -1537,7 +1541,7 @@ void TEXTURETYPE_Init() char buffer[512]; int i, j; byte *pMemFile; - int fileSize, filePos; + int fileSize, filePos = 0; if (fTextureTypeInit) return; @@ -1824,19 +1828,19 @@ void CSpeaker :: Spawn( void ) { ALERT( at_error, "SPEAKER with no Level/Sentence! at: %f, %f, %f\n", pev->origin.x, pev->origin.y, pev->origin.z ); pev->nextthink = gpGlobals->time + 0.1; - SetThink( SUB_Remove ); + SetThink( &CSpeaker::SUB_Remove ); return; } pev->solid = SOLID_NOT; pev->movetype = MOVETYPE_NONE; - SetThink(SpeakerThink); + SetThink(&CSpeaker::SpeakerThink); pev->nextthink = 0.0; // allow on/off switching via 'use' function. - SetUse ( ToggleUse ); + SetUse ( &CSpeaker::ToggleUse ); Precache( ); } @@ -1975,4 +1979,4 @@ void CSpeaker :: KeyValue( KeyValueData *pkvd ) } else CBaseEntity::KeyValue( pkvd ); -} \ No newline at end of file +} diff --git a/dlls/soundent.cpp b/dlls/soundent.cpp index 93c70a7..edc17af 100644 --- a/dlls/soundent.cpp +++ b/dlls/soundent.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/soundent.h b/dlls/soundent.h index 2393cb4..5294ff6 100644 --- a/dlls/soundent.h +++ b/dlls/soundent.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/spectator.cpp b/dlls/spectator.cpp index 9d6bef9..1df2f4d 100644 --- a/dlls/spectator.cpp +++ b/dlls/spectator.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/spectator.h b/dlls/spectator.h index f832621..510be97 100644 --- a/dlls/spectator.h +++ b/dlls/spectator.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -24,4 +24,4 @@ public: private: void SpectatorImpulseCommand(void); -}; \ No newline at end of file +}; diff --git a/dlls/squad.h b/dlls/squad.h index 5f9f249..b229f28 100644 --- a/dlls/squad.h +++ b/dlls/squad.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: New version of the slider bar // @@ -17,4 +17,4 @@ #define bits_SQUAD_FLANK_LEFT ( 1 << 0 ) #define bits_SQUAD_FLANK_RIGHT ( 1 << 1 ) #define bits_SQUAD_ADVANCE ( 1 << 2 ) -#define bits_SQUAD_FLUSH_ATTACK ( 1 << 3 ) \ No newline at end of file +#define bits_SQUAD_FLUSH_ATTACK ( 1 << 3 ) diff --git a/dlls/squadmonster.cpp b/dlls/squadmonster.cpp index d0a65ba..bef5dbd 100644 --- a/dlls/squadmonster.cpp +++ b/dlls/squadmonster.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/squadmonster.h b/dlls/squadmonster.h index f529787..66c44af 100644 --- a/dlls/squadmonster.h +++ b/dlls/squadmonster.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index 5b7ce72..9597a6e 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -120,8 +120,8 @@ void CSqueakGrenade :: Spawn( void ) UTIL_SetSize(pev, Vector( -4, -4, 0), Vector(4, 4, 8)); UTIL_SetOrigin( pev, pev->origin ); - SetTouch( SuperBounceTouch ); - SetThink( HuntThink ); + SetTouch( &CSqueakGrenade::SuperBounceTouch ); + SetThink( &CSqueakGrenade::HuntThink ); pev->nextthink = gpGlobals->time + 0.1; m_flNextHunt = gpGlobals->time + 1E6; @@ -162,7 +162,7 @@ void CSqueakGrenade::Precache( void ) void CSqueakGrenade :: Killed( entvars_t *pevAttacker, int iGib ) { pev->model = iStringNull;// make invisible - SetThink( SUB_Remove ); + SetThink( &CSqueakGrenade::SUB_Remove ); SetTouch( NULL ); pev->nextthink = gpGlobals->time + 0.1; @@ -483,7 +483,7 @@ void CSqueak::Holster( int skiplocal /* = 0 */ ) if ( !m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] ) { m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; return; } @@ -545,7 +545,7 @@ void CSqueak::PrimaryAttack() m_fJustThrown = 1; - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3; + m_flNextPrimaryAttack = GetNextAttackDelay(0.3); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; } } @@ -598,4 +598,4 @@ void CSqueak::WeaponIdle( void ) SendWeaponAnim( iAnim ); } -#endif \ No newline at end of file +#endif diff --git a/dlls/stats.cpp b/dlls/stats.cpp index 3323c1c..a34b97f 100644 --- a/dlls/stats.cpp +++ b/dlls/stats.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: New version of the slider bar // diff --git a/dlls/subs.cpp b/dlls/subs.cpp index a109366..2dd7b6d 100644 --- a/dlls/subs.cpp +++ b/dlls/subs.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -231,7 +231,7 @@ void CBaseDelay :: SUB_UseTargets( CBaseEntity *pActivator, USE_TYPE useType, fl pTemp->pev->nextthink = gpGlobals->time + m_flDelay; - pTemp->SetThink( DelayThink ); + pTemp->SetThink( &CBaseDelay::DelayThink ); // Save the useType pTemp->pev->button = (int)useType; @@ -413,7 +413,7 @@ void CBaseToggle :: LinearMove( Vector vecDest, float flSpeed ) // set nextthink to trigger a call to LinearMoveDone when dest is reached pev->nextthink = pev->ltime + flTravelTime; - SetThink( LinearMoveDone ); + SetThink( &CBaseToggle::LinearMoveDone ); // scale the destdelta vector by the time spent traveling to get velocity pev->velocity = vecDestDelta / flTravelTime; @@ -427,6 +427,14 @@ After moving, set origin to exact final destination, call "move done" function */ void CBaseToggle :: LinearMoveDone( void ) { + Vector delta = m_vecFinalDest - pev->origin; + float error = delta.Length(); + if ( error > 0.03125 ) + { + LinearMove( m_vecFinalDest, 100 ); + return; + } + UTIL_SetOrigin(pev, m_vecFinalDest); pev->velocity = g_vecZero; pev->nextthink = -1; @@ -473,7 +481,7 @@ void CBaseToggle :: AngularMove( Vector vecDestAngle, float flSpeed ) // set nextthink to trigger a call to AngularMoveDone when dest is reached pev->nextthink = pev->ltime + flTravelTime; - SetThink( AngularMoveDone ); + SetThink( &CBaseToggle::AngularMoveDone ); // scale the destdelta vector by the time spent traveling to get velocity pev->avelocity = vecDestDelta / flTravelTime; diff --git a/dlls/talkmonster.cpp b/dlls/talkmonster.cpp index 76ac05b..008865b 100644 --- a/dlls/talkmonster.cpp +++ b/dlls/talkmonster.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/talkmonster.h b/dlls/talkmonster.h index d59c55f..d0bd4e4 100644 --- a/dlls/talkmonster.h +++ b/dlls/talkmonster.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/teamplay_gamerules.cpp b/dlls/teamplay_gamerules.cpp index db99778..03a3351 100644 --- a/dlls/teamplay_gamerules.cpp +++ b/dlls/teamplay_gamerules.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/teamplay_gamerules.h b/dlls/teamplay_gamerules.h index c7c351e..ac11dc2 100644 --- a/dlls/teamplay_gamerules.h +++ b/dlls/teamplay_gamerules.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/tempmonster.cpp b/dlls/tempmonster.cpp index 2ad893f..21de4ab 100644 --- a/dlls/tempmonster.cpp +++ b/dlls/tempmonster.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/tentacle.cpp b/dlls/tentacle.cpp index ef3ab57..de126dd 100644 --- a/dlls/tentacle.cpp +++ b/dlls/tentacle.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -265,9 +265,9 @@ void CTentacle :: Spawn( ) m_bloodColor = BLOOD_COLOR_GREEN; - SetThink( Start ); - SetTouch( HitTouch ); - SetUse( CommandUse ); + SetThink( &CTentacle::Start ); + SetTouch( &CTentacle::HitTouch ); + SetUse( &CTentacle::CommandUse ); pev->nextthink = gpGlobals->time + 0.2; @@ -714,7 +714,7 @@ void CTentacle::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T { case USE_OFF: pev->takedamage = DAMAGE_NO; - SetThink( DieThink ); + SetThink( &CTentacle::DieThink ); m_iGoalAnim = TENTACLE_ANIM_Engine_Death1; break; case USE_ON: @@ -728,7 +728,7 @@ void CTentacle::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T break; case USE_TOGGLE: pev->takedamage = DAMAGE_NO; - SetThink( DieThink ); + SetThink( &CTentacle::DieThink ); m_iGoalAnim = TENTACLE_ANIM_Engine_Idle; break; } @@ -926,7 +926,7 @@ void CTentacle :: HandleAnimEvent( MonsterEvent_t *pEvent ) // void CTentacle :: Start( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) void CTentacle :: Start( void ) { - SetThink( Cycle ); + SetThink( &CTentacle::Cycle ); if ( !g_fFlySound ) { @@ -1041,4 +1041,4 @@ void CTentacleMaw :: Precache( ) PRECACHE_MODEL("models/maw.mdl"); } -#endif \ No newline at end of file +#endif diff --git a/dlls/trains.h b/dlls/trains.h index 4ee4411..90d06e7 100644 --- a/dlls/trains.h +++ b/dlls/trains.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index bd36a08..7916c2b 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -73,7 +73,7 @@ void CFrictionModifier :: Spawn( void ) pev->solid = SOLID_TRIGGER; SET_MODEL(ENT(pev), STRING(pev->model)); // set size and link into world pev->movetype = MOVETYPE_NONE; - SetTouch( ChangeFriction ); + SetTouch( &CFrictionModifier::ChangeFriction ); } @@ -344,8 +344,8 @@ void CMultiManager :: KeyValue( KeyValueData *pkvd ) void CMultiManager :: Spawn( void ) { pev->solid = SOLID_NOT; - SetUse ( ManagerUse ); - SetThink ( ManagerThink); + SetUse ( &CMultiManager::ManagerUse ); + SetThink ( &CMultiManager::ManagerThink); // Sort targets // Quick and dirty bubble sort @@ -403,7 +403,7 @@ void CMultiManager :: ManagerThink ( void ) UTIL_Remove( this ); return; } - SetUse ( ManagerUse );// allow manager re-use + SetUse ( &CMultiManager::ManagerUse );// allow manager re-use } else pev->nextthink = m_startTime + m_flTargetDelay[ m_index ]; @@ -444,7 +444,7 @@ void CMultiManager :: ManagerUse ( CBaseEntity *pActivator, CBaseEntity *pCaller SetUse( NULL );// disable use until all targets have fired - SetThink ( ManagerThink ); + SetThink ( &CMultiManager::ManagerThink ); pev->nextthink = gpGlobals->time; } @@ -618,7 +618,7 @@ void CTriggerMonsterJump :: Spawn ( void ) {// if targetted, spawn turned off pev->solid = SOLID_NOT; UTIL_SetOrigin( pev, pev->origin ); // Unlink from trigger list - SetUse( ToggleUse ); + SetUse( &CTriggerMonsterJump::ToggleUse ); } } @@ -712,7 +712,7 @@ void PlayCDTrack( int iTrack ) if ( iTrack == -1 ) { - CLIENT_COMMAND ( pClient, "cd pause\n"); + CLIENT_COMMAND ( pClient, "cd stop\n"); } else { @@ -808,11 +808,11 @@ void CTargetCDAudio::Play( void ) void CTriggerHurt :: Spawn( void ) { InitTrigger(); - SetTouch ( HurtTouch ); + SetTouch ( &CTriggerHurt::HurtTouch ); if ( !FStringNull ( pev->targetname ) ) { - SetUse ( ToggleUse ); + SetUse ( &CTriggerHurt::ToggleUse ); } else { @@ -821,7 +821,7 @@ void CTriggerHurt :: Spawn( void ) if (m_bitsDamageInflict & DMG_RADIATION) { - SetThink ( RadiationThink ); + SetThink ( &CTriggerHurt::RadiationThink ); pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.0, 0.5); } @@ -1080,7 +1080,7 @@ void CTriggerMultiple :: Spawn( void ) // } // else { - SetTouch( MultiTouch ); + SetTouch( &CTriggerMultiple::MultiTouch ); } } @@ -1177,7 +1177,7 @@ void CBaseTrigger :: ActivateMultiTrigger( CBaseEntity *pActivator ) if (m_flWait > 0) { - SetThink( MultiWaitOver ); + SetThink( &CBaseTrigger::MultiWaitOver ); pev->nextthink = gpGlobals->time + m_flWait; } else @@ -1186,7 +1186,7 @@ void CBaseTrigger :: ActivateMultiTrigger( CBaseEntity *pActivator ) // called while C code is looping through area links... SetTouch( NULL ); pev->nextthink = gpGlobals->time + 0.1; - SetThink( SUB_Remove ); + SetThink( &CBaseTrigger::SUB_Remove ); } } @@ -1266,7 +1266,7 @@ void CTriggerCounter :: Spawn( void ) if (m_cTriggersLeft == 0) m_cTriggersLeft = 2; - SetUse( CounterUse ); + SetUse( &CTriggerCounter::CounterUse ); } // ====================== TRIGGER_CHANGELEVEL ================================ @@ -1411,11 +1411,11 @@ void CChangeLevel :: Spawn( void ) if (!FStringNull ( pev->targetname ) ) { - SetUse ( UseChangeLevel ); + SetUse ( &CChangeLevel::UseChangeLevel ); } InitTrigger(); if ( !(pev->spawnflags & SF_CHANGELEVEL_USEONLY) ) - SetTouch( TouchChangeLevel ); + SetTouch( &CChangeLevel::TouchChangeLevel ); // ALERT( at_console, "TRANSITION: %s (%s)\n", m_szMapName, m_szLandmarkName ); } @@ -1732,7 +1732,7 @@ void NextLevel( void ) if (pChange->pev->nextthink < gpGlobals->time) { - pChange->SetThink( CChangeLevel::ExecuteChangeLevel ); + pChange->SetThink( &CChangeLevel::ExecuteChangeLevel ); pChange->pev->nextthink = gpGlobals->time + 0.1; } } @@ -1816,7 +1816,7 @@ void CTriggerPush :: Spawn( ) if ( FBitSet (pev->spawnflags, SF_TRIGGER_PUSH_START_OFF) )// if flagged to Start Turned Off, make trigger nonsolid. pev->solid = SOLID_NOT; - SetUse( ToggleUse ); + SetUse( &CTriggerPush::ToggleUse ); UTIL_SetOrigin( pev, pev->origin ); // Link into the list } @@ -1934,7 +1934,7 @@ void CTriggerTeleport :: Spawn( void ) { InitTrigger(); - SetTouch( TeleportTouch ); + SetTouch( &CTriggerTeleport::TeleportTouch ); } @@ -1959,7 +1959,7 @@ void CTriggerSave::Spawn( void ) } InitTrigger(); - SetTouch( SaveTouch ); + SetTouch( &CTriggerSave::SaveTouch ); } void CTriggerSave::SaveTouch( CBaseEntity *pOther ) @@ -2014,10 +2014,10 @@ void CTriggerEndSection::Spawn( void ) InitTrigger(); - SetUse ( EndSectionUse ); + SetUse ( &CTriggerEndSection::EndSectionUse ); // If it is a "use only" trigger, then don't set the touch function. if ( ! (pev->spawnflags & SF_ENDSECTION_USEONLY) ) - SetTouch( EndSectionTouch ); + SetTouch( &CTriggerEndSection::EndSectionTouch ); } void CTriggerEndSection::EndSectionTouch( CBaseEntity *pOther ) @@ -2060,7 +2060,7 @@ LINK_ENTITY_TO_CLASS( trigger_gravity, CTriggerGravity ); void CTriggerGravity::Spawn( void ) { InitTrigger(); - SetTouch( GravityTouch ); + SetTouch( &CTriggerGravity::GravityTouch ); } void CTriggerGravity::GravityTouch( CBaseEntity *pOther ) @@ -2317,7 +2317,7 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP SET_MODEL(ENT(pev), STRING(pActivator->pev->model) ); // follow the player down - SetThink( FollowTarget ); + SetThink( &CTriggerCamera::FollowTarget ); pev->nextthink = gpGlobals->time; m_moveDistance = 0; diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 81ff104..bba4d61 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -120,7 +120,7 @@ void CTripmineGrenade :: Spawn( void ) m_flPowerUp = gpGlobals->time + 2.5; } - SetThink( PowerupThink ); + SetThink( &CTripmineGrenade::PowerupThink ); pev->nextthink = gpGlobals->time + 0.2; pev->takedamage = DAMAGE_YES; @@ -158,7 +158,7 @@ void CTripmineGrenade :: WarningThink( void ) // EMIT_SOUND( ENT(pev), CHAN_VOICE, "buttons/Blip2.wav", 1.0, ATTN_NORM ); // set to power up - SetThink( PowerupThink ); + SetThink( &CTripmineGrenade::PowerupThink ); pev->nextthink = gpGlobals->time + 1.0; } @@ -191,7 +191,7 @@ void CTripmineGrenade :: PowerupThink( void ) { STOP_SOUND( ENT(pev), CHAN_VOICE, "weapons/mine_deploy.wav" ); STOP_SOUND( ENT(pev), CHAN_BODY, "weapons/mine_charge.wav" ); - SetThink( SUB_Remove ); + SetThink(&CTripmineGrenade::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; ALERT( at_console, "WARNING:Tripmine at %.0f, %.0f, %.0f removed\n", pev->origin.x, pev->origin.y, pev->origin.z ); KillBeam(); @@ -206,7 +206,7 @@ void CTripmineGrenade :: PowerupThink( void ) CBaseEntity *pMine = Create( "weapon_tripmine", pev->origin + m_vecDir * 24, pev->angles ); pMine->pev->spawnflags |= SF_NORESPAWN; - SetThink( SUB_Remove ); + SetThink( &CTripmineGrenade::SUB_Remove ); KillBeam(); pev->nextthink = gpGlobals->time + 0.1; return; @@ -249,7 +249,7 @@ void CTripmineGrenade :: MakeBeam( void ) m_flBeamLength = tr.flFraction; // set to follow laser spot - SetThink( BeamBreakThink ); + SetThink( &CTripmineGrenade::BeamBreakThink ); pev->nextthink = gpGlobals->time + 0.1; Vector vecTmpEnd = pev->origin + m_vecDir * 2048 * m_flBeamLength; @@ -317,7 +317,7 @@ int CTripmineGrenade :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttac { // disable // Create( "weapon_tripmine", pev->origin + m_vecDir * 24, pev->angles ); - SetThink( SUB_Remove ); + SetThink( &CTripmineGrenade::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; KillBeam(); return FALSE; @@ -335,7 +335,7 @@ void CTripmineGrenade::Killed( entvars_t *pevAttacker, int iGib ) pev->owner = ENT( pevAttacker ); } - SetThink( DelayDeathThink ); + SetThink( &CTripmineGrenade::DelayDeathThink ); pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1, 0.3 ); EMIT_SOUND( ENT(pev), CHAN_BODY, "common/null.wav", 0.5, ATTN_NORM ); // shut off chargeup @@ -420,7 +420,7 @@ void CTripmine::Holster( int skiplocal /* = 0 */ ) { // out of mines m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; } @@ -481,7 +481,7 @@ void CTripmine::PrimaryAttack( void ) } - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3; + m_flNextPrimaryAttack = GetNextAttackDelay(0.3); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); } diff --git a/dlls/turret.cpp b/dlls/turret.cpp index c0ebac9..759e0bd 100644 --- a/dlls/turret.cpp +++ b/dlls/turret.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -257,7 +257,7 @@ void CBaseTurret::Spawn() pev->takedamage = DAMAGE_AIM; SetBits (pev->flags, FL_MONSTER); - SetUse( TurretUse ); + SetUse( &CBaseTurret::TurretUse ); if (( pev->spawnflags & SF_MONSTER_TURRET_AUTOACTIVATE ) && !( pev->spawnflags & SF_MONSTER_TURRET_STARTINACTIVE )) @@ -307,7 +307,7 @@ void CTurret::Spawn() m_iMinPitch = -15; UTIL_SetSize(pev, Vector(-32, -32, -m_iRetractHeight), Vector(32, 32, m_iRetractHeight)); - SetThink(Initialize); + SetThink(&CTurret::Initialize); m_pEyeGlow = CSprite::SpriteCreate( TURRET_GLOW_SPRITE, pev->origin, FALSE ); m_pEyeGlow->SetTransparency( kRenderGlow, 255, 0, 0, 0, kRenderFxNoDissipation ); @@ -339,7 +339,7 @@ void CMiniTurret::Spawn() m_iMinPitch = -15; UTIL_SetSize(pev, Vector(-16, -16, -m_iRetractHeight), Vector(16, 16, m_iRetractHeight)); - SetThink(Initialize); + SetThink(&CMiniTurret::Initialize); pev->nextthink = gpGlobals->time + 0.3; } @@ -381,11 +381,11 @@ void CBaseTurret::Initialize(void) if (m_iAutoStart) { m_flLastSight = gpGlobals->time + m_flMaxWait; - SetThink(AutoSearchThink); + SetThink(&CBaseTurret::AutoSearchThink); pev->nextthink = gpGlobals->time + .1; } else - SetThink(SUB_DoNothing); + SetThink(&CBaseTurret::SUB_DoNothing); } void CBaseTurret::TurretUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) @@ -399,7 +399,7 @@ void CBaseTurret::TurretUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ pev->nextthink = gpGlobals->time + 0.1; m_iAutoStart = FALSE;// switching off a turret disables autostart //!!!! this should spin down first!!BUGBUG - SetThink(Retire); + SetThink(&CBaseTurret::Retire); } else { @@ -411,7 +411,7 @@ void CBaseTurret::TurretUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ m_iAutoStart = TRUE; } - SetThink(Deploy); + SetThink(&CBaseTurret::Deploy); } } @@ -472,7 +472,7 @@ void CBaseTurret::ActiveThink(void) { m_hEnemy = NULL; m_flLastSight = gpGlobals->time + m_flMaxWait; - SetThink(SearchThink); + SetThink(&CBaseTurret::SearchThink); return; } @@ -489,7 +489,7 @@ void CBaseTurret::ActiveThink(void) { m_hEnemy = NULL; m_flLastSight = gpGlobals->time + m_flMaxWait; - SetThink(SearchThink); + SetThink(&CBaseTurret::SearchThink); return; } } @@ -518,7 +518,7 @@ void CBaseTurret::ActiveThink(void) { m_hEnemy = NULL; m_flLastSight = gpGlobals->time + m_flMaxWait; - SetThink(SearchThink); + SetThink(&CBaseTurret::SearchThink); return; } } @@ -670,7 +670,7 @@ void CBaseTurret::Deploy(void) SetTurretAnim(TURRET_ANIM_SPIN); pev->framerate = 0; - SetThink(SearchThink); + SetThink(&CBaseTurret::SearchThink); } m_flLastSight = gpGlobals->time + m_flMaxWait; @@ -710,11 +710,11 @@ void CBaseTurret::Retire(void) UTIL_SetSize(pev, pev->mins, pev->maxs); if (m_iAutoStart) { - SetThink(AutoSearchThink); + SetThink(&CBaseTurret::AutoSearchThink); pev->nextthink = gpGlobals->time + .1; } else - SetThink(SUB_DoNothing); + SetThink(&CBaseTurret::SUB_DoNothing); } } else @@ -746,7 +746,7 @@ void CTurret::SpinUpCall(void) { pev->nextthink = gpGlobals->time + 0.1; // retarget delay EMIT_SOUND(ENT(pev), CHAN_STATIC, "turret/tu_active2.wav", TURRET_MACHINE_VOLUME, ATTN_NORM); - SetThink(ActiveThink); + SetThink(&CTurret::ActiveThink); m_iStartSpin = 0; m_iSpin = 1; } @@ -758,7 +758,7 @@ void CTurret::SpinUpCall(void) if (m_iSpin) { - SetThink(ActiveThink); + SetThink(&CTurret::ActiveThink); } } @@ -856,7 +856,7 @@ void CBaseTurret::SearchThink(void) { m_flLastSight = 0; m_flSpinUpTime = 0; - SetThink(ActiveThink); + SetThink(&CBaseTurret::ActiveThink); } else { @@ -866,7 +866,7 @@ void CBaseTurret::SearchThink(void) //Before we retrace, make sure that we are spun down. m_flLastSight = 0; m_flSpinUpTime = 0; - SetThink(Retire); + SetThink(&CBaseTurret::Retire); } // should we stop the spin? else if ((m_flSpinUpTime) && (gpGlobals->time > m_flSpinUpTime)) @@ -911,7 +911,7 @@ void CBaseTurret::AutoSearchThink(void) if (m_hEnemy != NULL) { - SetThink(Deploy); + SetThink(&CBaseTurret::Deploy); EMIT_SOUND(ENT(pev), CHAN_BODY, "turret/tu_alert.wav", TURRET_MACHINE_VOLUME, ATTN_NORM); } } @@ -1025,7 +1025,7 @@ int CBaseTurret::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, flo ClearBits (pev->flags, FL_MONSTER); // why are they set in the first place??? SetUse(NULL); - SetThink(TurretDeath); + SetThink(&CBaseTurret::TurretDeath); SUB_UseTargets( this, USE_ON, 0 ); // wake up others pev->nextthink = gpGlobals->time + 0.1; @@ -1037,7 +1037,7 @@ int CBaseTurret::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, flo if (m_iOn && (1 || RANDOM_LONG(0, 0x7FFF) > 800)) { m_fBeserk = 1; - SetThink(SearchThink); + SetThink(&CBaseTurret::SearchThink); } } @@ -1179,8 +1179,8 @@ void CSentry::Spawn() m_iMinPitch = -60; UTIL_SetSize(pev, Vector(-16, -16, -m_iRetractHeight), Vector(16, 16, m_iRetractHeight)); - SetTouch(SentryTouch); - SetThink(Initialize); + SetTouch(&CSentry::SentryTouch); + SetThink(&CSentry::Initialize); pev->nextthink = gpGlobals->time + 0.3; } @@ -1204,7 +1204,7 @@ int CSentry::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float f if (!m_iOn) { - SetThink( Deploy ); + SetThink( &CSentry::Deploy ); SetUse( NULL ); pev->nextthink = gpGlobals->time + 0.1; } @@ -1219,7 +1219,7 @@ int CSentry::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float f ClearBits (pev->flags, FL_MONSTER); // why are they set in the first place??? SetUse(NULL); - SetThink(SentryDeath); + SetThink( &CSentry::SentryDeath); SUB_UseTargets( this, USE_ON, 0 ); // wake up others pev->nextthink = gpGlobals->time + 0.1; diff --git a/dlls/util.cpp b/dlls/util.cpp index ab27c18..9f46652 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -1003,7 +1003,9 @@ float UTIL_VecToYaw( const Vector &vec ) void UTIL_SetOrigin( entvars_t *pev, const Vector &vecOrigin ) { - SET_ORIGIN(ENT(pev), vecOrigin ); + edict_t *ent = ENT(pev); + if ( ent ) + SET_ORIGIN( ent, vecOrigin ); } void UTIL_ParticleEffect( const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount ) @@ -1655,7 +1657,11 @@ static int gSizes[FIELD_TYPECOUNT] = sizeof(float)*3, // FIELD_POSITION_VECTOR sizeof(int *), // FIELD_POINTER sizeof(int), // FIELD_INTEGER - sizeof(int *), // FIELD_FUNCTION +#ifdef GNUC + sizeof(int *)*2, // FIELD_FUNCTION +#else + sizeof(int *), // FIELD_FUNCTION +#endif sizeof(int), // FIELD_BOOLEAN sizeof(short), // FIELD_SHORT sizeof(char), // FIELD_CHARACTER @@ -1965,11 +1971,11 @@ void CSave :: WritePositionVector( const char *pname, const float *value, int co } -void CSave :: WriteFunction( const char *pname, const int *data, int count ) +void CSave :: WriteFunction( const char *pname, void **data, int count ) { const char *functionName; - functionName = NAME_FOR_FUNCTION( *data ); + functionName = NAME_FOR_FUNCTION( (uint32)*data ); if ( functionName ) BufferField( pname, strlen(functionName) + 1, functionName ); else @@ -2133,7 +2139,7 @@ int CSave :: WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *p break; case FIELD_FUNCTION: - WriteFunction( pTest->fieldName, (int *)(char *)pOutputData, pTest->fieldSize ); + WriteFunction( pTest->fieldName, (void **)pOutputData, pTest->fieldSize ); break; default: ALERT( at_error, "Bad field type\n" ); diff --git a/dlls/util.h b/dlls/util.h index 4865515..0a7847c 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -12,6 +12,8 @@ * without written permission from Valve LLC. * ****/ +#include "archtypes.h" // DAL + // // Misc utility code // @@ -27,8 +29,8 @@ inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin, ent extern globalvars_t *gpGlobals; // Use this instead of ALLOC_STRING on constant strings -#define STRING(offset) (const char *)(gpGlobals->pStringBase + (int)offset) -#define MAKE_STRING(str) ((int)str - (int)STRING(0)) +#define STRING(offset) ((const char *)(gpGlobals->pStringBase + (unsigned int)(offset))) +#define MAKE_STRING(str) ((uint64)(str) - (uint64)(STRING(0))) inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) { @@ -78,19 +80,23 @@ typedef int BOOL; #define M_PI 3.14159265358979323846 // Keeps clutter down a bit, when declaring external entity/global method prototypes -#define DECLARE_GLOBAL_METHOD(MethodName) extern void DLLEXPORT MethodName( void ) -#define GLOBAL_METHOD(funcname) void DLLEXPORT funcname(void) +#define DECLARE_GLOBAL_METHOD(MethodName) extern void UTIL_DLLEXPORT MethodName( void ) +#define GLOBAL_METHOD(funcname) void UTIL_DLLEXPORT funcname(void) + +#ifndef UTIL_DLLEXPORT +#ifdef _WIN32 +#define UTIL_DLLEXPORT _declspec( dllexport ) +#else +#define UTIL_DLLEXPORT __attribute__ ((visibility("default"))) +#endif +#endif // This is the glue that hooks .MAP entity class names to our CPP classes // The _declspec forces them to be exported by name so we can do a lookup with GetProcAddress() // The function is used to intialize / allocate the object for the entity -#ifdef _WIN32 #define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) \ - extern "C" _declspec( dllexport ) void mapClassName( entvars_t *pev ); \ + extern "C" UTIL_DLLEXPORT void mapClassName( entvars_t *pev ); \ void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); } -#else -#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); } -#endif // diff --git a/dlls/vector.h b/dlls/vector.h index c498c83..a64262d 100644 --- a/dlls/vector.h +++ b/dlls/vector.h @@ -109,4 +109,4 @@ inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a. -#endif \ No newline at end of file +#endif diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index f818779..91abde8 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -477,8 +477,8 @@ void CBasePlayerItem :: FallInit( void ) UTIL_SetOrigin( pev, pev->origin ); UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0) );//pointsize until it lands on the ground. - SetTouch( DefaultTouch ); - SetThink( FallThink ); + SetTouch( &CBasePlayerItem::DefaultTouch ); + SetThink( &CBasePlayerItem::FallThink ); pev->nextthink = gpGlobals->time + 0.1; } @@ -528,7 +528,7 @@ void CBasePlayerItem::Materialize( void ) pev->solid = SOLID_TRIGGER; UTIL_SetOrigin( pev, pev->origin );// link into world. - SetTouch (DefaultTouch); + SetTouch (&CBasePlayerItem::DefaultTouch); SetThink (NULL); } @@ -581,7 +581,7 @@ CBaseEntity* CBasePlayerItem::Respawn( void ) { pNewWeapon->pev->effects |= EF_NODRAW;// invisible for now pNewWeapon->SetTouch( NULL );// no touch - pNewWeapon->SetThink( AttemptToMaterialize ); + pNewWeapon->SetThink( &CBasePlayerItem::AttemptToMaterialize ); DROP_TO_FLOOR ( ENT(pev) ); @@ -656,6 +656,11 @@ void CBasePlayerWeapon::ItemPostFrame( void ) m_fInReload = FALSE; } + if ( !(m_pPlayer->pev->button & IN_ATTACK ) ) + { + m_flLastFireTime = 0.0f; + } + if ((m_pPlayer->pev->button & IN_ATTACK2) && CanAttack( m_flNextSecondaryAttack, gpGlobals->time, UseDecrement() ) ) { if ( pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] ) @@ -739,14 +744,14 @@ int CBasePlayerItem::AddToPlayer( CBasePlayer *pPlayer ) void CBasePlayerItem::Drop( void ) { SetTouch( NULL ); - SetThink(SUB_Remove); + SetThink(&CBasePlayerItem::SUB_Remove); pev->nextthink = gpGlobals->time + .1; } void CBasePlayerItem::Kill( void ) { SetTouch( NULL ); - SetThink(SUB_Remove); + SetThink(&CBasePlayerItem::SUB_Remove); pev->nextthink = gpGlobals->time + .1; } @@ -995,6 +1000,7 @@ BOOL CBasePlayerWeapon :: DefaultDeploy( char *szViewModel, char *szWeaponModel, m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; + m_flLastFireTime = 0.0; return TRUE; } @@ -1065,7 +1071,7 @@ void CBasePlayerAmmo::Spawn( void ) UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 16)); UTIL_SetOrigin( pev, pev->origin ); - SetTouch( DefaultTouch ); + SetTouch( &CBasePlayerAmmo::DefaultTouch ); } CBaseEntity* CBasePlayerAmmo::Respawn( void ) @@ -1075,7 +1081,7 @@ CBaseEntity* CBasePlayerAmmo::Respawn( void ) UTIL_SetOrigin( pev, g_pGameRules->VecAmmoRespawnSpot( this ) );// move to wherever I'm supposed to repawn. - SetThink( Materialize ); + SetThink( &CBasePlayerAmmo::Materialize ); pev->nextthink = g_pGameRules->FlAmmoRespawnTime( this ); return this; @@ -1091,7 +1097,7 @@ void CBasePlayerAmmo::Materialize( void ) pev->effects |= EF_MUZZLEFLASH; } - SetTouch( DefaultTouch ); + SetTouch( &CBasePlayerAmmo::DefaultTouch ); } void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) @@ -1110,7 +1116,7 @@ void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) else { SetTouch( NULL ); - SetThink(SUB_Remove); + SetThink(&CBasePlayerAmmo::SUB_Remove); pev->nextthink = gpGlobals->time + .1; } } @@ -1118,7 +1124,7 @@ void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) { // evil impulse 101 hack, kill always SetTouch( NULL ); - SetThink(SUB_Remove); + SetThink(&CBasePlayerAmmo::SUB_Remove); pev->nextthink = gpGlobals->time + .1; } } @@ -1133,7 +1139,7 @@ void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) //========================================================= int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { - int iReturn; + int iReturn = 0; if ( pszAmmo1() != NULL ) { @@ -1183,6 +1189,38 @@ void CBasePlayerWeapon::RetireWeapon( void ) g_pGameRules->GetNextBestWeapon( m_pPlayer, this ); } +//========================================================================= +// GetNextAttackDelay - An accurate way of calcualting the next attack time. +//========================================================================= +float CBasePlayerWeapon::GetNextAttackDelay( float delay ) +{ + if(m_flLastFireTime == 0 || m_flNextPrimaryAttack == -1) + { + // At this point, we are assuming that the client has stopped firing + // and we are going to reset our book keeping variables. + m_flLastFireTime = gpGlobals->time; + m_flPrevPrimaryAttack = delay; + } + // calculate the time between this shot and the previous + float flTimeBetweenFires = gpGlobals->time - m_flLastFireTime; + float flCreep = 0.0f; + if(flTimeBetweenFires > 0) + flCreep = flTimeBetweenFires - m_flPrevPrimaryAttack; // postive or negative + + // save the last fire time + m_flLastFireTime = gpGlobals->time; + + float flNextAttack = UTIL_WeaponTimeBase() + delay - flCreep; + // we need to remember what the m_flNextPrimaryAttack time is set to for each shot, + // store it as m_flPrevPrimaryAttack. + m_flPrevPrimaryAttack = flNextAttack - UTIL_WeaponTimeBase(); +// char szMsg[256]; +// _snprintf( szMsg, sizeof(szMsg), "next attack time: %0.4f\n", gpGlobals->time + flNextAttack ); +// OutputDebugString( szMsg ); + return flNextAttack; +} + + //********************************************************* // weaponbox code: //********************************************************* @@ -1255,7 +1293,7 @@ void CWeaponBox::Kill( void ) while ( pWeapon ) { - pWeapon->SetThink(SUB_Remove); + pWeapon->SetThink(&CBasePlayerItem::SUB_Remove); pWeapon->pev->nextthink = gpGlobals->time + 0.1; pWeapon = pWeapon->m_pNext; } diff --git a/dlls/weapons.h b/dlls/weapons.h index aaa9824..fe4aca9 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -338,6 +338,7 @@ public: void PrintState( void ); virtual CBasePlayerItem *GetWeaponPtr( void ) { return (CBasePlayerItem *)this; }; + float GetNextAttackDelay( float delay ); float m_flPumpTime; int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns @@ -352,6 +353,10 @@ public: int m_fInReload; // Are we in the middle of a reload; int m_iDefaultAmmo;// how much ammo you get when you pick up this weapon as placed by a level designer. + + // hle time creep vars + float m_flPrevPrimaryAttack; + float m_flLastFireTime; }; @@ -445,7 +450,7 @@ public: int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; - HasWeapon( CBasePlayerItem *pCheckItem ); + BOOL HasWeapon( CBasePlayerItem *pCheckItem ); BOOL PackWeapon( CBasePlayerItem *pWeapon ); BOOL PackAmmo( int iszName, int iCount ); @@ -538,7 +543,6 @@ public: void Holster( int skiplocal = 0 ); void Reload( void ); void WeaponIdle( void ); - float m_flSoundDelay; BOOL m_fInZoom;// don't save this. diff --git a/dlls/world.cpp b/dlls/world.cpp index 6287fca..a3b9713 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -124,15 +124,15 @@ void CDecal :: Spawn( void ) if ( FStringNull ( pev->targetname ) ) { - SetThink( StaticDecal ); + SetThink( &CDecal::StaticDecal ); // if there's no targetname, the decal will spray itself on as soon as the world is done spawning. pev->nextthink = gpGlobals->time; } else { // if there IS a targetname, the decal sprays itself on when it is triggered. - SetThink ( SUB_DoNothing ); - SetUse(TriggerDecal); + SetThink ( &CDecal::SUB_DoNothing ); + SetUse( &CDecal::TriggerDecal); } } @@ -157,7 +157,7 @@ void CDecal :: TriggerDecal ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE WRITE_SHORT( (int)VARS(trace.pHit)->modelindex ); MESSAGE_END(); - SetThink( SUB_Remove ); + SetThink( &CDecal::SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; } @@ -639,7 +639,7 @@ void CWorld :: Precache( void ) CBaseEntity *pEntity = CBaseEntity::Create( "env_message", g_vecZero, g_vecZero, NULL ); if ( pEntity ) { - pEntity->SetThink( SUB_CallUseToggle ); + pEntity->SetThink( &CBaseEntity::SUB_CallUseToggle ); pEntity->pev->message = pev->netname; pev->netname = 0; pEntity->pev->nextthink = gpGlobals->time + 0.3; diff --git a/dlls/wpn_shared/hl_wpn_glock.cpp b/dlls/wpn_shared/hl_wpn_glock.cpp index 769ab4a..3807409 100644 --- a/dlls/wpn_shared/hl_wpn_glock.cpp +++ b/dlls/wpn_shared/hl_wpn_glock.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -110,7 +110,7 @@ void CGlock::GlockFire( float flSpread , float flCycleTime, BOOL fUseAutoAim ) if (m_fFireOnEmpty) { PlayEmptySound(); - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2; + m_flNextPrimaryAttack = GetNextAttackDelay(0.2); } return; @@ -161,7 +161,7 @@ void CGlock::GlockFire( float flSpread , float flCycleTime, BOOL fUseAutoAim ) PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); - m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime; + m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) // HEV suit - indicate out of ammo condition diff --git a/dlls/xen.cpp b/dlls/xen.cpp index a52ea6b..6f0f8e3 100644 --- a/dlls/xen.cpp +++ b/dlls/xen.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. diff --git a/dlls/zombie.cpp b/dlls/zombie.cpp index 234eafc..fed84ca 100644 --- a/dlls/zombie.cpp +++ b/dlls/zombie.cpp @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -169,16 +169,18 @@ void CZombie :: AlertSound( void ) void CZombie :: IdleSound( void ) { - int pitch = 95 + RANDOM_LONG(0,9); + int pitch = 100 + RANDOM_LONG(-5,5); // Play a random idle sound - EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pIdleSounds[ RANDOM_LONG(0,ARRAYSIZE(pIdleSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) ); + EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pIdleSounds[ RANDOM_LONG(0,ARRAYSIZE(pIdleSounds)-1) ], 1.0, ATTN_NORM, 0, pitch ); } void CZombie :: AttackSound( void ) { + int pitch = 100 + RANDOM_LONG(-5,5); + // Play a random attack sound - EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAttackSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) ); + EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAttackSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackSounds)-1) ], 1.0, ATTN_NORM, 0, pitch ); } diff --git a/engine/APIProxy.h b/engine/APIProxy.h new file mode 100644 index 0000000..b7429d6 --- /dev/null +++ b/engine/APIProxy.h @@ -0,0 +1,939 @@ +#ifndef __APIPROXY__ +#define __APIPROXY__ + +#include "archtypes.h" // DAL +#include "netadr.h" +#include "Sequence.h" + +#ifndef _WIN32 +#include "enums.h" +#endif + +#define MAX_ALIAS_NAME 32 + +typedef struct cmdalias_s +{ + struct cmdalias_s *next; + char name[MAX_ALIAS_NAME]; + char *value; +} cmdalias_t; + + +// ******************************************************** +// Functions exported by the client .dll +// ******************************************************** + +// Function type declarations for client exports +typedef int (*INITIALIZE_FUNC) ( struct cl_enginefuncs_s*, int ); +typedef void (*HUD_INIT_FUNC) ( void ); +typedef int (*HUD_VIDINIT_FUNC) ( void ); +typedef int (*HUD_REDRAW_FUNC) ( float, int ); +typedef int (*HUD_UPDATECLIENTDATA_FUNC) ( struct client_data_s*, float ); +typedef void (*HUD_RESET_FUNC) ( void ); +typedef void (*HUD_CLIENTMOVE_FUNC)( struct playermove_s *ppmove, qboolean server ); +typedef void (*HUD_CLIENTMOVEINIT_FUNC)( struct playermove_s *ppmove ); +typedef char (*HUD_TEXTURETYPE_FUNC)( char *name ); +typedef void (*HUD_IN_ACTIVATEMOUSE_FUNC) ( void ); +typedef void (*HUD_IN_DEACTIVATEMOUSE_FUNC) ( void ); +typedef void (*HUD_IN_MOUSEEVENT_FUNC) ( int mstate ); +typedef void (*HUD_IN_CLEARSTATES_FUNC) ( void ); +typedef void (*HUD_IN_ACCUMULATE_FUNC ) ( void ); +typedef void (*HUD_CL_CREATEMOVE_FUNC) ( float frametime, struct usercmd_s *cmd, int active ); +typedef int (*HUD_CL_ISTHIRDPERSON_FUNC) ( void ); +typedef void (*HUD_CL_GETCAMERAOFFSETS_FUNC )( float *ofs ); +typedef struct kbutton_s * (*HUD_KB_FIND_FUNC) ( const char *name ); +typedef void ( *HUD_CAMTHINK_FUNC )( void ); +typedef void ( *HUD_CALCREF_FUNC ) ( struct ref_params_s *pparams ); +typedef int ( *HUD_ADDENTITY_FUNC ) ( int type, struct cl_entity_s *ent, const char *modelname ); +typedef void ( *HUD_CREATEENTITIES_FUNC ) ( void ); +typedef void ( *HUD_DRAWNORMALTRIS_FUNC ) ( void ); +typedef void ( *HUD_DRAWTRANSTRIS_FUNC ) ( void ); +typedef void ( *HUD_STUDIOEVENT_FUNC ) ( const struct mstudioevent_s *event, const struct cl_entity_s *entity ); +typedef void ( *HUD_POSTRUNCMD_FUNC ) ( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed ); +typedef void ( *HUD_SHUTDOWN_FUNC ) ( void ); +typedef void ( *HUD_TXFERLOCALOVERRIDES_FUNC )( struct entity_state_s *state, const struct clientdata_s *client ); +typedef void ( *HUD_PROCESSPLAYERSTATE_FUNC )( struct entity_state_s *dst, const struct entity_state_s *src ); +typedef void ( *HUD_TXFERPREDICTIONDATA_FUNC ) ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd ); +typedef void ( *HUD_DEMOREAD_FUNC ) ( int size, unsigned char *buffer ); +typedef int ( *HUD_CONNECTIONLESS_FUNC )( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); +typedef int ( *HUD_GETHULLBOUNDS_FUNC ) ( int hullnumber, float *mins, float *maxs ); +typedef void (*HUD_FRAME_FUNC) ( double ); +typedef int (*HUD_KEY_EVENT_FUNC ) ( int eventcode, int keynum, const char *pszCurrentBinding ); +typedef void (*HUD_TEMPENTUPDATE_FUNC) ( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( struct cl_entity_s *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) ); +typedef struct cl_entity_s *(*HUD_GETUSERENTITY_FUNC ) ( int index ); +typedef void (*HUD_VOICESTATUS_FUNC)(int entindex, qboolean bTalking); +typedef void (*HUD_DIRECTORMESSAGE_FUNC)( int iSize, void *pbuf ); +typedef int ( *HUD_STUDIO_INTERFACE_FUNC )( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio ); +typedef void (*HUD_CHATINPUTPOSITION_FUNC)( int *x, int *y ); +typedef int (*HUD_GETPLAYERTEAM)(int iplayer); +typedef void *(*CLIENTFACTORY)(); // this should be CreateInterfaceFn but that means including interface.h + // which is a C++ file and some of the client files a C only... + // so we return a void * which we then do a typecast on later. + + +// Pointers to the exported client functions themselves +typedef struct +{ + INITIALIZE_FUNC pInitFunc; + HUD_INIT_FUNC pHudInitFunc; + HUD_VIDINIT_FUNC pHudVidInitFunc; + HUD_REDRAW_FUNC pHudRedrawFunc; + HUD_UPDATECLIENTDATA_FUNC pHudUpdateClientDataFunc; + HUD_RESET_FUNC pHudResetFunc; + HUD_CLIENTMOVE_FUNC pClientMove; + HUD_CLIENTMOVEINIT_FUNC pClientMoveInit; + HUD_TEXTURETYPE_FUNC pClientTextureType; + HUD_IN_ACTIVATEMOUSE_FUNC pIN_ActivateMouse; + HUD_IN_DEACTIVATEMOUSE_FUNC pIN_DeactivateMouse; + HUD_IN_MOUSEEVENT_FUNC pIN_MouseEvent; + HUD_IN_CLEARSTATES_FUNC pIN_ClearStates; + HUD_IN_ACCUMULATE_FUNC pIN_Accumulate; + HUD_CL_CREATEMOVE_FUNC pCL_CreateMove; + HUD_CL_ISTHIRDPERSON_FUNC pCL_IsThirdPerson; + HUD_CL_GETCAMERAOFFSETS_FUNC pCL_GetCameraOffsets; + HUD_KB_FIND_FUNC pFindKey; + HUD_CAMTHINK_FUNC pCamThink; + HUD_CALCREF_FUNC pCalcRefdef; + HUD_ADDENTITY_FUNC pAddEntity; + HUD_CREATEENTITIES_FUNC pCreateEntities; + HUD_DRAWNORMALTRIS_FUNC pDrawNormalTriangles; + HUD_DRAWTRANSTRIS_FUNC pDrawTransparentTriangles; + HUD_STUDIOEVENT_FUNC pStudioEvent; + HUD_POSTRUNCMD_FUNC pPostRunCmd; + HUD_SHUTDOWN_FUNC pShutdown; + HUD_TXFERLOCALOVERRIDES_FUNC pTxferLocalOverrides; + HUD_PROCESSPLAYERSTATE_FUNC pProcessPlayerState; + HUD_TXFERPREDICTIONDATA_FUNC pTxferPredictionData; + HUD_DEMOREAD_FUNC pReadDemoBuffer; + HUD_CONNECTIONLESS_FUNC pConnectionlessPacket; + HUD_GETHULLBOUNDS_FUNC pGetHullBounds; + HUD_FRAME_FUNC pHudFrame; + HUD_KEY_EVENT_FUNC pKeyEvent; + HUD_TEMPENTUPDATE_FUNC pTempEntUpdate; + HUD_GETUSERENTITY_FUNC pGetUserEntity; + HUD_VOICESTATUS_FUNC pVoiceStatus; // Possibly null on old client dlls. + HUD_DIRECTORMESSAGE_FUNC pDirectorMessage; // Possibly null on old client dlls. + HUD_STUDIO_INTERFACE_FUNC pStudioInterface; // Not used by all clients + HUD_CHATINPUTPOSITION_FUNC pChatInputPosition; // Not used by all clients + HUD_GETPLAYERTEAM pGetPlayerTeam; // Not used by all clients + CLIENTFACTORY pClientFactory; +} cldll_func_t; + +// Function type declarations for client destination functions +typedef void (*DST_INITIALIZE_FUNC) ( struct cl_enginefuncs_s**, int *); +typedef void (*DST_HUD_INIT_FUNC) ( void ); +typedef void (*DST_HUD_VIDINIT_FUNC) ( void ); +typedef void (*DST_HUD_REDRAW_FUNC) ( float*, int* ); +typedef void (*DST_HUD_UPDATECLIENTDATA_FUNC) ( struct client_data_s**, float* ); +typedef void (*DST_HUD_RESET_FUNC) ( void ); +typedef void (*DST_HUD_CLIENTMOVE_FUNC)( struct playermove_s **, qboolean * ); +typedef void (*DST_HUD_CLIENTMOVEINIT_FUNC)( struct playermove_s ** ); +typedef void (*DST_HUD_TEXTURETYPE_FUNC)( char ** ); +typedef void (*DST_HUD_IN_ACTIVATEMOUSE_FUNC) ( void ); +typedef void (*DST_HUD_IN_DEACTIVATEMOUSE_FUNC) ( void ); +typedef void (*DST_HUD_IN_MOUSEEVENT_FUNC) ( int * ); +typedef void (*DST_HUD_IN_CLEARSTATES_FUNC) ( void ); +typedef void (*DST_HUD_IN_ACCUMULATE_FUNC ) ( void ); +typedef void (*DST_HUD_CL_CREATEMOVE_FUNC) ( float *, struct usercmd_s **, int * ); +typedef void (*DST_HUD_CL_ISTHIRDPERSON_FUNC) ( void ); +typedef void (*DST_HUD_CL_GETCAMERAOFFSETS_FUNC )( float ** ); +typedef void (*DST_HUD_KB_FIND_FUNC) ( const char ** ); +typedef void (*DST_HUD_CAMTHINK_FUNC )( void ); +typedef void (*DST_HUD_CALCREF_FUNC ) ( struct ref_params_s ** ); +typedef void (*DST_HUD_ADDENTITY_FUNC ) ( int *, struct cl_entity_s **, const char ** ); +typedef void (*DST_HUD_CREATEENTITIES_FUNC ) ( void ); +typedef void (*DST_HUD_DRAWNORMALTRIS_FUNC ) ( void ); +typedef void (*DST_HUD_DRAWTRANSTRIS_FUNC ) ( void ); +typedef void (*DST_HUD_STUDIOEVENT_FUNC ) ( const struct mstudioevent_s **, const struct cl_entity_s ** ); +typedef void (*DST_HUD_POSTRUNCMD_FUNC ) ( struct local_state_s **, struct local_state_s **, struct usercmd_s **, int *, double *, unsigned int * ); +typedef void (*DST_HUD_SHUTDOWN_FUNC ) ( void ); +typedef void (*DST_HUD_TXFERLOCALOVERRIDES_FUNC )( struct entity_state_s **, const struct clientdata_s ** ); +typedef void (*DST_HUD_PROCESSPLAYERSTATE_FUNC )( struct entity_state_s **, const struct entity_state_s ** ); +typedef void (*DST_HUD_TXFERPREDICTIONDATA_FUNC ) ( struct entity_state_s **, const struct entity_state_s **, struct clientdata_s **, const struct clientdata_s **, struct weapon_data_s **, const struct weapon_data_s ** ); +typedef void (*DST_HUD_DEMOREAD_FUNC ) ( int *, unsigned char ** ); +typedef void (*DST_HUD_CONNECTIONLESS_FUNC )( const struct netadr_s **, const char **, char **, int ** ); +typedef void (*DST_HUD_GETHULLBOUNDS_FUNC ) ( int *, float **, float ** ); +typedef void (*DST_HUD_FRAME_FUNC) ( double * ); +typedef void (*DST_HUD_KEY_EVENT_FUNC ) ( int *, int *, const char ** ); +typedef void (*DST_HUD_TEMPENTUPDATE_FUNC) ( double *, double *, double *, struct tempent_s ***, struct tempent_s ***, int ( **Callback_AddVisibleEntity )( struct cl_entity_s *pEntity ), void ( **Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ) ); +typedef void (*DST_HUD_GETUSERENTITY_FUNC ) ( int * ); +typedef void (*DST_HUD_VOICESTATUS_FUNC)(int *, qboolean *); +typedef void (*DST_HUD_DIRECTORMESSAGE_FUNC)( int *, void ** ); +typedef void (*DST_HUD_STUDIO_INTERFACE_FUNC ) ( int *, struct r_studio_interface_s ***, struct engine_studio_api_s ** ); +typedef void (*DST_HUD_CHATINPUTPOSITION_FUNC)( int **, int ** ); +typedef void (*DST_HUD_GETPLAYERTEAM)(int); + +// Pointers to the client destination functions +typedef struct +{ + DST_INITIALIZE_FUNC pInitFunc; + DST_HUD_INIT_FUNC pHudInitFunc; + DST_HUD_VIDINIT_FUNC pHudVidInitFunc; + DST_HUD_REDRAW_FUNC pHudRedrawFunc; + DST_HUD_UPDATECLIENTDATA_FUNC pHudUpdateClientDataFunc; + DST_HUD_RESET_FUNC pHudResetFunc; + DST_HUD_CLIENTMOVE_FUNC pClientMove; + DST_HUD_CLIENTMOVEINIT_FUNC pClientMoveInit; + DST_HUD_TEXTURETYPE_FUNC pClientTextureType; + DST_HUD_IN_ACTIVATEMOUSE_FUNC pIN_ActivateMouse; + DST_HUD_IN_DEACTIVATEMOUSE_FUNC pIN_DeactivateMouse; + DST_HUD_IN_MOUSEEVENT_FUNC pIN_MouseEvent; + DST_HUD_IN_CLEARSTATES_FUNC pIN_ClearStates; + DST_HUD_IN_ACCUMULATE_FUNC pIN_Accumulate; + DST_HUD_CL_CREATEMOVE_FUNC pCL_CreateMove; + DST_HUD_CL_ISTHIRDPERSON_FUNC pCL_IsThirdPerson; + DST_HUD_CL_GETCAMERAOFFSETS_FUNC pCL_GetCameraOffsets; + DST_HUD_KB_FIND_FUNC pFindKey; + DST_HUD_CAMTHINK_FUNC pCamThink; + DST_HUD_CALCREF_FUNC pCalcRefdef; + DST_HUD_ADDENTITY_FUNC pAddEntity; + DST_HUD_CREATEENTITIES_FUNC pCreateEntities; + DST_HUD_DRAWNORMALTRIS_FUNC pDrawNormalTriangles; + DST_HUD_DRAWTRANSTRIS_FUNC pDrawTransparentTriangles; + DST_HUD_STUDIOEVENT_FUNC pStudioEvent; + DST_HUD_POSTRUNCMD_FUNC pPostRunCmd; + DST_HUD_SHUTDOWN_FUNC pShutdown; + DST_HUD_TXFERLOCALOVERRIDES_FUNC pTxferLocalOverrides; + DST_HUD_PROCESSPLAYERSTATE_FUNC pProcessPlayerState; + DST_HUD_TXFERPREDICTIONDATA_FUNC pTxferPredictionData; + DST_HUD_DEMOREAD_FUNC pReadDemoBuffer; + DST_HUD_CONNECTIONLESS_FUNC pConnectionlessPacket; + DST_HUD_GETHULLBOUNDS_FUNC pGetHullBounds; + DST_HUD_FRAME_FUNC pHudFrame; + DST_HUD_KEY_EVENT_FUNC pKeyEvent; + DST_HUD_TEMPENTUPDATE_FUNC pTempEntUpdate; + DST_HUD_GETUSERENTITY_FUNC pGetUserEntity; + DST_HUD_VOICESTATUS_FUNC pVoiceStatus; // Possibly null on old client dlls. + DST_HUD_DIRECTORMESSAGE_FUNC pDirectorMessage; // Possibly null on old client dlls. + DST_HUD_STUDIO_INTERFACE_FUNC pStudioInterface; // Not used by all clients + DST_HUD_CHATINPUTPOSITION_FUNC pChatInputPosition; // Not used by all clients + DST_HUD_GETPLAYERTEAM pGetPlayerTeam; // Not used by all clients +} cldll_func_dst_t; + + + + +// ******************************************************** +// Functions exported by the engine +// ******************************************************** + +// Function type declarations for engine exports +typedef HSPRITE (*pfnEngSrc_pfnSPR_Load_t ) ( const char *szPicName ); +typedef int (*pfnEngSrc_pfnSPR_Frames_t ) ( HSPRITE hPic ); +typedef int (*pfnEngSrc_pfnSPR_Height_t ) ( HSPRITE hPic, int frame ); +typedef int (*pfnEngSrc_pfnSPR_Width_t ) ( HSPRITE hPic, int frame ); +typedef void (*pfnEngSrc_pfnSPR_Set_t ) ( HSPRITE hPic, int r, int g, int b ); +typedef void (*pfnEngSrc_pfnSPR_Draw_t ) ( int frame, int x, int y, const struct rect_s *prc ); +typedef void (*pfnEngSrc_pfnSPR_DrawHoles_t ) ( int frame, int x, int y, const struct rect_s *prc ); +typedef void (*pfnEngSrc_pfnSPR_DrawAdditive_t ) ( int frame, int x, int y, const struct rect_s *prc ); +typedef void (*pfnEngSrc_pfnSPR_EnableScissor_t ) ( int x, int y, int width, int height ); +typedef void (*pfnEngSrc_pfnSPR_DisableScissor_t ) ( void ); +typedef struct client_sprite_s * (*pfnEngSrc_pfnSPR_GetList_t ) ( char *psz, int *piCount ); +typedef void (*pfnEngSrc_pfnFillRGBA_t ) ( int x, int y, int width, int height, int r, int g, int b, int a ); +typedef int (*pfnEngSrc_pfnGetScreenInfo_t ) ( struct SCREENINFO_s *pscrinfo ); +typedef void (*pfnEngSrc_pfnSetCrosshair_t ) ( HSPRITE hspr, wrect_t rc, int r, int g, int b ); +typedef struct cvar_s * (*pfnEngSrc_pfnRegisterVariable_t ) ( char *szName, char *szValue, int flags ); +typedef float (*pfnEngSrc_pfnGetCvarFloat_t ) ( char *szName ); +typedef char* (*pfnEngSrc_pfnGetCvarString_t ) ( char *szName ); +typedef int (*pfnEngSrc_pfnAddCommand_t ) ( char *cmd_name, void (*pfnEngSrc_function)(void) ); +typedef int (*pfnEngSrc_pfnHookUserMsg_t ) ( char *szMsgName, pfnUserMsgHook pfn ); +typedef int (*pfnEngSrc_pfnServerCmd_t ) ( char *szCmdString ); +typedef int (*pfnEngSrc_pfnClientCmd_t ) ( char *szCmdString ); +typedef void (*pfnEngSrc_pfnPrimeMusicStream_t ) ( char *szFilename, int looping ); +typedef void (*pfnEngSrc_pfnGetPlayerInfo_t ) ( int ent_num, struct hud_player_info_s *pinfo ); +typedef void (*pfnEngSrc_pfnPlaySoundByName_t ) ( char *szSound, float volume ); +typedef void (*pfnEngSrc_pfnPlaySoundByNameAtPitch_t ) ( char *szSound, float volume, int pitch ); +typedef void (*pfnEngSrc_pfnPlaySoundVoiceByName_t ) ( char *szSound, float volume, int pitch ); +typedef void (*pfnEngSrc_pfnPlaySoundByIndex_t ) ( int iSound, float volume ); +typedef void (*pfnEngSrc_pfnAngleVectors_t ) ( const float * vecAngles, float * forward, float * right, float * up ); +typedef struct client_textmessage_s*(*pfnEngSrc_pfnTextMessageGet_t ) ( const char *pName ); +typedef int (*pfnEngSrc_pfnDrawCharacter_t ) ( int x, int y, int number, int r, int g, int b ); +typedef int (*pfnEngSrc_pfnDrawConsoleString_t ) ( int x, int y, char *string ); +typedef void (*pfnEngSrc_pfnDrawSetTextColor_t ) ( float r, float g, float b ); +typedef void (*pfnEngSrc_pfnDrawConsoleStringLen_t )( const char *string, int *length, int *height ); +typedef void (*pfnEngSrc_pfnConsolePrint_t ) ( const char *string ); +typedef void (*pfnEngSrc_pfnCenterPrint_t ) ( const char *string ); +typedef int (*pfnEngSrc_GetWindowCenterX_t ) ( void ); +typedef int (*pfnEngSrc_GetWindowCenterY_t ) ( void ); +typedef void (*pfnEngSrc_GetViewAngles_t ) ( float * ); +typedef void (*pfnEngSrc_SetViewAngles_t ) ( float * ); +typedef int (*pfnEngSrc_GetMaxClients_t ) ( void ); +typedef void (*pfnEngSrc_Cvar_SetValue_t ) ( char *cvar, float value ); +typedef int (*pfnEngSrc_Cmd_Argc_t) (void); +typedef char * (*pfnEngSrc_Cmd_Argv_t ) ( int arg ); +typedef void (*pfnEngSrc_Con_Printf_t ) ( char *fmt, ... ); +typedef void (*pfnEngSrc_Con_DPrintf_t ) ( char *fmt, ... ); +typedef void (*pfnEngSrc_Con_NPrintf_t ) ( int pos, char *fmt, ... ); +typedef void (*pfnEngSrc_Con_NXPrintf_t ) ( struct con_nprint_s *info, char *fmt, ... ); +typedef const char * (*pfnEngSrc_PhysInfo_ValueForKey_t ) ( const char *key ); +typedef const char * (*pfnEngSrc_ServerInfo_ValueForKey_t )( const char *key ); +typedef float (*pfnEngSrc_GetClientMaxspeed_t ) ( void ); +typedef int (*pfnEngSrc_CheckParm_t ) ( char *parm, char **ppnext ); +typedef void (*pfnEngSrc_Key_Event_t ) ( int key, int down ); +typedef void (*pfnEngSrc_GetMousePosition_t ) ( int *mx, int *my ); +typedef int (*pfnEngSrc_IsNoClipping_t ) ( void ); +typedef struct cl_entity_s * (*pfnEngSrc_GetLocalPlayer_t ) ( void ); +typedef struct cl_entity_s * (*pfnEngSrc_GetViewModel_t ) ( void ); +typedef struct cl_entity_s * (*pfnEngSrc_GetEntityByIndex_t ) ( int idx ); +typedef float (*pfnEngSrc_GetClientTime_t ) ( void ); +typedef void (*pfnEngSrc_V_CalcShake_t ) ( void ); +typedef void (*pfnEngSrc_V_ApplyShake_t ) ( float *origin, float *angles, float factor ); +typedef int (*pfnEngSrc_PM_PointContents_t ) ( float *point, int *truecontents ); +typedef int (*pfnEngSrc_PM_WaterEntity_t ) ( float *p ); +typedef struct pmtrace_s * (*pfnEngSrc_PM_TraceLine_t ) ( float *start, float *end, int flags, int usehull, int ignore_pe ); +typedef struct model_s * (*pfnEngSrc_CL_LoadModel_t ) ( const char *modelname, int *index ); +typedef int (*pfnEngSrc_CL_CreateVisibleEntity_t ) ( int type, struct cl_entity_s *ent ); +typedef const struct model_s * (*pfnEngSrc_GetSpritePointer_t ) ( HSPRITE hSprite ); +typedef void (*pfnEngSrc_pfnPlaySoundByNameAtLocation_t ) ( char *szSound, float volume, float *origin ); +typedef unsigned short (*pfnEngSrc_pfnPrecacheEvent_t ) ( int type, const char* psz ); +typedef void (*pfnEngSrc_pfnPlaybackEvent_t ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); +typedef void (*pfnEngSrc_pfnWeaponAnim_t ) ( int iAnim, int body ); +typedef float (*pfnEngSrc_pfnRandomFloat_t ) ( float flLow, float flHigh ); +typedef int32 (*pfnEngSrc_pfnRandomLong_t ) ( int32 lLow, int32 lHigh ); +typedef void (*pfnEngSrc_pfnHookEvent_t ) ( char *name, void ( *pfnEvent )( struct event_args_s *args ) ); +typedef int (*pfnEngSrc_Con_IsVisible_t) (); +typedef const char * (*pfnEngSrc_pfnGetGameDirectory_t ) ( void ); +typedef struct cvar_s * (*pfnEngSrc_pfnGetCvarPointer_t ) ( const char *szName ); +typedef const char * (*pfnEngSrc_Key_LookupBinding_t ) ( const char *pBinding ); +typedef const char * (*pfnEngSrc_pfnGetLevelName_t ) ( void ); +typedef void (*pfnEngSrc_pfnGetScreenFade_t ) ( struct screenfade_s *fade ); +typedef void (*pfnEngSrc_pfnSetScreenFade_t ) ( struct screenfade_s *fade ); +typedef void * (*pfnEngSrc_VGui_GetPanel_t ) ( ); +typedef void (*pfnEngSrc_VGui_ViewportPaintBackground_t ) (int extents[4]); +typedef byte* (*pfnEngSrc_COM_LoadFile_t ) ( char *path, int usehunk, int *pLength ); +typedef char* (*pfnEngSrc_COM_ParseFile_t ) ( char *data, char *token ); +typedef void (*pfnEngSrc_COM_FreeFile_t) ( void *buffer ); +typedef struct triangleapi_s * pTriAPI; +typedef struct efx_api_s * pEfxAPI; +typedef struct event_api_s * pEventAPI; +typedef struct demo_api_s * pDemoAPI; +typedef struct net_api_s * pNetAPI; +typedef struct IVoiceTweak_s * pVoiceTweak; +typedef int (*pfnEngSrc_IsSpectateOnly_t ) ( void ); +typedef struct model_s * (*pfnEngSrc_LoadMapSprite_t ) ( const char *filename ); +typedef void (*pfnEngSrc_COM_AddAppDirectoryToSearchPath_t ) ( const char *pszBaseDir, const char *appName ); +typedef int (*pfnEngSrc_COM_ExpandFilename_t) ( const char *fileName, char *nameOutBuffer, int nameOutBufferSize ); +typedef const char * (*pfnEngSrc_PlayerInfo_ValueForKey_t )( int playerNum, const char *key ); +typedef void (*pfnEngSrc_PlayerInfo_SetValueForKey_t )( const char *key, const char *value ); +typedef qboolean (*pfnEngSrc_GetPlayerUniqueID_t)(int iPlayer, char playerID[16]); +typedef int (*pfnEngSrc_GetTrackerIDForPlayer_t)(int playerSlot); +typedef int (*pfnEngSrc_GetPlayerForTrackerID_t)(int trackerID); +typedef int (*pfnEngSrc_pfnServerCmdUnreliable_t )( char *szCmdString ); +typedef void (*pfnEngSrc_GetMousePos_t )(struct tagPOINT *ppt); +typedef void (*pfnEngSrc_SetMousePos_t )(int x, int y); +typedef void (*pfnEngSrc_SetMouseEnable_t)(qboolean fEnable); +typedef struct cvar_s * (*pfnEngSrc_GetFirstCVarPtr_t)(); +typedef unsigned int (*pfnEngSrc_GetFirstCmdFunctionHandle_t)(); +typedef unsigned int (*pfnEngSrc_GetNextCmdFunctionHandle_t)(unsigned int cmdhandle); +typedef const char * (*pfnEngSrc_GetCmdFunctionName_t)(unsigned int cmdhandle); +typedef float (*pfnEngSrc_GetClientOldTime_t)(); +typedef float (*pfnEngSrc_GetServerGravityValue_t)(); +typedef struct model_s * (*pfnEngSrc_GetModelByIndex_t)( int index ); +typedef void (*pfnEngSrc_pfnSetFilterMode_t )( int mode ); +typedef void (*pfnEngSrc_pfnSetFilterColor_t )( float r, float g, float b ); +typedef void (*pfnEngSrc_pfnSetFilterBrightness_t )( float brightness ); +typedef sequenceEntry_s* (*pfnEngSrc_pfnSequenceGet_t )( const char *fileName, const char* entryName ); +typedef void (*pfnEngSrc_pfnSPR_DrawGeneric_t )( int frame, int x, int y, const struct rect_s *prc, int src, int dest, int w, int h ); +typedef sentenceEntry_s* (*pfnEngSrc_pfnSequencePickSentence_t )( const char *sentenceName, int pickMethod, int* entryPicked ); +// draw a complete string +typedef int (*pfnEngSrc_pfnDrawString_t ) ( int x, int y, const char *str, int r, int g, int b ); +typedef int (*pfnEngSrc_pfnDrawStringReverse_t ) ( int x, int y, const char *str, int r, int g, int b ); +typedef const char * (*pfnEngSrc_LocalPlayerInfo_ValueForKey_t )( const char *key ); +typedef int (*pfnEngSrc_pfnVGUI2DrawCharacter_t ) ( int x, int y, int ch, unsigned int font ); +typedef int (*pfnEngSrc_pfnVGUI2DrawCharacterAdd_t ) ( int x, int y, int ch, int r, int g, int b, unsigned int font); +typedef unsigned int (*pfnEngSrc_COM_GetApproxWavePlayLength ) ( const char * filename); +typedef void * (*pfnEngSrc_pfnGetCareerUI_t)(); +typedef void (*pfnEngSrc_Cvar_Set_t ) ( char *cvar, char *value ); +typedef int (*pfnEngSrc_pfnIsPlayingCareerMatch_t)(); +typedef double (*pfnEngSrc_GetAbsoluteTime_t) ( void ); +typedef void (*pfnEngSrc_pfnProcessTutorMessageDecayBuffer_t)(int *buffer, int bufferLength); +typedef void (*pfnEngSrc_pfnConstructTutorMessageDecayBuffer_t)(int *buffer, int bufferLength); +typedef void (*pfnEngSrc_pfnResetTutorMessageDecayData_t)(); +typedef void (*pfnEngSrc_pfnFillRGBABlend_t ) ( int x, int y, int width, int height, int r, int g, int b, int a ); +typedef int (*pfnEngSrc_pfnGetAppID_t) ( void ); +typedef cmdalias_t* (*pfnEngSrc_pfnGetAliases_t) ( void ); +typedef void (*pfnEngSrc_pfnVguiWrap2_GetMouseDelta_t) ( int *x, int *y ); + +// Pointers to the exported engine functions themselves +typedef struct cl_enginefuncs_s +{ + pfnEngSrc_pfnSPR_Load_t pfnSPR_Load; + pfnEngSrc_pfnSPR_Frames_t pfnSPR_Frames; + pfnEngSrc_pfnSPR_Height_t pfnSPR_Height; + pfnEngSrc_pfnSPR_Width_t pfnSPR_Width; + pfnEngSrc_pfnSPR_Set_t pfnSPR_Set; + pfnEngSrc_pfnSPR_Draw_t pfnSPR_Draw; + pfnEngSrc_pfnSPR_DrawHoles_t pfnSPR_DrawHoles; + pfnEngSrc_pfnSPR_DrawAdditive_t pfnSPR_DrawAdditive; + pfnEngSrc_pfnSPR_EnableScissor_t pfnSPR_EnableScissor; + pfnEngSrc_pfnSPR_DisableScissor_t pfnSPR_DisableScissor; + pfnEngSrc_pfnSPR_GetList_t pfnSPR_GetList; + pfnEngSrc_pfnFillRGBA_t pfnFillRGBA; + pfnEngSrc_pfnGetScreenInfo_t pfnGetScreenInfo; + pfnEngSrc_pfnSetCrosshair_t pfnSetCrosshair; + pfnEngSrc_pfnRegisterVariable_t pfnRegisterVariable; + pfnEngSrc_pfnGetCvarFloat_t pfnGetCvarFloat; + pfnEngSrc_pfnGetCvarString_t pfnGetCvarString; + pfnEngSrc_pfnAddCommand_t pfnAddCommand; + pfnEngSrc_pfnHookUserMsg_t pfnHookUserMsg; + pfnEngSrc_pfnServerCmd_t pfnServerCmd; + pfnEngSrc_pfnClientCmd_t pfnClientCmd; + pfnEngSrc_pfnGetPlayerInfo_t pfnGetPlayerInfo; + pfnEngSrc_pfnPlaySoundByName_t pfnPlaySoundByName; + pfnEngSrc_pfnPlaySoundByIndex_t pfnPlaySoundByIndex; + pfnEngSrc_pfnAngleVectors_t pfnAngleVectors; + pfnEngSrc_pfnTextMessageGet_t pfnTextMessageGet; + pfnEngSrc_pfnDrawCharacter_t pfnDrawCharacter; + pfnEngSrc_pfnDrawConsoleString_t pfnDrawConsoleString; + pfnEngSrc_pfnDrawSetTextColor_t pfnDrawSetTextColor; + pfnEngSrc_pfnDrawConsoleStringLen_t pfnDrawConsoleStringLen; + pfnEngSrc_pfnConsolePrint_t pfnConsolePrint; + pfnEngSrc_pfnCenterPrint_t pfnCenterPrint; + pfnEngSrc_GetWindowCenterX_t GetWindowCenterX; + pfnEngSrc_GetWindowCenterY_t GetWindowCenterY; + pfnEngSrc_GetViewAngles_t GetViewAngles; + pfnEngSrc_SetViewAngles_t SetViewAngles; + pfnEngSrc_GetMaxClients_t GetMaxClients; + pfnEngSrc_Cvar_SetValue_t Cvar_SetValue; + pfnEngSrc_Cmd_Argc_t Cmd_Argc; + pfnEngSrc_Cmd_Argv_t Cmd_Argv; + pfnEngSrc_Con_Printf_t Con_Printf; + pfnEngSrc_Con_DPrintf_t Con_DPrintf; + pfnEngSrc_Con_NPrintf_t Con_NPrintf; + pfnEngSrc_Con_NXPrintf_t Con_NXPrintf; + pfnEngSrc_PhysInfo_ValueForKey_t PhysInfo_ValueForKey; + pfnEngSrc_ServerInfo_ValueForKey_t ServerInfo_ValueForKey; + pfnEngSrc_GetClientMaxspeed_t GetClientMaxspeed; + pfnEngSrc_CheckParm_t CheckParm; + pfnEngSrc_Key_Event_t Key_Event; + pfnEngSrc_GetMousePosition_t GetMousePosition; + pfnEngSrc_IsNoClipping_t IsNoClipping; + pfnEngSrc_GetLocalPlayer_t GetLocalPlayer; + pfnEngSrc_GetViewModel_t GetViewModel; + pfnEngSrc_GetEntityByIndex_t GetEntityByIndex; + pfnEngSrc_GetClientTime_t GetClientTime; + pfnEngSrc_V_CalcShake_t V_CalcShake; + pfnEngSrc_V_ApplyShake_t V_ApplyShake; + pfnEngSrc_PM_PointContents_t PM_PointContents; + pfnEngSrc_PM_WaterEntity_t PM_WaterEntity; + pfnEngSrc_PM_TraceLine_t PM_TraceLine; + pfnEngSrc_CL_LoadModel_t CL_LoadModel; + pfnEngSrc_CL_CreateVisibleEntity_t CL_CreateVisibleEntity; + pfnEngSrc_GetSpritePointer_t GetSpritePointer; + pfnEngSrc_pfnPlaySoundByNameAtLocation_t pfnPlaySoundByNameAtLocation; + pfnEngSrc_pfnPrecacheEvent_t pfnPrecacheEvent; + pfnEngSrc_pfnPlaybackEvent_t pfnPlaybackEvent; + pfnEngSrc_pfnWeaponAnim_t pfnWeaponAnim; + pfnEngSrc_pfnRandomFloat_t pfnRandomFloat; + pfnEngSrc_pfnRandomLong_t pfnRandomLong; + pfnEngSrc_pfnHookEvent_t pfnHookEvent; + pfnEngSrc_Con_IsVisible_t Con_IsVisible; + pfnEngSrc_pfnGetGameDirectory_t pfnGetGameDirectory; + pfnEngSrc_pfnGetCvarPointer_t pfnGetCvarPointer; + pfnEngSrc_Key_LookupBinding_t Key_LookupBinding; + pfnEngSrc_pfnGetLevelName_t pfnGetLevelName; + pfnEngSrc_pfnGetScreenFade_t pfnGetScreenFade; + pfnEngSrc_pfnSetScreenFade_t pfnSetScreenFade; + pfnEngSrc_VGui_GetPanel_t VGui_GetPanel; + pfnEngSrc_VGui_ViewportPaintBackground_t VGui_ViewportPaintBackground; + pfnEngSrc_COM_LoadFile_t COM_LoadFile; + pfnEngSrc_COM_ParseFile_t COM_ParseFile; + pfnEngSrc_COM_FreeFile_t COM_FreeFile; + struct triangleapi_s *pTriAPI; + struct efx_api_s *pEfxAPI; + struct event_api_s *pEventAPI; + struct demo_api_s *pDemoAPI; + struct net_api_s *pNetAPI; + struct IVoiceTweak_s *pVoiceTweak; + pfnEngSrc_IsSpectateOnly_t IsSpectateOnly; + pfnEngSrc_LoadMapSprite_t LoadMapSprite; + pfnEngSrc_COM_AddAppDirectoryToSearchPath_t COM_AddAppDirectoryToSearchPath; + pfnEngSrc_COM_ExpandFilename_t COM_ExpandFilename; + pfnEngSrc_PlayerInfo_ValueForKey_t PlayerInfo_ValueForKey; + pfnEngSrc_PlayerInfo_SetValueForKey_t PlayerInfo_SetValueForKey; + pfnEngSrc_GetPlayerUniqueID_t GetPlayerUniqueID; + pfnEngSrc_GetTrackerIDForPlayer_t GetTrackerIDForPlayer; + pfnEngSrc_GetPlayerForTrackerID_t GetPlayerForTrackerID; + pfnEngSrc_pfnServerCmdUnreliable_t pfnServerCmdUnreliable; + pfnEngSrc_GetMousePos_t pfnGetMousePos; + pfnEngSrc_SetMousePos_t pfnSetMousePos; + pfnEngSrc_SetMouseEnable_t pfnSetMouseEnable; + pfnEngSrc_GetFirstCVarPtr_t GetFirstCvarPtr; + pfnEngSrc_GetFirstCmdFunctionHandle_t GetFirstCmdFunctionHandle; + pfnEngSrc_GetNextCmdFunctionHandle_t GetNextCmdFunctionHandle; + pfnEngSrc_GetCmdFunctionName_t GetCmdFunctionName; + pfnEngSrc_GetClientOldTime_t hudGetClientOldTime; + pfnEngSrc_GetServerGravityValue_t hudGetServerGravityValue; + pfnEngSrc_GetModelByIndex_t hudGetModelByIndex; + pfnEngSrc_pfnSetFilterMode_t pfnSetFilterMode; + pfnEngSrc_pfnSetFilterColor_t pfnSetFilterColor; + pfnEngSrc_pfnSetFilterBrightness_t pfnSetFilterBrightness; + pfnEngSrc_pfnSequenceGet_t pfnSequenceGet; + pfnEngSrc_pfnSPR_DrawGeneric_t pfnSPR_DrawGeneric; + pfnEngSrc_pfnSequencePickSentence_t pfnSequencePickSentence; + pfnEngSrc_pfnDrawString_t pfnDrawString; + pfnEngSrc_pfnDrawStringReverse_t pfnDrawStringReverse; + pfnEngSrc_LocalPlayerInfo_ValueForKey_t LocalPlayerInfo_ValueForKey; + pfnEngSrc_pfnVGUI2DrawCharacter_t pfnVGUI2DrawCharacter; + pfnEngSrc_pfnVGUI2DrawCharacterAdd_t pfnVGUI2DrawCharacterAdd; + pfnEngSrc_COM_GetApproxWavePlayLength COM_GetApproxWavePlayLength; + pfnEngSrc_pfnGetCareerUI_t pfnGetCareerUI; + pfnEngSrc_Cvar_Set_t Cvar_Set; + pfnEngSrc_pfnIsPlayingCareerMatch_t pfnIsCareerMatch; + pfnEngSrc_pfnPlaySoundVoiceByName_t pfnPlaySoundVoiceByName; + pfnEngSrc_pfnPrimeMusicStream_t pfnPrimeMusicStream; + pfnEngSrc_GetAbsoluteTime_t GetAbsoluteTime; + pfnEngSrc_pfnProcessTutorMessageDecayBuffer_t pfnProcessTutorMessageDecayBuffer; + pfnEngSrc_pfnConstructTutorMessageDecayBuffer_t pfnConstructTutorMessageDecayBuffer; + pfnEngSrc_pfnResetTutorMessageDecayData_t pfnResetTutorMessageDecayData; + pfnEngSrc_pfnPlaySoundByNameAtPitch_t pfnPlaySoundByNameAtPitch; + pfnEngSrc_pfnFillRGBABlend_t pfnFillRGBABlend; + pfnEngSrc_pfnGetAppID_t pfnGetAppID; + pfnEngSrc_pfnGetAliases_t pfnGetAliasList; + pfnEngSrc_pfnVguiWrap2_GetMouseDelta_t pfnVguiWrap2_GetMouseDelta; +} cl_enginefunc_t; + +// Function type declarations for engine destination functions +typedef void (*pfnEngDst_pfnSPR_Load_t ) ( const char ** ); +typedef void (*pfnEngDst_pfnSPR_Frames_t ) ( HSPRITE * ); +typedef void (*pfnEngDst_pfnSPR_Height_t ) ( HSPRITE *, int * ); +typedef void (*pfnEngDst_pfnSPR_Width_t ) ( HSPRITE *, int * ); +typedef void (*pfnEngDst_pfnSPR_Set_t ) ( HSPRITE *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnSPR_Draw_t ) ( int *, int *, int *, const struct rect_s ** ); +typedef void (*pfnEngDst_pfnSPR_DrawHoles_t ) ( int *, int *, int *, const struct rect_s ** ); +typedef void (*pfnEngDst_pfnSPR_DrawAdditive_t ) ( int *, int *, int *, const struct rect_s ** ); +typedef void (*pfnEngDst_pfnSPR_EnableScissor_t ) ( int *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnSPR_DisableScissor_t ) ( void ); +typedef void (*pfnEngDst_pfnSPR_GetList_t ) ( char **, int ** ); +typedef void (*pfnEngDst_pfnFillRGBA_t ) ( int *, int *, int *, int *, int *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnGetScreenInfo_t ) ( struct SCREENINFO_s ** ); +typedef void (*pfnEngDst_pfnSetCrosshair_t ) ( HSPRITE *, struct rect_s *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnRegisterVariable_t ) ( char **, char **, int * ); +typedef void (*pfnEngDst_pfnGetCvarFloat_t ) ( char ** ); +typedef void (*pfnEngDst_pfnGetCvarString_t ) ( char ** ); +typedef void (*pfnEngDst_pfnAddCommand_t ) ( char **, void (**pfnEngDst_function)(void) ); +typedef void (*pfnEngDst_pfnHookUserMsg_t ) ( char **, pfnUserMsgHook * ); +typedef void (*pfnEngDst_pfnServerCmd_t ) ( char ** ); +typedef void (*pfnEngDst_pfnClientCmd_t ) ( char ** ); +typedef void (*pfnEngDst_pfnPrimeMusicStream_t ) ( char **, int *); +typedef void (*pfnEngDst_pfnGetPlayerInfo_t ) ( int *, struct hud_player_info_s ** ); +typedef void (*pfnEngDst_pfnPlaySoundByName_t ) ( char **, float * ); +typedef void (*pfnEngDst_pfnPlaySoundByNameAtPitch_t ) ( char **, float *, int * ); +typedef void (*pfnEngDst_pfnPlaySoundVoiceByName_t ) (char **, float * ); +typedef void (*pfnEngDst_pfnPlaySoundByIndex_t ) ( int *, float * ); +typedef void (*pfnEngDst_pfnAngleVectors_t ) ( const float * *, float * *, float * *, float * * ); +typedef void (*pfnEngDst_pfnTextMessageGet_t ) ( const char ** ); +typedef void (*pfnEngDst_pfnDrawCharacter_t ) ( int *, int *, int *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnDrawConsoleString_t ) ( int *, int *, char ** ); +typedef void (*pfnEngDst_pfnDrawSetTextColor_t ) ( float *, float *, float * ); +typedef void (*pfnEngDst_pfnDrawConsoleStringLen_t ) ( const char **, int **, int ** ); +typedef void (*pfnEngDst_pfnConsolePrint_t ) ( const char ** ); +typedef void (*pfnEngDst_pfnCenterPrint_t ) ( const char ** ); +typedef void (*pfnEngDst_GetWindowCenterX_t ) ( void ); +typedef void (*pfnEngDst_GetWindowCenterY_t ) ( void ); +typedef void (*pfnEngDst_GetViewAngles_t ) ( float ** ); +typedef void (*pfnEngDst_SetViewAngles_t ) ( float ** ); +typedef void (*pfnEngDst_GetMaxClients_t ) ( void ); +typedef void (*pfnEngDst_Cvar_SetValue_t ) ( char **, float * ); +typedef void (*pfnEngDst_Cmd_Argc_t) (void); +typedef void (*pfnEngDst_Cmd_Argv_t ) ( int * ); +typedef void (*pfnEngDst_Con_Printf_t ) ( char **); +typedef void (*pfnEngDst_Con_DPrintf_t ) ( char **); +typedef void (*pfnEngDst_Con_NPrintf_t ) ( int *, char ** ); +typedef void (*pfnEngDst_Con_NXPrintf_t ) ( struct con_nprint_s **, char **); +typedef void (*pfnEngDst_PhysInfo_ValueForKey_t ) ( const char ** ); +typedef void (*pfnEngDst_ServerInfo_ValueForKey_t ) ( const char ** ); +typedef void (*pfnEngDst_GetClientMaxspeed_t ) ( void ); +typedef void (*pfnEngDst_CheckParm_t ) ( char **, char *** ); +typedef void (*pfnEngDst_Key_Event_t ) ( int *, int * ); +typedef void (*pfnEngDst_GetMousePosition_t ) ( int **, int ** ); +typedef void (*pfnEngDst_IsNoClipping_t ) ( void ); +typedef void (*pfnEngDst_GetLocalPlayer_t ) ( void ); +typedef void (*pfnEngDst_GetViewModel_t ) ( void ); +typedef void (*pfnEngDst_GetEntityByIndex_t ) ( int * ); +typedef void (*pfnEngDst_GetClientTime_t ) ( void ); +typedef void (*pfnEngDst_V_CalcShake_t ) ( void ); +typedef void (*pfnEngDst_V_ApplyShake_t ) ( float **, float **, float * ); +typedef void (*pfnEngDst_PM_PointContents_t ) ( float **, int ** ); +typedef void (*pfnEngDst_PM_WaterEntity_t ) ( float ** ); +typedef void (*pfnEngDst_PM_TraceLine_t ) ( float **, float **, int *, int *, int * ); +typedef void (*pfnEngDst_CL_LoadModel_t ) ( const char **, int ** ); +typedef void (*pfnEngDst_CL_CreateVisibleEntity_t ) ( int *, struct cl_entity_s ** ); +typedef void (*pfnEngDst_GetSpritePointer_t ) ( HSPRITE * ); +typedef void (*pfnEngDst_pfnPlaySoundByNameAtLocation_t ) ( char **, float *, float ** ); +typedef void (*pfnEngDst_pfnPrecacheEvent_t ) ( int *, const char* * ); +typedef void (*pfnEngDst_pfnPlaybackEvent_t ) ( int *, const struct edict_s **, unsigned short *, float *, float **, float **, float *, float *, int *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnWeaponAnim_t ) ( int *, int * ); +typedef void (*pfnEngDst_pfnRandomFloat_t ) ( float *, float * ); +typedef void (*pfnEngDst_pfnRandomLong_t ) ( int32 *, int32 * ); +typedef void (*pfnEngDst_pfnHookEvent_t ) ( char **, void ( **pfnEvent )( struct event_args_s *args ) ); +typedef void (*pfnEngDst_Con_IsVisible_t) (); +typedef void (*pfnEngDst_pfnGetGameDirectory_t ) ( void ); +typedef void (*pfnEngDst_pfnGetCvarPointer_t ) ( const char ** ); +typedef void (*pfnEngDst_Key_LookupBinding_t ) ( const char ** ); +typedef void (*pfnEngDst_pfnGetLevelName_t ) ( void ); +typedef void (*pfnEngDst_pfnGetScreenFade_t ) ( struct screenfade_s ** ); +typedef void (*pfnEngDst_pfnSetScreenFade_t ) ( struct screenfade_s ** ); +typedef void (*pfnEngDst_VGui_GetPanel_t ) ( ); +typedef void (*pfnEngDst_VGui_ViewportPaintBackground_t ) (int **); +typedef void (*pfnEngDst_COM_LoadFile_t ) ( char **, int *, int ** ); +typedef void (*pfnEngDst_COM_ParseFile_t ) ( char **, char ** ); +typedef void (*pfnEngDst_COM_FreeFile_t) ( void ** ); +typedef void (*pfnEngDst_IsSpectateOnly_t ) ( void ); +typedef void (*pfnEngDst_LoadMapSprite_t ) ( const char ** ); +typedef void (*pfnEngDst_COM_AddAppDirectoryToSearchPath_t ) ( const char **, const char ** ); +typedef void (*pfnEngDst_COM_ExpandFilename_t) ( const char **, char **, int * ); +typedef void (*pfnEngDst_PlayerInfo_ValueForKey_t ) ( int *, const char ** ); +typedef void (*pfnEngDst_PlayerInfo_SetValueForKey_t )( const char **, const char ** ); +typedef void (*pfnEngDst_GetPlayerUniqueID_t) (int *, char **); +typedef void (*pfnEngDst_GetTrackerIDForPlayer_t) (int *); +typedef void (*pfnEngDst_GetPlayerForTrackerID_t) (int *); +typedef void (*pfnEngDst_pfnServerCmdUnreliable_t ) ( char ** ); +typedef void (*pfnEngDst_GetMousePos_t ) (struct tagPOINT **); +typedef void (*pfnEngDst_SetMousePos_t ) (int *, int *); +typedef void (*pfnEngDst_SetMouseEnable_t ) (qboolean *); +typedef void (*pfnEngDst_pfnSetFilterMode_t) ( int * ); +typedef void (*pfnEngDst_pfnSetFilterColor_t) ( float *, float *, float * ); +typedef void (*pfnEngDst_pfnSetFilterBrightness_t) ( float * ); +typedef void (*pfnEngDst_pfnSequenceGet_t ) ( const char**, const char** ); +typedef void (*pfnEngDst_pfnSPR_DrawGeneric_t ) ( int *, int *, int *, const struct rect_s **, int *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnSequencePickSentence_t ) ( const char**, int *, int ** ); +typedef void (*pfnEngDst_pfnDrawString_t ) ( int *, int *, const char *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnDrawStringReverse_t ) ( int *, int *, const char *, int *, int *, int * ); +typedef void (*pfnEngDst_LocalPlayerInfo_ValueForKey_t )( const char **); +typedef void (*pfnEngDst_pfnVGUI2DrawCharacter_t ) ( int *, int *, int *, unsigned int * ); +typedef void (*pfnEngDst_pfnVGUI2DrawCharacterAdd_t ) ( int *, int *, int *, int *, int *, int *, unsigned int *); +typedef void (*pfnEngDst_pfnProcessTutorMessageDecayBuffer_t )(int **, int *); +typedef void (*pfnEngDst_pfnConstructTutorMessageDecayBuffer_t )(int **, int *); +typedef void (*pfnEngDst_pfnResetTutorMessageDecayData_t)(); +typedef void (*pfnEngDst_pfnFillRGBABlend_t ) ( int *, int *, int *, int *, int *, int *, int *, int * ); +typedef void (*pfnEngDst_pfnGetAppID_t ) ( void ); +typedef void (*pfnEngDst_pfnGetAliases_t ) ( void ); +typedef void (*pfnEngDst_pfnVguiWrap2_GetMouseDelta_t) ( int *x, int *y ); + + +// Pointers to the engine destination functions +typedef struct +{ + pfnEngDst_pfnSPR_Load_t pfnSPR_Load; + pfnEngDst_pfnSPR_Frames_t pfnSPR_Frames; + pfnEngDst_pfnSPR_Height_t pfnSPR_Height; + pfnEngDst_pfnSPR_Width_t pfnSPR_Width; + pfnEngDst_pfnSPR_Set_t pfnSPR_Set; + pfnEngDst_pfnSPR_Draw_t pfnSPR_Draw; + pfnEngDst_pfnSPR_DrawHoles_t pfnSPR_DrawHoles; + pfnEngDst_pfnSPR_DrawAdditive_t pfnSPR_DrawAdditive; + pfnEngDst_pfnSPR_EnableScissor_t pfnSPR_EnableScissor; + pfnEngDst_pfnSPR_DisableScissor_t pfnSPR_DisableScissor; + pfnEngDst_pfnSPR_GetList_t pfnSPR_GetList; + pfnEngDst_pfnFillRGBA_t pfnFillRGBA; + pfnEngDst_pfnGetScreenInfo_t pfnGetScreenInfo; + pfnEngDst_pfnSetCrosshair_t pfnSetCrosshair; + pfnEngDst_pfnRegisterVariable_t pfnRegisterVariable; + pfnEngDst_pfnGetCvarFloat_t pfnGetCvarFloat; + pfnEngDst_pfnGetCvarString_t pfnGetCvarString; + pfnEngDst_pfnAddCommand_t pfnAddCommand; + pfnEngDst_pfnHookUserMsg_t pfnHookUserMsg; + pfnEngDst_pfnServerCmd_t pfnServerCmd; + pfnEngDst_pfnClientCmd_t pfnClientCmd; + pfnEngDst_pfnGetPlayerInfo_t pfnGetPlayerInfo; + pfnEngDst_pfnPlaySoundByName_t pfnPlaySoundByName; + pfnEngDst_pfnPlaySoundByIndex_t pfnPlaySoundByIndex; + pfnEngDst_pfnAngleVectors_t pfnAngleVectors; + pfnEngDst_pfnTextMessageGet_t pfnTextMessageGet; + pfnEngDst_pfnDrawCharacter_t pfnDrawCharacter; + pfnEngDst_pfnDrawConsoleString_t pfnDrawConsoleString; + pfnEngDst_pfnDrawSetTextColor_t pfnDrawSetTextColor; + pfnEngDst_pfnDrawConsoleStringLen_t pfnDrawConsoleStringLen; + pfnEngDst_pfnConsolePrint_t pfnConsolePrint; + pfnEngDst_pfnCenterPrint_t pfnCenterPrint; + pfnEngDst_GetWindowCenterX_t GetWindowCenterX; + pfnEngDst_GetWindowCenterY_t GetWindowCenterY; + pfnEngDst_GetViewAngles_t GetViewAngles; + pfnEngDst_SetViewAngles_t SetViewAngles; + pfnEngDst_GetMaxClients_t GetMaxClients; + pfnEngDst_Cvar_SetValue_t Cvar_SetValue; + pfnEngDst_Cmd_Argc_t Cmd_Argc; + pfnEngDst_Cmd_Argv_t Cmd_Argv; + pfnEngDst_Con_Printf_t Con_Printf; + pfnEngDst_Con_DPrintf_t Con_DPrintf; + pfnEngDst_Con_NPrintf_t Con_NPrintf; + pfnEngDst_Con_NXPrintf_t Con_NXPrintf; + pfnEngDst_PhysInfo_ValueForKey_t PhysInfo_ValueForKey; + pfnEngDst_ServerInfo_ValueForKey_t ServerInfo_ValueForKey; + pfnEngDst_GetClientMaxspeed_t GetClientMaxspeed; + pfnEngDst_CheckParm_t CheckParm; + pfnEngDst_Key_Event_t Key_Event; + pfnEngDst_GetMousePosition_t GetMousePosition; + pfnEngDst_IsNoClipping_t IsNoClipping; + pfnEngDst_GetLocalPlayer_t GetLocalPlayer; + pfnEngDst_GetViewModel_t GetViewModel; + pfnEngDst_GetEntityByIndex_t GetEntityByIndex; + pfnEngDst_GetClientTime_t GetClientTime; + pfnEngDst_V_CalcShake_t V_CalcShake; + pfnEngDst_V_ApplyShake_t V_ApplyShake; + pfnEngDst_PM_PointContents_t PM_PointContents; + pfnEngDst_PM_WaterEntity_t PM_WaterEntity; + pfnEngDst_PM_TraceLine_t PM_TraceLine; + pfnEngDst_CL_LoadModel_t CL_LoadModel; + pfnEngDst_CL_CreateVisibleEntity_t CL_CreateVisibleEntity; + pfnEngDst_GetSpritePointer_t GetSpritePointer; + pfnEngDst_pfnPlaySoundByNameAtLocation_t pfnPlaySoundByNameAtLocation; + pfnEngDst_pfnPrecacheEvent_t pfnPrecacheEvent; + pfnEngDst_pfnPlaybackEvent_t pfnPlaybackEvent; + pfnEngDst_pfnWeaponAnim_t pfnWeaponAnim; + pfnEngDst_pfnRandomFloat_t pfnRandomFloat; + pfnEngDst_pfnRandomLong_t pfnRandomLong; + pfnEngDst_pfnHookEvent_t pfnHookEvent; + pfnEngDst_Con_IsVisible_t Con_IsVisible; + pfnEngDst_pfnGetGameDirectory_t pfnGetGameDirectory; + pfnEngDst_pfnGetCvarPointer_t pfnGetCvarPointer; + pfnEngDst_Key_LookupBinding_t Key_LookupBinding; + pfnEngDst_pfnGetLevelName_t pfnGetLevelName; + pfnEngDst_pfnGetScreenFade_t pfnGetScreenFade; + pfnEngDst_pfnSetScreenFade_t pfnSetScreenFade; + pfnEngDst_VGui_GetPanel_t VGui_GetPanel; + pfnEngDst_VGui_ViewportPaintBackground_t VGui_ViewportPaintBackground; + pfnEngDst_COM_LoadFile_t COM_LoadFile; + pfnEngDst_COM_ParseFile_t COM_ParseFile; + pfnEngDst_COM_FreeFile_t COM_FreeFile; + struct triangleapi_s *pTriAPI; + struct efx_api_s *pEfxAPI; + struct event_api_s *pEventAPI; + struct demo_api_s *pDemoAPI; + struct net_api_s *pNetAPI; + struct IVoiceTweak_s *pVoiceTweak; + pfnEngDst_IsSpectateOnly_t IsSpectateOnly; + pfnEngDst_LoadMapSprite_t LoadMapSprite; + pfnEngDst_COM_AddAppDirectoryToSearchPath_t COM_AddAppDirectoryToSearchPath; + pfnEngDst_COM_ExpandFilename_t COM_ExpandFilename; + pfnEngDst_PlayerInfo_ValueForKey_t PlayerInfo_ValueForKey; + pfnEngDst_PlayerInfo_SetValueForKey_t PlayerInfo_SetValueForKey; + pfnEngDst_GetPlayerUniqueID_t GetPlayerUniqueID; + pfnEngDst_GetTrackerIDForPlayer_t GetTrackerIDForPlayer; + pfnEngDst_GetPlayerForTrackerID_t GetPlayerForTrackerID; + pfnEngDst_pfnServerCmdUnreliable_t pfnServerCmdUnreliable; + pfnEngDst_GetMousePos_t pfnGetMousePos; + pfnEngDst_SetMousePos_t pfnSetMousePos; + pfnEngDst_SetMouseEnable_t pfnSetMouseEnable; + pfnEngDst_pfnSetFilterMode_t pfnSetFilterMode ; + pfnEngDst_pfnSetFilterColor_t pfnSetFilterColor ; + pfnEngDst_pfnSetFilterBrightness_t pfnSetFilterBrightness ; + pfnEngDst_pfnSequenceGet_t pfnSequenceGet; + pfnEngDst_pfnSPR_DrawGeneric_t pfnSPR_DrawGeneric; + pfnEngDst_pfnSequencePickSentence_t pfnSequencePickSentence; + pfnEngDst_pfnDrawString_t pfnDrawString; + pfnEngDst_pfnDrawString_t pfnDrawStringReverse; + pfnEngDst_LocalPlayerInfo_ValueForKey_t LocalPlayerInfo_ValueForKey; + pfnEngDst_pfnVGUI2DrawCharacter_t pfnVGUI2DrawCharacter; + pfnEngDst_pfnVGUI2DrawCharacterAdd_t pfnVGUI2DrawCharacterAdd; + pfnEngDst_pfnPlaySoundVoiceByName_t pfnPlaySoundVoiceByName; + pfnEngDst_pfnPrimeMusicStream_t pfnPrimeMusicStream; + pfnEngDst_pfnProcessTutorMessageDecayBuffer_t pfnProcessTutorMessageDecayBuffer; + pfnEngDst_pfnConstructTutorMessageDecayBuffer_t pfnConstructTutorMessageDecayBuffer; + pfnEngDst_pfnResetTutorMessageDecayData_t pfnResetTutorMessageDecayData; + pfnEngDst_pfnPlaySoundByNameAtPitch_t pfnPlaySoundByNameAtPitch; + pfnEngDst_pfnFillRGBABlend_t pfnFillRGBABlend; + pfnEngDst_pfnGetAppID_t pfnGetAppID; + pfnEngDst_pfnGetAliases_t pfnGetAliasList; + pfnEngDst_pfnVguiWrap2_GetMouseDelta_t pfnVguiWrap2_GetMouseDelta; +} cl_enginefunc_dst_t; + + +// ******************************************************** +// Functions exposed by the engine to the module +// ******************************************************** + +// Functions for ModuleS +typedef void (*PFN_KICKPLAYER)(int nPlayerSlot, int nReason); + +typedef struct modshelpers_s +{ + PFN_KICKPLAYER m_pfnKickPlayer; + + // reserved for future expansion + int m_nVoid1; + int m_nVoid2; + int m_nVoid3; + int m_nVoid4; + int m_nVoid5; + int m_nVoid6; + int m_nVoid7; + int m_nVoid8; + int m_nVoid9; +} modshelpers_t; + +// Functions for moduleC +typedef struct modchelpers_s +{ + // reserved for future expansion + int m_nVoid0; + int m_nVoid1; + int m_nVoid2; + int m_nVoid3; + int m_nVoid4; + int m_nVoid5; + int m_nVoid6; + int m_nVoid7; + int m_nVoid8; + int m_nVoid9; +} modchelpers_t; + + +// ******************************************************** +// Information about the engine +// ******************************************************** +typedef struct engdata_s +{ + cl_enginefunc_t *pcl_enginefuncs; // functions exported by the engine + cl_enginefunc_dst_t *pg_engdstAddrs; // destination handlers for engine exports + cldll_func_t *pcl_funcs; // client exports + cldll_func_dst_t *pg_cldstAddrs; // client export destination handlers + struct modfuncs_s *pg_modfuncs; // engine's pointer to module functions + struct cmd_function_s **pcmd_functions; // list of all registered commands + void *pkeybindings; // all key bindings (not really a void *, but easier this way) + void (*pfnConPrintf)(char *, ...); // dump to console + struct cvar_s **pcvar_vars; // pointer to head of cvar list + struct glwstate_t *pglwstate; // OpenGl information + void *(*pfnSZ_GetSpace)(struct sizebuf_s *, int); // pointer to SZ_GetSpace + struct modfuncs_s *pmodfuncs; // &g_modfuncs + void *pfnGetProcAddress; // &GetProcAddress + void *pfnGetModuleHandle; // &GetModuleHandle + struct server_static_s *psvs; // &svs + struct client_static_s *pcls; // &cls + void (*pfnSV_DropClient)(struct client_s *, qboolean, char *, ...); // pointer to SV_DropClient + void (*pfnNetchan_Transmit)(struct netchan_s *, int, byte *); // pointer to Netchan_Transmit + void (*pfnNET_SendPacket)(enum netsrc_s sock, int length, void *data, netadr_t to); // &NET_SendPacket + struct cvar_s *(*pfnCvarFindVar)(const char *pchName); // pointer to Cvar_FindVar + int *phinstOpenGlEarly; // &g_hinstOpenGlEarly + + // Reserved for future expansion + void *pVoid0; // reserved for future expan + void *pVoid1; // reserved for future expan + void *pVoid2; // reserved for future expan + void *pVoid3; // reserved for future expan + void *pVoid4; // reserved for future expan + void *pVoid5; // reserved for future expan + void *pVoid6; // reserved for future expan + void *pVoid7; // reserved for future expan + void *pVoid8; // reserved for future expan + void *pVoid9; // reserved for future expan +} engdata_t; + + +// ******************************************************** +// Functions exposed by the security module +// ******************************************************** +typedef void (*PFN_LOADMOD)(char *pchModule); +typedef void (*PFN_CLOSEMOD)(void); +typedef int (*PFN_NCALL)(int ijump, int cnArg, ...); + +typedef void (*PFN_GETCLDSTADDRS)(cldll_func_dst_t *pcldstAddrs); +typedef void (*PFN_GETENGDSTADDRS)(cl_enginefunc_dst_t *pengdstAddrs); +typedef void (*PFN_MODULELOADED)(void); + +typedef void (*PFN_PROCESSOUTGOINGNET)(struct netchan_s *pchan, struct sizebuf_s *psizebuf); +typedef qboolean (*PFN_PROCESSINCOMINGNET)(struct netchan_s *pchan, struct sizebuf_s *psizebuf); + +typedef void (*PFN_TEXTURELOAD)(char *pszName, int dxWidth, int dyHeight, char *pbData); +typedef void (*PFN_MODELLOAD)(struct model_s *pmodel, void *pvBuf); + +typedef void (*PFN_FRAMEBEGIN)(void); +typedef void (*PFN_FRAMERENDER1)(void); +typedef void (*PFN_FRAMERENDER2)(void); + +typedef void (*PFN_SETMODSHELPERS)(modshelpers_t *pmodshelpers); +typedef void (*PFN_SETMODCHELPERS)(modchelpers_t *pmodchelpers); +typedef void (*PFN_SETENGDATA)(engdata_t *pengdata); + +typedef void (*PFN_CONNECTCLIENT)(int iPlayer); +typedef void (*PFN_RECORDIP)(unsigned int pnIP); +typedef void (*PFN_PLAYERSTATUS)(unsigned char *pbData, int cbData); + +typedef void (*PFN_SETENGINEVERSION)(int nVersion); + +// typedef class CMachine *(*PFN_PCMACHINE)(void); +typedef int (*PFN_PCMACHINE)(void); +typedef void (*PFN_SETIP)(int ijump); +typedef void (*PFN_EXECUTE)(void); + +typedef struct modfuncs_s +{ + // Functions for the pcode interpreter + PFN_LOADMOD m_pfnLoadMod; + PFN_CLOSEMOD m_pfnCloseMod; + PFN_NCALL m_pfnNCall; + + // API destination functions + PFN_GETCLDSTADDRS m_pfnGetClDstAddrs; + PFN_GETENGDSTADDRS m_pfnGetEngDstAddrs; + + // Miscellaneous functions + PFN_MODULELOADED m_pfnModuleLoaded; // Called right after the module is loaded + + // Functions for processing network traffic + PFN_PROCESSOUTGOINGNET m_pfnProcessOutgoingNet; // Every outgoing packet gets run through this + PFN_PROCESSINCOMINGNET m_pfnProcessIncomingNet; // Every incoming packet gets run through this + + // Resource functions + PFN_TEXTURELOAD m_pfnTextureLoad; // Called as each texture is loaded + PFN_MODELLOAD m_pfnModelLoad; // Called as each model is loaded + + // Functions called every frame + PFN_FRAMEBEGIN m_pfnFrameBegin; // Called at the beginning of each frame cycle + PFN_FRAMERENDER1 m_pfnFrameRender1; // Called at the beginning of the render loop + PFN_FRAMERENDER2 m_pfnFrameRender2; // Called at the end of the render loop + + // Module helper transfer + PFN_SETMODSHELPERS m_pfnSetModSHelpers; + PFN_SETMODCHELPERS m_pfnSetModCHelpers; + PFN_SETENGDATA m_pfnSetEngData; + + // Which version of the module is this? + int m_nVersion; + + // Miscellaneous game stuff + PFN_CONNECTCLIENT m_pfnConnectClient; // Called whenever a new client connects + PFN_RECORDIP m_pfnRecordIP; // Secure master has reported a new IP for us + PFN_PLAYERSTATUS m_pfnPlayerStatus; // Called whenever we receive a PlayerStatus packet + + // Recent additions + PFN_SETENGINEVERSION m_pfnSetEngineVersion; // 1 = patched engine + + // reserved for future expansion + int m_nVoid2; + int m_nVoid3; + int m_nVoid4; + int m_nVoid5; + int m_nVoid6; + int m_nVoid7; + int m_nVoid8; + int m_nVoid9; +} modfuncs_t; + + +#define k_nEngineVersion15Base 0 +#define k_nEngineVersion15Patch 1 +#define k_nEngineVersion16Base 2 +#define k_nEngineVersion16Validated 3 // 1.6 engine with built-in validation + + +typedef struct validator_s +{ + int m_nRandomizer; // Random number to be XOR'd into all subsequent fields + int m_nSignature1; // First signature that identifies this structure + int m_nSignature2; // Second signature + int m_pbCode; // Beginning of the code block + int m_cbCode; // Size of the code block + int m_nChecksum; // Checksum of the code block + int m_nSpecial; // For engine, 1 if hw.dll, 0 if sw.dll. For client, pclfuncs checksum + int m_nCompensator; // Keeps the checksum correct +} validator_t; + + +#define k_nChecksumCompensator 0x36a8f09c // Don't change this value: it's hardcorded in cdll_int.cpp, + +#define k_nModuleVersionCur 0x43210004 + + +#endif // __APIPROXY__ diff --git a/engine/cdll_int.h b/engine/cdll_int.h index 2c70fa5..ce57897 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -1,6 +1,6 @@ /*** * -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* Copyright (c) 1999, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. @@ -27,7 +27,10 @@ extern "C" { #endif #include "const.h" - +#include "steam/steamtypes.h" +#include "ref_params.h" +#include "r_efx.h" +#include "studio_event.h" // this file is included by both the engine and the client-dll, // so make sure engine declarations aren't done twice @@ -56,6 +59,7 @@ typedef struct client_data_s // fields that can be changed by the cldll vec3_t viewangles; int iWeaponBits; +// int iAccessoryBits; float fov; // field of view } client_data_t; @@ -68,20 +72,7 @@ typedef struct client_sprite_s wrect_t rc; } client_sprite_t; -typedef struct client_textmessage_s -{ - int effect; - byte r1, g1, b1, a1; // 2 colors for effects - byte r2, g2, b2, a2; - float x; - float y; - float fadein; - float fadeout; - float holdtime; - float fxtime; - const char *pName; - const char *pMessage; -} client_textmessage_t; + typedef struct hud_player_info_s { @@ -89,7 +80,6 @@ typedef struct hud_player_info_s short ping; byte thisplayer; // TRUE if this is the calling player - // stuff that's unused at the moment, but should be done byte spectator; byte packetloss; @@ -97,160 +87,21 @@ typedef struct hud_player_info_s short topcolor; short bottomcolor; + uint64 m_nSteamID; } hud_player_info_t; -typedef struct cl_enginefuncs_s + +typedef struct module_s { - // sprite handlers - HSPRITE ( *pfnSPR_Load ) ( const char *szPicName ); - int ( *pfnSPR_Frames ) ( HSPRITE hPic ); - int ( *pfnSPR_Height ) ( HSPRITE hPic, int frame ); - int ( *pfnSPR_Width ) ( HSPRITE hPic, int frame ); - void ( *pfnSPR_Set ) ( HSPRITE hPic, int r, int g, int b ); - void ( *pfnSPR_Draw ) ( int frame, int x, int y, const wrect_t *prc ); - void ( *pfnSPR_DrawHoles ) ( int frame, int x, int y, const wrect_t *prc ); - void ( *pfnSPR_DrawAdditive ) ( int frame, int x, int y, const wrect_t *prc ); - void ( *pfnSPR_EnableScissor ) ( int x, int y, int width, int height ); - void ( *pfnSPR_DisableScissor ) ( void ); - client_sprite_t *( *pfnSPR_GetList ) ( char *psz, int *piCount ); - - // screen handlers - void ( *pfnFillRGBA ) ( int x, int y, int width, int height, int r, int g, int b, int a ); - int ( *pfnGetScreenInfo ) ( SCREENINFO *pscrinfo ); - void ( *pfnSetCrosshair ) ( HSPRITE hspr, wrect_t rc, int r, int g, int b ); - - // cvar handlers - struct cvar_s *( *pfnRegisterVariable ) ( char *szName, char *szValue, int flags ); - float ( *pfnGetCvarFloat ) ( char *szName ); - char* ( *pfnGetCvarString ) ( char *szName ); - - // command handlers - int ( *pfnAddCommand ) ( char *cmd_name, void (*function)(void) ); - int ( *pfnHookUserMsg ) ( char *szMsgName, pfnUserMsgHook pfn ); - int ( *pfnServerCmd ) ( char *szCmdString ); - int ( *pfnClientCmd ) ( char *szCmdString ); - - void ( *pfnGetPlayerInfo ) ( int ent_num, hud_player_info_t *pinfo ); - - // sound handlers - void ( *pfnPlaySoundByName ) ( char *szSound, float volume ); - void ( *pfnPlaySoundByIndex ) ( int iSound, float volume ); - - // vector helpers - void ( *pfnAngleVectors ) ( const float * vecAngles, float * forward, float * right, float * up ); - - // text message system - client_textmessage_t *( *pfnTextMessageGet ) ( const char *pName ); - int ( *pfnDrawCharacter ) ( int x, int y, int number, int r, int g, int b ); - int ( *pfnDrawConsoleString ) ( int x, int y, char *string ); - void ( *pfnDrawSetTextColor ) ( float r, float g, float b ); - void ( *pfnDrawConsoleStringLen )( const char *string, int *length, int *height ); - - void ( *pfnConsolePrint ) ( const char *string ); - void ( *pfnCenterPrint ) ( const char *string ); + unsigned char ucMD5Hash[16]; // hash over code + qboolean fLoaded; // true if successfully loaded +} module_t; -// Added for user input processing - int ( *GetWindowCenterX ) ( void ); - int ( *GetWindowCenterY ) ( void ); - void ( *GetViewAngles ) ( float * ); - void ( *SetViewAngles ) ( float * ); - int ( *GetMaxClients ) ( void ); - void ( *Cvar_SetValue ) ( char *cvar, float value ); - int (*Cmd_Argc) (void); - char *( *Cmd_Argv ) ( int arg ); - void ( *Con_Printf ) ( char *fmt, ... ); - void ( *Con_DPrintf ) ( char *fmt, ... ); - void ( *Con_NPrintf ) ( int pos, char *fmt, ... ); - void ( *Con_NXPrintf ) ( struct con_nprint_s *info, char *fmt, ... ); - - const char *( *PhysInfo_ValueForKey ) ( const char *key ); - const char *( *ServerInfo_ValueForKey )( const char *key ); - float ( *GetClientMaxspeed ) ( void ); - int ( *CheckParm ) ( char *parm, char **ppnext ); - void ( *Key_Event ) ( int key, int down ); - void ( *GetMousePosition ) ( int *mx, int *my ); - int ( *IsNoClipping ) ( void ); - - struct cl_entity_s *( *GetLocalPlayer ) ( void ); - struct cl_entity_s *( *GetViewModel ) ( void ); - struct cl_entity_s *( *GetEntityByIndex ) ( int idx ); - - float ( *GetClientTime ) ( void ); - void ( *V_CalcShake ) ( void ); - void ( *V_ApplyShake ) ( float *origin, float *angles, float factor ); - - int ( *PM_PointContents ) ( float *point, int *truecontents ); - int ( *PM_WaterEntity ) ( float *p ); - struct pmtrace_s *( *PM_TraceLine ) ( float *start, float *end, int flags, int usehull, int ignore_pe ); - - struct model_s *( *CL_LoadModel ) ( const char *modelname, int *index ); - int ( *CL_CreateVisibleEntity ) ( int type, struct cl_entity_s *ent ); - - const struct model_s * ( *GetSpritePointer ) ( HSPRITE hSprite ); - void ( *pfnPlaySoundByNameAtLocation ) ( char *szSound, float volume, float *origin ); - - unsigned short ( *pfnPrecacheEvent ) ( int type, const char* psz ); - void ( *pfnPlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); - void ( *pfnWeaponAnim ) ( int iAnim, int body ); - float ( *pfnRandomFloat ) ( float flLow, float flHigh ); - long ( *pfnRandomLong ) ( long lLow, long lHigh ); - void ( *pfnHookEvent ) ( char *name, void ( *pfnEvent )( struct event_args_s *args ) ); - int (*Con_IsVisible) (); - const char *( *pfnGetGameDirectory ) ( void ); - struct cvar_s *( *pfnGetCvarPointer ) ( const char *szName ); - const char *( *Key_LookupBinding ) ( const char *pBinding ); - const char *( *pfnGetLevelName ) ( void ); - void ( *pfnGetScreenFade ) ( struct screenfade_s *fade ); - void ( *pfnSetScreenFade ) ( struct screenfade_s *fade ); - void *( *VGui_GetPanel ) ( ); - void ( *VGui_ViewportPaintBackground ) (int extents[4]); - - byte* (*COM_LoadFile) ( char *path, int usehunk, int *pLength ); - char* (*COM_ParseFile) ( char *data, char *token ); - void (*COM_FreeFile) ( void *buffer ); + - struct triangleapi_s *pTriAPI; - struct efx_api_s *pEfxAPI; - struct event_api_s *pEventAPI; - struct demo_api_s *pDemoAPI; - struct net_api_s *pNetAPI; - struct IVoiceTweak_s *pVoiceTweak; - - // returns 1 if the client is a spectator only (connected to a proxy), 0 otherwise or 2 if in dev_overview mode - int ( *IsSpectateOnly ) ( void ); - struct model_s *( *LoadMapSprite ) ( const char *filename ); - - // file search functions - void ( *COM_AddAppDirectoryToSearchPath ) ( const char *pszBaseDir, const char *appName ); - int ( *COM_ExpandFilename) ( const char *fileName, char *nameOutBuffer, int nameOutBufferSize ); - - // User info - // playerNum is in the range (1, MaxClients) - // returns NULL if player doesn't exit - // returns "" if no value is set - const char *( *PlayerInfo_ValueForKey )( int playerNum, const char *key ); - void ( *PlayerInfo_SetValueForKey )( const char *key, const char *value ); - - // Gets a unique ID for the specified player. This is the same even if you see the player on a different server. - // iPlayer is an entity index, so client 0 would use iPlayer=1. - // Returns false if there is no player on the server in the specified slot. - qboolean (*GetPlayerUniqueID)(int iPlayer, char playerID[16]); - - // TrackerID access - int (*GetTrackerIDForPlayer)(int playerSlot); - int (*GetPlayerForTrackerID)(int trackerID); - - // Same as pfnServerCmd, but the message goes in the unreliable stream so it can't clog the net stream - // (but it might not get there). - int ( *pfnServerCmdUnreliable )( char *szCmdString ); - - void ( *pfnGetMousePos )( struct tagPOINT *ppt ); - void ( *pfnSetMousePos )( int x, int y ); - void ( *pfnSetMouseEnable )( qboolean fEnable ); -} cl_enginefunc_t; #ifndef IN_BUTTONS_H #include "in_buttons.h" @@ -258,6 +109,11 @@ typedef struct cl_enginefuncs_s #define CLDLL_INTERFACE_VERSION 7 +extern void LoadSecurityModuleFromDisk(char * pszDllName); +extern void LoadSecurityModuleFromMemory( unsigned char * pCode, int nSize ); +extern void CloseSecurityModule(); + + extern void ClientDLL_Init( void ); // from cdll_int.c extern void ClientDLL_Shutdown( void ); extern void ClientDLL_HudInit( void ); @@ -302,10 +158,310 @@ extern void ClientDLL_TempEntUpdate( double ft, double ct, double grav, struct t extern struct cl_entity_s *ClientDLL_GetUserEntity( int index ); extern void ClientDLL_VoiceStatus(int entindex, qboolean bTalking); extern void ClientDLL_DirectorMessage( int iSize, void *pbuf ); +extern void ClientDLL_ChatInputPosition( int *x, int *y ); +//#include "server.h" // server_static_t define for apiproxy +#include "APIProxy.h" + +extern cldll_func_t cl_funcs; +extern cl_enginefunc_t cl_engsrcProxies; +extern cl_enginefunc_dst_t g_engdstAddrs; + +// Module exports +extern modfuncs_t g_modfuncs; +extern module_t g_module; + +// Macros for exported engine funcs +#define RecEngSPR_Load(a) (g_engdstAddrs.pfnSPR_Load(&a)) +#define RecEngSPR_Frames(a) (g_engdstAddrs.pfnSPR_Frames(&a)) +#define RecEngSPR_Height(a, b) (g_engdstAddrs.pfnSPR_Height(&a, &b)) +#define RecEngSPR_Width(a, b) (g_engdstAddrs.pfnSPR_Width(&a, &b)) +#define RecEngSPR_Set(a, b, c, d) (g_engdstAddrs.pfnSPR_Set(&a, &b, &c, &d)) +#define RecEngSPR_Draw(a, b, c, d) (g_engdstAddrs.pfnSPR_Draw(&a, &b, &c, &d)) +#define RecEngSPR_DrawHoles(a, b, c, d) (g_engdstAddrs.pfnSPR_DrawHoles(&a, &b, &c, &d)) +#define RecEngSPR_DrawAdditive(a, b, c, d) (g_engdstAddrs.pfnSPR_DrawAdditive(&a, &b, &c, &d)) +#define RecEngSPR_EnableScissor(a, b, c, d) (g_engdstAddrs.pfnSPR_EnableScissor(&a, &b, &c, &d)) +#define RecEngSPR_DisableScissor() (g_engdstAddrs.pfnSPR_DisableScissor()) +#define RecEngSPR_GetList(a, b) (g_engdstAddrs.pfnSPR_GetList(&a, &b)) +#define RecEngDraw_FillRGBA(a, b, c, d, e, f, g, h) (g_engdstAddrs.pfnFillRGBA(&a, &b, &c, &d, &e, &f, &g, &h)) +#define RecEnghudGetScreenInfo(a) (g_engdstAddrs.pfnGetScreenInfo(&a)) +#define RecEngSetCrosshair(a, b, c, d, e) (g_engdstAddrs.pfnSetCrosshair(&a, &b, &c, &d, &e)) +#define RecEnghudRegisterVariable(a, b, c) (g_engdstAddrs.pfnRegisterVariable(&a, &b, &c)) +#define RecEnghudGetCvarFloat(a) (g_engdstAddrs.pfnGetCvarFloat(&a)) +#define RecEnghudGetCvarString(a) (g_engdstAddrs.pfnGetCvarString(&a)) +#define RecEnghudAddCommand(a, b) (g_engdstAddrs.pfnAddCommand(&a, &b)) +#define RecEnghudHookUserMsg(a, b) (g_engdstAddrs.pfnHookUserMsg(&a, &b)) +#define RecEnghudServerCmd(a) (g_engdstAddrs.pfnServerCmd(&a)) +#define RecEnghudClientCmd(a) (g_engdstAddrs.pfnClientCmd(&a)) +#define RecEngPrimeMusicStream(a, b) (g_engdstAddrs.pfnPrimeMusicStream(&a, &b)) +#define RecEnghudGetPlayerInfo(a, b) (g_engdstAddrs.pfnGetPlayerInfo(&a, &b)) +#define RecEnghudPlaySoundByName(a, b) (g_engdstAddrs.pfnPlaySoundByName(&a, &b)) +#define RecEnghudPlaySoundByNameAtPitch(a, b, c) (g_engdstAddrs.pfnPlaySoundByNameAtPitch(&a, &b, &c)) +#define RecEnghudPlaySoundVoiceByName(a, b) (g_engdstAddrs.pfnPlaySoundVoiceByName(&a, &b)) +#define RecEnghudPlaySoundByIndex(a, b) (g_engdstAddrs.pfnPlaySoundByIndex(&a, &b)) +#define RecEngAngleVectors(a, b, c, d) (g_engdstAddrs.pfnAngleVectors(&a, &b, &c, &d)) +#define RecEngTextMessageGet(a) (g_engdstAddrs.pfnTextMessageGet(&a)) +#define RecEngTextMessageDrawCharacter(a, b, c, d, e, f) (g_engdstAddrs.pfnDrawCharacter(&a, &b, &c, &d, &e, &f)) +#define RecEngDrawConsoleString(a, b, c) (g_engdstAddrs.pfnDrawConsoleString(&a, &b, &c)) +#define RecEngDrawSetTextColor(a, b, c) (g_engdstAddrs.pfnDrawSetTextColor(&a, &b, &c)) +#define RecEnghudDrawConsoleStringLen(a, b, c) (g_engdstAddrs.pfnDrawConsoleStringLen(&a, &b, &c)) +#define RecEnghudConsolePrint(a) (g_engdstAddrs.pfnConsolePrint(&a)) +#define RecEnghudCenterPrint(a) (g_engdstAddrs.pfnCenterPrint(&a)) +#define RecEnghudCenterX() (g_engdstAddrs.GetWindowCenterX()) +#define RecEnghudCenterY() (g_engdstAddrs.GetWindowCenterY()) +#define RecEnghudGetViewAngles(a) (g_engdstAddrs.GetViewAngles(&a)) +#define RecEnghudSetViewAngles(a) (g_engdstAddrs.SetViewAngles(&a)) +#define RecEnghudGetMaxClients() (g_engdstAddrs.GetMaxClients()) +#define RecEngCvar_SetValue(a, b) (g_engdstAddrs.Cvar_SetValue(&a, &b)) +#define RecEngCmd_Argc() (g_engdstAddrs.Cmd_Argc()) +#define RecEngCmd_Argv(a) (g_engdstAddrs.Cmd_Argv(&a)) +#define RecEngCon_Printf(a) (g_engdstAddrs.Con_Printf(&a)) +#define RecEngCon_DPrintf(a) (g_engdstAddrs.Con_DPrintf(&a)) +#define RecEngCon_NPrintf(a, b) (g_engdstAddrs.Con_NPrintf(&a, &b)) +#define RecEngCon_NXPrintf(a, b) (g_engdstAddrs.Con_NXPrintf(&a, &b)) +#define RecEnghudPhysInfo_ValueForKey(a) (g_engdstAddrs.PhysInfo_ValueForKey(&a)) +#define RecEnghudServerInfo_ValueForKey(a) (g_engdstAddrs.ServerInfo_ValueForKey(&a)) +#define RecEnghudGetClientMaxspeed() (g_engdstAddrs.GetClientMaxspeed()) +#define RecEnghudCheckParm(a, b) (g_engdstAddrs.CheckParm(&a, &b)) +#define RecEngKey_Event(a, b) (g_engdstAddrs.Key_Event(&a, &b)) +#define RecEnghudGetMousePosition(a, b) (g_engdstAddrs.GetMousePosition(&a, &b)) +#define RecEnghudIsNoClipping() (g_engdstAddrs.IsNoClipping()) +#define RecEnghudGetLocalPlayer() (g_engdstAddrs.GetLocalPlayer()) +#define RecEnghudGetViewModel() (g_engdstAddrs.GetViewModel()) +#define RecEnghudGetEntityByIndex(a) (g_engdstAddrs.GetEntityByIndex(&a)) +#define RecEnghudGetClientTime() (g_engdstAddrs.GetClientTime()) +#define RecEngV_CalcShake() (g_engdstAddrs.V_CalcShake()) +#define RecEngV_ApplyShake(a, b, c) (g_engdstAddrs.V_ApplyShake(&a, &b, &c)) +#define RecEngPM_PointContents(a, b) (g_engdstAddrs.PM_PointContents(&a, &b)) +#define RecEngPM_WaterEntity(a) (g_engdstAddrs.PM_WaterEntity(&a)) +#define RecEngPM_TraceLine(a, b, c, d, e) (g_engdstAddrs.PM_TraceLine(&a, &b, &c, &d, &e)) +#define RecEngCL_LoadModel(a, b) (g_engdstAddrs.CL_LoadModel(&a, &b)) +#define RecEngCL_CreateVisibleEntity(a, b) (g_engdstAddrs.CL_CreateVisibleEntity(&a, &b)) +#define RecEnghudGetSpritePointer(a) (g_engdstAddrs.GetSpritePointer(&a)) +#define RecEnghudPlaySoundByNameAtLocation(a, b, c) (g_engdstAddrs.pfnPlaySoundByNameAtLocation(&a, &b, &c)) +#define RecEnghudPrecacheEvent(a, b) (g_engdstAddrs.pfnPrecacheEvent(&a, &b)) +#define RecEnghudPlaybackEvent(a, b, c, d, e, f, g, h, i, j, k, l) (g_engdstAddrs.pfnPlaybackEvent(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k, &l)) +#define RecEnghudWeaponAnim(a, b) (g_engdstAddrs.pfnWeaponAnim(&a, &b)) +#define RecEngRandomFloat(a, b) (g_engdstAddrs.pfnRandomFloat(&a, &b)) +#define RecEngRandomLong(a, b) (g_engdstAddrs.pfnRandomLong(&a, &b)) +#define RecEngCL_HookEvent(a, b) (g_engdstAddrs.pfnHookEvent(&a, &b)) +#define RecEngCon_IsVisible() (g_engdstAddrs.Con_IsVisible()) +#define RecEnghudGetGameDir() (g_engdstAddrs.pfnGetGameDirectory()) +#define RecEngCvar_FindVar(a) (g_engdstAddrs.pfnGetCvarPointer(&a)) +#define RecEngKey_NameForBinding(a) (g_engdstAddrs.Key_LookupBinding(&a)) +#define RecEnghudGetLevelName() (g_engdstAddrs.pfnGetLevelName()) +#define RecEnghudGetScreenFade(a) (g_engdstAddrs.pfnGetScreenFade(&a)) +#define RecEnghudSetScreenFade(a) (g_engdstAddrs.pfnSetScreenFade(&a)) +#define RecEngVGuiWrap_GetPanel() (g_engdstAddrs.VGui_GetPanel()) +#define RecEngVGui_ViewportPaintBackground(a) (g_engdstAddrs.VGui_ViewportPaintBackground(&a)) +#define RecEngCOM_LoadFile(a, b, c) (g_engdstAddrs.COM_LoadFile(&a, &b, &c)) +#define RecEngCOM_ParseFile(a, b) (g_engdstAddrs.COM_ParseFile(&a, &b)) +#define RecEngCOM_FreeFile(a) (g_engdstAddrs.COM_FreeFile(&a)) +#define RecEngCL_IsSpectateOnly() (g_engdstAddrs.IsSpectateOnly()) +#define RecEngR_LoadMapSprite(a) (g_engdstAddrs.LoadMapSprite(&a)) +#define RecEngCOM_AddAppDirectoryToSearchPath(a, b) (g_engdstAddrs.COM_AddAppDirectoryToSearchPath(&a, &b)) +#define RecEngClientDLL_ExpandFileName(a, b, c) (g_engdstAddrs.COM_ExpandFilename(&a, &b, &c)) +#define RecEngPlayerInfo_ValueForKey(a, b) (g_engdstAddrs.PlayerInfo_ValueForKey(&a, &b)) +#define RecEngPlayerInfo_SetValueForKey(a, b) (g_engdstAddrs.PlayerInfo_SetValueForKey(&a, &b)) +#define RecEngGetPlayerUniqueID(a, b) (g_engdstAddrs.GetPlayerUniqueID(&a, &b)) +#define RecEngGetTrackerIDForPlayer(a) (g_engdstAddrs.GetTrackerIDForPlayer(&a)) +#define RecEngGetPlayerForTrackerID(a) (g_engdstAddrs.GetPlayerForTrackerID(&a)) +#define RecEnghudServerCmdUnreliable(a) (g_engdstAddrs.pfnServerCmdUnreliable(&a)) +#define RecEngGetMousePos(a) (g_engdstAddrs.pfnGetMousePos(&a)) +#define RecEngSetMousePos(a, b) (g_engdstAddrs.pfnSetMousePos(&a, &b)) +#define RecEngSetMouseEnable(a) (g_engdstAddrs.pfnSetMouseEnable(&a)) +#define RecEngSetFilterMode(a) (g_engdstAddrs.pfnSetFilterMode(&a)) +#define RecEngSetFilterColor(a,b,c) (g_engdstAddrs.pfnSetFilterColor(&a,&b,&c)) +#define RecEngSetFilterBrightness(a) (g_engdstAddrs.pfnSetFilterBrightness(&a)) +#define RecEngSequenceGet(a,b) (g_engdstAddrs.pfnSequenceGet(&a,&b)) +#define RecEngSPR_DrawGeneric(a,b,c,d,e,f,g,h) (g_engdstAddrs.pfnSPR_DrawGeneric(&a, &b, &c, &d, &e, &f, &g, &h)) +#define RecEngSequencePickSentence(a,b,c) (g_engdstAddrs.pfnSequencePickSentence(&a, &b, &c)) +#define RecEngLocalPlayerInfo_ValueForKey(a) (g_engdstAddrs.LocalPlayerInfo_ValueForKey(&a)) +#define RecEngProcessTutorMessageDecayBuffer(a, b) (g_engdstAddrs.pfnProcessTutorMessageDecayBuffer(&a, &b)) +#define RecEngConstructTutorMessageDecayBuffer(a, b) (g_engdstAddrs.pfnConstructTutorMessageDecayBuffer(&a, &b)) +#define RecEngResetTutorMessageDecayBuffer() (g_engdstAddrs.pfnResetTutorMessageDecayBuffer()) +#define RecEngDraw_FillRGBABlend(a, b, c, d, e, f, g, h) (g_engdstAddrs.pfnFillRGBABlend(&a, &b, &c, &d, &e, &f, &g, &h)) + +// Dummy destination function for use when there's no security module +extern void NullDst(void); + +// Use this to init an engdst structure to point to NullDst +#define k_engdstNull \ +{ \ + (pfnEngDst_pfnSPR_Load_t) NullDst, \ + (pfnEngDst_pfnSPR_Frames_t) NullDst, \ + (pfnEngDst_pfnSPR_Height_t) NullDst, \ + (pfnEngDst_pfnSPR_Width_t) NullDst, \ + (pfnEngDst_pfnSPR_Set_t) NullDst, \ + (pfnEngDst_pfnSPR_Draw_t) NullDst, \ + (pfnEngDst_pfnSPR_DrawHoles_t) NullDst, \ + (pfnEngDst_pfnSPR_DrawAdditive_t) NullDst, \ + (pfnEngDst_pfnSPR_EnableScissor_t) NullDst, \ + (pfnEngDst_pfnSPR_DisableScissor_t) NullDst, \ + (pfnEngDst_pfnSPR_GetList_t) NullDst, \ + (pfnEngDst_pfnFillRGBA_t) NullDst, \ + (pfnEngDst_pfnGetScreenInfo_t) NullDst, \ + (pfnEngDst_pfnSetCrosshair_t) NullDst, \ + (pfnEngDst_pfnRegisterVariable_t) NullDst, \ + (pfnEngDst_pfnGetCvarFloat_t) NullDst, \ + (pfnEngDst_pfnGetCvarString_t) NullDst, \ + (pfnEngDst_pfnAddCommand_t) NullDst, \ + (pfnEngDst_pfnHookUserMsg_t) NullDst, \ + (pfnEngDst_pfnServerCmd_t) NullDst, \ + (pfnEngDst_pfnClientCmd_t) NullDst, \ + (pfnEngDst_pfnGetPlayerInfo_t) NullDst, \ + (pfnEngDst_pfnPlaySoundByName_t) NullDst, \ + (pfnEngDst_pfnPlaySoundByIndex_t) NullDst, \ + (pfnEngDst_pfnAngleVectors_t) NullDst, \ + (pfnEngDst_pfnTextMessageGet_t) NullDst, \ + (pfnEngDst_pfnDrawCharacter_t) NullDst, \ + (pfnEngDst_pfnDrawConsoleString_t) NullDst, \ + (pfnEngDst_pfnDrawSetTextColor_t) NullDst, \ + (pfnEngDst_pfnDrawConsoleStringLen_t) NullDst, \ + (pfnEngDst_pfnConsolePrint_t) NullDst, \ + (pfnEngDst_pfnCenterPrint_t) NullDst, \ + (pfnEngDst_GetWindowCenterX_t) NullDst, \ + (pfnEngDst_GetWindowCenterY_t) NullDst, \ + (pfnEngDst_GetViewAngles_t) NullDst, \ + (pfnEngDst_SetViewAngles_t) NullDst, \ + (pfnEngDst_GetMaxClients_t) NullDst, \ + (pfnEngDst_Cvar_SetValue_t) NullDst, \ + (pfnEngDst_Cmd_Argc_t) NullDst, \ + (pfnEngDst_Cmd_Argv_t) NullDst, \ + (pfnEngDst_Con_Printf_t) NullDst, \ + (pfnEngDst_Con_DPrintf_t) NullDst, \ + (pfnEngDst_Con_NPrintf_t) NullDst, \ + (pfnEngDst_Con_NXPrintf_t) NullDst, \ + (pfnEngDst_PhysInfo_ValueForKey_t) NullDst, \ + (pfnEngDst_ServerInfo_ValueForKey_t) NullDst, \ + (pfnEngDst_GetClientMaxspeed_t) NullDst, \ + (pfnEngDst_CheckParm_t) NullDst, \ + (pfnEngDst_Key_Event_t) NullDst, \ + (pfnEngDst_GetMousePosition_t) NullDst, \ + (pfnEngDst_IsNoClipping_t) NullDst, \ + (pfnEngDst_GetLocalPlayer_t) NullDst, \ + (pfnEngDst_GetViewModel_t) NullDst, \ + (pfnEngDst_GetEntityByIndex_t) NullDst, \ + (pfnEngDst_GetClientTime_t) NullDst, \ + (pfnEngDst_V_CalcShake_t) NullDst, \ + (pfnEngDst_V_ApplyShake_t) NullDst, \ + (pfnEngDst_PM_PointContents_t) NullDst, \ + (pfnEngDst_PM_WaterEntity_t) NullDst, \ + (pfnEngDst_PM_TraceLine_t) NullDst, \ + (pfnEngDst_CL_LoadModel_t) NullDst, \ + (pfnEngDst_CL_CreateVisibleEntity_t) NullDst, \ + (pfnEngDst_GetSpritePointer_t) NullDst, \ + (pfnEngDst_pfnPlaySoundByNameAtLocation_t) NullDst, \ + (pfnEngDst_pfnPrecacheEvent_t) NullDst, \ + (pfnEngDst_pfnPlaybackEvent_t) NullDst, \ + (pfnEngDst_pfnWeaponAnim_t) NullDst, \ + (pfnEngDst_pfnRandomFloat_t) NullDst, \ + (pfnEngDst_pfnRandomLong_t) NullDst, \ + (pfnEngDst_pfnHookEvent_t) NullDst, \ + (pfnEngDst_Con_IsVisible_t) NullDst, \ + (pfnEngDst_pfnGetGameDirectory_t) NullDst, \ + (pfnEngDst_pfnGetCvarPointer_t) NullDst, \ + (pfnEngDst_Key_LookupBinding_t) NullDst, \ + (pfnEngDst_pfnGetLevelName_t) NullDst, \ + (pfnEngDst_pfnGetScreenFade_t) NullDst, \ + (pfnEngDst_pfnSetScreenFade_t) NullDst, \ + (pfnEngDst_VGui_GetPanel_t) NullDst, \ + (pfnEngDst_VGui_ViewportPaintBackground_t) NullDst, \ + (pfnEngDst_COM_LoadFile_t) NullDst, \ + (pfnEngDst_COM_ParseFile_t) NullDst, \ + (pfnEngDst_COM_FreeFile_t) NullDst, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + (pfnEngDst_IsSpectateOnly_t) NullDst, \ + (pfnEngDst_LoadMapSprite_t) NullDst, \ + (pfnEngDst_COM_AddAppDirectoryToSearchPath_t) NullDst, \ + (pfnEngDst_COM_ExpandFilename_t) NullDst, \ + (pfnEngDst_PlayerInfo_ValueForKey_t) NullDst, \ + (pfnEngDst_PlayerInfo_SetValueForKey_t) NullDst, \ + (pfnEngDst_GetPlayerUniqueID_t) NullDst, \ + (pfnEngDst_GetTrackerIDForPlayer_t) NullDst, \ + (pfnEngDst_GetPlayerForTrackerID_t) NullDst, \ + (pfnEngDst_pfnServerCmdUnreliable_t) NullDst, \ + (pfnEngDst_GetMousePos_t) NullDst, \ + (pfnEngDst_SetMousePos_t) NullDst, \ + (pfnEngDst_SetMouseEnable_t) NullDst, \ + (pfnEngDst_pfnSetFilterMode_t) NullDst, \ + (pfnEngDst_pfnSetFilterColor_t) NullDst, \ + (pfnEngDst_pfnSetFilterBrightness_t) NullDst, \ + (pfnEngDst_pfnSequenceGet_t) NullDst, \ + (pfnEngDst_pfnSPR_DrawGeneric_t) NullDst, \ + (pfnEngDst_pfnSequencePickSentence_t) NullDst, \ + (pfnEngDst_pfnDrawString_t) NullDst, \ + (pfnEngDst_pfnDrawStringReverse_t) NullDst, \ + (pfnEngDst_LocalPlayerInfo_ValueForKey_t) NullDst, \ + (pfnEngDst_pfnVGUI2DrawCharacter_t) NullDst, \ + (pfnEngDst_pfnVGUI2DrawCharacterAdd_t) NullDst, \ + (pfnEngDst_pfnPlaySoundVoiceByName_t) NullDst, \ + (pfnEngDst_pfnPrimeMusicStream_t) NullDst, \ + (pfnEngDst_pfnProcessTutorMessageDecayBuffer_t) NullDst, \ + (pfnEngDst_pfnConstructTutorMessageDecayBuffer_t) NullDst, \ + (pfnEngDst_pfnResetTutorMessageDecayData_t) NullDst, \ + (pfnEngDst_pfnPlaySoundByNameAtPitch_t) NullDst, \ + (pfnEngDst_pfnFillRGBABlend_t) NullDst, \ + (pfnEngDst_pfnGetAppID_t) NullDst, \ + (pfnEngDst_pfnGetAliases_t) NullDst, \ + (pfnEngDst_pfnVguiWrap2_GetMouseDelta_t) NullDst, \ +}; + +// Use this to init a cldll_func_dst structure to point to NullDst +#define k_cldstNull \ +{ \ + (DST_INITIALIZE_FUNC) NullDst, \ + (DST_HUD_INIT_FUNC) NullDst, \ + (DST_HUD_VIDINIT_FUNC) NullDst, \ + (DST_HUD_REDRAW_FUNC) NullDst, \ + (DST_HUD_UPDATECLIENTDATA_FUNC) NullDst, \ + (DST_HUD_RESET_FUNC) NullDst, \ + (DST_HUD_CLIENTMOVE_FUNC) NullDst, \ + (DST_HUD_CLIENTMOVEINIT_FUNC) NullDst, \ + (DST_HUD_TEXTURETYPE_FUNC) NullDst, \ + (DST_HUD_IN_ACTIVATEMOUSE_FUNC) NullDst, \ + (DST_HUD_IN_DEACTIVATEMOUSE_FUNC) NullDst, \ + (DST_HUD_IN_MOUSEEVENT_FUNC) NullDst, \ + (DST_HUD_IN_CLEARSTATES_FUNC) NullDst, \ + (DST_HUD_IN_ACCUMULATE_FUNC) NullDst, \ + (DST_HUD_CL_CREATEMOVE_FUNC) NullDst, \ + (DST_HUD_CL_ISTHIRDPERSON_FUNC) NullDst, \ + (DST_HUD_CL_GETCAMERAOFFSETS_FUNC) NullDst, \ + (DST_HUD_KB_FIND_FUNC) NullDst, \ + (DST_HUD_CAMTHINK_FUNC) NullDst, \ + (DST_HUD_CALCREF_FUNC) NullDst, \ + (DST_HUD_ADDENTITY_FUNC) NullDst, \ + (DST_HUD_CREATEENTITIES_FUNC) NullDst, \ + (DST_HUD_DRAWNORMALTRIS_FUNC) NullDst, \ + (DST_HUD_DRAWTRANSTRIS_FUNC) NullDst, \ + (DST_HUD_STUDIOEVENT_FUNC) NullDst, \ + (DST_HUD_POSTRUNCMD_FUNC) NullDst, \ + (DST_HUD_SHUTDOWN_FUNC) NullDst, \ + (DST_HUD_TXFERLOCALOVERRIDES_FUNC) NullDst, \ + (DST_HUD_PROCESSPLAYERSTATE_FUNC) NullDst, \ + (DST_HUD_TXFERPREDICTIONDATA_FUNC) NullDst, \ + (DST_HUD_DEMOREAD_FUNC) NullDst, \ + (DST_HUD_CONNECTIONLESS_FUNC) NullDst, \ + (DST_HUD_GETHULLBOUNDS_FUNC) NullDst, \ + (DST_HUD_FRAME_FUNC) NullDst, \ + (DST_HUD_KEY_EVENT_FUNC) NullDst, \ + (DST_HUD_TEMPENTUPDATE_FUNC) NullDst, \ + (DST_HUD_GETUSERENTITY_FUNC) NullDst, \ + (DST_HUD_VOICESTATUS_FUNC) NullDst, \ + (DST_HUD_DIRECTORMESSAGE_FUNC) NullDst, \ + (DST_HUD_STUDIO_INTERFACE_FUNC) NullDst, \ + (DST_HUD_CHATINPUTPOSITION_FUNC) NullDst, \ + (DST_HUD_GETPLAYERTEAM) NullDst, \ +} #ifdef __cplusplus } #endif #endif // CDLL_INT_H + \ No newline at end of file diff --git a/engine/custom.h b/engine/custom.h index a5a8da9..f00bf9f 100644 --- a/engine/custom.h +++ b/engine/custom.h @@ -53,9 +53,11 @@ typedef struct resourceinfo_s #define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file. #define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok? #define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization - // or is it a server startup resource. + // or is it a server startup resource. #define RES_REQUESTED (1<<3) // Already requested a download of this one #define RES_PRECACHED (1<<4) // Already precached +#define RES_ALWAYS (1<<5) // download always even if available on client +#define RES_CHECKFILE (1<<7) // check file on client #include "crc.h" diff --git a/engine/eiface.h b/engine/eiface.h index 157173e..3898229 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -15,6 +15,8 @@ #ifndef EIFACE_H #define EIFACE_H +#include "archtypes.h" // DAL + #ifdef HLDEMO_BUILD #define INTERFACE_VERSION 001 #else // !HLDEMO_BUILD, i.e., regular version of HL @@ -24,6 +26,7 @@ #include #include "custom.h" #include "cvardef.h" +#include "Sequence.h" // // Defines entity interface between engine and DLLs. // This header file included by engine files and DLL files. @@ -33,11 +36,13 @@ // This is conveniently done for them in extdll.h // +/* #ifdef _WIN32 #define DLLEXPORT __stdcall #else -#define DLLEXPORT /* */ +#define DLLEXPORT __attribute__ ((visibility("default"))) #endif +*/ typedef enum { @@ -60,9 +65,10 @@ typedef enum // For integrity checking of content on clients typedef enum { - force_exactfile, // File on client must exactly match server's file - force_model_samebounds, // For model files only, the geometry must fit in the same bbox - force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox + force_exactfile, // File on client must exactly match server's file + force_model_samebounds, // For model files only, the geometry must fit in the same bbox + force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox + force_model_specifybounds_if_avail, // For Steam model files only, the geometry must fit in the specified bbox (if the file is available) } FORCE_TYPE; // Returned by TraceLine @@ -96,6 +102,7 @@ typedef struct #include "../common/crc.h" + // Engine hands this to DLLs for functionality callbacks typedef struct enginefuncs_s { @@ -161,8 +168,8 @@ typedef struct enginefuncs_s void (*pfnCVarSetFloat) (const char *szVarName, float flValue); void (*pfnCVarSetString) (const char *szVarName, const char *szValue); void (*pfnAlertMessage) (ALERT_TYPE atype, char *szFmt, ...); - void (*pfnEngineFprintf) (FILE *pfile, char *szFmt, ...); - void* (*pfnPvAllocEntPrivateData) (edict_t *pEdict, long cb); + void (*pfnEngineFprintf) (void *pfile, char *szFmt, ...); + void* (*pfnPvAllocEntPrivateData) (edict_t *pEdict, int32 cb); void* (*pfnPvEntPrivateData) (edict_t *pEdict); void (*pfnFreeEntPrivateData) (edict_t *pEdict); const char* (*pfnSzFromIndex) (int iString); @@ -177,8 +184,8 @@ typedef struct enginefuncs_s int (*pfnRegUserMsg) (const char *pszName, int iSize); void (*pfnAnimationAutomove) (const edict_t* pEdict, float flTime); void (*pfnGetBonePosition) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); - unsigned long (*pfnFunctionFromName) ( const char *pName ); - const char *(*pfnNameForFunction) ( unsigned long function ); + uint32 (*pfnFunctionFromName) ( const char *pName ); + const char *(*pfnNameForFunction) ( uint32 function ); void (*pfnClientPrintf) ( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients void (*pfnServerPrint) ( const char *szMsg ); const char *(*pfnCmd_Args) ( void ); // these 3 added @@ -189,7 +196,7 @@ typedef struct enginefuncs_s void (*pfnCRC32_ProcessBuffer) (CRC32_t *pulCRC, void *p, int len); void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, unsigned char ch); CRC32_t (*pfnCRC32_Final) (CRC32_t pulCRC); - long (*pfnRandomLong) (long lLow, long lHigh); + int32 (*pfnRandomLong) (int32 lLow, int32 lHigh); float (*pfnRandomFloat) (float flLow, float flHigh); void (*pfnSetView) (const edict_t *pClient, const edict_t *pViewent ); float (*pfnTime) ( void ); @@ -260,7 +267,38 @@ typedef struct enginefuncs_s qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen); const char *(*pfnGetPlayerAuthId) ( edict_t *e ); + + // PSV: Added for CZ training map +// const char *(*pfnKeyNameForBinding) ( const char* pBinding ); + + sequenceEntry_s* (*pfnSequenceGet) ( const char* fileName, const char* entryName ); + sentenceEntry_s* (*pfnSequencePickSentence) ( const char* groupName, int pickMethod, int *picked ); + + // LH: Give access to filesize via filesystem + int (*pfnGetFileSize) ( char *filename ); + + unsigned int (*pfnGetApproxWavePlayLen) (const char *filepath); + // MDC: Added for CZ career-mode + int (*pfnIsCareerMatch) ( void ); + + // BGC: return the number of characters of the localized string referenced by using "label" + int (*pfnGetLocalizedStringLength)(const char *label); + + // BGC: added to facilitate persistent storage of tutor message decay values for + // different career game profiles. Also needs to persist regardless of mp.dll being + // destroyed and recreated. + void (*pfnRegisterTutorMessageShown)(int mid); + int (*pfnGetTimesTutorMessageShown)(int mid); + void (*ProcessTutorMessageDecayBuffer)(int *buffer, int bufferLength); + void (*ConstructTutorMessageDecayBuffer)(int *buffer, int bufferLength); + void (*ResetTutorMessageDecayData)( void ); + + void (*pfnQueryClientCvarValue)( const edict_t *player, const char *cvarName ); + void (*pfnQueryClientCvarValue2)( const edict_t *player, const char *cvarName, int requestID ); + int (*pfnCheckParm)( const char *pchCmdLineToken, char **ppnext ); } enginefuncs_t; + + // ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 // Passed to pfnKeyValue @@ -269,7 +307,7 @@ typedef struct KeyValueData_s char *szClassName; // in: entity classname char *szKeyName; // in: name of key char *szValue; // in: value of key - long fHandled; // out: DLL sets to true if key-value pair was understood + int32 fHandled; // out: DLL sets to true if key-value pair was understood } KeyValueData; @@ -356,7 +394,7 @@ typedef enum _fieldtypes FIELD_TYPECOUNT, // MUST BE LAST } FIELDTYPE; -#ifndef offsetof +#if !defined(offsetof) && !defined(GNUC) #define offsetof(s,m) (size_t)&(((s *)0)->m) #endif @@ -480,6 +518,8 @@ typedef struct void (*pfnOnFreeEntPrivateData)(edict_t *pEnt); void (*pfnGameShutdown)(void); int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther ); + void (*pfnCvarValue)( const edict_t *pEnt, const char *value ); + void (*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value ); } NEW_DLL_FUNCTIONS; typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); diff --git a/engine/progdefs.h b/engine/progdefs.h index b8c58ad..6fab150 100644 --- a/engine/progdefs.h +++ b/engine/progdefs.h @@ -221,4 +221,4 @@ typedef struct entvars_s } entvars_t; -#endif // PROGDEFS_H \ No newline at end of file +#endif // PROGDEFS_H diff --git a/engine/progs.h b/engine/progs.h index 6115fcb..1d1f885 100644 --- a/engine/progs.h +++ b/engine/progs.h @@ -79,4 +79,4 @@ int NUM_FOR_EDICT(const edict_t *e); #define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) -#endif // PROGS_H \ No newline at end of file +#endif // PROGS_H diff --git a/engine/shake.h b/engine/shake.h index 8e405db..7df2971 100644 --- a/engine/shake.h +++ b/engine/shake.h @@ -33,7 +33,6 @@ extern void V_CalcShake( void ); extern int V_ScreenShake( const char *pszName, int iSize, void *pbuf ); extern int V_ScreenFade( const char *pszName, int iSize, void *pbuf ); - // Fade in/out extern int gmsgFade; @@ -41,6 +40,8 @@ extern int gmsgFade; #define FFADE_OUT 0x0001 // Fade out (not in) #define FFADE_MODULATE 0x0002 // Modulate (don't blend) #define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received +#define FFADE_LONGFADE 0x0008 // used to indicate the fade can be longer than 16 seconds (added for czero) + // This structure is sent over the net to describe a screen fade event typedef struct diff --git a/engine/studio.h b/engine/studio.h index 62d4a98..c1bfc72 100644 --- a/engine/studio.h +++ b/engine/studio.h @@ -27,18 +27,18 @@ STUDIO MODELS Studio models are position independent, so the cache manager can move them. ============================================================================== */ - + #define MAXSTUDIOTRIANGLES 20000 // TODO: tune this #define MAXSTUDIOVERTS 2048 // TODO: tune this -#define MAXSTUDIOSEQUENCES 256 // total animation sequences +#define MAXSTUDIOSEQUENCES 2048 // total animation sequences -- KSH incremented #define MAXSTUDIOSKINS 100 // total textures #define MAXSTUDIOSRCBONES 512 // bones allowed at source movement #define MAXSTUDIOBONES 128 // total bones actually used #define MAXSTUDIOMODELS 32 // sub-models per model #define MAXSTUDIOBODYPARTS 32 #define MAXSTUDIOGROUPS 16 -#define MAXSTUDIOANIMATIONS 512 // per sequence +#define MAXSTUDIOANIMATIONS 2048 #define MAXSTUDIOMESHES 256 #define MAXSTUDIOEVENTS 1024 #define MAXSTUDIOPIVOTS 256 @@ -149,13 +149,15 @@ typedef struct cache_user_s } cache_user_t; #endif +// // demand loaded sequence groups +// typedef struct { char label[32]; // textual name char name[64]; // file name - cache_user_t cache; // cache index pointer - int data; // hack for group 0 + int32 unused1; // was "cache" - index pointer + int unused2; // was "data" - hack for group 0 } mstudioseqgroup_t; // sequence descriptions @@ -327,6 +329,10 @@ typedef struct #define STUDIO_NF_FLATSHADE 0x0001 #define STUDIO_NF_CHROME 0x0002 #define STUDIO_NF_FULLBRIGHT 0x0004 +#define STUDIO_NF_NOMIPS 0x0008 +#define STUDIO_NF_ALPHA 0x0010 +#define STUDIO_NF_ADDITIVE 0x0020 +#define STUDIO_NF_MASKED 0x0040 // motion flags #define STUDIO_X 0x0001 diff --git a/external/SDL2/SDL.h b/external/SDL2/SDL.h new file mode 100644 index 0000000..19c8322 --- /dev/null +++ b/external/SDL2/SDL.h @@ -0,0 +1,163 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL.h + * + * Main include header for the SDL library + */ + +/** + * \mainpage Simple DirectMedia Layer (SDL) + * + * http://www.libsdl.org/ + * + * \section intro_sec Introduction + * + * This is the Simple DirectMedia Layer, a general API that provides low + * level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, + * and 2D framebuffer across multiple platforms. + * + * SDL is written in C, but works with C++ natively, and has bindings to + * several other languages, including Ada, C#, Eiffel, Erlang, Euphoria, + * Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP, + * Pike, Pliant, Python, Ruby, and Smalltalk. + * + * This library is distributed under the zlib license, which can be + * found in the file "COPYING". This license allows you to use SDL + * freely for any purpose as long as you retain the copyright notice. + * + * The best way to learn how to use SDL is to check out the header files in + * the "include" subdirectory and the programs in the "test" subdirectory. + * The header files and test programs are well commented and always up to date. + * More documentation and FAQs are available online at: + * http://wiki.libsdl.org/ + * + * If you need help with the library, or just want to discuss SDL related + * issues, you can join the developers mailing list: + * http://www.libsdl.org/mailing-list.php + * + * Enjoy! + * Sam Lantinga (slouken@libsdl.org) + */ + +#ifndef _SDL_H +#define _SDL_H + +#include "SDL_main.h" +#include "SDL_stdinc.h" +#include "SDL_assert.h" +#include "SDL_atomic.h" +#include "SDL_audio.h" +#include "SDL_clipboard.h" +#include "SDL_cpuinfo.h" +#include "SDL_endian.h" +#include "SDL_error.h" +#include "SDL_events.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "SDL_haptic.h" +#include "SDL_hints.h" +#include "SDL_loadso.h" +#include "SDL_log.h" +#include "SDL_messagebox.h" +#include "SDL_mutex.h" +#include "SDL_power.h" +#include "SDL_render.h" +#include "SDL_rwops.h" +#include "SDL_system.h" +#include "SDL_thread.h" +#include "SDL_timer.h" +#include "SDL_version.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* As of version 0.5, SDL is loaded dynamically into the application */ + +/** + * \name SDL_INIT_* + * + * These are the flags which may be passed to SDL_Init(). You should + * specify the subsystems which you will be using in your application. + */ +/*@{*/ +#define SDL_INIT_TIMER 0x00000001 +#define SDL_INIT_AUDIO 0x00000010 +#define SDL_INIT_VIDEO 0x00000020 +#define SDL_INIT_JOYSTICK 0x00000200 +#define SDL_INIT_HAPTIC 0x00001000 +#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */ +#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ +#define SDL_INIT_EVERYTHING ( \ + SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ + ) +/*@}*/ + +/** + * This function initializes the subsystems specified by \c flags + * Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + * signal handlers for some commonly ignored fatal signals (like SIGSEGV). + */ +extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); + +/** + * This function initializes specific SDL subsystems + */ +extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); + +/** + * This function cleans up specific SDL subsystems + */ +extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); + +/** + * This function returns a mask of the specified subsystems which have + * previously been initialized. + * + * If \c flags is 0, it returns a mask of all initialized subsystems. + */ +extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); + +/** + * This function cleans up all initialized subsystems. You should + * call it upon all exit conditions. + */ +extern DECLSPEC void SDLCALL SDL_Quit(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_assert.h b/external/SDL2/SDL_assert.h new file mode 100644 index 0000000..e68aee1 --- /dev/null +++ b/external/SDL2/SDL_assert.h @@ -0,0 +1,241 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_assert_h +#define _SDL_assert_h + +#include "SDL_config.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +#ifndef SDL_ASSERT_LEVEL +#ifdef SDL_DEFAULT_ASSERT_LEVEL +#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL +#elif defined(_DEBUG) || defined(DEBUG) || \ + (defined(__GNUC__) && !defined(__OPTIMIZE__)) +#define SDL_ASSERT_LEVEL 2 +#else +#define SDL_ASSERT_LEVEL 1 +#endif +#endif /* SDL_ASSERT_LEVEL */ + +/* +These are macros and not first class functions so that the debugger breaks +on the assertion line and not in some random guts of SDL, and so each +assert can have unique static variables associated with it. +*/ + +#if defined(_MSC_VER) +/* Don't include intrin.h here because it contains C++ code */ + extern void __cdecl __debugbreak(void); + #define SDL_TriggerBreakpoint() __debugbreak() +#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) +#elif defined(HAVE_SIGNAL_H) + #include + #define SDL_TriggerBreakpoint() raise(SIGTRAP) +#else + /* How do we trigger breakpoints on this platform? */ + #define SDL_TriggerBreakpoint() +#endif + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ +# define SDL_FUNCTION __func__ +#elif ((__GNUC__ >= 2) || defined(_MSC_VER)) +# define SDL_FUNCTION __FUNCTION__ +#else +# define SDL_FUNCTION "???" +#endif +#define SDL_FILE __FILE__ +#define SDL_LINE __LINE__ + +/* +sizeof (x) makes the compiler still parse the expression even without +assertions enabled, so the code is always checked at compile time, but +doesn't actually generate code for it, so there are no side effects or +expensive checks at run time, just the constant size of what x WOULD be, +which presumably gets optimized out as unused. +This also solves the problem of... + + int somevalue = blah(); + SDL_assert(somevalue == 1); + +...which would cause compiles to complain that somevalue is unused if we +disable assertions. +*/ + +#define SDL_disabled_assert(condition) \ + do { (void) sizeof ((condition)); } while (0) + +typedef enum +{ + SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */ + SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */ + SDL_ASSERTION_ABORT, /**< Terminate the program. */ + SDL_ASSERTION_IGNORE, /**< Ignore the assert. */ + SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */ +} SDL_assert_state; + +typedef struct SDL_assert_data +{ + int always_ignore; + unsigned int trigger_count; + const char *condition; + const char *filename; + int linenum; + const char *function; + const struct SDL_assert_data *next; +} SDL_assert_data; + +#if (SDL_ASSERT_LEVEL > 0) + +/* Never call this directly. Use the SDL_assert* macros. */ +extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *, + const char *, + const char *, int); + +/* the do {} while(0) avoids dangling else problems: + if (x) SDL_assert(y); else blah(); + ... without the do/while, the "else" could attach to this macro's "if". + We try to handle just the minimum we need here in a macro...the loop, + the static vars, and break points. The heavy lifting is handled in + SDL_ReportAssertion(), in SDL_assert.c. +*/ +#define SDL_enabled_assert(condition) \ + do { \ + while ( !(condition) ) { \ + static struct SDL_assert_data assert_data = { \ + 0, 0, #condition, 0, 0, 0, 0 \ + }; \ + const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \ + SDL_FUNCTION, \ + SDL_FILE, \ + SDL_LINE); \ + if (state == SDL_ASSERTION_RETRY) { \ + continue; /* go again. */ \ + } else if (state == SDL_ASSERTION_BREAK) { \ + SDL_TriggerBreakpoint(); \ + } \ + break; /* not retrying. */ \ + } \ + } while (0) + +#endif /* enabled assertions support code */ + +/* Enable various levels of assertions. */ +#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ +# define SDL_assert(condition) SDL_disabled_assert(condition) +# define SDL_assert_release(condition) SDL_disabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) +#elif SDL_ASSERT_LEVEL == 1 /* release settings. */ +# define SDL_assert(condition) SDL_disabled_assert(condition) +# define SDL_assert_release(condition) SDL_enabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) +#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */ +# define SDL_assert(condition) SDL_enabled_assert(condition) +# define SDL_assert_release(condition) SDL_enabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) +#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */ +# define SDL_assert(condition) SDL_enabled_assert(condition) +# define SDL_assert_release(condition) SDL_enabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition) +#else +# error Unknown assertion level. +#endif + + +typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)( + const SDL_assert_data* data, void* userdata); + +/** + * \brief Set an application-defined assertion handler. + * + * This allows an app to show its own assertion UI and/or force the + * response to an assertion failure. If the app doesn't provide this, SDL + * will try to do the right thing, popping up a system-specific GUI dialog, + * and probably minimizing any fullscreen windows. + * + * This callback may fire from any thread, but it runs wrapped in a mutex, so + * it will only fire from one thread at a time. + * + * Setting the callback to NULL restores SDL's original internal handler. + * + * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! + * + * \return SDL_assert_state value of how to handle the assertion failure. + * + * \param handler Callback function, called when an assertion fails. + * \param userdata A pointer passed to the callback as-is. + */ +extern DECLSPEC void SDLCALL SDL_SetAssertionHandler( + SDL_AssertionHandler handler, + void *userdata); + +/** + * \brief Get a list of all assertion failures. + * + * Get all assertions triggered since last call to SDL_ResetAssertionReport(), + * or the start of the program. + * + * The proper way to examine this data looks something like this: + * + * + * const SDL_assert_data *item = SDL_GetAssertionReport(); + * while (item) { + * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", + * item->condition, item->function, item->filename, + * item->linenum, item->trigger_count, + * item->always_ignore ? "yes" : "no"); + * item = item->next; + * } + * + * + * \return List of all assertions. + * \sa SDL_ResetAssertionReport + */ +extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void); + +/** + * \brief Reset the list of all assertion failures. + * + * Reset list of all assertions triggered. + * + * \sa SDL_GetAssertionReport + */ +extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_assert_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_atomic.h b/external/SDL2/SDL_atomic.h new file mode 100644 index 0000000..a190e7d --- /dev/null +++ b/external/SDL2/SDL_atomic.h @@ -0,0 +1,316 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_atomic.h + * + * Atomic operations. + * + * IMPORTANT: + * If you are not an expert in concurrent lockless programming, you should + * only be using the atomic lock and reference counting functions in this + * file. In all other cases you should be protecting your data structures + * with full mutexes. + * + * The list of "safe" functions to use are: + * SDL_AtomicLock() + * SDL_AtomicUnlock() + * SDL_AtomicIncRef() + * SDL_AtomicDecRef() + * + * Seriously, here be dragons! + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * + * You can find out a little more about lockless programming and the + * subtle issues that can arise here: + * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx + * + * There's also lots of good information here: + * http://www.1024cores.net/home/lock-free-algorithms + * + * These operations may or may not actually be implemented using + * processor specific atomic operations. When possible they are + * implemented as true processor specific atomic operations. When that + * is not possible the are implemented using locks that *do* use the + * available atomic operations. + * + * All of the atomic operations that modify memory are full memory barriers. + */ + +#ifndef _SDL_atomic_h_ +#define _SDL_atomic_h_ + +#include "SDL_stdinc.h" +#include "SDL_platform.h" + +#include "begin_code.h" + +/* Need to do this here because intrin.h has C++ code in it */ +/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +#include +#define HAVE_MSC_ATOMICS 1 +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \name SDL AtomicLock + * + * The atomic locks are efficient spinlocks using CPU instructions, + * but are vulnerable to starvation and can spin forever if a thread + * holding a lock has been terminated. For this reason you should + * minimize the code executed inside an atomic lock and never do + * expensive things like API or system calls while holding them. + * + * The atomic locks are not safe to lock recursively. + * + * Porting Note: + * The spin lock functions and type are required and can not be + * emulated because they are used in the atomic emulation code. + */ +/*@{*/ + +typedef int SDL_SpinLock; + +/** + * \brief Try to lock a spin lock by setting it to a non-zero value. + * + * \param lock Points to the lock. + * + * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); + +/** + * \brief Lock a spin lock by setting it to a non-zero value. + * + * \param lock Points to the lock. + */ +extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock); + +/** + * \brief Unlock a spin lock by setting it to 0. Always returns immediately + * + * \param lock Points to the lock. + */ +extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); + +/*@}*//*SDL AtomicLock*/ + + +/** + * The compiler barrier prevents the compiler from reordering + * reads and writes to globally visible variables across the call. + */ +#if defined(_MSC_VER) && (_MSC_VER > 1200) +void _ReadWriteBarrier(void); +#pragma intrinsic(_ReadWriteBarrier) +#define SDL_CompilerBarrier() _ReadWriteBarrier() +#elif defined(__GNUC__) +#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") +#else +#define SDL_CompilerBarrier() \ +{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } +#endif + +/* Platform specific optimized versions of the atomic functions, + * you can disable these by defining SDL_DISABLE_ATOMIC_INLINE + */ +#if defined(SDL_ATOMIC_DISABLED) && SDL_ATOMIC_DISABLED +#define SDL_DISABLE_ATOMIC_INLINE +#endif +#ifndef SDL_DISABLE_ATOMIC_INLINE + +#ifdef HAVE_MSC_ATOMICS + +#define SDL_AtomicSet(a, v) _InterlockedExchange((long*)&(a)->value, (v)) +#define SDL_AtomicAdd(a, v) _InterlockedExchangeAdd((long*)&(a)->value, (v)) +#define SDL_AtomicCAS(a, oldval, newval) (_InterlockedCompareExchange((long*)&(a)->value, (newval), (oldval)) == (oldval)) +#define SDL_AtomicSetPtr(a, v) _InterlockedExchangePointer((a), (v)) +#if _M_IX86 +#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchange((long*)(a), (long)(newval), (long)(oldval)) == (long)(oldval)) +#else +#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchangePointer((a), (newval), (oldval)) == (oldval)) +#endif + +#elif defined(__MACOSX__) +#include + +#define SDL_AtomicCAS(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((oldval), (newval), &(a)->value) +#ifdef __LP64__ +#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap64Barrier((int64_t)(oldval), (int64_t)(newval), (int64_t*)(a)) +#else +#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((int32_t)(oldval), (int32_t)(newval), (int32_t*)(a)) +#endif + +#elif defined(HAVE_GCC_ATOMICS) + +#define SDL_AtomicSet(a, v) __sync_lock_test_and_set(&(a)->value, v) +#define SDL_AtomicAdd(a, v) __sync_fetch_and_add(&(a)->value, v) +#define SDL_AtomicSetPtr(a, v) __sync_lock_test_and_set(a, v) +#define SDL_AtomicCAS(a, oldval, newval) __sync_bool_compare_and_swap(&(a)->value, oldval, newval) +#define SDL_AtomicCASPtr(a, oldval, newval) __sync_bool_compare_and_swap(a, oldval, newval) + +#endif + +#endif /* !SDL_DISABLE_ATOMIC_INLINE */ + + +/** + * \brief A type representing an atomic integer value. It is a struct + * so people don't accidentally use numeric operations on it. + */ +#ifndef SDL_atomic_t_defined +typedef struct { int value; } SDL_atomic_t; +#endif + +/** + * \brief Set an atomic variable to a new value if it is currently an old value. + * + * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. + * + * \note If you don't know what this function is for, you shouldn't use it! +*/ +#ifndef SDL_AtomicCAS +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval); +#endif + +/** + * \brief Set an atomic variable to a value. + * + * \return The previous value of the atomic variable. + */ +#ifndef SDL_AtomicSet +SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v) +{ + int value; + do { + value = a->value; + } while (!SDL_AtomicCAS(a, value, v)); + return value; +} +#endif + +/** + * \brief Get the value of an atomic variable + */ +#ifndef SDL_AtomicGet +SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a) +{ + int value = a->value; + SDL_CompilerBarrier(); + return value; +} +#endif + +/** + * \brief Add to an atomic variable. + * + * \return The previous value of the atomic variable. + * + * \note This same style can be used for any number operation + */ +#ifndef SDL_AtomicAdd +SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v) +{ + int value; + do { + value = a->value; + } while (!SDL_AtomicCAS(a, value, (value + v))); + return value; +} +#endif + +/** + * \brief Increment an atomic variable used as a reference count. + */ +#ifndef SDL_AtomicIncRef +#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1) +#endif + +/** + * \brief Decrement an atomic variable used as a reference count. + * + * \return SDL_TRUE if the variable reached zero after decrementing, + * SDL_FALSE otherwise + */ +#ifndef SDL_AtomicDecRef +#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1) +#endif + +/** + * \brief Set a pointer to a new value if it is currently an old value. + * + * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise. + * + * \note If you don't know what this function is for, you shouldn't use it! +*/ +#ifndef SDL_AtomicCASPtr +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval); +#endif + +/** + * \brief Set a pointer to a value atomically. + * + * \return The previous value of the pointer. + */ +#ifndef SDL_AtomicSetPtr +SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v) +{ + void* value; + do { + value = *a; + } while (!SDL_AtomicCASPtr(a, value, v)); + return value; +} +#endif + +/** + * \brief Get the value of a pointer atomically. + */ +#ifndef SDL_AtomicGetPtr +SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a) +{ + void* value = *a; + SDL_CompilerBarrier(); + return value; +} +#endif + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif + +#include "close_code.h" + +#endif /* _SDL_atomic_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_audio.h b/external/SDL2/SDL_audio.h new file mode 100644 index 0000000..69b1cb1 --- /dev/null +++ b/external/SDL2/SDL_audio.h @@ -0,0 +1,509 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_audio.h + * + * Access to the raw audio mixing buffer for the SDL library. + */ + +#ifndef _SDL_audio_h +#define _SDL_audio_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_endian.h" +#include "SDL_mutex.h" +#include "SDL_thread.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Audio format flags. + * + * These are what the 16 bits in SDL_AudioFormat currently mean... + * (Unspecified bits are always zero). + * + * \verbatim + ++-----------------------sample is signed if set + || + || ++-----------sample is bigendian if set + || || + || || ++---sample is float if set + || || || + || || || +---sample bit size---+ + || || || | | + 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 + \endverbatim + * + * There are macros in SDL 2.0 and later to query these bits. + */ +typedef Uint16 SDL_AudioFormat; + +/** + * \name Audio flags + */ +/*@{*/ + +#define SDL_AUDIO_MASK_BITSIZE (0xFF) +#define SDL_AUDIO_MASK_DATATYPE (1<<8) +#define SDL_AUDIO_MASK_ENDIAN (1<<12) +#define SDL_AUDIO_MASK_SIGNED (1<<15) +#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) +#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) +#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) +#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) +#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) +#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) +#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) + +/** + * \name Audio format flags + * + * Defaults to LSB byte order. + */ +/*@{*/ +#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ +#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ +#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ +#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ +#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ +#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ +#define AUDIO_U16 AUDIO_U16LSB +#define AUDIO_S16 AUDIO_S16LSB +/*@}*/ + +/** + * \name int32 support + * + * New to SDL 1.3. + */ +/*@{*/ +#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ +#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ +#define AUDIO_S32 AUDIO_S32LSB +/*@}*/ + +/** + * \name float32 support + * + * New to SDL 1.3. + */ +/*@{*/ +#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ +#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ +#define AUDIO_F32 AUDIO_F32LSB +/*@}*/ + +/** + * \name Native audio byte ordering + */ +/*@{*/ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define AUDIO_U16SYS AUDIO_U16LSB +#define AUDIO_S16SYS AUDIO_S16LSB +#define AUDIO_S32SYS AUDIO_S32LSB +#define AUDIO_F32SYS AUDIO_F32LSB +#else +#define AUDIO_U16SYS AUDIO_U16MSB +#define AUDIO_S16SYS AUDIO_S16MSB +#define AUDIO_S32SYS AUDIO_S32MSB +#define AUDIO_F32SYS AUDIO_F32MSB +#endif +/*@}*/ + +/** + * \name Allow change flags + * + * Which audio format changes are allowed when opening a device. + */ +/*@{*/ +#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 +#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 +#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) +/*@}*/ + +/*@}*//*Audio flags*/ + +/** + * This function is called when the audio device needs more data. + * + * \param userdata An application-specific parameter saved in + * the SDL_AudioSpec structure + * \param stream A pointer to the audio data buffer. + * \param len The length of that buffer in bytes. + * + * Once the callback returns, the buffer will no longer be valid. + * Stereo samples are stored in a LRLRLR ordering. + */ +typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, + int len); + +/** + * The calculated values in this structure are calculated by SDL_OpenAudio(). + */ +typedef struct SDL_AudioSpec +{ + int freq; /**< DSP frequency -- samples per second */ + SDL_AudioFormat format; /**< Audio data format */ + Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ + Uint8 silence; /**< Audio buffer silence value (calculated) */ + Uint16 samples; /**< Audio buffer size in samples (power of 2) */ + Uint16 padding; /**< Necessary for some compile environments */ + Uint32 size; /**< Audio buffer size in bytes (calculated) */ + SDL_AudioCallback callback; + void *userdata; +} SDL_AudioSpec; + + +struct SDL_AudioCVT; +typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, + SDL_AudioFormat format); + +/** + * A structure to hold a set of audio conversion filters and buffers. + */ +typedef struct SDL_AudioCVT +{ + int needed; /**< Set to 1 if conversion possible */ + SDL_AudioFormat src_format; /**< Source audio format */ + SDL_AudioFormat dst_format; /**< Target audio format */ + double rate_incr; /**< Rate conversion increment */ + Uint8 *buf; /**< Buffer to hold entire audio data */ + int len; /**< Length of original audio buffer */ + int len_cvt; /**< Length of converted audio buffer */ + int len_mult; /**< buffer must be len*len_mult big */ + double len_ratio; /**< Given len, final size is len*len_ratio */ + SDL_AudioFilter filters[10]; /**< Filter list */ + int filter_index; /**< Current audio conversion function */ +} SDL_AudioCVT; + + +/* Function prototypes */ + +/** + * \name Driver discovery functions + * + * These functions return the list of built in audio drivers, in the + * order that they are normally initialized by default. + */ +/*@{*/ +extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); +extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); +/*@}*/ + +/** + * \name Initialization and cleanup + * + * \internal These functions are used internally, and should not be used unless + * you have a specific need to specify the audio driver you want to + * use. You should normally use SDL_Init() or SDL_InitSubSystem(). + */ +/*@{*/ +extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); +extern DECLSPEC void SDLCALL SDL_AudioQuit(void); +/*@}*/ + +/** + * This function returns the name of the current audio driver, or NULL + * if no driver has been initialized. + */ +extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); + +/** + * This function opens the audio device with the desired parameters, and + * returns 0 if successful, placing the actual hardware parameters in the + * structure pointed to by \c obtained. If \c obtained is NULL, the audio + * data passed to the callback function will be guaranteed to be in the + * requested format, and will be automatically converted to the hardware + * audio format if necessary. This function returns -1 if it failed + * to open the audio device, or couldn't set up the audio thread. + * + * When filling in the desired audio spec structure, + * - \c desired->freq should be the desired audio frequency in samples-per- + * second. + * - \c desired->format should be the desired audio format. + * - \c desired->samples is the desired size of the audio buffer, in + * samples. This number should be a power of two, and may be adjusted by + * the audio driver to a value more suitable for the hardware. Good values + * seem to range between 512 and 8096 inclusive, depending on the + * application and CPU speed. Smaller values yield faster response time, + * but can lead to underflow if the application is doing heavy processing + * and cannot fill the audio buffer in time. A stereo sample consists of + * both right and left channels in LR ordering. + * Note that the number of samples is directly related to time by the + * following formula: \code ms = (samples*1000)/freq \endcode + * - \c desired->size is the size in bytes of the audio buffer, and is + * calculated by SDL_OpenAudio(). + * - \c desired->silence is the value used to set the buffer to silence, + * and is calculated by SDL_OpenAudio(). + * - \c desired->callback should be set to a function that will be called + * when the audio device is ready for more data. It is passed a pointer + * to the audio buffer, and the length in bytes of the audio buffer. + * This function usually runs in a separate thread, and so you should + * protect data structures that it accesses by calling SDL_LockAudio() + * and SDL_UnlockAudio() in your code. + * - \c desired->userdata is passed as the first parameter to your callback + * function. + * + * The audio device starts out playing silence when it's opened, and should + * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready + * for your audio callback function to be called. Since the audio driver + * may modify the requested size of the audio buffer, you should allocate + * any local mixing buffers after you open the audio device. + */ +extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, + SDL_AudioSpec * obtained); + +/** + * SDL Audio Device IDs. + * + * A successful call to SDL_OpenAudio() is always device id 1, and legacy + * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls + * always returns devices >= 2 on success. The legacy calls are good both + * for backwards compatibility and when you don't care about multiple, + * specific, or capture devices. + */ +typedef Uint32 SDL_AudioDeviceID; + +/** + * Get the number of available devices exposed by the current driver. + * Only valid after a successfully initializing the audio subsystem. + * Returns -1 if an explicit list of devices can't be determined; this is + * not an error. For example, if SDL is set up to talk to a remote audio + * server, it can't list every one available on the Internet, but it will + * still allow a specific host to be specified to SDL_OpenAudioDevice(). + * + * In many common cases, when this function returns a value <= 0, it can still + * successfully open the default device (NULL for first argument of + * SDL_OpenAudioDevice()). + */ +extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); + +/** + * Get the human-readable name of a specific audio device. + * Must be a value between 0 and (number of audio devices-1). + * Only valid after a successfully initializing the audio subsystem. + * The values returned by this function reflect the latest call to + * SDL_GetNumAudioDevices(); recall that function to redetect available + * hardware. + * + * The string returned by this function is UTF-8 encoded, read-only, and + * managed internally. You are not to free it. If you need to keep the + * string for any length of time, you should make your own copy of it, as it + * will be invalid next time any of several other SDL functions is called. + */ +extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, + int iscapture); + + +/** + * Open a specific audio device. Passing in a device name of NULL requests + * the most reasonable default (and is equivalent to calling SDL_OpenAudio()). + * + * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but + * some drivers allow arbitrary and driver-specific strings, such as a + * hostname/IP address for a remote audio server, or a filename in the + * diskaudio driver. + * + * \return 0 on error, a valid device ID that is >= 2 on success. + * + * SDL_OpenAudio(), unlike this function, always acts on device ID 1. + */ +extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char + *device, + int iscapture, + const + SDL_AudioSpec * + desired, + SDL_AudioSpec * + obtained, + int + allowed_changes); + + + +/** + * \name Audio state + * + * Get the current audio state. + */ +/*@{*/ +typedef enum +{ + SDL_AUDIO_STOPPED = 0, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED +} SDL_AudioStatus; +extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void); + +extern DECLSPEC SDL_AudioStatus SDLCALL +SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); +/*@}*//*Audio State*/ + +/** + * \name Pause audio functions + * + * These functions pause and unpause the audio callback processing. + * They should be called with a parameter of 0 after opening the audio + * device to start playing sound. This is so you can safely initialize + * data for your callback function after opening the audio device. + * Silence will be written to the audio device during the pause. + */ +/*@{*/ +extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); +extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, + int pause_on); +/*@}*//*Pause audio functions*/ + +/** + * This function loads a WAVE from the data source, automatically freeing + * that source if \c freesrc is non-zero. For example, to load a WAVE file, + * you could do: + * \code + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * \endcode + * + * If this function succeeds, it returns the given SDL_AudioSpec, + * filled with the audio data format of the wave data, and sets + * \c *audio_buf to a malloc()'d buffer containing the audio data, + * and sets \c *audio_len to the length of that audio buffer, in bytes. + * You need to free the audio buffer with SDL_FreeWAV() when you are + * done with it. + * + * This function returns NULL and sets the SDL error message if the + * wave file cannot be opened, uses an unknown data format, or is + * corrupt. Currently raw and MS-ADPCM WAVE files are supported. + */ +extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, + int freesrc, + SDL_AudioSpec * spec, + Uint8 ** audio_buf, + Uint32 * audio_len); + +/** + * Loads a WAV from a file. + * Compatibility convenience function. + */ +#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ + SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) + +/** + * This function frees data previously allocated with SDL_LoadWAV_RW() + */ +extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); + +/** + * This function takes a source format and rate and a destination format + * and rate, and initializes the \c cvt structure with information needed + * by SDL_ConvertAudio() to convert a buffer of audio data from one format + * to the other. + * + * \return -1 if the format conversion is not supported, 0 if there's + * no conversion needed, or 1 if the audio filter is set up. + */ +extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, + SDL_AudioFormat src_format, + Uint8 src_channels, + int src_rate, + SDL_AudioFormat dst_format, + Uint8 dst_channels, + int dst_rate); + +/** + * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(), + * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of + * audio data in the source format, this function will convert it in-place + * to the desired format. + * + * The data conversion may expand the size of the audio data, so the buffer + * \c cvt->buf should be allocated after the \c cvt structure is initialized by + * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. + */ +extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); + +#define SDL_MIX_MAXVOLUME 128 +/** + * This takes two audio buffers of the playing audio format and mixes + * them, performing addition, volume adjustment, and overflow clipping. + * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME + * for full audio volume. Note this does not change hardware volume. + * This is provided for convenience -- you can mix your own audio data. + */ +extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, + Uint32 len, int volume); + +/** + * This works like SDL_MixAudio(), but you specify the audio format instead of + * using the format of audio device 1. Thus it can be used when no audio + * device is open at all. + */ +extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, + const Uint8 * src, + SDL_AudioFormat format, + Uint32 len, int volume); + +/** + * \name Audio lock functions + * + * The lock manipulated by these functions protects the callback function. + * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that + * the callback function is not running. Do not call these from the callback + * function or you will cause deadlock. + */ +/*@{*/ +extern DECLSPEC void SDLCALL SDL_LockAudio(void); +extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); +extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); +extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); +/*@}*//*Audio lock functions*/ + +/** + * This function shuts down audio processing and closes the audio device. + */ +extern DECLSPEC void SDLCALL SDL_CloseAudio(void); +extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); + +/** + * \return 1 if audio device is still functioning, zero if not, -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_AudioDeviceConnected(SDL_AudioDeviceID dev); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_audio_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_bits.h b/external/SDL2/SDL_bits.h new file mode 100644 index 0000000..39626cd --- /dev/null +++ b/external/SDL2/SDL_bits.h @@ -0,0 +1,94 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_bits.h + * + * Functions for fiddling with bits and bitmasks. + */ + +#ifndef _SDL_bits_h +#define _SDL_bits_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \file SDL_bits.h + */ + +/** + * Get the index of the most significant bit. Result is undefined when called + * with 0. This operation can also be stated as "count leading zeroes" and + * "log base 2". + * + * \return Index of the most significant bit. + */ +SDL_FORCE_INLINE Sint8 +SDL_MostSignificantBitIndex32(Uint32 x) +{ +#if defined(__GNUC__) && __GNUC__ >= 4 + /* Count Leading Zeroes builtin in GCC. + * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html + */ + return 31 - __builtin_clz(x); +#else + /* Based off of Bit Twiddling Hacks by Sean Eron Anderson + * , released in the public domain. + * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog + */ + const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; + const Uint8 S[] = {1, 2, 4, 8, 16}; + + Uint8 msbIndex = 0; + int i; + + for (i = 4; i >= 0; i--) + { + if (x & b[i]) + { + x >>= S[i]; + msbIndex |= S[i]; + } + } + + return msbIndex; +#endif +} + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_bits_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_blendmode.h b/external/SDL2/SDL_blendmode.h new file mode 100644 index 0000000..916797f --- /dev/null +++ b/external/SDL2/SDL_blendmode.h @@ -0,0 +1,60 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_blendmode.h + * + * Header file declaring the SDL_BlendMode enumeration + */ + +#ifndef _SDL_blendmode_h +#define _SDL_blendmode_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief The blend mode used in SDL_RenderCopy() and drawing operations. + */ +typedef enum +{ + SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */ + SDL_BLENDMODE_BLEND = 0x00000001, /**< dst = (src * A) + (dst * (1-A)) */ + SDL_BLENDMODE_ADD = 0x00000002, /**< dst = (src * A) + dst */ + SDL_BLENDMODE_MOD = 0x00000004 /**< dst = src * dst */ +} SDL_BlendMode; + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_clipboard.h b/external/SDL2/SDL_clipboard.h new file mode 100644 index 0000000..db33feb --- /dev/null +++ b/external/SDL2/SDL_clipboard.h @@ -0,0 +1,75 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_clipboard.h + * + * Include file for SDL clipboard handling + */ + +#ifndef _SDL_clipboard_h +#define _SDL_clipboard_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* Function prototypes */ + +/** + * \brief Put UTF-8 text into the clipboard + * + * \sa SDL_GetClipboardText() + */ +extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); + +/** + * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() + * + * \sa SDL_SetClipboardText() + */ +extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); + +/** + * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty + * + * \sa SDL_GetClipboardText() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_clipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_config.h b/external/SDL2/SDL_config.h new file mode 100644 index 0000000..dc7816a --- /dev/null +++ b/external/SDL2/SDL_config.h @@ -0,0 +1,51 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_h +#define _SDL_config_h + +#include "SDL_platform.h" + +/** + * \file SDL_config.h + */ + +/* Add any platform that doesn't build using the configure system. */ +#if defined(__WIN32__) +#include "SDL_config_windows.h" +#elif defined(__MACOSX__) +#include "SDL_config_macosx.h" +#elif defined(__IPHONEOS__) +#include "SDL_config_iphoneos.h" +#elif defined(__ANDROID__) +#include "SDL_config_android.h" +#elif defined(__PSP__) +#include "SDL_config_psp.h" +#else +/* This is a minimal configuration just to get SDL running on new platforms */ +#include "SDL_config_minimal.h" +#endif /* platform config */ + +#ifdef USING_GENERATED_CONFIG_H +#error Wrong SDL_config.h, check your include path? +#endif + +#endif /* _SDL_config_h */ diff --git a/external/SDL2/SDL_config_android.h b/external/SDL2/SDL_config_android.h new file mode 100644 index 0000000..996bf2e --- /dev/null +++ b/external/SDL2/SDL_config_android.h @@ -0,0 +1,136 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_android_h +#define _SDL_config_android_h + +#include "SDL_platform.h" + +/** + * \file SDL_config_android.h + * + * This is a configuration that can be used to build SDL for Android + */ + +#include + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 + +#define SIZEOF_VOIDP 4 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_ANDROID 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_ANDROID 1 +#define SDL_HAPTIC_DUMMY 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_ANDROID 1 + +/* Enable OpenGL ES */ +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 + +/* Enable system power support */ +#define SDL_POWER_ANDROID 1 + +#endif /* _SDL_config_android_h */ diff --git a/external/SDL2/SDL_config_iphoneos.h b/external/SDL2/SDL_config_iphoneos.h new file mode 100644 index 0000000..c13a524 --- /dev/null +++ b/external/SDL2/SDL_config_iphoneos.h @@ -0,0 +1,151 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_iphoneos_h +#define _SDL_config_iphoneos_h + +#include "SDL_platform.h" + +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTLBYNAME 1 + +/* enable iPhone version of Core Audio driver */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DISABLED 1 + +/* Enable Unix style SO loading */ +/* Technically this works, but it violates the iPhone developer agreement */ +/* #define SDL_LOADSO_DLOPEN 1 */ + +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DISABLED 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Supported video drivers */ +#define SDL_VIDEO_DRIVER_UIKIT 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* enable OpenGL ES */ +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 + +/* Enable system power support */ +#define SDL_POWER_UIKIT 1 + +/* enable iPhone keyboard support */ +#define SDL_IPHONE_KEYBOARD 1 + +/* enable joystick subsystem */ +#define SDL_JOYSTICK_DISABLED 0 + +/* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed + */ +#define SDL_IPHONE_MAX_GFORCE 5.0 + +#endif /* _SDL_config_iphoneos_h */ diff --git a/external/SDL2/SDL_config_macosx.h b/external/SDL2/SDL_config_macosx.h new file mode 100644 index 0000000..a028cfd --- /dev/null +++ b/external/SDL2/SDL_config_macosx.h @@ -0,0 +1,183 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_macosx_h +#define _SDL_config_macosx_h + +#include "SDL_platform.h" + +/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ +#include + +/* This is a set of defines to configure the SDL features */ + +#ifdef __LP64__ + #define SIZEOF_VOIDP 8 +#else + #define SIZEOF_VOIDP 4 +#endif + +/* Useful headers */ +/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */ +#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) ) +#define HAVE_ALLOCA_H 1 +#endif +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTLBYNAME 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_IOKIT 1 +#define SDL_HAPTIC_IOKIT 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_COCOA 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#undef SDL_VIDEO_DRIVER_X11 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 +#define SDL_VIDEO_DRIVER_X11_XRANDR 1 +#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 +#define SDL_VIDEO_DRIVER_X11_XSHAPE 1 +#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 +#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 + +#ifdef MAC_OS_X_VERSION_10_8 +/* + * No matter the versions targeted, this is the 10.8 or later SDK, so you have + * to use the external Xquartz, which is a more modern Xlib. Previous SDKs + * used an older Xlib. + */ +#define SDL_VIDEO_DRIVER_X11_XINPUT2 1 +#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 +#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1 +#endif + +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_CGL +#define SDL_VIDEO_OPENGL_CGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_GLX +#define SDL_VIDEO_OPENGL_GLX 1 +#endif + +/* Enable system power support */ +#define SDL_POWER_MACOSX 1 + +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 +#ifdef __ppc__ +#define SDL_ALTIVEC_BLITTERS 1 +#endif + +#endif /* _SDL_config_macosx_h */ diff --git a/external/SDL2/SDL_config_minimal.h b/external/SDL2/SDL_config_minimal.h new file mode 100644 index 0000000..4f2a53b --- /dev/null +++ b/external/SDL2/SDL_config_minimal.h @@ -0,0 +1,302 @@ +/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_minimal_h +#define _SDL_config_minimal_h + +/** + * \file SDL_config.h.in + * + * This is a set of defines to configure the SDL features + */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +/* Make sure that this isn't included by Visual C++ */ +#ifdef _MSC_VER +#error You should run hg revert SDL_config.h +#endif + +/* C language features */ +/* #undef const */ +/* #undef inline */ +/* #undef volatile */ + +/* C datatypes */ +#define SIZEOF_VOIDP 4 +#define HAVE_GCC_ATOMICS 1 +/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */ +#define HAVE_PTHREAD_SPINLOCK 1 + +/* Comment this if you want to build without any C library requirements */ +#define HAVE_LIBC 1 +#if HAVE_LIBC + +/* Useful headers */ +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_SIGNAL_H 1 +/* #undef HAVE_ALTIVEC_H */ +/* #undef HAVE_PTHREAD_NP_H */ +#define HAVE_LIBUDEV_H 1 +#define HAVE_DBUS_DBUS_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#endif +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +/* #undef HAVE_STRLCPY */ +/* #undef HAVE_STRLCAT */ +#define HAVE_STRDUP 1 +/* #undef HAVE__STRREV */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ +/* #undef HAVE_INDEX */ +/* #undef HAVE_RINDEX */ +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +/* #undef HAVE_ITOA */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__UITOA */ +/* #undef HAVE__ULTOA */ +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +/* #undef HAVE__I64TOA */ +/* #undef HAVE__UI64TOA */ +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +/* #undef HAVE__STRICMP */ +#define HAVE_STRCASECMP 1 +/* #undef HAVE__STRNICMP */ +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI /**/ +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_FSEEKO 1 +#define HAVE_FSEEKO64 1 +#define HAVE_SIGACTION 1 +#define HAVE_SA_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +/* #undef HAVE_SYSCTLBYNAME */ +/* #undef HAVE_CLOCK_GETTIME */ +/* #undef HAVE_GETPAGESIZE */ +#define HAVE_MPROTECT 1 +#define HAVE_ICONV 1 +#define HAVE_PTHREAD_SETNAME_NP 1 +/* #undef HAVE_PTHREAD_SET_NAME_NP */ +#define HAVE_SEM_TIMEDWAIT 1 + +#else +/* We may need some replacement for stdarg.h here */ +#include +#endif /* HAVE_LIBC */ + +/* SDL internal assertion support */ +/* #undef SDL_DEFAULT_ASSERT_LEVEL */ + +/* Allow disabling of core subsystems */ +/* #undef SDL_ATOMIC_DISABLED */ +/* #undef SDL_AUDIO_DISABLED */ +/* #undef SDL_CPUINFO_DISABLED */ +/* #undef SDL_EVENTS_DISABLED */ +/* #undef SDL_FILE_DISABLED */ +/* #undef SDL_JOYSTICK_DISABLED */ +/* #undef SDL_HAPTIC_DISABLED */ +/* #undef SDL_LOADSO_DISABLED */ +/* #undef SDL_RENDER_DISABLED */ +/* #undef SDL_THREADS_DISABLED */ +/* #undef SDL_TIMERS_DISABLED */ +/* #undef SDL_VIDEO_DISABLED */ +/* #undef SDL_POWER_DISABLED */ + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_ALSA 1 +#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2" +/* #undef SDL_AUDIO_DRIVER_ARTS */ +/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ +#define SDL_AUDIO_DRIVER_PULSEAUDIO 1 +#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "libpulse-simple.so.0" +/* #undef SDL_AUDIO_DRIVER_BEOSAUDIO */ +/* #undef SDL_AUDIO_DRIVER_BSD */ +/* #undef SDL_AUDIO_DRIVER_COREAUDIO */ +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 +/* #undef SDL_AUDIO_DRIVER_XAUDIO2 */ +/* #undef SDL_AUDIO_DRIVER_DSOUND */ +/* #undef SDL_AUDIO_DRIVER_ESD */ +/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ +/* #undef SDL_AUDIO_DRIVER_NAS */ +/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */ +#define SDL_AUDIO_DRIVER_OSS 1 +/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ +/* #undef SDL_AUDIO_DRIVER_PAUDIO */ +/* #undef SDL_AUDIO_DRIVER_QSA */ +/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ +/* #undef SDL_AUDIO_DRIVER_WINMM */ +/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */ +/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ + +/* Enable various input drivers */ +#define SDL_INPUT_LINUXEV 1 +/* #undef SDL_INPUT_TSLIB */ +/* #undef SDL_JOYSTICK_BEOS */ +/* #undef SDL_JOYSTICK_DINPUT */ +/* #undef SDL_JOYSTICK_DUMMY */ +/* #undef SDL_JOYSTICK_IOKIT */ +#define SDL_JOYSTICK_LINUX 1 +/* #undef SDL_JOYSTICK_WINMM */ +/* #undef SDL_JOYSTICK_USBHID */ +/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */ +/* #undef SDL_HAPTIC_DUMMY */ +#define SDL_HAPTIC_LINUX 1 +/* #undef SDL_HAPTIC_IOKIT */ +/* #undef SDL_HAPTIC_DINPUT */ + +/* Enable various shared object loading systems */ +/* #undef SDL_LOADSO_BEOS */ +#define SDL_LOADSO_DLOPEN 1 +/* #undef SDL_LOADSO_DUMMY */ +/* #undef SDL_LOADSO_LDG */ +/* #undef SDL_LOADSO_WINDOWS */ + +/* Enable various threading systems */ +/* #undef SDL_THREAD_BEOS */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 +/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ +/* #undef SDL_THREAD_WINDOWS */ + +/* Enable various timer systems */ +/* #undef SDL_TIMER_BEOS */ +/* #undef SDL_TIMER_DUMMY */ +#define SDL_TIMER_UNIX 1 +/* #undef SDL_TIMER_WINDOWS */ + +/* Enable various video drivers */ +/* #undef SDL_VIDEO_DRIVER_BWINDOW */ +/* #undef SDL_VIDEO_DRIVER_COCOA */ +/* #undef SDL_VIDEO_DRIVER_DIRECTFB */ +/* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +/* #undef SDL_VIDEO_DRIVER_WINDOWS */ +#define SDL_VIDEO_DRIVER_X11 1 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "libXcursor.so.1" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "libXinerama.so.1" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "libXi.so.6" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "libXrandr.so.2" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "libXss.so.1" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "libXxf86vm.so.1" +#define SDL_VIDEO_DRIVER_X11_XCURSOR 1 +#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 +#define SDL_VIDEO_DRIVER_X11_XINPUT2 1 +#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1 +#define SDL_VIDEO_DRIVER_X11_XRANDR 1 +#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 +#define SDL_VIDEO_DRIVER_X11_XSHAPE 1 +#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 +#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 +/* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */ +#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 + +/* #undef SDL_VIDEO_RENDER_D3D */ +#define SDL_VIDEO_RENDER_OGL 1 +/* #undef SDL_VIDEO_RENDER_OGL_ES */ +/* #undef SDL_VIDEO_RENDER_OGL_ES2 */ +/* #undef SDL_VIDEO_RENDER_DIRECTFB */ + +/* Enable OpenGL support */ +#define SDL_VIDEO_OPENGL 1 +/* #undef SDL_VIDEO_OPENGL_ES */ +/* #undef SDL_VIDEO_OPENGL_BGL */ +/* #undef SDL_VIDEO_OPENGL_CGL */ +#define SDL_VIDEO_OPENGL_GLX 1 +/* #undef SDL_VIDEO_OPENGL_WGL */ +/* #undef SDL_VIDEO_OPENGL_OSMESA */ +/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ + +/* Enable system power support */ +#define SDL_POWER_LINUX 1 +/* #undef SDL_POWER_WINDOWS */ +/* #undef SDL_POWER_MACOSX */ +/* #undef SDL_POWER_BEOS */ +/* #undef SDL_POWER_HARDWIRED */ + +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 +/* #undef SDL_ALTIVEC_BLITTERS */ + +#endif /* _SDL_config_minimal_h */ diff --git a/external/SDL2/SDL_config_nintendods.h b/external/SDL2/SDL_config_nintendods.h new file mode 100644 index 0000000..c48ab80 --- /dev/null +++ b/external/SDL2/SDL_config_nintendods.h @@ -0,0 +1,129 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_nintendods_h +#define _SDL_config_nintendods_h + +#include "SDL_platform.h" + +/* This is a set of defines to configure the SDL features */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; + +/* LiF: __PTRDIFF_TYPE__ was causing errors of conflicting typedefs with the + shipping with devkitARM. copied a similar ifdef from it. */ +#ifndef __PTRDIFF_TYPE__ +typedef unsigned long uintptr_t; +#else +typedef unsigned __PTRDIFF_TYPE__ uintptr_t; +#endif +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#define SIZEOF_VOIDP 4 + +/* Useful headers */ +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_CTYPE_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_INDEX 1 +#define HAVE_RINDEX 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 + +/* DS isn't that sophisticated */ +#define LACKS_SYS_MMAN_H 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_NDS 1 +/*#define SDL_AUDIO_DRIVER_DUMMY 1 TODO: uncomment this later*/ + +/* Enable various input drivers */ +#define SDL_JOYSTICK_NDS 1 +/*#define SDL_JOYSTICK_DUMMY 1 TODO: uncomment this later*/ + +/* DS has no dynamic linking afaik */ +#define SDL_LOADSO_DISABLED 1 + +/* Enable various threading systems */ +/*#define SDL_THREAD_NDS 1*/ +#define SDL_THREADS_DISABLED 1 + +/* Enable various timer systems */ +#define SDL_TIMER_NDS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_NDS 1 +#ifdef USE_HW_RENDERER +#define SDL_VIDEO_RENDER_NDS 1 +#else +#define SDL_VIDEO_RENDER_NDS 0 +#endif + +/* Enable system power support */ +#define SDL_POWER_NINTENDODS 1 + +/* Enable haptic support */ +#define SDL_HAPTIC_NDS 1 + +#define SDL_BYTEORDER SDL_LIL_ENDIAN + +#endif /* _SDL_config_nintendods_h */ diff --git a/external/SDL2/SDL_config_pandora.h b/external/SDL2/SDL_config_pandora.h new file mode 100644 index 0000000..7ec8f44 --- /dev/null +++ b/external/SDL2/SDL_config_pandora.h @@ -0,0 +1,124 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_h +#define _SDL_config_h + +/* This is a set of defines to configure the SDL features */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#define SDL_BYTEORDER 1234 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 + +#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_OSS 1 + +#define SDL_INPUT_LINUXEV 1 +#define SDL_INPUT_TSLIB 1 +#define SDL_JOYSTICK_LINUX 1 +#define SDL_HAPTIC_LINUX 1 + +#define SDL_LOADSO_DLOPEN 1 + +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 + +#define SDL_TIMER_UNIX 1 + +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_X11 1 +#define SDL_VIDEO_DRIVER_PANDORA 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_OPENGL_ES 1 + +#endif /* _SDL_config_h */ diff --git a/external/SDL2/SDL_config_windows.h b/external/SDL2/SDL_config_windows.h new file mode 100644 index 0000000..a120a7b --- /dev/null +++ b/external/SDL2/SDL_config_windows.h @@ -0,0 +1,192 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_windows_h +#define _SDL_config_windows_h + +#include "SDL_platform.h" + +/* This is a set of defines to configure the SDL features */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __GNUC__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#ifdef _WIN64 +# define SIZEOF_VOIDP 8 +#else +# define SIZEOF_VOIDP 4 +#endif + +/* Enabled for SDL 1.2 (binary compatibility) */ +//#define HAVE_LIBC 1 +#ifdef HAVE_LIBC +/* Useful headers */ +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +#define HAVE__STRUPR 1 +#define HAVE__STRLWR 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_ITOA 1 +#define HAVE__LTOA 1 +#define HAVE__ULTOA 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE_SSCANF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_DSOUND 1 +#ifndef __GNUC__ +#define SDL_AUDIO_DRIVER_XAUDIO2 1 +#endif +#define SDL_AUDIO_DRIVER_WINMM 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_DINPUT 1 +#define SDL_HAPTIC_DINPUT 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#define SDL_THREAD_WINDOWS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 + +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_WGL +#define SDL_VIDEO_OPENGL_WGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif + +/* Enable system power support */ +#define SDL_POWER_WINDOWS 1 + +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + +#endif /* _SDL_config_windows_h */ diff --git a/external/SDL2/SDL_config_wiz.h b/external/SDL2/SDL_config_wiz.h new file mode 100644 index 0000000..a767860 --- /dev/null +++ b/external/SDL2/SDL_config_wiz.h @@ -0,0 +1,119 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_h +#define _SDL_config_h + +/* This is a set of defines to configure the SDL features */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +#define SDL_BYTEORDER 1234 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_POW 1 + +#define SDL_CDROM_DISABLED 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_OSS 1 + +#define SDL_INPUT_LINUXEV 1 +#define SDL_INPUT_TSLIB 1 +#define SDL_JOYSTICK_LINUX 1 +#define SDL_HAPTIC_LINUX 1 + +#define SDL_LOADSO_DLOPEN 1 + +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 + +#define SDL_TIMER_UNIX 1 + +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_PANDORA 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_OPENGL_ES 1 + +#endif /* _SDL_config_h */ diff --git a/external/SDL2/SDL_copying.h b/external/SDL2/SDL_copying.h new file mode 100644 index 0000000..d1a3f31 --- /dev/null +++ b/external/SDL2/SDL_copying.h @@ -0,0 +1,20 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ diff --git a/external/SDL2/SDL_cpuinfo.h b/external/SDL2/SDL_cpuinfo.h new file mode 100644 index 0000000..5569521 --- /dev/null +++ b/external/SDL2/SDL_cpuinfo.h @@ -0,0 +1,150 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_cpuinfo.h + * + * CPU feature detection for SDL. + */ + +#ifndef _SDL_cpuinfo_h +#define _SDL_cpuinfo_h + +#include "SDL_stdinc.h" + +/* Need to do this here because intrin.h has C++ code in it */ +/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +#include +#ifndef _WIN64 +#define __MMX__ +#define __3dNOW__ +#endif +#define __SSE__ +#define __SSE2__ +#elif defined(__MINGW64_VERSION_MAJOR) +#include +#else +#ifdef __ALTIVEC__ +#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#include +#undef pixel +#endif +#endif +#ifdef __MMX__ +#include +#endif +#ifdef __3dNOW__ +#include +#endif +#ifdef __SSE__ +#include +#endif +#ifdef __SSE2__ +#include +#endif +#endif + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* This is a guess for the cacheline size used for padding. + * Most x86 processors have a 64 byte cache line. + * The 64-bit PowerPC processors have a 128 byte cache line. + * We'll use the larger value to be generally safe. + */ +#define SDL_CACHELINE_SIZE 128 + +/** + * This function returns the number of CPU cores available. + */ +extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); + +/** + * This function returns the L1 cache line size of the CPU + * + * This is useful for determining multi-threaded structure padding + * or SIMD prefetch sizes. + */ +extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); + +/** + * This function returns true if the CPU has the RDTSC instruction. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); + +/** + * This function returns true if the CPU has AltiVec features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); + +/** + * This function returns true if the CPU has MMX features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); + +/** + * This function returns true if the CPU has 3DNow! features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); + +/** + * This function returns true if the CPU has SSE features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); + +/** + * This function returns true if the CPU has SSE2 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); + +/** + * This function returns true if the CPU has SSE3 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); + +/** + * This function returns true if the CPU has SSE4.1 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); + +/** + * This function returns true if the CPU has SSE4.2 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_cpuinfo_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_endian.h b/external/SDL2/SDL_endian.h new file mode 100644 index 0000000..d990d3a --- /dev/null +++ b/external/SDL2/SDL_endian.h @@ -0,0 +1,243 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_endian.h + * + * Functions for reading and writing endian-specific values + */ + +#ifndef _SDL_endian_h +#define _SDL_endian_h + +#include "SDL_stdinc.h" + +/** + * \name The two types of endianness + */ +/*@{*/ +#define SDL_LIL_ENDIAN 1234 +#define SDL_BIG_ENDIAN 4321 +/*@}*/ + +#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ +#ifdef __linux__ +#include +#define SDL_BYTEORDER __BYTE_ORDER +#else /* __linux __ */ +#if defined(__hppa__) || \ + defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ + (defined(__MIPS__) && defined(__MISPEB__)) || \ + defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ + defined(__sparc__) +#define SDL_BYTEORDER SDL_BIG_ENDIAN +#else +#define SDL_BYTEORDER SDL_LIL_ENDIAN +#endif +#endif /* __linux __ */ +#endif /* !SDL_BYTEORDER */ + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \file SDL_endian.h + */ +#if defined(__GNUC__) && defined(__i386__) && \ + !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + __asm__("xchgb %b0,%h0": "=q"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && defined(__x86_64__) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + int result; + + __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x)); + return (Uint16)result; +} +#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); + return x; +} +#else +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); +} +#endif + +#if defined(__GNUC__) && defined(__i386__) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + __asm__("bswap %0": "=r"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && defined(__x86_64__) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + __asm__("bswapl %0": "=r"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + Uint32 result; + + __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x)); + __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x)); + __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x)); + return result; +} +#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); + return x; +} +#else +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | + ((x >> 8) & 0x0000FF00) | (x >> 24))); +} +#endif + +#if defined(__GNUC__) && defined(__i386__) +SDL_FORCE_INLINE Uint64 +SDL_Swap64(Uint64 x) +{ + union + { + struct + { + Uint32 a, b; + } s; + Uint64 u; + } v; + v.u = x; + __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a), + "1"(v.s. + b)); + return v.u; +} +#elif defined(__GNUC__) && defined(__x86_64__) +SDL_FORCE_INLINE Uint64 +SDL_Swap64(Uint64 x) +{ + __asm__("bswapq %0": "=r"(x):"0"(x)); + return x; +} +#else +SDL_FORCE_INLINE Uint64 +SDL_Swap64(Uint64 x) +{ + Uint32 hi, lo; + + /* Separate into high and low 32-bit values and swap them */ + lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); + x >>= 32; + hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); + x = SDL_Swap32(lo); + x <<= 32; + x |= SDL_Swap32(hi); + return (x); +} +#endif + + +SDL_FORCE_INLINE float +SDL_SwapFloat(float x) +{ + union + { + float f; + Uint32 ui32; + } swapper; + swapper.f = x; + swapper.ui32 = SDL_Swap32(swapper.ui32); + return swapper.f; +} + + +/** + * \name Swap to native + * Byteswap item from the specified endianness to the native endianness. + */ +/*@{*/ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define SDL_SwapLE16(X) (X) +#define SDL_SwapLE32(X) (X) +#define SDL_SwapLE64(X) (X) +#define SDL_SwapFloatLE(X) (X) +#define SDL_SwapBE16(X) SDL_Swap16(X) +#define SDL_SwapBE32(X) SDL_Swap32(X) +#define SDL_SwapBE64(X) SDL_Swap64(X) +#define SDL_SwapFloatBE(X) SDL_SwapFloat(X) +#else +#define SDL_SwapLE16(X) SDL_Swap16(X) +#define SDL_SwapLE32(X) SDL_Swap32(X) +#define SDL_SwapLE64(X) SDL_Swap64(X) +#define SDL_SwapFloatLE(X) SDL_SwapFloat(X) +#define SDL_SwapBE16(X) (X) +#define SDL_SwapBE32(X) (X) +#define SDL_SwapBE64(X) (X) +#define SDL_SwapFloatBE(X) (X) +#endif +/*@}*//*Swap to native*/ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_endian_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_error.h b/external/SDL2/SDL_error.h new file mode 100644 index 0000000..1212ad0 --- /dev/null +++ b/external/SDL2/SDL_error.h @@ -0,0 +1,80 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_error.h + * + * Simple error message routines for SDL. + */ + +#ifndef _SDL_error_h +#define _SDL_error_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* Public functions */ +/* SDL_SetError() unconditionally returns -1. */ +extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...); +extern DECLSPEC const char *SDLCALL SDL_GetError(void); +extern DECLSPEC void SDLCALL SDL_ClearError(void); + +/** + * \name Internal error functions + * + * \internal + * Private error reporting function - used internally. + */ +/*@{*/ +#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) +#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) +#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) +typedef enum +{ + SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_UNSUPPORTED, + SDL_LASTERROR +} SDL_errorcode; +/* SDL_Error() unconditionally returns -1. */ +extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); +/*@}*//*Internal error functions*/ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_error_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_events.h b/external/SDL2/SDL_events.h new file mode 100644 index 0000000..cc45058 --- /dev/null +++ b/external/SDL2/SDL_events.h @@ -0,0 +1,690 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_events.h + * + * Include file for SDL event handling. + */ + +#ifndef _SDL_events_h +#define _SDL_events_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" +#include "SDL_keyboard.h" +#include "SDL_mouse.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "SDL_quit.h" +#include "SDL_gesture.h" +#include "SDL_touch.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* General keyboard/mouse state definitions */ +#define SDL_RELEASED 0 +#define SDL_PRESSED 1 + +/** + * \brief The types of events that can be delivered. + */ +typedef enum +{ + SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */ + + /* Application events */ + SDL_QUIT = 0x100, /**< User-requested quit */ + + /* Window events */ + SDL_WINDOWEVENT = 0x200, /**< Window state change */ + SDL_SYSWMEVENT, /**< System specific event */ + + /* Keyboard events */ + SDL_KEYDOWN = 0x300, /**< Key pressed */ + SDL_KEYUP, /**< Key released */ + SDL_TEXTEDITING, /**< Keyboard text editing (composition) */ + SDL_TEXTINPUT, /**< Keyboard text input */ + + /* Mouse events */ + SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ + SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ + SDL_MOUSEBUTTONUP, /**< Mouse button released */ + SDL_MOUSEWHEEL, /**< Mouse wheel motion */ + + /* Joystick events */ + SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ + SDL_JOYBALLMOTION, /**< Joystick trackball motion */ + SDL_JOYHATMOTION, /**< Joystick hat position change */ + SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ + SDL_JOYBUTTONUP, /**< Joystick button released */ + SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */ + SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */ + + /* Game controller events */ + SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ + SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */ + SDL_CONTROLLERBUTTONUP, /**< Game controller button released */ + SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */ + SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */ + SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */ + + /* Touch events */ + SDL_FINGERDOWN = 0x700, + SDL_FINGERUP, + SDL_FINGERMOTION, + + /* Gesture events */ + SDL_DOLLARGESTURE = 0x800, + SDL_DOLLARRECORD, + SDL_MULTIGESTURE, + + /* Clipboard events */ + SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ + + /* Drag and drop events */ + SDL_DROPFILE = 0x1000, /**< The system requests a file open */ + + /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, + * and should be allocated with SDL_RegisterEvents() + */ + SDL_USEREVENT = 0x8000, + + /** + * This last event is only for bounding internal arrays + */ + SDL_LASTEVENT = 0xFFFF +} SDL_EventType; + +/** + * \brief Fields shared by every event + */ +typedef struct SDL_GenericEvent +{ + Uint32 type; + Uint32 timestamp; +} SDL_GenericEvent; + +/** + * \brief Window state change event data (event.window.*) + */ +typedef struct SDL_WindowEvent +{ + Uint32 type; /**< ::SDL_WINDOWEVENT */ + Uint32 timestamp; + Uint32 windowID; /**< The associated window */ + Uint8 event; /**< ::SDL_WindowEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ + Sint32 data2; /**< event dependent data */ +} SDL_WindowEvent; + +/** + * \brief Keyboard button event structure (event.key.*) + */ +typedef struct SDL_KeyboardEvent +{ + Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ + Uint32 timestamp; + Uint32 windowID; /**< The window with keyboard focus, if any */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 repeat; /**< Non-zero if this is a key repeat */ + Uint8 padding2; + Uint8 padding3; + SDL_Keysym keysym; /**< The key that was pressed or released */ +} SDL_KeyboardEvent; + +#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) +/** + * \brief Keyboard text editing event structure (event.edit.*) + */ +typedef struct SDL_TextEditingEvent +{ + Uint32 type; /**< ::SDL_TEXTEDITING */ + Uint32 timestamp; + Uint32 windowID; /**< The window with keyboard focus, if any */ + char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ + Sint32 start; /**< The start cursor of selected editing text */ + Sint32 length; /**< The length of selected editing text */ +} SDL_TextEditingEvent; + + +#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) +/** + * \brief Keyboard text input event structure (event.text.*) + */ +typedef struct SDL_TextInputEvent +{ + Uint32 type; /**< ::SDL_TEXTINPUT */ + Uint32 timestamp; + Uint32 windowID; /**< The window with keyboard focus, if any */ + char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ +} SDL_TextInputEvent; + +/** + * \brief Mouse motion event structure (event.motion.*) + */ +typedef struct SDL_MouseMotionEvent +{ + Uint32 type; /**< ::SDL_MOUSEMOTION */ + Uint32 timestamp; + Uint32 windowID; /**< The window with mouse focus, if any */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Uint8 state; /**< The current button state */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 x; /**< X coordinate, relative to window */ + Sint32 y; /**< Y coordinate, relative to window */ + Sint32 xrel; /**< The relative motion in the X direction */ + Sint32 yrel; /**< The relative motion in the Y direction */ +} SDL_MouseMotionEvent; + +/** + * \brief Mouse button event structure (event.button.*) + */ +typedef struct SDL_MouseButtonEvent +{ + Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ + Uint32 timestamp; + Uint32 windowID; /**< The window with mouse focus, if any */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Uint8 button; /**< The mouse button index */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 padding1; + Uint8 padding2; + Sint32 x; /**< X coordinate, relative to window */ + Sint32 y; /**< Y coordinate, relative to window */ +} SDL_MouseButtonEvent; + +/** + * \brief Mouse wheel event structure (event.wheel.*) + */ +typedef struct SDL_MouseWheelEvent +{ + Uint32 type; /**< ::SDL_MOUSEWHEEL */ + Uint32 timestamp; + Uint32 windowID; /**< The window with mouse focus, if any */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Sint32 x; /**< The amount scrolled horizontally */ + Sint32 y; /**< The amount scrolled vertically */ +} SDL_MouseWheelEvent; + +/** + * \brief Joystick axis motion event structure (event.jaxis.*) + */ +typedef struct SDL_JoyAxisEvent +{ + Uint32 type; /**< ::SDL_JOYAXISMOTION */ + Uint32 timestamp; + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 axis; /**< The joystick axis index */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint16 value; /**< The axis value (range: -32768 to 32767) */ + Uint16 padding4; +} SDL_JoyAxisEvent; + +/** + * \brief Joystick trackball motion event structure (event.jball.*) + */ +typedef struct SDL_JoyBallEvent +{ + Uint32 type; /**< ::SDL_JOYBALLMOTION */ + Uint32 timestamp; + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 ball; /**< The joystick trackball index */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint16 xrel; /**< The relative motion in the X direction */ + Sint16 yrel; /**< The relative motion in the Y direction */ +} SDL_JoyBallEvent; + +/** + * \brief Joystick hat position change event structure (event.jhat.*) + */ +typedef struct SDL_JoyHatEvent +{ + Uint32 type; /**< ::SDL_JOYHATMOTION */ + Uint32 timestamp; + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 hat; /**< The joystick hat index */ + Uint8 value; /**< The hat position value. + * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP + * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT + * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN + * + * Note that zero means the POV is centered. + */ + Uint8 padding1; + Uint8 padding2; +} SDL_JoyHatEvent; + +/** + * \brief Joystick button event structure (event.jbutton.*) + */ +typedef struct SDL_JoyButtonEvent +{ + Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ + Uint32 timestamp; + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 button; /**< The joystick button index */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 padding1; + Uint8 padding2; +} SDL_JoyButtonEvent; + +/** + * \brief Joystick device event structure (event.jdevice.*) + */ +typedef struct SDL_JoyDeviceEvent +{ + Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ + Uint32 timestamp; + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ +} SDL_JoyDeviceEvent; + + +/** + * \brief Game controller axis motion event structure (event.caxis.*) + */ +typedef struct SDL_ControllerAxisEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ + Uint32 timestamp; + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint16 value; /**< The axis value (range: -32768 to 32767) */ + Uint16 padding4; +} SDL_ControllerAxisEvent; + + +/** + * \brief Game controller button event structure (event.cbutton.*) + */ +typedef struct SDL_ControllerButtonEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ + Uint32 timestamp; + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 button; /**< The controller button (SDL_GameControllerButton) */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 padding1; + Uint8 padding2; +} SDL_ControllerButtonEvent; + + +/** + * \brief Controller device event structure (event.cdevice.*) + */ +typedef struct SDL_ControllerDeviceEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ + Uint32 timestamp; + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ +} SDL_ControllerDeviceEvent; + + +/** + * \brief Touch finger event structure (event.tfinger.*) + */ +typedef struct SDL_TouchFingerEvent +{ + Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ + Uint32 timestamp; + SDL_TouchID touchId; /**< The touch device id */ + SDL_FingerID fingerId; + float x; /**< Normalized in the range 0...1 */ + float y; /**< Normalized in the range 0...1 */ + float dx; /**< Normalized in the range 0...1 */ + float dy; /**< Normalized in the range 0...1 */ + float pressure; /**< Normalized in the range 0...1 */ +} SDL_TouchFingerEvent; + + +/** + * \brief Multiple Finger Gesture Event (event.mgesture.*) + */ +typedef struct SDL_MultiGestureEvent +{ + Uint32 type; /**< ::SDL_MULTIGESTURE */ + Uint32 timestamp; + SDL_TouchID touchId; /**< The touch device index */ + float dTheta; + float dDist; + float x; + float y; + Uint16 numFingers; + Uint16 padding; +} SDL_MultiGestureEvent; + + +/* (event.dgesture.*) */ +typedef struct SDL_DollarGestureEvent +{ + Uint32 type; /**< ::SDL_DOLLARGESTURE */ + Uint32 timestamp; + SDL_TouchID touchId; /**< The touch device id */ + SDL_GestureID gestureId; + Uint32 numFingers; + float error; + float x; /**< Normalized center of gesture */ + float y; /**< Normalized center of gesture */ +} SDL_DollarGestureEvent; + + +/** + * \brief An event used to request a file open by the system (event.drop.*) + * This event is disabled by default, you can enable it with SDL_EventState() + * \note If you enable this event, you must free the filename in the event. + */ +typedef struct SDL_DropEvent +{ + Uint32 type; /**< ::SDL_DROPFILE */ + Uint32 timestamp; + char *file; /**< The file name, which should be freed with SDL_free() */ +} SDL_DropEvent; + + +/** + * \brief The "quit requested" event + */ +typedef struct SDL_QuitEvent +{ + Uint32 type; /**< ::SDL_QUIT */ + Uint32 timestamp; +} SDL_QuitEvent; + + +/** + * \brief A user-defined event type (event.user.*) + */ +typedef struct SDL_UserEvent +{ + Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */ + Uint32 timestamp; + Uint32 windowID; /**< The associated window if any */ + Sint32 code; /**< User defined event code */ + void *data1; /**< User defined data pointer */ + void *data2; /**< User defined data pointer */ +} SDL_UserEvent; + + +struct SDL_SysWMmsg; +typedef struct SDL_SysWMmsg SDL_SysWMmsg; + +/** + * \brief A video driver dependent system event (event.syswm.*) + * This event is disabled by default, you can enable it with SDL_EventState() + * + * \note If you want to use this event, you should include SDL_syswm.h. + */ +typedef struct SDL_SysWMEvent +{ + Uint32 type; /**< ::SDL_SYSWMEVENT */ + Uint32 timestamp; + SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ +} SDL_SysWMEvent; + +/** + * \brief General event structure + */ +typedef union SDL_Event +{ + Uint32 type; /**< Event type, shared with all events */ + SDL_GenericEvent generic; /**< Generic event data */ + SDL_WindowEvent window; /**< Window event data */ + SDL_KeyboardEvent key; /**< Keyboard event data */ + SDL_TextEditingEvent edit; /**< Text editing event data */ + SDL_TextInputEvent text; /**< Text input event data */ + SDL_MouseMotionEvent motion; /**< Mouse motion event data */ + SDL_MouseButtonEvent button; /**< Mouse button event data */ + SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */ + SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */ + SDL_JoyBallEvent jball; /**< Joystick ball event data */ + SDL_JoyHatEvent jhat; /**< Joystick hat event data */ + SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ + SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ + SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ + SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ + SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ + SDL_QuitEvent quit; /**< Quit request event data */ + SDL_UserEvent user; /**< Custom event data */ + SDL_SysWMEvent syswm; /**< System dependent window event data */ + SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ + SDL_MultiGestureEvent mgesture; /**< Gesture event data */ + SDL_DollarGestureEvent dgesture; /**< Gesture event data */ + SDL_DropEvent drop; /**< Drag and drop event data */ + + /* This is necessary for ABI compatibility between Visual C++ and GCC + Visual C++ will respect the push pack pragma and use 52 bytes for + this structure, and GCC will use the alignment of the largest datatype + within the union, which is 8 bytes. + + So... we'll add padding to force the size to be 56 bytes for both. + */ + Uint8 padding[56]; +} SDL_Event; + + +/* Function prototypes */ + +/** + * Pumps the event loop, gathering events from the input devices. + * + * This function updates the event queue and internal input device state. + * + * This should only be run in the thread that sets the video mode. + */ +extern DECLSPEC void SDLCALL SDL_PumpEvents(void); + +/*@{*/ +typedef enum +{ + SDL_ADDEVENT, + SDL_PEEKEVENT, + SDL_GETEVENT +} SDL_eventaction; + +/** + * Checks the event queue for messages and optionally returns them. + * + * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to + * the back of the event queue. + * + * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will not be removed from the queue. + * + * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will be removed from the queue. + * + * \return The number of events actually stored, or -1 if there was an error. + * + * This function is thread-safe. + */ +extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, + SDL_eventaction action, + Uint32 minType, Uint32 maxType); +/*@}*/ + +/** + * Checks to see if certain event types are in the event queue. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); +extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); + +/** + * This function clears events from the event queue + */ +extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); +extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); + +/** + * \brief Polls for currently pending events. + * + * \return 1 if there are any pending events, or 0 if there are none available. + * + * \param event If not NULL, the next event is removed from the queue and + * stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event); + +/** + * \brief Waits indefinitely for the next available event. + * + * \return 1, or 0 if there was an error while waiting for events. + * + * \param event If not NULL, the next event is removed from the queue and + * stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event); + +/** + * \brief Waits until the specified timeout (in milliseconds) for the next + * available event. + * + * \return 1, or 0 if there was an error while waiting for events. + * + * \param event If not NULL, the next event is removed from the queue and + * stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event, + int timeout); + +/** + * \brief Add an event to the event queue. + * + * \return 1 on success, 0 if the event was filtered, or -1 if the event queue + * was full or there was some other error. + */ +extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event); + +typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event); + +/** + * Sets up a filter to process all events before they change internal state and + * are posted to the internal event queue. + * + * The filter is protypted as: + * \code + * int SDL_EventFilter(void *userdata, SDL_Event * event); + * \endcode + * + * If the filter returns 1, then the event will be added to the internal queue. + * If it returns 0, then the event will be dropped from the queue, but the + * internal state will still be updated. This allows selective filtering of + * dynamically arriving events. + * + * \warning Be very careful of what you do in the event filter function, as + * it may run in a different thread! + * + * There is one caveat when dealing with the ::SDL_QUITEVENT event type. The + * event filter is only called when the window manager desires to close the + * application window. If the event filter returns 1, then the window will + * be closed, otherwise the window will remain open if possible. + * + * If the quit event is generated by an interrupt signal, it will bypass the + * internal queue and be delivered to the application at the next event poll. + */ +extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, + void *userdata); + +/** + * Return the current event filter - can be used to "chain" filters. + * If there is no event filter set, this function returns SDL_FALSE. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter, + void **userdata); + +/** + * Add a function which is called when an event is added to the queue. + */ +extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, + void *userdata); + +/** + * Remove an event watch function added with SDL_AddEventWatch() + */ +extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, + void *userdata); + +/** + * Run the filter function on the current event queue, removing any + * events for which the filter returns 0. + */ +extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, + void *userdata); + +/*@{*/ +#define SDL_QUERY -1 +#define SDL_IGNORE 0 +#define SDL_DISABLE 0 +#define SDL_ENABLE 1 + +/** + * This function allows you to set the state of processing certain events. + * - If \c state is set to ::SDL_IGNORE, that event will be automatically + * dropped from the event queue and will not event be filtered. + * - If \c state is set to ::SDL_ENABLE, that event will be processed + * normally. + * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the + * current processing state of the specified event. + */ +extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); +/*@}*/ +#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY) + +/** + * This function allocates a set of user-defined events, and returns + * the beginning event number for that set of events. + * + * If there aren't enough user-defined events left, this function + * returns (Uint32)-1 + */ +extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_events_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_gamecontroller.h b/external/SDL2/SDL_gamecontroller.h new file mode 100644 index 0000000..bc97df9 --- /dev/null +++ b/external/SDL2/SDL_gamecontroller.h @@ -0,0 +1,298 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_gamecontroller.h + * + * Include file for SDL game controller event handling + */ + +#ifndef _SDL_gamecontroller_h +#define _SDL_gamecontroller_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_joystick.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \file SDL_gamecontroller.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + * for game controllers, and load appropriate drivers. + */ + +/* The gamecontroller structure used to identify an SDL game controller */ +struct _SDL_GameController; +typedef struct _SDL_GameController SDL_GameController; + + +typedef enum +{ + SDL_CONTROLLER_BINDTYPE_NONE = 0, + SDL_CONTROLLER_BINDTYPE_BUTTON, + SDL_CONTROLLER_BINDTYPE_AXIS, + SDL_CONTROLLER_BINDTYPE_HAT +} SDL_GameControllerBindType; + +/** + * Get the SDL joystick layer binding for this controller button/axis mapping + */ +typedef struct SDL_GameControllerButtonBind +{ + SDL_GameControllerBindType bindType; + union + { + int button; + int axis; + struct { + int hat; + int hat_mask; + } hat; + } value; + +} SDL_GameControllerButtonBind; + + +/** + * To count the number of game controllers in the system for the following: + * int nJoysticks = SDL_NumJoysticks(); + * int nGameControllers = 0; + * for ( int i = 0; i < nJoysticks; i++ ) { + * if ( SDL_IsGameController(i) ) { + * nGameControllers++; + * } + * } + * + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: + * guid,name,mappings + * + * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. + * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. + * The mapping format for joystick is: + * bX - a joystick button, index X + * hX.Y - hat X with value Y + * aX - axis X of the joystick + * Buttons can be used as a controller axis and vice versa. + * + * This string shows an example of a valid mapping for a controller + * "341a3608000000000000504944564944,Aferglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * + */ + +/** + * Add or update an existing mapping configuration + * + * \return 1 if mapping is added, 0 if updated, -1 on error + */ +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingSring ); + +/** + * Get a mapping string for a GUID + * + * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); + +/** + * Get a mapping string for an open GameController + * + * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller ); + +/** + * Is the joystick on this index supported by the game controller interface? + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); + + +/** + * Get the implementation dependent name of a game controller. + * This can be called before any controllers are opened. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); + +/** + * Open a game controller for use. + * The index passed as an argument refers to the N'th game controller on the system. + * This index is the value which will identify this controller in future controller + * events. + * + * \return A controller identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); + +/** + * Return the name for this currently opened controller + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); + +/** + * Returns SDL_TRUE if the controller has been opened and currently connected, + * or SDL_FALSE if it has not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller); + +/** + * Get the underlying joystick object used by a controller + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); + +/** + * Enable/disable controller event polling. + * + * If controller events are disabled, you must call SDL_GameControllerUpdate() + * yourself and check the state of the controller when you want controller + * information. + * + * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); + +/** + * Update the current state of the open game controllers. + * + * This is called automatically by the event loop if any game controller + * events are enabled. + */ +extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); + + +/** + * The list of axii available from a controller + */ +typedef enum +{ + SDL_CONTROLLER_AXIS_INVALID = -1, + SDL_CONTROLLER_AXIS_LEFTX, + SDL_CONTROLLER_AXIS_LEFTY, + SDL_CONTROLLER_AXIS_RIGHTX, + SDL_CONTROLLER_AXIS_RIGHTY, + SDL_CONTROLLER_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_AXIS_MAX +} SDL_GameControllerAxis; + +/** + * turn this string into a axis mapping + */ +extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString); + +/** + * turn this axis enum into a string mapping + */ +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); + +/** + * Get the SDL joystick layer binding for this controller button mapping + */ +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL +SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, + SDL_GameControllerAxis axis); + +/** + * Get the current state of an axis control on a game controller. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + */ +extern DECLSPEC Sint16 SDLCALL +SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, + SDL_GameControllerAxis axis); + +/** + * The list of buttons available from a controller + */ +typedef enum +{ + SDL_CONTROLLER_BUTTON_INVALID = -1, + SDL_CONTROLLER_BUTTON_A, + SDL_CONTROLLER_BUTTON_B, + SDL_CONTROLLER_BUTTON_X, + SDL_CONTROLLER_BUTTON_Y, + SDL_CONTROLLER_BUTTON_BACK, + SDL_CONTROLLER_BUTTON_GUIDE, + SDL_CONTROLLER_BUTTON_START, + SDL_CONTROLLER_BUTTON_LEFTSTICK, + SDL_CONTROLLER_BUTTON_RIGHTSTICK, + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + SDL_CONTROLLER_BUTTON_MAX +} SDL_GameControllerButton; + +/** + * turn this string into a button mapping + */ +extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString); + +/** + * turn this button enum into a string mapping + */ +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); + +/** + * Get the SDL joystick layer binding for this controller button mapping + */ +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL +SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, + SDL_GameControllerButton button); + + +/** + * Get the current state of a button on a game controller. + * + * The button indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, + SDL_GameControllerButton button); + +/** + * Close a controller previously opened with SDL_GameControllerOpen(). + */ +extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_gamecontroller_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_gesture.h b/external/SDL2/SDL_gesture.h new file mode 100644 index 0000000..6baf7ab --- /dev/null +++ b/external/SDL2/SDL_gesture.h @@ -0,0 +1,91 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_gesture.h + * + * Include file for SDL gesture event handling. + */ + +#ifndef _SDL_gesture_h +#define _SDL_gesture_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "SDL_touch.h" + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +typedef Sint64 SDL_GestureID; + +/* Function prototypes */ + +/** + * \brief Begin Recording a gesture on the specified touch, or all touches (-1) + * + * + */ +extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); + + +/** + * \brief Save all currently loaded Dollar Gesture templates + * + * + */ +extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src); + +/** + * \brief Save a currently loaded Dollar Gesture template + * + * + */ +extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src); + + +/** + * \brief Load Dollar Gesture templates from a file + * + * + */ +extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_gesture_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_haptic.h b/external/SDL2/SDL_haptic.h new file mode 100644 index 0000000..cfcd9ea --- /dev/null +++ b/external/SDL2/SDL_haptic.h @@ -0,0 +1,1200 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_haptic.h + * + * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) + * devices. + * + * The basic usage is as follows: + * - Initialize the Subsystem (::SDL_INIT_HAPTIC). + * - Open a Haptic Device. + * - SDL_HapticOpen() to open from index. + * - SDL_HapticOpenFromJoystick() to open from an existing joystick. + * - Create an effect (::SDL_HapticEffect). + * - Upload the effect with SDL_HapticNewEffect(). + * - Run the effect with SDL_HapticRunEffect(). + * - (optional) Free the effect with SDL_HapticDestroyEffect(). + * - Close the haptic device with SDL_HapticClose(). + * + * \par Simple rumble example: + * \code + * SDL_Haptic *haptic; + * + * // Open the device + * haptic = SDL_HapticOpen( 0 ); + * if (haptic == NULL) + * return -1; + * + * // Initialize simple rumble + * if (SDL_HapticRumbleInit( haptic ) != 0) + * return -1; + * + * // Play effect at 50% strength for 2 seconds + * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) + * return -1; + * SDL_Delay( 2000 ); + * + * // Clean up + * SDL_HapticClose( haptic ); + * \endcode + * + * \par Complete example: + * \code + * int test_haptic( SDL_Joystick * joystick ) { + * SDL_Haptic *haptic; + * SDL_HapticEffect effect; + * int effect_id; + * + * // Open the device + * haptic = SDL_HapticOpenFromJoystick( joystick ); + * if (haptic == NULL) return -1; // Most likely joystick isn't haptic + * + * // See if it can do sine waves + * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) { + * SDL_HapticClose(haptic); // No sine effect + * return -1; + * } + * + * // Create the effect + * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default + * effect.type = SDL_HAPTIC_SINE; + * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates + * effect.periodic.direction.dir[0] = 18000; // Force comes from south + * effect.periodic.period = 1000; // 1000 ms + * effect.periodic.magnitude = 20000; // 20000/32767 strength + * effect.periodic.length = 5000; // 5 seconds long + * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength + * effect.periodic.fade_length = 1000; // Takes 1 second to fade away + * + * // Upload the effect + * effect_id = SDL_HapticNewEffect( haptic, &effect ); + * + * // Test the effect + * SDL_HapticRunEffect( haptic, effect_id, 1 ); + * SDL_Delay( 5000); // Wait for the effect to finish + * + * // We destroy the effect, although closing the device also does this + * SDL_HapticDestroyEffect( haptic, effect_id ); + * + * // Close the device + * SDL_HapticClose(haptic); + * + * return 0; // Success + * } + * \endcode + * + * You can also find out more information on my blog: + * http://bobbens.dyndns.org/journal/2010/sdl_haptic/ + * + * \author Edgar Simo Serra + */ + +#ifndef _SDL_haptic_h +#define _SDL_haptic_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_joystick.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { + /* *INDENT-ON* */ +#endif /* __cplusplus */ + +/** + * \typedef SDL_Haptic + * + * \brief The haptic structure used to identify an SDL haptic. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticOpenFromJoystick + * \sa SDL_HapticClose + */ +struct _SDL_Haptic; +typedef struct _SDL_Haptic SDL_Haptic; + + +/** + * \name Haptic features + * + * Different haptic features a device can have. + */ +/*@{*/ + +/** + * \name Haptic effects + */ +/*@{*/ + +/** + * \brief Constant effect supported. + * + * Constant haptic effect. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_CONSTANT (1<<0) + +/** + * \brief Sine wave effect supported. + * + * Periodic haptic effect that simulates sine waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_SINE (1<<1) + +/** + * \brief Square wave effect supported. + * + * Periodic haptic effect that simulates square waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_SQUARE (1<<2) + +/** + * \brief Triangle wave effect supported. + * + * Periodic haptic effect that simulates triangular waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_TRIANGLE (1<<3) + +/** + * \brief Sawtoothup wave effect supported. + * + * Periodic haptic effect that simulates saw tooth up waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_SAWTOOTHUP (1<<4) + +/** + * \brief Sawtoothdown wave effect supported. + * + * Periodic haptic effect that simulates saw tooth down waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) + +/** + * \brief Ramp effect supported. + * + * Ramp haptic effect. + * + * \sa SDL_HapticRamp + */ +#define SDL_HAPTIC_RAMP (1<<6) + +/** + * \brief Spring effect supported - uses axes position. + * + * Condition haptic effect that simulates a spring. Effect is based on the + * axes position. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_SPRING (1<<7) + +/** + * \brief Damper effect supported - uses axes velocity. + * + * Condition haptic effect that simulates dampening. Effect is based on the + * axes velocity. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_DAMPER (1<<8) + +/** + * \brief Inertia effect supported - uses axes acceleration. + * + * Condition haptic effect that simulates inertia. Effect is based on the axes + * acceleration. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_INERTIA (1<<9) + +/** + * \brief Friction effect supported - uses axes movement. + * + * Condition haptic effect that simulates friction. Effect is based on the + * axes movement. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_FRICTION (1<<10) + +/** + * \brief Custom effect is supported. + * + * User defined custom haptic effect. + */ +#define SDL_HAPTIC_CUSTOM (1<<11) + +/*@}*//*Haptic effects*/ + +/* These last few are features the device has, not effects */ + +/** + * \brief Device can set global gain. + * + * Device supports setting the global gain. + * + * \sa SDL_HapticSetGain + */ +#define SDL_HAPTIC_GAIN (1<<12) + +/** + * \brief Device can set autocenter. + * + * Device supports setting autocenter. + * + * \sa SDL_HapticSetAutocenter + */ +#define SDL_HAPTIC_AUTOCENTER (1<<13) + +/** + * \brief Device can be queried for effect status. + * + * Device can be queried for effect status. + * + * \sa SDL_HapticGetEffectStatus + */ +#define SDL_HAPTIC_STATUS (1<<14) + +/** + * \brief Device can be paused. + * + * \sa SDL_HapticPause + * \sa SDL_HapticUnpause + */ +#define SDL_HAPTIC_PAUSE (1<<15) + + +/** + * \name Direction encodings + */ +/*@{*/ + +/** + * \brief Uses polar coordinates for the direction. + * + * \sa SDL_HapticDirection + */ +#define SDL_HAPTIC_POLAR 0 + +/** + * \brief Uses cartesian coordinates for the direction. + * + * \sa SDL_HapticDirection + */ +#define SDL_HAPTIC_CARTESIAN 1 + +/** + * \brief Uses spherical coordinates for the direction. + * + * \sa SDL_HapticDirection + */ +#define SDL_HAPTIC_SPHERICAL 2 + +/*@}*//*Direction encodings*/ + +/*@}*//*Haptic features*/ + +/* + * Misc defines. + */ + +/** + * \brief Used to play a device an infinite number of times. + * + * \sa SDL_HapticRunEffect + */ +#define SDL_HAPTIC_INFINITY 4294967295U + + +/** + * \brief Structure that represents a haptic direction. + * + * Directions can be specified by: + * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates. + * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. + * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. + * + * Cardinal directions of the haptic device are relative to the positioning + * of the device. North is considered to be away from the user. + * + * The following diagram represents the cardinal directions: + * \verbatim + .--. + |__| .-------. + |=.| |.-----.| + |--| || || + | | |'-----'| + |__|~')_____(' + [ COMPUTER ] + + + North (0,-1) + ^ + | + | + (1,0) West <----[ HAPTIC ]----> East (-1,0) + | + | + v + South (0,1) + + + [ USER ] + \|||/ + (o o) + ---ooO-(_)-Ooo--- + \endverbatim + * + * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a + * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses + * the first \c dir parameter. The cardinal directions would be: + * - North: 0 (0 degrees) + * - East: 9000 (90 degrees) + * - South: 18000 (180 degrees) + * - West: 27000 (270 degrees) + * + * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions + * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses + * the first three \c dir parameters. The cardinal directions would be: + * - North: 0,-1, 0 + * - East: -1, 0, 0 + * - South: 0, 1, 0 + * - West: 1, 0, 0 + * + * The Z axis represents the height of the effect if supported, otherwise + * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you + * can use any multiple you want, only the direction matters. + * + * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. + * The first two \c dir parameters are used. The \c dir parameters are as + * follows (all values are in hundredths of degrees): + * - Degrees from (1, 0) rotated towards (0, 1). + * - Degrees towards (0, 0, 1) (device needs at least 3 axes). + * + * + * Example of force coming from the south with all encodings (force coming + * from the south means the user will have to pull the stick to counteract): + * \code + * SDL_HapticDirection direction; + * + * // Cartesian directions + * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. + * direction.dir[0] = 0; // X position + * direction.dir[1] = 1; // Y position + * // Assuming the device has 2 axes, we don't need to specify third parameter. + * + * // Polar directions + * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. + * direction.dir[0] = 18000; // Polar only uses first parameter + * + * // Spherical coordinates + * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding + * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. + * \endcode + * + * \sa SDL_HAPTIC_POLAR + * \sa SDL_HAPTIC_CARTESIAN + * \sa SDL_HAPTIC_SPHERICAL + * \sa SDL_HapticEffect + * \sa SDL_HapticNumAxes + */ +typedef struct SDL_HapticDirection +{ + Uint8 type; /**< The type of encoding. */ + Sint32 dir[3]; /**< The encoded direction. */ +} SDL_HapticDirection; + + +/** + * \brief A structure containing a template for a Constant effect. + * + * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. + * + * A constant effect applies a constant force in the specified direction + * to the joystick. + * + * \sa SDL_HAPTIC_CONSTANT + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticConstant +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Constant */ + Sint16 level; /**< Strength of the constant effect. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticConstant; + +/** + * \brief A structure containing a template for a Periodic effect. + * + * The struct handles the following effects: + * - ::SDL_HAPTIC_SINE + * - ::SDL_HAPTIC_SQUARE + * - ::SDL_HAPTIC_TRIANGLE + * - ::SDL_HAPTIC_SAWTOOTHUP + * - ::SDL_HAPTIC_SAWTOOTHDOWN + * + * A periodic effect consists in a wave-shaped effect that repeats itself + * over time. The type determines the shape of the wave and the parameters + * determine the dimensions of the wave. + * + * Phase is given by hundredth of a cyle meaning that giving the phase a value + * of 9000 will displace it 25% of it's period. Here are sample values: + * - 0: No phase displacement. + * - 9000: Displaced 25% of it's period. + * - 18000: Displaced 50% of it's period. + * - 27000: Displaced 75% of it's period. + * - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered. + * + * Examples: + * \verbatim + SDL_HAPTIC_SINE + __ __ __ __ + / \ / \ / \ / + / \__/ \__/ \__/ + + SDL_HAPTIC_SQUARE + __ __ __ __ __ + | | | | | | | | | | + | |__| |__| |__| |__| | + + SDL_HAPTIC_TRIANGLE + /\ /\ /\ /\ /\ + / \ / \ / \ / \ / + / \/ \/ \/ \/ + + SDL_HAPTIC_SAWTOOTHUP + /| /| /| /| /| /| /| + / | / | / | / | / | / | / | + / |/ |/ |/ |/ |/ |/ | + + SDL_HAPTIC_SAWTOOTHDOWN + \ |\ |\ |\ |\ |\ |\ | + \ | \ | \ | \ | \ | \ | \ | + \| \| \| \| \| \| \| + \endverbatim + * + * \sa SDL_HAPTIC_SINE + * \sa SDL_HAPTIC_SQUARE + * \sa SDL_HAPTIC_TRIANGLE + * \sa SDL_HAPTIC_SAWTOOTHUP + * \sa SDL_HAPTIC_SAWTOOTHDOWN + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticPeriodic +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_SQUARE, + ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or + ::SDL_HAPTIC_SAWTOOTHDOWN */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Periodic */ + Uint16 period; /**< Period of the wave. */ + Sint16 magnitude; /**< Peak value. */ + Sint16 offset; /**< Mean value of the wave. */ + Uint16 phase; /**< Horizontal shift given by hundredth of a cycle. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticPeriodic; + +/** + * \brief A structure containing a template for a Condition effect. + * + * The struct handles the following effects: + * - ::SDL_HAPTIC_SPRING: Effect based on axes position. + * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity. + * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration. + * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement. + * + * Direction is handled by condition internals instead of a direction member. + * The condition effect specific members have three parameters. The first + * refers to the X axis, the second refers to the Y axis and the third + * refers to the Z axis. The right terms refer to the positive side of the + * axis and the left terms refer to the negative side of the axis. Please + * refer to the ::SDL_HapticDirection diagram for which side is positive and + * which is negative. + * + * \sa SDL_HapticDirection + * \sa SDL_HAPTIC_SPRING + * \sa SDL_HAPTIC_DAMPER + * \sa SDL_HAPTIC_INERTIA + * \sa SDL_HAPTIC_FRICTION + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticCondition +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER, + ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */ + SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Condition */ + Uint16 right_sat[3]; /**< Level when joystick is to the positive side. */ + Uint16 left_sat[3]; /**< Level when joystick is to the negative side. */ + Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ + Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ + Uint16 deadband[3]; /**< Size of the dead zone. */ + Sint16 center[3]; /**< Position of the dead zone. */ +} SDL_HapticCondition; + +/** + * \brief A structure containing a template for a Ramp effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. + * + * The ramp effect starts at start strength and ends at end strength. + * It augments in linear fashion. If you use attack and fade with a ramp + * they effects get added to the ramp effect making the effect become + * quadratic instead of linear. + * + * \sa SDL_HAPTIC_RAMP + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticRamp +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_RAMP */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Ramp */ + Sint16 start; /**< Beginning strength level. */ + Sint16 end; /**< Ending strength level. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticRamp; + +/** + * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. + * + * A custom force feedback effect is much like a periodic effect, where the + * application can define it's exact shape. You will have to allocate the + * data yourself. Data should consist of channels * samples Uint16 samples. + * + * If channels is one, the effect is rotated using the defined direction. + * Otherwise it uses the samples in data for the different axes. + * + * \sa SDL_HAPTIC_CUSTOM + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticCustom +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Custom */ + Uint8 channels; /**< Axes to use, minimum of one. */ + Uint16 period; /**< Sample periods. */ + Uint16 samples; /**< Amount of samples. */ + Uint16 *data; /**< Should contain channels*samples items. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticCustom; + +/** + * \brief The generic template for any haptic effect. + * + * All values max at 32767 (0x7FFF). Signed values also can be negative. + * Time values unless specified otherwise are in milliseconds. + * + * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 + * value. Neither delay, interval, attack_length nor fade_length support + * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. + * + * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of + * ::SDL_HAPTIC_INFINITY. + * + * Button triggers may not be supported on all devices, it is advised to not + * use them if possible. Buttons start at index 1 instead of index 0 like + * they joystick. + * + * If both attack_length and fade_level are 0, the envelope is not used, + * otherwise both values are used. + * + * Common parts: + * \code + * // Replay - All effects have this + * Uint32 length; // Duration of effect (ms). + * Uint16 delay; // Delay before starting effect. + * + * // Trigger - All effects have this + * Uint16 button; // Button that triggers effect. + * Uint16 interval; // How soon before effect can be triggered again. + * + * // Envelope - All effects except condition effects have this + * Uint16 attack_length; // Duration of the attack (ms). + * Uint16 attack_level; // Level at the start of the attack. + * Uint16 fade_length; // Duration of the fade out (ms). + * Uint16 fade_level; // Level at the end of the fade. + * \endcode + * + * + * Here we have an example of a constant effect evolution in time: + * \verbatim + Strength + ^ + | + | effect level --> _________________ + | / \ + | / \ + | / \ + | / \ + | attack_level --> | \ + | | | <--- fade_level + | + +--------------------------------------------------> Time + [--] [---] + attack_length fade_length + + [------------------][-----------------------] + delay length + \endverbatim + * + * Note either the attack_level or the fade_level may be above the actual + * effect level. + * + * \sa SDL_HapticConstant + * \sa SDL_HapticPeriodic + * \sa SDL_HapticCondition + * \sa SDL_HapticRamp + * \sa SDL_HapticCustom + */ +typedef union SDL_HapticEffect +{ + /* Common for all force feedback effects */ + Uint16 type; /**< Effect type. */ + SDL_HapticConstant constant; /**< Constant effect. */ + SDL_HapticPeriodic periodic; /**< Periodic effect. */ + SDL_HapticCondition condition; /**< Condition effect. */ + SDL_HapticRamp ramp; /**< Ramp effect. */ + SDL_HapticCustom custom; /**< Custom effect. */ +} SDL_HapticEffect; + + +/* Function prototypes */ +/** + * \brief Count the number of joysticks attached to the system. + * + * \return Number of haptic devices detected on the system. + */ +extern DECLSPEC int SDLCALL SDL_NumHaptics(void); + +/** + * \brief Get the implementation dependent name of a Haptic device. + * + * This can be called before any joysticks are opened. + * If no name can be found, this function returns NULL. + * + * \param device_index Index of the device to get it's name. + * \return Name of the device or NULL on error. + * + * \sa SDL_NumHaptics + */ +extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); + +/** + * \brief Opens a Haptic device for usage. + * + * The index passed as an argument refers to the N'th Haptic device on this + * system. + * + * When opening a haptic device, it's gain will be set to maximum and + * autocenter will be disabled. To modify these values use + * SDL_HapticSetGain() and SDL_HapticSetAutocenter(). + * + * \param device_index Index of the device to open. + * \return Device identifier or NULL on error. + * + * \sa SDL_HapticIndex + * \sa SDL_HapticOpenFromMouse + * \sa SDL_HapticOpenFromJoystick + * \sa SDL_HapticClose + * \sa SDL_HapticSetGain + * \sa SDL_HapticSetAutocenter + * \sa SDL_HapticPause + * \sa SDL_HapticStopAll + */ +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); + +/** + * \brief Checks if the haptic device at index has been opened. + * + * \param device_index Index to check to see if it has been opened. + * \return 1 if it has been opened or 0 if it hasn't. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticIndex + */ +extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); + +/** + * \brief Gets the index of a haptic device. + * + * \param haptic Haptic device to get the index of. + * \return The index of the haptic device or -1 on error. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticOpened + */ +extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); + +/** + * \brief Gets whether or not the current mouse has haptic capabilities. + * + * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't. + * + * \sa SDL_HapticOpenFromMouse + */ +extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); + +/** + * \brief Tries to open a haptic device from the current mouse. + * + * \return The haptic device identifier or NULL on error. + * + * \sa SDL_MouseIsHaptic + * \sa SDL_HapticOpen + */ +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); + +/** + * \brief Checks to see if a joystick has haptic features. + * + * \param joystick Joystick to test for haptic capabilities. + * \return 1 if the joystick is haptic, 0 if it isn't + * or -1 if an error ocurred. + * + * \sa SDL_HapticOpenFromJoystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); + +/** + * \brief Opens a Haptic device for usage from a Joystick device. + * + * You must still close the haptic device seperately. It will not be closed + * with the joystick. + * + * When opening from a joystick you should first close the haptic device before + * closing the joystick device. If not, on some implementations the haptic + * device will also get unallocated and you'll be unable to use force feedback + * on that device. + * + * \param joystick Joystick to create a haptic device from. + * \return A valid haptic device identifier on success or NULL on error. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticClose + */ +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * + joystick); + +/** + * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). + * + * \param haptic Haptic device to close. + */ +extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); + +/** + * \brief Returns the number of effects a haptic device can store. + * + * On some platforms this isn't fully supported, and therefore is an + * aproximation. Always check to see if your created effect was actually + * created and do not rely solely on SDL_HapticNumEffects(). + * + * \param haptic The haptic device to query effect max. + * \return The number of effects the haptic device can store or + * -1 on error. + * + * \sa SDL_HapticNumEffectsPlaying + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); + +/** + * \brief Returns the number of effects a haptic device can play at the same + * time. + * + * This is not supported on all platforms, but will always return a value. + * Added here for the sake of completness. + * + * \param haptic The haptic device to query maximum playing effects. + * \return The number of effects the haptic device can play at the same time + * or -1 on error. + * + * \sa SDL_HapticNumEffects + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); + +/** + * \brief Gets the haptic devices supported features in bitwise matter. + * + * Example: + * \code + * if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) { + * printf("We have constant haptic effect!"); + * } + * \endcode + * + * \param haptic The haptic device to query. + * \return Haptic features in bitwise manner (OR'd). + * + * \sa SDL_HapticNumEffects + * \sa SDL_HapticEffectSupported + */ +extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); + + +/** + * \brief Gets the number of haptic axes the device has. + * + * \sa SDL_HapticDirection + */ +extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); + +/** + * \brief Checks to see if effect is supported by haptic. + * + * \param haptic Haptic device to check on. + * \param effect Effect to check to see if it is supported. + * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. + * + * \sa SDL_HapticQuery + * \sa SDL_HapticNewEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, + SDL_HapticEffect * + effect); + +/** + * \brief Creates a new haptic effect on the device. + * + * \param haptic Haptic device to create the effect on. + * \param effect Properties of the effect to create. + * \return The id of the effect on success or -1 on error. + * + * \sa SDL_HapticUpdateEffect + * \sa SDL_HapticRunEffect + * \sa SDL_HapticDestroyEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, + SDL_HapticEffect * effect); + +/** + * \brief Updates the properties of an effect. + * + * Can be used dynamically, although behaviour when dynamically changing + * direction may be strange. Specifically the effect may reupload itself + * and start playing from the start. You cannot change the type either when + * running SDL_HapticUpdateEffect(). + * + * \param haptic Haptic device that has the effect. + * \param effect Effect to update. + * \param data New effect properties to use. + * \return The id of the effect on success or -1 on error. + * + * \sa SDL_HapticNewEffect + * \sa SDL_HapticRunEffect + * \sa SDL_HapticDestroyEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, + int effect, + SDL_HapticEffect * data); + +/** + * \brief Runs the haptic effect on it's assosciated haptic device. + * + * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over + * repeating the envelope (attack and fade) every time. If you only want the + * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length + * parameter. + * + * \param haptic Haptic device to run the effect on. + * \param effect Identifier of the haptic effect to run. + * \param iterations Number of iterations to run the effect. Use + * ::SDL_HAPTIC_INFINITY for infinity. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticStopEffect + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticGetEffectStatus + */ +extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, + int effect, + Uint32 iterations); + +/** + * \brief Stops the haptic effect on it's assosciated haptic device. + * + * \param haptic Haptic device to stop the effect on. + * \param effect Identifier of the effect to stop. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticRunEffect + * \sa SDL_HapticDestroyEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, + int effect); + +/** + * \brief Destroys a haptic effect on the device. + * + * This will stop the effect if it's running. Effects are automatically + * destroyed when the device is closed. + * + * \param haptic Device to destroy the effect on. + * \param effect Identifier of the effect to destroy. + * + * \sa SDL_HapticNewEffect + */ +extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, + int effect); + +/** + * \brief Gets the status of the current effect on the haptic device. + * + * Device must support the ::SDL_HAPTIC_STATUS feature. + * + * \param haptic Haptic device to query the effect status on. + * \param effect Identifier of the effect to query it's status. + * \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing + * or -1 on error. + * + * \sa SDL_HapticRunEffect + * \sa SDL_HapticStopEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, + int effect); + +/** + * \brief Sets the global gain of the device. + * + * Device must support the ::SDL_HAPTIC_GAIN feature. + * + * The user may specify the maxmimum gain by setting the environment variable + * ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to + * SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the + * maximum. + * + * \param haptic Haptic device to set the gain on. + * \param gain Value to set the gain to, should be between 0 and 100. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); + +/** + * \brief Sets the global autocenter of the device. + * + * Autocenter should be between 0 and 100. Setting it to 0 will disable + * autocentering. + * + * Device must support the ::SDL_HAPTIC_AUTOCENTER feature. + * + * \param haptic Haptic device to set autocentering on. + * \param autocenter Value to set autocenter to, 0 disables autocentering. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, + int autocenter); + +/** + * \brief Pauses a haptic device. + * + * Device must support the ::SDL_HAPTIC_PAUSE feature. Call + * SDL_HapticUnpause() to resume playback. + * + * Do not modify the effects nor add new ones while the device is paused. + * That can cause all sorts of weird errors. + * + * \param haptic Haptic device to pause. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticUnpause + */ +extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); + +/** + * \brief Unpauses a haptic device. + * + * Call to unpause after SDL_HapticPause(). + * + * \param haptic Haptic device to pause. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticPause + */ +extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); + +/** + * \brief Stops all the currently playing effects on a haptic device. + * + * \param haptic Haptic device to stop. + * \return 0 on success or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); + +/** + * \brief Checks to see if rumble is supported on a haptic device.. + * + * \param haptic Haptic device to check to see if it supports rumble. + * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + */ +extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic); + +/** + * \brief Initializes the haptic device for simple rumble playback. + * + * \param haptic Haptic device to initialize for simple rumble playback. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticRumbleSupported + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + */ +extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic); + +/** + * \brief Runs simple rumble on a haptic device + * + * \param haptic Haptic device to play rumble effect on. + * \param strength Strength of the rumble to play as a 0-1 float value. + * \param length Length of the rumble to play in miliseconds. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticRumbleSupported + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumbleStop + */ +extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length ); + +/** + * \brief Stops the simple rumble on a haptic device. + * + * \param haptic Haptic to stop the rumble on. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticRumbleSupported + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + */ +extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); + + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_haptic_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_hints.h b/external/SDL2/SDL_hints.h new file mode 100644 index 0000000..5242f9f --- /dev/null +++ b/external/SDL2/SDL_hints.h @@ -0,0 +1,290 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_hints.h + * + * Official documentation for SDL configuration variables + * + * This file contains functions to set and get configuration hints, + * as well as listing each of them alphabetically. + * + * The convention for naming hints is SDL_HINT_X, where "SDL_X" is + * the environment variable that can be used to override the default. + * + * In general these hints are just that - they may or may not be + * supported or applicable on any given platform, but they provide + * a way for an application or user to give the library a hint as + * to how they would like the library to work. + */ + +#ifndef _SDL_hints_h +#define _SDL_hints_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface. + * + * SDL can try to accelerate the SDL 1.2 screen surface by using streaming + * textures with a 3D rendering engine. This variable controls whether and + * how this is done. + * + * This variable can be set to the following values: + * "0" - Disable 3D acceleration + * "1" - Enable 3D acceleration, using the default renderer. + * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) + * + * By default SDL tries to make a best guess for each platform whether + * to use acceleration or not. + */ +#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION" + +/** + * \brief A variable specifying which render driver to use. + * + * If the application doesn't pick a specific renderer to use, this variable + * specifies the name of the preferred renderer. If the preferred renderer + * can't be initialized, the normal default renderer is used. + * + * This variable is case insensitive and can be set to the following values: + * "direct3d" + * "opengl" + * "opengles2" + * "opengles" + * "software" + * + * The default varies by platform, but it's the first one in the list that + * is available on the current platform. + */ +#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER" + +/** + * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. + * + * This variable can be set to the following values: + * "0" - Disable shaders + * "1" - Enable shaders + * + * By default shaders are used if OpenGL supports them. + */ +#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS" + +/** + * \brief A variable controlling the scaling quality + * + * This variable can be set to the following values: + * "0" or "nearest" - Nearest pixel sampling + * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) + * "2" or "best" - Anisotropic filtering (supported by Direct3D) + * + * By default nearest pixel sampling is used + */ +#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" + +/** + * \brief A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing. + * + * This variable can be set to the following values: + * "0" - Disable vsync + * "1" - Enable vsync + * + * By default SDL does not sync screen surface updates with vertical refresh. + */ +#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" + +/** + * \brief A variable controlling whether the X11 VidMode extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XVidMode + * "1" - Enable XVidMode + * + * By default SDL will use XVidMode if it is available. + */ +#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" + +/** + * \brief A variable controlling whether the X11 Xinerama extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable Xinerama + * "1" - Enable Xinerama + * + * By default SDL will use Xinerama if it is available. + */ +#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" + +/** + * \brief A variable controlling whether the X11 XRandR extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XRandR + * "1" - Enable XRandR + * + * By default SDL will not use XRandR because of window manager issues. + */ +#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" + +/** + * \brief A variable controlling whether grabbing input grabs the keyboard + * + * This variable can be set to the following values: + * "0" - Grab will affect only the mouse + * "1" - Grab will affect mouse and keyboard + * + * By default SDL will not grab the keyboard so system shortcuts still work. + */ +#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" + +/** + * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true. + * + */ +#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" + + +/** + * \brief A variable controlling whether the idle timer is disabled on iOS. + * + * When an iOS app does not receive touches for some time, the screen is + * dimmed automatically. For games where the accelerometer is the only input + * this is problematic. This functionality can be disabled by setting this + * hint. + * + * This variable can be set to the following values: + * "0" - Enable idle timer + * "1" - Disable idle timer + */ +#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" + +/** + * \brief A variable controlling which orientations are allowed on iOS. + * + * In some circumstances it is necessary to be able to explicitly control + * which UI orientations are allowed. + * + * This variable is a space delimited list of the following values: + * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" + */ +#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" + + +/** + * \brief A variable that lets you disable the detection and use of Xinput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable XInput timer (only uses direct input) + * "1" - Enable XInput timer (the default) + */ +#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" + + +/** + * \brief A variable that lets you manually hint extra gamecontroller db entries + * + * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() + */ +#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" + + +/** + * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. + * This is a debugging aid for developers and not expected to be used by end users. The default is "1" + * + * This variable can be set to the following values: + * "0" - don't allow topmost + * "1" - allow topmost + */ +#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" + + + +/** + * \brief An enumeration of hint priorities + */ +typedef enum +{ + SDL_HINT_DEFAULT, + SDL_HINT_NORMAL, + SDL_HINT_OVERRIDE +} SDL_HintPriority; + + +/** + * \brief Set a hint with a specific priority + * + * The priority controls the behavior when setting a hint that already + * has a value. Hints will replace existing hints of their priority and + * lower. Environment variables are considered to have override priority. + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, + const char *value, + SDL_HintPriority priority); + +/** + * \brief Set a hint with normal priority + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, + const char *value); + + +/** + * \brief Get a hint + * + * \return The string value of a hint variable. + */ +extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); + +/** + * \brief Clear all hints + * + * This function is called during SDL_Quit() to free stored hints. + */ +extern DECLSPEC void SDLCALL SDL_ClearHints(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_hints_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_input.h b/external/SDL2/SDL_input.h new file mode 100644 index 0000000..1f97876 --- /dev/null +++ b/external/SDL2/SDL_input.h @@ -0,0 +1,87 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_input.h + * + * Include file for lowlevel SDL input device handling. + * + * This talks about individual devices, and not the system cursor. If you + * just want to know when the user moves the pointer somewhere in your + * window, this is NOT the API you want. This one handles things like + * multi-touch, drawing tablets, and multiple, separate mice. + * + * The other API is in SDL_mouse.h + */ + +#ifndef _SDL_input_h +#define _SDL_input_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +/* Function prototypes */ + +/* !!! FIXME: real documentation + * - Redetect devices + * - This invalidates all existing device information from previous queries! + * - There is an implicit (re)detect upon SDL_Init(). + */ +extern DECLSPEC int SDLCALL SDL_RedetectInputDevices(void); + +/** + * \brief Get the number of mouse input devices available. + */ +extern DECLSPEC int SDLCALL SDL_GetNumInputDevices(void); + +/** + * \brief Gets the name of a device with the given index. + * + * \param index is the index of the device, whose name is to be returned. + * + * \return the name of the device with the specified index + */ +extern DECLSPEC const char *SDLCALL SDL_GetInputDeviceName(int index); + + +extern DECLSPEC int SDLCALL SDL_IsDeviceDisconnected(int index); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_mouse_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_joystick.h b/external/SDL2/SDL_joystick.h new file mode 100644 index 0000000..f34a1c0 --- /dev/null +++ b/external/SDL2/SDL_joystick.h @@ -0,0 +1,253 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_joystick.h + * + * Include file for SDL joystick event handling + * + * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick + * behind a device_index changing as joysticks are plugged and unplugged. + * + * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted + * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. + * + * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of + * the device (a X360 wired controller for example). This identifier is platform dependent. + * + * + */ + +#ifndef _SDL_joystick_h +#define _SDL_joystick_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \file SDL_joystick.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + * for joysticks, and load appropriate drivers. + */ + +/* The joystick structure used to identify an SDL joystick */ +struct _SDL_Joystick; +typedef struct _SDL_Joystick SDL_Joystick; + +/* A structure that encodes the stable unique id for a joystick device */ +typedef struct { + Uint8 data[16]; +} SDL_JoystickGUID; + +typedef Sint32 SDL_JoystickID; + + +/* Function prototypes */ +/** + * Count the number of joysticks attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); + +/** + * Get the implementation dependent name of a joystick. + * This can be called before any joysticks are opened. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); + +/** + * Open a joystick for use. + * The index passed as an argument refers tothe N'th joystick on the system. + * This index is the value which will identify this joystick in future joystick + * events. + * + * \return A joystick identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); + +/** + * Return the name for this currently opened joystick. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); + +/** + * Return the GUID for the joystick at this index + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); + +/** + * Return the GUID for this opened joystick + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); + +/** + * Return a string representation for this guid. pszGUID must point to at least 33 bytes + * (32 for the string plus a NULL terminator). + */ +extern DECLSPEC void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); + +/** + * convert a string into a joystick formatted guid + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); + +/** + * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick); + +/** + * Get the instance ID of an opened joystick or -1 if the joystick is invalid. + */ +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick); + +/** + * Get the number of general axis controls on a joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick); + +/** + * Get the number of trackballs on a joystick. + * + * Joystick trackballs have only relative motion events associated + * with them and their state cannot be polled. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick); + +/** + * Get the number of POV hats on a joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick); + +/** + * Get the number of buttons on a joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick); + +/** + * Update the current state of the open joysticks. + * + * This is called automatically by the event loop if any joystick + * events are enabled. + */ +extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); + +/** + * Enable/disable joystick event polling. + * + * If joystick events are disabled, you must call SDL_JoystickUpdate() + * yourself and check the state of the joystick when you want joystick + * information. + * + * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. + */ +extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); + +/** + * Get the current state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + */ +extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, + int axis); + +/** + * \name Hat positions + */ +/*@{*/ +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) +/*@}*/ + +/** + * Get the current state of a POV hat on a joystick. + * + * The hat indices start at index 0. + * + * \return The return value is one of the following positions: + * - ::SDL_HAT_CENTERED + * - ::SDL_HAT_UP + * - ::SDL_HAT_RIGHT + * - ::SDL_HAT_DOWN + * - ::SDL_HAT_LEFT + * - ::SDL_HAT_RIGHTUP + * - ::SDL_HAT_RIGHTDOWN + * - ::SDL_HAT_LEFTUP + * - ::SDL_HAT_LEFTDOWN + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick, + int hat); + +/** + * Get the ball axis change since the last poll. + * + * \return 0, or -1 if you passed it invalid parameters. + * + * The ball indices start at index 0. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, + int ball, int *dx, int *dy); + +/** + * Get the current state of a button on a joystick. + * + * The button indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, + int button); + +/** + * Close a joystick previously opened with SDL_JoystickOpen(). + */ +extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_joystick_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_keyboard.h b/external/SDL2/SDL_keyboard.h new file mode 100644 index 0000000..4372c8f --- /dev/null +++ b/external/SDL2/SDL_keyboard.h @@ -0,0 +1,219 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_keyboard.h + * + * Include file for SDL keyboard event handling + */ + +#ifndef _SDL_keyboard_h +#define _SDL_keyboard_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_keycode.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief The SDL keysym structure, used in key events. + */ +typedef struct SDL_Keysym +{ + SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ + SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ + Uint16 mod; /**< current key modifiers */ + Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */ +} SDL_Keysym; + +/* Function prototypes */ + +/** + * \brief Get the window which currently has keyboard focus. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); + +/** + * \brief Get a snapshot of the current state of the keyboard. + * + * \param numkeys if non-NULL, receives the length of the returned array. + * + * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values. + * + * \b Example: + * \code + * Uint8 *state = SDL_GetKeyboardState(NULL); + * if ( state[SDL_SCANCODE_RETURN] ) { + * printf(" is pressed.\n"); + * } + * \endcode + */ +extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); + +/** + * \brief Get the current key modifier state for the keyboard. + */ +extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); + +/** + * \brief Set the current key modifier state for the keyboard. + * + * \note This does not change the keyboard state, only the key modifier flags. + */ +extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); + +/** + * \brief Get the key code corresponding to the given scancode according + * to the current keyboard layout. + * + * See ::SDL_Keycode for details. + * + * \sa SDL_GetKeyName() + */ +extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); + +/** + * \brief Get the scancode corresponding to the given key code according to the + * current keyboard layout. + * + * See ::SDL_Scancode for details. + * + * \sa SDL_GetScancodeName() + */ +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); + +/** + * \brief Get a human-readable name for a scancode. + * + * \return A pointer to the name for the scancode. + * If the scancode doesn't have a name, this function returns + * an empty string (""). + * + * \sa SDL_Scancode + */ +extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); + +/** + * \brief Get a scancode from a human-readable name + * + * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized + * + * \sa SDL_Scancode + */ +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); + +/** + * \brief Get a human-readable name for a key. + * + * \return A pointer to a UTF-8 string that stays valid at least until the next + * call to this function. If you need it around any longer, you must + * copy it. If the key doesn't have a name, this function returns an + * empty string (""). + * + * \sa SDL_Key + */ +extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); + +/** + * \brief Get a key code from a human-readable name + * + * \return key code, or SDLK_UNKNOWN if the name wasn't recognized + * + * \sa SDL_Keycode + */ +extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); + +/** + * \brief Start accepting Unicode text input events. + * This function will show the on-screen keyboard if supported. + * + * \sa SDL_StopTextInput() + * \sa SDL_SetTextInputRect() + * \sa SDL_HasScreenKeyboardSupport() + */ +extern DECLSPEC void SDLCALL SDL_StartTextInput(void); + +/** + * \brief Return whether or not Unicode text input events are enabled. + * + * \sa SDL_StartTextInput() + * \sa SDL_StopTextInput() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); + +/** + * \brief Stop receiving any text input events. + * This function will hide the on-screen keyboard if supported. + * + * \sa SDL_StartTextInput() + * \sa SDL_HasScreenKeyboardSupport() + */ +extern DECLSPEC void SDLCALL SDL_StopTextInput(void); + +/** + * \brief Set the rectangle used to type Unicode text inputs. + * This is used as a hint for IME and on-screen keyboard placement. + * + * \sa SDL_StartTextInput() + */ +extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect); + +/** + * \brief Returns whether the platform has some screen keyboard support. + * + * \return SDL_TRUE if some keyboard support is available else SDL_FALSE. + * + * \note Not all screen keyboard functions are supported on all platforms. + * + * \sa SDL_IsScreenKeyboardShown() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); + +/** + * \brief Returns whether the screen keyboard is shown for given window. + * + * \param window The window for which screen keyboard should be queried. + * + * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE. + * + * \sa SDL_HasScreenKeyboardSupport() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_keyboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_keycode.h b/external/SDL2/SDL_keycode.h new file mode 100644 index 0000000..317cb67 --- /dev/null +++ b/external/SDL2/SDL_keycode.h @@ -0,0 +1,341 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_keycode.h + * + * Defines constants which identify keyboard keys and modifiers. + */ + +#ifndef _SDL_keycode_h +#define _SDL_keycode_h + +#include "SDL_stdinc.h" +#include "SDL_scancode.h" + +/** + * \brief The SDL virtual key representation. + * + * Values of this type are used to represent keyboard keys using the current + * layout of the keyboard. These values include Unicode values representing + * the unmodified character that would be generated by pressing the key, or + * an SDLK_* constant for those keys that do not generate characters. + */ +typedef Sint32 SDL_Keycode; + +#define SDLK_SCANCODE_MASK (1<<30) +#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) + +enum +{ + SDLK_UNKNOWN = 0, + + SDLK_RETURN = '\r', + SDLK_ESCAPE = '\033', + SDLK_BACKSPACE = '\b', + SDLK_TAB = '\t', + SDLK_SPACE = ' ', + SDLK_EXCLAIM = '!', + SDLK_QUOTEDBL = '"', + SDLK_HASH = '#', + SDLK_PERCENT = '%', + SDLK_DOLLAR = '$', + SDLK_AMPERSAND = '&', + SDLK_QUOTE = '\'', + SDLK_LEFTPAREN = '(', + SDLK_RIGHTPAREN = ')', + SDLK_ASTERISK = '*', + SDLK_PLUS = '+', + SDLK_COMMA = ',', + SDLK_MINUS = '-', + SDLK_PERIOD = '.', + SDLK_SLASH = '/', + SDLK_0 = '0', + SDLK_1 = '1', + SDLK_2 = '2', + SDLK_3 = '3', + SDLK_4 = '4', + SDLK_5 = '5', + SDLK_6 = '6', + SDLK_7 = '7', + SDLK_8 = '8', + SDLK_9 = '9', + SDLK_COLON = ':', + SDLK_SEMICOLON = ';', + SDLK_LESS = '<', + SDLK_EQUALS = '=', + SDLK_GREATER = '>', + SDLK_QUESTION = '?', + SDLK_AT = '@', + /* + Skip uppercase letters + */ + SDLK_LEFTBRACKET = '[', + SDLK_BACKSLASH = '\\', + SDLK_RIGHTBRACKET = ']', + SDLK_CARET = '^', + SDLK_UNDERSCORE = '_', + SDLK_BACKQUOTE = '`', + SDLK_a = 'a', + SDLK_b = 'b', + SDLK_c = 'c', + SDLK_d = 'd', + SDLK_e = 'e', + SDLK_f = 'f', + SDLK_g = 'g', + SDLK_h = 'h', + SDLK_i = 'i', + SDLK_j = 'j', + SDLK_k = 'k', + SDLK_l = 'l', + SDLK_m = 'm', + SDLK_n = 'n', + SDLK_o = 'o', + SDLK_p = 'p', + SDLK_q = 'q', + SDLK_r = 'r', + SDLK_s = 's', + SDLK_t = 't', + SDLK_u = 'u', + SDLK_v = 'v', + SDLK_w = 'w', + SDLK_x = 'x', + SDLK_y = 'y', + SDLK_z = 'z', + + SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK), + + SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), + SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), + SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), + SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), + SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), + SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), + SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), + SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), + SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), + SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), + SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), + SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12), + + SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN), + SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK), + SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE), + SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), + SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), + SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), + SDLK_DELETE = '\177', + SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), + SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), + SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), + SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), + SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), + SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), + + SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR), + SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE), + SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY), + SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS), + SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS), + SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER), + SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1), + SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2), + SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3), + SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4), + SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5), + SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6), + SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7), + SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8), + SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9), + SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0), + SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD), + + SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION), + SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER), + SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS), + SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13), + SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14), + SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15), + SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16), + SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17), + SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18), + SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19), + SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20), + SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21), + SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22), + SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23), + SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24), + SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE), + SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP), + SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU), + SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT), + SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP), + SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN), + SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO), + SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT), + SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY), + SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE), + SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND), + SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE), + SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP), + SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN), + SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA), + SDLK_KP_EQUALSAS400 = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400), + + SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE), + SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ), + SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL), + SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR), + SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR), + SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2), + SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR), + SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT), + SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER), + SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN), + SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL), + SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL), + + SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00), + SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000), + SDLK_THOUSANDSSEPARATOR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR), + SDLK_DECIMALSEPARATOR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR), + SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT), + SDLK_CURRENCYSUBUNIT = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT), + SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN), + SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN), + SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE), + SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE), + SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB), + SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE), + SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A), + SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B), + SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C), + SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D), + SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E), + SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F), + SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR), + SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER), + SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT), + SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS), + SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER), + SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND), + SDLK_KP_DBLAMPERSAND = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND), + SDLK_KP_VERTICALBAR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR), + SDLK_KP_DBLVERTICALBAR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR), + SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON), + SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH), + SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE), + SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT), + SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM), + SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE), + SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL), + SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR), + SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD), + SDLK_KP_MEMSUBTRACT = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT), + SDLK_KP_MEMMULTIPLY = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY), + SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE), + SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS), + SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR), + SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY), + SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY), + SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL), + SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL), + SDLK_KP_HEXADECIMAL = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL), + + SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL), + SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT), + SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT), + SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI), + SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL), + SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT), + SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT), + SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI), + + SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE), + + SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT), + SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV), + SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP), + SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY), + SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE), + SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT), + SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW), + SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL), + SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR), + SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER), + SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH), + SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME), + SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK), + SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD), + SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP), + SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH), + SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS), + + SDLK_BRIGHTNESSDOWN = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN), + SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP), + SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH), + SDLK_KBDILLUMTOGGLE = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE), + SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), + SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), + SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), + SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) +}; + +/** + * \brief Enumeration of valid key mods (possibly OR'd together). + */ +typedef enum +{ + KMOD_NONE = 0x0000, + KMOD_LSHIFT = 0x0001, + KMOD_RSHIFT = 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LGUI = 0x0400, + KMOD_RGUI = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, + KMOD_RESERVED = 0x8000 +} SDL_Keymod; + +#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) +#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) +#define KMOD_ALT (KMOD_LALT|KMOD_RALT) +#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) + +#endif /* _SDL_keycode_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_loadso.h b/external/SDL2/SDL_loadso.h new file mode 100644 index 0000000..ed36d68 --- /dev/null +++ b/external/SDL2/SDL_loadso.h @@ -0,0 +1,85 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_loadso.h + * + * System dependent library loading routines + * + * Some things to keep in mind: + * \li These functions only work on C function names. Other languages may + * have name mangling and intrinsic language support that varies from + * compiler to compiler. + * \li Make sure you declare your function pointers with the same calling + * convention as the actual library function. Your code will crash + * mysteriously if you do not do this. + * \li Avoid namespace collisions. If you load a symbol from the library, + * it is not defined whether or not it goes into the global symbol + * namespace for the application. If it does and it conflicts with + * symbols in your code or other shared libraries, you will not get + * the results you expect. :) + */ + +#ifndef _SDL_loadso_h +#define _SDL_loadso_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * This function dynamically loads a shared object and returns a pointer + * to the object handle (or NULL if there was an error). + * The 'sofile' parameter is a system dependent name of the object file. + */ +extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); + +/** + * Given an object handle, this function looks up the address of the + * named function in the shared object and returns it. This address + * is no longer valid after calling SDL_UnloadObject(). + */ +extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, + const char *name); + +/** + * Unload a shared object from memory. + */ +extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_loadso_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_log.h b/external/SDL2/SDL_log.h new file mode 100644 index 0000000..1180994 --- /dev/null +++ b/external/SDL2/SDL_log.h @@ -0,0 +1,215 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_log.h + * + * Simple log messages with categories and priorities. + * + * By default logs are quiet, but if you're debugging SDL you might want: + * + * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); + * + * Here's where the messages go on different platforms: + * Windows: debug output stream + * Android: log output + * Others: standard error output (stderr) + */ + +#ifndef _SDL_log_h +#define _SDL_log_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +/** + * \brief The maximum size of a log message + * + * Messages longer than the maximum size will be truncated + */ +#define SDL_MAX_LOG_MESSAGE 4096 + +/** + * \brief The predefined log categories + * + * By default the application category is enabled at the INFO level, + * the assert category is enabled at the WARN level, test is enabled + * at the VERBOSE level and all other categories are enabled at the + * CRITICAL level. + */ +enum +{ + SDL_LOG_CATEGORY_APPLICATION, + SDL_LOG_CATEGORY_ERROR, + SDL_LOG_CATEGORY_ASSERT, + SDL_LOG_CATEGORY_SYSTEM, + SDL_LOG_CATEGORY_AUDIO, + SDL_LOG_CATEGORY_VIDEO, + SDL_LOG_CATEGORY_RENDER, + SDL_LOG_CATEGORY_INPUT, + SDL_LOG_CATEGORY_TEST, + + /* Reserved for future SDL library use */ + SDL_LOG_CATEGORY_RESERVED1, + SDL_LOG_CATEGORY_RESERVED2, + SDL_LOG_CATEGORY_RESERVED3, + SDL_LOG_CATEGORY_RESERVED4, + SDL_LOG_CATEGORY_RESERVED5, + SDL_LOG_CATEGORY_RESERVED6, + SDL_LOG_CATEGORY_RESERVED7, + SDL_LOG_CATEGORY_RESERVED8, + SDL_LOG_CATEGORY_RESERVED9, + SDL_LOG_CATEGORY_RESERVED10, + + /* Beyond this point is reserved for application use, e.g. + enum { + MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, + MYAPP_CATEGORY_AWESOME2, + MYAPP_CATEGORY_AWESOME3, + ... + }; + */ + SDL_LOG_CATEGORY_CUSTOM +}; + +/** + * \brief The predefined log priorities + */ +typedef enum +{ + SDL_LOG_PRIORITY_VERBOSE = 1, + SDL_LOG_PRIORITY_DEBUG, + SDL_LOG_PRIORITY_INFO, + SDL_LOG_PRIORITY_WARN, + SDL_LOG_PRIORITY_ERROR, + SDL_LOG_PRIORITY_CRITICAL, + SDL_NUM_LOG_PRIORITIES +} SDL_LogPriority; + + +/** + * \brief Set the priority of all log categories + */ +extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); + +/** + * \brief Set the priority of a particular log category + */ +extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, + SDL_LogPriority priority); + +/** + * \brief Get the priority of a particular log category + */ +extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); + +/** + * \brief Reset all priorities to default. + * + * \note This is called in SDL_Quit(). + */ +extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); + +/** + * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO + */ +extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE + */ +extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_DEBUG + */ +extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_INFO + */ +extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_WARN + */ +extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_ERROR + */ +extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL + */ +extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...); + +/** + * \brief Log a message with the specified category and priority. + */ +extern DECLSPEC void SDLCALL SDL_LogMessage(int category, + SDL_LogPriority priority, + const char *fmt, ...); + +/** + * \brief Log a message with the specified category and priority. + */ +extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, + SDL_LogPriority priority, + const char *fmt, va_list ap); + +/** + * \brief The prototype for the log output function + */ +typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); + +/** + * \brief Get the current log output function. + */ +extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); + +/** + * \brief This function allows you to replace the default log output + * function with one of your own. + */ +extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_log_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_main.h b/external/SDL2/SDL_main.h new file mode 100644 index 0000000..722060d --- /dev/null +++ b/external/SDL2/SDL_main.h @@ -0,0 +1,98 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_main_h +#define _SDL_main_h + +#include "SDL_stdinc.h" + +/** + * \file SDL_main.h + * + * Redefine main() on some platforms so that it is called by SDL. + */ + +#if defined(__WIN32__) || defined(__IPHONEOS__) || defined(__ANDROID__) +#ifndef SDL_MAIN_HANDLED +#define SDL_MAIN_NEEDED +#endif +#endif + +#ifdef __cplusplus +#define C_LINKAGE "C" +#else +#define C_LINKAGE +#endif /* __cplusplus */ + +/** + * \file SDL_main.h + * + * The application's main() function must be called with C linkage, + * and should be declared like this: + * \code + * #ifdef __cplusplus + * extern "C" + * #endif + * int main(int argc, char *argv[]) + * { + * } + * \endcode + */ + +#ifdef SDL_MAIN_NEEDED +#define main SDL_main +#endif + +/** + * The prototype for the application's main() function + */ +extern C_LINKAGE int SDL_main(int argc, char *argv[]); + + +#include "begin_code.h" +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +#ifdef __WIN32__ + +/** + * This can be called to set the application class at startup + */ +extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, + void *hInst); +extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); + +#endif /* __WIN32__ */ + + +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_main_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_messagebox.h b/external/SDL2/SDL_messagebox.h new file mode 100644 index 0000000..4cb7cc4 --- /dev/null +++ b/external/SDL2/SDL_messagebox.h @@ -0,0 +1,147 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_messagebox_h +#define _SDL_messagebox_h + +#include "SDL_stdinc.h" +#include "SDL_video.h" /* For SDL_Window */ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief SDL_MessageBox flags. If supported will display warning icon, etc. + */ +typedef enum +{ + SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ + SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ + SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */ +} SDL_MessageBoxFlags; + +/** + * \brief Flags for SDL_MessageBoxButtonData. + */ +typedef enum +{ + SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ + SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ +} SDL_MessageBoxButtonFlags; + +/** + * \brief Individual button data. + */ +typedef struct +{ + Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ + int buttonid; /**< User defined button id (value returned via SDL_MessageBox) */ + const char * text; /**< The UTF-8 button text */ +} SDL_MessageBoxButtonData; + +/** + * \brief RGB value used in a message box color scheme + */ +typedef struct +{ + Uint8 r, g, b; +} SDL_MessageBoxColor; + +typedef enum +{ + SDL_MESSAGEBOX_COLOR_BACKGROUND, + SDL_MESSAGEBOX_COLOR_TEXT, + SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, + SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, + SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, + SDL_MESSAGEBOX_COLOR_MAX +} SDL_MessageBoxColorType; + +/** + * \brief A set of colors to use for message box dialogs + */ +typedef struct +{ + SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; +} SDL_MessageBoxColorScheme; + +/** + * \brief MessageBox structure containing title, text, window, etc. + */ +typedef struct +{ + Uint32 flags; /**< ::SDL_MessageBoxFlags */ + SDL_Window *window; /**< Parent window, can be NULL */ + const char *title; /**< UTF-8 title */ + const char *message; /**< UTF-8 message text */ + + int numbuttons; + const SDL_MessageBoxButtonData *buttons; + + const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ +} SDL_MessageBoxData; + +/** + * \brief Create a modal message box. + * + * \param messagebox The SDL_MessageBox structure with title, text, etc. + * + * \return -1 on error, otherwise 0 and buttonid contains user id of button + * hit or -1 if dialog was closed. + * + * \note This function should be called on the thread that created the parent + * window, or on the main thread if the messagebox has no parent. It will + * block execution of that thread until the user clicks a button or + * closes the messagebox. + */ +extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + +/** + * \brief Create a simple modal message box + * + * \param flags ::SDL_MessageBoxFlags + * \param title UTF-8 title text + * \param message UTF-8 message text + * \param window The parent window, or NULL for no parent + * + * \return 0 on success, -1 on error + * + * \sa SDL_ShowMessageBox + */ +extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_messagebox_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_mouse.h b/external/SDL2/SDL_mouse.h new file mode 100644 index 0000000..1d1468b --- /dev/null +++ b/external/SDL2/SDL_mouse.h @@ -0,0 +1,223 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_mouse.h + * + * Include file for SDL mouse event handling. + */ + +#ifndef _SDL_mouse_h +#define _SDL_mouse_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ + +/** + * \brief Cursor types for SDL_CreateSystemCursor. + */ +typedef enum +{ + SDL_SYSTEM_CURSOR_ARROW, // Arrow + SDL_SYSTEM_CURSOR_IBEAM, // I-beam + SDL_SYSTEM_CURSOR_WAIT, // Wait + SDL_SYSTEM_CURSOR_CROSSHAIR, // Crosshair + SDL_SYSTEM_CURSOR_WAITARROW, // Small wait cursor (or Wait if not available) + SDL_SYSTEM_CURSOR_SIZENWSE, // Double arrow pointing northwest and southeast + SDL_SYSTEM_CURSOR_SIZENESW, // Double arrow pointing northeast and southwest + SDL_SYSTEM_CURSOR_SIZEWE, // Double arrow pointing west and east + SDL_SYSTEM_CURSOR_SIZENS, // Double arrow pointing north and south + SDL_SYSTEM_CURSOR_SIZEALL, // Four pointed arrow pointing north, south, east, and west + SDL_SYSTEM_CURSOR_NO, // Slashed circle or crossbones + SDL_SYSTEM_CURSOR_HAND, // Hand + SDL_NUM_SYSTEM_CURSORS +} SDL_SystemCursor; + +/* Function prototypes */ + +/** + * \brief Get the window which currently has mouse focus. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); + +/** + * \brief Retrieve the current state of the mouse. + * + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse cursor position relative to the focus window for the currently + * selected mouse. You can pass NULL for either x or y. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y); + +/** + * \brief Retrieve the relative state of the mouse. + * + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState(). + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); + +/** + * \brief Moves the mouse to the given position within the window. + * + * \param window The window to move the mouse into, or NULL for the current mouse focus + * \param x The x coordinate within the window + * \param y The y coordinate within the window + * + * \note This function generates a mouse motion event + */ +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, + int x, int y); + +/** + * \brief Set relative mouse mode. + * + * \param enabled Whether or not to enable relative mode + * + * \return 0 on success, or -1 if relative mode is not supported. + * + * While the mouse is in relative mode, the cursor is hidden, and the + * driver will try to report continuous motion in the current window. + * Only relative motion events will be delivered, the mouse position + * will not change. + * + * \note This function will flush any pending mouse motion. + * + * \sa SDL_GetRelativeMouseMode() + */ +extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); + +/** + * \brief Query whether relative mouse mode is enabled. + * + * \sa SDL_SetRelativeMouseMode() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); + +/** + * \brief Create a cursor, using the specified bitmap data and + * mask (in MSB format). + * + * The cursor width must be a multiple of 8 bits. + * + * The cursor is created in black and white according to the following: + * + * + * + * + * + * + *
data mask resulting pixel on screen
0 1 White
1 1 Black
0 0 Transparent
1 0 Inverted color if possible, black + * if not.
+ * + * \sa SDL_FreeCursor() + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, + const Uint8 * mask, + int w, int h, int hot_x, + int hot_y); + +/** + * \brief Create a color cursor. + * + * \sa SDL_FreeCursor() + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, + int hot_x, + int hot_y); + +/** + * \brief Create a system cursor. + * + * \sa SDL_FreeCursor() + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id); + +/** + * \brief Set the active cursor. + */ +extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); + +/** + * \brief Return the active cursor. + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); + +/** + * \brief Frees a cursor created with SDL_CreateCursor(). + * + * \sa SDL_CreateCursor() + */ +extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); + +/** + * \brief Toggle whether or not the cursor is shown. + * + * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current + * state. + * + * \return 1 if the cursor is shown, or 0 if the cursor is hidden. + */ +extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); + +/** + * Used as a mask when testing buttons in buttonstate. + * - Button 1: Left mouse button + * - Button 2: Middle mouse button + * - Button 3: Right mouse button + */ +#define SDL_BUTTON(X) (1 << ((X)-1)) +#define SDL_BUTTON_LEFT 1 +#define SDL_BUTTON_MIDDLE 2 +#define SDL_BUTTON_RIGHT 3 +#define SDL_BUTTON_X1 4 +#define SDL_BUTTON_X2 5 +#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) +#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) +#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) +#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) +#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_mouse_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_mutex.h b/external/SDL2/SDL_mutex.h new file mode 100644 index 0000000..76f96d6 --- /dev/null +++ b/external/SDL2/SDL_mutex.h @@ -0,0 +1,255 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_mutex_h +#define _SDL_mutex_h + +/** + * \file SDL_mutex.h + * + * Functions to provide thread synchronization primitives. + */ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * Synchronization functions which can time out return this value + * if they time out. + */ +#define SDL_MUTEX_TIMEDOUT 1 + +/** + * This is the timeout value which corresponds to never time out. + */ +#define SDL_MUTEX_MAXWAIT (~(Uint32)0) + + +/** + * \name Mutex functions + */ +/*@{*/ + +/* The SDL mutex structure, defined in SDL_mutex.c */ +struct SDL_mutex; +typedef struct SDL_mutex SDL_mutex; + +/** + * Create a mutex, initialized unlocked. + */ +extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); + +/** + * Lock the mutex. + * + * \return 0, or -1 on error. + */ +#define SDL_mutexP(m) SDL_LockMutex(m) +extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); + +/** + * Try to lock the mutex + * + * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); + +/** + * Unlock the mutex. + * + * \return 0, or -1 on error. + * + * \warning It is an error to unlock a mutex that has not been locked by + * the current thread, and doing so results in undefined behavior. + */ +#define SDL_mutexV(m) SDL_UnlockMutex(m) +extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); + +/** + * Destroy a mutex. + */ +extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); + +/*@}*//*Mutex functions*/ + + +/** + * \name Semaphore functions + */ +/*@{*/ + +/* The SDL semaphore structure, defined in SDL_sem.c */ +struct SDL_semaphore; +typedef struct SDL_semaphore SDL_sem; + +/** + * Create a semaphore, initialized with value, returns NULL on failure. + */ +extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); + +/** + * Destroy a semaphore. + */ +extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); + +/** + * This function suspends the calling thread until the semaphore pointed + * to by \c sem has a positive count. It then atomically decreases the + * semaphore count. + */ +extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); + +/** + * Non-blocking variant of SDL_SemWait(). + * + * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would + * block, and -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); + +/** + * Variant of SDL_SemWait() with a timeout in milliseconds. + * + * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not + * succeed in the allotted time, and -1 on error. + * + * \warning On some platforms this function is implemented by looping with a + * delay of 1 ms, and so should be avoided if possible. + */ +extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); + +/** + * Atomically increases the semaphore's count (not blocking). + * + * \return 0, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); + +/** + * Returns the current count of the semaphore. + */ +extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); + +/*@}*//*Semaphore functions*/ + + +/** + * \name Condition variable functions + */ +/*@{*/ + +/* The SDL condition variable structure, defined in SDL_cond.c */ +struct SDL_cond; +typedef struct SDL_cond SDL_cond; + +/** + * Create a condition variable. + * + * Typical use of condition variables: + * + * Thread A: + * SDL_LockMutex(lock); + * while ( ! condition ) { + * SDL_CondWait(cond, lock); + * } + * SDL_UnlockMutex(lock); + * + * Thread B: + * SDL_LockMutex(lock); + * ... + * condition = true; + * ... + * SDL_CondSignal(cond); + * SDL_UnlockMutex(lock); + * + * There is some discussion whether to signal the condition variable + * with the mutex locked or not. There is some potential performance + * benefit to unlocking first on some platforms, but there are some + * potential race conditions depending on how your code is structured. + * + * In general it's safer to signal the condition variable while the + * mutex is locked. + */ +extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void); + +/** + * Destroy a condition variable. + */ +extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); + +/** + * Restart one of the threads that are waiting on the condition variable. + * + * \return 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); + +/** + * Restart all threads that are waiting on the condition variable. + * + * \return 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); + +/** + * Wait on the condition variable, unlocking the provided mutex. + * + * \warning The mutex must be locked before entering this function! + * + * The mutex is re-locked once the condition variable is signaled. + * + * \return 0 when it is signaled, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); + +/** + * Waits for at most \c ms milliseconds, and returns 0 if the condition + * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not + * signaled in the allotted time, and -1 on error. + * + * \warning On some platforms this function is implemented by looping with a + * delay of 1 ms, and so should be avoided if possible. + */ +extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, + SDL_mutex * mutex, Uint32 ms); + +/*@}*//*Condition variable functions*/ + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_mutex_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_name.h b/external/SDL2/SDL_name.h new file mode 100644 index 0000000..84d5e39 --- /dev/null +++ b/external/SDL2/SDL_name.h @@ -0,0 +1,11 @@ + +#ifndef _SDLname_h_ +#define _SDLname_h_ + +#if defined(__STDC__) || defined(__cplusplus) +#define NeedFunctionPrototypes 1 +#endif + +#define SDL_NAME(X) SDL_##X + +#endif /* _SDLname_h_ */ diff --git a/external/SDL2/SDL_opengl.h b/external/SDL2/SDL_opengl.h new file mode 100644 index 0000000..908c918 --- /dev/null +++ b/external/SDL2/SDL_opengl.h @@ -0,0 +1,11132 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_opengl.h + * + * This is a simple file to encapsulate the OpenGL API headers. + */ + +#ifndef _SDL_opengl_h +#define _SDL_opengl_h + +#include "SDL_config.h" + +#ifndef __IPHONEOS__ + +#ifdef __WIN32__ +#define WIN32_LEAN_AND_MEAN +#ifndef NOMINMAX +#define NOMINMAX /* Don't defined min() and max() */ +#endif +#include +#endif + +#ifdef __HAIKU__ /* !!! FIXME: temp compiler warning fix... */ +#define NO_SDL_GLEXT 1 +#endif + +#ifdef __glext_h_ +/* Someone has already included glext.h */ +#define NO_SDL_GLEXT +#endif +#ifndef NO_SDL_GLEXT +#define __glext_h_ /* Don't let gl.h include glext.h */ +#endif +#if defined(__MACOSX__) +#include /* Header File For The OpenGL Library */ +#define __X_GL_H +#else +#include /* Header File For The OpenGL Library */ +#endif +#ifndef NO_SDL_GLEXT +#undef __glext_h_ +#endif + +/** + * \file SDL_opengl.h + * + * This file is included because glext.h is not available on some systems. + * If you don't want this version included, simply define ::NO_SDL_GLEXT. + * + * The latest version is available from: + * http://www.opengl.org/registry/ + */ + +/** + * \def NO_SDL_GLEXT + * + * Define this if you have your own version of glext.h and want to disable the + * version included in SDL_opengl.h. + */ + +#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY) +/* *INDENT-OFF* */ +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2010 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated $Date: 2010-08-03 01:30:25 -0700 (Tue, 03 Aug 2010) $ */ +/* Current version at http://www.opengl.org/registry/ */ +#define GL_GLEXT_VERSION 64 +/* Function declaration macros - to move into glplatform.h */ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +#ifndef GL_VERSION_1_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif + +#ifndef GL_VERSION_1_2_DEPRECATED +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#endif + +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#endif + +#ifndef GL_ARB_imaging_DEPRECATED +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif + +#ifndef GL_VERSION_1_3 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#endif + +#ifndef GL_VERSION_1_3_DEPRECATED +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#endif + +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#endif + +#ifndef GL_VERSION_1_4_DEPRECATED +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + +#ifndef GL_VERSION_1_5 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#endif + +#ifndef GL_VERSION_1_5_DEPRECATED +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A +#endif + +#ifndef GL_VERSION_2_0 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif + +#ifndef GL_VERSION_2_0_DEPRECATED +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +#endif + +#ifndef GL_VERSION_2_1 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#endif + +#ifndef GL_VERSION_2_1_DEPRECATED +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +#endif + +#ifndef GL_VERSION_3_0 +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_DEPTH_BUFFER 0x8223 +#define GL_STENCIL_BUFFER 0x8224 +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +/* Reuse tokens from ARB_depth_buffer_float */ +/* reuse GL_DEPTH_COMPONENT32F */ +/* reuse GL_DEPTH32F_STENCIL8 */ +/* reuse GL_FLOAT_32_UNSIGNED_INT_24_8_REV */ +/* Reuse tokens from ARB_framebuffer_object */ +/* reuse GL_INVALID_FRAMEBUFFER_OPERATION */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ +/* reuse GL_FRAMEBUFFER_DEFAULT */ +/* reuse GL_FRAMEBUFFER_UNDEFINED */ +/* reuse GL_DEPTH_STENCIL_ATTACHMENT */ +/* reuse GL_INDEX */ +/* reuse GL_MAX_RENDERBUFFER_SIZE */ +/* reuse GL_DEPTH_STENCIL */ +/* reuse GL_UNSIGNED_INT_24_8 */ +/* reuse GL_DEPTH24_STENCIL8 */ +/* reuse GL_TEXTURE_STENCIL_SIZE */ +/* reuse GL_TEXTURE_RED_TYPE */ +/* reuse GL_TEXTURE_GREEN_TYPE */ +/* reuse GL_TEXTURE_BLUE_TYPE */ +/* reuse GL_TEXTURE_ALPHA_TYPE */ +/* reuse GL_TEXTURE_DEPTH_TYPE */ +/* reuse GL_UNSIGNED_NORMALIZED */ +/* reuse GL_FRAMEBUFFER_BINDING */ +/* reuse GL_DRAW_FRAMEBUFFER_BINDING */ +/* reuse GL_RENDERBUFFER_BINDING */ +/* reuse GL_READ_FRAMEBUFFER */ +/* reuse GL_DRAW_FRAMEBUFFER */ +/* reuse GL_READ_FRAMEBUFFER_BINDING */ +/* reuse GL_RENDERBUFFER_SAMPLES */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ +/* reuse GL_FRAMEBUFFER_COMPLETE */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ +/* reuse GL_FRAMEBUFFER_UNSUPPORTED */ +/* reuse GL_MAX_COLOR_ATTACHMENTS */ +/* reuse GL_COLOR_ATTACHMENT0 */ +/* reuse GL_COLOR_ATTACHMENT1 */ +/* reuse GL_COLOR_ATTACHMENT2 */ +/* reuse GL_COLOR_ATTACHMENT3 */ +/* reuse GL_COLOR_ATTACHMENT4 */ +/* reuse GL_COLOR_ATTACHMENT5 */ +/* reuse GL_COLOR_ATTACHMENT6 */ +/* reuse GL_COLOR_ATTACHMENT7 */ +/* reuse GL_COLOR_ATTACHMENT8 */ +/* reuse GL_COLOR_ATTACHMENT9 */ +/* reuse GL_COLOR_ATTACHMENT10 */ +/* reuse GL_COLOR_ATTACHMENT11 */ +/* reuse GL_COLOR_ATTACHMENT12 */ +/* reuse GL_COLOR_ATTACHMENT13 */ +/* reuse GL_COLOR_ATTACHMENT14 */ +/* reuse GL_COLOR_ATTACHMENT15 */ +/* reuse GL_DEPTH_ATTACHMENT */ +/* reuse GL_STENCIL_ATTACHMENT */ +/* reuse GL_FRAMEBUFFER */ +/* reuse GL_RENDERBUFFER */ +/* reuse GL_RENDERBUFFER_WIDTH */ +/* reuse GL_RENDERBUFFER_HEIGHT */ +/* reuse GL_RENDERBUFFER_INTERNAL_FORMAT */ +/* reuse GL_STENCIL_INDEX1 */ +/* reuse GL_STENCIL_INDEX4 */ +/* reuse GL_STENCIL_INDEX8 */ +/* reuse GL_STENCIL_INDEX16 */ +/* reuse GL_RENDERBUFFER_RED_SIZE */ +/* reuse GL_RENDERBUFFER_GREEN_SIZE */ +/* reuse GL_RENDERBUFFER_BLUE_SIZE */ +/* reuse GL_RENDERBUFFER_ALPHA_SIZE */ +/* reuse GL_RENDERBUFFER_DEPTH_SIZE */ +/* reuse GL_RENDERBUFFER_STENCIL_SIZE */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ +/* reuse GL_MAX_SAMPLES */ +/* Reuse tokens from ARB_framebuffer_sRGB */ +/* reuse GL_FRAMEBUFFER_SRGB */ +/* Reuse tokens from ARB_half_float_vertex */ +/* reuse GL_HALF_FLOAT */ +/* Reuse tokens from ARB_map_buffer_range */ +/* reuse GL_MAP_READ_BIT */ +/* reuse GL_MAP_WRITE_BIT */ +/* reuse GL_MAP_INVALIDATE_RANGE_BIT */ +/* reuse GL_MAP_INVALIDATE_BUFFER_BIT */ +/* reuse GL_MAP_FLUSH_EXPLICIT_BIT */ +/* reuse GL_MAP_UNSYNCHRONIZED_BIT */ +/* Reuse tokens from ARB_texture_compression_rgtc */ +/* reuse GL_COMPRESSED_RED_RGTC1 */ +/* reuse GL_COMPRESSED_SIGNED_RED_RGTC1 */ +/* reuse GL_COMPRESSED_RG_RGTC2 */ +/* reuse GL_COMPRESSED_SIGNED_RG_RGTC2 */ +/* Reuse tokens from ARB_texture_rg */ +/* reuse GL_RG */ +/* reuse GL_RG_INTEGER */ +/* reuse GL_R8 */ +/* reuse GL_R16 */ +/* reuse GL_RG8 */ +/* reuse GL_RG16 */ +/* reuse GL_R16F */ +/* reuse GL_R32F */ +/* reuse GL_RG16F */ +/* reuse GL_RG32F */ +/* reuse GL_R8I */ +/* reuse GL_R8UI */ +/* reuse GL_R16I */ +/* reuse GL_R16UI */ +/* reuse GL_R32I */ +/* reuse GL_R32UI */ +/* reuse GL_RG8I */ +/* reuse GL_RG8UI */ +/* reuse GL_RG16I */ +/* reuse GL_RG16UI */ +/* reuse GL_RG32I */ +/* reuse GL_RG32UI */ +/* Reuse tokens from ARB_vertex_array_object */ +/* reuse GL_VERTEX_ARRAY_BINDING */ +#endif + +#ifndef GL_VERSION_3_0_DEPRECATED +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_ALPHA_INTEGER 0x8D97 +/* Reuse tokens from ARB_framebuffer_object */ +/* reuse GL_TEXTURE_LUMINANCE_TYPE */ +/* reuse GL_TEXTURE_INTENSITY_TYPE */ +#endif + +#ifndef GL_VERSION_3_1 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_RED_SNORM 0x8F90 +#define GL_RG_SNORM 0x8F91 +#define GL_RGB_SNORM 0x8F92 +#define GL_RGBA_SNORM 0x8F93 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +/* Reuse tokens from ARB_copy_buffer */ +/* reuse GL_COPY_READ_BUFFER */ +/* reuse GL_COPY_WRITE_BUFFER */ +/* Reuse tokens from ARB_draw_instanced (none) */ +/* Reuse tokens from ARB_uniform_buffer_object */ +/* reuse GL_UNIFORM_BUFFER */ +/* reuse GL_UNIFORM_BUFFER_BINDING */ +/* reuse GL_UNIFORM_BUFFER_START */ +/* reuse GL_UNIFORM_BUFFER_SIZE */ +/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */ +/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */ +/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */ +/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */ +/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */ +/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */ +/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */ +/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */ +/* reuse GL_ACTIVE_UNIFORM_BLOCKS */ +/* reuse GL_UNIFORM_TYPE */ +/* reuse GL_UNIFORM_SIZE */ +/* reuse GL_UNIFORM_NAME_LENGTH */ +/* reuse GL_UNIFORM_BLOCK_INDEX */ +/* reuse GL_UNIFORM_OFFSET */ +/* reuse GL_UNIFORM_ARRAY_STRIDE */ +/* reuse GL_UNIFORM_MATRIX_STRIDE */ +/* reuse GL_UNIFORM_IS_ROW_MAJOR */ +/* reuse GL_UNIFORM_BLOCK_BINDING */ +/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */ +/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */ +/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */ +/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */ +/* reuse GL_INVALID_INDEX */ +#endif + +#ifndef GL_VERSION_3_2 +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +/* reuse GL_MAX_VARYING_COMPONENTS */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ +/* Reuse tokens from ARB_depth_clamp */ +/* reuse GL_DEPTH_CLAMP */ +/* Reuse tokens from ARB_draw_elements_base_vertex (none) */ +/* Reuse tokens from ARB_fragment_coord_conventions (none) */ +/* Reuse tokens from ARB_provoking_vertex */ +/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ +/* reuse GL_FIRST_VERTEX_CONVENTION */ +/* reuse GL_LAST_VERTEX_CONVENTION */ +/* reuse GL_PROVOKING_VERTEX */ +/* Reuse tokens from ARB_seamless_cube_map */ +/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */ +/* Reuse tokens from ARB_sync */ +/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */ +/* reuse GL_OBJECT_TYPE */ +/* reuse GL_SYNC_CONDITION */ +/* reuse GL_SYNC_STATUS */ +/* reuse GL_SYNC_FLAGS */ +/* reuse GL_SYNC_FENCE */ +/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */ +/* reuse GL_UNSIGNALED */ +/* reuse GL_SIGNALED */ +/* reuse GL_ALREADY_SIGNALED */ +/* reuse GL_TIMEOUT_EXPIRED */ +/* reuse GL_CONDITION_SATISFIED */ +/* reuse GL_WAIT_FAILED */ +/* reuse GL_TIMEOUT_IGNORED */ +/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */ +/* reuse GL_TIMEOUT_IGNORED */ +/* Reuse tokens from ARB_texture_multisample */ +/* reuse GL_SAMPLE_POSITION */ +/* reuse GL_SAMPLE_MASK */ +/* reuse GL_SAMPLE_MASK_VALUE */ +/* reuse GL_MAX_SAMPLE_MASK_WORDS */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE */ +/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */ +/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_TEXTURE_SAMPLES */ +/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */ +/* reuse GL_SAMPLER_2D_MULTISAMPLE */ +/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */ +/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */ +/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */ +/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */ +/* reuse GL_MAX_INTEGER_SAMPLES */ +/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */ +#endif + +#ifndef GL_VERSION_3_3 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +/* Reuse tokens from ARB_blend_func_extended */ +/* reuse GL_SRC1_COLOR */ +/* reuse GL_ONE_MINUS_SRC1_COLOR */ +/* reuse GL_ONE_MINUS_SRC1_ALPHA */ +/* reuse GL_MAX_DUAL_SOURCE_DRAW_BUFFERS */ +/* Reuse tokens from ARB_explicit_attrib_location (none) */ +/* Reuse tokens from ARB_occlusion_query2 */ +/* reuse GL_ANY_SAMPLES_PASSED */ +/* Reuse tokens from ARB_sampler_objects */ +/* reuse GL_SAMPLER_BINDING */ +/* Reuse tokens from ARB_shader_bit_encoding (none) */ +/* Reuse tokens from ARB_texture_rgb10_a2ui */ +/* reuse GL_RGB10_A2UI */ +/* Reuse tokens from ARB_texture_swizzle */ +/* reuse GL_TEXTURE_SWIZZLE_R */ +/* reuse GL_TEXTURE_SWIZZLE_G */ +/* reuse GL_TEXTURE_SWIZZLE_B */ +/* reuse GL_TEXTURE_SWIZZLE_A */ +/* reuse GL_TEXTURE_SWIZZLE_RGBA */ +/* Reuse tokens from ARB_timer_query */ +/* reuse GL_TIME_ELAPSED */ +/* reuse GL_TIMESTAMP */ +/* Reuse tokens from ARB_vertex_type_2_10_10_10_rev */ +/* reuse GL_INT_2_10_10_10_REV */ +#endif + +#ifndef GL_VERSION_4_0 +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +/* Reuse tokens from ARB_texture_query_lod (none) */ +/* Reuse tokens from ARB_draw_buffers_blend (none) */ +/* Reuse tokens from ARB_draw_indirect */ +/* reuse GL_DRAW_INDIRECT_BUFFER */ +/* reuse GL_DRAW_INDIRECT_BUFFER_BINDING */ +/* Reuse tokens from ARB_gpu_shader5 */ +/* reuse GL_GEOMETRY_SHADER_INVOCATIONS */ +/* reuse GL_MAX_GEOMETRY_SHADER_INVOCATIONS */ +/* reuse GL_MIN_FRAGMENT_INTERPOLATION_OFFSET */ +/* reuse GL_MAX_FRAGMENT_INTERPOLATION_OFFSET */ +/* reuse GL_FRAGMENT_INTERPOLATION_OFFSET_BITS */ +/* reuse GL_MAX_VERTEX_STREAMS */ +/* Reuse tokens from ARB_gpu_shader_fp64 */ +/* reuse GL_DOUBLE_VEC2 */ +/* reuse GL_DOUBLE_VEC3 */ +/* reuse GL_DOUBLE_VEC4 */ +/* reuse GL_DOUBLE_MAT2 */ +/* reuse GL_DOUBLE_MAT3 */ +/* reuse GL_DOUBLE_MAT4 */ +/* reuse GL_DOUBLE_MAT2x3 */ +/* reuse GL_DOUBLE_MAT2x4 */ +/* reuse GL_DOUBLE_MAT3x2 */ +/* reuse GL_DOUBLE_MAT3x4 */ +/* reuse GL_DOUBLE_MAT4x2 */ +/* reuse GL_DOUBLE_MAT4x3 */ +/* Reuse tokens from ARB_shader_subroutine */ +/* reuse GL_ACTIVE_SUBROUTINES */ +/* reuse GL_ACTIVE_SUBROUTINE_UNIFORMS */ +/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS */ +/* reuse GL_ACTIVE_SUBROUTINE_MAX_LENGTH */ +/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH */ +/* reuse GL_MAX_SUBROUTINES */ +/* reuse GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS */ +/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */ +/* reuse GL_COMPATIBLE_SUBROUTINES */ +/* Reuse tokens from ARB_tessellation_shader */ +/* reuse GL_PATCHES */ +/* reuse GL_PATCH_VERTICES */ +/* reuse GL_PATCH_DEFAULT_INNER_LEVEL */ +/* reuse GL_PATCH_DEFAULT_OUTER_LEVEL */ +/* reuse GL_TESS_CONTROL_OUTPUT_VERTICES */ +/* reuse GL_TESS_GEN_MODE */ +/* reuse GL_TESS_GEN_SPACING */ +/* reuse GL_TESS_GEN_VERTEX_ORDER */ +/* reuse GL_TESS_GEN_POINT_MODE */ +/* reuse GL_ISOLINES */ +/* reuse GL_FRACTIONAL_ODD */ +/* reuse GL_FRACTIONAL_EVEN */ +/* reuse GL_MAX_PATCH_VERTICES */ +/* reuse GL_MAX_TESS_GEN_LEVEL */ +/* reuse GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS */ +/* reuse GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS */ +/* reuse GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS */ +/* reuse GL_MAX_TESS_PATCH_COMPONENTS */ +/* reuse GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS */ +/* reuse GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS */ +/* reuse GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS */ +/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS */ +/* reuse GL_MAX_TESS_CONTROL_INPUT_COMPONENTS */ +/* reuse GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS */ +/* reuse GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER */ +/* reuse GL_TESS_EVALUATION_SHADER */ +/* reuse GL_TESS_CONTROL_SHADER */ +/* Reuse tokens from ARB_texture_buffer_object_rgb32 (none) */ +/* Reuse tokens from ARB_transform_feedback2 */ +/* reuse GL_TRANSFORM_FEEDBACK */ +/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ +/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ +/* reuse GL_TRANSFORM_FEEDBACK_BINDING */ +/* Reuse tokens from ARB_transform_feedback3 */ +/* reuse GL_MAX_TRANSFORM_FEEDBACK_BUFFERS */ +/* reuse GL_MAX_VERTEX_STREAMS */ +#endif + +#ifndef GL_VERSION_4_1 +/* Reuse tokens from ARB_ES2_compatibility */ +/* reuse GL_FIXED */ +/* reuse GL_IMPLEMENTATION_COLOR_READ_TYPE */ +/* reuse GL_IMPLEMENTATION_COLOR_READ_FORMAT */ +/* reuse GL_LOW_FLOAT */ +/* reuse GL_MEDIUM_FLOAT */ +/* reuse GL_HIGH_FLOAT */ +/* reuse GL_LOW_INT */ +/* reuse GL_MEDIUM_INT */ +/* reuse GL_HIGH_INT */ +/* reuse GL_SHADER_COMPILER */ +/* reuse GL_NUM_SHADER_BINARY_FORMATS */ +/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */ +/* reuse GL_MAX_VARYING_VECTORS */ +/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */ +/* Reuse tokens from ARB_get_program_binary */ +/* reuse GL_PROGRAM_BINARY_RETRIEVABLE_HINT */ +/* reuse GL_PROGRAM_BINARY_LENGTH */ +/* reuse GL_NUM_PROGRAM_BINARY_FORMATS */ +/* reuse GL_PROGRAM_BINARY_FORMATS */ +/* Reuse tokens from ARB_separate_shader_objects */ +/* reuse GL_VERTEX_SHADER_BIT */ +/* reuse GL_FRAGMENT_SHADER_BIT */ +/* reuse GL_GEOMETRY_SHADER_BIT */ +/* reuse GL_TESS_CONTROL_SHADER_BIT */ +/* reuse GL_TESS_EVALUATION_SHADER_BIT */ +/* reuse GL_ALL_SHADER_BITS */ +/* reuse GL_PROGRAM_SEPARABLE */ +/* reuse GL_ACTIVE_PROGRAM */ +/* reuse GL_PROGRAM_PIPELINE_BINDING */ +/* Reuse tokens from ARB_shader_precision (none) */ +/* Reuse tokens from ARB_vertex_attrib_64bit - all are in GL 3.0 and 4.0 already */ +/* Reuse tokens from ARB_viewport_array - some are in GL 1.1 and ARB_provoking_vertex already */ +/* reuse GL_MAX_VIEWPORTS */ +/* reuse GL_VIEWPORT_SUBPIXEL_BITS */ +/* reuse GL_VIEWPORT_BOUNDS_RANGE */ +/* reuse GL_LAYER_PROVOKING_VERTEX */ +/* reuse GL_VIEWPORT_INDEX_PROVOKING_VERTEX */ +/* reuse GL_UNDEFINED_VERTEX */ +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_env_add +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + +#ifndef GL_ARB_point_parameters +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif + +#ifndef GL_ARB_shadow +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif + +#ifndef GL_ARB_window_pos +#endif + +#ifndef GL_ARB_vertex_program +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + +#ifndef GL_ARB_fragment_program +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif + +#ifndef GL_ARB_shader_objects +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#endif + +#ifndef GL_ARB_point_sprite +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_HALF_FLOAT_ARB 0x140B +#endif + +#ifndef GL_ARB_texture_float +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif + +#ifndef GL_ARB_depth_buffer_float +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#endif + +#ifndef GL_ARB_draw_instanced +#endif + +#ifndef GL_ARB_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#endif + +#ifndef GL_ARB_framebuffer_object_DEPRECATED +#define GL_INDEX 0x8222 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#endif + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#endif + +#ifndef GL_ARB_geometry_shader4 +#define GL_LINES_ADJACENCY_ARB 0x000A +#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B +#define GL_TRIANGLES_ADJACENCY_ARB 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D +#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 +#define GL_GEOMETRY_SHADER_ARB 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 +/* reuse GL_MAX_VARYING_COMPONENTS */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ +#endif + +#ifndef GL_ARB_half_float_vertex +#define GL_HALF_FLOAT 0x140B +#endif + +#ifndef GL_ARB_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE +#endif + +#ifndef GL_ARB_map_buffer_range +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#endif + +#ifndef GL_ARB_texture_buffer_object +#define GL_TEXTURE_BUFFER_ARB 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E +#endif + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#endif + +#ifndef GL_ARB_texture_rg +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#endif + +#ifndef GL_ARB_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#endif + +#ifndef GL_ARB_uniform_buffer_object +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFFu +#endif + +#ifndef GL_ARB_compatibility +/* ARB_compatibility just defines tokens from core 3.0 */ +#endif + +#ifndef GL_ARB_copy_buffer +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#endif + +#ifndef GL_ARB_shader_texture_lod +#endif + +#ifndef GL_ARB_depth_clamp +#define GL_DEPTH_CLAMP 0x864F +#endif + +#ifndef GL_ARB_draw_elements_base_vertex +#endif + +#ifndef GL_ARB_fragment_coord_conventions +#endif + +#ifndef GL_ARB_provoking_vertex +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#endif + +#ifndef GL_ARB_seamless_cube_map +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#endif + +#ifndef GL_ARB_sync +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#endif + +#ifndef GL_ARB_texture_multisample +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#endif + +#ifndef GL_ARB_vertex_array_bgra +/* reuse GL_BGRA */ +#endif + +#ifndef GL_ARB_draw_buffers_blend +#endif + +#ifndef GL_ARB_sample_shading +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 +#endif + +#ifndef GL_ARB_texture_cube_map_array +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F +#endif + +#ifndef GL_ARB_texture_gather +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#endif + +#ifndef GL_ARB_texture_query_lod +#endif + +#ifndef GL_ARB_shading_language_include +#define GL_SHADER_INCLUDE_ARB 0x8DAE +#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 +#define GL_NAMED_STRING_TYPE_ARB 0x8DEA +#endif + +#ifndef GL_ARB_texture_compression_bptc +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F +#endif + +#ifndef GL_ARB_blend_func_extended +#define GL_SRC1_COLOR 0x88F9 +/* reuse GL_SRC1_ALPHA */ +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC +#endif + +#ifndef GL_ARB_explicit_attrib_location +#endif + +#ifndef GL_ARB_occlusion_query2 +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#endif + +#ifndef GL_ARB_sampler_objects +#define GL_SAMPLER_BINDING 0x8919 +#endif + +#ifndef GL_ARB_shader_bit_encoding +#endif + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_RGB10_A2UI 0x906F +#endif + +#ifndef GL_ARB_texture_swizzle +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 +#endif + +#ifndef GL_ARB_timer_query +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#endif + +#ifndef GL_ARB_vertex_type_2_10_10_10_rev +/* reuse GL_UNSIGNED_INT_2_10_10_10_REV */ +#define GL_INT_2_10_10_10_REV 0x8D9F +#endif + +#ifndef GL_ARB_draw_indirect +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#endif + +#ifndef GL_ARB_gpu_shader5 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +/* reuse GL_MAX_VERTEX_STREAMS */ +#endif + +#ifndef GL_ARB_gpu_shader_fp64 +/* reuse GL_DOUBLE */ +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#endif + +#ifndef GL_ARB_shader_subroutine +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +/* reuse GL_UNIFORM_SIZE */ +/* reuse GL_UNIFORM_NAME_LENGTH */ +#endif + +#ifndef GL_ARB_tessellation_shader +#define GL_PATCHES 0x000E +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +/* reuse GL_TRIANGLES */ +/* reuse GL_QUADS */ +#define GL_ISOLINES 0x8E7A +/* reuse GL_EQUAL */ +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRACTIONAL_EVEN 0x8E7C +/* reuse GL_CCW */ +/* reuse GL_CW */ +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#endif + +#ifndef GL_ARB_texture_buffer_object_rgb32 +/* reuse GL_RGB32F */ +/* reuse GL_RGB32UI */ +/* reuse GL_RGB32I */ +#endif + +#ifndef GL_ARB_transform_feedback2 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#endif + +#ifndef GL_ARB_transform_feedback3 +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#endif + +#ifndef GL_ARB_ES2_compatibility +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#endif + +#ifndef GL_ARB_get_program_binary +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#endif + +#ifndef GL_ARB_separate_shader_objects +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#endif + +#ifndef GL_ARB_shader_precision +#endif + +#ifndef GL_ARB_vertex_attrib_64bit +/* reuse GL_RGB32I */ +/* reuse GL_DOUBLE_VEC2 */ +/* reuse GL_DOUBLE_VEC3 */ +/* reuse GL_DOUBLE_VEC4 */ +/* reuse GL_DOUBLE_MAT2 */ +/* reuse GL_DOUBLE_MAT3 */ +/* reuse GL_DOUBLE_MAT4 */ +/* reuse GL_DOUBLE_MAT2x3 */ +/* reuse GL_DOUBLE_MAT2x4 */ +/* reuse GL_DOUBLE_MAT3x2 */ +/* reuse GL_DOUBLE_MAT3x4 */ +/* reuse GL_DOUBLE_MAT4x2 */ +/* reuse GL_DOUBLE_MAT4x3 */ +#endif + +#ifndef GL_ARB_viewport_array +/* reuse GL_SCISSOR_BOX */ +/* reuse GL_VIEWPORT */ +/* reuse GL_DEPTH_RANGE */ +/* reuse GL_SCISSOR_TEST */ +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 +/* reuse GL_FIRST_VERTEX_CONVENTION */ +/* reuse GL_LAST_VERTEX_CONVENTION */ +/* reuse GL_PROVOKING_VERTEX */ +#endif + +#ifndef GL_ARB_cl_event +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 +#endif + +#ifndef GL_ARB_debug_output +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 +#endif + +#ifndef GL_ARB_robustness +/* reuse GL_NO_ERROR */ +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 +#endif + +#ifndef GL_ARB_shader_stencil_export +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_SGIX_impact_pixel_texture +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif + +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_NV_evaluators +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif + +#ifndef GL_NV_texture_compression_vtc +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_NV_texture_shader +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif + +#ifndef GL_NV_vertex_program +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif + +#ifndef GL_OML_interlace +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif + +#ifndef GL_OML_subsample +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif + +#ifndef GL_OML_resample +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif + +#ifndef GL_ATI_element_array +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif + +#ifndef GL_SUN_mesh_array +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_DEPTH_CLAMP_NV 0x864F +#endif + +#ifndef GL_NV_occlusion_query +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif + +#ifndef GL_NV_point_sprite +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif + +#ifndef GL_NV_vertex_program1_1 +#endif + +#ifndef GL_EXT_shadow_funcs +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif + +#ifndef GL_APPLE_element_array +#define GL_ELEMENT_ARRAY_APPLE 0x8A0C +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E +#endif + +#ifndef GL_APPLE_fence +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CLIENT_APPLE 0x85B4 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +#ifndef GL_S3_s3tc +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_fragment_program +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif + +#ifndef GL_NV_half_float +#define GL_HALF_FLOAT_NV 0x140B +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif + +#ifndef GL_NV_primitive_restart +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif + +#ifndef GL_NV_vertex_program2 +#endif + +#ifndef GL_ATI_map_object_buffer +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#endif + +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif + +#ifndef GL_MESA_pack_invert +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif + +#ifndef GL_NV_fragment_program_option +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif + +#ifndef GL_NV_vertex_program2_option +/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ +/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ +#endif + +#ifndef GL_NV_vertex_program3 +/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +#ifndef GL_GREMEDY_string_marker +#endif + +#ifndef GL_EXT_packed_depth_stencil +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif + +#ifndef GL_EXT_stencil_clear_tag +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 +#endif + +#ifndef GL_EXT_texture_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB8_EXT 0x8C41 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#define GL_SLUMINANCE_EXT 0x8C46 +#define GL_SLUMINANCE8_EXT 0x8C47 +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif + +#ifndef GL_EXT_framebuffer_blit +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT +#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA +#endif + +#ifndef GL_EXT_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +#endif + +#ifndef GL_MESAX_texture_stack +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E +#endif + +#ifndef GL_EXT_timer_query +#define GL_TIME_ELAPSED_EXT 0x88BF +#endif + +#ifndef GL_EXT_gpu_program_parameters +#endif + +#ifndef GL_APPLE_flush_buffer_range +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 +#endif + +#ifndef GL_NV_gpu_program4 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 +#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 +#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 +#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 +#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 +#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 +#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 +#endif + +#ifndef GL_NV_geometry_program4 +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_GEOMETRY_PROGRAM_NV 0x8C26 +#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 +#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 +#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +#endif + +#ifndef GL_EXT_geometry_shader4 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */ +/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */ +/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */ +/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */ +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +/* reuse GL_LINES_ADJACENCY_EXT */ +/* reuse GL_LINE_STRIP_ADJACENCY_EXT */ +/* reuse GL_TRIANGLES_ADJACENCY_EXT */ +/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ +/* reuse GL_PROGRAM_POINT_SIZE_EXT */ +#endif + +#ifndef GL_NV_vertex_program4 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD +#endif + +#ifndef GL_EXT_gpu_shader4 +#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 +#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 +#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 +#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 +#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 +#define GL_INT_SAMPLER_1D_EXT 0x8DC9 +#define GL_INT_SAMPLER_2D_EXT 0x8DCA +#define GL_INT_SAMPLER_3D_EXT 0x8DCB +#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC +#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD +#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#endif + +#ifndef GL_EXT_draw_instanced +#endif + +#ifndef GL_EXT_packed_float +#define GL_R11F_G11F_B10F_EXT 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B +#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C +#endif + +#ifndef GL_EXT_texture_array +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ +#endif + +#ifndef GL_EXT_texture_buffer_object +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E +#endif + +#ifndef GL_EXT_texture_compression_latc +#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 +#endif + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif + +#ifndef GL_EXT_texture_shared_exponent +#define GL_RGB9_E5_EXT 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E +#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F +#endif + +#ifndef GL_NV_depth_buffer_float +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF +#endif + +#ifndef GL_NV_fragment_program4 +#endif + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB +#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 +#endif + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#endif + +#ifndef GL_NV_geometry_shader4 +#endif + +#ifndef GL_NV_parameter_buffer_object +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 +#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 +#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 +#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 +#endif + +#ifndef GL_EXT_draw_buffers2 +#endif + +#ifndef GL_NV_transform_feedback +#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 +#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 +#define GL_TEXTURE_COORD_NV 0x8C79 +#define GL_CLIP_DISTANCE_NV 0x8C7A +#define GL_VERTEX_ID_NV 0x8C7B +#define GL_PRIMITIVE_ID_NV 0x8C7C +#define GL_GENERIC_ATTRIB_NV 0x8C7D +#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 +#define GL_ACTIVE_VARYINGS_NV 0x8C81 +#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 +#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 +#define GL_PRIMITIVES_GENERATED_NV 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 +#define GL_RASTERIZER_DISCARD_NV 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B +#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C +#define GL_SEPARATE_ATTRIBS_NV 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F +#define GL_LAYER_NV 0x8DAA +#define GL_NEXT_BUFFER_NV -2 +#define GL_SKIP_COMPONENTS4_NV -3 +#define GL_SKIP_COMPONENTS3_NV -4 +#define GL_SKIP_COMPONENTS2_NV -5 +#define GL_SKIP_COMPONENTS1_NV -6 +#endif + +#ifndef GL_EXT_bindable_uniform +#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 +#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 +#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 +#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED +#define GL_UNIFORM_BUFFER_EXT 0x8DEE +#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF +#endif + +#ifndef GL_EXT_texture_integer +#define GL_RGBA32UI_EXT 0x8D70 +#define GL_RGB32UI_EXT 0x8D71 +#define GL_ALPHA32UI_EXT 0x8D72 +#define GL_INTENSITY32UI_EXT 0x8D73 +#define GL_LUMINANCE32UI_EXT 0x8D74 +#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 +#define GL_RGBA16UI_EXT 0x8D76 +#define GL_RGB16UI_EXT 0x8D77 +#define GL_ALPHA16UI_EXT 0x8D78 +#define GL_INTENSITY16UI_EXT 0x8D79 +#define GL_LUMINANCE16UI_EXT 0x8D7A +#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B +#define GL_RGBA8UI_EXT 0x8D7C +#define GL_RGB8UI_EXT 0x8D7D +#define GL_ALPHA8UI_EXT 0x8D7E +#define GL_INTENSITY8UI_EXT 0x8D7F +#define GL_LUMINANCE8UI_EXT 0x8D80 +#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 +#define GL_RGBA32I_EXT 0x8D82 +#define GL_RGB32I_EXT 0x8D83 +#define GL_ALPHA32I_EXT 0x8D84 +#define GL_INTENSITY32I_EXT 0x8D85 +#define GL_LUMINANCE32I_EXT 0x8D86 +#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 +#define GL_RGBA16I_EXT 0x8D88 +#define GL_RGB16I_EXT 0x8D89 +#define GL_ALPHA16I_EXT 0x8D8A +#define GL_INTENSITY16I_EXT 0x8D8B +#define GL_LUMINANCE16I_EXT 0x8D8C +#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D +#define GL_RGBA8I_EXT 0x8D8E +#define GL_RGB8I_EXT 0x8D8F +#define GL_ALPHA8I_EXT 0x8D90 +#define GL_INTENSITY8I_EXT 0x8D91 +#define GL_LUMINANCE8I_EXT 0x8D92 +#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 +#define GL_RED_INTEGER_EXT 0x8D94 +#define GL_GREEN_INTEGER_EXT 0x8D95 +#define GL_BLUE_INTEGER_EXT 0x8D96 +#define GL_ALPHA_INTEGER_EXT 0x8D97 +#define GL_RGB_INTEGER_EXT 0x8D98 +#define GL_RGBA_INTEGER_EXT 0x8D99 +#define GL_BGR_INTEGER_EXT 0x8D9A +#define GL_BGRA_INTEGER_EXT 0x8D9B +#define GL_LUMINANCE_INTEGER_EXT 0x8D9C +#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D +#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E +#endif + +#ifndef GL_GREMEDY_frame_terminator +#endif + +#ifndef GL_NV_conditional_render +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +#endif + +#ifndef GL_NV_present_video +#define GL_FRAME_NV 0x8E26 +#define GL_FIELDS_NV 0x8E27 +#define GL_CURRENT_TIME_NV 0x8E28 +#define GL_NUM_FILL_STREAMS_NV 0x8E29 +#define GL_PRESENT_TIME_NV 0x8E2A +#define GL_PRESENT_DURATION_NV 0x8E2B +#endif + +#ifndef GL_EXT_transform_feedback +#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F +#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C +#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 +#define GL_RASTERIZER_DISCARD_EXT 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 +#endif + +#ifndef GL_EXT_direct_state_access +#define GL_PROGRAM_MATRIX_EXT 0x8E2D +#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E +#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F +#endif + +#ifndef GL_EXT_vertex_array_bgra +/* reuse GL_BGRA */ +#endif + +#ifndef GL_EXT_texture_swizzle +#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 +#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 +#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 +#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 +#endif + +#ifndef GL_NV_explicit_multisample +#define GL_SAMPLE_POSITION_NV 0x8E50 +#define GL_SAMPLE_MASK_NV 0x8E51 +#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 +#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 +#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 +#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 +#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 +#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 +#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 +#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 +#endif + +#ifndef GL_NV_transform_feedback2 +#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 +#endif + +#ifndef GL_ATI_meminfo +#define GL_VBO_FREE_MEMORY_ATI 0x87FB +#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC +#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD +#endif + +#ifndef GL_AMD_performance_monitor +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#endif + +#ifndef GL_AMD_texture_texture4 +#endif + +#ifndef GL_AMD_vertex_shader_tesselator +#define GL_SAMPLER_BUFFER_AMD 0x9001 +#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 +#define GL_TESSELLATION_MODE_AMD 0x9004 +#define GL_TESSELLATION_FACTOR_AMD 0x9005 +#define GL_DISCRETE_AMD 0x9006 +#define GL_CONTINUOUS_AMD 0x9007 +#endif + +#ifndef GL_EXT_provoking_vertex +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_PROVOKING_VERTEX_EXT 0x8E4F +#endif + +#ifndef GL_EXT_texture_snorm +#define GL_ALPHA_SNORM 0x9010 +#define GL_LUMINANCE_SNORM 0x9011 +#define GL_LUMINANCE_ALPHA_SNORM 0x9012 +#define GL_INTENSITY_SNORM 0x9013 +#define GL_ALPHA8_SNORM 0x9014 +#define GL_LUMINANCE8_SNORM 0x9015 +#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 +#define GL_INTENSITY8_SNORM 0x9017 +#define GL_ALPHA16_SNORM 0x9018 +#define GL_LUMINANCE16_SNORM 0x9019 +#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A +#define GL_INTENSITY16_SNORM 0x901B +/* reuse GL_RED_SNORM */ +/* reuse GL_RG_SNORM */ +/* reuse GL_RGB_SNORM */ +/* reuse GL_RGBA_SNORM */ +/* reuse GL_R8_SNORM */ +/* reuse GL_RG8_SNORM */ +/* reuse GL_RGB8_SNORM */ +/* reuse GL_RGBA8_SNORM */ +/* reuse GL_R16_SNORM */ +/* reuse GL_RG16_SNORM */ +/* reuse GL_RGB16_SNORM */ +/* reuse GL_RGBA16_SNORM */ +/* reuse GL_SIGNED_NORMALIZED */ +#endif + +#ifndef GL_AMD_draw_buffers_blend +#endif + +#ifndef GL_APPLE_texture_range +#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 +#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 +#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC +#define GL_STORAGE_PRIVATE_APPLE 0x85BD +/* reuse GL_STORAGE_CACHED_APPLE */ +/* reuse GL_STORAGE_SHARED_APPLE */ +#endif + +#ifndef GL_APPLE_float_pixels +#define GL_HALF_APPLE 0x140B +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#define GL_COLOR_FLOAT_APPLE 0x8A0F +#endif + +#ifndef GL_APPLE_vertex_program_evaluators +#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 +#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 +#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 +#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 +#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 +#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 +#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 +#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 +#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 +#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 +#endif + +#ifndef GL_APPLE_aux_depth_stencil +#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 +#endif + +#ifndef GL_APPLE_object_purgeable +#define GL_BUFFER_OBJECT_APPLE 0x85B3 +#define GL_RELEASED_APPLE 0x8A19 +#define GL_VOLATILE_APPLE 0x8A1A +#define GL_RETAINED_APPLE 0x8A1B +#define GL_UNDEFINED_APPLE 0x8A1C +#define GL_PURGEABLE_APPLE 0x8A1D +#endif + +#ifndef GL_APPLE_row_bytes +#define GL_PACK_ROW_BYTES_APPLE 0x8A15 +#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 +#endif + +#ifndef GL_APPLE_rgb_422 +#define GL_RGB_422_APPLE 0x8A1F +/* reuse GL_UNSIGNED_SHORT_8_8_APPLE */ +/* reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE */ +#endif + +#ifndef GL_NV_video_capture +#define GL_VIDEO_BUFFER_NV 0x9020 +#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 +#define GL_FIELD_UPPER_NV 0x9022 +#define GL_FIELD_LOWER_NV 0x9023 +#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 +#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 +#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 +#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 +#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 +#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 +#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A +#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B +#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C +#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D +#define GL_PARTIAL_SUCCESS_NV 0x902E +#define GL_SUCCESS_NV 0x902F +#define GL_FAILURE_NV 0x9030 +#define GL_YCBYCR8_422_NV 0x9031 +#define GL_YCBAYCR8A_4224_NV 0x9032 +#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 +#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 +#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 +#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 +#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 +#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 +#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 +#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A +#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B +#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C +#endif + +#ifndef GL_NV_copy_image +#endif + +#ifndef GL_EXT_separate_shader_objects +#define GL_ACTIVE_PROGRAM_EXT 0x8B8D +#endif + +#ifndef GL_NV_parameter_buffer_object2 +#endif + +#ifndef GL_NV_shader_buffer_load +#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D +#define GL_GPU_ADDRESS_NV 0x8F34 +#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 +#endif + +#ifndef GL_NV_vertex_buffer_unified_memory +#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E +#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F +#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 +#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 +#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 +#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 +#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 +#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 +#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 +#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 +#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 +#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 +#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A +#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B +#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C +#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D +#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E +#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F +#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 +#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 +#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 +#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 +#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 +#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 +#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 +#endif + +#ifndef GL_NV_texture_barrier +#endif + +#ifndef GL_AMD_shader_stencil_export +#endif + +#ifndef GL_AMD_seamless_cubemap_per_texture +/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB */ +#endif + +#ifndef GL_AMD_conservative_depth +#endif + +#ifndef GL_EXT_shader_image_load_store +#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 +#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A +#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B +#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C +#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D +#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E +#define GL_IMAGE_1D_EXT 0x904C +#define GL_IMAGE_2D_EXT 0x904D +#define GL_IMAGE_3D_EXT 0x904E +#define GL_IMAGE_2D_RECT_EXT 0x904F +#define GL_IMAGE_CUBE_EXT 0x9050 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_IMAGE_1D_ARRAY_EXT 0x9052 +#define GL_IMAGE_2D_ARRAY_EXT 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 +#define GL_INT_IMAGE_1D_EXT 0x9057 +#define GL_INT_IMAGE_2D_EXT 0x9058 +#define GL_INT_IMAGE_3D_EXT 0x9059 +#define GL_INT_IMAGE_2D_RECT_EXT 0x905A +#define GL_INT_IMAGE_CUBE_EXT 0x905B +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D +#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C +#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D +#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 +#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 +#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF +#endif + +#ifndef GL_EXT_vertex_attrib_64bit +/* reuse GL_DOUBLE */ +#define GL_DOUBLE_VEC2_EXT 0x8FFC +#define GL_DOUBLE_VEC3_EXT 0x8FFD +#define GL_DOUBLE_VEC4_EXT 0x8FFE +#define GL_DOUBLE_MAT2_EXT 0x8F46 +#define GL_DOUBLE_MAT3_EXT 0x8F47 +#define GL_DOUBLE_MAT4_EXT 0x8F48 +#define GL_DOUBLE_MAT2x3_EXT 0x8F49 +#define GL_DOUBLE_MAT2x4_EXT 0x8F4A +#define GL_DOUBLE_MAT3x2_EXT 0x8F4B +#define GL_DOUBLE_MAT3x4_EXT 0x8F4C +#define GL_DOUBLE_MAT4x2_EXT 0x8F4D +#define GL_DOUBLE_MAT4x3_EXT 0x8F4E +#endif + +#ifndef GL_NV_gpu_program5 +#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C +#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D +#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 +#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 +#endif + +#ifndef GL_NV_gpu_shader5 +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +/* reuse GL_PATCHES */ +#endif + +#ifndef GL_NV_shader_buffer_store +#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 +/* reuse GL_READ_WRITE */ +/* reuse GL_WRITE_ONLY */ +#endif + +#ifndef GL_NV_tessellation_program5 +#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 +#define GL_TESS_CONTROL_PROGRAM_NV 0x891E +#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F +#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 +#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 +#endif + +#ifndef GL_NV_vertex_attrib_integer_64bit +/* reuse GL_INT64_NV */ +/* reuse GL_UNSIGNED_INT64_NV */ +#endif + +#ifndef GL_NV_multisample_coverage +#define GL_COVERAGE_SAMPLES_NV 0x80A9 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#endif + +#ifndef GL_AMD_name_gen_delete +#define GL_DATA_BUFFER_AMD 0x9151 +#define GL_PERFORMANCE_MONITOR_AMD 0x9152 +#define GL_QUERY_OBJECT_AMD 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 +#define GL_SAMPLER_OBJECT_AMD 0x9155 +#endif + +#ifndef GL_AMD_debug_output +#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 +#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 +#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 +#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A +#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B +#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C +#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D +#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E +#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F +#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 +#endif + +#ifndef GL_NV_vdpau_interop +#define GL_SURFACE_STATE_NV 0x86EB +#define GL_SURFACE_REGISTERED_NV 0x86FD +#define GL_SURFACE_MAPPED_NV 0x8700 +#define GL_WRITE_DISCARD_NV 0x88BE +#endif + +#ifndef GL_AMD_transform_feedback3_lines_triangles +#endif + + +/*************************************************************/ + +#include +#ifndef GL_VERSION_2_0 +/* GL type for program/shader text */ +typedef char GLchar; +#endif + +#ifndef GL_VERSION_1_5 +/* GL types for handling large vertex buffer objects */ +#if defined(__APPLE__) +typedef long GLintptr; +typedef long GLsizeiptr; +#else +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif +#endif + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +#if defined(__APPLE__) +typedef long GLintptrARB; +typedef long GLsizeiptrARB; +#else +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif +#endif + +#ifndef GL_ARB_shader_objects +/* GL types for program/shader text and shader object handles */ +typedef char GLcharARB; +#if defined(__APPLE__) +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif +#endif + +/* GL type for "half" precision (s10e5) float data in host memory */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif + +#ifndef GL_EXT_timer_query +typedef int64_t GLint64EXT; +typedef uint64_t GLuint64EXT; +#endif + +#ifndef GL_ARB_sync +typedef int64_t GLint64; +typedef uint64_t GLuint64; +typedef struct __GLsync *GLsync; +#endif + +#ifndef GL_ARB_cl_event +/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */ +struct _cl_context; +struct _cl_event; +#endif + +#ifndef GL_ARB_debug_output +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +#endif + +#ifndef GL_AMD_debug_output +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +#endif + +#ifndef GL_NV_vdpau_interop +typedef GLintptr GLvdpauSurfaceNV; +#endif + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY glBlendEquation (GLenum mode); +GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_2_DEPRECATED +#define GL_VERSION_1_2_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glResetHistogram (GLenum target); +GLAPI void APIENTRY glResetMinmax (GLenum target); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +#endif + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum texture); +GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_3_DEPRECATED +#define GL_VERSION_1_3_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClientActiveTexture (GLenum texture); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +#endif + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_VERSION_1_4_DEPRECATED +#define GL_VERSION_1_4_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordf (GLfloat coord); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord); +GLAPI void APIENTRY glFogCoordd (GLdouble coord); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord); +GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v); +GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v); +GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v); +GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2iv (const GLint *v); +GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *v); +GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3iv (const GLint *v); +GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *v); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQuery (GLuint id); +GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQuery (GLenum target); +GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); +GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +GLAPI GLvoid* APIENTRY glMapBuffer (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY glCompileShader (GLuint shader); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum type); +GLAPI void APIENTRY glDeleteProgram (GLuint program); +GLAPI void APIENTRY glDeleteShader (GLuint shader); +GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer); +GLAPI GLboolean APIENTRY glIsProgram (GLuint program); +GLAPI GLboolean APIENTRY glIsShader (GLuint shader); +GLAPI void APIENTRY glLinkProgram (GLuint program); +GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +GLAPI void APIENTRY glUseProgram (GLuint program); +GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glValidateProgram (GLuint program); +GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif + +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +/* OpenGL 3.0 also reuses entry points from these extensions: */ +/* ARB_framebuffer_object */ +/* ARB_map_buffer_range */ +/* ARB_vertex_array_object */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); +GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); +GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedback (void); +GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); +GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRender (void); +GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI const GLubyte * APIENTRY glGetStringi (GLenum name, GLuint index); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); +#endif + +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +/* OpenGL 3.1 also reuses entry points from these extensions: */ +/* ARB_copy_buffer */ +/* ARB_uniform_buffer_object */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +#endif + +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +/* OpenGL 3.2 also reuses entry points from these extensions: */ +/* ARB_draw_elements_base_vertex */ +/* ARB_provoking_vertex */ +/* ARB_sync */ +/* ARB_texture_multisample */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); +GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif + +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 +/* OpenGL 3.3 also reuses entry points from these extensions: */ +/* ARB_blend_func_extended */ +/* ARB_sampler_objects */ +/* ARB_explicit_attrib_location, but it has none */ +/* ARB_occlusion_query2 (no entry points) */ +/* ARB_shader_bit_encoding (no entry points) */ +/* ARB_texture_rgb10_a2ui (no entry points) */ +/* ARB_texture_swizzle (no entry points) */ +/* ARB_timer_query */ +/* ARB_vertex_type_2_10_10_10_rev */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +#endif + +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 +/* OpenGL 4.0 also reuses entry points from these extensions: */ +/* ARB_texture_query_lod (no entry points) */ +/* ARB_draw_indirect */ +/* ARB_gpu_shader5 (no entry points) */ +/* ARB_gpu_shader_fp64 */ +/* ARB_shader_subroutine */ +/* ARB_tessellation_shader */ +/* ARB_texture_buffer_object_rgb32 (no entry points) */ +/* ARB_texture_cube_map_array (no entry points) */ +/* ARB_texture_gather (no entry points) */ +/* ARB_transform_feedback2 */ +/* ARB_transform_feedback3 */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShading (GLclampf value); +GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLclampf value); +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif + +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 +/* OpenGL 4.1 also reuses entry points from these extensions: */ +/* ARB_ES2_compatibility */ +/* ARB_get_program_binary */ +/* ARB_separate_shader_objects */ +/* ARB_shader_precision (no entry points) */ +/* ARB_vertex_attrib_64bit */ +/* ARB_viewport_array */ +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum texture); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLclampf value, GLboolean invert); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#endif + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights); +GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights); +GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights); +GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights); +GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights); +GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights); +GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights); +GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights); +GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glVertexBlendARB (GLint count); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#endif + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#endif + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v); +GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v); +GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#endif + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, GLvoid *string); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, GLvoid* *pointer); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer); +GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id); +GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQueryARB (GLenum target); +GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +#endif + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#endif + +#ifndef GL_ARB_depth_buffer_float +#define GL_ARB_depth_buffer_float 1 +#endif + +#ifndef GL_ARB_draw_instanced +#define GL_ARB_draw_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + +#ifndef GL_ARB_framebuffer_object +#define GL_ARB_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmap (GLenum target); +GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_ARB_framebuffer_sRGB 1 +#endif + +#ifndef GL_ARB_geometry_shader4 +#define GL_ARB_geometry_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif + +#ifndef GL_ARB_half_float_vertex +#define GL_ARB_half_float_vertex 1 +#endif + +#ifndef GL_ARB_instanced_arrays +#define GL_ARB_instanced_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); +#endif + +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#endif + +#ifndef GL_ARB_texture_buffer_object +#define GL_ARB_texture_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#endif + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_ARB_texture_compression_rgtc 1 +#endif + +#ifndef GL_ARB_texture_rg +#define GL_ARB_texture_rg 1 +#endif + +#ifndef GL_ARB_vertex_array_object +#define GL_ARB_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArray (GLuint array); +GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); +#endif + +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#endif + +#ifndef GL_ARB_compatibility +#define GL_ARB_compatibility 1 +#endif + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif + +#ifndef GL_ARB_shader_texture_lod +#define GL_ARB_shader_texture_lod 1 +#endif + +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +#endif + +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex); +#endif + +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 +#endif + +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertex (GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); +#endif + +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 +#endif + +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); +GLAPI GLboolean APIENTRY glIsSync (GLsync sync); +GLAPI void APIENTRY glDeleteSync (GLsync sync); +GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); +typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif + +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); +#endif + +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 +#endif + +#ifndef GL_ARB_draw_buffers_blend +#define GL_ARB_draw_buffers_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif + +#ifndef GL_ARB_sample_shading +#define GL_ARB_sample_shading 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShadingARB (GLclampf value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value); +#endif + +#ifndef GL_ARB_texture_cube_map_array +#define GL_ARB_texture_cube_map_array 1 +#endif + +#ifndef GL_ARB_texture_gather +#define GL_ARB_texture_gather 1 +#endif + +#ifndef GL_ARB_texture_query_lod +#define GL_ARB_texture_query_lod 1 +#endif + +#ifndef GL_ARB_shading_language_include +#define GL_ARB_shading_language_include 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length); +GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length); +typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#endif + +#ifndef GL_ARB_texture_compression_bptc +#define GL_ARB_texture_compression_bptc 1 +#endif + +#ifndef GL_ARB_blend_func_extended +#define GL_ARB_blend_func_extended 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); +#endif + +#ifndef GL_ARB_explicit_attrib_location +#define GL_ARB_explicit_attrib_location 1 +#endif + +#ifndef GL_ARB_occlusion_query2 +#define GL_ARB_occlusion_query2 1 +#endif + +#ifndef GL_ARB_sampler_objects +#define GL_ARB_sampler_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); +GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); +GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); +GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); +GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); +GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); +GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); +GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); +typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); +typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_ARB_texture_rgb10_a2ui 1 +#endif + +#ifndef GL_ARB_texture_swizzle +#define GL_ARB_texture_swizzle 1 +#endif + +#ifndef GL_ARB_timer_query +#define GL_ARB_timer_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); +GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); +#endif + +#ifndef GL_ARB_vertex_type_2_10_10_10_rev +#define GL_ARB_vertex_type_2_10_10_10_rev 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color); +GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color); +GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color); +GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color); +GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color); +GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color); +GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +#endif + +#ifndef GL_ARB_draw_indirect +#define GL_ARB_draw_indirect 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const GLvoid *indirect); +GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const GLvoid *indirect); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid *indirect); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect); +#endif + +#ifndef GL_ARB_gpu_shader5 +#define GL_ARB_gpu_shader5 1 +#endif + +#ifndef GL_ARB_gpu_shader_fp64 +#define GL_ARB_gpu_shader_fp64 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); +GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); +#endif + +#ifndef GL_ARB_shader_subroutine +#define GL_ARB_shader_subroutine 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); +GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); +GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); +typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +#endif + +#ifndef GL_ARB_tessellation_shader +#define GL_ARB_tessellation_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); +GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); +#endif + +#ifndef GL_ARB_texture_buffer_object_rgb32 +#define GL_ARB_texture_buffer_object_rgb32 1 +#endif + +#ifndef GL_ARB_transform_feedback2 +#define GL_ARB_transform_feedback2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedback (void); +GLAPI void APIENTRY glResumeTransformFeedback (void); +GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); +#endif + +#ifndef GL_ARB_transform_feedback3 +#define GL_ARB_transform_feedback3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); +GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); +GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); +GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); +typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_ARB_ES2_compatibility +#define GL_ARB_ES2_compatibility 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReleaseShaderCompiler (void); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY glDepthRangef (GLclampf n, GLclampf f); +GLAPI void APIENTRY glClearDepthf (GLclampf d); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f); +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLclampf d); +#endif + +#ifndef GL_ARB_get_program_binary +#define GL_ARB_get_program_binary 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +#endif + +#ifndef GL_ARB_separate_shader_objects +#define GL_ARB_separate_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar* *strings); +GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); +GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); +GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar* *strings); +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif + +#ifndef GL_ARB_vertex_attrib_64bit +#define GL_ARB_vertex_attrib_64bit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); +#endif + +#ifndef GL_ARB_viewport_array +#define GL_ARB_viewport_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); +GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); +GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLclampd *v); +GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLclampd n, GLclampd f); +GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f); +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); +#endif + +#ifndef GL_ARB_cl_event +#define GL_ARB_cl_event 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); +#endif + +#ifndef GL_ARB_debug_output +#define GL_ARB_debug_output 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const GLvoid *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#endif + +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); +GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table); +GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image); +GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span); +GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); +GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); +GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); +typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +#endif + +#ifndef GL_ARB_shader_stencil_export +#define GL_ARB_shader_stencil_export 1 +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glResetHistogramEXT (GLenum target); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum target); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *image); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_SGI_color_matrix +#define GL_SGI_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, GLvoid *table); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint i); +GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer); +GLAPI void APIENTRY glGetPointervEXT (GLenum pname, GLvoid* *params); +GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint factor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +GLAPI void APIENTRY glDeformSGIX (GLbitfield mask); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, GLvoid *data); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params); +GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param); +GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params); +GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum mode); +GLAPI void APIENTRY glTextureLightEXT (GLenum pname); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const GLvoid* *pointer); +GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *v); +GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *v); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v); +GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v); +GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const GLvoid *pointer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param); +GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean* *pointer, GLint ptrstride); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const GLvoid *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#endif + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence); +GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GLAPI void APIENTRY glFinishFenceNV (GLuint fence); +GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#endif + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#endif + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences); +GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params); +GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, GLvoid* *pointer); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id); +GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLuint count, const GLdouble *v); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLuint count, const GLfloat *v); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#endif + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#endif + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle); +GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const GLvoid *pointer, GLenum usage); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id); +GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1); +GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num); +GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const GLvoid *addr); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const GLvoid *addr); +GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr); +GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr); +GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr); +GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr); +GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr); +GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr); +GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr); +GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr); +GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, GLvoid* *data); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x); +GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords); +GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum type, const GLvoid *pointer); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#endif + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#endif + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#endif + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const GLvoid *pointer); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#endif + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +/* This is really a WGL extension, but defines some associated GL enums. + * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. + */ +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, GLvoid *pointer); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#endif + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#endif + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#endif + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#endif + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#endif + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const GLvoid *string); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); +#endif + +#ifndef GL_EXT_packed_depth_stencil +#define GL_EXT_packed_depth_stencil 1 +#endif + +#ifndef GL_EXT_stencil_clear_tag +#define GL_EXT_stencil_clear_tag 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag); +#endif + +#ifndef GL_EXT_texture_sRGB +#define GL_EXT_texture_sRGB 1 +#endif + +#ifndef GL_EXT_framebuffer_blit +#define GL_EXT_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +#ifndef GL_MESAX_texture_stack +#define GL_MESAX_texture_stack 1 +#endif + +#ifndef GL_EXT_timer_query +#define GL_EXT_timer_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64EXT *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params); +#endif + +#ifndef GL_EXT_gpu_program_parameters +#define GL_EXT_gpu_program_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#endif + +#ifndef GL_APPLE_flush_buffer_range +#define GL_APPLE_flush_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); +#endif + +#ifndef GL_NV_gpu_program4 +#define GL_NV_gpu_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params); +GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +#endif + +#ifndef GL_NV_geometry_program4 +#define GL_NV_geometry_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); +GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif + +#ifndef GL_EXT_geometry_shader4 +#define GL_EXT_geometry_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +#endif + +#ifndef GL_NV_vertex_program4 +#define GL_NV_vertex_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); +#endif + +#ifndef GL_EXT_gpu_shader4 +#define GL_EXT_gpu_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +#endif + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_packed_float +#define GL_EXT_packed_float 1 +#endif + +#ifndef GL_EXT_texture_array +#define GL_EXT_texture_array 1 +#endif + +#ifndef GL_EXT_texture_buffer_object +#define GL_EXT_texture_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#endif + +#ifndef GL_EXT_texture_compression_latc +#define GL_EXT_texture_compression_latc 1 +#endif + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#endif + +#ifndef GL_EXT_texture_shared_exponent +#define GL_EXT_texture_shared_exponent 1 +#endif + +#ifndef GL_NV_depth_buffer_float +#define GL_NV_depth_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glClearDepthdNV (GLdouble depth); +GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); +#endif + +#ifndef GL_NV_fragment_program4 +#define GL_NV_fragment_program4 1 +#endif + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_NV_framebuffer_multisample_coverage 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_EXT_framebuffer_sRGB 1 +#endif + +#ifndef GL_NV_geometry_shader4 +#define GL_NV_geometry_shader4 1 +#endif + +#ifndef GL_NV_parameter_buffer_object +#define GL_NV_parameter_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); +#endif + +#ifndef GL_EXT_draw_buffers2 +#define GL_EXT_draw_buffers2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index); +GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); +#endif + +#ifndef GL_NV_transform_feedback +#define GL_NV_transform_feedback 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedbackNV (void); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode); +GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); +GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name); +GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location); +GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); +typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); +#endif + +#ifndef GL_EXT_bindable_uniform +#define GL_EXT_bindable_uniform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer); +GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location); +GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); +typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); +typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); +#endif + +#ifndef GL_EXT_texture_integer +#define GL_EXT_texture_integer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha); +GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); +typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#endif + +#ifndef GL_GREMEDY_frame_terminator +#define GL_GREMEDY_frame_terminator 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameTerminatorGREMEDY (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void); +#endif + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRenderNV (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#endif + +#ifndef GL_NV_present_video +#define GL_NV_present_video 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); +GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); +typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params); +#endif + +#ifndef GL_EXT_transform_feedback +#define GL_EXT_transform_feedback 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedbackEXT (void); +GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +#endif + +#ifndef GL_EXT_direct_state_access +#define GL_EXT_direct_state_access 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask); +GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask); +GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode); +GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glMatrixPopEXT (GLenum mode); +GLAPI void APIENTRY glMatrixPushEXT (GLenum mode); +GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture); +GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); +GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data); +GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, GLvoid* *data); +GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, GLvoid *img); +GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); +GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, GLvoid *img); +GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string); +GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, GLvoid *string); +GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params); +GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access); +GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer); +GLAPI GLvoid* APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, GLvoid* *params); +GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data); +GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target); +GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target); +GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode); +GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode); +GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); +GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); +typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data); +typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid* *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, GLvoid *img); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, GLvoid *img); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); +typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); +typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +#endif + +#ifndef GL_EXT_vertex_array_bgra +#define GL_EXT_vertex_array_bgra 1 +#endif + +#ifndef GL_EXT_texture_swizzle +#define GL_EXT_texture_swizzle 1 +#endif + +#ifndef GL_NV_explicit_multisample +#define GL_NV_explicit_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask); +GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); +typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); +#endif + +#ifndef GL_NV_transform_feedback2 +#define GL_NV_transform_feedback2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedbackNV (void); +GLAPI void APIENTRY glResumeTransformFeedbackNV (void); +GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); +#endif + +#ifndef GL_ATI_meminfo +#define GL_ATI_meminfo 1 +#endif + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif + +#ifndef GL_AMD_texture_texture4 +#define GL_AMD_texture_texture4 1 +#endif + +#ifndef GL_AMD_vertex_shader_tesselator +#define GL_AMD_vertex_shader_tesselator 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor); +GLAPI void APIENTRY glTessellationModeAMD (GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_provoking_vertex +#define GL_EXT_provoking_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_texture_snorm +#define GL_EXT_texture_snorm 1 +#endif + +#ifndef GL_AMD_draw_buffers_blend +#define GL_AMD_draw_buffers_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_APPLE_texture_range +#define GL_APPLE_texture_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const GLvoid *pointer); +GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, GLvoid* *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 +#endif + +#ifndef GL_APPLE_vertex_program_evaluators +#define GL_APPLE_vertex_program_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname); +GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname); +GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname); +GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +#endif + +#ifndef GL_APPLE_aux_depth_stencil +#define GL_APPLE_aux_depth_stencil 1 +#endif + +#ifndef GL_APPLE_object_purgeable +#define GL_APPLE_object_purgeable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); +GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); +GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params); +#endif + +#ifndef GL_APPLE_row_bytes +#define GL_APPLE_row_bytes 1 +#endif + +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#endif + +#ifndef GL_NV_video_capture +#define GL_NV_video_capture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot); +GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot); +GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); +GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); +GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); +GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); +typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); +#endif + +#ifndef GL_NV_copy_image +#define GL_NV_copy_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif + +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program); +GLAPI void APIENTRY glActiveProgramEXT (GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program); +typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string); +#endif + +#ifndef GL_NV_parameter_buffer_object2 +#define GL_NV_parameter_buffer_object2 1 +#endif + +#ifndef GL_NV_shader_buffer_load +#define GL_NV_shader_buffer_load 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access); +GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target); +GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target); +GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access); +GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer); +GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer); +GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result); +GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value); +GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params); +GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value); +GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access); +typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target); +typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target); +typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access); +typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer); +typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result); +typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); +typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif + +#ifndef GL_NV_vertex_buffer_unified_memory +#define GL_NV_vertex_buffer_unified_memory 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); +GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride); +GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); +GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); +typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result); +#endif + +#ifndef GL_NV_texture_barrier +#define GL_NV_texture_barrier 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureBarrierNV (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); +#endif + +#ifndef GL_AMD_shader_stencil_export +#define GL_AMD_shader_stencil_export 1 +#endif + +#ifndef GL_AMD_seamless_cubemap_per_texture +#define GL_AMD_seamless_cubemap_per_texture 1 +#endif + +#ifndef GL_AMD_conservative_depth +#define GL_AMD_conservative_depth 1 +#endif + +#ifndef GL_EXT_shader_image_load_store +#define GL_EXT_shader_image_load_store 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); +#endif + +#ifndef GL_EXT_vertex_attrib_64bit +#define GL_EXT_vertex_attrib_64bit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +#endif + +#ifndef GL_NV_gpu_program5 +#define GL_NV_gpu_program5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param); +#endif + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif + +#ifndef GL_NV_shader_buffer_store +#define GL_NV_shader_buffer_store 1 +#endif + +#ifndef GL_NV_tessellation_program5 +#define GL_NV_tessellation_program5 1 +#endif + +#ifndef GL_NV_vertex_attrib_integer_64bit +#define GL_NV_vertex_attrib_integer_64bit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x); +GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); +#endif + +#ifndef GL_NV_multisample_coverage +#define GL_NV_multisample_coverage 1 +#endif + +#ifndef GL_AMD_name_gen_delete +#define GL_AMD_name_gen_delete 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names); +GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names); +GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names); +typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names); +typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); +#endif + +#ifndef GL_AMD_debug_output +#define GL_AMD_debug_output 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, GLvoid *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, GLvoid *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#endif + +#ifndef GL_NV_vdpau_interop +#define GL_NV_vdpau_interop 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress); +GLAPI void APIENTRY glVDPAUFiniNV (void); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); +GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress); +typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); +typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#endif + +#ifndef GL_AMD_transform_feedback3_lines_triangles +#define GL_AMD_transform_feedback3_lines_triangles 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif +/* *INDENT-ON* */ +#endif /* NO_SDL_GLEXT */ + +#endif /* !__IPHONEOS__ */ + +#endif /* _SDL_opengl_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_opengles.h b/external/SDL2/SDL_opengles.h new file mode 100644 index 0000000..4be511b --- /dev/null +++ b/external/SDL2/SDL_opengles.h @@ -0,0 +1,38 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_opengles.h + * + * This is a simple file to encapsulate the OpenGL ES 1.X API headers. + */ + +#ifdef __IPHONEOS__ +#include +#include +#else +#include +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif diff --git a/external/SDL2/SDL_opengles2.h b/external/SDL2/SDL_opengles2.h new file mode 100644 index 0000000..92c0ad1 --- /dev/null +++ b/external/SDL2/SDL_opengles2.h @@ -0,0 +1,38 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_opengles.h + * + * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. + */ + +#ifdef __IPHONEOS__ +#include +#include +#else +#include +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif diff --git a/external/SDL2/SDL_pixels.h b/external/SDL2/SDL_pixels.h new file mode 100644 index 0000000..d1fab6f --- /dev/null +++ b/external/SDL2/SDL_pixels.h @@ -0,0 +1,431 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_pixels.h + * + * Header for the enumerated pixel format definitions. + */ + +#ifndef _SDL_pixels_h +#define _SDL_pixels_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \name Transparency definitions + * + * These define alpha as the opacity of a surface. + */ +/*@{*/ +#define SDL_ALPHA_OPAQUE 255 +#define SDL_ALPHA_TRANSPARENT 0 +/*@}*/ + +/** Pixel type. */ +enum +{ + SDL_PIXELTYPE_UNKNOWN, + SDL_PIXELTYPE_INDEX1, + SDL_PIXELTYPE_INDEX4, + SDL_PIXELTYPE_INDEX8, + SDL_PIXELTYPE_PACKED8, + SDL_PIXELTYPE_PACKED16, + SDL_PIXELTYPE_PACKED32, + SDL_PIXELTYPE_ARRAYU8, + SDL_PIXELTYPE_ARRAYU16, + SDL_PIXELTYPE_ARRAYU32, + SDL_PIXELTYPE_ARRAYF16, + SDL_PIXELTYPE_ARRAYF32 +}; + +/** Bitmap pixel order, high bit -> low bit. */ +enum +{ + SDL_BITMAPORDER_NONE, + SDL_BITMAPORDER_4321, + SDL_BITMAPORDER_1234 +}; + +/** Packed component order, high bit -> low bit. */ +enum +{ + SDL_PACKEDORDER_NONE, + SDL_PACKEDORDER_XRGB, + SDL_PACKEDORDER_RGBX, + SDL_PACKEDORDER_ARGB, + SDL_PACKEDORDER_RGBA, + SDL_PACKEDORDER_XBGR, + SDL_PACKEDORDER_BGRX, + SDL_PACKEDORDER_ABGR, + SDL_PACKEDORDER_BGRA +}; + +/** Array component order, low byte -> high byte. */ +enum +{ + SDL_ARRAYORDER_NONE, + SDL_ARRAYORDER_RGB, + SDL_ARRAYORDER_RGBA, + SDL_ARRAYORDER_ARGB, + SDL_ARRAYORDER_BGR, + SDL_ARRAYORDER_BGRA, + SDL_ARRAYORDER_ABGR +}; + +/** Packed component layout. */ +enum +{ + SDL_PACKEDLAYOUT_NONE, + SDL_PACKEDLAYOUT_332, + SDL_PACKEDLAYOUT_4444, + SDL_PACKEDLAYOUT_1555, + SDL_PACKEDLAYOUT_5551, + SDL_PACKEDLAYOUT_565, + SDL_PACKEDLAYOUT_8888, + SDL_PACKEDLAYOUT_2101010, + SDL_PACKEDLAYOUT_1010102 +}; + +#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) + +#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ + ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ + ((bits) << 8) | ((bytes) << 0)) + +#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F) +#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) +#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) +#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) +#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) +#define SDL_BYTESPERPIXEL(X) \ + (SDL_ISPIXELFORMAT_FOURCC(X) ? \ + ((((X) == SDL_PIXELFORMAT_YUY2) || \ + ((X) == SDL_PIXELFORMAT_UYVY) || \ + ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) + +#define SDL_ISPIXELFORMAT_INDEXED(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) + +#define SDL_ISPIXELFORMAT_ALPHA(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) + +/* The flag is set to 1 because 0x1? is not in the printable ASCII range */ +#define SDL_ISPIXELFORMAT_FOURCC(format) \ + ((format) && (SDL_PIXELFLAG(format) != 1)) + +/* Note: If you modify this list, update SDL_GetPixelFormatName() */ +enum +{ + SDL_PIXELFORMAT_UNKNOWN, + SDL_PIXELFORMAT_INDEX1LSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, + 1, 0), + SDL_PIXELFORMAT_INDEX1MSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, + 1, 0), + SDL_PIXELFORMAT_INDEX4LSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, + 4, 0), + SDL_PIXELFORMAT_INDEX4MSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, + 4, 0), + SDL_PIXELFORMAT_INDEX8 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1), + SDL_PIXELFORMAT_RGB332 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_332, 8, 1), + SDL_PIXELFORMAT_RGB444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_4444, 12, 2), + SDL_PIXELFORMAT_RGB555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_1555, 15, 2), + SDL_PIXELFORMAT_BGR555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_1555, 15, 2), + SDL_PIXELFORMAT_ARGB4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_RGBA4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_ABGR4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_BGRA4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_ARGB1555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_1555, 16, 2), + SDL_PIXELFORMAT_RGBA5551 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, + SDL_PACKEDLAYOUT_5551, 16, 2), + SDL_PIXELFORMAT_ABGR1555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, + SDL_PACKEDLAYOUT_1555, 16, 2), + SDL_PIXELFORMAT_BGRA5551 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, + SDL_PACKEDLAYOUT_5551, 16, 2), + SDL_PIXELFORMAT_RGB565 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_565, 16, 2), + SDL_PIXELFORMAT_BGR565 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_565, 16, 2), + SDL_PIXELFORMAT_RGB24 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, + 24, 3), + SDL_PIXELFORMAT_BGR24 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, + 24, 3), + SDL_PIXELFORMAT_RGB888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_RGBX8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_BGR888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_BGRX8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_ARGB8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_RGBA8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_ABGR8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_BGRA8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_ARGB2101010 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_2101010, 32, 4), + + SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ + SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), + SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */ + SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'), + SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ + SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'), + SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ + SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'), + SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ + SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U') +}; + +typedef struct SDL_Color +{ + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 a; +} SDL_Color; +#define SDL_Colour SDL_Color + +typedef struct SDL_Palette +{ + int ncolors; + SDL_Color *colors; + Uint32 version; + int refcount; +} SDL_Palette; + +/** + * \note Everything in the pixel format structure is read-only. + */ +typedef struct SDL_PixelFormat +{ + Uint32 format; + SDL_Palette *palette; + Uint8 BitsPerPixel; + Uint8 BytesPerPixel; + Uint8 padding[2]; + Uint32 Rmask; + Uint32 Gmask; + Uint32 Bmask; + Uint32 Amask; + Uint8 Rloss; + Uint8 Gloss; + Uint8 Bloss; + Uint8 Aloss; + Uint8 Rshift; + Uint8 Gshift; + Uint8 Bshift; + Uint8 Ashift; + int refcount; + struct SDL_PixelFormat *next; +} SDL_PixelFormat; + +/** + * \brief Get the human readable name of a pixel format + */ +extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format); + +/** + * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks. + * + * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible. + * + * \sa SDL_MasksToPixelFormatEnum() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, + int *bpp, + Uint32 * Rmask, + Uint32 * Gmask, + Uint32 * Bmask, + Uint32 * Amask); + +/** + * \brief Convert a bpp and RGBA masks to an enumerated pixel format. + * + * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion + * wasn't possible. + * + * \sa SDL_PixelFormatEnumToMasks() + */ +extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp, + Uint32 Rmask, + Uint32 Gmask, + Uint32 Bmask, + Uint32 Amask); + +/** + * \brief Create an SDL_PixelFormat structure from a pixel format enum. + */ +extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format); + +/** + * \brief Free an SDL_PixelFormat structure. + */ +extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format); + +/** + * \brief Create a palette structure with the specified number of color + * entries. + * + * \return A new palette, or NULL if there wasn't enough memory. + * + * \note The palette entries are initialized to white. + * + * \sa SDL_FreePalette() + */ +extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors); + +/** + * \brief Set the palette for a pixel format structure. + */ +extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format, + SDL_Palette *palette); + +/** + * \brief Set a range of colors in a palette. + * + * \param palette The palette to modify. + * \param colors An array of colors to copy into the palette. + * \param firstcolor The index of the first palette entry to modify. + * \param ncolors The number of entries to modify. + * + * \return 0 on success, or -1 if not all of the colors could be set. + */ +extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette, + const SDL_Color * colors, + int firstcolor, int ncolors); + +/** + * \brief Free a palette created with SDL_AllocPalette(). + * + * \sa SDL_AllocPalette() + */ +extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette); + +/** + * \brief Maps an RGB triple to an opaque pixel value for a given pixel format. + * + * \sa SDL_MapRGBA + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format, + Uint8 r, Uint8 g, Uint8 b); + +/** + * \brief Maps an RGBA quadruple to a pixel value for a given pixel format. + * + * \sa SDL_MapRGB + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format, + Uint8 r, Uint8 g, Uint8 b, + Uint8 a); + +/** + * \brief Get the RGB components from a pixel of the specified format. + * + * \sa SDL_GetRGBA + */ +extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, + const SDL_PixelFormat * format, + Uint8 * r, Uint8 * g, Uint8 * b); + +/** + * \brief Get the RGBA components from a pixel of the specified format. + * + * \sa SDL_GetRGB + */ +extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, + const SDL_PixelFormat * format, + Uint8 * r, Uint8 * g, Uint8 * b, + Uint8 * a); + +/** + * \brief Calculate a 256 entry gamma ramp for a gamma value. + */ +extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_pixels_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_platform.h b/external/SDL2/SDL_platform.h new file mode 100644 index 0000000..b804a28 --- /dev/null +++ b/external/SDL2/SDL_platform.h @@ -0,0 +1,149 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_platform.h + * + * Try to get a standard set of platform defines. + */ + +#ifndef _SDL_platform_h +#define _SDL_platform_h + +#if defined(_AIX) +#undef __AIX__ +#define __AIX__ 1 +#endif +#if defined(__BEOS__) +#undef __BEOS__ +#define __BEOS__ 1 +#endif +#if defined(__HAIKU__) +#undef __HAIKU__ +#define __HAIKU__ 1 +#endif +#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) +#undef __BSDI__ +#define __BSDI__ 1 +#endif +#if defined(_arch_dreamcast) +#undef __DREAMCAST__ +#define __DREAMCAST__ 1 +#endif +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#undef __FREEBSD__ +#define __FREEBSD__ 1 +#endif +#if defined(hpux) || defined(__hpux) || defined(__hpux__) +#undef __HPUX__ +#define __HPUX__ 1 +#endif +#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) +#undef __IRIX__ +#define __IRIX__ 1 +#endif +#if defined(linux) || defined(__linux) || defined(__linux__) +#undef __LINUX__ +#define __LINUX__ 1 +#endif +#if defined(ANDROID) +#undef __ANDROID__ +#undef __LINUX__ /*do we need to do this?*/ +#define __ANDROID__ 1 +#endif + +#if defined(__APPLE__) +/* lets us know what version of Mac OS X we're compiling on */ +#include "AvailabilityMacros.h" +#include "TargetConditionals.h" +#if TARGET_OS_IPHONE +/* if compiling for iPhone */ +#undef __IPHONEOS__ +#define __IPHONEOS__ 1 +#undef __MACOSX__ +#else +/* if not compiling for iPhone */ +#undef __MACOSX__ +#define __MACOSX__ 1 +#endif /* TARGET_OS_IPHONE */ +#endif /* defined(__APPLE__) */ + +#if defined(__NetBSD__) +#undef __NETBSD__ +#define __NETBSD__ 1 +#endif +#if defined(__OpenBSD__) +#undef __OPENBSD__ +#define __OPENBSD__ 1 +#endif +#if defined(__OS2__) +#undef __OS2__ +#define __OS2__ 1 +#endif +#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) +#undef __OSF__ +#define __OSF__ 1 +#endif +#if defined(__QNXNTO__) +#undef __QNXNTO__ +#define __QNXNTO__ 1 +#endif +#if defined(riscos) || defined(__riscos) || defined(__riscos__) +#undef __RISCOS__ +#define __RISCOS__ 1 +#endif +#if defined(__SVR4) +#undef __SOLARIS__ +#define __SOLARIS__ 1 +#endif +#if defined(WIN32) || defined(_WIN32) +#undef __WIN32__ +#define __WIN32__ 1 +#endif +#if defined(__PSP__) +#undef __PSP__ +#define __PSP__ 1 +#endif + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Gets the name of the platform. + */ +extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_platform_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_power.h b/external/SDL2/SDL_power.h new file mode 100644 index 0000000..51180db --- /dev/null +++ b/external/SDL2/SDL_power.h @@ -0,0 +1,79 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_power_h +#define _SDL_power_h + +/** + * \file SDL_power.h + * + * Header for the SDL power management routines. + */ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief The basic state for the system's power supply. + */ +typedef enum +{ + SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ + SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ + SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ + SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ + SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ +} SDL_PowerState; + + +/** + * \brief Get the current power supply details. + * + * \param secs Seconds of battery life left. You can pass a NULL here if + * you don't care. Will return -1 if we can't determine a + * value, or we're not running on a battery. + * + * \param pct Percentage of battery life left, between 0 and 100. You can + * pass a NULL here if you don't care. Will return -1 if we + * can't determine a value, or we're not running on a battery. + * + * \return The state of the battery (if any). + */ +extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_power_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_quit.h b/external/SDL2/SDL_quit.h new file mode 100644 index 0000000..e3c87a3 --- /dev/null +++ b/external/SDL2/SDL_quit.h @@ -0,0 +1,58 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_quit.h + * + * Include file for SDL quit event handling. + */ + +#ifndef _SDL_quit_h +#define _SDL_quit_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +/** + * \file SDL_quit.h + * + * An ::SDL_QUIT event is generated when the user tries to close the application + * window. If it is ignored or filtered out, the window will remain open. + * If it is not ignored or filtered, it is queued normally and the window + * is allowed to close. When the window is closed, screen updates will + * complete, but have no effect. + * + * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) + * and SIGTERM (system termination request), if handlers do not already + * exist, that generate ::SDL_QUIT events as well. There is no way + * to determine the cause of an ::SDL_QUIT event, but setting a signal + * handler in your application will override the default generation of + * quit events for that signal. + * + * \sa SDL_Quit() + */ + +/* There are no functions directly affecting the quit event */ + +#define SDL_QuitRequested() \ + (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) + +#endif /* _SDL_quit_h */ diff --git a/external/SDL2/SDL_rect.h b/external/SDL2/SDL_rect.h new file mode 100644 index 0000000..0353c22 --- /dev/null +++ b/external/SDL2/SDL_rect.h @@ -0,0 +1,137 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_rect.h + * + * Header file for SDL_rect definition and management functions. + */ + +#ifndef _SDL_rect_h +#define _SDL_rect_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_pixels.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief The structure that defines a point + * + * \sa SDL_EnclosePoints + */ +typedef struct +{ + int x; + int y; +} SDL_Point; + +/** + * \brief A rectangle, with the origin at the upper left. + * + * \sa SDL_RectEmpty + * \sa SDL_RectEquals + * \sa SDL_HasIntersection + * \sa SDL_IntersectRect + * \sa SDL_UnionRect + * \sa SDL_EnclosePoints + */ +typedef struct SDL_Rect +{ + int x, y; + int w, h; +} SDL_Rect; + +/** + * \brief Returns true if the rectangle has no area. + */ +#define SDL_RectEmpty(X) ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0)) + +/** + * \brief Returns true if the two rectangles are equal. + */ +#define SDL_RectEquals(A, B) (((A)) && ((B)) && \ + ((A)->x == (B)->x) && ((A)->y == (B)->y) && \ + ((A)->w == (B)->w) && ((A)->h == (B)->h)) + +/** + * \brief Determine whether two rectangles intersect. + * + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, + const SDL_Rect * B); + +/** + * \brief Calculate the intersection of two rectangles. + * + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, + const SDL_Rect * B, + SDL_Rect * result); + +/** + * \brief Calculate the union of two rectangles. + */ +extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, + const SDL_Rect * B, + SDL_Rect * result); + +/** + * \brief Calculate a minimal rectangle enclosing a set of points + * + * \return SDL_TRUE if any points were within the clipping rect + */ +extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, + int count, + const SDL_Rect * clip, + SDL_Rect * result); + +/** + * \brief Calculate the intersection of a rectangle and line segment. + * + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * + rect, int *X1, + int *Y1, int *X2, + int *Y2); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_rect_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_render.h b/external/SDL2/SDL_render.h new file mode 100644 index 0000000..2697cd3 --- /dev/null +++ b/external/SDL2/SDL_render.h @@ -0,0 +1,788 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_render.h + * + * Header file for SDL 2D rendering functions. + * + * This API supports the following features: + * * single pixel points + * * single pixel lines + * * filled rectangles + * * texture images + * + * The primitives may be drawn in opaque, blended, or additive modes. + * + * The texture images may be drawn in opaque, blended, or additive modes. + * They can have an additional color tint or alpha modulation applied to + * them, and may also be stretched with linear interpolation. + * + * This API is designed to accelerate simple 2D operations. You may + * want more functionality such as rotation and particle effects and + * in that case you should use SDL's OpenGL/Direct3D support or one + * of the many good 3D engines. + */ + +#ifndef _SDL_render_h +#define _SDL_render_h + +#include "SDL_stdinc.h" +#include "SDL_rect.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Flags used when creating a rendering context + */ +typedef enum +{ + SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ + SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware + acceleration */ + SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized + with the refresh rate */ + SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports + rendering to texture */ +} SDL_RendererFlags; + +/** + * \brief Information on the capabilities of a render driver or context. + */ +typedef struct SDL_RendererInfo +{ + const char *name; /**< The name of the renderer */ + Uint32 flags; /**< Supported ::SDL_RendererFlags */ + Uint32 num_texture_formats; /**< The number of available texture formats */ + Uint32 texture_formats[16]; /**< The available texture formats */ + int max_texture_width; /**< The maximimum texture width */ + int max_texture_height; /**< The maximimum texture height */ +} SDL_RendererInfo; + +/** + * \brief The access pattern allowed for a texture. + */ +typedef enum +{ + SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */ + SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */ + SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */ +} SDL_TextureAccess; + +/** + * \brief The texture channel modulation used in SDL_RenderCopy(). + */ +typedef enum +{ + SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */ + SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ + SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ +} SDL_TextureModulate; + +/** + * \brief Flip constants for SDL_RenderCopyEx + */ +typedef enum +{ + SDL_FLIP_NONE = 0x00000000, /**< Do not flip */ + SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */ + SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */ +} SDL_RendererFlip; + +/** + * \brief A structure representing rendering state + */ +struct SDL_Renderer; +typedef struct SDL_Renderer SDL_Renderer; + +/** + * \brief An efficient driver-specific representation of pixel data + */ +struct SDL_Texture; +typedef struct SDL_Texture SDL_Texture; + + +/* Function prototypes */ + +/** + * \brief Get the number of 2D rendering drivers available for the current + * display. + * + * A render driver is a set of code that handles rendering and texture + * management on a particular display. Normally there is only one, but + * some drivers may have several available with different capabilities. + * + * \sa SDL_GetRenderDriverInfo() + * \sa SDL_CreateRenderer() + */ +extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); + +/** + * \brief Get information about a specific 2D rendering driver for the current + * display. + * + * \param index The index of the driver to query information about. + * \param info A pointer to an SDL_RendererInfo struct to be filled with + * information on the rendering driver. + * + * \return 0 on success, -1 if the index was out of range. + * + * \sa SDL_CreateRenderer() + */ +extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, + SDL_RendererInfo * info); + +/** + * \brief Create a window and default renderer + * + * \param width The width of the window + * \param height The height of the window + * \param window_flags The flags used to create the window + * \param window A pointer filled with the window, or NULL on error + * \param renderer A pointer filled with the renderer, or NULL on error + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( + int width, int height, Uint32 window_flags, + SDL_Window **window, SDL_Renderer **renderer); + + +/** + * \brief Create a 2D rendering context for a window. + * + * \param window The window where rendering is displayed. + * \param index The index of the rendering driver to initialize, or -1 to + * initialize the first one supporting the requested flags. + * \param flags ::SDL_RendererFlags. + * + * \return A valid rendering context or NULL if there was an error. + * + * \sa SDL_CreateSoftwareRenderer() + * \sa SDL_GetRendererInfo() + * \sa SDL_DestroyRenderer() + */ +extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, + int index, Uint32 flags); + +/** + * \brief Create a 2D software rendering context for a surface. + * + * \param surface The surface where rendering is done. + * + * \return A valid rendering context or NULL if there was an error. + * + * \sa SDL_CreateRenderer() + * \sa SDL_DestroyRenderer() + */ +extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface); + +/** + * \brief Get the renderer associated with a window. + */ +extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); + +/** + * \brief Get information about a rendering context. + */ +extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, + SDL_RendererInfo * info); + +/** + * \brief Create a texture for a rendering context. + * + * \param format The format of the texture. + * \param access One of the enumerated values in ::SDL_TextureAccess. + * \param w The width of the texture in pixels. + * \param h The height of the texture in pixels. + * + * \return The created texture is returned, or 0 if no rendering context was + * active, the format was unsupported, or the width or height were out + * of range. + * + * \sa SDL_QueryTexture() + * \sa SDL_UpdateTexture() + * \sa SDL_DestroyTexture() + */ +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, + Uint32 format, + int access, int w, + int h); + +/** + * \brief Create a texture from an existing surface. + * + * \param surface The surface containing pixel data used to fill the texture. + * + * \return The created texture is returned, or 0 on error. + * + * \note The surface is not modified or freed by this function. + * + * \sa SDL_QueryTexture() + * \sa SDL_DestroyTexture() + */ +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface); + +/** + * \brief Query the attributes of a texture + * + * \param texture A texture to be queried. + * \param format A pointer filled in with the raw format of the texture. The + * actual format may differ, but pixel transfers will use this + * format. + * \param access A pointer filled in with the actual access to the texture. + * \param w A pointer filled in with the width of the texture in pixels. + * \param h A pointer filled in with the height of the texture in pixels. + * + * \return 0 on success, or -1 if the texture is not valid. + */ +extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, + Uint32 * format, int *access, + int *w, int *h); + +/** + * \brief Set an additional color value used in render copy operations. + * + * \param texture The texture to update. + * \param r The red color value multiplied into copy operations. + * \param g The green color value multiplied into copy operations. + * \param b The blue color value multiplied into copy operations. + * + * \return 0 on success, or -1 if the texture is not valid or color modulation + * is not supported. + * + * \sa SDL_GetTextureColorMod() + */ +extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, + Uint8 r, Uint8 g, Uint8 b); + + +/** + * \brief Get the additional color value used in render copy operations. + * + * \param texture The texture to query. + * \param r A pointer filled in with the current red color value. + * \param g A pointer filled in with the current green color value. + * \param b A pointer filled in with the current blue color value. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \sa SDL_SetTextureColorMod() + */ +extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, + Uint8 * r, Uint8 * g, + Uint8 * b); + +/** + * \brief Set an additional alpha value used in render copy operations. + * + * \param texture The texture to update. + * \param alpha The alpha value multiplied into copy operations. + * + * \return 0 on success, or -1 if the texture is not valid or alpha modulation + * is not supported. + * + * \sa SDL_GetTextureAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, + Uint8 alpha); + +/** + * \brief Get the additional alpha value used in render copy operations. + * + * \param texture The texture to query. + * \param alpha A pointer filled in with the current alpha value. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \sa SDL_SetTextureAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, + Uint8 * alpha); + +/** + * \brief Set the blend mode used for texture copy operations. + * + * \param texture The texture to update. + * \param blendMode ::SDL_BlendMode to use for texture blending. + * + * \return 0 on success, or -1 if the texture is not valid or the blend mode is + * not supported. + * + * \note If the blend mode is not supported, the closest supported mode is + * chosen. + * + * \sa SDL_GetTextureBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, + SDL_BlendMode blendMode); + +/** + * \brief Get the blend mode used for texture copy operations. + * + * \param texture The texture to query. + * \param blendMode A pointer filled in with the current blend mode. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \sa SDL_SetTextureBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, + SDL_BlendMode *blendMode); + +/** + * \brief Update the given texture rectangle with new pixel data. + * + * \param texture The texture to update + * \param rect A pointer to the rectangle of pixels to update, or NULL to + * update the entire texture. + * \param pixels The raw pixel data. + * \param pitch The number of bytes between rows of pixel data. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \note This is a fairly slow function. + */ +extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, + const SDL_Rect * rect, + const void *pixels, int pitch); + +/** + * \brief Lock a portion of the texture for write-only pixel access. + * + * \param texture The texture to lock for access, which was created with + * ::SDL_TEXTUREACCESS_STREAMING. + * \param rect A pointer to the rectangle to lock for access. If the rect + * is NULL, the entire texture will be locked. + * \param pixels This is filled in with a pointer to the locked pixels, + * appropriately offset by the locked area. + * \param pitch This is filled in with the pitch of the locked pixels. + * + * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. + * + * \sa SDL_UnlockTexture() + */ +extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, + const SDL_Rect * rect, + void **pixels, int *pitch); + +/** + * \brief Unlock a texture, uploading the changes to video memory, if needed. + * + * \sa SDL_LockTexture() + */ +extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); + +/** + * \brief Determines whether a window supports the use of render targets + * + * \param renderer The renderer that will be checked + * + * \return SDL_TRUE if supported, SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); + +/** + * \brief Set a texture as the current rendering target. + * + * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target + * + * \return 0 on success, or -1 on error + * + * \sa SDL_GetRenderTarget() + */ +extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, + SDL_Texture *texture); + +/** + * \brief Get the current render target or NULL for the default render target. + * + * \return The current render target + * + * \sa SDL_SetRenderTarget() + */ +extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer); + +/** + * \brief Set device independent resolution for rendering + * + * \param w The width of the logical resolution + * \param h The height of the logical resolution + * + * This function uses the viewport and scaling functionality to allow a fixed logical + * resolution for rendering, regardless of the actual output resolution. If the actual + * output resolution doesn't have the same aspect ratio the output rendering will be + * centered within the output display. + * + * If the output display is a window, mouse events in the window will be filtered + * and scaled so they seem to arrive within the logical resolution. + * + * \note If this function results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. + * + * \sa SDL_RenderGetLogicalSize() + * \sa SDL_RenderSetScale() + * \sa SDL_RenderSetViewport() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h); + +/** + * \brief Get device independent resolution for rendering + * + * \param w A pointer filled with the width of the logical resolution + * \param h A pointer filled with the height of the logical resolution + * + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *y); + +/** + * \brief Set the drawing area for rendering on the current target. + * + * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. + * + * The x,y of the viewport rect represents the origin for rendering. + * + * \note When the window is resized, the current viewport is automatically + * centered within the new window size. + * + * \sa SDL_RenderGetViewport() + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Get the drawing area for the current target. + * + * \sa SDL_RenderSetViewport() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, + SDL_Rect * rect); + +/** + * \brief Set the drawing scale for rendering on the current target. + * + * \param scaleX The horizontal scaling factor + * \param scaleY The vertical scaling factor + * + * The drawing coordinates are scaled by the x/y scaling factors + * before they are used by the renderer. This allows resolution + * independent drawing with a single coordinate system. + * + * \note If this results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. For best results use integer scaling factors. + * + * \sa SDL_RenderGetScale() + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer, + float scaleX, float scaleY); + +/** + * \brief Get the drawing scale for the current target. + * + * \param scaleX A pointer filled in with the horizontal scaling factor + * \param scaleY A pointer filled in with the vertical scaling factor + * + * \sa SDL_RenderSetScale() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer, + float *scaleX, float *scaleY); + +/** + * \brief Set the color used for drawing operations (Rect, Line and Clear). + * + * \param r The red value used to draw on the rendering target. + * \param g The green value used to draw on the rendering target. + * \param b The blue value used to draw on the rendering target. + * \param a The alpha value used to draw on the rendering target, usually + * ::SDL_ALPHA_OPAQUE (255). + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer, + Uint8 r, Uint8 g, Uint8 b, + Uint8 a); + +/** + * \brief Get the color used for drawing operations (Rect, Line and Clear). + * + * \param r A pointer to the red value used to draw on the rendering target. + * \param g A pointer to the green value used to draw on the rendering target. + * \param b A pointer to the blue value used to draw on the rendering target. + * \param a A pointer to the alpha value used to draw on the rendering target, + * usually ::SDL_ALPHA_OPAQUE (255). + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer, + Uint8 * r, Uint8 * g, Uint8 * b, + Uint8 * a); + +/** + * \brief Set the blend mode used for drawing operations (Fill and Line). + * + * \param blendMode ::SDL_BlendMode to use for blending. + * + * \return 0 on success, or -1 on error + * + * \note If the blend mode is not supported, the closest supported mode is + * chosen. + * + * \sa SDL_GetRenderDrawBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, + SDL_BlendMode blendMode); + +/** + * \brief Get the blend mode used for drawing operations. + * + * \param blendMode A pointer filled in with the current blend mode. + * + * \return 0 on success, or -1 on error + * + * \sa SDL_SetRenderDrawBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, + SDL_BlendMode *blendMode); + +/** + * \brief Clear the current rendering target with the drawing color + * + * This function clears the entire rendering target, ignoring the viewport. + */ +extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); + +/** + * \brief Draw a point on the current rendering target. + * + * \param x The x coordinate of the point. + * \param y The y coordinate of the point. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, + int x, int y); + +/** + * \brief Draw multiple points on the current rendering target. + * + * \param points The points to draw + * \param count The number of points to draw + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_Point * points, + int count); + +/** + * \brief Draw a line on the current rendering target. + * + * \param x1 The x coordinate of the start point. + * \param y1 The y coordinate of the start point. + * \param x2 The x coordinate of the end point. + * \param y2 The y coordinate of the end point. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, + int x1, int y1, int x2, int y2); + +/** + * \brief Draw a series of connected lines on the current rendering target. + * + * \param points The points along the lines + * \param count The number of points, drawing count-1 lines + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, + const SDL_Point * points, + int count); + +/** + * \brief Draw a rectangle on the current rendering target. + * + * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Draw some number of rectangles on the current rendering target. + * + * \param rects A pointer to an array of destination rectangles. + * \param count The number of rectangles. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, + const SDL_Rect * rects, + int count); + +/** + * \brief Fill a rectangle on the current rendering target with the drawing color. + * + * \param rect A pointer to the destination rectangle, or NULL for the entire + * rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Fill some number of rectangles on the current rendering target with the drawing color. + * + * \param rects A pointer to an array of destination rectangles. + * \param count The number of rectangles. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, + const SDL_Rect * rects, + int count); + +/** + * \brief Copy a portion of the texture to the current rendering target. + * + * \param texture The source texture. + * \param srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * \param dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, + SDL_Texture * texture, + const SDL_Rect * srcrect, + const SDL_Rect * dstrect); + +/** + * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * + * \param texture The source texture. + * \param srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * \param dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect + * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) + * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, + SDL_Texture * texture, + const SDL_Rect * srcrect, + const SDL_Rect * dstrect, + const double angle, + const SDL_Point *center, + const SDL_RendererFlip flip); + +/** + * \brief Read pixels from the current rendering target. + * + * \param rect A pointer to the rectangle to read, or NULL for the entire + * render target. + * \param format The desired format of the pixel data, or 0 to use the format + * of the rendering target + * \param pixels A pointer to be filled in with the pixel data + * \param pitch The pitch of the pixels parameter. + * + * \return 0 on success, or -1 if pixel reading is not supported. + * + * \warning This is a very slow operation, and should not be used frequently. + */ +extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, + const SDL_Rect * rect, + Uint32 format, + void *pixels, int pitch); + +/** + * \brief Update the screen with rendering performed. + */ +extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer); + +/** + * \brief Destroy the specified texture. + * + * \sa SDL_CreateTexture() + * \sa SDL_CreateTextureFromSurface() + */ +extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); + +/** + * \brief Destroy the rendering context for a window and free associated + * textures. + * + * \sa SDL_CreateRenderer() + */ +extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); + + +/** + * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with + * OpenGL instructions. + * + * \param texture The SDL texture to bind + * \param texw A pointer to a float that will be filled with the texture width + * \param texh A pointer to a float that will be filled with the texture height + * + * \return 0 on success, or -1 if the operation is not supported + */ +extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh); + +/** + * \brief Unbind a texture from the current OpenGL/ES/ES2 context. + * + * \param texture The SDL texture to unbind + * + * \return 0 on success, or -1 if the operation is not supported + */ +extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_render_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_revision.h b/external/SDL2/SDL_revision.h new file mode 100644 index 0000000..23ac4a5 --- /dev/null +++ b/external/SDL2/SDL_revision.h @@ -0,0 +1,2 @@ +#define SDL_REVISION "hg-0:aaaaaaaaaaah" +#define SDL_REVISION_NUMBER 0 diff --git a/external/SDL2/SDL_rwops.h b/external/SDL2/SDL_rwops.h new file mode 100644 index 0000000..3049247 --- /dev/null +++ b/external/SDL2/SDL_rwops.h @@ -0,0 +1,235 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_rwops.h + * + * This file provides a general interface for SDL to read and write + * data streams. It can easily be extended to files, memory, etc. + */ + +#ifndef _SDL_rwops_h +#define _SDL_rwops_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* RWops Types */ +#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */ +#define SDL_RWOPS_WINFILE 1 /* Win32 file */ +#define SDL_RWOPS_STDFILE 2 /* Stdio file */ +#define SDL_RWOPS_JNIFILE 3 /* Android asset */ +#define SDL_RWOPS_MEMORY 4 /* Memory stream */ +#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */ + +/** + * This is the read/write operation structure -- very basic. + */ +typedef struct SDL_RWops +{ + /** + * Return the size of the file in this rwops, or -1 if unknown + */ + Sint64 (SDLCALL * size) (struct SDL_RWops * context); + + /** + * Seek to \c offset relative to \c whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * \return the final offset in the data stream, or -1 on error. + */ + Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset, + int whence); + + /** + * Read up to \c maxnum objects each of size \c size from the data + * stream to the area pointed at by \c ptr. + * + * \return the number of objects read, or 0 at error or end of file. + */ + size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr, + size_t size, size_t maxnum); + + /** + * Write exactly \c num objects each of size \c size from the area + * pointed at by \c ptr to data stream. + * + * \return the number of objects written, or 0 at error or end of file. + */ + size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr, + size_t size, size_t num); + + /** + * Close and free an allocated SDL_RWops structure. + * + * \return 0 if successful or -1 on write error when flushing data. + */ + int (SDLCALL * close) (struct SDL_RWops * context); + + Uint32 type; + union + { +#if defined(ANDROID) + struct + { + void *fileNameRef; + void *inputStreamRef; + void *readableByteChannelRef; + void *readMethod; + void *assetFileDescriptorRef; + long position; + long size; + long offset; + int fd; + } androidio; +#elif defined(__WIN32__) + struct + { + SDL_bool append; + void *h; + struct + { + void *data; + size_t size; + size_t left; + } buffer; + } windowsio; +#endif + +#ifdef HAVE_STDIO_H + struct + { + SDL_bool autoclose; + FILE *fp; + } stdio; +#endif + struct + { + Uint8 *base; + Uint8 *here; + Uint8 *stop; + } mem; + struct + { + void *data1; + } unknown; + } hidden; + +} SDL_RWops; + + +/** + * \name RWFrom functions + * + * Functions to create SDL_RWops structures from various data streams. + */ +/*@{*/ + +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, + const char *mode); + +#ifdef HAVE_STDIO_H +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, + SDL_bool autoclose); +#else +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp, + SDL_bool autoclose); +#endif + +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size); +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, + int size); + +/*@}*//*RWFrom functions*/ + + +extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); +extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); + +#define RW_SEEK_SET 0 /**< Seek from the beginning of data */ +#define RW_SEEK_CUR 1 /**< Seek relative to current read point */ +#define RW_SEEK_END 2 /**< Seek relative to the end of data */ + +/** + * \name Read/write macros + * + * Macros to easily read and write from an SDL_RWops structure. + */ +/*@{*/ +#define SDL_RWsize(ctx) (ctx)->size(ctx) +#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) +#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) +#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) +#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) +#define SDL_RWclose(ctx) (ctx)->close(ctx) +/*@}*//*Read/write macros*/ + + +/** + * \name Read endian functions + * + * Read an item of the specified endianness and return in native format. + */ +/*@{*/ +extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); +/*@}*//*Read endian functions*/ + +/** + * \name Write endian functions + * + * Write an item of native format to the specified endianness. + */ +/*@{*/ +extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); +/*@}*//*Write endian functions*/ + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_rwops_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_scancode.h b/external/SDL2/SDL_scancode.h new file mode 100644 index 0000000..9463dd6 --- /dev/null +++ b/external/SDL2/SDL_scancode.h @@ -0,0 +1,401 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_scancode.h + * + * Defines keyboard scancodes. + */ + +#ifndef _SDL_scancode_h +#define _SDL_scancode_h + +#include "SDL_stdinc.h" + +/** + * \brief The SDL keyboard scancode representation. + * + * Values of this type are used to represent keyboard keys, among other places + * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the + * SDL_Event structure. + * + * The values in this enumeration are based on the USB usage page standard: + * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf + */ +typedef enum +{ + SDL_SCANCODE_UNKNOWN = 0, + + /** + * \name Usage page 0x07 + * + * These values are from usage page 0x07 (USB keyboard page). + */ + /*@{*/ + + SDL_SCANCODE_A = 4, + SDL_SCANCODE_B = 5, + SDL_SCANCODE_C = 6, + SDL_SCANCODE_D = 7, + SDL_SCANCODE_E = 8, + SDL_SCANCODE_F = 9, + SDL_SCANCODE_G = 10, + SDL_SCANCODE_H = 11, + SDL_SCANCODE_I = 12, + SDL_SCANCODE_J = 13, + SDL_SCANCODE_K = 14, + SDL_SCANCODE_L = 15, + SDL_SCANCODE_M = 16, + SDL_SCANCODE_N = 17, + SDL_SCANCODE_O = 18, + SDL_SCANCODE_P = 19, + SDL_SCANCODE_Q = 20, + SDL_SCANCODE_R = 21, + SDL_SCANCODE_S = 22, + SDL_SCANCODE_T = 23, + SDL_SCANCODE_U = 24, + SDL_SCANCODE_V = 25, + SDL_SCANCODE_W = 26, + SDL_SCANCODE_X = 27, + SDL_SCANCODE_Y = 28, + SDL_SCANCODE_Z = 29, + + SDL_SCANCODE_1 = 30, + SDL_SCANCODE_2 = 31, + SDL_SCANCODE_3 = 32, + SDL_SCANCODE_4 = 33, + SDL_SCANCODE_5 = 34, + SDL_SCANCODE_6 = 35, + SDL_SCANCODE_7 = 36, + SDL_SCANCODE_8 = 37, + SDL_SCANCODE_9 = 38, + SDL_SCANCODE_0 = 39, + + SDL_SCANCODE_RETURN = 40, + SDL_SCANCODE_ESCAPE = 41, + SDL_SCANCODE_BACKSPACE = 42, + SDL_SCANCODE_TAB = 43, + SDL_SCANCODE_SPACE = 44, + + SDL_SCANCODE_MINUS = 45, + SDL_SCANCODE_EQUALS = 46, + SDL_SCANCODE_LEFTBRACKET = 47, + SDL_SCANCODE_RIGHTBRACKET = 48, + SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout, REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout, NUMBER SIGN and TILDE in a UK + * Windows layout, DOLLAR SIGN and POUND SIGN + * in a Swiss German layout, NUMBER SIGN and + * APOSTROPHE in a German layout, GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout, and ASTERISK and MICRO SIGN in a + * French Windows layout. + */ + SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code + * instead of 49 for the same key, but all + * OSes I've seen treat the two codes + * identically. So, as an implementor, unless + * your keyboard generates both of those + * codes and your OS treats them differently, + * you should generate SDL_SCANCODE_BACKSLASH + * instead of this code. As a user, you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. + */ + SDL_SCANCODE_SEMICOLON = 51, + SDL_SCANCODE_APOSTROPHE = 52, + SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards, GRAVE ACCENT + * and NOT SIGN in a UK Windows layout, SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards, SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards), CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on + * ISO keyboards), SUPERSCRIPT TWO and TILDE in a + * French Windows layout, COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO + * keyboards, and LESS-THAN SIGN and GREATER-THAN + * SIGN in a Swiss German, German, or French Mac + * layout on ANSI keyboards. + */ + SDL_SCANCODE_COMMA = 54, + SDL_SCANCODE_PERIOD = 55, + SDL_SCANCODE_SLASH = 56, + + SDL_SCANCODE_CAPSLOCK = 57, + + SDL_SCANCODE_F1 = 58, + SDL_SCANCODE_F2 = 59, + SDL_SCANCODE_F3 = 60, + SDL_SCANCODE_F4 = 61, + SDL_SCANCODE_F5 = 62, + SDL_SCANCODE_F6 = 63, + SDL_SCANCODE_F7 = 64, + SDL_SCANCODE_F8 = 65, + SDL_SCANCODE_F9 = 66, + SDL_SCANCODE_F10 = 67, + SDL_SCANCODE_F11 = 68, + SDL_SCANCODE_F12 = 69, + + SDL_SCANCODE_PRINTSCREEN = 70, + SDL_SCANCODE_SCROLLLOCK = 71, + SDL_SCANCODE_PAUSE = 72, + SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but + does send code 73, not 117) */ + SDL_SCANCODE_HOME = 74, + SDL_SCANCODE_PAGEUP = 75, + SDL_SCANCODE_DELETE = 76, + SDL_SCANCODE_END = 77, + SDL_SCANCODE_PAGEDOWN = 78, + SDL_SCANCODE_RIGHT = 79, + SDL_SCANCODE_LEFT = 80, + SDL_SCANCODE_DOWN = 81, + SDL_SCANCODE_UP = 82, + + SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards + */ + SDL_SCANCODE_KP_DIVIDE = 84, + SDL_SCANCODE_KP_MULTIPLY = 85, + SDL_SCANCODE_KP_MINUS = 86, + SDL_SCANCODE_KP_PLUS = 87, + SDL_SCANCODE_KP_ENTER = 88, + SDL_SCANCODE_KP_1 = 89, + SDL_SCANCODE_KP_2 = 90, + SDL_SCANCODE_KP_3 = 91, + SDL_SCANCODE_KP_4 = 92, + SDL_SCANCODE_KP_5 = 93, + SDL_SCANCODE_KP_6 = 94, + SDL_SCANCODE_KP_7 = 95, + SDL_SCANCODE_KP_8 = 96, + SDL_SCANCODE_KP_9 = 97, + SDL_SCANCODE_KP_0 = 98, + SDL_SCANCODE_KP_PERIOD = 99, + + SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO + * keyboards have over ANSI ones, + * located between left shift and Y. + * Produces GRAVE ACCENT and TILDE in a + * US or UK Mac layout, REVERSE SOLIDUS + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout, and + * LESS-THAN SIGN and GREATER-THAN SIGN + * in a Swiss German, German, or French + * layout. */ + SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */ + SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, + * not a physical key - but some Mac keyboards + * do have a power key. */ + SDL_SCANCODE_KP_EQUALS = 103, + SDL_SCANCODE_F13 = 104, + SDL_SCANCODE_F14 = 105, + SDL_SCANCODE_F15 = 106, + SDL_SCANCODE_F16 = 107, + SDL_SCANCODE_F17 = 108, + SDL_SCANCODE_F18 = 109, + SDL_SCANCODE_F19 = 110, + SDL_SCANCODE_F20 = 111, + SDL_SCANCODE_F21 = 112, + SDL_SCANCODE_F22 = 113, + SDL_SCANCODE_F23 = 114, + SDL_SCANCODE_F24 = 115, + SDL_SCANCODE_EXECUTE = 116, + SDL_SCANCODE_HELP = 117, + SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_SELECT = 119, + SDL_SCANCODE_STOP = 120, + SDL_SCANCODE_AGAIN = 121, /**< redo */ + SDL_SCANCODE_UNDO = 122, + SDL_SCANCODE_CUT = 123, + SDL_SCANCODE_COPY = 124, + SDL_SCANCODE_PASTE = 125, + SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_MUTE = 127, + SDL_SCANCODE_VOLUMEUP = 128, + SDL_SCANCODE_VOLUMEDOWN = 129, +/* not sure whether there's a reason to enable these */ +/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */ +/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */ +/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */ + SDL_SCANCODE_KP_COMMA = 133, + SDL_SCANCODE_KP_EQUALSAS400 = 134, + + SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see + footnotes in USB doc */ + SDL_SCANCODE_INTERNATIONAL2 = 136, + SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */ + SDL_SCANCODE_INTERNATIONAL4 = 138, + SDL_SCANCODE_INTERNATIONAL5 = 139, + SDL_SCANCODE_INTERNATIONAL6 = 140, + SDL_SCANCODE_INTERNATIONAL7 = 141, + SDL_SCANCODE_INTERNATIONAL8 = 142, + SDL_SCANCODE_INTERNATIONAL9 = 143, + SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */ + SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */ + SDL_SCANCODE_LANG3 = 146, /**< Katakana */ + SDL_SCANCODE_LANG4 = 147, /**< Hiragana */ + SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */ + SDL_SCANCODE_LANG6 = 149, /**< reserved */ + SDL_SCANCODE_LANG7 = 150, /**< reserved */ + SDL_SCANCODE_LANG8 = 151, /**< reserved */ + SDL_SCANCODE_LANG9 = 152, /**< reserved */ + + SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ + SDL_SCANCODE_SYSREQ = 154, + SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CLEAR = 156, + SDL_SCANCODE_PRIOR = 157, + SDL_SCANCODE_RETURN2 = 158, + SDL_SCANCODE_SEPARATOR = 159, + SDL_SCANCODE_OUT = 160, + SDL_SCANCODE_OPER = 161, + SDL_SCANCODE_CLEARAGAIN = 162, + SDL_SCANCODE_CRSEL = 163, + SDL_SCANCODE_EXSEL = 164, + + SDL_SCANCODE_KP_00 = 176, + SDL_SCANCODE_KP_000 = 177, + SDL_SCANCODE_THOUSANDSSEPARATOR = 178, + SDL_SCANCODE_DECIMALSEPARATOR = 179, + SDL_SCANCODE_CURRENCYUNIT = 180, + SDL_SCANCODE_CURRENCYSUBUNIT = 181, + SDL_SCANCODE_KP_LEFTPAREN = 182, + SDL_SCANCODE_KP_RIGHTPAREN = 183, + SDL_SCANCODE_KP_LEFTBRACE = 184, + SDL_SCANCODE_KP_RIGHTBRACE = 185, + SDL_SCANCODE_KP_TAB = 186, + SDL_SCANCODE_KP_BACKSPACE = 187, + SDL_SCANCODE_KP_A = 188, + SDL_SCANCODE_KP_B = 189, + SDL_SCANCODE_KP_C = 190, + SDL_SCANCODE_KP_D = 191, + SDL_SCANCODE_KP_E = 192, + SDL_SCANCODE_KP_F = 193, + SDL_SCANCODE_KP_XOR = 194, + SDL_SCANCODE_KP_POWER = 195, + SDL_SCANCODE_KP_PERCENT = 196, + SDL_SCANCODE_KP_LESS = 197, + SDL_SCANCODE_KP_GREATER = 198, + SDL_SCANCODE_KP_AMPERSAND = 199, + SDL_SCANCODE_KP_DBLAMPERSAND = 200, + SDL_SCANCODE_KP_VERTICALBAR = 201, + SDL_SCANCODE_KP_DBLVERTICALBAR = 202, + SDL_SCANCODE_KP_COLON = 203, + SDL_SCANCODE_KP_HASH = 204, + SDL_SCANCODE_KP_SPACE = 205, + SDL_SCANCODE_KP_AT = 206, + SDL_SCANCODE_KP_EXCLAM = 207, + SDL_SCANCODE_KP_MEMSTORE = 208, + SDL_SCANCODE_KP_MEMRECALL = 209, + SDL_SCANCODE_KP_MEMCLEAR = 210, + SDL_SCANCODE_KP_MEMADD = 211, + SDL_SCANCODE_KP_MEMSUBTRACT = 212, + SDL_SCANCODE_KP_MEMMULTIPLY = 213, + SDL_SCANCODE_KP_MEMDIVIDE = 214, + SDL_SCANCODE_KP_PLUSMINUS = 215, + SDL_SCANCODE_KP_CLEAR = 216, + SDL_SCANCODE_KP_CLEARENTRY = 217, + SDL_SCANCODE_KP_BINARY = 218, + SDL_SCANCODE_KP_OCTAL = 219, + SDL_SCANCODE_KP_DECIMAL = 220, + SDL_SCANCODE_KP_HEXADECIMAL = 221, + + SDL_SCANCODE_LCTRL = 224, + SDL_SCANCODE_LSHIFT = 225, + SDL_SCANCODE_LALT = 226, /**< alt, option */ + SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */ + SDL_SCANCODE_RCTRL = 228, + SDL_SCANCODE_RSHIFT = 229, + SDL_SCANCODE_RALT = 230, /**< alt gr, option */ + SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */ + + SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered + * by any of the above, but since there's a + * special KMOD_MODE for it I'm adding it here + */ + + /*@}*//*Usage page 0x07*/ + + /** + * \name Usage page 0x0C + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /*@{*/ + + SDL_SCANCODE_AUDIONEXT = 258, + SDL_SCANCODE_AUDIOPREV = 259, + SDL_SCANCODE_AUDIOSTOP = 260, + SDL_SCANCODE_AUDIOPLAY = 261, + SDL_SCANCODE_AUDIOMUTE = 262, + SDL_SCANCODE_MEDIASELECT = 263, + SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_MAIL = 265, + SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_COMPUTER = 267, + SDL_SCANCODE_AC_SEARCH = 268, + SDL_SCANCODE_AC_HOME = 269, + SDL_SCANCODE_AC_BACK = 270, + SDL_SCANCODE_AC_FORWARD = 271, + SDL_SCANCODE_AC_STOP = 272, + SDL_SCANCODE_AC_REFRESH = 273, + SDL_SCANCODE_AC_BOOKMARKS = 274, + + /*@}*//*Usage page 0x0C*/ + + /** + * \name Walther keys + * + * These are values that Christian Walther added (for mac keyboard?). + */ + /*@{*/ + + SDL_SCANCODE_BRIGHTNESSDOWN = 275, + SDL_SCANCODE_BRIGHTNESSUP = 276, + SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display + switch, video mode switch */ + SDL_SCANCODE_KBDILLUMTOGGLE = 278, + SDL_SCANCODE_KBDILLUMDOWN = 279, + SDL_SCANCODE_KBDILLUMUP = 280, + SDL_SCANCODE_EJECT = 281, + SDL_SCANCODE_SLEEP = 282, + + SDL_SCANCODE_APP1 = 283, + SDL_SCANCODE_APP2 = 284, + + /*@}*//*Walther keys*/ + + /* Add any other keys here. */ + + SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes + for array bounds */ +} SDL_Scancode; + +#endif /* _SDL_scancode_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_shape.h b/external/SDL2/SDL_shape.h new file mode 100644 index 0000000..4345807 --- /dev/null +++ b/external/SDL2/SDL_shape.h @@ -0,0 +1,147 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_shape_h +#define _SDL_shape_h + +#include "SDL_stdinc.h" +#include "SDL_pixels.h" +#include "SDL_rect.h" +#include "SDL_surface.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** \file SDL_shape.h + * + * Header file for the shaped window API. + */ + +#define SDL_NONSHAPEABLE_WINDOW -1 +#define SDL_INVALID_SHAPE_ARGUMENT -2 +#define SDL_WINDOW_LACKS_SHAPE -3 + +/** + * \brief Create a window that can be shaped with the specified position, dimensions, and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window. + * \param h The height of the window. + * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: + * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED, + * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_RESIZABLE, + * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, + * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset. + * + * \return The window created, or NULL if window creation failed. + * + * \sa SDL_DestroyWindow() + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); + +/** + * \brief Return whether the given window is a shaped window. + * + * \param window The window to query for being shaped. + * + * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. + * \sa SDL_CreateShapedWindow + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); + +/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ +typedef enum { + /** \brief The default mode, a binarized alpha cutoff of 1. */ + ShapeModeDefault, + /** \brief A binarized alpha cutoff with a given integer value. */ + ShapeModeBinarizeAlpha, + /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */ + ShapeModeReverseBinarizeAlpha, + /** \brief A color key is applied. */ + ShapeModeColorKey +} WindowShapeMode; + +#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha) + +/** \brief A union containing parameters for shaped windows. */ +typedef union { + /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ + Uint8 binarizationCutoff; + SDL_Color colorKey; +} SDL_WindowShapeParams; + +/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */ +typedef struct SDL_WindowShapeMode { + /** \brief The mode of these window-shape parameters. */ + WindowShapeMode mode; + /** \brief Window-shape parameters. */ + SDL_WindowShapeParams parameters; +} SDL_WindowShapeMode; + +/** + * \brief Set the shape and parameters of a shaped window. + * + * \param window The shaped window whose parameters should be set. + * \param shape A surface encoding the desired shape for the window. + * \param shape_mode The parameters to set for the shaped window. + * + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW + * if the SDL_Window* given does not reference a valid shaped window. + * + * \sa SDL_WindowShapeMode + * \sa SDL_GetShapedWindowMode. + */ +extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); + +/** + * \brief Get the shape parameters of a shaped window. + * + * \param window The shaped window whose parameters should be retrieved. + * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape. + * + * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode + * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if + * the SDL_Window* given is a shapeable window currently lacking a shape. + * + * \sa SDL_WindowShapeMode + * \sa SDL_SetWindowShape + */ +extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_shape_h */ diff --git a/external/SDL2/SDL_stdinc.h b/external/SDL2/SDL_stdinc.h new file mode 100644 index 0000000..c7b1bd3 --- /dev/null +++ b/external/SDL2/SDL_stdinc.h @@ -0,0 +1,795 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_stdinc.h + * + * This is a general header that includes C language support. + */ + +#ifndef _SDL_stdinc_h +#define _SDL_stdinc_h + +#include "SDL_config.h" + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDIO_H +#include +#endif +#if defined(STDC_HEADERS) +# include +# include +# include +#else +# if defined(HAVE_STDLIB_H) +# include +# elif defined(HAVE_MALLOC_H) +# include +# endif +# if defined(HAVE_STDDEF_H) +# include +# endif +# if defined(HAVE_STDARG_H) +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#if defined(HAVE_INTTYPES_H) +# include +#elif defined(HAVE_STDINT_H) +# include +#endif +#ifdef HAVE_CTYPE_H +# include +#endif +#ifdef HAVE_MATH_H +# include +#endif +#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) +# include +#endif + +/** + * The number of elements in an array. + */ +#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) +#define SDL_TABLESIZE(table) SDL_arraysize(table) + +/** + * \name Cast operators + * + * Use proper C++ casts when compiled as C++ to be compatible with the option + * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). + */ +/*@{*/ +#ifdef __cplusplus +#define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) +#define SDL_static_cast(type, expression) static_cast(expression) +#else +#define SDL_reinterpret_cast(type, expression) ((type)(expression)) +#define SDL_static_cast(type, expression) ((type)(expression)) +#endif +/*@}*//*Cast operators*/ + +/* Define a four character code as a Uint32 */ +#define SDL_FOURCC(A, B, C, D) \ + ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) + +/** + * \name Basic data types + */ +/*@{*/ + +typedef enum +{ + SDL_FALSE = 0, + SDL_TRUE = 1 +} SDL_bool; + +/** + * \brief A signed 8-bit integer type. + */ +typedef int8_t Sint8; +/** + * \brief An unsigned 8-bit integer type. + */ +typedef uint8_t Uint8; +/** + * \brief A signed 16-bit integer type. + */ +typedef int16_t Sint16; +/** + * \brief An unsigned 16-bit integer type. + */ +typedef uint16_t Uint16; +/** + * \brief A signed 32-bit integer type. + */ +typedef int32_t Sint32; +/** + * \brief An unsigned 32-bit integer type. + */ +typedef uint32_t Uint32; + +/** + * \brief A signed 64-bit integer type. + */ +typedef int64_t Sint64; +/** + * \brief An unsigned 64-bit integer type. + */ +typedef uint64_t Uint64; + +/*@}*//*Basic data types*/ + + +#define SDL_COMPILE_TIME_ASSERT(name, x) \ + typedef int SDL_dummy_ ## name[(x) * 2 - 1] +/** \cond */ +#ifndef DOXYGEN_SHOULD_IGNORE_THIS +SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); +SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); +SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); +SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); +SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); +SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); +SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); +SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); +#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ +/** \endcond */ + +/* Check to make sure enums are the size of ints, for structure packing. + For both Watcom C/C++ and Borland C/C++ the compiler option that makes + enums having the size of an int must be enabled. + This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). +*/ + +/** \cond */ +#ifndef DOXYGEN_SHOULD_IGNORE_THIS +#if !defined(__ANDROID__) + /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ +typedef enum +{ + DUMMY_ENUM_VALUE +} SDL_DUMMY_ENUM; + +SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); +#endif +#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ +/** \endcond */ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif +#endif +#ifdef HAVE_ALLOCA +#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) +#define SDL_stack_free(data) +#else +#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) +#define SDL_stack_free(data) SDL_free(data) +#endif + + +/* SDL stdinc inline functions: + + The theory here is that by default we forcibly inline what we can, and your + app will use the inline version by default. However we expose a non-inline + version too, so the symbol is always available in the library even if your app + bypassed the inline version. The SDL_*_inline versions aren't guaranteed to + exist, so never call them directly; use SDL_* instead, and trust the system + to give you the right thing. + + The benefit here is that you can dlsym() these functions, which you + couldn't if you had macros, you can link against a foreign build of SDL + even if you configured differently, and you can drop the unconfigured SDL + headers into a project without #defining HAVE_MALLOC (etc) and still link. +*/ + +extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); +#ifdef HAVE_MALLOC +SDL_FORCE_INLINE void *SDL_malloc_inline(size_t size) { return malloc(size); } +#define SDL_malloc SDL_malloc_inline +#endif + +extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); +#ifdef HAVE_CALLOC +SDL_FORCE_INLINE void *SDL_calloc_inline(size_t nmemb, size_t size) { return calloc(nmemb, size); } +#define SDL_calloc SDL_calloc_inline +#endif + +extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); +#ifdef HAVE_REALLOC +SDL_FORCE_INLINE void *SDL_realloc_inline(void *mem, size_t size) { return realloc(mem, size); } +#define SDL_realloc SDL_realloc_inline +#endif + +extern DECLSPEC void SDLCALL SDL_free(void *mem); +#ifdef HAVE_FREE +SDL_FORCE_INLINE void SDL_free_inline(void *mem) { free(mem); } +#define SDL_free SDL_free_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); +#ifdef HAVE_GETENV +SDL_FORCE_INLINE char *SDL_getenv_inline(const char *name) { return getenv(name); } +#define SDL_getenv SDL_getenv_inline +#endif + +extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); +#ifdef HAVE_SETENV +SDL_FORCE_INLINE int SDL_setenv_inline(const char *name, const char *value, int overwrite) { return setenv(name, value, overwrite); } +#define SDL_setenv SDL_setenv_inline +#endif + +extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); +#ifdef HAVE_QSORT +SDL_FORCE_INLINE void SDL_qsort_inline(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { return qsort(base, nmemb, size, compare); } +#define SDL_qsort SDL_qsort_inline +#endif + +extern DECLSPEC int SDLCALL SDL_abs(int x); +#ifdef HAVE_ABS +SDL_FORCE_INLINE int SDL_abs_inline(int x) { return abs(x); } +#else +SDL_FORCE_INLINE int SDL_abs_inline(int x) { return ((x) < 0 ? -(x) : (x)); } +#endif +#define SDL_abs SDL_abs_inline + +/* !!! FIXME: these have side effects. You probably shouldn't use them. */ +/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */ +#define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) +#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) + +extern DECLSPEC int SDLCALL SDL_isdigit(int x); +extern DECLSPEC int SDLCALL SDL_isspace(int x); +extern DECLSPEC int SDLCALL SDL_toupper(int x); +extern DECLSPEC int SDLCALL SDL_tolower(int x); +#ifdef HAVE_CTYPE_H +SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return isdigit(x); } +SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return isspace(x); } +SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return toupper(x); } +SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return tolower(x); } +#else +SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return ((x) >= '0') && ((x) <= '9'); } +SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n'); } +SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); } +SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); } +#endif +#define SDL_isdigit SDL_isdigit_inline +#define SDL_isspace SDL_isspace_inline +#define SDL_toupper SDL_toupper_inline +#define SDL_tolower SDL_tolower_inline + +extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); +#ifdef HAVE_MEMSET +SDL_FORCE_INLINE void *SDL_memset_inline(void *dst, int c, size_t len) { return memset(dst, c, len); } +#define SDL_memset SDL_memset_inline +#endif + +#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) +#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) + +/* !!! FIXME: does this _really_ beat memset() on any modern platform? */ +SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t len) +{ +#if defined(__GNUC__) && defined(i386) + int u0, u1, u2; + __asm__ __volatile__ ( + "cld \n\t" + "rep ; stosl \n\t" + : "=&D" (u0), "=&a" (u1), "=&c" (u2) + : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) + : "memory" + ); +/* !!! FIXME: amd64? */ +#else + size_t _n = (len + 3) / 4; + Uint32 *_p = SDL_static_cast(Uint32 *, dst); + Uint32 _val = (val); + if (len == 0) + return; + switch (len % 4) + { + case 0: do { *_p++ = _val; + case 3: *_p++ = _val; + case 2: *_p++ = _val; + case 1: *_p++ = _val; + } while ( --_n ); + } +#endif +} + + +extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); +#if defined(__MACOSX__) +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + /* We can count on memcpy existing on Mac OS X and being well-tuned. */ + return memcpy(dst, src, len); +} +#define SDL_memcpy SDL_memcpy_inline +#elif defined(__GNUC__) && defined(i386) && !defined(__WIN32__) +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + /* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */ + /* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */ + /* !!! FIXME: amd64? */ + int u0, u1, u2; + __asm__ __volatile__ ( + "cld \n\t" + "rep ; movsl \n\t" + "testb $2,%b4 \n\t" + "je 1f \n\t" + "movsw \n" + "1:\ttestb $1,%b4 \n\t" + "je 2f \n\t" + "movsb \n" + "2:" + : "=&c" (u0), "=&D" (u1), "=&S" (u2) + : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst), "2" (src) + : "memory" + ); + return dst; +} +#define SDL_memcpy SDL_memcpy_inline +#elif defined(HAVE_MEMCPY) +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + return memcpy(dst, src, len); +} +#define SDL_memcpy SDL_memcpy_inline +#elif defined(HAVE_BCOPY) /* !!! FIXME: is there _really_ ever a time where you have bcopy and not memcpy? */ +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + bcopy(src, dst, len); + return dst; +} +#define SDL_memcpy SDL_memcpy_inline +#endif + + +SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords) +{ +#if defined(__GNUC__) && defined(i386) + /* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */ + /* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */ + int ecx, edi, esi; + __asm__ __volatile__ ( + "cld \n\t" + "rep ; movsl \n\t" + : "=&c" (ecx), "=&D" (edi), "=&S" (esi) + : "0" (SDL_static_cast(unsigned, dwords)), "1" (dst), "2" (src) + : "memory" + ); + return dst; +#else + return SDL_memcpy(dst, src, dwords * 4); +#endif +} + +extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len); +#ifdef HAVE_MEMMOVE +SDL_FORCE_INLINE void *SDL_memmove_inline(void *dst, const void *src, size_t len) { return memmove(dst, src, len); } +#define SDL_memmove SDL_memmove_inline +#endif + +extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +#ifdef HAVE_MEMCMP +SDL_FORCE_INLINE int SDL_memcmp_inline(const void *s1, const void *s2, size_t len) { return memcmp(s1, s2, len); } +#define SDL_memcmp SDL_memcmp_inline +#endif + +extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); +#ifdef HAVE_STRLEN +SDL_FORCE_INLINE size_t SDL_strlen_inline(const char *str) { return strlen(str); } +#define SDL_strlen SDL_strlen_inline +#endif + +extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); +#ifdef HAVE_WCSLEN +SDL_FORCE_INLINE size_t SDL_wcslen_inline(const wchar_t *wstr) { return wcslen(wstr); } +#define SDL_wcslen SDL_wcslen_inline +#endif + +extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen); +#ifdef HAVE_WCSLCPY +SDL_FORCE_INLINE size_t SDL_wcslcpy_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcpy(dst, src, maxlen); } +#define SDL_wcslcpy SDL_wcslcpy_inline +#endif + +extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen); +#ifdef HAVE_WCSLCAT +SDL_FORCE_INLINE size_t SDL_wcslcat_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcat(dst, src, maxlen); } +#define SDL_wcslcat SDL_wcslcat_inline +#endif + +extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); +#ifdef HAVE_STRLCPY +SDL_FORCE_INLINE size_t SDL_strlcpy_inline(char *dst, const char *src, size_t maxlen) { return strlcpy(dst, src, maxlen); } +#define SDL_strlcpy SDL_strlcpy_inline +#else +#endif + +extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes); + +extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); +#ifdef HAVE_STRLCAT +SDL_FORCE_INLINE size_t SDL_strlcat_inline(char *dst, const char *src, size_t maxlen) { return strlcat(dst, src, maxlen); } +#define SDL_strlcat SDL_strlcat_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); +#ifdef HAVE_STRDUP +SDL_FORCE_INLINE char *SDL_strdup_inline(const char *str) { return strdup(str); } +#define SDL_strdup SDL_strdup_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_strrev(char *str); +#ifdef HAVE__STRREV +SDL_FORCE_INLINE char *SDL_strrev_inline(char *str) { return _strrev(str); } +#define SDL_strrev SDL_strrev_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_strupr(char *str); +#ifdef HAVE__STRUPR +SDL_FORCE_INLINE char *SDL_strupr_inline(char *str) { return _strupr(str); } +#define SDL_strupr SDL_strupr_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); +#ifdef HAVE__STRLWR +SDL_FORCE_INLINE char *SDL_strlwr_inline(char *str) { return _strlwr(str); } +#define SDL_strlwr SDL_strlwr_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); +#ifdef HAVE_STRCHR +SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return (char*)strchr(str, c); } +#define SDL_strchr SDL_strchr_inline +#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */ +SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); } +#define SDL_strchr SDL_strchr_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); +#ifdef HAVE_STRRCHR +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return (char*)strrchr(str, c); } +#define SDL_strrchr SDL_strrchr_inline +#elif defined(HAVE_RINDEX) /* !!! FIXME: is there anywhere that has this but not strrchr? */ +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return (char*)rindex(str, c); } +#define SDL_strrchr SDL_strrchr_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +#ifdef HAVE_STRSTR +SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) { return (char*)strstr(haystack, needle); } +#define SDL_strstr SDL_strstr_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix); +#ifdef HAVE__LTOA +SDL_FORCE_INLINE char *SDL_ltoa_inline(long value, char *str, int radix) { return _ltoa(value, str, radix); } +#define SDL_ltoa SDL_ltoa_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); +#ifdef HAVE_ITOA +SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return itoa(value, str, radix); } +#else +SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return SDL_ltoa((long)value, str, radix); } +#endif +#define SDL_itoa SDL_itoa_inline + +extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix); +#ifdef HAVE__ULTOA +SDL_FORCE_INLINE char *SDL_ultoa_inline(unsigned long value, char *str, int radix) { return _ultoa(value, str, radix); } +#define SDL_ultoa SDL_ultoa_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); +#ifdef HAVE__UITOA +SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return _uitoa(value, str, radix); } +#else +SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return SDL_ultoa((unsigned long)value, str, radix); } +#endif +#define SDL_uitoa SDL_uitoa_inline + + +extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base); +#ifdef HAVE_STRTOL +SDL_FORCE_INLINE long SDL_strtol_inline(const char *str, char **endp, int base) { return strtol(str, endp, base); } +#define SDL_strtol SDL_strtol_inline +#endif + +extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base); +#ifdef HAVE_STRTOUL +SDL_FORCE_INLINE unsigned long SDLCALL SDL_strtoul_inline(const char *str, char **endp, int base) { return strtoul(str, endp, base); } +#define SDL_strtoul SDL_strtoul_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix); +#ifdef HAVE__I64TOA +SDL_FORCE_INLINE char *SDL_lltoa_inline(Sint64 value, char *str, int radix) { return _i64toa(value, str, radix); } +#define SDL_lltoa SDL_lltoa_inline +#endif + +extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix); +#ifdef HAVE__UI64TOA +SDL_FORCE_INLINE char *SDL_ulltoa_inline(Uint64 value, char *str, int radix) { return _ui64toa(value, str, radix); } +#define SDL_ulltoa SDL_ulltoa_inline +#endif + +extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base); +#ifdef HAVE_STRTOLL +SDL_FORCE_INLINE Sint64 SDL_strtoll_inline(const char *str, char **endp, int base) { return strtoll(str, endp, base); } +#define SDL_strtoll SDL_strtoll_inline +#endif + +extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base); +#ifdef HAVE_STRTOULL +SDL_FORCE_INLINE Uint64 SDL_strtoull_inline(const char *str, char **endp, int base) { return strtoull(str, endp, base); } +#define SDL_strtoull SDL_strtoull_inline +#endif + +extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); +#ifdef HAVE_STRTOD +SDL_FORCE_INLINE double SDL_strtod_inline(const char *str, char **endp) { return strtod(str, endp); } +#define SDL_strtod SDL_strtod_inline +#endif + +extern DECLSPEC int SDLCALL SDL_atoi(const char *str); +#ifdef HAVE_ATOI +SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return atoi(str); } +#else +SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return SDL_strtol(str, NULL, 0); } +#endif +#define SDL_atoi SDL_atoi_inline + +extern DECLSPEC double SDLCALL SDL_atof(const char *str); +#ifdef HAVE_ATOF +SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return (double) atof(str); } +#else +SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return SDL_strtod(str, NULL); } +#endif +#define SDL_atof SDL_atof_inline + + +extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); +#ifdef HAVE_STRCMP +SDL_FORCE_INLINE int SDL_strcmp_inline(const char *str1, const char *str2) { return strcmp(str1, str2); } +#define SDL_strcmp SDL_strcmp_inline +#endif + +extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); +#ifdef HAVE_STRNCMP +SDL_FORCE_INLINE int SDL_strncmp_inline(const char *str1, const char *str2, size_t maxlen) { return strncmp(str1, str2, maxlen); } +#define SDL_strncmp SDL_strncmp_inline +#endif + +extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); +#ifdef HAVE_STRCASECMP +SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return strcasecmp(str1, str2); } +#define SDL_strcasecmp SDL_strcasecmp_inline +#elif defined(HAVE__STRICMP) +SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return _stricmp(str1, str2); } +#define SDL_strcasecmp SDL_strcasecmp_inline +#endif + +extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); +#ifdef HAVE_STRNCASECMP +SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return strncasecmp(str1, str2, len); } +#define SDL_strncasecmp SDL_strncasecmp_inline +#elif defined(HAVE__STRNICMP) +SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return _strnicmp(str1, str2, len); } +#define SDL_strncasecmp SDL_strncasecmp_inline +#endif + +/* Not doing SDL_*_inline functions for these, because of the varargs. */ +extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); +#ifdef HAVE_SSCANF +#define SDL_sscanf sscanf +#endif + +extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); +#ifdef HAVE_SNPRINTF +#define SDL_snprintf snprintf +#endif + +extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); +#ifdef HAVE_VSNPRINTF +SDL_FORCE_INLINE int SDL_vsnprintf_inline(char *text, size_t maxlen, const char *fmt, va_list ap) { return vsnprintf(text, maxlen, fmt, ap); } +#define SDL_vsnprintf SDL_vsnprintf_inline +#endif + +#ifndef HAVE_M_PI +#ifndef M_PI +#define M_PI 3.14159265358979323846264338327950288 /* pi */ +#endif +#endif + +extern DECLSPEC double SDLCALL SDL_atan(double x); +#ifdef HAVE_ATAN +SDL_FORCE_INLINE double SDL_atan_inline(double x) { return atan(x); } +#define SDL_atan SDL_atan_inline +#endif + +extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +#ifdef HAVE_ATAN2 +SDL_FORCE_INLINE double SDL_atan2_inline(double x, double y) { return atan2(x, y); } +#define SDL_atan2 SDL_atan2_inline +#endif + +extern DECLSPEC double SDLCALL SDL_ceil(double x); +#ifdef HAVE_CEIL +SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return ceil(x); } +#else +SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return (double)(int)((x)+0.5); } +#endif +#define SDL_ceil SDL_ceil_inline + +extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +#ifdef HAVE_COPYSIGN +SDL_FORCE_INLINE double SDL_copysign_inline(double x, double y) { return copysign(x, y); } +#define SDL_copysign SDL_copysign_inline +#endif + +extern DECLSPEC double SDLCALL SDL_cos(double x); +#ifdef HAVE_COS +SDL_FORCE_INLINE double SDL_cos_inline(double x) { return cos(x); } +#define SDL_cos SDL_cos_inline +#endif + +extern DECLSPEC float SDLCALL SDL_cosf(float x); +#ifdef HAVE_COSF +SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return cosf(x); } +#else +SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return (float)SDL_cos((double)x); } +#endif +#define SDL_cosf SDL_cosf_inline + +extern DECLSPEC double SDLCALL SDL_fabs(double x); +#ifdef HAVE_FABS +SDL_FORCE_INLINE double SDL_fabs_inline(double x) { return fabs(x); } +#define SDL_fabs SDL_fabs_inline +#endif + +extern DECLSPEC double SDLCALL SDL_floor(double x); +#ifdef HAVE_FLOOR +SDL_FORCE_INLINE double SDL_floor_inline(double x) { return floor(x); } +#define SDL_floor SDL_floor_inline +#endif + +extern DECLSPEC double SDLCALL SDL_log(double x); +#ifdef HAVE_LOG +SDL_FORCE_INLINE double SDL_log_inline(double x) { return log(x); } +#define SDL_log SDL_log_inline +#endif + +extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +#ifdef HAVE_POW +SDL_FORCE_INLINE double SDL_pow_inline(double x, double y) { return pow(x, y); } +#define SDL_pow SDL_pow_inline +#endif + +extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +#ifdef HAVE_SCALBN +SDL_FORCE_INLINE double SDL_scalbn_inline(double x, int n) { return scalbn(x, n); } +#define SDL_scalbn SDL_scalbn_inline +#endif + +extern DECLSPEC double SDLCALL SDL_sin(double x); +#ifdef HAVE_SIN +SDL_FORCE_INLINE double SDL_sin_inline(double x) { return sin(x); } +#define SDL_sin SDL_sin_inline +#endif + +extern DECLSPEC float SDLCALL SDL_sinf(float x); +#ifdef HAVE_SINF +SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return sinf(x); } +#else +SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return (float)SDL_sin((double)x); } +#endif +#define SDL_sinf SDL_sinf_inline + +extern DECLSPEC double SDLCALL SDL_sqrt(double x); +#ifdef HAVE_SQRT +SDL_FORCE_INLINE double SDL_sqrt_inline(double x) { return sqrt(x); } +#define SDL_sqrt SDL_sqrt_inline +#endif + +/* The SDL implementation of iconv() returns these error codes */ +#define SDL_ICONV_ERROR (size_t)-1 +#define SDL_ICONV_E2BIG (size_t)-2 +#define SDL_ICONV_EILSEQ (size_t)-3 +#define SDL_ICONV_EINVAL (size_t)-4 + +/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */ +typedef struct _SDL_iconv_t *SDL_iconv_t; +extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, + const char *fromcode); +extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); +extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, + size_t * inbytesleft, char **outbuf, + size_t * outbytesleft); +/** + * This function converts a string between encodings in one pass, returning a + * string that must be freed with SDL_free() or NULL on error. + */ +extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, + const char *fromcode, + const char *inbuf, + size_t inbytesleft); +#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_stdinc_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_surface.h b/external/SDL2/SDL_surface.h new file mode 100644 index 0000000..400ae37 --- /dev/null +++ b/external/SDL2/SDL_surface.h @@ -0,0 +1,502 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_surface.h + * + * Header file for ::SDL_surface definition and management functions. + */ + +#ifndef _SDL_surface_h +#define _SDL_surface_h + +#include "SDL_stdinc.h" +#include "SDL_pixels.h" +#include "SDL_rect.h" +#include "SDL_blendmode.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \name Surface flags + * + * These are the currently supported flags for the ::SDL_surface. + * + * \internal + * Used internally (read-only). + */ +/*@{*/ +#define SDL_SWSURFACE 0 /**< Just here for compatibility */ +#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ +#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ +#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ +/*@}*//*Surface flags*/ + +/** + * Evaluates to true if the surface needs to be locked before access. + */ +#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) + +/** + * \brief A collection of pixels used in software blitting. + * + * \note This structure should be treated as read-only, except for \c pixels, + * which, if not NULL, contains the raw pixel data for the surface. + */ +typedef struct SDL_Surface +{ + Uint32 flags; /**< Read-only */ + SDL_PixelFormat *format; /**< Read-only */ + int w, h; /**< Read-only */ + int pitch; /**< Read-only */ + void *pixels; /**< Read-write */ + + /** Application data associated with the surface */ + void *userdata; /**< Read-write */ + + /** information needed for surfaces requiring locks */ + int locked; /**< Read-only */ + void *lock_data; /**< Read-only */ + + /** clipping information */ + SDL_Rect clip_rect; /**< Read-only */ + + /** info for fast blit mapping to other surfaces */ + struct SDL_BlitMap *map; /**< Private */ + + /** Reference count -- used when freeing surface */ + int refcount; /**< Read-mostly */ +} SDL_Surface; + +/** + * \brief The type of function used for surface blitting functions. + */ +typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, + struct SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * Allocate and free an RGB surface. + * + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + * If the depth is greater than 8 bits, the pixel format is set using the + * flags '[RGB]mask'. + * + * If the function runs out of memory, it will return NULL. + * + * \param flags The \c flags are obsolete and should be set to 0. + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface + (Uint32 flags, int width, int height, int depth, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, + int width, + int height, + int depth, + int pitch, + Uint32 Rmask, + Uint32 Gmask, + Uint32 Bmask, + Uint32 Amask); +extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); + +/** + * \brief Set the palette used by a surface. + * + * \return 0, or -1 if the surface format doesn't use a palette. + * + * \note A single palette can be shared with many surfaces. + */ +extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, + SDL_Palette * palette); + +/** + * \brief Sets up a surface for directly accessing the pixels. + * + * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write + * to and read from \c surface->pixels, using the pixel format stored in + * \c surface->format. Once you are done accessing the surface, you should + * use SDL_UnlockSurface() to release it. + * + * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + * to 0, then you can read and write to the surface at any time, and the + * pixel format of the surface will not change. + * + * No operating system or library calls should be made between lock/unlock + * pairs, as critical system locks may be held during this time. + * + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. + * + * \sa SDL_UnlockSurface() + */ +extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface); +/** \sa SDL_LockSurface() */ +extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface); + +/** + * Load a surface from a seekable SDL data stream (memory or file). + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The new surface should be freed with SDL_FreeSurface(). + * + * \return the new surface, or NULL if there was an error. + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, + int freesrc); + +/** + * Load a surface from a file. + * + * Convenience macro. + */ +#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) + +/** + * Save a surface to a seekable SDL data stream (memory or file). + * + * If \c freedst is non-zero, the stream will be closed after being written. + * + * \return 0 if successful or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_SaveBMP_RW + (SDL_Surface * surface, SDL_RWops * dst, int freedst); + +/** + * Save a surface to a file. + * + * Convenience macro. + */ +#define SDL_SaveBMP(surface, file) \ + SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) + +/** + * \brief Sets the RLE acceleration hint for a surface. + * + * \return 0 on success, or -1 if the surface is not valid + * + * \note If RLE is enabled, colorkey and alpha blending blits are much faster, + * but the surface must be locked before directly accessing the pixels. + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, + int flag); + +/** + * \brief Sets the color key (transparent pixel) in a blittable surface. + * + * \param surface The surface to update + * \param flag Non-zero to enable colorkey and 0 to disable colorkey + * \param key The transparent pixel in the native surface format + * + * \return 0 on success, or -1 if the surface is not valid + * + * You can pass SDL_RLEACCEL to enable RLE accelerated blits. + */ +extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, + int flag, Uint32 key); + +/** + * \brief Gets the color key (transparent pixel) in a blittable surface. + * + * \param surface The surface to update + * \param key A pointer filled in with the transparent pixel in the native + * surface format + * + * \return 0 on success, or -1 if the surface is not valid or colorkey is not + * enabled. + */ +extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface, + Uint32 * key); + +/** + * \brief Set an additional color value used in blit operations. + * + * \param surface The surface to update. + * \param r The red color value multiplied into blit operations. + * \param g The green color value multiplied into blit operations. + * \param b The blue color value multiplied into blit operations. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_GetSurfaceColorMod() + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface, + Uint8 r, Uint8 g, Uint8 b); + + +/** + * \brief Get the additional color value used in blit operations. + * + * \param surface The surface to query. + * \param r A pointer filled in with the current red color value. + * \param g A pointer filled in with the current green color value. + * \param b A pointer filled in with the current blue color value. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_SetSurfaceColorMod() + */ +extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface, + Uint8 * r, Uint8 * g, + Uint8 * b); + +/** + * \brief Set an additional alpha value used in blit operations. + * + * \param surface The surface to update. + * \param alpha The alpha value multiplied into blit operations. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_GetSurfaceAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface, + Uint8 alpha); + +/** + * \brief Get the additional alpha value used in blit operations. + * + * \param surface The surface to query. + * \param alpha A pointer filled in with the current alpha value. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_SetSurfaceAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface, + Uint8 * alpha); + +/** + * \brief Set the blend mode used for blit operations. + * + * \param surface The surface to update. + * \param blendMode ::SDL_BlendMode to use for blit blending. + * + * \return 0 on success, or -1 if the parameters are not valid. + * + * \sa SDL_GetSurfaceBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, + SDL_BlendMode blendMode); + +/** + * \brief Get the blend mode used for blit operations. + * + * \param surface The surface to query. + * \param blendMode A pointer filled in with the current blend mode. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_SetSurfaceBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, + SDL_BlendMode *blendMode); + +/** + * Sets the clipping rectangle for the destination surface in a blit. + * + * If the clip rectangle is NULL, clipping will be disabled. + * + * If the clip rectangle doesn't intersect the surface, the function will + * return SDL_FALSE and blits will be completely clipped. Otherwise the + * function returns SDL_TRUE and blits to the surface will be clipped to + * the intersection of the surface area and the clipping rectangle. + * + * Note that blits are automatically clipped to the edges of the source + * and destination surfaces. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, + const SDL_Rect * rect); + +/** + * Gets the clipping rectangle for the destination surface in a blit. + * + * \c rect must be a pointer to a valid rectangle which will be filled + * with the correct values. + */ +extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, + SDL_Rect * rect); + +/** + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as + * fast as possible. If this function fails, it returns NULL. + * + * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those + * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting + * surface. + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface + (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags); +extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat + (SDL_Surface * src, Uint32 pixel_format, Uint32 flags); + +/** + * \brief Copy a block of pixels of one format to another format + * + * \return 0 on success, or -1 if there was an error + */ +extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, + Uint32 src_format, + const void * src, int src_pitch, + Uint32 dst_format, + void * dst, int dst_pitch); + +/** + * Performs a fast fill of the given rectangle with \c color. + * + * If \c rect is NULL, the whole surface will be filled with \c color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_FillRect + (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color); +extern DECLSPEC int SDLCALL SDL_FillRects + (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color); + +/** + * Performs a fast blit from the source surface to the destination surface. + * + * This assumes that the source and destination rectangles are + * the same size. If either \c srcrect or \c dstrect are NULL, the entire + * surface (\c src or \c dst) is copied. The final blit rectangles are saved + * in \c srcrect and \c dstrect after all clipping is performed. + * + * \return If the blit is successful, it returns 0, otherwise it returns -1. + * + * The blit function should not be called on a locked surface. + * + * The blit semantics for surfaces with and without alpha and colorkey + * are defined as follows: + * \verbatim + RGBA->RGB: + SDL_SRCALPHA set: + alpha-blend (using alpha-channel). + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value); + set destination alpha to opaque. + SDL_SRCALPHA not set: + copy RGB, set destination alpha to source per-surface alpha value. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + RGBA->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source alpha channel) the RGB values; + leave destination alpha untouched. [Note: is this correct?] + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGB: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value). + SDL_SRCALPHA not set: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + \endverbatim + * + * You should call SDL_BlitSurface() unless you know exactly how SDL + * blitting works internally and how to use the other blit functions. + */ +#define SDL_BlitSurface SDL_UpperBlit + +/** + * This is the public blit function, SDL_BlitSurface(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlit() + */ +extern DECLSPEC int SDLCALL SDL_UpperBlit + (SDL_Surface * src, const SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * This is a semi-private blit function and it performs low-level surface + * blitting only. + */ +extern DECLSPEC int SDLCALL SDL_LowerBlit + (SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief Perform a fast, low quality, stretch blit between two surfaces of the + * same pixel format. + * + * \note This function uses a static buffer, and is not thread-safe. + */ +extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, + const SDL_Rect * srcrect, + SDL_Surface * dst, + const SDL_Rect * dstrect); + +#define SDL_BlitScaled SDL_UpperBlitScaled + +/** + * This is the public scaled blit function, SDL_BlitScaled(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() + */ +extern DECLSPEC int SDLCALL SDL_UpperBlitScaled + (SDL_Surface * src, const SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * This is a semi-private blit function and it performs low-level surface + * scaled blitting only. + */ +extern DECLSPEC int SDLCALL SDL_LowerBlitScaled + (SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_surface_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_system.h b/external/SDL2/SDL_system.h new file mode 100644 index 0000000..96c8faa --- /dev/null +++ b/external/SDL2/SDL_system.h @@ -0,0 +1,106 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_system.h + * + * Include file for platform specific SDL API functions + */ + +#ifndef _SDL_system_h +#define _SDL_system_h + +#include "SDL_stdinc.h" + +#if defined(__IPHONEOS__) && __IPHONEOS__ +#include "SDL_video.h" +#include "SDL_keyboard.h" +#endif + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* Platform specific functions for iOS */ +#if defined(__IPHONEOS__) && __IPHONEOS__ + +extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); +extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); + +#endif /* __IPHONEOS__ */ + + +/* Platform specific functions for Android */ +#if defined(__ANDROID__) && __ANDROID__ + +/* Get the JNI environment for the current thread + This returns JNIEnv*, but the prototype is void* so we don't need jni.h + */ +extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); + +/* Get the SDL Activity object for the application + This returns jobject, but the prototype is void* so we don't need jni.h + */ +extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); + +/* See the official Android developer guide for more information: + http://developer.android.com/guide/topics/data/data-storage.html +*/ +#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 +#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 + +/* Get the path used for internal storage for this application. + This path is unique to your application and cannot be written to + by other applications. + */ +extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); + +/* Get the current state of external storage, a bitmask of these values: + SDL_ANDROID_EXTERNAL_STORAGE_READ + SDL_ANDROID_EXTERNAL_STORAGE_WRITE + If external storage is currently unavailable, this will return 0. +*/ +extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); + +/* Get the path used for external storage for this application. + This path is unique to your application, but is public and can be + written to by other applications. + */ +extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); + +#endif /* __ANDROID__ */ + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_system_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_syswm.h b/external/SDL2/SDL_syswm.h new file mode 100644 index 0000000..6571313 --- /dev/null +++ b/external/SDL2/SDL_syswm.h @@ -0,0 +1,241 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_syswm.h + * + * Include file for SDL custom system window manager hooks. + */ + +#ifndef _SDL_syswm_h +#define _SDL_syswm_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \file SDL_syswm.h + * + * Your application has access to a special type of event ::SDL_SYSWMEVENT, + * which contains window-manager specific information and arrives whenever + * an unhandled window event occurs. This event is ignored by default, but + * you can enable it with SDL_EventState(). + */ +#ifdef SDL_PROTOTYPES_ONLY +struct SDL_SysWMinfo; +#else + +#if defined(SDL_VIDEO_DRIVER_WINDOWS) +#define WIN32_LEAN_AND_MEAN +#include +#endif + +/* This is the structure for custom window manager events */ +#if defined(SDL_VIDEO_DRIVER_X11) +#if defined(__APPLE__) && defined(__MACH__) +/* conflicts with Quickdraw.h */ +#define Cursor X11Cursor +#endif + +#include +#include + +#if defined(__APPLE__) && defined(__MACH__) +/* matches the re-define above */ +#undef Cursor +#endif + +#endif /* defined(SDL_VIDEO_DRIVER_X11) */ + +#if defined(SDL_VIDEO_DRIVER_DIRECTFB) +#include +#endif + +#if defined(SDL_VIDEO_DRIVER_COCOA) +#ifdef __OBJC__ +#include +#else +typedef struct _NSWindow NSWindow; +#endif +#endif + +#if defined(SDL_VIDEO_DRIVER_UIKIT) +#ifdef __OBJC__ +#include +#else +typedef struct _UIWindow UIWindow; +#endif +#endif + +/** + * These are the various supported windowing subsystems + */ +typedef enum +{ + SDL_SYSWM_UNKNOWN, + SDL_SYSWM_WINDOWS, + SDL_SYSWM_X11, + SDL_SYSWM_DIRECTFB, + SDL_SYSWM_COCOA, + SDL_SYSWM_UIKIT, +} SDL_SYSWM_TYPE; + +/** + * The custom event structure. + */ +struct SDL_SysWMmsg +{ + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union + { +#if defined(SDL_VIDEO_DRIVER_WINDOWS) + struct { + HWND hwnd; /**< The window for the message */ + UINT msg; /**< The type of message */ + WPARAM wParam; /**< WORD message parameter */ + LPARAM lParam; /**< LONG message parameter */ + } win; +#endif +#if defined(SDL_VIDEO_DRIVER_X11) + struct { + XEvent event; + } x11; +#endif +#if defined(SDL_VIDEO_DRIVER_DIRECTFB) + struct { + DFBEvent event; + } dfb; +#endif +#if defined(SDL_VIDEO_DRIVER_COCOA) + struct + { + /* No Cocoa window events yet */ + } cocoa; +#endif +#if defined(SDL_VIDEO_DRIVER_UIKIT) + struct + { + /* No UIKit window events yet */ + } uikit; +#endif + /* Can't have an empty union */ + int dummy; + } msg; +}; + +/** + * The custom window manager information structure. + * + * When this structure is returned, it holds information about which + * low level system it is using, and will be one of SDL_SYSWM_TYPE. + */ +struct SDL_SysWMinfo +{ + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union + { +#if defined(SDL_VIDEO_DRIVER_WINDOWS) + struct + { + HWND window; /**< The window handle */ + } win; +#endif +#if defined(SDL_VIDEO_DRIVER_X11) + struct + { + Display *display; /**< The X11 display */ + Window window; /**< The X11 window */ + } x11; +#endif +#if defined(SDL_VIDEO_DRIVER_DIRECTFB) + struct + { + IDirectFB *dfb; /**< The directfb main interface */ + IDirectFBWindow *window; /**< The directfb window handle */ + IDirectFBSurface *surface; /**< The directfb client surface */ + } dfb; +#endif +#if defined(SDL_VIDEO_DRIVER_COCOA) + struct + { + NSWindow *window; /* The Cocoa window */ + } cocoa; +#endif +#if defined(SDL_VIDEO_DRIVER_UIKIT) + struct + { + UIWindow *window; /* The UIKit window */ + } uikit; +#endif + /* Can't have an empty union */ + int dummy; + } info; +}; + +#endif /* SDL_PROTOTYPES_ONLY */ + +typedef struct SDL_SysWMinfo SDL_SysWMinfo; + +/* Function prototypes */ +/** + * \brief This function allows access to driver-dependent window information. + * + * \param window The window about which information is being requested + * \param info This structure must be initialized with the SDL version, and is + * then filled in with information about the given window. + * + * \return SDL_TRUE if the function is implemented and the version member of + * the \c info struct is valid, SDL_FALSE otherwise. + * + * You typically use this function like this: + * \code + * SDL_SysWMinfo info; + * SDL_VERSION(&info.version); + * if ( SDL_GetWindowWMInfo(&info) ) { ... } + * \endcode + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, + SDL_SysWMinfo * info); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_syswm_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test.h b/external/SDL2/SDL_test.h new file mode 100644 index 0000000..aeec011 --- /dev/null +++ b/external/SDL2/SDL_test.h @@ -0,0 +1,72 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef _SDL_test_h +#define _SDL_test_h + +#include "SDL.h" +#include "SDL_test_common.h" +#include "SDL_test_font.h" +#include "SDL_test_random.h" +#include "SDL_test_fuzzer.h" +#include "SDL_test_crc32.h" +#include "SDL_test_md5.h" +#include "SDL_test_log.h" +#include "SDL_test_assert.h" +#include "SDL_test_harness.h" +#include "SDL_test_images.h" +#include "SDL_test_compare.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* Global definitions */ + +/* + * Note: Maximum size of SDLTest log message is less than SDLs limit + * to ensure we can fit additional information such as the timestamp. + */ +#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_assert.h b/external/SDL2/SDL_test_assert.h new file mode 100644 index 0000000..37f6657 --- /dev/null +++ b/external/SDL2/SDL_test_assert.h @@ -0,0 +1,109 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_assert.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + * + * Assert API for test code and test cases + * + */ + +#ifndef _SDL_test_assert_h +#define _SDL_test_assert_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Fails the assert. + */ +#define ASSERT_FAIL 0 + +/** + * \brief Passes the assert. + */ +#define ASSERT_PASS 1 + +/** + * \brief Assert that logs and break execution flow on failures. + * + * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). + * \param assertDescription Message to log with the assert describing it. + */ +void SDLTest_Assert(int assertCondition, const char *assertDescription, ...); + +/** + * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. + * + * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). + * \param assertDescription Message to log with the assert describing it. + * + * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. + */ +int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...); + +/** + * \brief Explicitely pass without checking an assertion condition. Updates assertion counter. + * + * \param assertDescription Message to log with the assert describing it. + */ +void SDLTest_AssertPass(const char *assertDescription, ...); + +/** + * \brief Resets the assert summary counters to zero. + */ +void SDLTest_ResetAssertSummary(); + +/** + * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. + */ +void SDLTest_LogAssertSummary(); + + +/** + * \brief Converts the current assert summary state to a test result. + * + * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT + */ +int SDLTest_AssertSummaryToTestResult(); + +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_assert_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_common.h b/external/SDL2/SDL_test_common.h new file mode 100644 index 0000000..0c9625b --- /dev/null +++ b/external/SDL2/SDL_test_common.h @@ -0,0 +1,186 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_common.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* Ported from original test\common.h file. */ + +#ifndef _SDL_test_common_h +#define _SDL_test_common_h + +#include "SDL.h" + +#if defined(__PSP__) +#define DEFAULT_WINDOW_WIDTH 480 +#define DEFAULT_WINDOW_HEIGHT 272 +#else +#define DEFAULT_WINDOW_WIDTH 640 +#define DEFAULT_WINDOW_HEIGHT 480 +#endif + +#define VERBOSE_VIDEO 0x00000001 +#define VERBOSE_MODES 0x00000002 +#define VERBOSE_RENDER 0x00000004 +#define VERBOSE_EVENT 0x00000008 +#define VERBOSE_AUDIO 0x00000010 + +typedef struct +{ + /* SDL init flags */ + char **argv; + Uint32 flags; + Uint32 verbose; + + /* Video info */ + const char *videodriver; + int display; + const char *window_title; + const char *window_icon; + Uint32 window_flags; + int window_x; + int window_y; + int window_w; + int window_h; + int window_minW; + int window_minH; + int window_maxW; + int window_maxH; + int depth; + int refresh_rate; + int num_windows; + SDL_Window **windows; + + /* Renderer info */ + const char *renderdriver; + Uint32 render_flags; + SDL_bool skip_renderer; + SDL_Renderer **renderers; + + /* Audio info */ + const char *audiodriver; + SDL_AudioSpec audiospec; + + /* GL settings */ + int gl_red_size; + int gl_green_size; + int gl_blue_size; + int gl_alpha_size; + int gl_buffer_size; + int gl_depth_size; + int gl_stencil_size; + int gl_double_buffer; + int gl_accum_red_size; + int gl_accum_green_size; + int gl_accum_blue_size; + int gl_accum_alpha_size; + int gl_stereo; + int gl_multisamplebuffers; + int gl_multisamplesamples; + int gl_retained_backing; + int gl_accelerated; + int gl_major_version; + int gl_minor_version; +} SDLTest_CommonState; + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* Function prototypes */ + +/** + * \brief Parse command line parameters and create common state. + * + * \param argv Array of command line parameters + * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO) + * + * \returns Returns a newly allocated common state object. + */ +SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); + +/** + * \brief Process one common argument. + * + * \param state The common state describing the test window to create. + * \param index The index of the argument to process in argv[]. + * + * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error. + */ +int SDLTest_CommonArg(SDLTest_CommonState * state, int index); + +/** + * \brief Returns common usage information + * + * \param state The common state describing the test window to create. + * + * \returns String with usage information + */ +const char *SDLTest_CommonUsage(SDLTest_CommonState * state); + +/** + * \brief Open test window. + * + * \param state The common state describing the test window to create. + * + * \returns True if initialization succeeded, false otherwise + */ +SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); + +/** + * \brief Common event handler for test windows. + * + * \param state The common state used to create test window. + * \param event The event to handle. + * \param done Flag indicating we are done. + * + */ +void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done); + +/** + * \brief Close test window. + * + * \param state The common state used to create test window. + * + */ +void SDLTest_CommonQuit(SDLTest_CommonState * state); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_common_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_compare.h b/external/SDL2/SDL_test_compare.h new file mode 100644 index 0000000..1ebf283 --- /dev/null +++ b/external/SDL2/SDL_test_compare.h @@ -0,0 +1,73 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_compare.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Defines comparison functions (i.e. for surfaces). + +*/ + +#ifndef _SDL_test_compare_h +#define _SDL_test_compare_h + +#include "SDL.h" + +#include "SDL_test_images.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Compares a surface and with reference image data for equality + * + * \param surface Surface used in comparison + * \param referenceSurface Test Surface used in comparison + * \param allowable_error Allowable difference (squared) in blending accuracy. + * + * \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. + */ +int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_compare_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_crc32.h b/external/SDL2/SDL_test_crc32.h new file mode 100644 index 0000000..fc712fe --- /dev/null +++ b/external/SDL2/SDL_test_crc32.h @@ -0,0 +1,128 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_crc32.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Implements CRC32 calculations (default output is Perl String::CRC32 compatible). + +*/ + +#ifndef _SDL_test_crc32_h +#define _SDL_test_crc32_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +/* ------------ Definitions --------- */ + +/* Definition shared by all CRC routines */ + +#ifndef CrcUint32 + #define CrcUint32 unsigned int +#endif +#ifndef CrcUint8 + #define CrcUint8 unsigned char +#endif + +#ifdef ORIGINAL_METHOD + #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ +#else + #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ +#endif + +/** + * Data structure for CRC32 (checksum) computation + */ + typedef struct { + CrcUint32 crc32_table[256]; /* CRC table */ + } SDLTest_Crc32Context; + +/* ---------- Function Prototypes ------------- */ + +/** + * /brief Initialize the CRC context + * + * Note: The function initializes the crc table required for all crc calculations. + * + * /param crcContext pointer to context variable + * + * /returns 0 for OK, -1 on error + * + */ + int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); + + +/** + * /brief calculate a crc32 from a data block + * + * /param crcContext pointer to context variable + * /param inBuf input buffer to checksum + * /param inLen length of input buffer + * /param crc32 pointer to Uint32 to store the final CRC into + * + * /returns 0 for OK, -1 on error + * + */ +int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); + +/* Same routine broken down into three steps */ +int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); +int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); +int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); + + +/** + * /brief clean up CRC context + * + * /param crcContext pointer to context variable + * + * /returns 0 for OK, -1 on error + * +*/ + +int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_crc32_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_font.h b/external/SDL2/SDL_test_font.h new file mode 100644 index 0000000..8e126e8 --- /dev/null +++ b/external/SDL2/SDL_test_font.h @@ -0,0 +1,66 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_font.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef _SDL_test_font_h +#define _SDL_test_font_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* Function prototypes */ + +/** + * \brief Draw a string in the currently set font. + * + * \param renderer The renderer to draw on. + * \param x The X coordinate of the upper left corner of the string. + * \param y The Y coordinate of the upper left corner of the string. + * \param s The string to draw. + * + * \returns Returns 0 on success, -1 on failure. + */ +int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_font_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_fuzzer.h b/external/SDL2/SDL_test_fuzzer.h new file mode 100644 index 0000000..ede3379 --- /dev/null +++ b/external/SDL2/SDL_test_fuzzer.h @@ -0,0 +1,388 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_fuzzer.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Data generators for fuzzing test data in a reproducible way. + +*/ + +#ifndef _SDL_test_fuzzer_h +#define _SDL_test_fuzzer_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +/* + Based on GSOC code by Markus Kauppila +*/ + + +/** + * \file + * Note: The fuzzer implementation uses a static instance of random context + * internally which makes it thread-UNsafe. + */ + +/** + * Initializes the fuzzer for a test + * + * /param execKey Execution "Key" that initializes the random number generator uniquely for the test. + * + */ +void SDLTest_FuzzerInit(Uint64 execKey); + + +/** + * Returns a random Uint8 + * + * \returns Generated integer + */ +Uint8 SDLTest_RandomUint8(); + +/** + * Returns a random Sint8 + * + * \returns Generated signed integer + */ +Sint8 SDLTest_RandomSint8(); + + +/** + * Returns a random Uint16 + * + * \returns Generated integer + */ +Uint16 SDLTest_RandomUint16(); + +/** + * Returns a random Sint16 + * + * \returns Generated signed integer + */ +Sint16 SDLTest_RandomSint16(); + + +/** + * Returns a random integer + * + * \returns Generated integer + */ +Sint32 SDLTest_RandomSint32(); + + +/** + * Returns a random positive integer + * + * \returns Generated integer + */ +Uint32 SDLTest_RandomUint32(); + +/** + * Returns random Uint64. + * + * \returns Generated integer + */ +Uint64 SDLTest_RandomUint64(); + + +/** + * Returns random Sint64. + * + * \returns Generated signed integer + */ +Sint64 SDLTest_RandomSint64(); + +/** + * \returns random float in range [0.0 - 1.0[ + */ +float SDLTest_RandomUnitFloat(); + +/** + * \returns random double in range [0.0 - 1.0[ + */ +double SDLTest_RandomUnitDouble(); + +/** + * \returns random float. + * + */ +float SDLTest_RandomFloat(); + +/** + * \returns random double. + * + */ +double SDLTest_RandomDouble(); + +/** + * Returns a random boundary value for Uint8 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Uint16 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Uint32 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Uint64 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Sint8 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100 + * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT8_MIN with error set + */ +Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain); + + +/** + * Returns a random boundary value for Sint16 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100 + * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT16_MIN with error set + */ +Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Sint32 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100 + * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT32_MIN with error set + */ +Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Sint64 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100 + * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT64_MIN with error set + */ +Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain); + + +/** + * Returns integer in range [min, max] (inclusive). + * Min and max values can be negative values. + * If Max in smaller tham min, then the values are swapped. + * Min and max are the same value, that value will be returned. + * + * \param min Minimum inclusive value of returned random number + * \param max Maximum inclusive value of returned random number + * + * \returns Generated random integer in range + */ +Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); + + +/** + * Generates random null-terminated string. The minimum length for + * the string is 1 character, maximum length for the string is 255 + * characters and it can contain ASCII characters from 32 to 126. + * + * Note: Returned string needs to be deallocated. + * + * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. + */ +char * SDLTest_RandomAsciiString(); + + +/** + * Generates random null-terminated string. The maximum length for + * the string is defined by the maxLength parameter. + * String can contain ASCII characters from 32 to 126. + * + * Note: Returned string needs to be deallocated. + * + * \param maxLength The maximum length of the generated string. + * + * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated. + */ +char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); + + +/** + * Generates random null-terminated string. The length for + * the string is defined by the size parameter. + * String can contain ASCII characters from 32 to 126. + * + * Note: Returned string needs to be deallocated. + * + * \param size The length of the generated string + * + * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated. + */ +char * SDLTest_RandomAsciiStringOfSize(int size); + +/** + * Returns the invocation count for the fuzzer since last ...FuzzerInit. + */ +int SDLTest_GetFuzzerInvocationCount(); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_fuzzer_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_harness.h b/external/SDL2/SDL_test_harness.h new file mode 100644 index 0000000..d00289c --- /dev/null +++ b/external/SDL2/SDL_test_harness.h @@ -0,0 +1,126 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_harness.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + Defines types for test case definitions and the test execution harness API. + + Based on original GSOC code by Markus Kauppila +*/ + +#ifndef _SDL_test_harness_h +#define _SDL_test_harness_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +//! Definitions for test case structures +#define TEST_ENABLED 1 +#define TEST_DISABLED 0 + +//! Definition of all the possible test return values of the test case method +#define TEST_ABORTED -1 +#define TEST_COMPLETED 0 +#define TEST_SKIPPED 1 + +//! Definition of all the possible test results for the harness +#define TEST_RESULT_PASSED 0 +#define TEST_RESULT_FAILED 1 +#define TEST_RESULT_NO_ASSERT 2 +#define TEST_RESULT_SKIPPED 3 +#define TEST_RESULT_SETUP_FAILURE 4 + +//!< Function pointer to a test case setup function (run before every test) +typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); + +//!< Function pointer to a test case function +typedef void (*SDLTest_TestCaseFp)(void *arg); + +//!< Function pointer to a test case teardown function (run after every test) +typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); + +/** + * Holds information about a single test case. + */ +typedef struct SDLTest_TestCaseReference { + /*!< Func2Stress */ + SDLTest_TestCaseFp testCase; + /*!< Short name (or function name) "Func2Stress" */ + char *name; + /*!< Long name or full description "This test pushes func2() to the limit." */ + char *description; + /*!< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ + int enabled; +} SDLTest_TestCaseReference; + +/** + * Holds information about a test suite (multiple test cases). + */ +typedef struct SDLTest_TestSuiteReference { + /*!< "PlatformSuite" */ + char *name; + /*!< The function that is run before each test. NULL skips. */ + SDLTest_TestCaseSetUpFp testSetUp; + /*!< The test cases that are run as part of the suite. Last item should be NULL. */ + const SDLTest_TestCaseReference **testCases; + /*!< The function that is run after each test. NULL skips. */ + SDLTest_TestCaseTearDownFp testTearDown; +} SDLTest_TestSuiteReference; + + +/** + * \brief Execute a test suite using the given run seed and execution key. + * + * \param testSuites Suites containing the test case. + * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. + * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. + * \param filter Filter specification. NULL disables. Case sensitive. + * \param testIterations Number of iterations to run each test case. + * + * \returns Test run result; 0 when all tests passed, 1 if any tests failed. + */ +int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_harness_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_images.h b/external/SDL2/SDL_test_images.h new file mode 100644 index 0000000..39061d5 --- /dev/null +++ b/external/SDL2/SDL_test_images.h @@ -0,0 +1,82 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_images.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Defines some images for tests. + +*/ + +#ifndef _SDL_test_images_h +#define _SDL_test_images_h + +#include "SDL.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + *Type for test images. + */ +typedef struct SDLTest_SurfaceImage_s { + int width; + int height; + unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ + const char *pixel_data; +} SDLTest_SurfaceImage_t; + +/* Test images */ +SDL_Surface *SDLTest_ImageBlit(); +SDL_Surface *SDLTest_ImageBlitColor(); +SDL_Surface *SDLTest_ImageBlitAlpha(); +SDL_Surface *SDLTest_ImageBlitBlendAdd(); +SDL_Surface *SDLTest_ImageBlitBlend(); +SDL_Surface *SDLTest_ImageBlitBlendMod(); +SDL_Surface *SDLTest_ImageBlitBlendNone(); +SDL_Surface *SDLTest_ImageBlitBlendAll(); +SDL_Surface *SDLTest_ImageFace(); +SDL_Surface *SDLTest_ImagePrimitives(); +SDL_Surface *SDLTest_ImagePrimitivesBlend(); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_images_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_log.h b/external/SDL2/SDL_test_log.h new file mode 100644 index 0000000..10dbf51 --- /dev/null +++ b/external/SDL2/SDL_test_log.h @@ -0,0 +1,71 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_log.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + * + * Wrapper to log in the TEST category + * + */ + +#ifndef _SDL_test_log_h +#define _SDL_test_log_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Prints given message with a timestamp in the TEST category and INFO priority. + * + * \param fmt Message to be logged + */ +void SDLTest_Log(const char *fmt, ...); + +/** + * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. + * + * \param fmt Message to be logged + */ +void SDLTest_LogError(const char *fmt, ...); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_log_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_md5.h b/external/SDL2/SDL_test_md5.h new file mode 100644 index 0000000..8101920 --- /dev/null +++ b/external/SDL2/SDL_test_md5.h @@ -0,0 +1,133 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_md5.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + *********************************************************************** + ** Header file for implementation of MD5 ** + ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** + ** Created: 2/17/90 RLR ** + ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** + ** Revised (for MD5): RLR 4/27/91 ** + ** -- G modified to have y&~z instead of y&z ** + ** -- FF, GG, HH modified to add in last register done ** + ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** + ** -- distinct additive constant for each step ** + ** -- round 4 added, working mod 7 ** + *********************************************************************** +*/ + +/* + *********************************************************************** + ** Message-digest routines: ** + ** To form the message digest for a message M ** + ** (1) Initialize a context buffer mdContext using MD5Init ** + ** (2) Call MD5Update on mdContext and M ** + ** (3) Call MD5Final on mdContext ** + ** The message digest is now in mdContext->digest[0...15] ** + *********************************************************************** +*/ + +#ifndef _SDL_test_md5_h +#define _SDL_test_md5_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* ------------ Definitions --------- */ + +/* typedef a 32-bit type */ + typedef unsigned long int MD5UINT4; + +/* Data structure for MD5 (Message-Digest) computation */ + typedef struct { + MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ + MD5UINT4 buf[4]; /* scratch buffer */ + unsigned char in[64]; /* input buffer */ + unsigned char digest[16]; /* actual digest after Md5Final call */ + } SDLTest_Md5Context; + +/* ---------- Function Prototypes ------------- */ + +/** + * /brief initialize the context + * + * /param mdContext pointer to context variable + * + * Note: The function initializes the message-digest context + * mdContext. Call before each new use of the context - + * all fields are set to zero. + */ + void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); + + +/** + * /brief update digest from variable length data + * + * /param mdContext pointer to context variable + * /param inBuf pointer to data array/string + * /param inLen length of data array/string + * + * Note: The function updates the message-digest context to account + * for the presence of each of the characters inBuf[0..inLen-1] + * in the message whose digest is being computed. +*/ + + void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, + unsigned int inLen); + + +/* + * /brief complete digest computation + * + * /param mdContext pointer to context variable + * + * Note: The function terminates the message-digest computation and + * ends with the desired message digest in mdContext.digest[0..15]. + * Always call before using the digest[] variable. +*/ + + void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_md5_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_test_random.h b/external/SDL2/SDL_test_random.h new file mode 100644 index 0000000..f29d006 --- /dev/null +++ b/external/SDL2/SDL_test_random.h @@ -0,0 +1,119 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_random.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + A "32-bit Multiply with carry random number generator. Very fast. + Includes a list of recommended multipliers. + + multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. + period: (a*2^31)-1 + +*/ + +#ifndef _SDL_test_random_h +#define _SDL_test_random_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* --- Definitions */ + +/* + * Macros that return a random number in a specific format. + */ +#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) + +/* + * Context structure for the random number generator state. + */ + typedef struct { + unsigned int a; + unsigned int x; + unsigned int c; + unsigned int ah; + unsigned int al; + } SDLTest_RandomContext; + + +/* --- Function prototypes */ + +/** + * \brief Initialize random number generator with two integers. + * + * Note: The random sequence of numbers returned by ...Random() is the + * same for the same two integers and has a period of 2^31. + * + * \param rndContext pointer to context structure + * \param xi integer that defines the random sequence + * \param ci integer that defines the random sequence + * + */ + void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, + unsigned int ci); + +/** + * \brief Initialize random number generator based on current system time. + * + * \param rndContext pointer to context structure + * + */ + void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); + + +/** + * \brief Initialize random number generator based on current system time. + * + * Note: ...RandomInit() or ...RandomInitTime() must have been called + * before using this function. + * + * \param rndContext pointer to context structure + * + * \returns A random number (32bit unsigned integer) + * + */ + unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_test_random_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_thread.h b/external/SDL2/SDL_thread.h new file mode 100644 index 0000000..b3b8641 --- /dev/null +++ b/external/SDL2/SDL_thread.h @@ -0,0 +1,182 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_thread_h +#define _SDL_thread_h + +/** + * \file SDL_thread.h + * + * Header for the SDL thread management routines. + */ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +/* Thread synchronization primitives */ +#include "SDL_mutex.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* The SDL thread structure, defined in SDL_thread.c */ +struct SDL_Thread; +typedef struct SDL_Thread SDL_Thread; + +/* The SDL thread ID */ +typedef unsigned long SDL_threadID; + +/* The SDL thread priority + * + * Note: On many systems you require special privileges to set high priority. + */ +typedef enum { + SDL_THREAD_PRIORITY_LOW, + SDL_THREAD_PRIORITY_NORMAL, + SDL_THREAD_PRIORITY_HIGH +} SDL_ThreadPriority; + +/* The function passed to SDL_CreateThread() + It is passed a void* user context parameter and returns an int. + */ +typedef int (SDLCALL * SDL_ThreadFunction) (void *data); + +#if defined(__WIN32__) && !defined(HAVE_LIBC) +/** + * \file SDL_thread.h + * + * We compile SDL into a DLL. This means, that it's the DLL which + * creates a new thread for the calling process with the SDL_CreateThread() + * API. There is a problem with this, that only the RTL of the SDL.DLL will + * be initialized for those threads, and not the RTL of the calling + * application! + * + * To solve this, we make a little hack here. + * + * We'll always use the caller's _beginthread() and _endthread() APIs to + * start a new thread. This way, if it's the SDL.DLL which uses this API, + * then the RTL of SDL.DLL will be used to create the new thread, and if it's + * the application, then the RTL of the application will be used. + * + * So, in short: + * Always use the _beginthread() and _endthread() of the calling runtime + * library! + */ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD +#include /* This has _beginthread() and _endthread() defined! */ + +typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, + unsigned (__stdcall * + func) (void + *), + void *arg, unsigned, + unsigned *threadID); +typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); + +/** + * Create a thread. + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + +/** + * Create a thread. + */ +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, _beginthreadex, _endthreadex) + +#else + +/** + * Create a thread. + * + * Thread naming is a little complicated: Most systems have very small + * limits for the string length (BeOS has 32 bytes, Linux currently has 16, + * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll + * have to see what happens with your system's debugger. The name should be + * UTF-8 (but using the naming limits of C identifiers is a better bet). + * There are no requirements for thread naming conventions, so long as the + * string is null-terminated UTF-8, but these guidelines are helpful in + * choosing a name: + * + * http://stackoverflow.com/questions/149932/naming-conventions-for-threads + * + * If a system imposes requirements, SDL will try to munge the string for + * it (truncate, etc), but the original string contents will be available + * from SDL_GetThreadName(). + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); + +#endif + +/** + * Get the thread name, as it was specified in SDL_CreateThread(). + * This function returns a pointer to a UTF-8 string that names the + * specified thread, or NULL if it doesn't have a name. This is internal + * memory, not to be free()'d by the caller, and remains valid until the + * specified thread is cleaned up by SDL_WaitThread(). + */ +extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread); + +/** + * Get the thread identifier for the current thread. + */ +extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void); + +/** + * Get the thread identifier for the specified thread. + * + * Equivalent to SDL_ThreadID() if the specified thread is NULL. + */ +extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); + +/** + * Set the priority for the current thread + */ +extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); + +/** + * Wait for a thread to finish. + * + * The return code for the thread function is placed in the area + * pointed to by \c status, if \c status is not NULL. + */ +extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_thread_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_timer.h b/external/SDL2/SDL_timer.h new file mode 100644 index 0000000..ebe0314 --- /dev/null +++ b/external/SDL2/SDL_timer.h @@ -0,0 +1,108 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_timer_h +#define _SDL_timer_h + +/** + * \file SDL_timer.h + * + * Header for the SDL time management routines. + */ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Get the number of milliseconds since the SDL library initialization. + * + * \note This value wraps if the program runs for more than ~49 days. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); + +/** + * \brief Get the current value of the high resolution counter + */ +extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); + +/** + * \brief Get the count per second of the high resolution counter + */ +extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); + +/** + * \brief Wait a specified number of milliseconds before returning. + */ +extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); + +/** + * Function prototype for the timer callback function. + * + * The callback function is passed the current timer interval and returns + * the next timer interval. If the returned value is the same as the one + * passed in, the periodic alarm continues, otherwise a new alarm is + * scheduled. If the callback returns 0, the periodic alarm is cancelled. + */ +typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); + +/** + * Definition of the timer ID type. + */ +typedef int SDL_TimerID; + +/** + * \brief Add a new timer to the pool of timers already running. + * + * \return A timer ID, or NULL when an error occurs. + */ +extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, + SDL_TimerCallback callback, + void *param); + +/** + * \brief Remove a timer knowing its ID. + * + * \return A boolean value indicating success or failure. + * + * \warning It is not safe to remove a timer multiple times. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_timer_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_touch.h b/external/SDL2/SDL_touch.h new file mode 100644 index 0000000..b16b481 --- /dev/null +++ b/external/SDL2/SDL_touch.h @@ -0,0 +1,90 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_touch.h + * + * Include file for SDL touch event handling. + */ + +#ifndef _SDL_touch_h +#define _SDL_touch_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +typedef Sint64 SDL_TouchID; +typedef Sint64 SDL_FingerID; + +typedef struct SDL_Finger +{ + SDL_FingerID id; + float x; + float y; + float pressure; +} SDL_Finger; + +/* Used as the device ID for mouse events simulated with touch input */ +#define SDL_TOUCH_MOUSEID ((Uint32)-1) + + +/* Function prototypes */ + +/** + * \brief Get the number of registered touch devices. + */ +extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(); + +/** + * \brief Get the touch ID with the given index, or 0 if the index is invalid. + */ +extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); + +/** + * \brief Get the number of active fingers for a given touch device. + */ +extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); + +/** + * \brief Get the finger object of the given touch, with the given index. + */ +extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_touch_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_types.h b/external/SDL2/SDL_types.h new file mode 100644 index 0000000..dfcc7ce --- /dev/null +++ b/external/SDL2/SDL_types.h @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_types.h + * + * \deprecated + */ + +/* DEPRECATED */ +#include "SDL_stdinc.h" diff --git a/external/SDL2/SDL_version.h b/external/SDL2/SDL_version.h new file mode 100644 index 0000000..19ccc4c --- /dev/null +++ b/external/SDL2/SDL_version.h @@ -0,0 +1,166 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_version.h + * + * This header defines the current SDL version. + */ + +#ifndef _SDL_version_h +#define _SDL_version_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief Information the version of SDL in use. + * + * Represents the library's version as three levels: major revision + * (increments with massive changes, additions, and enhancements), + * minor revision (increments with backwards-compatible changes to the + * major revision), and patchlevel (increments with fixes to the minor + * revision). + * + * \sa SDL_VERSION + * \sa SDL_GetVersion + */ +typedef struct SDL_version +{ + Uint8 major; /**< major version */ + Uint8 minor; /**< minor version */ + Uint8 patch; /**< update version */ +} SDL_version; + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MAJOR_VERSION 2 +#define SDL_MINOR_VERSION 0 +#define SDL_PATCHLEVEL 0 + +/** + * \brief Macro to determine SDL version program was compiled against. + * + * This macro fills in a SDL_version structure with the version of the + * library you compiled against. This is determined by what header the + * compiler uses. Note that if you dynamically linked the library, you might + * have a slightly newer or older version at runtime. That version can be + * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), + * is not a macro. + * + * \param x A pointer to a SDL_version struct to initialize. + * + * \sa SDL_version + * \sa SDL_GetVersion + */ +#define SDL_VERSION(x) \ +{ \ + (x)->major = SDL_MAJOR_VERSION; \ + (x)->minor = SDL_MINOR_VERSION; \ + (x)->patch = SDL_PATCHLEVEL; \ +} + +/** + * This macro turns the version numbers into a numeric value: + * \verbatim + (1,2,3) -> (1203) + \endverbatim + * + * This assumes that there will never be more than 100 patchlevels. + */ +#define SDL_VERSIONNUM(X, Y, Z) \ + ((X)*1000 + (Y)*100 + (Z)) + +/** + * This is the version number macro for the current SDL version. + */ +#define SDL_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) + +/** + * This macro will evaluate to true if compiled with SDL at least X.Y.Z. + */ +#define SDL_VERSION_ATLEAST(X, Y, Z) \ + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/** + * \brief Get the version of SDL that is linked against your program. + * + * If you are linking to SDL dynamically, then it is possible that the + * current version will be different than the version you compiled against. + * This function returns the current version, while SDL_VERSION() is a + * macro that tells you what version you compiled with. + * + * \code + * SDL_version compiled; + * SDL_version linked; + * + * SDL_VERSION(&compiled); + * SDL_GetVersion(&linked); + * printf("We compiled against SDL version %d.%d.%d ...\n", + * compiled.major, compiled.minor, compiled.patch); + * printf("But we linked against SDL version %d.%d.%d.\n", + * linked.major, linked.minor, linked.patch); + * \endcode + * + * This function may be called safely at any time, even before SDL_Init(). + * + * \sa SDL_VERSION + */ +extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); + +/** + * \brief Get the code revision of SDL that is linked against your program. + * + * Returns an arbitrary string (a hash value) uniquely identifying the + * exact revision of the SDL library in use, and is only useful in comparing + * against other revisions. It is NOT an incrementing number. + */ +extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); + +/** + * \brief Get the revision number of SDL that is linked against your program. + * + * Returns a number uniquely identifying the exact revision of the SDL + * library in use. It is an incrementing number based on commits to + * hg.libsdl.org. + */ +extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_version_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/SDL_video.h b/external/SDL2/SDL_video.h new file mode 100644 index 0000000..817838b --- /dev/null +++ b/external/SDL2/SDL_video.h @@ -0,0 +1,934 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_video.h + * + * Header file for SDL video functions. + */ + +#ifndef _SDL_video_h +#define _SDL_video_h + +#include "SDL_stdinc.h" +#include "SDL_pixels.h" +#include "SDL_rect.h" +#include "SDL_surface.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief The structure that defines a display mode + * + * \sa SDL_GetNumDisplayModes() + * \sa SDL_GetDisplayMode() + * \sa SDL_GetDesktopDisplayMode() + * \sa SDL_GetCurrentDisplayMode() + * \sa SDL_GetClosestDisplayMode() + * \sa SDL_SetWindowDisplayMode() + * \sa SDL_GetWindowDisplayMode() + */ +typedef struct +{ + Uint32 format; /**< pixel format */ + int w; /**< width */ + int h; /**< height */ + int refresh_rate; /**< refresh rate (or zero for unspecified) */ + void *driverdata; /**< driver-specific data, initialize to 0 */ +} SDL_DisplayMode; + +/** + * \brief The type used to identify a window + * + * \sa SDL_CreateWindow() + * \sa SDL_CreateWindowFrom() + * \sa SDL_DestroyWindow() + * \sa SDL_GetWindowData() + * \sa SDL_GetWindowFlags() + * \sa SDL_GetWindowGrab() + * \sa SDL_GetWindowPosition() + * \sa SDL_GetWindowSize() + * \sa SDL_GetWindowTitle() + * \sa SDL_HideWindow() + * \sa SDL_MaximizeWindow() + * \sa SDL_MinimizeWindow() + * \sa SDL_RaiseWindow() + * \sa SDL_RestoreWindow() + * \sa SDL_SetWindowData() + * \sa SDL_SetWindowFullscreen() + * \sa SDL_SetWindowGrab() + * \sa SDL_SetWindowIcon() + * \sa SDL_SetWindowPosition() + * \sa SDL_SetWindowSize() + * \sa SDL_SetWindowBordered() + * \sa SDL_SetWindowTitle() + * \sa SDL_ShowWindow() + */ +typedef struct SDL_Window SDL_Window; + +/** + * \brief The flags on a window + * + * \sa SDL_GetWindowFlags() + */ +typedef enum +{ + SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ + SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ + SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ + SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ + SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ + SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ + SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ + SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ + SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ + SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ + SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ + SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), + SDL_WINDOW_FOREIGN = 0x00000800 /**< window not created by SDL */ +} SDL_WindowFlags; + +/** + * \brief Used to indicate that you don't care what the window position is. + */ +#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000 +#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) +#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) +#define SDL_WINDOWPOS_ISUNDEFINED(X) \ + (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) + +/** + * \brief Used to indicate that the window position should be centered. + */ +#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000 +#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) +#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) +#define SDL_WINDOWPOS_ISCENTERED(X) \ + (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) + +/** + * \brief Event subtype for window events + */ +typedef enum +{ + SDL_WINDOWEVENT_NONE, /**< Never used */ + SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ + SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ + SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be + redrawn */ + SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 + */ + SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ + SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ + SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ + SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ + SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size + and position */ + SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ + SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ + SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ + SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ + SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the + window be closed */ +} SDL_WindowEventID; + +/** + * \brief An opaque handle to an OpenGL context. + */ +typedef void *SDL_GLContext; + +/** + * \brief OpenGL configuration attributes + */ +typedef enum +{ + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE, + SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES, + SDL_GL_ACCELERATED_VISUAL, + SDL_GL_RETAINED_BACKING, + SDL_GL_CONTEXT_MAJOR_VERSION, + SDL_GL_CONTEXT_MINOR_VERSION, + SDL_GL_CONTEXT_EGL, + SDL_GL_CONTEXT_FLAGS, + SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_SHARE_WITH_CURRENT_CONTEXT +} SDL_GLattr; + +typedef enum +{ + SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, + SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, + SDL_GL_CONTEXT_PROFILE_ES = 0x0004 +} SDL_GLprofile; + +typedef enum +{ + SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, + SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, + SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, + SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 +} SDL_GLcontextFlag; + + +/* Function prototypes */ + +/** + * \brief Get the number of video drivers compiled into SDL + * + * \sa SDL_GetVideoDriver() + */ +extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); + +/** + * \brief Get the name of a built in video driver. + * + * \note The video drivers are presented in the order in which they are + * normally checked during initialization. + * + * \sa SDL_GetNumVideoDrivers() + */ +extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); + +/** + * \brief Initialize the video subsystem, optionally specifying a video driver. + * + * \param driver_name Initialize a specific driver by name, or NULL for the + * default video driver. + * + * \return 0 on success, -1 on error + * + * This function initializes the video subsystem; setting up a connection + * to the window manager, etc, and determines the available display modes + * and pixel formats, but does not initialize a window or graphics mode. + * + * \sa SDL_VideoQuit() + */ +extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); + +/** + * \brief Shuts down the video subsystem. + * + * This function closes all windows, and restores the original video mode. + * + * \sa SDL_VideoInit() + */ +extern DECLSPEC void SDLCALL SDL_VideoQuit(void); + +/** + * \brief Returns the name of the currently initialized video driver. + * + * \return The name of the current video driver or NULL if no driver + * has been initialized + * + * \sa SDL_GetNumVideoDrivers() + * \sa SDL_GetVideoDriver() + */ +extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); + +/** + * \brief Returns the number of available video displays. + * + * \sa SDL_GetDisplayBounds() + */ +extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); + +/** + * \brief Get the name of a display in UTF-8 encoding + * + * \return The name of a display, or NULL for an invalid display index. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); + +/** + * \brief Get the desktop area represented by a display, with the primary + * display located at 0,0 + * + * \return 0 on success, or -1 if the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); + +/** + * \brief Returns the number of available display modes. + * + * \sa SDL_GetDisplayMode() + */ +extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); + +/** + * \brief Fill in information about a specific display mode. + * + * \note The display modes are sorted in this priority: + * \li bits per pixel -> more colors to fewer colors + * \li width -> largest to smallest + * \li height -> largest to smallest + * \li refresh rate -> highest to lowest + * + * \sa SDL_GetNumDisplayModes() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, + SDL_DisplayMode * mode); + +/** + * \brief Fill in information about the desktop display mode. + */ +extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode); + +/** + * \brief Fill in information about the current display mode. + */ +extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode); + + +/** + * \brief Get the closest match to the requested display mode. + * + * \param mode The desired display mode + * \param closest A pointer to a display mode to be filled in with the closest + * match of the available display modes. + * + * \return The passed in value \c closest, or NULL if no matching video mode + * was available. + * + * The available display modes are scanned, and \c closest is filled in with the + * closest mode matching the requested mode and returned. The mode format and + * refresh_rate default to the desktop mode if they are 0. The modes are + * scanned with size being first priority, format being second priority, and + * finally checking the refresh_rate. If all the available modes are too + * small, then NULL is returned. + * + * \sa SDL_GetNumDisplayModes() + * \sa SDL_GetDisplayMode() + */ +extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); + +/** + * \brief Get the display index associated with a window. + * + * \return the display index of the display containing the center of the + * window, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); + +/** + * \brief Set the display mode used when a fullscreen window is visible. + * + * By default the window's dimensions and the desktop format and refresh rate + * are used. + * + * \param mode The mode to use, or NULL for the default mode. + * + * \return 0 on success, or -1 if setting the display mode failed. + * + * \sa SDL_GetWindowDisplayMode() + * \sa SDL_SetWindowFullscreen() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, + const SDL_DisplayMode + * mode); + +/** + * \brief Fill in information about the display mode used when a fullscreen + * window is visible. + * + * \sa SDL_SetWindowDisplayMode() + * \sa SDL_SetWindowFullscreen() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, + SDL_DisplayMode * mode); + +/** + * \brief Get the pixel format associated with the window. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); + +/** + * \brief Create a window with the specified position, dimensions, and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window. + * \param h The height of the window. + * \param flags The flags for the window, a mask of any of the following: + * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, + * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS, + * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, + * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED. + * + * \return The id of the window created, or zero if window creation failed. + * + * \sa SDL_DestroyWindow() + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, + int x, int y, int w, + int h, Uint32 flags); + +/** + * \brief Create an SDL window from an existing native window. + * + * \param data A pointer to driver-dependent window creation data + * + * \return The id of the window created, or zero if window creation failed. + * + * \sa SDL_DestroyWindow() + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); + +/** + * \brief Get the numeric ID of a window, for logging purposes. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); + +/** + * \brief Get a window from a stored ID, or NULL if it doesn't exist. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); + +/** + * \brief Get the window flags. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); + +/** + * \brief Set the title of a window, in UTF-8 format. + * + * \sa SDL_GetWindowTitle() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, + const char *title); + +/** + * \brief Get the title of a window, in UTF-8 format. + * + * \sa SDL_SetWindowTitle() + */ +extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); + +/** + * \brief Set the icon for a window. + * + * \param icon The icon for the window. + */ +extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, + SDL_Surface * icon); + +/** + * \brief Associate an arbitrary named pointer with a window. + * + * \param window The window to associate with the pointer. + * \param name The name of the pointer. + * \param userdata The associated pointer. + * + * \return The previous value associated with 'name' + * + * \note The name is case-sensitive. + * + * \sa SDL_GetWindowData() + */ +extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, + const char *name, + void *userdata); + +/** + * \brief Retrieve the data pointer associated with a window. + * + * \param window The window to query. + * \param name The name of the pointer. + * + * \return The value associated with 'name' + * + * \sa SDL_SetWindowData() + */ +extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, + const char *name); + +/** + * \brief Set the position of a window. + * + * \param window The window to reposition. + * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or + ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or + ::SDL_WINDOWPOS_UNDEFINED. + * + * \note The window coordinate origin is the upper left of the display. + * + * \sa SDL_GetWindowPosition() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, + int x, int y); + +/** + * \brief Get the position of a window. + * + * \param x Pointer to variable for storing the x position, may be NULL + * \param y Pointer to variable for storing the y position, may be NULL + * + * \sa SDL_SetWindowPosition() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, + int *x, int *y); + +/** + * \brief Set the size of a window's client area. + * + * \param w The width of the window, must be >0 + * \param h The height of the window, must be >0 + * + * \note You can't change the size of a fullscreen window, it automatically + * matches the size of the display mode. + * + * \sa SDL_GetWindowSize() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, + int h); + +/** + * \brief Get the size of a window's client area. + * + * \param w Pointer to variable for storing the width, may be NULL + * \param h Pointer to variable for storing the height, may be NULL + * + * \sa SDL_SetWindowSize() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, + int *h); + +/** + * \brief Set the minimum size of a window's client area. + * + * \param min_w The minimum width of the window, must be >0 + * \param min_h The minimum height of the window, must be >0 + * + * \note You can't change the minimum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * \sa SDL_GetWindowMinimumSize() + * \sa SDL_SetWindowMaximumSize() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, + int min_w, int min_h); + +/** + * \brief Get the minimum size of a window's client area. + * + * \param w Pointer to variable for storing the minimum width, may be NULL + * \param h Pointer to variable for storing the minimum height, may be NULL + * + * \sa SDL_GetWindowMaximumSize() + * \sa SDL_SetWindowMinimumSize() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, + int *w, int *h); + +/** + * \brief Set the maximum size of a window's client area. + * + * \param max_w The maximum width of the window, must be >0 + * \param max_h The maximum height of the window, must be >0 + * + * \note You can't change the maximum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * \sa SDL_GetWindowMaximumSize() + * \sa SDL_SetWindowMinimumSize() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, + int max_w, int max_h); + +/** + * \brief Get the maximum size of a window's client area. + * + * \param w Pointer to variable for storing the maximum width, may be NULL + * \param h Pointer to variable for storing the maximum height, may be NULL + * + * \sa SDL_GetWindowMinimumSize() + * \sa SDL_SetWindowMaximumSize() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, + int *w, int *h); + +/** + * \brief Set the border state of a window. + * + * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and + * add or remove the border from the actual window. This is a no-op if the + * window's border already matches the requested state. + * + * \param window The window of which to change the border state. + * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. + * + * \note You can't change the border state of a fullscreen window. + * + * \sa SDL_GetWindowFlags() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, + SDL_bool bordered); + +/** + * \brief Show a window. + * + * \sa SDL_HideWindow() + */ +extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); + +/** + * \brief Hide a window. + * + * \sa SDL_ShowWindow() + */ +extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); + +/** + * \brief Raise a window above other windows and set the input focus. + */ +extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); + +/** + * \brief Make a window as large as possible. + * + * \sa SDL_RestoreWindow() + */ +extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); + +/** + * \brief Minimize a window to an iconic representation. + * + * \sa SDL_RestoreWindow() + */ +extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); + +/** + * \brief Restore the size and position of a minimized or maximized window. + * + * \sa SDL_MaximizeWindow() + * \sa SDL_MinimizeWindow() + */ +extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); + +/** + * \brief Set a window's fullscreen state. + * + * \return 0 on success, or -1 if setting the display mode failed. + * + * \sa SDL_SetWindowDisplayMode() + * \sa SDL_GetWindowDisplayMode() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, + Uint32 flags); + +/** + * \brief Get the SDL surface associated with the window. + * + * \return The window's framebuffer surface, or NULL on error. + * + * A new surface will be created with the optimal format for the window, + * if necessary. This surface will be freed when the window is destroyed. + * + * \note You may not combine this with 3D or the rendering API on this window. + * + * \sa SDL_UpdateWindowSurface() + * \sa SDL_UpdateWindowSurfaceRects() + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window); + +/** + * \brief Copy the window surface to the screen. + * + * \return 0 on success, or -1 on error. + * + * \sa SDL_GetWindowSurface() + * \sa SDL_UpdateWindowSurfaceRects() + */ +extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); + +/** + * \brief Copy a number of rectangles on the window surface to the screen. + * + * \return 0 on success, or -1 on error. + * + * \sa SDL_GetWindowSurface() + * \sa SDL_UpdateWindowSurfaceRect() + */ +extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, + const SDL_Rect * rects, + int numrects); + +/** + * \brief Set a window's input grab mode. + * + * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. + * + * \sa SDL_GetWindowGrab() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, + SDL_bool grabbed); + +/** + * \brief Get a window's input grab mode. + * + * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. + * + * \sa SDL_SetWindowGrab() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); + +/** + * \brief Set the brightness (gamma correction) for a window. + * + * \return 0 on success, or -1 if setting the brightness isn't supported. + * + * \sa SDL_GetWindowBrightness() + * \sa SDL_SetWindowGammaRamp() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness); + +/** + * \brief Get the brightness (gamma correction) for a window. + * + * \return The last brightness value passed to SDL_SetWindowBrightness() + * + * \sa SDL_SetWindowBrightness() + */ +extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); + +/** + * \brief Set the gamma ramp for a window. + * + * \param red The translation table for the red channel, or NULL. + * \param green The translation table for the green channel, or NULL. + * \param blue The translation table for the blue channel, or NULL. + * + * \return 0 on success, or -1 if gamma ramps are unsupported. + * + * Set the gamma translation table for the red, green, and blue channels + * of the video hardware. Each table is an array of 256 16-bit quantities, + * representing a mapping between the input and output for that channel. + * The input is the index into the array, and the output is the 16-bit + * gamma value at that index, scaled to the output color precision. + * + * \sa SDL_GetWindowGammaRamp() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, + const Uint16 * red, + const Uint16 * green, + const Uint16 * blue); + +/** + * \brief Get the gamma ramp for a window. + * + * \param red A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the red channel, or NULL. + * \param green A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the green channel, or NULL. + * \param blue A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the blue channel, or NULL. + * + * \return 0 on success, or -1 if gamma ramps are unsupported. + * + * \sa SDL_SetWindowGammaRamp() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, + Uint16 * red, + Uint16 * green, + Uint16 * blue); + +/** + * \brief Destroy a window. + */ +extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); + + +/** + * \brief Returns whether the screensaver is currently enabled (default on). + * + * \sa SDL_EnableScreenSaver() + * \sa SDL_DisableScreenSaver() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); + +/** + * \brief Allow the screen to be blanked by a screensaver + * + * \sa SDL_IsScreenSaverEnabled() + * \sa SDL_DisableScreenSaver() + */ +extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); + +/** + * \brief Prevent the screen from being blanked by a screensaver + * + * \sa SDL_IsScreenSaverEnabled() + * \sa SDL_EnableScreenSaver() + */ +extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); + + +/** + * \name OpenGL support functions + */ +/*@{*/ + +/** + * \brief Dynamically load an OpenGL library. + * + * \param path The platform dependent OpenGL library name, or NULL to open the + * default OpenGL library. + * + * \return 0 on success, or -1 if the library couldn't be loaded. + * + * This should be done after initializing the video driver, but before + * creating any OpenGL windows. If no OpenGL library is loaded, the default + * library will be loaded upon creation of the first OpenGL window. + * + * \note If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + * + * \sa SDL_GL_GetProcAddress() + * \sa SDL_GL_UnloadLibrary() + */ +extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); + +/** + * \brief Get the address of an OpenGL function. + */ +extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); + +/** + * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). + * + * \sa SDL_GL_LoadLibrary() + */ +extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); + +/** + * \brief Return true if an OpenGL extension is supported for the current + * context. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char + *extension); + +/** + * \brief Set an OpenGL window attribute before window creation. + */ +extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); + +/** + * \brief Get the actual value for an attribute from the current context. + */ +extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); + +/** + * \brief Create an OpenGL context for use with an OpenGL window, and make it + * current. + * + * \sa SDL_GL_DeleteContext() + */ +extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * + window); + +/** + * \brief Set up an OpenGL context for rendering into an OpenGL window. + * + * \note The context must have been created with a compatible window. + */ +extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, + SDL_GLContext context); + +/** + * \brief Set the swap interval for the current OpenGL context. + * + * \param interval 0 for immediate updates, 1 for updates synchronized with the + * vertical retrace. If the system supports it, you may + * specify -1 to allow late swaps to happen immediately + * instead of waiting for the next retrace. + * + * \return 0 on success, or -1 if setting the swap interval is not supported. + * + * \sa SDL_GL_GetSwapInterval() + */ +extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); + +/** + * \brief Get the swap interval for the current OpenGL context. + * + * \return 0 if there is no vertical retrace synchronization, 1 if the buffer + * swap is synchronized with the vertical retrace, and -1 if late + * swaps happen immediately instead of waiting for the next retrace. + * If the system can't determine the swap interval, or there isn't a + * valid current context, this will return 0 as a safe default. + * + * \sa SDL_GL_SetSwapInterval() + */ +extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); + +/** + * \brief Swap the OpenGL buffers for a window, if double-buffering is + * supported. + */ +extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); + +/** + * \brief Delete an OpenGL context. + * + * \sa SDL_GL_CreateContext() + */ +extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); + +/*@}*//*OpenGL support functions*/ + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/external/SDL2/begin_code.h b/external/SDL2/begin_code.h new file mode 100644 index 0000000..5731e57 --- /dev/null +++ b/external/SDL2/begin_code.h @@ -0,0 +1,150 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file begin_code.h + * + * This file sets things up for C dynamic library function definitions, + * static inlined functions, and structures aligned at 4-byte alignment. + * If you don't like ugly C preprocessor code, don't look at this file. :) + */ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# if defined(__BEOS__) || defined(__HAIKU__) +# if defined(__GNUC__) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(export) +# endif +# elif defined(__WIN32__) +# ifdef __BORLANDC__ +# ifdef BUILD_SDL +# define DECLSPEC +# else +# define DECLSPEC __declspec(dllimport) +# endif +# else +# define DECLSPEC __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define DECLSPEC __attribute__ ((visibility("default"))) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#if defined(__WIN32__) && !defined(__GNUC__) +#define SDLCALL __cdecl +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ +#ifdef __SYMBIAN32__ +#undef DECLSPEC +#define DECLSPEC +#endif /* __SYMBIAN32__ */ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else +#pragma pack(push,4) +#endif +#endif /* Compiler needs structure packing set */ + +/* Set up compiler-specific options for inlining functions */ +#ifndef SDL_INLINE_OKAY +#ifdef __GNUC__ +#define SDL_INLINE_OKAY +#else +/* Add any special compiler-specific cases here */ +#if defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) +#ifndef __inline__ +#define __inline__ __inline +#endif +#define SDL_INLINE_OKAY +#else +#if !defined(__MRC__) && !defined(_SGI_SOURCE) +#ifndef __inline__ +#define __inline__ inline +#endif +#define SDL_INLINE_OKAY +#endif /* Not a funky compiler */ +#endif /* Visual C++ */ +#endif /* GNU C */ +#endif /* SDL_INLINE_OKAY */ + +/* If inlining isn't supported, remove "__inline__", turning static + inlined functions into static functions (resulting in code bloat + in all files which include the offending header files) +*/ +#ifndef SDL_INLINE_OKAY +#define __inline__ +#endif + +#ifndef SDL_FORCE_INLINE +#if defined(_MSC_VER) +#define SDL_FORCE_INLINE __forceinline +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) +#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline +#else +#define SDL_FORCE_INLINE static __inline__ +#endif +#endif + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/external/SDL2/close_code.h b/external/SDL2/close_code.h new file mode 100644 index 0000000..722250d --- /dev/null +++ b/external/SDL2/close_code.h @@ -0,0 +1,37 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file close_code.h + * + * This file reverses the effects of begin_code.h and should be included + * after you finish any function and structure declarations in your headers + */ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(pop) +#endif /* Compiler needs structure packing set */ diff --git a/external/SDL2/merge_sdl2.sh b/external/SDL2/merge_sdl2.sh new file mode 100755 index 0000000..ecfa73d --- /dev/null +++ b/external/SDL2/merge_sdl2.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +p4 integ -i -d -Dt //steam/rel/client/src/external/SDL2/... //ValveGames/main/GoldSrc/external/SDL2/... +p4 integ -i -d -Dt //steam/rel/client/client/osx32/libsdl... //ValveGames/rel/goldsource/hl1/game/libsdl... +p4 integ -i -d -Dt //steam/rel/client/client/osx32/libsdl... //ValveGames/main/GoldSrc/linux/libsdl... +p4 integ -i -d -Dt //steam/rel/client/client/ubuntu12_32/libsdl... //ValveGames/rel/goldsource/hl1/game/libsdl... +p4 integ -i -d -Dt //steam/rel/client/client/ubuntu12_32/libsdl... //ValveGames/main/GoldSrc/linux/libsdl... + +p4 integ -i -d -Dt //steam/rel/client/client/sdl... //ValveGames/rel/goldsource/hl1/game/sdl... +p4 resolve -am //ValveGames/main/GoldSrc/external/SDL2/... +p4 resolve -at //ValveGames/rel/goldsource/hl1/game/sdl... //ValveGames/rel/goldsource/hl1/game/libsdl... //ValveGames/main/GoldSrc/linux/libsdl... diff --git a/game_shared/GameEvent.h b/game_shared/GameEvent.h new file mode 100644 index 0000000..c4d974a --- /dev/null +++ b/game_shared/GameEvent.h @@ -0,0 +1,282 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Michael S. Booth (mike@turtlerockstudios.com), 2003 +// Author: Matthew D. Campbell (matt@turtlerockstudios.com), 2003 + +#ifndef GAME_EVENT_H +#define GAME_EVENT_H + +// +// NOTE: This enum is used by both the client and server, so only add events to the +// end of the list to remain maximally compatible with existing clients. +// + +// Define some event types used in various places (CZ bot code, career mode, and tutor, initially) +enum GameEventType +{ + EVENT_INVALID = 0, + + EVENT_WEAPON_FIRED, + EVENT_WEAPON_FIRED_ON_EMPTY, + EVENT_WEAPON_RELOADED, + EVENT_HE_GRENADE_EXPLODED, + EVENT_FLASHBANG_GRENADE_EXPLODED, + EVENT_SMOKE_GRENADE_EXPLODED, + EVENT_GRENADE_BOUNCED, + EVENT_BEING_SHOT_AT, ///< this will only trigger for the local player in single player games. + EVENT_PLAYER_BLINDED_BY_FLASHBANG, + + EVENT_PLAYER_FOOTSTEP, + EVENT_PLAYER_JUMPED, + EVENT_PLAYER_DIED, + EVENT_PLAYER_LANDED_FROM_HEIGHT, + EVENT_PLAYER_TOOK_DAMAGE, + + EVENT_HOSTAGE_DAMAGED, + EVENT_HOSTAGE_KILLED, + + EVENT_DOOR, + EVENT_BREAK_GLASS, + EVENT_BREAK_WOOD, + EVENT_BREAK_METAL, + EVENT_BREAK_FLESH, + EVENT_BREAK_CONCRETE, + + EVENT_BOMB_PLANTED, + EVENT_BOMB_DROPPED, + EVENT_BOMB_PICKED_UP, + EVENT_BOMB_BEEP, ///< timer beep when counting down to detonation + EVENT_BOMB_DEFUSING, + EVENT_BOMB_DEFUSE_ABORTED, + EVENT_BOMB_DEFUSED, + EVENT_BOMB_EXPLODED, + + EVENT_HOSTAGE_USED, + EVENT_HOSTAGE_RESCUED, + EVENT_ALL_HOSTAGES_RESCUED, + + EVENT_VIP_ESCAPED, + EVENT_VIP_ASSASSINATED, + + EVENT_TERRORISTS_WIN, + EVENT_CTS_WIN, + EVENT_ROUND_DRAW, + EVENT_ROUND_WIN, ///< win/loss relative to the client + EVENT_ROUND_LOSS, ///< win/loss relative to the client + EVENT_ROUND_START, + EVENT_PLAYER_SPAWNED, + EVENT_CLIENT_CORPSE_SPAWNED, + EVENT_BUY_TIME_START, + EVENT_PLAYER_LEFT_BUY_ZONE, ///< triggered by tutor system when the local player leaves the buy zone/buy time expires for the first time. + EVENT_DEATH_CAMERA_START, + EVENT_KILL_ALL, ///< everybody on one team has been killed + EVENT_ROUND_TIME, + + // client-relative events for career mode: has the player killed with certain weapons, etc? + + EVENT_DIE, + EVENT_KILL, ///< someone has been killed + EVENT_HEADSHOT, ///< subset of EVENT_KILL + EVENT_KILL_FLASHBANGED, + + // Tutor Buy menu events + EVENT_TUTOR_BUY_MENU_OPENNED, + EVENT_TUTOR_AUTOBUY, + EVENT_PLAYER_BOUGHT_SOMETHING, + EVENT_TUTOR_NOT_BUYING_ANYTHING, + EVENT_TUTOR_NEED_TO_BUY_PRIMARY_WEAPON, + EVENT_TUTOR_NEED_TO_BUY_PRIMARY_AMMO, + EVENT_TUTOR_NEED_TO_BUY_SECONDARY_AMMO, + EVENT_TUTOR_NEED_TO_BUY_ARMOR, + EVENT_TUTOR_NEED_TO_BUY_DEFUSE_KIT, + EVENT_TUTOR_NEED_TO_BUY_GRENADE, + + EVENT_CAREER_TASK_DONE, + + // radio messages (these must be kept in sync with actual radio) ------------------------------------- + + EVENT_START_RADIO_1, ///< radio messages between this and RADIO_2 and part of Radio1() + + EVENT_RADIO_COVER_ME, + EVENT_RADIO_YOU_TAKE_THE_POINT, + EVENT_RADIO_HOLD_THIS_POSITION, + EVENT_RADIO_REGROUP_TEAM, + EVENT_RADIO_FOLLOW_ME, + EVENT_RADIO_TAKING_FIRE, + + EVENT_START_RADIO_2, ///< radio messages between this and RADIO_3 are part of Radio2() + + EVENT_RADIO_GO_GO_GO, + EVENT_RADIO_TEAM_FALL_BACK, + EVENT_RADIO_STICK_TOGETHER_TEAM, + EVENT_RADIO_GET_IN_POSITION_AND_WAIT, + EVENT_RADIO_STORM_THE_FRONT, + EVENT_RADIO_REPORT_IN_TEAM, + + EVENT_START_RADIO_3, ///< radio messages above this are part of Radio3() + + EVENT_RADIO_AFFIRMATIVE, + EVENT_RADIO_ENEMY_SPOTTED, + EVENT_RADIO_NEED_BACKUP, + EVENT_RADIO_SECTOR_CLEAR, + EVENT_RADIO_IN_POSITION, + EVENT_RADIO_REPORTING_IN, + EVENT_RADIO_GET_OUT_OF_THERE, + EVENT_RADIO_NEGATIVE, + EVENT_RADIO_ENEMY_DOWN, + + EVENT_END_RADIO, + + EVENT_NEW_MATCH, ///< sent at the start of a new map/match. + EVENT_PLAYER_CHANGED_TEAM, ///< sent when a player changes teams. + EVENT_BULLET_IMPACT, + EVENT_GAME_COMMENCE, + EVENT_WEAPON_ZOOMED, + + EVENT_HOSTAGE_CALLED_FOR_HELP, ///< hostage yelled to a CT + + NUM_GAME_EVENTS +}; + +#ifdef DEFINE_EVENT_NAMES +// NOTE: These must be kept in sync with the GameEventType enum +const char *GameEventName[ NUM_GAME_EVENTS+1 ] = +{ + "EVENT_INVALID", + + "EVENT_WEAPON_FIRED", + "EVENT_WEAPON_FIRED_ON_EMPTY", + "EVENT_WEAPON_RELOADED", + "EVENT_HE_GRENADE_EXPLODED", + "EVENT_FLASHBANG_GRENADE_EXPLODED", + "EVENT_SMOKE_GRENADE_EXPLODED", + "EVENT_GRENADE_BOUNCED", + "EVENT_BEING_SHOT_AT", + "EVENT_PLAYER_BLINDED_BY_FLASHBANG", + + "EVENT_PLAYER_FOOTSTEP", + "EVENT_PLAYER_JUMPED", + "EVENT_PLAYER_DIED", + "EVENT_PLAYER_LANDED_FROM_HEIGHT", + "EVENT_PLAYER_TOOK_DAMAGE", + + "EVENT_HOSTAGE_DAMAGED", + "EVENT_HOSTAGE_KILLED", + + "EVENT_DOOR", + "EVENT_BREAK_GLASS", + "EVENT_BREAK_WOOD", + "EVENT_BREAK_METAL", + "EVENT_BREAK_FLESH", + "EVENT_BREAK_CONCRETE", + + "EVENT_BOMB_PLANTED", + "EVENT_BOMB_DROPPED", + "EVENT_BOMB_PICKED_UP", + "EVENT_BOMB_BEEP", + "EVENT_BOMB_DEFUSING", + "EVENT_BOMB_DEFUSE_ABORTED", + "EVENT_BOMB_DEFUSED", + "EVENT_BOMB_EXPLODED", + + "EVENT_HOSTAGE_USED", + "EVENT_HOSTAGE_RESCUED", + + "EVENT_ALL_HOSTAGES_RESCUED", + + "EVENT_VIP_ESCAPED", + "EVENT_VIP_ASSASSINATED", + + "EVENT_TERRORISTS_WIN", + "EVENT_CTS_WIN", + "EVENT_ROUND_DRAW", + + "EVENT_ROUND_WIN", + "EVENT_ROUND_LOSS", + "EVENT_ROUND_START", + "EVENT_PLAYER_SPAWNED", + "EVENT_CLIENT_CORPSE_SPAWNED", + "EVENT_BUY_TIME_START", + "EVENT_PLAYER_LEFT_BUY_ZONE", + "EVENT_DEATH_CAMERA_START", + "EVENT_KILL_ALL", + "EVENT_ROUND_TIME", + + // client-relative events for career mode: has the player killed with certain weapons, etc? + + "EVENT_DIE", + "EVENT_KILL", + "EVENT_HEADSHOT", + "EVENT_KILL_FLASHBANGED", + + // Tutor Buy menu events + "EVENT_TUTOR_BUY_MENU_OPENNED", + "EVENT_TUTOR_AUTOBUY", + "EVENT_PLAYER_BOUGHT_SOMETHING", + "EVENT_TUTOR_NOT_BUYING_ANYTHING", + "EVENT_TUTOR_NEED_TO_BUY_PRIMARY_WEAPON", + "EVENT_TUTOR_NEED_TO_BUY_PRIMARY_AMMO", + "EVENT_TUTOR_NEED_TO_BUY_SECONDARY_AMMO", + "EVENT_TUTOR_NEED_TO_BUY_ARMOR", + "EVENT_TUTOR_NEED_TO_BUY_DEFUSE_KIT", + "EVENT_TUTOR_NEED_TO_BUY_GRENADE", + + "EVENT_CAREER_TASK_DONE", + + // radio messages (these must be kept in sync with actual radio) ------------------------------------- + + "EVENT_START_RADIO_1", + + "EVENT_RADIO_COVER_ME", + "EVENT_RADIO_YOU_TAKE_THE_POINT", + "EVENT_RADIO_HOLD_THIS_POSITION", + "EVENT_RADIO_REGROUP_TEAM", + "EVENT_RADIO_FOLLOW_ME", + "EVENT_RADIO_TAKING_FIRE", + + "EVENT_START_RADIO_2", + + "EVENT_RADIO_GO_GO_GO", + "EVENT_RADIO_TEAM_FALL_BACK", + "EVENT_RADIO_STICK_TOGETHER_TEAM", + "EVENT_RADIO_GET_IN_POSITION_AND_WAIT", + "EVENT_RADIO_STORM_THE_FRONT", + "EVENT_RADIO_REPORT_IN_TEAM", + + "EVENT_START_RADIO_3", + + "EVENT_RADIO_AFFIRMATIVE", + "EVENT_RADIO_ENEMY_SPOTTED", + "EVENT_RADIO_NEED_BACKUP", + "EVENT_RADIO_SECTOR_CLEAR", + "EVENT_RADIO_IN_POSITION", + "EVENT_RADIO_REPORTING_IN", + "EVENT_RADIO_GET_OUT_OF_THERE", + "EVENT_RADIO_NEGATIVE", + "EVENT_RADIO_ENEMY_DOWN", + + "EVENT_END_RADIO", + + "EVENT_NEW_MATCH", + "EVENT_PLAYER_CHANGED_TEAM", + "EVENT_BULLET_IMPACT", + "EVENT_GAME_COMMENCE", + "EVENT_WEAPON_ZOOMED", + + "EVENT_HOSTAGE_CALLED_FOR_HELP", + + NULL // must be NULL-terminated +}; +#else +extern const char *GameEventName[ NUM_GAME_EVENTS ]; +#endif + +/// convert name to GameEventType +extern GameEventType NameToGameEvent( const char *name ); + +#endif // GAME_EVENT_H diff --git a/game_shared/bitvec.h b/game_shared/bitvec.h index 0271a11..fc05a8e 100644 --- a/game_shared/bitvec.h +++ b/game_shared/bitvec.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -12,19 +12,21 @@ #endif +#include "archtypes.h" // DAL #include +#include class CBitVecAccessor { public: - CBitVecAccessor(unsigned long *pDWords, int iBit); + CBitVecAccessor(uint32 *pDWords, int iBit); void operator=(int val); - operator unsigned long(); + operator uint32(); private: - unsigned long *m_pDWords; + uint32 *m_pDWords; int m_iBit; }; @@ -51,15 +53,15 @@ public: // Get underlying dword representations of the bits. int GetNumDWords(); - unsigned long GetDWord(int i); - void SetDWord(int i, unsigned long val); + uint32 GetDWord(int i); + void SetDWord(int i, uint32 val); int GetNumBits(); private: enum {NUM_DWORDS = NUM_BITS/32 + !!(NUM_BITS & 31)}; - unsigned long m_DWords[NUM_DWORDS]; + uint32 m_DWords[NUM_DWORDS]; }; @@ -68,7 +70,7 @@ private: // CBitVecAccessor inlines. // ------------------------------------------------------------------------ // -inline CBitVecAccessor::CBitVecAccessor(unsigned long *pDWords, int iBit) +inline CBitVecAccessor::CBitVecAccessor(uint32 *pDWords, int iBit) { m_pDWords = pDWords; m_iBit = iBit; @@ -80,10 +82,10 @@ inline void CBitVecAccessor::operator=(int val) if(val) m_pDWords[m_iBit >> 5] |= (1 << (m_iBit & 31)); else - m_pDWords[m_iBit >> 5] &= ~(unsigned long)(1 << (m_iBit & 31)); + m_pDWords[m_iBit >> 5] &= ~(uint32)(1 << (m_iBit & 31)); } -inline CBitVecAccessor::operator unsigned long() +inline CBitVecAccessor::operator uint32() { return m_pDWords[m_iBit >> 5] & (1 << (m_iBit & 31)); } @@ -160,7 +162,7 @@ inline int CBitVec::GetNumDWords() } template -inline unsigned long CBitVec::GetDWord(int i) +inline uint32 CBitVec::GetDWord(int i) { assert(i >= 0 && i < NUM_DWORDS); return m_DWords[i]; @@ -168,7 +170,7 @@ inline unsigned long CBitVec::GetDWord(int i) template -inline void CBitVec::SetDWord(int i, unsigned long val) +inline void CBitVec::SetDWord(int i, uint32 val) { assert(i >= 0 && i < NUM_DWORDS); m_DWords[i] = val; diff --git a/game_shared/bot/bot.cpp b/game_shared/bot/bot.cpp new file mode 100644 index 0000000..09989b8 --- /dev/null +++ b/game_shared/bot/bot.cpp @@ -0,0 +1,626 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Michael S. Booth (mike@turtlerockstudios.com), Leon Hartwig, 2003 + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "weapons.h" +#include "soundent.h" +#include "gamerules.h" +#include "player.h" +#include "client.h" +#include "pm_shared.h" + +#include "bot.h" +#include "bot_util.h" + +DLL_GLOBAL float g_flBotCommandInterval = 1.0 / 30.0; // 30 times per second, just like human clients +DLL_GLOBAL float g_flBotFullThinkInterval = 1.0 / 10.0; // full AI only 10 times per second + + +//-------------------------------------------------------------------------------------------------------------- +CBot::CBot( void ) +{ + // the profile will be attached after this instance is constructed + m_profile = NULL; + + // assign this bot a unique ID + static unsigned int nextID = 1; + + // wraparound (highly unlikely) + if (nextID == 0) + ++nextID; + + m_id = nextID; + ++nextID; + + m_postureStackIndex = 0; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Prepare bot for action + */ +bool CBot::Initialize( const BotProfile *profile ) +{ + m_profile = profile; + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::Spawn( void ) +{ + // Let CBasePlayer set some things up + CBasePlayer::Spawn(); + + // Make sure everyone knows we are a bot + pev->flags |= ( FL_CLIENT | FL_FAKECLIENT ); + + // Bots use their own thinking mechanism + SetThink( NULL ); + pev->nextthink = -1; + + m_flNextBotThink = gpGlobals->time + g_flBotCommandInterval; + m_flNextFullBotThink = gpGlobals->time + g_flBotFullThinkInterval; + m_flPreviousCommandTime = gpGlobals->time; + + m_isRunning = true; + m_isCrouching = false; + m_postureStackIndex = 0; + + m_jumpTimestamp = 0.0f; + + // Command interface variable initialization + ResetCommand(); + + // Allow derived classes to setup at spawn time + SpawnBot(); +} + + +//-------------------------------------------------------------------------------------------------------------- +Vector CBot::GetAutoaimVector( float flDelta ) +{ + UTIL_MakeVectors( pev->v_angle + pev->punchangle ); + + return gpGlobals->v_forward; +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::BotThink( void ) +{ + if ( gpGlobals->time >= m_flNextBotThink ) + { + m_flNextBotThink = gpGlobals->time + g_flBotCommandInterval; + + Upkeep(); + + if ( gpGlobals->time >= m_flNextFullBotThink ) + { + m_flNextFullBotThink = gpGlobals->time + g_flBotFullThinkInterval; + + ResetCommand(); + Update(); + } + + ExecuteCommand(); + } +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::MoveForward( void ) +{ + m_forwardSpeed = GetMoveSpeed(); + SetBits( m_buttonFlags, IN_FORWARD ); + + // make mutually exclusive + ClearBits( m_buttonFlags, IN_BACK ); +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::MoveBackward( void ) +{ + m_forwardSpeed = -GetMoveSpeed(); + SetBits( m_buttonFlags, IN_BACK ); + + // make mutually exclusive + ClearBits( m_buttonFlags, IN_FORWARD ); +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::StrafeLeft( void ) +{ + m_strafeSpeed = -GetMoveSpeed(); + SetBits( m_buttonFlags, IN_MOVELEFT ); + + // make mutually exclusive + ClearBits( m_buttonFlags, IN_MOVERIGHT ); +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::StrafeRight( void ) +{ + m_strafeSpeed = GetMoveSpeed(); + SetBits( m_buttonFlags, IN_MOVERIGHT ); + + // make mutually exclusive + ClearBits( m_buttonFlags, IN_MOVELEFT ); +} + +//-------------------------------------------------------------------------------------------------------------- +bool CBot::Jump( bool mustJump ) +{ + if (IsJumping() || IsCrouching()) + return false; + + if (!mustJump) + { + const float minJumpInterval = 0.9f; // 1.5f; + if (gpGlobals->time - m_jumpTimestamp < minJumpInterval) + return false; + } + + // still need sanity check for jumping frequency + const float sanityInterval = 0.3f; + if (gpGlobals->time - m_jumpTimestamp < sanityInterval) + return false; + + // jump + SetBits( m_buttonFlags, IN_JUMP ); + m_jumpTimestamp = gpGlobals->time; + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Zero any MoveForward(), Jump(), etc + */ +void CBot::ClearMovement( void ) +{ + ResetCommand(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Returns true if we are in the midst of a jump + */ +bool CBot::IsJumping( void ) +{ + // if long time after last jump, we can't be jumping + if (gpGlobals->time - m_jumpTimestamp > 3.0f) + return false; + + // if we just jumped, we're still jumping + if (gpGlobals->time - m_jumpTimestamp < 1.0f) + return true; + + // a little after our jump, we're jumping until we hit the ground + if (FBitSet( pev->flags, FL_ONGROUND )) + return false; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::Crouch( void ) +{ + m_isCrouching = true; +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::StandUp( void ) +{ + m_isCrouching = false; +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::UseEnvironment( void ) +{ + SetBits( m_buttonFlags, IN_USE ); +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::PrimaryAttack( void ) +{ + SetBits( m_buttonFlags, IN_ATTACK ); +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::ClearPrimaryAttack( void ) +{ + ClearBits( m_buttonFlags, IN_ATTACK ); +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::TogglePrimaryAttack( void ) +{ + if (FBitSet( m_buttonFlags, IN_ATTACK )) + { + ClearBits( m_buttonFlags, IN_ATTACK ); + } + else + { + SetBits( m_buttonFlags, IN_ATTACK ); + } +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::SecondaryAttack( void ) +{ + SetBits( m_buttonFlags, IN_ATTACK2 ); +} + +//-------------------------------------------------------------------------------------------------------------- +void CBot::Reload( void ) +{ + SetBits( m_buttonFlags, IN_RELOAD ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Returns ratio of ammo left to max ammo (1 = full clip, 0 = empty) + */ +float CBot::GetActiveWeaponAmmoRatio( void ) const +{ + CBasePlayerWeapon *gun = GetActiveWeapon(); + + if ( !gun ) + return 0.0f; + + // weapons with no ammo are always full + if (gun->m_iClip < 0) + return 1.0f; + + return (float)gun->m_iClip / (float)gun->iMaxClip(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if active weapon has an empty clip + */ +bool CBot::IsActiveWeaponClipEmpty( void ) const +{ + CBasePlayerWeapon *gun = GetActiveWeapon(); + + if (gun && gun->m_iClip == 0) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if active weapon has no ammo at all + */ +bool CBot::IsActiveWeaponOutOfAmmo( void ) const +{ + CBasePlayerWeapon *gun = GetActiveWeapon(); + + if (gun == NULL) + return true; + + if (gun->m_iClip < 0) + return false; + + if (gun->m_iClip == 0 && m_rgAmmo[ gun->m_iPrimaryAmmoType ] <= 0) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if looking thru weapon's scope + */ +bool CBot::IsUsingScope( void ) const +{ + // if our field of view is less than 90, we're looking thru a scope (maybe only true for CS...) + if (m_iFOV < 90.0f) + return true; + + return false; +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::ExecuteCommand( void ) +{ + byte adjustedMSec; + + // Adjust msec to command time interval + adjustedMSec = ThrottledMsec(); + + // player model is "munged" + pev->angles = pev->v_angle; + pev->angles.x /= -3.0; + + // save the command time + m_flPreviousCommandTime = gpGlobals->time; + + if (m_isCrouching) + SetBits( m_buttonFlags, IN_DUCK ); + + // Run the command + (*g_engfuncs.pfnRunPlayerMove)( edict(), pev->v_angle, m_forwardSpeed, m_strafeSpeed, m_verticalSpeed, + m_buttonFlags, 0, adjustedMSec ); +} + + +//-------------------------------------------------------------------------------------------------------------- +void CBot::ResetCommand( void ) +{ + m_forwardSpeed = 0.0; + m_strafeSpeed = 0.0; + m_verticalSpeed = 0.0; + m_buttonFlags = 0; +} + + +//-------------------------------------------------------------------------------------------------------------- +byte CBot::ThrottledMsec( void ) const +{ + int iNewMsec; + + // Estimate Msec to use for this command based on time passed from the previous command + iNewMsec = (int)( (gpGlobals->time - m_flPreviousCommandTime) * 1000 ); + if (iNewMsec > 255) // Doh, bots are going to be slower than they should if this happens. + iNewMsec = 255; // Upgrade that CPU or use less bots! + + return (byte)iNewMsec; +} + +//-------------------------------------------------------------------------------------------------------------- + +// Nasty Hack. See client.cpp/ClientCommand() +const char *BotArgs[4] = { NULL }; +bool UseBotArgs = false; + +/** + * Do a "client command" - useful for invoking menu choices, etc. + */ +void CBot::ClientCommand( const char *cmd, const char *arg1, const char *arg2, const char *arg3 ) +{ + BotArgs[0] = cmd; + BotArgs[1] = arg1; + BotArgs[2] = arg2; + BotArgs[3] = arg3; + + UseBotArgs = true; + ::ClientCommand( ENT( pev ) ); + UseBotArgs = false; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Returns TRUE if given entity is our enemy + */ +bool CBot::IsEnemy( CBaseEntity *ent ) const +{ + // only Players (real and AI) can be enemies + if (!ent->IsPlayer()) + return false; + + // corpses are no threat + if (!ent->IsAlive()) + return false; + + CBasePlayer *player = static_cast( ent ); + + // if they are on our team, they are our friends + if (player->m_iTeam == m_iTeam) + return false; + + // yep, we hate 'em + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return number of enemies left alive + */ +int CBot::GetEnemiesRemaining( void ) const +{ + int count = 0; + + for ( int i = 1; i <= gpGlobals->maxClients; ++i ) + { + CBaseEntity *player = UTIL_PlayerByIndex( i ); + + if (player == NULL) + continue; + + if (FNullEnt( player->pev )) + continue; + + if (FStrEq( STRING( player->pev->netname ), "" )) + continue; + + if (!IsEnemy( player )) + continue; + + if (!player->IsAlive()) + continue; + + count++; + } + + return count; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return number of friends left alive + */ +int CBot::GetFriendsRemaining( void ) const +{ + int count = 0; + + for ( int i = 1; i <= gpGlobals->maxClients; ++i ) + { + CBaseEntity *player = UTIL_PlayerByIndex( i ); + + if (player == NULL) + continue; + + if (FNullEnt( player->pev )) + continue; + + if (FStrEq( STRING( player->pev->netname ), "" )) + continue; + + if (IsEnemy( player )) + continue; + + if (!player->IsAlive()) + continue; + + if (player == static_cast( const_cast( this ) )) + continue; + + count++; + } + + return count; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if the local player is currently in observer mode watching this bot. + */ +bool CBot::IsLocalPlayerWatchingMe( void ) const +{ + // avoid crash during spawn + if (pev == NULL) + return false; + + int myIndex = const_cast(this)->entindex(); + + CBasePlayer *player = UTIL_GetLocalPlayer(); + if (player == NULL) + return false; + + if (player->pev->flags & FL_SPECTATOR || player->m_iTeam == SPECTATOR) + { + if (player->pev->iuser2 == myIndex) + { + switch( player->pev->iuser1 ) + { + case OBS_IN_EYE: + case OBS_CHASE_LOCKED: + case OBS_CHASE_FREE: + return true; + } + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Output message to console + */ +void CBot::Print( char *format, ... ) const +{ + va_list varg; + char buffer[1024]; + + // prefix the message with the bot's name + sprintf( buffer, "%s: ", STRING(pev->netname) ); + (*g_engfuncs.pfnServerPrint)( buffer ); + + va_start( varg, format ); + vsprintf( buffer, format, varg ); + va_end( varg ); + + (*g_engfuncs.pfnServerPrint)( buffer ); +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Output message to console if we are being watched by the local player + */ +void CBot::PrintIfWatched( char *format, ... ) const +{ + if (cv_bot_debug.value == 0) + return; + + if ((IsLocalPlayerWatchingMe() && (cv_bot_debug.value == 1 || cv_bot_debug.value == 3)) || + (cv_bot_debug.value == 2 || cv_bot_debug.value == 4)) + { + va_list varg; + char buffer[1024]; + + // prefix the message with the bot's name (this can be NULL if bot was just added) + const char *name; + if (pev == NULL) + name = "(NULL pev)"; + else + name = STRING(pev->netname); + sprintf( buffer, "%s: ", (name) ? name : "(NULL netname)" ); + (*g_engfuncs.pfnServerPrint)( buffer ); + + va_start( varg, format ); + vsprintf( buffer, format, varg ); + va_end( varg ); + + (*g_engfuncs.pfnServerPrint)( buffer ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------------------------------- + +ActiveGrenade::ActiveGrenade( int weaponID, CGrenade *grenadeEntity ) +{ + m_id = weaponID; + m_entity = grenadeEntity; + m_detonationPosition = grenadeEntity->pev->origin; + m_dieTimestamp = 0.0f; +} + +//-------------------------------------------------------------------------------------------------------------- +void ActiveGrenade::OnEntityGone( void ) ///< called when the grenade in the world goes away +{ + if (m_id == WEAPON_SMOKEGRENADE) + { + // smoke lingers after grenade is gone + const float smokeLingerTime = 4.0f; + m_dieTimestamp = gpGlobals->time + smokeLingerTime; + } + + m_entity = NULL; +} + +//-------------------------------------------------------------------------------------------------------------- +bool ActiveGrenade::IsValid( void ) const ///< return true if this grenade is valid +{ + if (m_entity) + return true; + + if (gpGlobals->time > m_dieTimestamp) + return false; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +const Vector *ActiveGrenade::GetPosition( void ) const +{ + return &m_entity->pev->origin; +} + diff --git a/game_shared/bot/bot.h b/game_shared/bot/bot.h new file mode 100644 index 0000000..ca6fc4c --- /dev/null +++ b/game_shared/bot/bot.h @@ -0,0 +1,386 @@ +//========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef BOT_H +#define BOT_H + +#if !defined ( _WIN32 ) +#define MAX_OSPATH PATH_MAX +#else +// stolen from quakedef.h +#define MAX_OSPATH 260 +#endif + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "player.h" + +#include "bot_manager.h" +#include "bot_util.h" +#include "bot_constants.h" + +extern DLL_GLOBAL float g_flBotCommandInterval; +extern DLL_GLOBAL float g_flBotFullThinkInterval; + +extern DLL_GLOBAL CBotManager *TheBots; + +class BotProfile; + + +//-------------------------------------------------------------------------------------------------------- +template T * CreateBot( const BotProfile *profile ) +{ + edict_t * pentBot; + + if ( UTIL_ClientsInGame() >= gpGlobals->maxClients ) + { + CONSOLE_ECHO( "Unable to create bot: Server is full (%d/%d clients).\n", UTIL_ClientsInGame(), gpGlobals->maxClients ); + return NULL; + } + + char netname[64]; + + UTIL_ConstructBotNetName(netname, 64, profile); + + pentBot = CREATE_FAKE_CLIENT( netname ); + + if ( FNullEnt( pentBot ) ) + { + CONSOLE_ECHO( "Unable to create bot: pfnCreateFakeClient() returned null.\n" ); + return NULL; + } + else + { + T * pBot = NULL; + + FREE_PRIVATE( pentBot ); + pBot = GetClassPtr( (T *)VARS( pentBot ) ); + + // initialize the bot + pBot->Initialize( profile ); + + return pBot; + } +} + +//---------------------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------------- +/** + * The base bot class from which bots for specific games are derived + */ +class CBot : public CBasePlayer +{ +public: + CBot( void ); ///< constructor initializes all values to zero + virtual bool Initialize( const BotProfile *profile ); ///< (EXTEND) prepare bot for action + + unsigned int GetID( void ) const { return m_id; } ///< return bot's unique ID + + virtual BOOL IsBot( void ) { return true; } + + virtual void SpawnBot( void ) = 0; + virtual void Upkeep( void ) = 0; ///< lightweight maintenance, invoked frequently + virtual void Update( void ) = 0; ///< heavyweight algorithms, invoked less often + + + virtual void Run( void ); + virtual void Walk( void ); + bool IsRunning( void ) const { return m_isRunning; } + + virtual void Crouch( void ); + virtual void StandUp( void ); + bool IsCrouching( void ) const { return m_isCrouching; } + + void PushPostureContext( void ); ///< push the current posture context onto the top of the stack + void PopPostureContext( void ); ///< restore the posture context to the next context on the stack + + virtual void MoveForward( void ); + virtual void MoveBackward( void ); + virtual void StrafeLeft( void ); + virtual void StrafeRight( void ); + + #define MUST_JUMP true + virtual bool Jump( bool mustJump = false ); ///< returns true if jump was started + bool IsJumping( void ); ///< returns true if we are in the midst of a jump + float GetJumpTimestamp( void ) const { return m_jumpTimestamp; } ///< return time last jump began + + virtual void ClearMovement( void ); ///< zero any MoveForward(), Jump(), etc + + //------------------------------------------------------------------------------------ + // Weapon interface + // + virtual void UseEnvironment( void ); + virtual void PrimaryAttack( void ); + virtual void ClearPrimaryAttack( void ); + virtual void TogglePrimaryAttack( void ); + virtual void SecondaryAttack( void ); + virtual void Reload( void ); + + float GetActiveWeaponAmmoRatio( void ) const; ///< returns ratio of ammo left to max ammo (1 = full clip, 0 = empty) + bool IsActiveWeaponClipEmpty( void ) const; ///< return true if active weapon has any empty clip + bool IsActiveWeaponOutOfAmmo( void ) const; ///< return true if active weapon has no ammo at all + bool IsActiveWeaponReloading( void ) const; ///< is the weapon in the middle of a reload + bool IsActiveWeaponRecoilHigh( void ) const; ///< return true if active weapon's bullet spray has become large and inaccurate + CBasePlayerWeapon *GetActiveWeapon( void ) const; ///< return the weapon the bot is currently using + bool IsUsingScope( void ) const; ///< return true if looking thru weapon's scope + + + //------------------------------------------------------------------------------------ + // Event hooks + // + + /// invoked when injured by something (EXTEND) + virtual int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ) + { + return CBasePlayer::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType ); + } + + /// invoked when killed (EXTEND) + virtual void Killed( entvars_t *pevAttacker, int iGib ) + { + CBasePlayer::Killed( pevAttacker, iGib ); + } + + virtual void OnTouchingWeapon( CWeaponBox *box ) { } ///< invoked when in contact with a CWeaponBox + + /// invoked when event occurs in the game (some events have NULL entities) + virtual void OnEvent( GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL ) { } + + //------------------------------------------------------------------------------------ + // Vision + // + + enum VisiblePartType + { + NONE = 0x00, + CHEST = 0x01, + HEAD = 0x02, + LEFT_SIDE = 0x04, ///< the left side of the object from our point of view (not their left side) + RIGHT_SIDE = 0x08, ///< the right side of the object from our point of view (not their right side) + FEET = 0x10 + }; + + #define CHECK_FOV true + virtual bool IsVisible( const Vector *pos, bool testFOV = false ) const = 0; ///< return true if we can see the point + virtual bool IsVisible( CBasePlayer *player, bool testFOV = false, unsigned char *visParts = NULL ) const = 0; ///< return true if we can see any part of the player + + virtual bool IsEnemyPartVisible( VisiblePartType part ) const = 0; ///< if enemy is visible, return the part we see + + virtual bool IsPlayerFacingMe( CBasePlayer *enemy ) const; ///< return true if player is facing towards us + virtual bool IsPlayerLookingAtMe( CBasePlayer *enemy ) const; ///< returns true if other player is pointing right at us + + + //------------------------------------------------------------------------------------ + // Information query + // + + bool IsEnemy( CBaseEntity *ent ) const; ///< returns TRUE if given entity is our enemy + int GetEnemiesRemaining( void ) const; ///< return number of enemies left alive + int GetFriendsRemaining( void ) const; ///< return number of friends left alive + + bool IsLocalPlayerWatchingMe( void ) const; ///< return true if local player is observing this bot + + void Print( char *format, ... ) const; ///< output message to console + void PrintIfWatched( char *format, ... ) const; ///< output message to console if we are being watched by the local player + + virtual void ExecuteCommand( void ); + virtual void SetModel( const char *modelName ); + virtual Vector GetAutoaimVector( float delta ); + + void Spawn( void ); + void BotThink( void ); + bool IsNetClient( void ) const { return FALSE; } + int Save( CSave &save ) const { return 0; } + int Restore( CRestore &restore ) const { return 0; } + virtual void Think( void ) { } + + const BotProfile *GetProfile( void ) const { return m_profile; } ///< return our personality profile + +protected: + // Do a "client command" - useful for invoking menu choices, etc. + void ClientCommand( const char *cmd, const char *arg1 = NULL, const char *arg2 = NULL, const char *arg3 = NULL ); + + const BotProfile *m_profile; ///< the "personality" profile of this bot + +private: + unsigned int m_id; ///< unique bot ID + + // Think mechanism variables + float m_flNextBotThink; + float m_flNextFullBotThink; + + // Command interface variables + float m_flPreviousCommandTime; + + bool m_isRunning; ///< run/walk mode + bool m_isCrouching; ///< true if crouching (ducking) + float m_forwardSpeed; + float m_strafeSpeed; + float m_verticalSpeed; + unsigned short m_buttonFlags; ///< bitfield of movement buttons + + float m_jumpTimestamp; ///< time when we last began a jump + + /// the PostureContext represents the current settings of walking and crouching + struct PostureContext + { + bool isRunning; + bool isCrouching; + }; + enum { MAX_POSTURE_STACK = 8 }; + PostureContext m_postureStack[ MAX_POSTURE_STACK ]; + int m_postureStackIndex; ///< index of top of stack + + void ResetCommand( void ); + byte ThrottledMsec( void ) const; + + float GetMoveSpeed( void ); ///< returns current movement speed (for walk/run) +}; + + +//----------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------- +// +// Inlines +// + +//-------------------------------------------------------------------------------------------------------------- +inline void CBot::SetModel( const char *modelName ) +{ + SET_CLIENT_KEY_VALUE( entindex(), GET_USERINFO(edict()), "model", (char *)modelName ); +} + +//----------------------------------------------------------------------------------------------------------- +inline float CBot::GetMoveSpeed( void ) +{ + if (m_isRunning || m_isCrouching) + return pev->maxspeed; + + // should be 0.52, but when bots strafe, they break the run/walk threshold + return 0.4f * pev->maxspeed; +} + +//----------------------------------------------------------------------------------------------------------- +inline void CBot::Run( void ) +{ + m_isRunning = true; +} + +//----------------------------------------------------------------------------------------------------------- +inline void CBot::Walk( void ) +{ + m_isRunning = false; +} + +//----------------------------------------------------------------------------------------------------------- +inline CBasePlayerWeapon *CBot::GetActiveWeapon( void ) const +{ + return static_cast( m_pActiveItem ); +} + +//----------------------------------------------------------------------------------------------------------- +inline bool CBot::IsActiveWeaponReloading( void ) const +{ + CBasePlayerWeapon *gun = GetActiveWeapon(); + if (gun == NULL) + return false; + + return (gun->m_fInReload || gun->m_fInSpecialReload) ? true : false; +} + +//----------------------------------------------------------------------------------------------------------- +inline bool CBot::IsActiveWeaponRecoilHigh( void ) const +{ + CBasePlayerWeapon *gun = GetActiveWeapon(); + if (gun == NULL) + return false; + + const float highRecoil = 0.4f; + return (gun->m_flAccuracy > highRecoil) ? true : false; +} + +//----------------------------------------------------------------------------------------------------------- +inline void CBot::PushPostureContext( void ) +{ + if (m_postureStackIndex == MAX_POSTURE_STACK) + { + if (pev) + PrintIfWatched( "PushPostureContext() overflow error!\n" ); + return; + } + + m_postureStack[ m_postureStackIndex ].isRunning = m_isRunning; + m_postureStack[ m_postureStackIndex ].isCrouching = m_isCrouching; + ++m_postureStackIndex; +} + +//----------------------------------------------------------------------------------------------------------- +inline void CBot::PopPostureContext( void ) +{ + if (m_postureStackIndex == 0) + { + if (pev) + PrintIfWatched( "PopPostureContext() underflow error!\n" ); + m_isRunning = true; + m_isCrouching = false; + return; + } + + --m_postureStackIndex; + m_isRunning = m_postureStack[ m_postureStackIndex ].isRunning; + m_isCrouching = m_postureStack[ m_postureStackIndex ].isCrouching; +} + +//----------------------------------------------------------------------------------------------------------- +inline bool CBot::IsPlayerFacingMe( CBasePlayer *other ) const +{ + Vector toOther = other->pev->origin - pev->origin; + + // compute the unit vector along our other player's + UTIL_MakeVectors( other->pev->v_angle + other->pev->punchangle ); + Vector otherDir = gpGlobals->v_forward; + + if (otherDir.x * toOther.x + otherDir.y * toOther.y < 0.0f) + return true; + + return false; +} + +//----------------------------------------------------------------------------------------------------------- +inline bool CBot::IsPlayerLookingAtMe( CBasePlayer *other ) const +{ + Vector toOther = other->pev->origin - pev->origin; + toOther.NormalizeInPlace(); + + // compute the unit vector along our other player's + UTIL_MakeVectors( other->pev->v_angle + other->pev->punchangle ); + Vector otherDir = gpGlobals->v_forward; + + // other player must be pointing nearly right at us to be "looking at" us + const float lookAtCos = 0.9f; + if (otherDir.x * toOther.x + otherDir.y * toOther.y < -lookAtCos) + { + // other player must have clear line of sight to us to be "looking at" us + Vector vec(other->EyePosition()); + if (IsVisible( &vec )) + return true; + } + + return false; +} + + +//----------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------- + +extern void InstallBotControl( void ); +extern void Bot_ServerCommand( void ); +extern void Bot_RegisterCvars( void ); + + +#endif // BOT_H diff --git a/game_shared/bot/bot_constants.h b/game_shared/bot/bot_constants.h new file mode 100644 index 0000000..582e311 --- /dev/null +++ b/game_shared/bot/bot_constants.h @@ -0,0 +1,46 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Matthew D. Campbell (matt@turtlerockstudios.com), 2003 + +#ifndef BOT_CONSTANTS_H +#define BOT_CONSTANTS_H + +// +// We'll define our own version of this, because everyone else does. :P +// This needs to stay in sync with MAX_CLIENTS, but there's no header with the #define. Nice. +// +#define BOT_MAX_CLIENTS 32 + +/// version number is MAJOR.MINOR +#define BOT_VERSION_MAJOR 1 +#define BOT_VERSION_MINOR 50 + +//-------------------------------------------------------------------------------------------------------- +/** + * Difficulty levels + */ +enum BotDifficultyType +{ + BOT_EASY = 0, + BOT_NORMAL = 1, + BOT_HARD = 2, + BOT_EXPERT = 3, + + NUM_DIFFICULTY_LEVELS +}; + +#ifdef DEFINE_DIFFICULTY_NAMES + char *BotDifficultyName[] = + { + "EASY", "NORMAL", "HARD", "EXPERT", NULL + }; +#else + extern char *BotDifficultyName[]; +#endif + +#endif // BOT_CONSTANTS_H diff --git a/game_shared/bot/bot_manager.cpp b/game_shared/bot/bot_manager.cpp new file mode 100644 index 0000000..0e90920 --- /dev/null +++ b/game_shared/bot/bot_manager.cpp @@ -0,0 +1,474 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Michael S. Booth (mike@turtlerockstudios.com), 2003 + +#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning + +#define DEFINE_EVENT_NAMES + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "weapons.h" +#include "soundent.h" +#include "gamerules.h" +#include "player.h" +#include "client.h" +#include "perf_counter.h" + +#include "bot.h" +#include "bot_manager.h" +#include "nav_area.h" +#include "bot_util.h" +#include "hostage.h" + +#include "tutor.h" + +const float smokeRadius = 115.0f; ///< for smoke grenades + + +//#define CHECK_PERFORMANCE +#ifdef CHECK_PERFORMANCE + // crude performance timing + static CPerformanceCounter perfCounter; + + struct PerfInfo + { + float frameTime; + float botThinkTime; + }; + + #define MAX_PERF_DATA 50000 + static PerfInfo perfData[ MAX_PERF_DATA ]; + static int perfDataCount = 0; + static int perfFileIndex = 0; +#endif + + + +/** + * Convert name to GameEventType + * @todo Find more appropriate place for this function + */ +GameEventType NameToGameEvent( const char *name ) +{ + for( int i=0; GameEventName[i]; ++i ) + if (!stricmp( GameEventName[i], name )) + return static_cast( i ); + + return EVENT_INVALID; +} + + +//-------------------------------------------------------------------------------------------------------------- +CBotManager::CBotManager() +{ + InitBotTrig(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Invoked when the round is restarting + */ +void CBotManager::RestartRound( void ) +{ +#ifdef CHECK_PERFORMANCE + // dump previous round's performance + char filename[80]; + sprintf( filename, "perfdata%02X.txt", perfFileIndex++ ); + FILE *fp = fopen( filename, "w" ); + + if (fp) + { + for( int p=0; pIsValid()) + { + delete ag; + iter = m_activeGrenadeList.erase( iter ); + continue; + } + else + { + ++iter; + } + + const Vector *pos = ag->GetDetonationPosition(); + + UTIL_DrawBeamPoints( *pos, *pos + Vector( 0, 0, 50 ), 1, 255, 100, 0 ); + + lastEdge = Vector( smokeRadius + pos->x, pos->y, pos->z ); + float angle; + for( angle=0.0f; angle <= 180.0f; angle += 22.5f ) + { + edge.x = smokeRadius * BotCOS( angle ) + pos->x; + edge.y = pos->y; + edge.z = smokeRadius * BotSIN( angle ) + pos->z; + + UTIL_DrawBeamPoints( edge, lastEdge, 1, 255, 50, 0 ); + + lastEdge = edge; + } + + lastEdge = Vector( pos->x, smokeRadius + pos->y, pos->z ); + for( angle=0.0f; angle <= 180.0f; angle += 22.5f ) + { + edge.x = pos->x; + edge.y = smokeRadius * BotCOS( angle ) + pos->y; + edge.z = smokeRadius * BotSIN( angle ) + pos->z; + + UTIL_DrawBeamPoints( edge, lastEdge, 1, 255, 50, 0 ); + + lastEdge = edge; + } + } + } + + + // + // Process each active bot + // + +#ifdef CHECK_PERFORMANCE + static double lastTime = 0.0f; + double startTime = perfCounter.GetCurTime(); +#endif + + for( int i = 1; i <= gpGlobals->maxClients; ++i ) + { + CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i ); + + if (!pPlayer) + continue; + + if (pPlayer->IsBot() && IsEntityValid( pPlayer )) + { + CBot *pBot = static_cast( pPlayer ); + + pBot->BotThink(); + } + } + +#ifdef CHECK_PERFORMANCE + if (perfDataCount < MAX_PERF_DATA) + { + if (lastTime > 0.0f) + { + double endTime = perfCounter.GetCurTime(); + + perfData[ perfDataCount ].frameTime = (float)(startTime - lastTime); + perfData[ perfDataCount ].botThinkTime = (float)(endTime - startTime); + ++perfDataCount; + } + + lastTime = startTime; + } +#endif +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the filename for this map's "nav map" file + */ +const char *CBotManager::GetNavMapFilename( void ) const +{ + static char filename[256]; + sprintf( filename, "maps\\%s.nav", STRING( gpGlobals->mapname ) ); + return filename; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Invoked when given player does given event (some events have NULL player). + * Events are propogated to all bots. + * + * @todo This has become the game-wide event dispatcher. We should restructure this. + */ +void CBotManager::OnEvent( GameEventType event, CBaseEntity *entity, CBaseEntity *other ) +{ + // propogate event to all bots + for ( int i=1; i <= gpGlobals->maxClients; ++i ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (player == NULL) + continue; + + if (FNullEnt( player->pev )) + continue; + + if (FStrEq( STRING( player->pev->netname ), "" )) + continue; + + if (!player->IsBot()) + continue; + + // do not send self-generated event + if (entity == player) + continue; + + CBot *bot = static_cast( player ); + bot->OnEvent( event, entity, other ); + } + + if (TheTutor) + TheTutor->OnEvent( event, entity, other ); + + if (g_pHostages) + g_pHostages->OnEvent( event, entity, other ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Add an active grenade to the bot's awareness + */ +void CBotManager::AddGrenade( int type, CGrenade *grenade ) +{ + ActiveGrenade *ag = new ActiveGrenade( type, grenade ); + m_activeGrenadeList.push_back( ag ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * The grenade entity in the world is going away + */ +void CBotManager::RemoveGrenade( CGrenade *grenade ) +{ + for( ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); iter != m_activeGrenadeList.end(); ++iter ) + { + ActiveGrenade *ag = *iter; + + if (ag->IsEntity( grenade )) + { + ag->OnEntityGone(); + return; + } + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Destroy any invalid active grenades + */ +void CBotManager::ValidateActiveGrenades( void ) +{ + ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); + while( iter != m_activeGrenadeList.end() ) + { + ActiveGrenade *ag = *iter; + + if (!ag->IsValid()) + { + delete ag; + iter = m_activeGrenadeList.erase( iter ); + } + else + { + ++iter; + } + } +} + +//-------------------------------------------------------------------------------------------------------------- +void CBotManager::DestroyAllGrenades( void ) +{ + for( ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); iter != m_activeGrenadeList.end(); ++iter ) + delete *iter; + + m_activeGrenadeList.clear(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if position is inside a smoke cloud + */ +bool CBotManager::IsInsideSmokeCloud( const Vector *pos ) +{ + ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); + while( iter != m_activeGrenadeList.end() ) + { + ActiveGrenade *ag = *iter; + + // lazy validation + if (!ag->IsValid()) + { + delete ag; + iter = m_activeGrenadeList.erase( iter ); + continue; + } + else + { + ++iter; + } + + if (ag->GetID() == WEAPON_SMOKEGRENADE) + { + const Vector *smokeOrigin = ag->GetDetonationPosition(); + + if ((*smokeOrigin - *pos).IsLengthLessThan( smokeRadius )) + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if line intersects smoke volume + * Determine the length of the line of sight covered by each smoke cloud, + * and sum them (overlap is additive for obstruction). + * If the overlap exceeds the threshold, the bot can't see through. + */ +bool CBotManager::IsLineBlockedBySmoke( const Vector *from, const Vector *to ) +{ + const float smokeRadiusSq = smokeRadius * smokeRadius; + float totalSmokedLength = 0.0f; // distance along line of sight covered by smoke + + // compute unit vector and length of line of sight segment + Vector sightDir = *to - *from; + float sightLength = sightDir.NormalizeInPlace(); + + + ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); + while( iter != m_activeGrenadeList.end() ) + { + ActiveGrenade *ag = *iter; + + // lazy validation + if (!ag->IsValid()) + { + delete ag; + iter = m_activeGrenadeList.erase( iter ); + continue; + } + else + { + ++iter; + } + + if (ag->GetID() == WEAPON_SMOKEGRENADE) + { + const Vector *smokeOrigin = ag->GetDetonationPosition(); + + Vector toGrenade = *smokeOrigin - *from; + + float alongDist = DotProduct( toGrenade, sightDir ); + + // compute closest point to grenade along line of sight ray + Vector close; + + // constrain closest point to line segment + if (alongDist < 0.0f) + close = *from; + else if (alongDist >= sightLength) + close = *to; + else + close = *from + sightDir * alongDist; + + // if closest point is within smoke radius, the line overlaps the smoke cloud + Vector toClose = close - *smokeOrigin; + float lengthSq = toClose.LengthSquared(); + + if (lengthSq < smokeRadiusSq) + { + // some portion of the ray intersects the cloud + + float fromSq = toGrenade.LengthSquared(); + float toSq = (*smokeOrigin - *to).LengthSquared(); + + if (fromSq < smokeRadiusSq) + { + if (toSq < smokeRadiusSq) + { + // both 'from' and 'to' lie within the cloud + // entire length is smoked + totalSmokedLength += (*to - *from).Length(); + } + else + { + // 'from' is inside the cloud, 'to' is outside + // compute half of total smoked length as if ray crosses entire cloud chord + float halfSmokedLength = sqrt( smokeRadiusSq - lengthSq ); + + if (alongDist > 0.0f) + { + // ray goes thru 'close' + totalSmokedLength += halfSmokedLength + (close - *from).Length(); + } + else + { + // ray starts after 'close' + totalSmokedLength += halfSmokedLength - (close - *from).Length(); + } + + } + } + else if (toSq < smokeRadiusSq) + { + // 'from' is outside the cloud, 'to' is inside + // compute half of total smoked length as if ray crosses entire cloud chord + float halfSmokedLength = sqrt( smokeRadiusSq - lengthSq ); + + Vector v = *to - *smokeOrigin; + if (DotProduct( v, sightDir ) > 0.0f) + { + // ray goes thru 'close' + totalSmokedLength += halfSmokedLength + (close - *to).Length(); + } + else + { + // ray ends before 'close' + totalSmokedLength += halfSmokedLength - (close - *to).Length(); + } + } + else + { + // 'from' and 'to' lie outside of the cloud - the line of sight completely crosses it + // determine the length of the chord that crosses the cloud + float smokedLength = 2.0f * sqrt( smokeRadiusSq - lengthSq ); + + totalSmokedLength += smokedLength; + } + } + } + } + + // define how much smoke a bot can see thru + const float maxSmokedLength = 0.7f * smokeRadius; + + // return true if the total length of smoke-covered line-of-sight is too much + return (totalSmokedLength > maxSmokedLength); +} diff --git a/game_shared/bot/bot_manager.h b/game_shared/bot/bot_manager.h new file mode 100644 index 0000000..b82db71 --- /dev/null +++ b/game_shared/bot/bot_manager.h @@ -0,0 +1,107 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Michael S. Booth (mike@turtlerockstudios.com), 2003 + +#ifndef BASE_CONTROL_H +#define BASE_CONTROL_H + +#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning + +#include "extdll.h" +#include "util.h" +#include +#include "GameEvent.h" // Game event enum used by career mode, tutor system, and bots + +#ifndef _WIN32 +// DAL undefs max and min +#ifndef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) ((a) < (b) ? (a) : (b)) +#endif +#endif + + +class CNavArea; + + +//-------------------------------------------------------------------------------------------------------------- +class CGrenade; + +/** + * An ActiveGrenade is a representation of a grenade in the world + * NOTE: Currently only used for smoke grenade line-of-sight testing + * @todo Use system allow bots to avoid HE and Flashbangs + */ +class ActiveGrenade +{ +public: + ActiveGrenade( int weaponID, CGrenade *grenadeEntity ); + + void OnEntityGone( void ); ///< called when the grenade in the world goes away + bool IsValid( void ) const ; ///< return true if this grenade is valid + bool IsEntity( CGrenade *grenade ) const { return (grenade == m_entity) ? true : false; } + int GetID( void ) const { return m_id; } + const Vector *GetDetonationPosition( void ) const { return &m_detonationPosition; } + const Vector *GetPosition( void ) const; + +private: + int m_id; ///< weapon id + CGrenade *m_entity; ///< the entity + Vector m_detonationPosition; ///< the location where the grenade detonated (smoke) + float m_dieTimestamp; ///< time this should go away after m_entity is NULL +}; + +typedef std::list ActiveGrenadeList; + + +//-------------------------------------------------------------------------------------------------------------- +/** + * This class manages all active bots, propagating events to them and updating them. + */ +class CBotManager +{ +public: + CBotManager(); + + virtual void ClientDisconnect( CBasePlayer * pPlayer ) = 0; + virtual BOOL ClientCommand( CBasePlayer * pPlayer, const char * pcmd ) = 0; + + virtual void ServerActivate( void ) = 0; + virtual void ServerDeactivate( void ) = 0; + virtual void ServerCommand( const char * pcmd ) = 0; + virtual void AddServerCommand( const char *cmd ) = 0; + virtual void AddServerCommands( void ) = 0; + + virtual void RestartRound( void ); ///< (EXTEND) invoked when a new round begins + virtual void StartFrame( void ); ///< (EXTEND) called each frame + + const char *GetNavMapFilename( void ) const; ///< return the filename for this map's "nav" file + + /** + * Invoked when event occurs in the game (some events have NULL entity). + * Events are propogated to all bots. + */ + virtual void OnEvent( GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL ); + + virtual unsigned int GetPlayerPriority( CBasePlayer *player ) const = 0; ///< return priority of player (0 = max pri) + + + void AddGrenade( int type, CGrenade *grenade ); ///< add an active grenade to the bot's awareness + void RemoveGrenade( CGrenade *grenade ); ///< the grenade entity in the world is going away + void ValidateActiveGrenades( void ); ///< destroy any invalid active grenades + void DestroyAllGrenades( void ); + bool IsLineBlockedBySmoke( const Vector *from, const Vector *to ); ///< return true if line intersects smoke volume + bool IsInsideSmokeCloud( const Vector *pos ); ///< return true if position is inside a smoke cloud + +private: + ActiveGrenadeList m_activeGrenadeList;///< the list of active grenades the bots are aware of +}; + +#endif diff --git a/game_shared/bot/bot_profile.cpp b/game_shared/bot/bot_profile.cpp new file mode 100644 index 0000000..d9d7b3d --- /dev/null +++ b/game_shared/bot/bot_profile.cpp @@ -0,0 +1,703 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Michael S. Booth (mike@turtlerockstudios.com), 2003 + +#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning + +#define DEFINE_DIFFICULTY_NAMES +#include "bot_profile.h" +#include "shared_util.h" +#include "simple_checksum.h" + +BotProfileManager *TheBotProfiles = NULL; + +//-------------------------------------------------------------------------------------------------------------- +// A little explanation is in order here. This file is in game_shared. It is supposed to be able to be compiled +// into multiple dlls. However, all the basic utility functions (loading files, parsing strings, etc) are +// accessed different ways in different dlls. To combat this, we need to redirect some calls depending on +// the dll we're in. +#ifdef GAMEUI_EXPORTS + #include "../GameUI/EngineInterface.h" + #include "../cstrike/dlls/weapontype.h" + #include "../cstrike/dlls/weapontype.cpp" /// @TODO: remove this CStrike peculiarity from a game_shared file!!! + void Career_Printf(const char *fmt, ...); + #define CONSOLE_ECHO Career_Printf + #define LOAD_FILE_FOR_ME(name, len) (engine->COM_LoadFile( (name), 5, (len) )) + #define FREE_FILE (engine->COM_FreeFile) + #define UTIL_IsGame( x ) 0 +#else + #include "extdll.h" + #include "util.h" + #include "cbase.h" + #include "weapons.h" + #include "soundent.h" + #include "gamerules.h" + #include "player.h" + #include "client.h" + #include "cmd.h" + #include "pm_shared.h" + #include "bot.h" + #include "bot_util.h" +#endif + +//-------------------------------------------------------------------------------------------------------- +/** + * Generates a filename-decorated skin name + */ +static const char * GetDecoratedSkinName( const char *name, const char *filename ) +{ +#ifdef _WIN32 + const int BufLen = _MAX_PATH + 64; +#else + const int BufLen = MAX_PATH + 64; +#endif + static char buf[BufLen]; + snprintf( buf, BufLen, "%s/%s", filename, name ); + return buf; +} + +//-------------------------------------------------------------------------------------------------------------- +const char* BotProfile::GetWeaponPreferenceAsString( int i ) const +{ + if ( i < 0 || i >= m_weaponPreferenceCount ) + return NULL; + + return WeaponIDToAlias( m_weaponPreference[ i ] ); +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if this profile has a primary weapon preference + */ +bool BotProfile::HasPrimaryPreference( void ) const +{ + for( int i=0; i( filename ), &dataLength ); + const char *dataFile = dataPointer; + + if (dataFile == NULL) + { + if ( UTIL_IsGame( "czero" ) ) + { + CONSOLE_ECHO( "WARNING: Cannot access bot profile database '%s'\n", filename ); + } + return; + } + + // compute simple checksum + if (checksum) + { + *checksum = ComputeSimpleChecksum( (const unsigned char *)dataPointer, dataLength ); + } + + // keep list of templates used for inheritance + BotProfileList templateList; + + BotProfile defaultProfile; + + // + // Parse the BotProfile.db into BotProfile instances + // + while( true ) + { + dataFile = SharedParse( dataFile ); + if (!dataFile) + break; + + char *token = SharedGetToken(); + + bool isDefault = (!stricmp( token, "Default" )); + bool isTemplate = (!stricmp( token, "Template" )); + bool isCustomSkin = (!stricmp( token, "Skin" )); + + if ( isCustomSkin ) + { + const int BufLen = 64; + char skinName[BufLen]; + + // get skin name + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected skin name\n", filename ); + FREE_FILE( dataPointer ); + return; + } + token = SharedGetToken(); + snprintf( skinName, BufLen, "%s", token ); + + // get attribute name + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected 'Model'\n", filename ); + FREE_FILE( dataPointer ); + return; + } + token = SharedGetToken(); + if (stricmp( "Model", token )) + { + CONSOLE_ECHO( "Error parsing %s - expected 'Model'\n", filename ); + FREE_FILE( dataPointer ); + return; + } + + // eat '=' + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected '='\n", filename ); + FREE_FILE( dataPointer ); + return; + } + token = SharedGetToken(); + if (strcmp( "=", token )) + { + CONSOLE_ECHO( "Error parsing %s - expected '='\n", filename ); + FREE_FILE( dataPointer ); + return; + } + + // get attribute value + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected attribute value\n", filename ); + FREE_FILE( dataPointer ); + return; + } + token = SharedGetToken(); + + const char *decoratedName = GetDecoratedSkinName( skinName, filename ); + bool skinExists = GetCustomSkinIndex( decoratedName ) > 0; + if ( m_nextSkin < NumCustomSkins && !skinExists ) + { + // decorate the name + m_skins[ m_nextSkin ] = CloneString( decoratedName ); + + // construct the model filename + m_skinModelnames[ m_nextSkin ] = CloneString( token ); + m_skinFilenames[ m_nextSkin ] = new char[ strlen(token)*2 + strlen("models/player//.mdl") + 1 ]; + sprintf( m_skinFilenames[ m_nextSkin ], "models/player/%s/%s.mdl", token, token ); + ++m_nextSkin; + } + + // eat 'End' + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected 'End'\n", filename ); + FREE_FILE( dataPointer ); + return; + } + token = SharedGetToken(); + if (strcmp( "End", token )) + { + CONSOLE_ECHO( "Error parsing %s - expected 'End'\n", filename ); + FREE_FILE( dataPointer ); + return; + } + + continue; // it's just a custom skin - no need to do inheritance on a bot profile, etc. + } + + // encountered a new profile + BotProfile *profile; + + if (isDefault) + { + profile = &defaultProfile; + } + else + { + profile = new BotProfile; + + // always inherit from Default + *profile = defaultProfile; + } + + // do inheritance in order of appearance + if (!isTemplate && !isDefault) + { + const BotProfile *inherit = NULL; + + // template names are separated by "+" + while(true) + { + char *c = strchr( token, '+' ); + if (c) + *c = '\000'; + + // find the given template name + for( BotProfileList::iterator iter = templateList.begin(); iter != templateList.end(); ++iter ) + { + if (!stricmp( (*iter)->GetName(), token )) + { + inherit = *iter; + break; + } + } + + if (inherit == NULL) + { + CONSOLE_ECHO( "Error parsing '%s' - invalid template reference '%s'\n", filename, token ); + FREE_FILE( dataPointer ); + return; + } + + // inherit the data + profile->Inherit( inherit, &defaultProfile ); + + if (c == NULL) + break; + + token = c+1; + } + } + + + // get name of this profile + if (!isDefault) + { + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing '%s' - expected name\n", filename ); + FREE_FILE( dataPointer ); + return; + } + profile->m_name = CloneString( SharedGetToken() ); + + /** + * HACK HACK + * Until we have a generalized means of storing bot preferences, we're going to hardcode the bot's + * preference towards silencers based on his name. + */ + if ( profile->m_name[0] % 2 ) + { + profile->m_prefersSilencer = true; + } + } + + // read attributes for this profile + bool isFirstWeaponPref = true; + while( true ) + { + // get next token + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected 'End'\n", filename ); + FREE_FILE( dataPointer ); + return; + } + token = SharedGetToken(); + + // check for End delimiter + if (!stricmp( token, "End" )) + break; + + // found attribute name - keep it + char attributeName[64]; + strcpy( attributeName, token ); + + // eat '=' + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected '='\n", filename ); + FREE_FILE( dataPointer ); + return; + } + + token = SharedGetToken(); + if (strcmp( "=", token )) + { + CONSOLE_ECHO( "Error parsing %s - expected '='\n", filename ); + FREE_FILE( dataPointer ); + return; + } + + // get attribute value + dataFile = SharedParse( dataFile ); + if (!dataFile) + { + CONSOLE_ECHO( "Error parsing %s - expected attribute value\n", filename ); + FREE_FILE( dataPointer ); + return; + } + token = SharedGetToken(); + + // store value in appropriate attribute + if (!stricmp( "Aggression", attributeName )) + { + profile->m_aggression = atof(token) / 100.0f; + } + else if (!stricmp( "Skill", attributeName )) + { + profile->m_skill = atof(token) / 100.0f; + } + else if (!stricmp( "Skin", attributeName )) + { + profile->m_skin = atoi(token); + if ( profile->m_skin == 0 ) + { + // atoi() failed - try to look up a custom skin by name + profile->m_skin = GetCustomSkinIndex( token, filename ); + } + } + else if (!stricmp( "Teamwork", attributeName )) + { + profile->m_teamwork = atof(token) / 100.0f; + } + else if (!stricmp( "Cost", attributeName )) + { + profile->m_cost = atoi(token); + } + else if (!stricmp( "VoicePitch", attributeName )) + { + profile->m_voicePitch = atoi(token); + } + else if (!stricmp( "VoiceBank", attributeName )) + { + profile->m_voiceBank = FindVoiceBankIndex( token ); + } + else if (!stricmp( "WeaponPreference", attributeName )) + { + // weapon preferences override parent prefs + if (isFirstWeaponPref) + { + isFirstWeaponPref = false; + profile->m_weaponPreferenceCount = 0; + } + + if (!stricmp( token, "none" )) + { + profile->m_weaponPreferenceCount = 0; + } + else + { + if (profile->m_weaponPreferenceCount < BotProfile::MAX_WEAPON_PREFS) + { + profile->m_weaponPreference[ profile->m_weaponPreferenceCount++ ] = AliasToWeaponID( token ); + } + } + } + else if (!stricmp( "ReactionTime", attributeName )) + { + profile->m_reactionTime = atof(token); + +#ifndef GAMEUI_EXPORTS + // subtract off latency due to "think" update rate. + // In GameUI, we don't really care. + profile->m_reactionTime -= g_flBotFullThinkInterval; +#endif + + } + else if (!stricmp( "AttackDelay", attributeName )) + { + profile->m_attackDelay = atof(token); + } + else if (!stricmp( "Difficulty", attributeName )) + { + // override inheritance + profile->m_difficultyFlags = 0; + + // parse bit flags + while(true) + { + char *c = strchr( token, '+' ); + if (c) + *c = '\000'; + + for( int i=0; im_difficultyFlags |= (1 << i); + + if (c == NULL) + break; + + token = c+1; + } + } + else if (!stricmp( "Team", attributeName )) + { + if ( !stricmp( token, "T" ) ) + { + profile->m_teams = BOT_TEAM_T; + } + else if ( !stricmp( token, "CT" ) ) + { + profile->m_teams = BOT_TEAM_CT; + } + else + { + profile->m_teams = BOT_TEAM_ANY; + } + } + else + { + CONSOLE_ECHO( "Error parsing %s - unknown attribute '%s'\n", filename, attributeName ); + } + } + + if (!isDefault) + { + if (isTemplate) + { + // add to template list + templateList.push_back( profile ); + } + else + { + // add profile to the master list + m_profileList.push_back( profile ); + } + } + } + + FREE_FILE( dataPointer ); + + // free the templates + for( BotProfileList::iterator iter = templateList.begin(); iter != templateList.end(); ++iter ) + delete *iter; +} + +//-------------------------------------------------------------------------------------------------------------- +BotProfileManager::~BotProfileManager( void ) +{ + Reset(); + + VoiceBankList::iterator it; + for ( it = m_voiceBanks.begin(); it != m_voiceBanks.end(); ++it ) + { + delete[] *it; + } + m_voiceBanks.clear(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Free all bot profiles + */ +void BotProfileManager::Reset( void ) +{ + for( BotProfileList::iterator iter = m_profileList.begin(); iter != m_profileList.end(); ++iter ) + delete *iter; + + m_profileList.clear(); + + for (int i=0; i LastCustomSkin ) + { + return NULL; + } + + return m_skins[ index - FirstCustomSkin ]; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Returns custom skin filename at a particular index + */ +const char * BotProfileManager::GetCustomSkinFname( int index ) +{ + if ( index < FirstCustomSkin || index > LastCustomSkin ) + { + return NULL; + } + + return m_skinFilenames[ index - FirstCustomSkin ]; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Returns custom skin modelname at a particular index + */ +const char * BotProfileManager::GetCustomSkinModelname( int index ) +{ + if ( index < FirstCustomSkin || index > LastCustomSkin ) + { + return NULL; + } + + return m_skinModelnames[ index - FirstCustomSkin ]; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Looks up a custom skin index by filename-decorated name (will decorate the name if filename is given) + */ +int BotProfileManager::GetCustomSkinIndex( const char *name, const char *filename ) +{ + const char * skinName = name; + if ( filename ) + { + skinName = GetDecoratedSkinName( name, filename ); + } + + for (int i=0; iIsDifficulty( difficulty ) && !UTIL_IsNameTaken( profile->GetName() ) && profile->IsValidForTeam( team )) + ++validCount; + } + + if (validCount == 0) + return NULL; + + // select one at random + int which = RANDOM_LONG( 0, validCount-1 ); + for( iter = m_profileList.begin(); iter != m_profileList.end(); ++iter ) + { + const BotProfile *profile = *iter; + + if (profile->IsDifficulty( difficulty ) && !UTIL_IsNameTaken( profile->GetName() ) && profile->IsValidForTeam( team )) + if (which-- == 0) + return profile; + } + + return NULL; +#endif; +} + diff --git a/game_shared/bot/bot_profile.h b/game_shared/bot/bot_profile.h new file mode 100644 index 0000000..813ebf0 --- /dev/null +++ b/game_shared/bot/bot_profile.h @@ -0,0 +1,220 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Michael S. Booth (mike@turtlerockstudios.com), 2003 + +#ifndef _BOT_PROFILE_H_ +#define _BOT_PROFILE_H_ + +#pragma warning( disable : 4786 ) // long STL names get truncated in browse info. +#ifdef LINUX +#include +#include +#endif + +#undef min +#undef max +#include +#include +#include "bot_constants.h" + +enum +{ + FirstCustomSkin = 100, + NumCustomSkins = 100, + LastCustomSkin = FirstCustomSkin + NumCustomSkins - 1, +}; + +enum BotProfileTeamType +{ + BOT_TEAM_T, + BOT_TEAM_CT, + BOT_TEAM_ANY +}; + +//-------------------------------------------------------------------------------------------------------------- +/** + * A BotProfile describes the "personality" of a given bot + */ +class BotProfile +{ +public: + BotProfile( void ) + { + m_name = NULL; + m_aggression = 0.0f; + m_skill = 0.0f; + m_teamwork = 0.0f; + m_weaponPreferenceCount = 0; + m_cost = 0; + m_skin = 0; + m_difficultyFlags = 0; + m_voicePitch = 100; + m_reactionTime = 0.3f; + m_attackDelay = 0.0f; + m_teams = BOT_TEAM_ANY; + m_voiceBank = 0; + m_prefersSilencer = false; + } + + const char *GetName( void ) const { return m_name; } ///< return bot's name + float GetAggression( void ) const { return m_aggression; } + float GetSkill( void ) const { return m_skill; } + float GetTeamwork( void ) const { return m_teamwork; } + + int GetWeaponPreference( int i ) const { return m_weaponPreference[ i ]; } + const char *GetWeaponPreferenceAsString( int i ) const; + int GetWeaponPreferenceCount( void ) const { return m_weaponPreferenceCount; } + bool HasPrimaryPreference( void ) const; ///< return true if this profile has a primary weapon preference + bool HasPistolPreference( void ) const; ///< return true if this profile has a pistol weapon preference + + int GetCost( void ) const { return m_cost; } + int GetSkin( void ) const { return m_skin; } + bool IsDifficulty( BotDifficultyType diff ) const; ///< return true if this profile can be used for the given difficulty level + int GetVoicePitch( void ) const { return m_voicePitch; } + float GetReactionTime( void ) const { return m_reactionTime; } + float GetAttackDelay( void ) const { return m_attackDelay; } + int GetVoiceBank() const { return m_voiceBank; } + + bool IsValidForTeam( BotProfileTeamType team ) const; + + bool PrefersSilencer() const { return m_prefersSilencer; } +private: + friend class BotProfileManager; ///< for loading profiles + + void Inherit( const BotProfile *parent, const BotProfile *baseline ); ///< copy values from parent if they differ from baseline + + char *m_name; ///< the bot's name + float m_aggression; ///< percentage: 0 = coward, 1 = berserker + float m_skill; ///< percentage: 0 = terrible, 1 = expert + float m_teamwork; ///< percentage: 0 = rogue, 1 = complete obeyance to team, lots of comm + + enum { MAX_WEAPON_PREFS = 16 }; + int m_weaponPreference[ MAX_WEAPON_PREFS ]; ///< which weapons this bot likes to use, in order of priority + int m_weaponPreferenceCount; + + int m_cost; ///< reputation point cost for career mode + int m_skin; ///< "skin" index + unsigned char m_difficultyFlags; ///< bits set correspond to difficulty levels this is valid for + int m_voicePitch; ///< the pitch shift for bot chatter (100 = normal) + float m_reactionTime; ///< our reaction time in seconds + float m_attackDelay; ///< time in seconds from when we notice an enemy to when we open fire + BotProfileTeamType m_teams; ///< teams for which this profile is valid + + bool m_prefersSilencer; ///< does the bot prefer to use silencers? + + int m_voiceBank; ///< Index of the BotChatter.db voice bank this profile uses (0 is the default) +}; +typedef std::list BotProfileList; + + +inline bool BotProfile::IsDifficulty( BotDifficultyType diff ) const +{ + return (m_difficultyFlags & (1 << diff)) ? true : false; +} + +/** + * Copy in data from parent if it differs from the baseline + */ +inline void BotProfile::Inherit( const BotProfile *parent, const BotProfile *baseline ) +{ + if (parent->m_aggression != baseline->m_aggression) + m_aggression = parent->m_aggression; + + if (parent->m_skill != baseline->m_skill) + m_skill = parent->m_skill; + + if (parent->m_teamwork != baseline->m_teamwork) + m_teamwork = parent->m_teamwork; + + if (parent->m_weaponPreferenceCount != baseline->m_weaponPreferenceCount) + { + m_weaponPreferenceCount = parent->m_weaponPreferenceCount; + for( int i=0; im_weaponPreferenceCount; ++i ) + m_weaponPreference[i] = parent->m_weaponPreference[i]; + } + + if (parent->m_cost != baseline->m_cost) + m_cost = parent->m_cost; + + if (parent->m_skin != baseline->m_skin) + m_skin = parent->m_skin; + + if (parent->m_difficultyFlags != baseline->m_difficultyFlags) + m_difficultyFlags = parent->m_difficultyFlags; + + if (parent->m_voicePitch != baseline->m_voicePitch) + m_voicePitch = parent->m_voicePitch; + + if (parent->m_reactionTime != baseline->m_reactionTime) + m_reactionTime = parent->m_reactionTime; + + if (parent->m_attackDelay != baseline->m_attackDelay) + m_attackDelay = parent->m_attackDelay; + + if (parent->m_teams != baseline->m_teams) + m_teams = parent->m_teams; + + if (parent->m_voiceBank != baseline->m_voiceBank) + m_voiceBank = parent->m_voiceBank; +} + + + + +//-------------------------------------------------------------------------------------------------------------- +/** + * The BotProfileManager defines the interface to accessing BotProfiles + */ +class BotProfileManager +{ +public: + BotProfileManager( void ); + ~BotProfileManager( void ); + + void Init( const char *filename, unsigned int *checksum = NULL ); + void Reset( void ); + + /// given a name, return a profile + const BotProfile *GetProfile( const char *name, BotProfileTeamType team ) const + { + for( BotProfileList::const_iterator iter = m_profileList.begin(); iter != m_profileList.end(); ++iter ) + if ( !stricmp( name, (*iter)->GetName() ) && (*iter)->IsValidForTeam( team ) ) + return *iter; + + return NULL; + } + + const BotProfileList *GetProfileList( void ) const { return &m_profileList; } ///< return list of all profiles + + const BotProfile *GetRandomProfile( BotDifficultyType difficulty, BotProfileTeamType team ) const; ///< return random unused profile that matches the given difficulty level + + const char * GetCustomSkin( int index ); ///< Returns custom skin name at a particular index + const char * GetCustomSkinModelname( int index ); ///< Returns custom skin modelname at a particular index + const char * GetCustomSkinFname( int index ); ///< Returns custom skin filename at a particular index + int GetCustomSkinIndex( const char *name, const char *filename = NULL ); ///< Looks up a custom skin index by name + + typedef std::vector VoiceBankList; + const VoiceBankList* GetVoiceBanks() const { return &m_voiceBanks; } + int FindVoiceBankIndex( const char *filename ); ///< return index of the (custom) bot phrase db, inserting it if needed + +protected: + BotProfileList m_profileList; ///< the list of all bot profiles + + VoiceBankList m_voiceBanks; + + char *m_skins[ NumCustomSkins ]; ///< Custom skin names + char *m_skinModelnames[ NumCustomSkins ]; ///< Custom skin modelnames + char *m_skinFilenames[ NumCustomSkins ]; ///< Custom skin filenames + int m_nextSkin; ///< Next custom skin to allocate +}; + +/// the global singleton for accessing BotProfiles +extern BotProfileManager *TheBotProfiles; + + +#endif // _BOT_PROFILE_H_ diff --git a/game_shared/bot/bot_util.cpp b/game_shared/bot/bot_util.cpp new file mode 100644 index 0000000..480a063 --- /dev/null +++ b/game_shared/bot/bot_util.cpp @@ -0,0 +1,859 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Author: Michael S. Booth (mike@turtlerockstudios.com), 2003 + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "player.h" + +#include "bot.h" +#include "bot_util.h" +#include "bot_profile.h" +#include "nav.h" + +static short s_iBeamSprite = 0; + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if given name is already in use by another player + */ +bool UTIL_IsNameTaken( const char *name, bool ignoreHumans ) +{ + for ( int i = 1; i <= gpGlobals->maxClients; ++i ) + { + CBaseEntity * player = UTIL_PlayerByIndex( i ); + + if (player == NULL) + continue; + + if (FNullEnt( player->pev )) + continue; + + if (FStrEq( STRING( player->pev->netname ), "" )) + continue; + + if (player->IsPlayer() && (((CBasePlayer *)player)->IsBot() == TRUE)) + { + // bots can have prefixes so we need to check the name + // against the profile name instead. + CBot *bot = (CBot *)player; + if (FStrEq(name, bot->GetProfile()->GetName())) + { + return true; + } + } + else + { + if (!ignoreHumans) + { + if (FStrEq( name, STRING( player->pev->netname ) )) + return true; + } + } + } + + return false; +} + + +//-------------------------------------------------------------------------------------------------------------- +int UTIL_ClientsInGame( void ) +{ + int iCount = 0; + + for ( int iIndex = 1; iIndex <= gpGlobals->maxClients; iIndex++ ) + { + CBaseEntity * pPlayer = UTIL_PlayerByIndex( iIndex ); + + if ( pPlayer == NULL ) + continue; + + if ( FNullEnt( pPlayer->pev ) ) + continue; + + if ( FStrEq( STRING( pPlayer->pev->netname ), "" ) ) + continue; + + iCount++; + } + + return iCount; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return number of active players (not spectators) in the game + */ +int UTIL_ActivePlayersInGame( void ) +{ + int iCount = 0; + + for (int iIndex = 1; iIndex <= gpGlobals->maxClients; iIndex++ ) + { + CBaseEntity *entity = UTIL_PlayerByIndex( iIndex ); + + if ( entity == NULL ) + continue; + + if ( FNullEnt( entity->pev ) ) + continue; + + if ( FStrEq( STRING( entity->pev->netname ), "" ) ) + continue; + + CBasePlayer *player = static_cast( entity ); + + // ignore spectators + if (player->m_iTeam != TERRORIST && player->m_iTeam != CT) + continue; + + if (player->m_iJoiningState != JOINED) + continue; + + iCount++; + } + + return iCount; +} + + + +//-------------------------------------------------------------------------------------------------------------- +int UTIL_HumansInGame( bool ignoreSpectators ) +{ + int iCount = 0; + + for (int iIndex = 1; iIndex <= gpGlobals->maxClients; iIndex++ ) + { + CBaseEntity *entity = UTIL_PlayerByIndex( iIndex ); + + if ( entity == NULL ) + continue; + + if ( FNullEnt( entity->pev ) ) + continue; + + if ( FStrEq( STRING( entity->pev->netname ), "" ) ) + continue; + + CBasePlayer *player = static_cast( entity ); + + if (player->IsBot()) + continue; + + if (ignoreSpectators && player->m_iTeam != TERRORIST && player->m_iTeam != CT) + continue; + + if (ignoreSpectators && player->m_iJoiningState != JOINED) + continue; + + iCount++; + } + + /* + if ( IS_DEDICATED_SERVER() && !ignoreSpectators ) + { + // If we're counting humans, including spectators, don't count the dedicated server + --iCount; + } + */ + + return iCount; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the number of non-bots on the given team + */ +int UTIL_HumansOnTeam( int teamID, bool isAlive ) +{ + int iCount = 0; + + for (int iIndex = 1; iIndex <= gpGlobals->maxClients; iIndex++ ) + { + CBaseEntity *entity = UTIL_PlayerByIndex( iIndex ); + + if ( entity == NULL ) + continue; + + if ( FNullEnt( entity->pev ) ) + continue; + + if ( FStrEq( STRING( entity->pev->netname ), "" ) ) + continue; + + CBasePlayer *player = static_cast( entity ); + + if (player->IsBot()) + continue; + + if (player->m_iTeam != teamID) + continue; + + if (isAlive && !player->IsAlive()) + continue; + + iCount++; + } + + return iCount; +} + + +//-------------------------------------------------------------------------------------------------------------- +int UTIL_BotsInGame( void ) +{ + int iCount = 0; + + for (int iIndex = 1; iIndex <= gpGlobals->maxClients; iIndex++ ) + { + CBasePlayer *pPlayer = static_cast(UTIL_PlayerByIndex( iIndex )); + + if ( pPlayer == NULL ) + continue; + + if ( FNullEnt( pPlayer->pev ) ) + continue; + + if ( FStrEq( STRING( pPlayer->pev->netname ), "" ) ) + continue; + + if ( !pPlayer->IsBot() ) + continue; + + iCount++; + } + + return iCount; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Kick a bot from the given team. If no bot exists on the team, return false. + */ +bool UTIL_KickBotFromTeam( TeamName kickTeam ) +{ + int i; + + // try to kick a dead bot first + for ( i = 1; i <= gpGlobals->maxClients; ++i ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (player == NULL) + continue; + + if (FNullEnt( player->pev )) + continue; + + const char *name = STRING( player->pev->netname ); + if (FStrEq( name, "" )) + continue; + + if (!player->IsBot()) + continue; + + if (!player->IsAlive() && player->m_iTeam == kickTeam) + { + // its a bot on the right team - kick it + SERVER_COMMAND( UTIL_VarArgs( "kick \"%s\"\n", STRING( player->pev->netname ) ) ); + + return true; + } + } + + // no dead bots, kick any bot on the given team + for ( i = 1; i <= gpGlobals->maxClients; ++i ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (player == NULL) + continue; + + if (FNullEnt( player->pev )) + continue; + + const char *name = STRING( player->pev->netname ); + if (FStrEq( name, "" )) + continue; + + if (!player->IsBot()) + continue; + + if (player->m_iTeam == kickTeam) + { + // its a bot on the right team - kick it + SERVER_COMMAND( UTIL_VarArgs( "kick \"%s\"\n", STRING( player->pev->netname ) ) ); + + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if all of the members of the given team are bots + */ +bool UTIL_IsTeamAllBots( int team ) +{ + int botCount = 0; + + for( int i=1; i <= gpGlobals->maxClients; ++i ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (player == NULL) + continue; + + // skip players on other teams + if (player->m_iTeam != team) + continue; + + if (FNullEnt( player->pev )) + continue; + + if (FStrEq( STRING( player->pev->netname ), "" )) + continue; + + // if not a bot, fail the test + if (!FBitSet( player->pev->flags, FL_FAKECLIENT )) + return false; + + // is a bot on given team + ++botCount; + } + + // if team is empty, there are no bots + return (botCount) ? true : false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the closest active player to the given position. + * If 'distance' is non-NULL, the distance to the closest player is returned in it. + */ +extern CBasePlayer *UTIL_GetClosestPlayer( const Vector *pos, float *distance ) +{ + CBasePlayer *closePlayer = NULL; + float closeDistSq = 999999999999.9f; + + for ( int i = 1; i <= gpGlobals->maxClients; i++ ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (!IsEntityValid( player )) + continue; + + if (!player->IsAlive()) + continue; + + float distSq = (player->pev->origin - *pos).LengthSquared(); + if (distSq < closeDistSq) + { + closeDistSq = distSq; + closePlayer = static_cast( player ); + } + } + + if (distance) + *distance = sqrt( closeDistSq ); + + return closePlayer; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the closest active player on the given team to the given position. + * If 'distance' is non-NULL, the distance to the closest player is returned in it. + */ +extern CBasePlayer *UTIL_GetClosestPlayer( const Vector *pos, int team, float *distance ) +{ + CBasePlayer *closePlayer = NULL; + float closeDistSq = 999999999999.9f; + + for ( int i = 1; i <= gpGlobals->maxClients; i++ ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (!IsEntityValid( player )) + continue; + + if (!player->IsAlive()) + continue; + + if (player->m_iTeam != team) + continue; + + float distSq = (player->pev->origin - *pos).LengthSquared(); + if (distSq < closeDistSq) + { + closeDistSq = distSq; + closePlayer = static_cast( player ); + } + } + + if (distance) + *distance = sqrt( closeDistSq ); + + return closePlayer; +} + +//-------------------------------------------------------------------------------------------------------------- +// returns the string to be used for the bot name prefix. +const char * UTIL_GetBotPrefix() +{ + return cv_bot_prefix.string; +} + +//-------------------------------------------------------------------------------------------------------------- +// Takes the bot pointer and constructs the net name using the current bot name prefix. +void UTIL_ConstructBotNetName(char *name, int nameLength, const BotProfile *profile) +{ + if (profile == NULL) + { + name[0] = 0; + return; + } + + // if there is no bot prefix just use the profile name. + if ((UTIL_GetBotPrefix() == NULL) || (strlen(UTIL_GetBotPrefix()) == 0)) + { + strncpy(name, profile->GetName(), nameLength); + return; + } + + _snprintf(name, nameLength, "%s %s", UTIL_GetBotPrefix(), profile->GetName()); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if anyone on the given team can see the given spot + */ +bool UTIL_IsVisibleToTeam( const Vector &spot, int team, float maxRange ) +{ + for( int i = 1; i <= gpGlobals->maxClients; ++i ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (player == NULL) + continue; + + if (FNullEnt( player->pev )) + continue; + + if (FStrEq( STRING( player->pev->netname ), "" )) + continue; + + if (!player->IsAlive()) + continue; + + if (player->m_iTeam != team) + continue; + + if (maxRange > 0.0f && (spot - player->Center()).IsLengthGreaterThan( maxRange )) + continue; + + TraceResult result; + UTIL_TraceLine( player->EyePosition(), spot, ignore_monsters, ignore_glass, ENT( player->pev ), &result ); + + if (result.flFraction == 1.0f) + return true; + } + + return false; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the local player + */ +CBasePlayer *UTIL_GetLocalPlayer( void ) +{ + if ( IS_DEDICATED_SERVER() ) + { + return NULL; + } + return static_cast( UTIL_PlayerByIndex( 1 ) ); +} + + +//------------------------------------------------------------------------------------------------------------ +// Some types of entities have no origin set, so we use this instead. +Vector UTIL_ComputeOrigin( entvars_t * pevVars ) +{ + if ( ( pevVars->origin.x == 0.0 ) && ( pevVars->origin.y == 0.0 ) && ( pevVars->origin.z == 0.0 ) ) + return ( pevVars->absmax + pevVars->absmin ) * 0.5; + else + return pevVars->origin; +} + + +Vector UTIL_ComputeOrigin( CBaseEntity * pEntity ) +{ + return UTIL_ComputeOrigin( pEntity->pev ); +} + + +Vector UTIL_ComputeOrigin( edict_t * pentEdict ) +{ + return UTIL_ComputeOrigin( VARS( pentEdict ) ); +} + + +//------------------------------------------------------------------------------------------------------------ +void UTIL_DrawBeamFromEnt( int iIndex, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue ) +{ + MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecEnd ); // vecEnd = origin??? + WRITE_BYTE( TE_BEAMENTPOINT ); + WRITE_SHORT( iIndex ); + WRITE_COORD( vecEnd.x ); + WRITE_COORD( vecEnd.y ); + WRITE_COORD( vecEnd.z ); + WRITE_SHORT( s_iBeamSprite ); + WRITE_BYTE( 0 ); // startframe + WRITE_BYTE( 0 ); // framerate + WRITE_BYTE( iLifetime ); // life + WRITE_BYTE( 10 ); // width + WRITE_BYTE( 0 ); // noise + WRITE_BYTE( bRed ); // r, g, b + WRITE_BYTE( bGreen ); // r, g, b + WRITE_BYTE( bBlue ); // r, g, b + WRITE_BYTE( 255 ); // brightness + WRITE_BYTE( 0 ); // speed + MESSAGE_END(); +} + + +//------------------------------------------------------------------------------------------------------------ +void UTIL_DrawBeamPoints( Vector vecStart, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue ) +{ + MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecStart ); + WRITE_BYTE( TE_BEAMPOINTS ); + WRITE_COORD( vecStart.x ); + WRITE_COORD( vecStart.y ); + WRITE_COORD( vecStart.z ); + WRITE_COORD( vecEnd.x ); + WRITE_COORD( vecEnd.y ); + WRITE_COORD( vecEnd.z ); + WRITE_SHORT( s_iBeamSprite ); + WRITE_BYTE( 0 ); // startframe + WRITE_BYTE( 0 ); // framerate + WRITE_BYTE( iLifetime ); // life + WRITE_BYTE( 10 ); // width + WRITE_BYTE( 0 ); // noise + WRITE_BYTE( bRed ); // r, g, b + WRITE_BYTE( bGreen ); // r, g, b + WRITE_BYTE( bBlue ); // r, g, b + WRITE_BYTE( 255 ); // brightness + WRITE_BYTE( 0 ); // speed + MESSAGE_END(); +} + + +//------------------------------------------------------------------------------------------------------------ +void CONSOLE_ECHO( char * pszMsg, ... ) +{ + va_list argptr; + static char szStr[1024]; + + va_start( argptr, pszMsg ); + vsprintf( szStr, pszMsg, argptr ); + va_end( argptr ); + + (*g_engfuncs.pfnServerPrint)( szStr ); +} + + +//------------------------------------------------------------------------------------------------------------ +void CONSOLE_ECHO_LOGGED( char * pszMsg, ... ) +{ + va_list argptr; + static char szStr[1024]; + + va_start( argptr, pszMsg ); + vsprintf( szStr, pszMsg, argptr ); + va_end( argptr ); + + (*g_engfuncs.pfnServerPrint)( szStr ); + UTIL_LogPrintf( szStr ); +} + + +//------------------------------------------------------------------------------------------------------------ +void BotPrecache( void ) +{ + s_iBeamSprite = PRECACHE_MODEL( "sprites/smoke.spr" ); + PRECACHE_SOUND( "buttons/bell1.wav" ); + PRECACHE_SOUND( "buttons/blip1.wav" ); + PRECACHE_SOUND( "buttons/blip2.wav" ); + PRECACHE_SOUND( "buttons/button11.wav" ); + PRECACHE_SOUND( "buttons/latchunlocked2.wav" ); + PRECACHE_SOUND( "buttons/lightswitch2.wav" ); + PRECACHE_SOUND( "ambience/quail1.wav" ); + + /// @todo This is for the Tutor - move it somewhere sane + PRECACHE_SOUND( "events/tutor_msg.wav" ); + PRECACHE_SOUND( "events/enemy_died.wav" ); + PRECACHE_SOUND( "events/friend_died.wav" ); + + /// @todo This is for the Career mode UI - move it somewhere sane + PRECACHE_SOUND( "events/task_complete.wav" ); + +#ifdef TERRORSTRIKE + /// @todo Zombie mode experiment + PRECACHE_SOUND( "zombie/attack1.wav" ); + PRECACHE_SOUND( "zombie/attack2.wav" ); + PRECACHE_SOUND( "zombie/attack3.wav" ); + PRECACHE_SOUND( "zombie/attack4.wav" ); + PRECACHE_SOUND( "zombie/attack5.wav" ); + PRECACHE_SOUND( "zombie/bark1.wav" ); + PRECACHE_SOUND( "zombie/bark2.wav" ); + PRECACHE_SOUND( "zombie/bark3.wav" ); + PRECACHE_SOUND( "zombie/bark4.wav" ); + PRECACHE_SOUND( "zombie/bark5.wav" ); + PRECACHE_SOUND( "zombie/bark6.wav" ); + PRECACHE_SOUND( "zombie/bark7.wav" ); + PRECACHE_SOUND( "zombie/breathing1.wav" ); + PRECACHE_SOUND( "zombie/breathing2.wav" ); + PRECACHE_SOUND( "zombie/breathing3.wav" ); + PRECACHE_SOUND( "zombie/breathing4.wav" ); + PRECACHE_SOUND( "zombie/groan1.wav" ); + PRECACHE_SOUND( "zombie/groan2.wav" ); + PRECACHE_SOUND( "zombie/groan3.wav" ); + PRECACHE_SOUND( "zombie/hiss1.wav" ); + PRECACHE_SOUND( "zombie/hiss2.wav" ); + PRECACHE_SOUND( "zombie/hiss3.wav" ); + PRECACHE_SOUND( "ambience/the_horror2.wav" ); + PRECACHE_SOUND( "scientist/scream20.wav" ); + PRECACHE_SOUND( "zombie/human_hurt1.wav" ); + PRECACHE_SOUND( "zombie/human_hurt2.wav" ); + PRECACHE_SOUND( "zombie/human_hurt3.wav" ); + PRECACHE_SOUND( "zombie/human_hurt4.wav" ); + PRECACHE_SOUND( "zombie/shout_reloading1.wav" ); + PRECACHE_SOUND( "zombie/shout_reloading2.wav" ); + PRECACHE_SOUND( "zombie/shout_reloading3.wav" ); + PRECACHE_SOUND( "zombie/deep_heartbeat.wav" ); + PRECACHE_SOUND( "zombie/deep_heartbeat_fast.wav" ); + PRECACHE_SOUND( "zombie/deep_heartbeat_very_fast.wav" ); + PRECACHE_SOUND( "zombie/deep_heartbeat_stopping.wav" ); + PRECACHE_SOUND( "zombie/zombie_step1.wav" ); + PRECACHE_SOUND( "zombie/zombie_step2.wav" ); + PRECACHE_SOUND( "zombie/zombie_step3.wav" ); + PRECACHE_SOUND( "zombie/zombie_step4.wav" ); + PRECACHE_SOUND( "zombie/zombie_step5.wav" ); + PRECACHE_SOUND( "zombie/zombie_step6.wav" ); + PRECACHE_SOUND( "zombie/zombie_step7.wav" ); + PRECACHE_SOUND( "zombie/fear1.wav" ); + PRECACHE_SOUND( "zombie/fear2.wav" ); + PRECACHE_SOUND( "zombie/fear3.wav" ); + PRECACHE_SOUND( "zombie/fear4.wav" ); +#endif // TERRORSTRIKE +} + +//------------------------------------------------------------------------------------------------------------ +#define COS_TABLE_SIZE 256 +static float cosTable[ COS_TABLE_SIZE ]; + +void InitBotTrig( void ) +{ + for( int i=0; i( entity ); + if (entity == NULL || !player->IsPlayer()) + player = NULL; + + const float ShortRange = 1000.0f; + const float NormalRange = 2000.0f; + switch( event ) + { + /// @todo Check weapon type (knives are pretty quiet) + /// @todo Use actual volume, account for silencers, etc. + case EVENT_WEAPON_FIRED: + { + if (player->m_pActiveItem == NULL) + return false; + + switch( player->m_pActiveItem->m_iId ) + { + // silent "firing" + case WEAPON_HEGRENADE: + case WEAPON_SMOKEGRENADE: + case WEAPON_FLASHBANG: + case WEAPON_SHIELDGUN: + case WEAPON_C4: + return false; + + // quiet + case WEAPON_KNIFE: + case WEAPON_TMP: + *range = ShortRange; + break; + + // M4A1 - check for silencer + case WEAPON_M4A1: + { + CBasePlayerWeapon *pWeapon = static_cast(player->m_pActiveItem); + if ( pWeapon->m_iWeaponState & WPNSTATE_M4A1_SILENCER_ON ) + { + *range = ShortRange; + } + else + { + *range = NormalRange; + } + } + break; + + // USP - check for silencer + case WEAPON_USP: + { + CBasePlayerWeapon *pWeapon = static_cast(player->m_pActiveItem); + if ( pWeapon->m_iWeaponState & WPNSTATE_USP_SILENCER_ON ) + { + *range = ShortRange; + } + else + { + *range = NormalRange; + } + } + break; + + // loud + case WEAPON_AWP: + *range = 99999.0f; + break; + + // normal + default: + *range = NormalRange; + break; + } + + *priority = PRIORITY_HIGH; + *isHostile = true; + return true; + } + + case EVENT_HE_GRENADE_EXPLODED: + *range = 99999.0f; + *priority = PRIORITY_HIGH; + *isHostile = true; + return true; + + case EVENT_FLASHBANG_GRENADE_EXPLODED: + *range = 1000.0f; + *priority = PRIORITY_LOW; + *isHostile = true; + return true; + + case EVENT_SMOKE_GRENADE_EXPLODED: + *range = 1000.0f; + *priority = PRIORITY_LOW; + *isHostile = true; + return true; + + case EVENT_GRENADE_BOUNCED: + *range = 500.0f; + *priority = PRIORITY_LOW; + *isHostile = true; + return true; + + case EVENT_BREAK_GLASS: + case EVENT_BREAK_WOOD: + case EVENT_BREAK_METAL: + case EVENT_BREAK_FLESH: + case EVENT_BREAK_CONCRETE: + *range = 1100.0f; + *priority = PRIORITY_MEDIUM; + *isHostile = true; + return true; + + case EVENT_DOOR: + *range = 1100.0f; + *priority = PRIORITY_MEDIUM; + *isHostile = false; + return true; + + case EVENT_WEAPON_FIRED_ON_EMPTY: + case EVENT_PLAYER_FOOTSTEP: + case EVENT_WEAPON_RELOADED: + case EVENT_WEAPON_ZOOMED: + case EVENT_PLAYER_LANDED_FROM_HEIGHT: + *range = 1100.0f; + *priority = PRIORITY_LOW; + *isHostile = false; + return true; + + case EVENT_HOSTAGE_USED: + case EVENT_HOSTAGE_CALLED_FOR_HELP: + *range = 1200.0f; + *priority = PRIORITY_MEDIUM; + *isHostile = false; + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Send a "hint" message to all players, dead or alive. + */ +void HintMessageToAllPlayers( const char *message ) +{ + hudtextparms_t textParms; + + textParms.x = -1.0f; + textParms.y = -1.0f; + textParms.fadeinTime = 1.0f; + textParms.fadeoutTime = 5.0f; + textParms.holdTime = 5.0f; + textParms.fxTime = 0.0f; + textParms.r1 = 100; + textParms.g1 = 255; + textParms.b1 = 100; + textParms.r2 = 255; + textParms.g2 = 255; + textParms.b2 = 255; + textParms.effect = 0; + textParms.channel = 0; + + UTIL_HudMessageAll( textParms, message ); +} + diff --git a/game_shared/bot/bot_util.h b/game_shared/bot/bot_util.h new file mode 100644 index 0000000..64342dc --- /dev/null +++ b/game_shared/bot/bot_util.h @@ -0,0 +1,326 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef BOT_UTIL_H +#define BOT_UTIL_H + + +#include "eiface.h" +#include "player.h" +#include "shared_util.h" +#include "GameEvent.h" + +//-------------------------------------------------------------------------------------------------------------- +enum PriorityType +{ + PRIORITY_LOW, PRIORITY_MEDIUM, PRIORITY_HIGH, PRIORITY_UNINTERRUPTABLE +}; + + +extern cvar_t cv_bot_traceview; +extern cvar_t cv_bot_stop; +extern cvar_t cv_bot_show_nav; +extern cvar_t cv_bot_show_danger; +extern cvar_t cv_bot_nav_edit; +extern cvar_t cv_bot_nav_zdraw; +extern cvar_t cv_bot_walk; +extern cvar_t cv_bot_difficulty; +extern cvar_t cv_bot_debug; +extern cvar_t cv_bot_quicksave; +extern cvar_t cv_bot_quota; +extern cvar_t cv_bot_quota_match; +extern cvar_t cv_bot_prefix; +extern cvar_t cv_bot_allow_rogues; +extern cvar_t cv_bot_allow_pistols; +extern cvar_t cv_bot_allow_shotguns; +extern cvar_t cv_bot_allow_sub_machine_guns; +extern cvar_t cv_bot_allow_rifles; +extern cvar_t cv_bot_allow_machine_guns; +extern cvar_t cv_bot_allow_grenades; +extern cvar_t cv_bot_allow_snipers; +extern cvar_t cv_bot_allow_shield; +extern cvar_t cv_bot_join_team; +extern cvar_t cv_bot_join_after_player; +extern cvar_t cv_bot_auto_vacate; +extern cvar_t cv_bot_zombie; +extern cvar_t cv_bot_defer_to_human; +extern cvar_t cv_bot_chatter; +extern cvar_t cv_bot_profile_db; + +#ifdef TERRORSTRIKE +extern cvar_t cv_zombie_near_spawn; +extern cvar_t cv_zombie_far_spawn; +extern cvar_t cv_zombie_relocate; +extern cvar_t cv_zombie_min_spawn_time; +extern cvar_t cv_zombie_max_spawn_time; +#endif + +#define RAD_TO_DEG( deg ) ((deg) * 180.0 / M_PI) +#define DEG_TO_RAD( rad ) ((rad) * M_PI / 180.0) + +#define SIGN( num ) (((num) < 0) ? -1 : 1) +#define ABS( num ) (SIGN(num) * (num)) + + +#define CREATE_FAKE_CLIENT ( *g_engfuncs.pfnCreateFakeClient ) +#define GET_USERINFO ( *g_engfuncs.pfnGetInfoKeyBuffer ) +#define SET_KEY_VALUE ( *g_engfuncs.pfnSetKeyValue ) +#define SET_CLIENT_KEY_VALUE ( *g_engfuncs.pfnSetClientKeyValue ) + +class BotProfile; + +extern void BotPrecache( void ); +extern int UTIL_ClientsInGame( void ); + +extern bool UTIL_IsNameTaken( const char *name, bool ignoreHumans = false ); ///< return true if given name is already in use by another player + +// return number of active players (not spectators) in the game +extern int UTIL_ActivePlayersInGame( void ); + +#define IGNORE_SPECTATORS true +extern int UTIL_HumansInGame( bool ignoreSpectators = false ); + +#define IS_ALIVE true +extern int UTIL_HumansOnTeam( int teamID, bool isAlive = false ); + +extern int UTIL_BotsInGame( void ); +extern bool UTIL_IsTeamAllBots( int team ); +extern Vector UTIL_ComputeOrigin( entvars_t * pevVars ); +extern Vector UTIL_ComputeOrigin( CBaseEntity * pEntity ); +extern Vector UTIL_ComputeOrigin( edict_t * pentEdict ); +extern void UTIL_DrawBeamFromEnt( int iIndex, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue ); +extern void UTIL_DrawBeamPoints( Vector vecStart, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue ); +extern CBasePlayer *UTIL_GetClosestPlayer( const Vector *pos, float *distance = NULL ); +extern CBasePlayer *UTIL_GetClosestPlayer( const Vector *pos, int team, float *distance = NULL ); +extern CBasePlayer *UTIL_GetLocalPlayer( void ); +extern bool UTIL_KickBotFromTeam( TeamName kickTeam ); ///< kick a bot from the given team. If no bot exists on the team, return false. + +extern bool UTIL_IsVisibleToTeam( const Vector &spot, int team, float maxRange = -1.0f ); ///< return true if anyone on the given team can see the given spot + +extern const char * UTIL_GetBotPrefix(); ///< returns the bot prefix string. +extern void UTIL_ConstructBotNetName(char *name, int nameLength, const BotProfile *bot); + +/** + * Echos text to the console, and prints it on the client's screen. This is NOT tied to the developer cvar. + * If you are adding debugging output in cstrike, use UTIL_DPrintf() (debug.h) instead. + */ +extern void CONSOLE_ECHO( char * pszMsg, ... ); +extern void CONSOLE_ECHO_LOGGED( char * pszMsg, ... ); + +extern void InitBotTrig( void ); +extern float BotCOS( float angle ); +extern float BotSIN( float angle ); + +/// determine if this event is audible, and if so, return its audible range and priority +bool IsGameEventAudible( GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile ); + +extern void HintMessageToAllPlayers( const char *message ); + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Simple class for tracking intervals of game time + */ +class IntervalTimer +{ +public: + IntervalTimer( void ) + { + m_timestamp = -1.0f; + } + + void Reset( void ) + { + m_timestamp = gpGlobals->time; + } + + void Start( void ) + { + m_timestamp = gpGlobals->time; + } + + void Invalidate( void ) + { + m_timestamp = -1.0f; + } + + bool HasStarted( void ) const + { + return (m_timestamp > 0.0f); + } + + /// if not started, elapsed time is very large + float GetElapsedTime( void ) const + { + return (HasStarted()) ? (gpGlobals->time - m_timestamp) : 99999.9f; + } + + bool IsLessThen( float duration ) const + { + return (gpGlobals->time - m_timestamp < duration) ? true : false; + } + + bool IsGreaterThen( float duration ) const + { + return (gpGlobals->time - m_timestamp > duration) ? true : false; + } + +private: + float m_timestamp; +}; + +//-------------------------------------------------------------------------------------------------------------- +/** + * Simple class for counting down a short interval of time + */ +class CountdownTimer +{ +public: + CountdownTimer( void ) + { + m_timestamp = -1.0f; + m_duration = 0.0f; + } + + void Reset( void ) + { + m_timestamp = gpGlobals->time + m_duration; + } + + void Start( float duration ) + { + m_timestamp = gpGlobals->time + duration; + m_duration = duration; + } + + void Invalidate( void ) + { + m_timestamp = -1.0f; + } + + bool HasStarted( void ) const + { + return (m_timestamp > 0.0f); + } + + bool IsElapsed( void ) const + { + return (gpGlobals->time > m_timestamp); + } + +private: + float m_duration; + float m_timestamp; +}; + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if the given entity is valid + */ +inline bool IsEntityValid( CBaseEntity *entity ) +{ + if (entity == NULL) + return false; + + if (FNullEnt( entity->pev )) + return false; + + if (FStrEq( STRING( entity->pev->netname ), "" )) + return false; + + if (entity->pev->flags & FL_DORMANT) + return false; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Given two line segments: startA to endA, and startB to endB, return true if they intesect + * and put the intersection point in "result". + * Note that this computes the intersection of the 2D (x,y) projection of the line segments. + */ +inline bool IsIntersecting2D( const Vector &startA, const Vector &endA, + const Vector &startB, const Vector &endB, + Vector *result = NULL ) +{ + float denom = (endA.x - startA.x) * (endB.y - startB.y) - (endA.y - startA.y) * (endB.x - startB.x); + if (denom == 0.0f) + { + // parallel + return false; + } + + float numS = (startA.y - startB.y) * (endB.x - startB.x) - (startA.x - startB.x) * (endB.y - startB.y); + if (numS == 0.0f) + { + // coincident + return true; + } + + float numT = (startA.y - startB.y) * (endA.x - startA.x) - (startA.x - startB.x) * (endA.y - startA.y); + + float s = numS / denom; + if (s < 0.0f || s > 1.0f) + { + // intersection is not within line segment of startA to endA + return false; + } + + float t = numT / denom; + if (t < 0.0f || t > 1.0f) + { + // intersection is not within line segment of startB to endB + return false; + } + + // compute intesection point + if (result) + *result = startA + s * (endA - startA); + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Iterate over all active players in the game, invoking functor on each. + * If functor returns false, stop iteration and return false. + */ +template < typename Functor > +bool ForEachPlayer( Functor &func ) +{ + for( int i=1; i<=gpGlobals->maxClients; ++i ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (!IsEntityValid( player )) + continue; + + if (!player->IsPlayer()) + continue; + + if (func( player ) == false) + return false; + } + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * For zombie game + */ +inline bool IsZombieGame( void ) +{ +#ifdef TERRORSTRIKE + return true; +#else + return false; +#endif +} + +#endif diff --git a/game_shared/bot/improv.h b/game_shared/bot/improv.h new file mode 100644 index 0000000..f18082e --- /dev/null +++ b/game_shared/bot/improv.h @@ -0,0 +1,118 @@ +// improv.h +// Improv interface +// Author: Michael S. Booth (mike@turtlerockstudios.com), November 2003 + +#ifndef _IMPROV_H_ +#define _IMPROV_H_ + +#include "nav_path.h" + +class CBaseEntity; + + +//-------------------------------------------------------------------------------------------------------- +/** + * Improv-specific events + */ +class IImprovEvent +{ +public: + virtual void OnMoveToSuccess( const Vector &goal ) { } ///< invoked when an improv reaches its MoveTo goal + + enum MoveToFailureType + { + FAIL_INVALID_PATH, + FAIL_STUCK, + FAIL_FELL_OFF, + }; + virtual void OnMoveToFailure( const Vector &goal, MoveToFailureType reason ) { } ///< invoked when an improv fails to reach a MoveTo goal + + virtual void OnInjury( float amount ) { } ///< invoked when the improv is injured +}; + +//-------------------------------------------------------------------------------------------------------- +/** + * The Improv interface definition + * + * An "Improv" is an improvisational actor that simulates the + * behavor of a human in an unscripted, "make it up as you go" manner. + */ +class CImprov : public IImprovEvent +{ +public: + virtual ~CImprov() { } + + virtual bool IsAlive( void ) const = 0; ///< return true if this improv is alive + + virtual void MoveTo( const Vector &goal ) = 0; ///< move improv towards far-away goal (pathfind) + virtual void LookAt( const Vector &target ) = 0; ///< define desired view target + virtual void ClearLookAt( void ) = 0; ///< remove view goal + virtual void FaceTo( const Vector &goal ) = 0; ///< orient body towards goal + virtual void ClearFaceTo( void ) = 0; ///< remove body orientation goal + + virtual bool IsAtMoveGoal( float error = 20.0f ) const = 0; ///< return true if improv is standing on its movement goal + virtual bool HasLookAt( void ) const = 0; ///< return true if improv has a look at goal + virtual bool HasFaceTo( void ) const = 0; ///< return true if improv has a face to goal + virtual bool IsAtFaceGoal( void ) const = 0; ///< return true if improv is facing towards its face goal + virtual bool IsFriendInTheWay( const Vector &goalPos ) const = 0; ///< return true if a friend is blocking our line to the given goal position + virtual bool IsFriendInTheWay( CBaseEntity *myFriend, const Vector &goalPos ) const = 0; ///< return true if the given friend is blocking our line to the given goal position + + virtual void MoveForward( void ) = 0; + virtual void MoveBackward( void ) = 0; + virtual void StrafeLeft( void ) = 0; + virtual void StrafeRight( void ) = 0; + virtual bool Jump( void ) = 0; + virtual void Crouch( void ) = 0; + virtual void StandUp( void ) = 0; ///< "un-crouch" + + virtual void TrackPath( const Vector &pathGoal, float deltaT ) = 0; ///< move along path by following "pathGoal" + + virtual void StartLadder( const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos ) = 0; ///< invoked when a ladder is encountered while following a path + virtual bool TraverseLadder( const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT ) = 0; ///< traverse given ladder + + virtual bool GetSimpleGroundHeightWithFloor( const Vector *pos, float *height, Vector *normal = NULL ) = 0; ///< find "simple" ground height, treating current nav area as part of the floor + + virtual void Run( void ) = 0; + virtual void Walk( void ) = 0; + virtual void Stop( void ) = 0; + + virtual float GetMoveAngle( void ) const = 0; ///< return direction of movement + virtual float GetFaceAngle( void ) const = 0; ///< return direction of view + + virtual const Vector &GetFeet( void ) const = 0; ///< return position of "feet" - point below centroid of improv at feet level + virtual const Vector &GetCentroid( void ) const = 0; + virtual const Vector &GetEyes( void ) const = 0; + + virtual bool IsRunning( void ) const = 0; + virtual bool IsWalking( void ) const = 0; + virtual bool IsStopped( void ) const = 0; + + virtual bool IsCrouching( void ) const = 0; + virtual bool IsJumping( void ) const = 0; + virtual bool IsUsingLadder( void ) const = 0; + virtual bool IsOnGround( void ) const = 0; + virtual bool IsMoving( void ) const = 0; ///< if true, improv is walking, crawling, running somewhere + + virtual bool CanRun( void ) const = 0; + virtual bool CanCrouch( void ) const = 0; + virtual bool CanJump( void ) const = 0; + + #define CHECK_FOV true + virtual bool IsVisible( const Vector &pos, bool testFOV = false ) const = 0; ///< return true if improv can see position + + virtual bool IsPlayerLookingAtMe( CBasePlayer *other, float cosTolerance = 0.95f ) const = 0; ///< return true if 'other' is looking right at me + virtual CBasePlayer *IsAnyPlayerLookingAtMe( int team = 0, float cosTolerance = 0.95f ) const = 0; ///< return player on given team that is looking right at me (team == 0 means any team), NULL otherwise + + virtual CBasePlayer *GetClosestPlayerByTravelDistance( int team = 0, float *range = NULL ) const = 0; ///< return actual travel distance to closest player on given team (team == 0 means any team) + + virtual CNavArea *GetLastKnownArea( void ) const = 0; + + virtual void OnUpdate( float deltaT ) = 0; ///< a less frequent, full update 'tick' + virtual void OnUpkeep( float deltaT ) = 0; ///< a frequent, lightweight update 'tick' + virtual void OnReset( void ) = 0; ///< reset improv to initial state + virtual void OnGameEvent( GameEventType event, CBaseEntity *entity, CBaseEntity *other ) = 0; ///< invoked when an event occurs in the game + virtual void OnTouch( CBaseEntity *other ) = 0; ///< "other" has touched us +}; + + +#endif // _IMPROV_H_ diff --git a/game_shared/bot/nav.h b/game_shared/bot/nav.h new file mode 100644 index 0000000..4167add --- /dev/null +++ b/game_shared/bot/nav.h @@ -0,0 +1,363 @@ +// nav.h +// AI Navigation data structures +// Author: Michael S. Booth (mike@turtlerockstudios.com), January 2003 + +#ifndef _NAV_H_ +#define _NAV_H_ + +#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning + +const float GenerationStepSize = 25.0f; // (30) was 20, but bots can't fit always fit +const float StepHeight = 18.0f; ///< if delta Z is greater than this, we have to jump to get up +const float JumpHeight = 41.8f; ///< if delta Z is less than this, we can jump up on it +const float JumpCrouchHeight = 58.0f; ///< (48) if delta Z is less than or equal to this, we can jumpcrouch up on it + +// Strictly speaking, you CAN get up a slope of 1.643 (about 59 degrees), but you move very, very slowly +// This slope will represent the slope you can navigate without much slowdown +const float MaxSlope = 1.4f; ///< rise/run - if greater than this, we can't move up it (de_survivor canyon ramps) + +// instead of MaxSlope, we are using the following max Z component of a unit normal +const float MaxUnitZSlope = 0.7f; + +const float BotRadius = 10.0f; ///< circular extent that contains bot +const float DeathDrop = 200.0f; ///< (300) distance at which we will die if we fall - should be about 600, and pay attention to fall damage during pathfind + +const float HalfHumanWidth = 16.0f; +const float HalfHumanHeight = 36.0f; +const float HumanHeight = 72.0f; + +#define NAV_MAGIC_NUMBER 0xFEEDFACE ///< to help identify nav files + +/** + * A place is a named group of navigation areas + */ +typedef unsigned int Place; +#define UNDEFINED_PLACE 0 // ie: "no place" +#define ANY_PLACE 0xFFFF + +enum NavErrorType +{ + NAV_OK, + NAV_CANT_ACCESS_FILE, + NAV_INVALID_FILE, + NAV_BAD_FILE_VERSION, + NAV_CORRUPT_DATA, +}; + +enum NavAttributeType +{ + NAV_CROUCH = 0x01, ///< must crouch to use this node/area + NAV_JUMP = 0x02, ///< must jump to traverse this area + NAV_PRECISE = 0x04, ///< do not adjust for obstacles, just move along area + NAV_NO_JUMP = 0x08, ///< inhibit discontinuity jumping +}; + +enum NavDirType +{ + NORTH = 0, + EAST = 1, + SOUTH = 2, + WEST = 3, + + NUM_DIRECTIONS +}; + +/** + * Defines possible ways to move from one area to another + */ +enum NavTraverseType +{ + // NOTE: First 4 directions MUST match NavDirType + GO_NORTH = 0, + GO_EAST, + GO_SOUTH, + GO_WEST, + GO_LADDER_UP, + GO_LADDER_DOWN, + GO_JUMP, + + NUM_TRAVERSE_TYPES +}; + +enum NavCornerType +{ + NORTH_WEST = 0, + NORTH_EAST = 1, + SOUTH_EAST = 2, + SOUTH_WEST = 3, + + NUM_CORNERS +}; + +enum NavRelativeDirType +{ + FORWARD = 0, + RIGHT, + BACKWARD, + LEFT, + UP, + DOWN, + + NUM_RELATIVE_DIRECTIONS +}; + +struct Extent +{ + Vector lo, hi; + + float SizeX( void ) const { return hi.x - lo.x; } + float SizeY( void ) const { return hi.y - lo.y; } + float SizeZ( void ) const { return hi.z - lo.z; } + float Area( void ) const { return SizeX() * SizeY(); } + + /// return true if 'pos' is inside of this extent + bool Contains( const Vector *pos ) const + { + return (pos->x >= lo.x && pos->x <= hi.x && + pos->y >= lo.y && pos->y <= hi.y && + pos->z >= lo.z && pos->z <= hi.z); + } +}; + +struct Ray +{ + Vector from, to; +}; + +class CNavArea; +class CNavNode; + +extern Extent NodeMapExtent; + + +//-------------------------------------------------------------------------------------------------------------- +inline NavDirType OppositeDirection( NavDirType dir ) +{ + switch( dir ) + { + case NORTH: return SOUTH; + case SOUTH: return NORTH; + case EAST: return WEST; + case WEST: return EAST; + } + + return NORTH; +} + +//-------------------------------------------------------------------------------------------------------------- +inline NavDirType DirectionLeft( NavDirType dir ) +{ + switch( dir ) + { + case NORTH: return WEST; + case SOUTH: return EAST; + case EAST: return NORTH; + case WEST: return SOUTH; + } + + return NORTH; +} + +//-------------------------------------------------------------------------------------------------------------- +inline NavDirType DirectionRight( NavDirType dir ) +{ + switch( dir ) + { + case NORTH: return EAST; + case SOUTH: return WEST; + case EAST: return SOUTH; + case WEST: return NORTH; + } + + return NORTH; +} + +//-------------------------------------------------------------------------------------------------------------- +inline void AddDirectionVector( Vector *v, NavDirType dir, float amount ) +{ + switch( dir ) + { + case NORTH: v->y -= amount; return; + case SOUTH: v->y += amount; return; + case EAST: v->x += amount; return; + case WEST: v->x -= amount; return; + } +} + +//-------------------------------------------------------------------------------------------------------------- +inline float DirectionToAngle( NavDirType dir ) +{ + switch( dir ) + { + case NORTH: return 270.0f; + case SOUTH: return 90.0f; + case EAST: return 0.0f; + case WEST: return 180.0f; + } + + return 0.0f; +} + +//-------------------------------------------------------------------------------------------------------------- +inline NavDirType AngleToDirection( float angle ) +{ + while( angle < 0.0f ) + angle += 360.0f; + + while( angle > 360.0f ) + angle -= 360.0f; + + if (angle < 45 || angle > 315) + return EAST; + + if (angle >= 45 && angle < 135) + return SOUTH; + + if (angle >= 135 && angle < 225) + return WEST; + + return NORTH; +} + +//-------------------------------------------------------------------------------------------------------------- +inline void DirectionToVector2D( NavDirType dir, Vector2D *v ) +{ + switch( dir ) + { + case NORTH: v->x = 0.0f; v->y = -1.0f; break; + case SOUTH: v->x = 0.0f; v->y = 1.0f; break; + case EAST: v->x = 1.0f; v->y = 0.0f; break; + case WEST: v->x = -1.0f; v->y = 0.0f; break; + } +} + +//-------------------------------------------------------------------------------------------------------------- +inline void SnapToGrid( Vector *pos ) +{ + int cx = pos->x / GenerationStepSize; + int cy = pos->y / GenerationStepSize; + pos->x = cx * GenerationStepSize; + pos->y = cy * GenerationStepSize; +} + +//-------------------------------------------------------------------------------------------------------------- +inline void SnapToGrid( float *value ) +{ + int c = *value / GenerationStepSize; + *value = c * GenerationStepSize; +} + +//-------------------------------------------------------------------------------------------------------------- +inline float NormalizeAngle( float angle ) +{ + while( angle < -180.0f ) + angle += 360.0f; + + while( angle > 180.0f ) + angle -= 360.0f; + + return angle; +} + +//-------------------------------------------------------------------------------------------------------------- +inline float NormalizeAnglePositive( float angle ) +{ + while( angle < 0.0f ) + angle += 360.0f; + + while( angle >= 360.0f ) + angle -= 360.0f; + + return angle; +} + +//-------------------------------------------------------------------------------------------------------------- +inline float AngleDifference( float a, float b ) +{ + float angleDiff = a - b; + + while (angleDiff > 180.0f) + angleDiff -= 360.0f; + while (angleDiff < -180.0f) + angleDiff += 360.0f; + + return angleDiff; +} + +//-------------------------------------------------------------------------------------------------------------- +inline bool AnglesAreEqual( float a, float b, float tolerance = 5.0f ) +{ + if (abs( AngleDifference( a, b ) ) < tolerance) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +inline bool VectorsAreEqual( const Vector *a, const Vector *b, float tolerance = 0.1f ) +{ + if (abs(a->x - b->x) < tolerance && + abs(a->y - b->y) < tolerance && + abs(a->z - b->z) < tolerance) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if given entity can be ignored when moving + */ +#define WALK_THRU_DOORS 0x01 +#define WALK_THRU_BREAKABLES 0x02 +inline bool IsEntityWalkable( entvars_t *entity, unsigned int flags ) +{ + // if we hit a door, assume its walkable because it will open when we touch it + if (FClassnameIs( entity, "func_door" ) || FClassnameIs( entity, "func_door_rotating" )) + return (flags & WALK_THRU_DOORS) ? true : false; + + // if we hit a breakable object, assume its walkable because we will shoot it when we touch it + if (FClassnameIs( entity, "func_breakable" ) && entity->takedamage == DAMAGE_YES) + return (flags & WALK_THRU_BREAKABLES) ? true : false; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Check LOS, ignoring any entities that we can walk through + */ +inline bool IsWalkableTraceLineClear( Vector &from, Vector &to, unsigned int flags = 0 ) +{ + TraceResult result; + edict_t *ignore = NULL; + Vector useFrom = from; + + while(true) + { + UTIL_TraceLine( useFrom, to, ignore_monsters, ignore, &result ); + + // if we hit a walkable entity, try again + if (result.flFraction != 1.0f && IsEntityWalkable( VARS( result.pHit ), flags )) + { + ignore = result.pHit; + + // start from just beyond where we hit to avoid infinite loops + Vector dir = to - from; + dir.NormalizeInPlace(); + useFrom = result.vecEndPos + 5.0f * dir; + } + else + { + break; + } + } + + if (result.flFraction == 1.0f) + return true; + + return false; +} + + +#endif // _NAV_H_ diff --git a/game_shared/bot/nav_area.cpp b/game_shared/bot/nav_area.cpp new file mode 100644 index 0000000..e031003 --- /dev/null +++ b/game_shared/bot/nav_area.cpp @@ -0,0 +1,5219 @@ +// nav_area.cpp +// AI Navigation areas +// Author: Michael S. Booth (mike@turtlerockstudios.com), January 2003 + +#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning +#pragma warning( disable : 4786 ) // long STL names get truncated in browse info. + +#include +#include +#include + +#include +#include +#include + +#ifdef _WIN32 +#include + +#else +#include +#define _write write +#define _close close +#define MAX_OSPATH PATH_MAX +#endif + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "player.h" +#include "gamerules.h" +#include "bot_util.h" + +/// @todo Abstract hostages and cs-bots out of here +#include "cs_bot.h" +#include "cs_bot_manager.h" +#include "hostage.h" + +#include "nav.h" +#include "nav_node.h" +#include "nav_area.h" + +#include "pm_shared.h" // for OBS_ROAMING + +extern void HintMessageToAllPlayers( const char *message ); + +unsigned int CNavArea::m_nextID = 1; +NavAreaList TheNavAreaList; + +NavLadderList TheNavLadderList; + +unsigned int CNavArea::m_masterMarker = 1; +CNavArea *CNavArea::m_openList = NULL; + +bool CNavArea::m_isReset = false; +static float lastDrawTimestamp = 0.0f; + +//-------------------------------------------------------------------------------------------------------------- +/** + * This list contains all "good-sized" areas used to compute "approach points" + */ +static NavAreaList goodSizedAreaList; + +static void buildGoodSizedList( void ) +{ + const float minSize = 200.0f; // 150 + + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + // skip the small areas + const Extent *extent = area->GetExtent(); + if (extent->SizeX() < minSize || extent->SizeY() < minSize) + continue; + + goodSizedAreaList.push_back( area ); + } +} + +//-------------------------------------------------------------------------------------------------------------- + +HidingSpotList TheHidingSpotList; +unsigned int HidingSpot::m_nextID = 1; +unsigned int HidingSpot::m_masterMarker = 0; + +void DestroyHidingSpots( void ) +{ + // remove all hiding spot references from the nav areas + for( NavAreaList::iterator areaIter = TheNavAreaList.begin(); areaIter != TheNavAreaList.end(); ++areaIter ) + { + CNavArea *area = *areaIter; + + area->m_hidingSpotList.clear(); + } + + HidingSpot::m_nextID = 0; + + // free all the HidingSpots + for( HidingSpotList::iterator iter = TheHidingSpotList.begin(); iter != TheHidingSpotList.end(); ++iter ) + delete *iter; + + TheHidingSpotList.clear(); +} + +/** + * For use when loading from a file + */ +HidingSpot::HidingSpot( void ) +{ + m_pos = Vector( 0, 0, 0 ); + m_id = 0; + m_flags = 0; + + TheHidingSpotList.push_back( this ); +} + +/** + * For use when generating - assigns unique ID + */ +HidingSpot::HidingSpot( const Vector *pos, unsigned char flags ) +{ + m_pos = *pos; + m_id = m_nextID++; + m_flags = flags; + + TheHidingSpotList.push_back( this ); +} + +void HidingSpot::Save( int fd, unsigned int version ) const +{ + _write( fd, &m_id, sizeof(unsigned int) ); + _write( fd, &m_pos, 3 * sizeof(float) ); + _write( fd, &m_flags, sizeof(unsigned char) ); +} + +void HidingSpot::Load( SteamFile *file, unsigned int version ) +{ + file->Read( &m_id, sizeof(unsigned int) ); + file->Read( &m_pos, 3 * sizeof(float) ); + file->Read( &m_flags, sizeof(unsigned char) ); + + // update next ID to avoid ID collisions by later spots + if (m_id >= m_nextID) + m_nextID = m_id+1; +} + +/** + * Given a HidingSpot ID, return the associated HidingSpot + */ +HidingSpot *GetHidingSpotByID( unsigned int id ) +{ + for( HidingSpotList::iterator iter = TheHidingSpotList.begin(); iter != TheHidingSpotList.end(); ++iter ) + { + HidingSpot *spot = *iter; + + if (spot->GetID() == id) + return spot; + } + + return NULL; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * To keep constructors consistent + */ +void CNavArea::Initialize( void ) +{ + m_marker = 0; + m_parent = NULL; + m_parentHow = GO_NORTH; + m_attributeFlags = 0; + m_place = 0; + + for ( int i=0; ix < otherCorner->x) + { + m_extent.lo.x = corner->x; + m_extent.hi.x = otherCorner->x; + } + else + { + m_extent.hi.x = corner->x; + m_extent.lo.x = otherCorner->x; + } + + if (corner->y < otherCorner->y) + { + m_extent.lo.y = corner->y; + m_extent.hi.y = otherCorner->y; + } + else + { + m_extent.hi.y = corner->y; + m_extent.lo.y = otherCorner->y; + } + + m_extent.lo.z = corner->z; + m_extent.hi.z = corner->z; + + m_center.x = (m_extent.lo.x + m_extent.hi.x)/2.0f; + m_center.y = (m_extent.lo.y + m_extent.hi.y)/2.0f; + m_center.z = (m_extent.lo.z + m_extent.hi.z)/2.0f; + + m_neZ = corner->z; + m_swZ = otherCorner->z; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * + */ +CNavArea::CNavArea( const Vector *nwCorner, const Vector *neCorner, const Vector *seCorner, const Vector *swCorner ) +{ + Initialize(); + + m_extent.lo = *nwCorner; + m_extent.hi = *seCorner; + + m_center.x = (m_extent.lo.x + m_extent.hi.x)/2.0f; + m_center.y = (m_extent.lo.y + m_extent.hi.y)/2.0f; + m_center.z = (m_extent.lo.z + m_extent.hi.z)/2.0f; + + m_neZ = neCorner->z; + m_swZ = swCorner->z; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Constructor used during generation phase. + */ +CNavArea::CNavArea( CNavNode *nwNode, CNavNode *neNode, CNavNode *seNode, CNavNode *swNode ) +{ + Initialize(); + + m_extent.lo = *nwNode->GetPosition(); + m_extent.hi = *seNode->GetPosition(); + + m_center.x = (m_extent.lo.x + m_extent.hi.x)/2.0f; + m_center.y = (m_extent.lo.y + m_extent.hi.y)/2.0f; + m_center.z = (m_extent.lo.z + m_extent.hi.z)/2.0f; + + m_neZ = neNode->GetPosition()->z; + m_swZ = swNode->GetPosition()->z; + + m_node[ NORTH_WEST ] = nwNode; + m_node[ NORTH_EAST ] = neNode; + m_node[ SOUTH_EAST ] = seNode; + m_node[ SOUTH_WEST ] = swNode; + + // mark internal nodes as part of this area + AssignNodes( this ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Destructor + */ +CNavArea::~CNavArea() +{ + // if we are resetting the system, don't bother cleaning up - all areas are being destroyed + if (m_isReset) + return; + + // tell the other areas we are going away + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + if (area == this) + continue; + + area->OnDestroyNotify( this ); + } + + // unhook from ladders + for( int i=0; iOnDestroyNotify( this ); + } + } + + // remove the area from the grid + TheNavAreaGrid.RemoveNavArea( this ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * This is invoked when an area is going away. + * Remove any references we have to it. + */ +void CNavArea::OnDestroyNotify( CNavArea *dead ) +{ + NavConnect con; + con.area = dead; + for( int d=0; dm_id, dirName[ dir ] ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Disconnect this area from given area + */ +void CNavArea::Disconnect( CNavArea *area ) +{ + NavConnect connect; + connect.area = area; + + for( int dir = 0; dirGetPosition(); + m_extent.hi = *m_node[ SOUTH_EAST ]->GetPosition(); + + m_center.x = (m_extent.lo.x + m_extent.hi.x)/2.0f; + m_center.y = (m_extent.lo.y + m_extent.hi.y)/2.0f; + m_center.z = (m_extent.lo.z + m_extent.hi.z)/2.0f; + + m_neZ = m_node[ NORTH_EAST ]->GetPosition()->z; + m_swZ = m_node[ SOUTH_WEST ]->GetPosition()->z; + + // reassign the adjacent area's internal nodes to the final area + adjArea->AssignNodes( this ); + + // merge adjacency links - we gain all the connections that adjArea had + MergeAdjacentConnections( adjArea ); + + // remove subsumed adjacent area + TheNavAreaList.remove( adjArea ); + delete adjArea; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * For merging with "adjArea" - pick up all of "adjArea"s connections + */ +void CNavArea::MergeAdjacentConnections( CNavArea *adjArea ) +{ + // merge adjacency links - we gain all the connections that adjArea had + NavConnectList::iterator iter; + int dir; + for( dir = 0; dirm_connect[ dir ].begin(); iter != adjArea->m_connect[ dir ].end(); ++iter ) + { + NavConnect connect = *iter; + + if (connect.area != adjArea && connect.area != this) + ConnectTo( connect.area, (NavDirType)dir ); + } + } + + // remove any references from this area to the adjacent area, since it is now part of us + for( dir = 0; dirm_connect[ dir ].begin(); iter != area->m_connect[ dir ].end(); ++iter ) + { + NavConnect connect = *iter; + + if (connect.area == adjArea) + { + connected = true; + break; + } + } + + if (connected) + { + // remove all references to adjArea + NavConnect connect; + connect.area = adjArea; + area->m_connect[dir].remove( connect ); + + // remove all references to the new area + connect.area = this; + area->m_connect[dir].remove( connect ); + + // add a single connection to the new area + connect.area = this; + area->m_connect[dir].push_back( connect ); + } + } + } + +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Assign internal nodes to the given area + * NOTE: "internal" nodes do not include the east or south border nodes + */ +void CNavArea::AssignNodes( CNavArea *area ) +{ + CNavNode *horizLast = m_node[ NORTH_EAST ]; + + for( CNavNode *vertNode = m_node[ NORTH_WEST ]; vertNode != m_node[ SOUTH_WEST ]; vertNode = vertNode->GetConnectedNode( SOUTH ) ) + { + for( CNavNode *horizNode = vertNode; horizNode != horizLast; horizNode = horizNode->GetConnectedNode( EAST ) ) + { + horizNode->AssignArea( area ); + } + + horizLast = horizLast->GetConnectedNode( SOUTH ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Split this area into two areas at the given edge. + * Preserve all adjacency connections. + * NOTE: This does not update node connections, only areas. + */ +bool CNavArea::SplitEdit( bool splitAlongX, float splitEdge, CNavArea **outAlpha, CNavArea **outBeta ) +{ + CNavArea *alpha = NULL; + CNavArea *beta = NULL; + + if (splitAlongX) + { + // +-----+->X + // | A | + // +-----+ + // | B | + // +-----+ + // | + // Y + + // don't do split if at edge of area + if (splitEdge <= m_extent.lo.y + 1.0f) + return false; + + if (splitEdge >= m_extent.hi.y - 1.0f) + return false; + + alpha = new CNavArea; + alpha->m_extent.lo = m_extent.lo; + + alpha->m_extent.hi.x = m_extent.hi.x; + alpha->m_extent.hi.y = splitEdge; + alpha->m_extent.hi.z = GetZ( &alpha->m_extent.hi ); + + beta = new CNavArea; + beta->m_extent.lo.x = m_extent.lo.x; + beta->m_extent.lo.y = splitEdge; + beta->m_extent.lo.z = GetZ( &beta->m_extent.lo ); + + beta->m_extent.hi = m_extent.hi; + + alpha->ConnectTo( beta, SOUTH ); + beta->ConnectTo( alpha, NORTH ); + + FinishSplitEdit( alpha, SOUTH ); + FinishSplitEdit( beta, NORTH ); + } + else + { + // +--+--+->X + // | | | + // | A|B | + // | | | + // +--+--+ + // | + // Y + + // don't do split if at edge of area + if (splitEdge <= m_extent.lo.x + 1.0f) + return false; + + if (splitEdge >= m_extent.hi.x - 1.0f) + return false; + + alpha = new CNavArea; + alpha->m_extent.lo = m_extent.lo; + + alpha->m_extent.hi.x = splitEdge; + alpha->m_extent.hi.y = m_extent.hi.y; + alpha->m_extent.hi.z = GetZ( &alpha->m_extent.hi ); + + beta = new CNavArea; + beta->m_extent.lo.x = splitEdge; + beta->m_extent.lo.y = m_extent.lo.y; + beta->m_extent.lo.z = GetZ( &beta->m_extent.lo ); + + beta->m_extent.hi = m_extent.hi; + + alpha->ConnectTo( beta, EAST ); + beta->ConnectTo( alpha, WEST ); + + FinishSplitEdit( alpha, EAST ); + FinishSplitEdit( beta, WEST ); + } + + // new areas inherit attributes from original area + alpha->SetAttributes( GetAttributes() ); + beta->SetAttributes( GetAttributes() ); + + // new areas inherit place from original area + alpha->SetPlace( GetPlace() ); + beta->SetPlace( GetPlace() ); + + // return new areas + if (outAlpha) + *outAlpha = alpha; + + if (outBeta) + *outBeta = beta; + + // remove original area + TheNavAreaList.remove( this ); + delete this; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if given area is connected in given direction + * if dir == NUM_DIRECTIONS, check all directions (direction is unknown) + * @todo Formalize "asymmetric" flag on connections + */ +bool CNavArea::IsConnected( const CNavArea *area, NavDirType dir ) const +{ + // we are connected to ourself + if (area == this) + return true; + + NavConnectList::const_iterator iter; + + if (dir == NUM_DIRECTIONS) + { + // search all directions + for( int d=0; dm_topBehindArea == area || + ladder->m_topForwardArea == area || + ladder->m_topLeftArea == area || + ladder->m_topRightArea == area) + return true; + } + + for( liter = m_ladder[ LADDER_DOWN ].begin(); liter != m_ladder[ LADDER_DOWN ].end(); ++liter ) + { + CNavLadder *ladder = *liter; + + if (ladder->m_bottomArea == area) + return true; + } + } + else + { + // check specific direction + for( iter = m_connect[ dir ].begin(); iter != m_connect[ dir ].end(); ++iter ) + { + if (area == (*iter).area) + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute change in height from this area to given area + * @todo This is approximate for now + */ +float CNavArea::ComputeHeightChange( const CNavArea *area ) +{ + float ourZ = GetZ( GetCenter() ); + float areaZ = area->GetZ( area->GetCenter() ); + + return areaZ - ourZ; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Given the portion of the original area, update its internal data + * The "ignoreEdge" direction defines the side of the original area that the new area does not include + */ +void CNavArea::FinishSplitEdit( CNavArea *newArea, NavDirType ignoreEdge ) +{ + newArea->m_center.x = (newArea->m_extent.lo.x + newArea->m_extent.hi.x)/2.0f; + newArea->m_center.y = (newArea->m_extent.lo.y + newArea->m_extent.hi.y)/2.0f; + newArea->m_center.z = (newArea->m_extent.lo.z + newArea->m_extent.hi.z)/2.0f; + + newArea->m_neZ = GetZ( newArea->m_extent.hi.x, newArea->m_extent.lo.y ); + newArea->m_swZ = GetZ( newArea->m_extent.lo.x, newArea->m_extent.hi.y ); + + // connect to adjacent areas + for( int d=0; dIsOverlappingX( adj )) + { + newArea->ConnectTo( adj, (NavDirType)d ); + + // add reciprocal connection if needed + if (adj->IsConnected( this, OppositeDirection( (NavDirType)d ))) + adj->ConnectTo( newArea, OppositeDirection( (NavDirType)d ) ); + } + break; + + case EAST: + case WEST: + if (newArea->IsOverlappingY( adj )) + { + newArea->ConnectTo( adj, (NavDirType)d ); + + // add reciprocal connection if needed + if (adj->IsConnected( this, OppositeDirection( (NavDirType)d ))) + adj->ConnectTo( newArea, OppositeDirection( (NavDirType)d ) ); + } + break; + } + } + } + + TheNavAreaList.push_back( newArea ); + TheNavAreaGrid.AddNavArea( newArea ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Create a new area between this area and given area + */ +bool CNavArea::SpliceEdit( CNavArea *other ) +{ + CNavArea *newArea = NULL; + Vector nw, ne, se, sw; + + if (m_extent.lo.x > other->m_extent.hi.x) + { + // 'this' is east of 'other' + float top = max( m_extent.lo.y, other->m_extent.lo.y ); + float bottom = min( m_extent.hi.y, other->m_extent.hi.y ); + + nw.x = other->m_extent.hi.x; + nw.y = top; + nw.z = other->GetZ( &nw ); + + se.x = m_extent.lo.x; + se.y = bottom; + se.z = GetZ( &se ); + + ne.x = se.x; + ne.y = nw.y; + ne.z = GetZ( &ne ); + + sw.x = nw.x; + sw.y = se.y; + sw.z = other->GetZ( &sw ); + + newArea = new CNavArea( &nw, &ne, &se, &sw ); + + this->ConnectTo( newArea, WEST ); + newArea->ConnectTo( this, EAST ); + + other->ConnectTo( newArea, EAST ); + newArea->ConnectTo( other, WEST ); + } + else if (m_extent.hi.x < other->m_extent.lo.x) + { + // 'this' is west of 'other' + float top = max( m_extent.lo.y, other->m_extent.lo.y ); + float bottom = min( m_extent.hi.y, other->m_extent.hi.y ); + + nw.x = m_extent.hi.x; + nw.y = top; + nw.z = GetZ( &nw ); + + se.x = other->m_extent.lo.x; + se.y = bottom; + se.z = other->GetZ( &se ); + + ne.x = se.x; + ne.y = nw.y; + ne.z = other->GetZ( &ne ); + + sw.x = nw.x; + sw.y = se.y; + sw.z = GetZ( &sw ); + + newArea = new CNavArea( &nw, &ne, &se, &sw ); + + this->ConnectTo( newArea, EAST ); + newArea->ConnectTo( this, WEST ); + + other->ConnectTo( newArea, WEST ); + newArea->ConnectTo( other, EAST ); + } + else // 'this' overlaps in X + { + if (m_extent.lo.y > other->m_extent.hi.y) + { + // 'this' is south of 'other' + float left = max( m_extent.lo.x, other->m_extent.lo.x ); + float right = min( m_extent.hi.x, other->m_extent.hi.x ); + + nw.x = left; + nw.y = other->m_extent.hi.y; + nw.z = other->GetZ( &nw ); + + se.x = right; + se.y = m_extent.lo.y; + se.z = GetZ( &se ); + + ne.x = se.x; + ne.y = nw.y; + ne.z = other->GetZ( &ne ); + + sw.x = nw.x; + sw.y = se.y; + sw.z = GetZ( &sw ); + + newArea = new CNavArea( &nw, &ne, &se, &sw ); + + this->ConnectTo( newArea, NORTH ); + newArea->ConnectTo( this, SOUTH ); + + other->ConnectTo( newArea, SOUTH ); + newArea->ConnectTo( other, NORTH ); + } + else if (m_extent.hi.y < other->m_extent.lo.y) + { + // 'this' is north of 'other' + float left = max( m_extent.lo.x, other->m_extent.lo.x ); + float right = min( m_extent.hi.x, other->m_extent.hi.x ); + + nw.x = left; + nw.y = m_extent.hi.y; + nw.z = GetZ( &nw ); + + se.x = right; + se.y = other->m_extent.lo.y; + se.z = other->GetZ( &se ); + + ne.x = se.x; + ne.y = nw.y; + ne.z = GetZ( &ne ); + + sw.x = nw.x; + sw.y = se.y; + sw.z = other->GetZ( &sw ); + + newArea = new CNavArea( &nw, &ne, &se, &sw ); + + this->ConnectTo( newArea, SOUTH ); + newArea->ConnectTo( this, NORTH ); + + other->ConnectTo( newArea, NORTH ); + newArea->ConnectTo( other, SOUTH ); + } + else + { + // areas overlap + return false; + } + } + + // if both areas have the same place, the new area inherits it + if (GetPlace() == other->GetPlace()) + { + newArea->SetPlace( GetPlace() ); + } + else if (GetPlace() == UNDEFINED_PLACE) + { + newArea->SetPlace( other->GetPlace() ); + } + else if (other->GetPlace() == UNDEFINED_PLACE) + { + newArea->SetPlace( GetPlace() ); + } + else + { + // both have valid, but different places - pick on at random + if (RANDOM_LONG( 0, 100 ) < 50) + newArea->SetPlace( GetPlace() ); + else + newArea->SetPlace( other->GetPlace() ); + } + + TheNavAreaList.push_back( newArea ); + TheNavAreaGrid.AddNavArea( newArea ); + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Merge this area and given adjacent area + */ +bool CNavArea::MergeEdit( CNavArea *adj ) +{ + // can only merge if attributes of both areas match + + + // check that these areas can be merged + const float tolerance = 1.0f; + bool merge = false; + if (ABS( m_extent.lo.x - adj->m_extent.lo.x ) < tolerance && + ABS( m_extent.hi.x - adj->m_extent.hi.x ) < tolerance) + merge = true; + + if (ABS( m_extent.lo.y - adj->m_extent.lo.y ) < tolerance && + ABS( m_extent.hi.y - adj->m_extent.hi.y ) < tolerance) + merge = true; + + if (merge == false) + return false; + + Extent origExtent = m_extent; + + // update extent + if (m_extent.lo.x > adj->m_extent.lo.x || m_extent.lo.y > adj->m_extent.lo.y) + m_extent.lo = adj->m_extent.lo; + + if (m_extent.hi.x < adj->m_extent.hi.x || m_extent.hi.y < adj->m_extent.hi.y) + m_extent.hi = adj->m_extent.hi; + + m_center.x = (m_extent.lo.x + m_extent.hi.x)/2.0f; + m_center.y = (m_extent.lo.y + m_extent.hi.y)/2.0f; + m_center.z = (m_extent.lo.z + m_extent.hi.z)/2.0f; + + if (m_extent.hi.x > origExtent.hi.x || m_extent.lo.y < origExtent.lo.y) + m_neZ = adj->GetZ( m_extent.hi.x, m_extent.lo.y ); + else + m_neZ = GetZ( m_extent.hi.x, m_extent.lo.y ); + + if (m_extent.lo.x < origExtent.lo.x || m_extent.hi.y > origExtent.hi.y) + m_swZ = adj->GetZ( m_extent.lo.x, m_extent.hi.y ); + else + m_swZ = GetZ( m_extent.lo.x, m_extent.hi.y ); + + // merge adjacency links - we gain all the connections that adjArea had + MergeAdjacentConnections( adj ); + + // remove subsumed adjacent area + TheNavAreaList.remove( adj ); + delete adj; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +void ApproachAreaAnalysisPrep( void ) +{ + // collect "good-sized" areas for computing approach areas + buildGoodSizedList(); +} + +//-------------------------------------------------------------------------------------------------------------- +void CleanupApproachAreaAnalysisPrep( void ) +{ + goodSizedAreaList.clear(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Destroy ladder representations + */ +void DestroyLadders( void ) +{ + while( !TheNavLadderList.empty() ) + { + CNavLadder *ladder = TheNavLadderList.front(); + TheNavLadderList.pop_front(); + delete ladder; + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Free navigation map data. + */ +void DestroyNavigationMap( void ) +{ + CNavArea::m_isReset = true; + + // remove each element of the list and delete them + while( !TheNavAreaList.empty() ) + { + CNavArea *area = TheNavAreaList.front(); + TheNavAreaList.pop_front(); + delete area; + } + + CNavArea::m_isReset = false; + + // destroy ladder representations + DestroyLadders(); + + // destroy all hiding spots + DestroyHidingSpots(); + + // destroy navigation nodes created during map learning + CNavNode *node, *next; + for( node = CNavNode::m_list; node; node = next ) + { + next = node->m_next; + delete node; + } + CNavNode::m_list = NULL; + + // reset the grid + TheNavAreaGrid.Reset(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Strip the "analyzed" data out of all navigation areas + */ +void StripNavigationAreas( void ) +{ + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + area->Strip(); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Remove "analyzed" data from nav area + */ +void CNavArea::Strip( void ) +{ + m_approachCount = 0; + m_spotEncounterList.clear(); // memory leak +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Start at given position and find first area in given direction + */ +inline CNavArea *FindFirstAreaInDirection( const Vector *start, NavDirType dir, float range, float beneathLimit, CBaseEntity *traceIgnore = NULL, Vector *closePos = NULL ) +{ + CNavArea *area = NULL; + + Vector pos = *start; + + int end = (int)((range / GenerationStepSize) + 0.5f); + + for( int i=1; i<=end; i++ ) + { + AddDirectionVector( &pos, dir, GenerationStepSize ); + + // make sure we dont look thru the wall + TraceResult result; + + if (traceIgnore) + UTIL_TraceLine( *start, pos, ignore_monsters, ENT( traceIgnore->pev ), &result ); + else + UTIL_TraceLine( *start, pos, ignore_monsters, NULL, &result ); + + if (result.flFraction != 1.0f) + break; + + area = TheNavAreaGrid.GetNavArea( &pos, beneathLimit ); + if (area) + { + if (closePos) + { + closePos->x = pos.x; + closePos->y = pos.y; + closePos->z = area->GetZ( pos.x, pos.y ); + } + + break; + } + } + + return area; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Determine if we can "jump down" from given point + */ +inline bool testJumpDown( const Vector *fromPos, const Vector *toPos ) +{ + float dz = fromPos->z - toPos->z; + + // drop can't be too far, or too short (or nonexistant) + if (dz <= JumpCrouchHeight || dz >= DeathDrop) + return false; + + // + // Check LOS out and down + // + // ------+ + // | + // F | + // | + // T + // + + Vector from( fromPos->x, fromPos->y, fromPos->z + HumanHeight ); + Vector to( toPos->x, toPos->y, from.z ); + + TraceResult result; + UTIL_TraceLine( from, to, ignore_monsters, NULL, &result ); + if (result.flFraction != 1.0f || result.fStartSolid) + return false; + + from = to; + to.z = toPos->z + 2.0f; + UTIL_TraceLine( from, to, ignore_monsters, NULL, &result ); + if (result.flFraction != 1.0f || result.fStartSolid) + return false; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +inline CNavArea *findJumpDownArea( const Vector *fromPos, NavDirType dir ) +{ + Vector start( fromPos->x, fromPos->y, fromPos->z + HalfHumanHeight ); + AddDirectionVector( &start, dir, GenerationStepSize/2.0f ); + + Vector toPos; + CNavArea *downArea = FindFirstAreaInDirection( &start, dir, 4.0f * GenerationStepSize, DeathDrop, NULL, &toPos ); + + if (downArea && testJumpDown( fromPos, &toPos )) + return downArea; + + return NULL; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Define connections between adjacent generated areas + */ +void ConnectGeneratedAreas( void ) +{ + CONSOLE_ECHO( " Connecting navigation areas...\n" ); + + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + // scan along edge nodes, stepping one node over into the next area + // for now, only use bi-directional connections + + // north edge + CNavNode *node; + for( node = area->m_node[ NORTH_WEST ]; node != area->m_node[ NORTH_EAST ]; node = node->GetConnectedNode( EAST ) ) + { + CNavNode *adj = node->GetConnectedNode( NORTH ); + + if (adj && adj->GetArea() && adj->GetConnectedNode( SOUTH ) == node) + { + area->ConnectTo( adj->GetArea(), NORTH ); + } + else + { + CNavArea *downArea = findJumpDownArea( node->GetPosition(), NORTH ); + if (downArea && downArea != area) + area->ConnectTo( downArea, NORTH ); + } + } + + // west edge + for( node = area->m_node[ NORTH_WEST ]; node != area->m_node[ SOUTH_WEST ]; node = node->GetConnectedNode( SOUTH ) ) + { + CNavNode *adj = node->GetConnectedNode( WEST ); + + if (adj && adj->GetArea() && adj->GetConnectedNode( EAST ) == node) + { + area->ConnectTo( adj->GetArea(), WEST ); + } + else + { + CNavArea *downArea = findJumpDownArea( node->GetPosition(), WEST ); + if (downArea && downArea != area) + area->ConnectTo( downArea, WEST ); + } + } + + // south edge - this edge's nodes are actually part of adjacent areas + // move one node north, and scan west to east + /// @todo This allows one-node-wide areas - do we want this? + node = area->m_node[ SOUTH_WEST ]; + node = node->GetConnectedNode( NORTH ); + if (node) + { + CNavNode *end = area->m_node[ SOUTH_EAST ]->GetConnectedNode( NORTH ); + /// @todo Figure out why cs_backalley gets a NULL node in here... + for( ; node && node != end; node = node->GetConnectedNode( EAST ) ) + { + CNavNode *adj = node->GetConnectedNode( SOUTH ); + + if (adj && adj->GetArea() && adj->GetConnectedNode( NORTH ) == node) + { + area->ConnectTo( adj->GetArea(), SOUTH ); + } + else + { + CNavArea *downArea = findJumpDownArea( node->GetPosition(), SOUTH ); + if (downArea && downArea != area) + area->ConnectTo( downArea, SOUTH ); + } + } + } + + // east edge - this edge's nodes are actually part of adjacent areas + node = area->m_node[ NORTH_EAST ]; + node = node->GetConnectedNode( WEST ); + if (node) + { + CNavNode *end = area->m_node[ SOUTH_EAST ]->GetConnectedNode( WEST ); + for( ; node && node != end; node = node->GetConnectedNode( SOUTH ) ) + { + CNavNode *adj = node->GetConnectedNode( EAST ); + + if (adj && adj->GetArea() && adj->GetConnectedNode( WEST ) == node) + { + area->ConnectTo( adj->GetArea(), EAST ); + } + else + { + CNavArea *downArea = findJumpDownArea( node->GetPosition(), EAST ); + if (downArea && downArea != area) + area->ConnectTo( downArea, EAST ); + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Merge areas together to make larger ones (must remain rectangular - convex). + * Areas can only be merged if their attributes match. + */ +void MergeGeneratedAreas( void ) +{ + CONSOLE_ECHO( " Merging navigation areas...\n" ); + + bool merged; + + do + { + merged = false; + + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + // north edge + NavConnectList::iterator citer; + for( citer = area->m_connect[ NORTH ].begin(); citer != area->m_connect[ NORTH ].end(); ++citer ) + { + CNavArea *adjArea = (*citer).area; + + if (area->m_node[ NORTH_WEST ] == adjArea->m_node[ SOUTH_WEST ] && + area->m_node[ NORTH_EAST ] == adjArea->m_node[ SOUTH_EAST ] && + area->GetAttributes() == adjArea->GetAttributes() && + area->IsCoplanar( adjArea )) + { + // merge vertical + area->m_node[ NORTH_WEST ] = adjArea->m_node[ NORTH_WEST ]; + area->m_node[ NORTH_EAST ] = adjArea->m_node[ NORTH_EAST ]; + + merged = true; + //CONSOLE_ECHO( " Merged (north) areas #%d and #%d\n", area->m_id, adjArea->m_id ); + + area->FinishMerge( adjArea ); + + // restart scan - iterator is invalidated + break; + } + } + + if (merged) + break; + + // south edge + for( citer = area->m_connect[ SOUTH ].begin(); citer != area->m_connect[ SOUTH ].end(); ++citer ) + { + CNavArea *adjArea = (*citer).area; + + if (adjArea->m_node[ NORTH_WEST ] == area->m_node[ SOUTH_WEST ] && + adjArea->m_node[ NORTH_EAST ] == area->m_node[ SOUTH_EAST ] && + area->GetAttributes() == adjArea->GetAttributes() && + area->IsCoplanar( adjArea )) + { + // merge vertical + area->m_node[ SOUTH_WEST ] = adjArea->m_node[ SOUTH_WEST ]; + area->m_node[ SOUTH_EAST ] = adjArea->m_node[ SOUTH_EAST ]; + + merged = true; + //CONSOLE_ECHO( " Merged (south) areas #%d and #%d\n", area->m_id, adjArea->m_id ); + + area->FinishMerge( adjArea ); + + // restart scan - iterator is invalidated + break; + } + + } + + if (merged) + break; + + + // west edge + for( citer = area->m_connect[ WEST ].begin(); citer != area->m_connect[ WEST ].end(); ++citer ) + { + CNavArea *adjArea = (*citer).area; + + if (area->m_node[ NORTH_WEST ] == adjArea->m_node[ NORTH_EAST ] && + area->m_node[ SOUTH_WEST ] == adjArea->m_node[ SOUTH_EAST ] && + area->GetAttributes() == adjArea->GetAttributes() && + area->IsCoplanar( adjArea )) + { + // merge horizontal + area->m_node[ NORTH_WEST ] = adjArea->m_node[ NORTH_WEST ]; + area->m_node[ SOUTH_WEST ] = adjArea->m_node[ SOUTH_WEST ]; + + merged = true; + //CONSOLE_ECHO( " Merged (west) areas #%d and #%d\n", area->m_id, adjArea->m_id ); + + area->FinishMerge( adjArea ); + + // restart scan - iterator is invalidated + break; + } + + } + + if (merged) + break; + + // east edge + for( citer = area->m_connect[ EAST ].begin(); citer != area->m_connect[ EAST ].end(); ++citer ) + { + CNavArea *adjArea = (*citer).area; + + if (adjArea->m_node[ NORTH_WEST ] == area->m_node[ NORTH_EAST ] && + adjArea->m_node[ SOUTH_WEST ] == area->m_node[ SOUTH_EAST ] && + area->GetAttributes() == adjArea->GetAttributes() && + area->IsCoplanar( adjArea )) + { + // merge horizontal + area->m_node[ NORTH_EAST ] = adjArea->m_node[ NORTH_EAST ]; + area->m_node[ SOUTH_EAST ] = adjArea->m_node[ SOUTH_EAST ]; + + merged = true; + //CONSOLE_ECHO( " Merged (east) areas #%d and #%d\n", area->m_id, adjArea->m_id ); + + area->FinishMerge( adjArea ); + + // restart scan - iterator is invalidated + break; + } + } + + if (merged) + break; + } + } + while( merged ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if area is more or less square. + * This is used when merging to prevent long, thin, areas being created. + */ +inline bool IsAreaRoughlySquare( const CNavArea *area ) +{ + float aspect = area->GetSizeX() / area->GetSizeY(); + + const float maxAspect = 3.01; + const float minAspect = 1.0f / maxAspect; + if (aspect < minAspect || aspect > maxAspect) + return false; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Recursively chop area in half along X until child areas are roughly square + */ +void SplitX( CNavArea *area ) +{ + if (IsAreaRoughlySquare( area )) + return; + + float split = area->GetSizeX(); + split /= 2.0f; + split += area->GetExtent()->lo.x; + + SnapToGrid( &split ); + + const float epsilon = 0.1f; + if (abs(split - area->GetExtent()->lo.x) < epsilon || + abs(split - area->GetExtent()->hi.x) < epsilon) + { + // too small to subdivide + return; + } + + CNavArea *alpha, *beta; + if (area->SplitEdit( false, split, &alpha, &beta )) + { + // split each new area until square + SplitX( alpha ); + SplitX( beta ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Recursively chop area in half along Y until child areas are roughly square + */ +void SplitY( CNavArea *area ) +{ + if (IsAreaRoughlySquare( area )) + return; + + float split = area->GetSizeY(); + split /= 2.0f; + split += area->GetExtent()->lo.y; + + SnapToGrid( &split ); + + const float epsilon = 0.1f; + if (abs(split - area->GetExtent()->lo.y) < epsilon || + abs(split - area->GetExtent()->hi.y) < epsilon) + { + // too small to subdivide + return; + } + + CNavArea *alpha, *beta; + if (area->SplitEdit( true, split, &alpha, &beta )) + { + // split each new area until square + SplitY( alpha ); + SplitY( beta ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Split any long, thin, areas into roughly square chunks. + */ +void SquareUpAreas( void ) +{ + NavAreaList::iterator iter = TheNavAreaList.begin(); + + while( iter != TheNavAreaList.end() ) + { + CNavArea *area = *iter; + ++iter; + + if (!IsAreaRoughlySquare( area )) + { + // chop this area into square pieces + if (area->GetSizeX() > area->GetSizeY()) + SplitX( area ); + else + SplitY( area ); + } + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Check if an rectangular area of the given size can be + * made starting from the given node as the NW corner. + * Only consider fully connected nodes for this check. + * All of the nodes within the test area must have the same attributes. + * All of the nodes must be approximately co-planar w.r.t the NW node's normal, with the + * exception of 1x1 areas which can be any angle. + */ +bool TestArea( CNavNode *node, int width, int height ) +{ + Vector normal = *node->GetNormal(); + float d = -DotProduct( normal, *node->GetPosition() ); + + const float offPlaneTolerance = 5.0f; + + CNavNode *vertNode, *horizNode; + + vertNode = node; + for( int y=0; yGetAttributes() != node->GetAttributes()) + return false; + + if (horizNode->IsCovered()) + return false; + + if (!horizNode->IsClosedCell()) + return false; + + horizNode = horizNode->GetConnectedNode( EAST ); + if (horizNode == NULL) + return false; + + // nodes must lie on/near the plane + if (width > 1 || height > 1) + { + float dist = abs(DotProduct( *horizNode->GetPosition(), normal ) + d); + if (dist > offPlaneTolerance) + return false; + } + } + + vertNode = vertNode->GetConnectedNode( SOUTH ); + if (vertNode == NULL) + return false; + + // nodes must lie on/near the plane + if (width > 1 || height > 1) + { + float dist = abs(DotProduct( *vertNode->GetPosition(), normal ) + d); + if (dist > offPlaneTolerance) + return false; + } + } + + // check planarity of southern edge + if (width > 1 || height > 1) + { + horizNode = vertNode; + + for( int x=0; xGetConnectedNode( EAST ); + if (horizNode == NULL) + return false; + + // nodes must lie on/near the plane + float dist = abs(DotProduct( *horizNode->GetPosition(), normal ) + d); + if (dist > offPlaneTolerance) + return false; + } + } + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Create a nav area, and mark all nodes it overlaps as "covered" + * NOTE: Nodes on the east and south edges are not included. + * Returns number of nodes covered by this area, or -1 for error; + */ +int BuildArea( CNavNode *node, int width, int height ) +{ + //CONSOLE_ECHO( "BuildArea( #%d, %d, %d )\n", node->GetID(), width, height ); + + CNavNode *nwNode = node; + CNavNode *neNode = NULL; + CNavNode *swNode = NULL; + CNavNode *seNode = NULL; + + CNavNode *vertNode = node; + CNavNode *horizNode; + + int coveredNodes = 0; + + for( int y=0; yCover(); + ++coveredNodes; + + horizNode = horizNode->GetConnectedNode( EAST ); + } + + if (y == 0) + neNode = horizNode; + + vertNode = vertNode->GetConnectedNode( SOUTH ); + } + + swNode = vertNode; + + horizNode = vertNode; + for( int x=0; xGetConnectedNode( EAST ); + } + seNode = horizNode; + + if (!nwNode || !neNode || !seNode || !swNode) + { + CONSOLE_ECHO( "ERROR: BuildArea - NULL node.\n" ); + return -1; + } + + CNavArea *area = new CNavArea( nwNode, neNode, seNode, swNode ); + TheNavAreaList.push_back( area ); + + // since all internal nodes have the same attributes, set this area's attributes + area->SetAttributes( node->GetAttributes() ); + +// fprintf( fp, "f %d %d %d %d\n", nwNode->m_id, neNode->m_id, seNode->m_id, swNode->m_id ); + + return coveredNodes; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * For each ladder in the map, create a navigation representation of it. + */ +void BuildLadders( void ) +{ + // remove any left-over ladders + DestroyLadders(); + + TraceResult result; + CBaseEntity *entity = UTIL_FindEntityByClassname( NULL, "func_ladder" ); + while( entity && !FNullEnt( entity->edict() ) ) + { + CNavLadder *ladder = new CNavLadder; + + // compute top & bottom of ladder + ladder->m_top.x = (entity->pev->absmin.x + entity->pev->absmax.x) / 2.0f; + ladder->m_top.y = (entity->pev->absmin.y + entity->pev->absmax.y) / 2.0f; + ladder->m_top.z = entity->pev->absmax.z; + + ladder->m_bottom.x = ladder->m_top.x; + ladder->m_bottom.y = ladder->m_top.y; + ladder->m_bottom.z = entity->pev->absmin.z; + + // determine facing - assumes "normal" runged ladder + float xSize = entity->pev->absmax.x - entity->pev->absmin.x; + float ySize = entity->pev->absmax.y - entity->pev->absmin.y; + if (xSize > ySize) + { + // ladder is facing north or south - determine which way + // "pull in" traceline from bottom and top in case ladder abuts floor and/or ceiling + Vector from = ladder->m_bottom + Vector( 0.0f, GenerationStepSize, GenerationStepSize ); + Vector to = ladder->m_top + Vector( 0.0f, GenerationStepSize, -GenerationStepSize ); + + UTIL_TraceLine( from, to, ignore_monsters, ENT( entity->pev ), &result ); + + if (result.flFraction != 1.0f || result.fStartSolid) + ladder->m_dir = NORTH; + else + ladder->m_dir = SOUTH; + } + else + { + // ladder is facing east or west - determine which way + Vector from = ladder->m_bottom + Vector( GenerationStepSize, 0.0f, GenerationStepSize ); + Vector to = ladder->m_top + Vector( GenerationStepSize, 0.0f, -GenerationStepSize ); + + UTIL_TraceLine( from, to, ignore_monsters, ENT( entity->pev ), &result ); + + if (result.flFraction != 1.0f || result.fStartSolid) + ladder->m_dir = WEST; + else + ladder->m_dir = EAST; + } + + // adjust top and bottom of ladder to make sure they are reachable + // (cs_office has a crate right in front of the base of a ladder) + Vector along = ladder->m_top - ladder->m_bottom; + float length = along.NormalizeInPlace(); + Vector on, out; + const float minLadderClearance = 32.0f; + + // adjust bottom to bypass blockages + const float inc = 10.0f; + float t; + for( t = 0.0f; t <= length; t += inc ) + { + on = ladder->m_bottom + t * along; + + out = on; + AddDirectionVector( &out, ladder->m_dir, minLadderClearance ); + + UTIL_TraceLine( on, out, ignore_monsters, ENT( entity->pev ), &result ); + + if (result.flFraction == 1.0f && !result.fStartSolid) + { + // found viable ladder bottom + ladder->m_bottom = on; + break; + } + } + + // adjust top to bypass blockages + for( t = 0.0f; t <= length; t += inc ) + { + on = ladder->m_top - t * along; + + out = on; + AddDirectionVector( &out, ladder->m_dir, minLadderClearance ); + + UTIL_TraceLine( on, out, ignore_monsters, ENT( entity->pev ), &result ); + + if (result.flFraction == 1.0f && !result.fStartSolid) + { + // found viable ladder top + ladder->m_top = on; + break; + } + } + + ladder->m_length = (ladder->m_top - ladder->m_bottom).Length(); + + DirectionToVector2D( ladder->m_dir, &ladder->m_dirVector ); + + ladder->m_entity = entity; + const float nearLadderRange = 75.0f; // 50 + + // + // Find naviagtion area at bottom of ladder + // + + // get approximate postion of player on ladder + Vector center = ladder->m_bottom + Vector( 0, 0, GenerationStepSize ); + AddDirectionVector( ¢er, ladder->m_dir, HalfHumanWidth ); + + ladder->m_bottomArea = TheNavAreaGrid.GetNearestNavArea( ¢er, true ); + if (!ladder->m_bottomArea) + { + ALERT( at_console, "ERROR: Unconnected ladder bottom at ( %g, %g, %g )\n", ladder->m_bottom.x, ladder->m_bottom.y, ladder->m_bottom.z ); + } + else + { + // store reference to ladder in the area + ladder->m_bottomArea->AddLadderUp( ladder ); + } + + // + // Find adjacent navigation areas at the top of the ladder + // + + // get approximate postion of player on ladder + center = ladder->m_top + Vector( 0, 0, GenerationStepSize ); + AddDirectionVector( ¢er, ladder->m_dir, HalfHumanWidth ); + + // find "ahead" area + ladder->m_topForwardArea = FindFirstAreaInDirection( ¢er, OppositeDirection( ladder->m_dir ), nearLadderRange, 120.0f, entity ); + if (ladder->m_topForwardArea == ladder->m_bottomArea) + ladder->m_topForwardArea = NULL; + + // find "left" area + ladder->m_topLeftArea = FindFirstAreaInDirection( ¢er, DirectionLeft( ladder->m_dir ), nearLadderRange, 120.0f, entity ); + if (ladder->m_topLeftArea == ladder->m_bottomArea) + ladder->m_topLeftArea = NULL; + + // find "right" area + ladder->m_topRightArea = FindFirstAreaInDirection( ¢er, DirectionRight( ladder->m_dir ), nearLadderRange, 120.0f, entity ); + if (ladder->m_topRightArea == ladder->m_bottomArea) + ladder->m_topRightArea = NULL; + + // find "behind" area - must look farther, since ladder is against the wall away from this area + ladder->m_topBehindArea = FindFirstAreaInDirection( ¢er, ladder->m_dir, 2.0f*nearLadderRange, 120.0f, entity ); + if (ladder->m_topBehindArea == ladder->m_bottomArea) + ladder->m_topBehindArea = NULL; + + // can't include behind area, since it is not used when going up a ladder + if (!ladder->m_topForwardArea && !ladder->m_topLeftArea && !ladder->m_topRightArea) + ALERT( at_console, "ERROR: Unconnected ladder top at ( %g, %g, %g )\n", ladder->m_top.x, ladder->m_top.y, ladder->m_top.z ); + + // store reference to ladder in the area(s) + if (ladder->m_topForwardArea) + ladder->m_topForwardArea->AddLadderDown( ladder ); + + if (ladder->m_topLeftArea) + ladder->m_topLeftArea->AddLadderDown( ladder ); + + if (ladder->m_topRightArea) + ladder->m_topRightArea->AddLadderDown( ladder ); + + if (ladder->m_topBehindArea) + ladder->m_topBehindArea->AddLadderDown( ladder ); + + // adjust top of ladder to highest connected area + float topZ = -99999.9f; + bool topAdjusted = false; + CNavArea *topAreaList[4]; + topAreaList[0] = ladder->m_topForwardArea; + topAreaList[1] = ladder->m_topLeftArea; + topAreaList[2] = ladder->m_topRightArea; + topAreaList[3] = ladder->m_topBehindArea; + + for( int a=0; a<4; ++a ) + { + CNavArea *topArea = topAreaList[a]; + if (topArea == NULL) + continue; + + Vector close; + topArea->GetClosestPointOnArea( &ladder->m_top, &close ); + if (topZ < close.z) + { + topZ = close.z; + topAdjusted = true; + } + } + + if (topAdjusted) + ladder->m_top.z = topZ; + + // + // Determine whether this ladder is "dangling" or not + // "Dangling" ladders are too high to go up + // + ladder->m_isDangling = false; + if (ladder->m_bottomArea) + { + Vector bottomSpot; + ladder->m_bottomArea->GetClosestPointOnArea( &ladder->m_bottom, &bottomSpot ); + if (ladder->m_bottom.z - bottomSpot.z > HumanHeight) + ladder->m_isDangling = true; + } + + // add ladder to global list + TheNavLadderList.push_back( ladder ); + + entity = UTIL_FindEntityByClassname( entity, "func_ladder" ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Mark all areas that require a jump to get through them. + * This currently relies on jump areas having extreme slope. + */ +void MarkJumpAreas( void ) +{ + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + Vector u, v; + + // compute our unit surface normal + u.x = area->m_extent.hi.x - area->m_extent.lo.x; + u.y = 0.0f; + u.z = area->m_neZ - area->m_extent.lo.z; + + v.x = 0.0f; + v.y = area->m_extent.hi.y - area->m_extent.lo.y; + v.z = area->m_swZ - area->m_extent.lo.z; + + Vector normal = CrossProduct( u, v ); + normal.NormalizeInPlace(); + + if (normal.z < MaxUnitZSlope) + area->SetAttributes( area->GetAttributes() | NAV_JUMP ); + } +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * This function uses the CNavNodes that have been sampled from the map to + * generate CNavAreas - rectangular areas of "walkable" space. These areas + * are connected to each other, allowing the AI to know how to move from + * area to area. + * + * This is a "greedy" algorithm that attempts to cover the walkable area + * with the fewest, largest, rectangles. + */ +void GenerateNavigationAreaMesh( void ) +{ + // haven't yet seen a map use larger than 30... + int tryWidth = 50; + int tryHeight = 50; + int uncoveredNodes = CNavNode::GetListLength(); + + while( uncoveredNodes > 0 ) + { + for( CNavNode *node = CNavNode::GetFirst(); node; node = node->GetNext() ) + { + if (node->IsCovered()) + continue; + + if (TestArea( node, tryWidth, tryHeight )) + { + int covered = BuildArea( node, tryWidth, tryHeight ); + if (covered < 0) + { + CONSOLE_ECHO( "GenerateNavigationAreaMesh: Error - Data corrupt.\n" ); + return; + } + + uncoveredNodes -= covered; + } + } + + if (tryWidth >= tryHeight) + --tryWidth; + else + --tryHeight; + + if (tryWidth <= 0 || tryHeight <= 0) + break; + } + + Extent extent; + extent.lo.x = 9999999999.9f; + extent.lo.y = 9999999999.9f; + extent.hi.x = -9999999999.9f; + extent.hi.y = -9999999999.9f; + + // compute total extent + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + const Extent *areaExtent = area->GetExtent(); + + if (areaExtent->lo.x < extent.lo.x) + extent.lo.x = areaExtent->lo.x; + if (areaExtent->lo.y < extent.lo.y) + extent.lo.y = areaExtent->lo.y; + if (areaExtent->hi.x > extent.hi.x) + extent.hi.x = areaExtent->hi.x; + if (areaExtent->hi.y > extent.hi.y) + extent.hi.y = areaExtent->hi.y; + } + + // add the areas to the grid + TheNavAreaGrid.Initialize( extent.lo.x, extent.hi.x, extent.lo.y, extent.hi.y ); + + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + TheNavAreaGrid.AddNavArea( *iter ); + + + ConnectGeneratedAreas(); + MergeGeneratedAreas(); + SquareUpAreas(); + MarkJumpAreas(); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if 'pos' is within 2D extents of area. + */ +bool CNavArea::IsOverlapping( const Vector *pos ) const +{ + if (pos->x >= m_extent.lo.x && pos->x <= m_extent.hi.x && + pos->y >= m_extent.lo.y && pos->y <= m_extent.hi.y) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if 'area' overlaps our 2D extents + */ +bool CNavArea::IsOverlapping( const CNavArea *area ) const +{ + if (area->m_extent.lo.x < m_extent.hi.x && area->m_extent.hi.x > m_extent.lo.x && + area->m_extent.lo.y < m_extent.hi.y && area->m_extent.hi.y > m_extent.lo.y) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if 'area' overlaps our X extent + */ +bool CNavArea::IsOverlappingX( const CNavArea *area ) const +{ + if (area->m_extent.lo.x < m_extent.hi.x && area->m_extent.hi.x > m_extent.lo.x) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if 'area' overlaps our Y extent + */ +bool CNavArea::IsOverlappingY( const CNavArea *area ) const +{ + if (area->m_extent.lo.y < m_extent.hi.y && area->m_extent.hi.y > m_extent.lo.y) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if given point is on or above this area, but no others + */ +bool CNavArea::Contains( const Vector *pos ) const +{ + // check 2D overlap + if (!IsOverlapping( pos )) + return false; + + // the point overlaps us, check that it is above us, but not above any areas that overlap us + float ourZ = GetZ( pos ); + + // if we are above this point, fail + if (ourZ > pos->z) + return false; + + for( NavAreaList::const_iterator iter = m_overlapList.begin(); iter != m_overlapList.end(); ++iter ) + { + const CNavArea *area = *iter; + + // skip self + if (area == this) + continue; + + // check 2D overlap + if (!area->IsOverlapping( pos )) + continue; + + float theirZ = area->GetZ( pos ); + if (theirZ > pos->z) + { + // they are above the point + continue; + } + + if (theirZ > ourZ) + { + // we are below an area that is closer underneath the point + return false; + } + } + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if this area and given area are approximately co-planar + */ +bool CNavArea::IsCoplanar( const CNavArea *area ) const +{ + Vector u, v; + + // compute our unit surface normal + u.x = m_extent.hi.x - m_extent.lo.x; + u.y = 0.0f; + u.z = m_neZ - m_extent.lo.z; + + v.x = 0.0f; + v.y = m_extent.hi.y - m_extent.lo.y; + v.z = m_swZ - m_extent.lo.z; + + Vector normal = CrossProduct( u, v ); + normal.NormalizeInPlace(); + + + // compute their unit surface normal + u.x = area->m_extent.hi.x - area->m_extent.lo.x; + u.y = 0.0f; + u.z = area->m_neZ - area->m_extent.lo.z; + + v.x = 0.0f; + v.y = area->m_extent.hi.y - area->m_extent.lo.y; + v.z = area->m_swZ - area->m_extent.lo.z; + + Vector otherNormal = CrossProduct( u, v ); + otherNormal.NormalizeInPlace(); + + // can only merge areas that are nearly planar, to ensure areas do not differ from underlying geometry much + const float tolerance = 0.99f; // 0.7071f; // 0.9 + if (DotProduct( normal, otherNormal ) > tolerance) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return Z of area at (x,y) of 'pos' + * Trilinear interpolation of Z values at quad edges. + * NOTE: pos->z is not used. + */ +float CNavArea::GetZ( const Vector *pos ) const +{ + float dx = m_extent.hi.x - m_extent.lo.x; + float dy = m_extent.hi.y - m_extent.lo.y; + + // guard against division by zero due to degenerate areas + if (dx == 0.0f || dy == 0.0f) + return m_neZ; + + float u = (pos->x - m_extent.lo.x) / dx; + float v = (pos->y - m_extent.lo.y) / dy; + + // clamp Z values to (x,y) volume + if (u < 0.0f) + u = 0.0f; + else if (u > 1.0f) + u = 1.0f; + + if (v < 0.0f) + v = 0.0f; + else if (v > 1.0f) + v = 1.0f; + + float northZ = m_extent.lo.z + u * (m_neZ - m_extent.lo.z); + float southZ = m_swZ + u * (m_extent.hi.z - m_swZ); + + return northZ + v * (southZ - northZ); +} + +float CNavArea::GetZ( float x, float y ) const +{ + Vector pos( x, y, 0.0f ); + return GetZ( &pos ); +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return closest point to 'pos' on 'area'. + * Returned point is in 'close'. + */ +void CNavArea::GetClosestPointOnArea( const Vector *pos, Vector *close ) const +{ + const Extent *extent = GetExtent(); + + if (pos->x < extent->lo.x) + { + if (pos->y < extent->lo.y) + { + // position is north-west of area + *close = extent->lo; + } + else if (pos->y > extent->hi.y) + { + // position is south-west of area + close->x = extent->lo.x; + close->y = extent->hi.y; + } + else + { + // position is west of area + close->x = extent->lo.x; + close->y = pos->y; + } + } + else if (pos->x > extent->hi.x) + { + if (pos->y < extent->lo.y) + { + // position is north-east of area + close->x = extent->hi.x; + close->y = extent->lo.y; + } + else if (pos->y > extent->hi.y) + { + // position is south-east of area + *close = extent->hi; + } + else + { + // position is east of area + close->x = extent->hi.x; + close->y = pos->y; + } + } + else if (pos->y < extent->lo.y) + { + // position is north of area + close->x = pos->x; + close->y = extent->lo.y; + } + else if (pos->y > extent->hi.y) + { + // position is south of area + close->x = pos->x; + close->y = extent->hi.y; + } + else + { + // position is inside of area - it is the 'closest point' to itself + *close = *pos; + } + + close->z = GetZ( close ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return shortest distance squared between point and this area + */ +float CNavArea::GetDistanceSquaredToPoint( const Vector *pos ) const +{ + const Extent *extent = GetExtent(); + + if (pos->x < extent->lo.x) + { + if (pos->y < extent->lo.y) + { + // position is north-west of area + return (extent->lo - *pos).LengthSquared(); + } + else if (pos->y > extent->hi.y) + { + // position is south-west of area + Vector d; + d.x = extent->lo.x - pos->x; + d.y = extent->hi.y - pos->y; + d.z = m_swZ - pos->z; + return d.LengthSquared(); + } + else + { + // position is west of area + float d = extent->lo.x - pos->x; + return d * d; + } + } + else if (pos->x > extent->hi.x) + { + if (pos->y < extent->lo.y) + { + // position is north-east of area + Vector d; + d.x = extent->hi.x - pos->x; + d.y = extent->lo.y - pos->y; + d.z = m_neZ - pos->z; + return d.LengthSquared(); + } + else if (pos->y > extent->hi.y) + { + // position is south-east of area + return (extent->hi - *pos).LengthSquared(); + } + else + { + // position is east of area + float d = pos->z - extent->hi.x; + return d * d; + } + } + else if (pos->y < extent->lo.y) + { + // position is north of area + float d = extent->lo.y - pos->y; + return d * d; + } + else if (pos->y > extent->hi.y) + { + // position is south of area + float d = pos->y - extent->hi.y; + return d * d; + } + else + { + // position is inside of 2D extent of area - find delta Z + float z = GetZ( pos ); + float d = z - pos->z; + return d * d; + } +} + + + +//-------------------------------------------------------------------------------------------------------------- +CNavArea *CNavArea::GetRandomAdjacentArea( NavDirType dir ) const +{ + int count = m_connect[ dir ].size(); + int which = RANDOM_LONG( 0, count-1 ); + + int i = 0; + NavConnectList::const_iterator iter; + for( iter = m_connect[ dir ].begin(); iter != m_connect[ dir ].end(); ++iter ) + { + if (i == which) + return (*iter).area; + + i++; + } + + return NULL; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute "portal" between to adjacent areas. + * Return center of portal opening, and half-width defining sides of portal from center. + * NOTE: center->z is unset. + */ +void CNavArea::ComputePortal( const CNavArea *to, NavDirType dir, Vector *center, float *halfWidth ) const +{ + if (dir == NORTH || dir == SOUTH) + { + if (dir == NORTH) + center->y = m_extent.lo.y; + else + center->y = m_extent.hi.y; + + float left = max( m_extent.lo.x, to->m_extent.lo.x ); + float right = min( m_extent.hi.x, to->m_extent.hi.x ); + + // clamp to our extent in case areas are disjoint + if (left < m_extent.lo.x) + left = m_extent.lo.x; + else if (left > m_extent.hi.x) + left = m_extent.hi.x; + + if (right < m_extent.lo.x) + right = m_extent.lo.x; + else if (right > m_extent.hi.x) + right = m_extent.hi.x; + + center->x = (left + right)/2.0f; + *halfWidth = (right - left)/2.0f; + } + else // EAST or WEST + { + if (dir == WEST) + center->x = m_extent.lo.x; + else + center->x = m_extent.hi.x; + + float top = max( m_extent.lo.y, to->m_extent.lo.y ); + float bottom = min( m_extent.hi.y, to->m_extent.hi.y ); + + // clamp to our extent in case areas are disjoint + if (top < m_extent.lo.y) + top = m_extent.lo.y; + else if (top > m_extent.hi.y) + top = m_extent.hi.y; + + if (bottom < m_extent.lo.y) + bottom = m_extent.lo.y; + else if (bottom > m_extent.hi.y) + bottom = m_extent.hi.y; + + center->y = (top + bottom)/2.0f; + *halfWidth = (bottom - top)/2.0f; + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute closest point within the "portal" between to adjacent areas. + */ +void CNavArea::ComputeClosestPointInPortal( const CNavArea *to, NavDirType dir, const Vector *fromPos, Vector *closePos ) const +{ + const float margin = GenerationStepSize/2.0f; + + if (dir == NORTH || dir == SOUTH) + { + if (dir == NORTH) + closePos->y = m_extent.lo.y; + else + closePos->y = m_extent.hi.y; + + float left = max( m_extent.lo.x, to->m_extent.lo.x ); + float right = min( m_extent.hi.x, to->m_extent.hi.x ); + + // clamp to our extent in case areas are disjoint + if (left < m_extent.lo.x) + left = m_extent.lo.x; + else if (left > m_extent.hi.x) + left = m_extent.hi.x; + + if (right < m_extent.lo.x) + right = m_extent.lo.x; + else if (right > m_extent.hi.x) + right = m_extent.hi.x; + + // keep margin if against edge + const float leftMargin = (to->IsEdge( WEST )) ? (left + margin) : left; + const float rightMargin = (to->IsEdge( EAST )) ? (right - margin) : right; + + // limit x to within portal + if (fromPos->x < leftMargin) + closePos->x = leftMargin; + else if (fromPos->x > rightMargin) + closePos->x = rightMargin; + else + closePos->x = fromPos->x; + + } + else // EAST or WEST + { + if (dir == WEST) + closePos->x = m_extent.lo.x; + else + closePos->x = m_extent.hi.x; + + float top = max( m_extent.lo.y, to->m_extent.lo.y ); + float bottom = min( m_extent.hi.y, to->m_extent.hi.y ); + + // clamp to our extent in case areas are disjoint + if (top < m_extent.lo.y) + top = m_extent.lo.y; + else if (top > m_extent.hi.y) + top = m_extent.hi.y; + + if (bottom < m_extent.lo.y) + bottom = m_extent.lo.y; + else if (bottom > m_extent.hi.y) + bottom = m_extent.hi.y; + + // keep margin if against edge + const float topMargin = (to->IsEdge( NORTH )) ? (top + margin) : top; + const float bottomMargin = (to->IsEdge( SOUTH )) ? (bottom - margin) : bottom; + + // limit y to within portal + if (fromPos->y < topMargin) + closePos->y = topMargin; + else if (fromPos->y > bottomMargin) + closePos->y = bottomMargin; + else + closePos->y = fromPos->y; + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if there are no bi-directional links on the given side + */ +bool CNavArea::IsEdge( NavDirType dir ) const +{ + for( NavConnectList::const_iterator it = m_connect[ dir ].begin(); it != m_connect[ dir ].end(); ++it ) + { + const NavConnect connect = *it; + + if (connect.area->IsConnected( this, OppositeDirection( dir ) )) + return false; + } + + return true; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return direction from this area to the given point + */ +NavDirType CNavArea::ComputeDirection( Vector *point ) const +{ + if (point->x >= m_extent.lo.x && point->x <= m_extent.hi.x) + { + if (point->y < m_extent.lo.y) + return NORTH; + else if (point->y > m_extent.hi.y) + return SOUTH; + } + else if (point->y >= m_extent.lo.y && point->y <= m_extent.hi.y) + { + if (point->x < m_extent.lo.x) + return WEST; + else if (point->x > m_extent.hi.x) + return EAST; + } + + // find closest direction + Vector to = *point - m_center; + + if (abs(to.x) > abs(to.y)) + { + if (to.x > 0.0f) + return EAST; + return WEST; + } + else + { + if (to.y > 0.0f) + return SOUTH; + return NORTH; + } + + return NUM_DIRECTIONS; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Draw area for debugging + */ +void CNavArea::Draw( byte red, byte green, byte blue, int duration ) +{ + Vector nw, ne, sw, se; + + nw = m_extent.lo; + se = m_extent.hi; + ne.x = se.x; + ne.y = nw.y; + ne.z = m_neZ; + sw.x = nw.x; + sw.y = se.y; + sw.z = m_swZ; + + nw.z += cv_bot_nav_zdraw.value; + ne.z += cv_bot_nav_zdraw.value; + sw.z += cv_bot_nav_zdraw.value; + se.z += cv_bot_nav_zdraw.value; + + float border = 2.0f; + nw.x += border; + nw.y += border; + ne.x -= border; + ne.y += border; + sw.x += border; + sw.y -= border; + se.x -= border; + se.y -= border; + + UTIL_DrawBeamPoints( nw, ne, duration, red, green, blue ); + UTIL_DrawBeamPoints( ne, se, duration, red, green, blue ); + UTIL_DrawBeamPoints( se, sw, duration, red, green, blue ); + UTIL_DrawBeamPoints( sw, nw, duration, red, green, blue ); + + if (GetAttributes() & NAV_CROUCH) + UTIL_DrawBeamPoints( nw, se, duration, red, green, blue ); + + if (GetAttributes() & NAV_JUMP) + { + UTIL_DrawBeamPoints( nw, se, duration, red, green, blue ); + UTIL_DrawBeamPoints( ne, sw, duration, red, green, blue ); + } + + if (GetAttributes() & NAV_PRECISE) + { + float size = 8.0f; + Vector up( m_center.x, m_center.y - size, m_center.z + cv_bot_nav_zdraw.value ); + Vector down( m_center.x, m_center.y + size, m_center.z + cv_bot_nav_zdraw.value ); + UTIL_DrawBeamPoints( up, down, duration, red, green, blue ); + + Vector left( m_center.x - size, m_center.y, m_center.z + cv_bot_nav_zdraw.value ); + Vector right( m_center.x + size, m_center.y, m_center.z + cv_bot_nav_zdraw.value ); + UTIL_DrawBeamPoints( left, right, duration, red, green, blue ); + } + + if (GetAttributes() & NAV_NO_JUMP) + { + float size = 8.0f; + Vector up( m_center.x, m_center.y - size, m_center.z + cv_bot_nav_zdraw.value ); + Vector down( m_center.x, m_center.y + size, m_center.z + cv_bot_nav_zdraw.value ); + Vector left( m_center.x - size, m_center.y, m_center.z + cv_bot_nav_zdraw.value ); + Vector right( m_center.x + size, m_center.y, m_center.z + cv_bot_nav_zdraw.value ); + UTIL_DrawBeamPoints( up, right, duration, red, green, blue ); + UTIL_DrawBeamPoints( right, down, duration, red, green, blue ); + UTIL_DrawBeamPoints( down, left, duration, red, green, blue ); + UTIL_DrawBeamPoints( left, up, duration, red, green, blue ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Draw selected corner for debugging + */ +void CNavArea::DrawMarkedCorner( NavCornerType corner, byte red, byte green, byte blue, int duration ) +{ + Vector nw, ne, sw, se; + + nw = m_extent.lo; + se = m_extent.hi; + ne.x = se.x; + ne.y = nw.y; + ne.z = m_neZ; + sw.x = nw.x; + sw.y = se.y; + sw.z = m_swZ; + + nw.z += cv_bot_nav_zdraw.value; + ne.z += cv_bot_nav_zdraw.value; + sw.z += cv_bot_nav_zdraw.value; + se.z += cv_bot_nav_zdraw.value; + + float border = 2.0f; + nw.x += border; + nw.y += border; + ne.x -= border; + ne.y += border; + sw.x += border; + sw.y -= border; + se.x -= border; + se.y -= border; + + switch( corner ) + { + case NORTH_WEST: + UTIL_DrawBeamPoints( nw + Vector( 0, 0, 10 ), nw, duration, red, green, blue ); + break; + case NORTH_EAST: + UTIL_DrawBeamPoints( ne + Vector( 0, 0, 10 ), ne, duration, red, green, blue ); + break; + case SOUTH_EAST: + UTIL_DrawBeamPoints( se + Vector( 0, 0, 10 ), se, duration, red, green, blue ); + break; + case SOUTH_WEST: + UTIL_DrawBeamPoints( sw + Vector( 0, 0, 10 ), sw, duration, red, green, blue ); + break; + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Add to open list in decreasing value order + */ +void CNavArea::AddToOpenList( void ) +{ + // mark as being on open list for quick check + m_openMarker = m_masterMarker; + + // if list is empty, add and return + if (m_openList == NULL) + { + m_openList = this; + this->m_prevOpen = NULL; + this->m_nextOpen = NULL; + return; + } + + // insert self in ascending cost order + CNavArea *area, *last = NULL; + for( area = m_openList; area; area = area->m_nextOpen ) + { + if (this->GetTotalCost() < area->GetTotalCost()) + break; + + last = area; + } + + if (area) + { + // insert before this area + this->m_prevOpen = area->m_prevOpen; + if (this->m_prevOpen) + this->m_prevOpen->m_nextOpen = this; + else + m_openList = this; + + this->m_nextOpen = area; + area->m_prevOpen = this; + } + else + { + // append to end of list + last->m_nextOpen = this; + + this->m_prevOpen = last; + this->m_nextOpen = NULL; + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * A smaller value has been found, update this area on the open list + * @todo "bubbling" does unnecessary work, since the order of all other nodes will be unchanged - only this node is altered + */ +void CNavArea::UpdateOnOpenList( void ) +{ + // since value can only decrease, bubble this area up from current spot + while( m_prevOpen && + this->GetTotalCost() < m_prevOpen->GetTotalCost() ) + { + // swap position with predecessor + CNavArea *other = m_prevOpen; + CNavArea *before = other->m_prevOpen; + CNavArea *after = this->m_nextOpen; + + this->m_nextOpen = other; + this->m_prevOpen = before; + + other->m_prevOpen = this; + other->m_nextOpen = after; + + if (before) + before->m_nextOpen = this; + else + m_openList = this; + + if (after) + after->m_prevOpen = other; + } +} + +//-------------------------------------------------------------------------------------------------------------- +void CNavArea::RemoveFromOpenList( void ) +{ + if (m_prevOpen) + m_prevOpen->m_nextOpen = m_nextOpen; + else + m_openList = m_nextOpen; + + if (m_nextOpen) + m_nextOpen->m_prevOpen = m_prevOpen; + + // zero is an invalid marker + m_openMarker = 0; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Clears the open and closed lists for a new search + */ +void CNavArea::ClearSearchLists( void ) +{ + // effectively clears all open list pointers and closed flags + CNavArea::MakeNewMarker(); + + m_openList = NULL; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the coordinates of the area's corner. + * NOTE: Do not retain the returned pointer - it is temporary. + */ +const Vector *CNavArea::GetCorner( NavCornerType corner ) const +{ + static Vector pos; + + switch( corner ) + { + case NORTH_WEST: + return &m_extent.lo; + + case NORTH_EAST: + pos.x = m_extent.hi.x; + pos.y = m_extent.lo.y; + pos.z = m_neZ; + return &pos; + + case SOUTH_WEST: + pos.x = m_extent.lo.x; + pos.y = m_extent.hi.y; + pos.z = m_swZ; + return &pos; + + case SOUTH_EAST: + return &m_extent.hi; + } + + return NULL; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Returns true if an existing hiding spot is too close to given position + */ +bool CNavArea::IsHidingSpotCollision( const Vector *pos ) const +{ + const float collisionRange = 30.0f; + + for( HidingSpotList::const_iterator iter = m_hidingSpotList.begin(); iter != m_hidingSpotList.end(); ++iter ) + { + const HidingSpot *spot = *iter; + + if ((*spot->GetPosition() - *pos).IsLengthLessThan( collisionRange )) + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +bool IsHidingSpotInCover( const Vector *spot ) +{ + int coverCount = 0; + TraceResult result; + + Vector from = *spot; + from.z += HalfHumanHeight; + + Vector to; + + // if we are crouched underneath something, that counts as good cover + to = from + Vector( 0, 0, 20.0f ); + UTIL_TraceLine( from, to, ignore_monsters, NULL, &result ); + if (result.flFraction != 1.0f) + return true; + + const float coverRange = 100.0f; + const float inc = M_PI / 8.0f; + + for( float angle = 0.0f; angle < 2.0f * M_PI; angle += inc ) + { + to = from + Vector( coverRange * cos(angle), coverRange * sin(angle), HalfHumanHeight ); + + UTIL_TraceLine( from, to, ignore_monsters, NULL, &result ); + + // if traceline hit something, it hit "cover" + if (result.flFraction != 1.0f) + ++coverCount; + } + + // if more than half of the circle has no cover, the spot is not "in cover" + const int halfCover = 8; + if (coverCount < halfCover) + return false; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Analyze local area neighborhood to find "hiding spots" for this area + */ +void CNavArea::ComputeHidingSpots( void ) +{ + struct + { + float lo, hi; + } + extent; + + // "jump areas" cannot have hiding spots + if (GetAttributes() & NAV_JUMP) + return; + + int cornerCount[NUM_CORNERS]; + for( int i=0; iIsConnected( this, OppositeDirection( static_cast( d ) ) ) == false) + continue; + + // ignore jump areas + if (connect.area->GetAttributes() & NAV_JUMP) + continue; + + if (isHoriz) + { + if (connect.area->m_extent.lo.x < extent.lo) + extent.lo = connect.area->m_extent.lo.x; + + if (connect.area->m_extent.hi.x > extent.hi) + extent.hi = connect.area->m_extent.hi.x; + } + else + { + if (connect.area->m_extent.lo.y < extent.lo) + extent.lo = connect.area->m_extent.lo.y; + + if (connect.area->m_extent.hi.y > extent.hi) + extent.hi = connect.area->m_extent.hi.y; + } + } + + switch( d ) + { + case NORTH: + if (extent.lo - m_extent.lo.x >= cornerSize) + ++cornerCount[ NORTH_WEST ]; + + if (m_extent.hi.x - extent.hi >= cornerSize) + ++cornerCount[ NORTH_EAST ]; + break; + + case SOUTH: + if (extent.lo - m_extent.lo.x >= cornerSize) + ++cornerCount[ SOUTH_WEST ]; + + if (m_extent.hi.x - extent.hi >= cornerSize) + ++cornerCount[ SOUTH_EAST ]; + break; + + case EAST: + if (extent.lo - m_extent.lo.y >= cornerSize) + ++cornerCount[ NORTH_EAST ]; + + if (m_extent.hi.y - extent.hi >= cornerSize) + ++cornerCount[ SOUTH_EAST ]; + break; + + case WEST: + if (extent.lo - m_extent.lo.y >= cornerSize) + ++cornerCount[ NORTH_WEST ]; + + if (m_extent.hi.y - extent.hi >= cornerSize) + ++cornerCount[ SOUTH_WEST ]; + break; + } + } + + // if a corner count is 2, then it really is a corner (walls on both sides) + float offset = 12.5f; + + if (cornerCount[ NORTH_WEST ] == 2) + { + Vector pos = *GetCorner( NORTH_WEST ) + Vector( offset, offset, 0.0f ); + + m_hidingSpotList.push_back( new HidingSpot( &pos, (IsHidingSpotInCover( &pos )) ? HidingSpot::IN_COVER : 0 ) ); + } + + if (cornerCount[ NORTH_EAST ] == 2) + { + Vector pos = *GetCorner( NORTH_EAST ) + Vector( -offset, offset, 0.0f ); + if (!IsHidingSpotCollision( &pos )) + m_hidingSpotList.push_back( new HidingSpot( &pos, (IsHidingSpotInCover( &pos )) ? HidingSpot::IN_COVER : 0 ) ); + } + + if (cornerCount[ SOUTH_WEST ] == 2) + { + Vector pos = *GetCorner( SOUTH_WEST ) + Vector( offset, -offset, 0.0f ); + if (!IsHidingSpotCollision( &pos )) + m_hidingSpotList.push_back( new HidingSpot( &pos, (IsHidingSpotInCover( &pos )) ? HidingSpot::IN_COVER : 0 ) ); + } + + if (cornerCount[ SOUTH_EAST ] == 2) + { + Vector pos = *GetCorner( SOUTH_EAST ) + Vector( -offset, -offset, 0.0f ); + if (!IsHidingSpotCollision( &pos )) + m_hidingSpotList.push_back( new HidingSpot( &pos, (IsHidingSpotInCover( &pos )) ? HidingSpot::IN_COVER : 0 ) ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Determine how much walkable area we can see from the spot, and how far away we can see. + */ +void ClassifySniperSpot( HidingSpot *spot ) +{ + Vector eye = *spot->GetPosition() + Vector( 0, 0, HalfHumanHeight ); // assume we are crouching + Vector walkable; + TraceResult result; + + Extent sniperExtent; + float farthestRangeSq = 0.0f; + const float minSniperRangeSq = 1000.0f * 1000.0f; + bool found = false; + + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + const Extent *extent = area->GetExtent(); + + // scan this area + for( walkable.y = extent->lo.y + GenerationStepSize/2.0f; walkable.y < extent->hi.y; walkable.y += GenerationStepSize ) + { + for( walkable.x = extent->lo.x + GenerationStepSize/2.0f; walkable.x < extent->hi.x; walkable.x += GenerationStepSize ) + { + walkable.z = area->GetZ( &walkable ) + HalfHumanHeight; + + // check line of sight + UTIL_TraceLine( eye, walkable, ignore_monsters, ignore_glass, NULL, &result ); + + if (result.flFraction == 1.0f && !result.fStartSolid) + { + // can see this spot + + // keep track of how far we can see + float rangeSq = (eye - walkable).LengthSquared(); + if (rangeSq > farthestRangeSq) + { + farthestRangeSq = rangeSq; + + if (rangeSq >= minSniperRangeSq) + { + // this is a sniper spot + // determine how good of a sniper spot it is by keeping track of the snipable area + if (found) + { + if (walkable.x < sniperExtent.lo.x) + sniperExtent.lo.x = walkable.x; + if (walkable.x > sniperExtent.hi.x) + sniperExtent.hi.x = walkable.x; + + if (walkable.y < sniperExtent.lo.y) + sniperExtent.lo.y = walkable.y; + if (walkable.y > sniperExtent.hi.y) + sniperExtent.hi.y = walkable.y; + } + else + { + sniperExtent.lo = walkable; + sniperExtent.hi = walkable; + found = true; + } + } + } + } + } + } + } + + if (found) + { + // if we can see a large snipable area, it is an "ideal" spot + float snipableArea = sniperExtent.Area(); + + const float minIdealSniperArea = 200.0f * 200.0f; + const float longSniperRangeSq = 1500.0f * 1500.0f; + + if (snipableArea >= minIdealSniperArea || farthestRangeSq >= longSniperRangeSq) + spot->SetFlags( HidingSpot::IDEAL_SNIPER_SPOT ); + else + spot->SetFlags( HidingSpot::GOOD_SNIPER_SPOT ); + } +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Analyze local area neighborhood to find "sniper spots" for this area + */ +void CNavArea::ComputeSniperSpots( void ) +{ + if (cv_bot_quicksave.value > 0.0f) + return; + + for( HidingSpotList::iterator iter = m_hidingSpotList.begin(); iter != m_hidingSpotList.end(); ++iter ) + { + HidingSpot *spot = *iter; + + ClassifySniperSpot( spot ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Given the areas we are moving between, return the spots we will encounter + */ +SpotEncounter *CNavArea::GetSpotEncounter( const CNavArea *from, const CNavArea *to ) +{ + if (from && to) + { + SpotEncounter *e; + + for( SpotEncounterList::iterator iter = m_spotEncounterList.begin(); iter != m_spotEncounterList.end(); ++iter ) + { + e = &(*iter); + + if (e->from.area == from && e->to.area == to) + return e; + } + } + + return NULL; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Add spot encounter data when moving from area to area + */ +void CNavArea::AddSpotEncounters( const CNavArea *from, NavDirType fromDir, const CNavArea *to, NavDirType toDir ) +{ + SpotEncounter e; + + e.from.area = const_cast( from ); + e.fromDir = fromDir; + + e.to.area = const_cast( to ); + e.toDir = toDir; + + float halfWidth; + ComputePortal( to, toDir, &e.path.to, &halfWidth ); + ComputePortal( from, fromDir, &e.path.from, &halfWidth ); + + const float eyeHeight = HalfHumanHeight; + e.path.from.z = from->GetZ( &e.path.from ) + eyeHeight; + e.path.to.z = to->GetZ( &e.path.to ) + eyeHeight; + + // step along ray and track which spots can be seen + Vector dir = e.path.to - e.path.from; + float length = dir.NormalizeInPlace(); + + // create unique marker to flag used spots + HidingSpot::ChangeMasterMarker(); + + const float stepSize = 25.0f; // 50 + const float seeSpotRange = 2000.0f; // 3000 + TraceResult result; + + Vector eye, delta; + HidingSpot *spot; + SpotOrder spotOrder; + + // step along path thru this area + bool done = false; + for( float along = 0.0f; !done; along += stepSize ) + { + // make sure we check the endpoint of the path segment + if (along >= length) + { + along = length; + done = true; + } + + // move the eyepoint along the path segment + eye = e.path.from + along * dir; + + // check each hiding spot for visibility + for( HidingSpotList::iterator iter = TheHidingSpotList.begin(); iter != TheHidingSpotList.end(); ++iter ) + { + spot = *iter; + + // only look at spots with cover (others are out in the open and easily seen) + if (!spot->HasGoodCover()) + continue; + + if (spot->IsMarked()) + continue; + + const Vector *spotPos = spot->GetPosition(); + + delta.x = spotPos->x - eye.x; + delta.y = spotPos->y - eye.y; + delta.z = (spotPos->z + eyeHeight) - eye.z; + + // check if in range + if (delta.IsLengthGreaterThan( seeSpotRange )) + continue; + + // check if we have LOS + UTIL_TraceLine( eye, Vector( spotPos->x, spotPos->y, spotPos->z + HalfHumanHeight ), ignore_monsters, ignore_glass, NULL, &result ); + if (result.flFraction != 1.0f) + continue; + + // if spot is in front of us along our path, ignore it + delta.NormalizeInPlace(); + float dot = DotProduct( dir, delta ); + if (dot < 0.7071f && dot > -0.7071f) + { + // we only want to keep spots that BECOME visible as we walk past them + // therefore, skip ALL visible spots at the start of the path segment + if (along > 0.0f) + { + // add spot to encounter + spotOrder.spot = spot; + spotOrder.t = along/length; + e.spotList.push_back( spotOrder ); + } + } + + // mark spot as encountered + spot->Mark(); + } + } + + // add encounter to list + m_spotEncounterList.push_back( e ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute "spot encounter" data. This is an ordered list of spots to look at + * for each possible path thru a nav area. + */ +void CNavArea::ComputeSpotEncounters( void ) +{ + m_spotEncounterList.clear(); + + if (cv_bot_quicksave.value > 0.0f) + return; + + // for each adjacent area + for( int fromDir=0; fromDirarea, (NavDirType)fromDir, toCon->area, (NavDirType)toDir ); + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Decay the danger values + */ +void CNavArea::DecayDanger( void ) +{ + // one kill == 1.0, which we will forget about in two minutes + const float decayRate = 1.0f / 120.0f; + + for( int i=0; itime - m_dangerTimestamp[i]; + float decayAmount = decayRate * deltaT; + + m_danger[i] -= decayAmount; + if (m_danger[i] < 0.0f) + m_danger[i] = 0.0f; + + // update timestamp + m_dangerTimestamp[i] = gpGlobals->time; + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Increase the danger of this area for the given team + */ +void CNavArea::IncreaseDanger( int teamID, float amount ) +{ + // before we add the new value, decay what's there + DecayDanger(); + + m_danger[ teamID ] += amount; + m_dangerTimestamp[ teamID ] = gpGlobals->time; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the danger of this area (decays over time) + */ +float CNavArea::GetDanger( int teamID ) +{ + DecayDanger(); + return m_danger[ teamID ]; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Increase the danger of nav areas containing and near the given position + */ +void IncreaseDangerNearby( int teamID, float amount, CNavArea *startArea, const Vector *pos, float maxRadius ) +{ + if (startArea == NULL) + return; + + CNavArea::MakeNewMarker(); + CNavArea::ClearSearchLists(); + + startArea->AddToOpenList(); + startArea->SetTotalCost( 0.0f ); + startArea->Mark(); + startArea->IncreaseDanger( teamID, amount ); + + while( !CNavArea::IsOpenListEmpty() ) + { + // get next area to check + CNavArea *area = CNavArea::PopOpenList(); + + // area has no hiding spots, explore adjacent areas + for( int dir=0; dirGetAdjacentCount( (NavDirType)dir ); + for( int i=0; iGetAdjacentArea( (NavDirType)dir, i ); + + if (!adjArea->IsMarked()) + { + // compute distance from danger source + float cost = (*adjArea->GetCenter() - *pos).Length(); + if (cost <= maxRadius) + { + adjArea->AddToOpenList(); + adjArea->SetTotalCost( cost ); + adjArea->Mark(); + adjArea->IncreaseDanger( teamID, amount * cost/maxRadius ); + } + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Show danger levels for debugging + */ +void DrawDanger( void ) +{ + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + Vector center = *area->GetCenter(); + Vector top; + center.z = area->GetZ( ¢er ); + + float danger = area->GetDanger( 0 ); + if (danger > 0.1f) + { + top.x = center.x; + top.y = center.y; + top.z = center.z + 10.0f * danger; + UTIL_DrawBeamPoints( center, top, 3.0f, 255, 0, 0 ); + } + + danger = area->GetDanger( 1 ); + if (danger > 0.1f) + { + top.x = center.x; + top.y = center.y; + top.z = center.z + 10.0f * danger; + UTIL_DrawBeamPoints( center, top, 3.0f, 0, 0, 255 ); + } + } +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * If a player is at the given spot, return true + */ +bool IsSpotOccupied( CBaseEntity *me, const Vector *pos ) +{ + const float closeRange = 75.0f; // 50 + + // is there a player in this spot + float range; + CBasePlayer *player = UTIL_GetClosestPlayer( pos, &range ); + + if (player != me) + { + if (player && range < closeRange) + return true; + } + + // is there is a hostage in this spot + if (g_pHostages) + { + CHostage *hostage = g_pHostages->GetClosestHostage( *pos, &range ); + if (hostage && hostage != me && range < closeRange) + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +class CollectHidingSpotsFunctor +{ +public: + CollectHidingSpotsFunctor( CBaseEntity *me, const Vector *origin, float range, unsigned char flags, Place place = UNDEFINED_PLACE, bool useCrouchAreas = true ) + { + m_me = me; + m_count = 0; + m_origin = origin; + m_range = range; + m_flags = flags; + m_place = place; + m_useCrouchAreas = useCrouchAreas; + } + + enum { MAX_SPOTS = 256 }; + + bool operator() ( CNavArea *area ) + { + // if a place is specified, only consider hiding spots from areas in that place + if (m_place != UNDEFINED_PLACE && area->GetPlace() != m_place) + return true; + + // collect all the hiding spots in this area + const HidingSpotList *list = area->GetHidingSpotList(); + + for( HidingSpotList::const_iterator iter = list->begin(); iter != list->end() && m_count < MAX_SPOTS; ++iter ) + { + const HidingSpot *spot = *iter; + + if (m_useCrouchAreas == false) + { + CNavArea *area = TheNavAreaGrid.GetNavArea( spot->GetPosition() ); + if (area && (area->GetAttributes() & NAV_CROUCH)) + continue; + } + + // make sure hiding spot is in range + if (m_range > 0.0f) + if ((*spot->GetPosition() - *m_origin).IsLengthGreaterThan( m_range )) + continue; + + // if a Player is using this hiding spot, don't consider it + if (IsSpotOccupied( m_me, spot->GetPosition() )) + { + // player is in hiding spot + /// @todo Check if player is moving or sitting still + continue; + } + + // only collect hiding spots with matching flags + if (m_flags & spot->GetFlags()) + { + m_hidingSpot[ m_count++ ] = spot->GetPosition(); + } + } + + // if we've filled up, stop searching + if (m_count == MAX_SPOTS) + return false; + + return true; + } + + /** + * Remove the spot at index "i" + */ + void RemoveSpot( int i ) + { + if (m_count == 0) + return; + + for( int j=i+1; jmaxClients; ++p ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( p ) ); + + if (!IsEntityValid( player )) + continue; + + if (player == ignore) + continue; + + if (!player->IsAlive()) + continue; + + if (ignoreTeam && player->m_iTeam == ignoreTeam) + continue; + + // compute player's unit aiming vector + UTIL_MakeVectors( player->pev->v_angle + player->pev->punchangle ); + + const float longRange = 5000.0f; + Vector playerTarget = player->pev->origin + longRange * gpGlobals->v_forward; + + Vector result; + if (IsIntersecting2D( start, finish, player->pev->origin, playerTarget, &result )) + { + // simple check to see if intersection lies in the Z range of the path + float loZ, hiZ; + + if (start.z < finish.z) + { + loZ = start.z; + hiZ = finish.z; + } + else + { + loZ = finish.z; + hiZ = start.z; + } + + if (result.z >= loZ && result.z <= hiZ + HumanHeight) + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------------------------- +/** + * Select a nearby retreat spot. + * Don't pick a hiding spot that a Player is currently occupying. + * If "avoidTeam" is nonzero, avoid getting close to members of that team. + */ +const Vector *FindNearbyRetreatSpot( CBaseEntity *me, const Vector *start, CNavArea *startArea, float maxRange, int avoidTeam, bool useCrouchAreas ) +{ + if (startArea == NULL) + return NULL; + + // collect hiding spots with decent "cover" + CollectHidingSpotsFunctor collector( me, start, maxRange, HidingSpot::IN_COVER, UNDEFINED_PLACE, useCrouchAreas ); + SearchSurroundingAreas( startArea, start, collector, maxRange ); + + if (collector.m_count == 0) + return NULL; + + // find the closest unoccupied hiding spot that crosses the least lines of fire and has the best cover + for( int i=0; imaxClients; ++i ) + { + CBasePlayer *player = static_cast( UTIL_PlayerByIndex( i ) ); + + if (player == ignore) + continue; + + if (!IsEntityValid( player )) + continue; + + if (!player->IsPlayer()) + continue; + + if (!player->IsAlive()) + continue; + + if (teamID == 0 || player->m_iTeam == teamID) + if (Contains( &player->pev->origin )) + ++count; + } + + return count; +} + +//-------------------------------------------------------------------------------------------------------------- +static CNavArea *markedArea = NULL; +static CNavArea *lastSelectedArea = NULL; +static NavCornerType markedCorner = NUM_CORNERS; + +static bool isCreatingNavArea = false; ///< if true, we are manually creating a new nav area +static bool isAnchored = false; +static Vector anchor; + +static bool isPlaceMode = false; ///< if true, we are in place editing mode +static bool isPlacePainting = false; ///< if true, we set an area's place by pointing at it + +static float editTimestamp = 0.0f; + +CNavArea *GetMarkedArea( void ) +{ + return markedArea; +} + +/** + * Draw navigation areas and edit them + */ +void EditNavAreasReset( void ) +{ + markedArea = NULL; + lastSelectedArea = NULL; + isCreatingNavArea = false; + editTimestamp = 0.0f; + isPlacePainting = false; + lastDrawTimestamp = 0.0f; +} + +void DrawHidingSpots( const CNavArea *area ) +{ + const HidingSpotList *list = area->GetHidingSpotList(); + for( HidingSpotList::const_iterator iter = list->begin(); iter != list->end(); ++iter ) + { + const HidingSpot *spot = *iter; + + int r, g, b; + + if (spot->IsIdealSniperSpot()) + { + r = 255; g = 0; b = 0; + } + else if (spot->IsGoodSniperSpot()) + { + r = 255; g = 0; b = 255; + } + else if (spot->HasGoodCover()) + { + r = 0; g = 255; b = 0; + } + else + { + r = 0; g = 0; b = 1; + } + + UTIL_DrawBeamPoints( *spot->GetPosition(), *spot->GetPosition() + Vector( 0, 0, 50 ), 3, r, g, b ); + } +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Draw ourselves and adjacent areas + */ +void CNavArea::DrawConnectedAreas( void ) +{ + CBasePlayer *player = UTIL_GetLocalPlayer(); + if (player == NULL) + return; + + CCSBotManager *ctrl = static_cast( TheBots ); + const float maxRange = 500.0f; + + // draw self + if (isPlaceMode) + { + if (GetPlace() == 0) + Draw( 50, 0, 0, 3 ); + else if (GetPlace() != ctrl->GetNavPlace()) + Draw( 0, 0, 200, 3 ); + else + Draw( 0, 255, 0, 3 ); + } + else + { + Draw( 255, 255, 0, 3 ); + DrawHidingSpots( this ); + } + + // randomize order of directions to make sure all connected areas are + // drawn, since we may have too many to render all at once + int dirSet[ NUM_DIRECTIONS ]; + int i; + for( i=0; i= NUM_DIRECTIONS) + nextI = 0; + + int tmp = dirSet[nextI]; + dirSet[nextI] = dirSet[swapI]; + dirSet[swapI] = tmp; + } + + // draw connected areas + for( i=0; iGetPlace() == 0) + adj->Draw( 50, 0, 0, 3 ); + else if (adj->GetPlace() != ctrl->GetNavPlace()) + adj->Draw( 0, 0, 200, 3 ); + else + adj->Draw( 0, 255, 0, 3 ); + } + else + { + if (adj->IsDegenerate()) + { + static IntervalTimer blink; + static bool blinkOn = false; + + if (blink.GetElapsedTime() > 1.0f) + { + blink.Reset(); + blinkOn = !blinkOn; + } + + if (blinkOn) + adj->Draw( 255, 255, 255, 3 ); + else + adj->Draw( 255, 0, 255, 3 ); + } + else + { + adj->Draw( 255, 0, 0, 3 ); + } + + DrawHidingSpots( adj ); + + Vector from, to; + Vector hookPos; + float halfWidth; + float size = 5.0f; + ComputePortal( adj, dir, &hookPos, &halfWidth ); + + switch( dir ) + { + case NORTH: + from = hookPos + Vector( 0.0f, size, 0.0f ); + to = hookPos + Vector( 0.0f, -size, 0.0f ); + break; + case SOUTH: + from = hookPos + Vector( 0.0f, -size, 0.0f ); + to = hookPos + Vector( 0.0f, size, 0.0f ); + break; + case EAST: + from = hookPos + Vector( -size, 0.0f, 0.0f ); + to = hookPos + Vector( +size, 0.0f, 0.0f ); + break; + case WEST: + from = hookPos + Vector( size, 0.0f, 0.0f ); + to = hookPos + Vector( -size, 0.0f, 0.0f ); + break; + } + + from.z = GetZ( &from ) + cv_bot_nav_zdraw.value; + to.z = adj->GetZ( &to ) + cv_bot_nav_zdraw.value; + + Vector drawTo; + adj->GetClosestPointOnArea( &to, &drawTo ); + + if (adj->IsConnected( this, OppositeDirection( dir ) ) ) + UTIL_DrawBeamPoints( from, drawTo, 3, 0, 255, 255 ); + else + UTIL_DrawBeamPoints( from, drawTo, 3, 0, 0, 255 ); + } + } + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Raise/lower a corner + */ +void CNavArea::RaiseCorner( NavCornerType corner, int amount ) +{ + if ( corner == NUM_CORNERS ) + { + m_extent.lo.z += amount; + m_extent.hi.z += amount; + m_neZ += amount; + m_swZ += amount; + } + else + { + switch (corner) + { + case NORTH_WEST: + m_extent.lo.z += amount; + break; + case NORTH_EAST: + m_neZ += amount; + break; + case SOUTH_WEST: + m_swZ += amount; + break; + case SOUTH_EAST: + m_extent.hi.z += amount; + break; + } + } + + m_center.x = (m_extent.lo.x + m_extent.hi.x)/2.0f; + m_center.y = (m_extent.lo.y + m_extent.hi.y)/2.0f; + m_center.z = (m_extent.lo.z + m_extent.hi.z)/2.0f; +} + +/** + * Flood fills all areas with current place + */ +class PlaceFloodFillFunctor +{ +public: + PlaceFloodFillFunctor( CNavArea *area ) + { + m_initialPlace = area->GetPlace(); + } + + bool operator() ( CNavArea *area ) + { + CCSBotManager *ctrl = static_cast( TheBots ); + + if (area->GetPlace() != m_initialPlace) + return false; + + area->SetPlace( ctrl->GetNavPlace() ); + + return true; + } + +private: + unsigned int m_initialPlace; +}; + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Draw navigation areas and edit them + */ +void EditNavAreas( NavEditCmdType cmd ) +{ + CCSBotManager *ctrl = static_cast( TheBots ); + + CBasePlayer *player = UTIL_GetLocalPlayer(); + if (player == NULL) + return; + + // don't draw too often on fast video cards or the areas may not appear (odd video effect) + float drawTimestamp = gpGlobals->time; + const float maxDrawRate = 0.05f; + + bool doDraw; + if (drawTimestamp - lastDrawTimestamp < maxDrawRate) + { + doDraw = false; + } + else + { + doDraw = true; + lastDrawTimestamp = drawTimestamp; + } + + + const float maxRange = 1000.0f; // 500 + + int beamTime = 1; + + if (doDraw) + { + // show ladder connections + for( NavLadderList::iterator iter = TheNavLadderList.begin(); iter != TheNavLadderList.end(); ++iter ) + { + CNavLadder *ladder = *iter; + + float dx = player->pev->origin.x - ladder->m_bottom.x; + float dy = player->pev->origin.y - ladder->m_bottom.y; + if (dx*dx + dy*dy > maxRange*maxRange) + continue; + + + UTIL_DrawBeamPoints( ladder->m_top, ladder->m_bottom, beamTime, 255, 0, 255 ); + + Vector bottom = ladder->m_bottom; + Vector top = ladder->m_top; + + AddDirectionVector( &top, ladder->m_dir, HalfHumanWidth ); + AddDirectionVector( &bottom, ladder->m_dir, HalfHumanWidth ); + + UTIL_DrawBeamPoints( top, bottom, beamTime, 0, 0, 255 ); + + if (ladder->m_bottomArea) + UTIL_DrawBeamPoints( bottom + Vector( 0, 0, GenerationStepSize ), *ladder->m_bottomArea->GetCenter(), beamTime, 0, 0, 255 ); + + if (ladder->m_topForwardArea) + UTIL_DrawBeamPoints( top, *ladder->m_topForwardArea->GetCenter(), beamTime, 0, 0, 255 ); + + if (ladder->m_topLeftArea) + UTIL_DrawBeamPoints( top, *ladder->m_topLeftArea->GetCenter(), beamTime, 0, 0, 255 ); + + if (ladder->m_topRightArea) + UTIL_DrawBeamPoints( top, *ladder->m_topRightArea->GetCenter(), beamTime, 0, 0, 255 ); + + if (ladder->m_topBehindArea) + UTIL_DrawBeamPoints( top, *ladder->m_topBehindArea->GetCenter(), beamTime, 0, 0, 255 ); + } + + // draw approach points for marked area + if (cv_bot_traceview.value == 3 && markedArea) + { + Vector ap; + float halfWidth; + for( int i=0; iGetApproachInfoCount(); ++i ) + { + const CNavArea::ApproachInfo *info = markedArea->GetApproachInfo( i ); + + // compute approach point + if (info->hereToNextHow <= GO_WEST) + { + info->here.area->ComputePortal( info->next.area, (NavDirType)info->hereToNextHow, &ap, &halfWidth ); + ap.z = info->next.area->GetZ( &ap ); + } + else + { + // use the area's center as an approach point + ap = *info->here.area->GetCenter(); + } + + UTIL_DrawBeamPoints( ap + Vector( 0, 0, 50 ), ap + Vector( 10, 0, 0 ), beamTime, 255, 100, 0 ); + UTIL_DrawBeamPoints( ap + Vector( 0, 0, 50 ), ap + Vector( -10, 0, 0 ), beamTime, 255, 100, 0 ); + UTIL_DrawBeamPoints( ap + Vector( 0, 0, 50 ), ap + Vector( 0, 10, 0 ), beamTime, 255, 100, 0 ); + UTIL_DrawBeamPoints( ap + Vector( 0, 0, 50 ), ap + Vector( 0, -10, 0 ), beamTime, 255, 100, 0 ); + } + } + } + + Vector dir; + UTIL_MakeVectorsPrivate( player->pev->v_angle, dir, NULL, NULL ); + + Vector from = player->pev->origin + player->pev->view_ofs; // eye position + Vector to = from + maxRange * dir; + + TraceResult result; + UTIL_TraceLine( from, to, ignore_monsters, ignore_glass, ENT( player->pev ), &result ); + + if (result.flFraction != 1.0f) + { + // draw cursor + Vector cursor = result.vecEndPos; + float cursorSize = 10.0f; + + if (doDraw) + { + UTIL_DrawBeamPoints( cursor + Vector( 0, 0, cursorSize ), cursor, beamTime, 255, 255, 255 ); + UTIL_DrawBeamPoints( cursor + Vector( cursorSize, 0, 0 ), cursor + Vector( -cursorSize, 0, 0 ), beamTime, 255, 255, 255 ); + UTIL_DrawBeamPoints( cursor + Vector( 0, cursorSize, 0 ), cursor + Vector( 0, -cursorSize, 0 ), beamTime, 255, 255, 255 ); + + // show surface normal + // UTIL_DrawBeamPoints( cursor + 50.0f * result.vecPlaneNormal, cursor, beamTime, 255, 0, 255 ); + + } + + if (isCreatingNavArea) + { + if (isAnchored) + { + // show drag rectangle + if (doDraw) + { + float z = anchor.z + 2.0f; + UTIL_DrawBeamPoints( Vector( cursor.x, cursor.y, z ), Vector( anchor.x, cursor.y, z ), beamTime, 0, 255, 255 ); + UTIL_DrawBeamPoints( Vector( anchor.x, anchor.y, z ), Vector( anchor.x, cursor.y, z ), beamTime, 0, 255, 255 ); + UTIL_DrawBeamPoints( Vector( anchor.x, anchor.y, z ), Vector( cursor.x, anchor.y, z ), beamTime, 0, 255, 255 ); + UTIL_DrawBeamPoints( Vector( cursor.x, cursor.y, z ), Vector( cursor.x, anchor.y, z ), beamTime, 0, 255, 255 ); + } + } + else + { + // anchor starting corner + anchor = cursor; + isAnchored = true; + } + } + + // find the area the player is pointing at + CNavArea *area = TheNavAreaGrid.GetNearestNavArea( &result.vecEndPos ); + + if (area) + { + // if area changed, print its ID + if (area != lastSelectedArea) + { + lastSelectedArea = area; + + char buffer[80]; + char attrib[80]; + char locName[80]; + + if (area->GetPlace()) + { + const char *name = TheBotPhrases->IDToName( area->GetPlace() ); + if (name) + strcpy( locName, name ); + else + strcpy( locName, "ERROR" ); + } + else + { + locName[0] = '\000'; + } + + if (isPlaceMode) + { + attrib[0] = '\000'; + } + else + { + sprintf( attrib, "%s%s%s%s", + (area->GetAttributes() & NAV_CROUCH) ? "CROUCH " : "", + (area->GetAttributes() & NAV_JUMP) ? "JUMP " : "", + (area->GetAttributes() & NAV_PRECISE) ? "PRECISE " : "", + (area->GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP " : "" ); + } + + sprintf( buffer, "Area #%d %s %s\n", area->GetID(), locName, attrib ); + + UTIL_SayTextAll( buffer, player ); + + // do "place painting" + if (isPlacePainting) + { + if (area->GetPlace() != ctrl->GetNavPlace()) + { + area->SetPlace( ctrl->GetNavPlace() ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/lightswitch2.wav", 1, ATTN_NORM, 0, 100 ); + } + } + } + + if (isPlaceMode) + { + area->DrawConnectedAreas(); + + switch( cmd ) + { + case EDIT_TOGGLE_PLACE_MODE: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + isPlaceMode = false; + return; + + case EDIT_TOGGLE_PLACE_PAINTING: + { + if (isPlacePainting) + { + isPlacePainting = false; + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/latchunlocked2.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + isPlacePainting = true; + + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/lightswitch2.wav", 1, ATTN_NORM, 0, 100 ); + + // paint the initial area + area->SetPlace( ctrl->GetNavPlace() ); + } + break; + } + + case EDIT_PLACE_PICK: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + ctrl->SetNavPlace( area->GetPlace() ); + break; + + case EDIT_PLACE_FLOODFILL: + PlaceFloodFillFunctor pff( area ); + SearchSurroundingAreas( area, area->GetCenter(), pff ); + break; + } + } + else // normal editing mode + { + // draw the "marked" area + if (markedArea && doDraw) + { + markedArea->Draw( 0, 255, 255, beamTime ); + if ( markedCorner != NUM_CORNERS ) + markedArea->DrawMarkedCorner( markedCorner, 0, 0, 255, beamTime ); + + if (cv_bot_traceview.value == 11) + { + // draw areas connected to the marked area + markedArea->DrawConnectedAreas(); + } + } + + + // draw split line + const Extent *extent = area->GetExtent(); + + float yaw = player->pev->v_angle.y; + while( yaw > 360.0f ) + yaw -= 360.0f; + + while( yaw < 0.0f ) + yaw += 360.0f; + + float splitEdge; + bool splitAlongX; + + if ((yaw < 45.0f || yaw > 315.0f) || (yaw > 135.0f && yaw < 225.0f)) + { + splitEdge = GenerationStepSize * (int)(result.vecEndPos.y/GenerationStepSize); + + from.x = extent->lo.x; + from.y = splitEdge; + from.z = area->GetZ( &from ) + cv_bot_nav_zdraw.value; + + to.x = extent->hi.x; + to.y = splitEdge; + to.z = area->GetZ( &to ) + cv_bot_nav_zdraw.value; + + splitAlongX = true; + } + else + { + splitEdge = GenerationStepSize * (int)(result.vecEndPos.x/GenerationStepSize); + + from.x = splitEdge; + from.y = extent->lo.y; + from.z = area->GetZ( &from ) + cv_bot_nav_zdraw.value; + + to.x = splitEdge; + to.y = extent->hi.y; + to.z = area->GetZ( &to ) + cv_bot_nav_zdraw.value; + + splitAlongX = false; + } + + if (doDraw) + UTIL_DrawBeamPoints( from, to, beamTime, 255, 255, 255 ); + + // draw the area we are pointing at and all connected areas + if (doDraw && (cv_bot_traceview.value != 11 || markedArea == NULL)) + area->DrawConnectedAreas(); + + + // do area-dependant edit commands, if any + switch( cmd ) + { + case EDIT_TOGGLE_PLACE_MODE: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + isPlaceMode = true; + return; + + case EDIT_DELETE: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + TheNavAreaList.remove( area ); + delete area; + return; + + case EDIT_ATTRIB_CROUCH: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/bell1.wav", 1, ATTN_NORM, 0, 100 ); + area->SetAttributes( area->GetAttributes() ^ NAV_CROUCH ); + break; + + case EDIT_ATTRIB_JUMP: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/bell1.wav", 1, ATTN_NORM, 0, 100 ); + area->SetAttributes( area->GetAttributes() ^ NAV_JUMP ); + break; + + case EDIT_ATTRIB_PRECISE: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/bell1.wav", 1, ATTN_NORM, 0, 100 ); + area->SetAttributes( area->GetAttributes() ^ NAV_PRECISE ); + break; + + case EDIT_ATTRIB_NO_JUMP: + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/bell1.wav", 1, ATTN_NORM, 0, 100 ); + area->SetAttributes( area->GetAttributes() ^ NAV_NO_JUMP ); + break; + + case EDIT_SPLIT: + if (area->SplitEdit( splitAlongX, splitEdge )) + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "weapons/knife_hitwall1.wav", 1, ATTN_NORM, 0, 100 ); + else + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + break; + + case EDIT_MERGE: + if (markedArea) + { + if (area->MergeEdit( markedArea )) + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + else + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + HintMessageToAllPlayers( "To merge, mark an area, highlight a second area, then invoke the merge command" ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + + case EDIT_MARK: + if (markedArea) + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + markedArea = NULL; + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip2.wav", 1, ATTN_NORM, 0, 100 ); + markedArea = area; + + int connected = 0; + connected += markedArea->GetAdjacentCount( NORTH ); + connected += markedArea->GetAdjacentCount( SOUTH ); + connected += markedArea->GetAdjacentCount( EAST ); + connected += markedArea->GetAdjacentCount( WEST ); + + char buffer[80]; + sprintf( buffer, "Marked Area is connected to %d other Areas\n", connected ); + UTIL_SayTextAll( buffer, player ); + } + break; + + case EDIT_MARK_UNNAMED: + if (markedArea) + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + markedArea = NULL; + } + else + { + markedArea = NULL; + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + if ( area->GetPlace() == 0 ) + { + markedArea = area; + break; + } + } + if ( !markedArea ) + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip2.wav", 1, ATTN_NORM, 0, 100 ); + + int connected = 0; + connected += markedArea->GetAdjacentCount( NORTH ); + connected += markedArea->GetAdjacentCount( SOUTH ); + connected += markedArea->GetAdjacentCount( EAST ); + connected += markedArea->GetAdjacentCount( WEST ); + + int totalUnnamedAreas = 0; + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + if ( area->GetPlace() == 0 ) + { + ++totalUnnamedAreas; + } + } + + char buffer[80]; + sprintf( buffer, "Marked Area is connected to %d other Areas - there are %d total unnamed areas\n", connected, totalUnnamedAreas ); + UTIL_SayTextAll( buffer, player ); + } + } + break; + + case EDIT_WARP_TO_MARK: + if (markedArea) + { + CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer(); + if ( pLocalPlayer && pLocalPlayer->m_iTeam == SPECTATOR && pLocalPlayer->pev->iuser1 == OBS_ROAMING ) + { + Vector origin = *markedArea->GetCenter() + Vector( 0, 0, 0.75f * HumanHeight ); + UTIL_SetOrigin( pLocalPlayer->pev, origin ); + } + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + + case EDIT_CONNECT: + if (markedArea) + { + NavDirType dir = markedArea->ComputeDirection( &cursor ); + if (dir == NUM_DIRECTIONS) + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + markedArea->ConnectTo( area, dir ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + } + } + else + { + HintMessageToAllPlayers( "To connect areas, mark an area, highlight a second area, then invoke the connect command. Make sure the cursor is directly north, south, east, or west of the marked area." ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + + case EDIT_DISCONNECT: + if (markedArea) + { + markedArea->Disconnect( area ); + area->Disconnect( markedArea ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + HintMessageToAllPlayers( "To disconnect areas, mark an area, highlight a second area, then invoke the disconnect command. This will remove all connections between the two areas." ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + + case EDIT_SPLICE: + if (markedArea) + { + if (area->SpliceEdit( markedArea )) + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + else + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + HintMessageToAllPlayers( "To splice, mark an area, highlight a second area, then invoke the splice command to create an area between them" ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + + case EDIT_SELECT_CORNER: + if (markedArea) + { + int corner = (markedCorner + 1) % (NUM_CORNERS + 1); + markedCorner = (NavCornerType)corner; + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + + case EDIT_RAISE_CORNER: + if (markedArea) + { + markedArea->RaiseCorner( markedCorner, 1 ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + + case EDIT_LOWER_CORNER: + if (markedArea) + { + markedArea->RaiseCorner( markedCorner, -1 ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + } + } + } + + // do area-independant edit commands, if any + switch( cmd ) + { + case EDIT_BEGIN_AREA: + { + if (isCreatingNavArea) + { + isCreatingNavArea = false; + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip2.wav", 1, ATTN_NORM, 0, 100 ); + isCreatingNavArea = true; + isAnchored = false; + } + break; + } + + case EDIT_END_AREA: + { + if (isCreatingNavArea) + { + // create the new nav area + CNavArea *newArea = new CNavArea( &anchor, &cursor ); + TheNavAreaList.push_back( newArea ); + TheNavAreaGrid.AddNavArea( newArea ); + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100 ); + + // if we have a marked area, inter-connect the two + if (markedArea) + { + const Extent *extent = markedArea->GetExtent(); + + if (anchor.x > extent->hi.x && cursor.x > extent->hi.x) + { + markedArea->ConnectTo( newArea, EAST ); + newArea->ConnectTo( markedArea, WEST ); + } + else if (anchor.x < extent->lo.x && cursor.x < extent->lo.x) + { + markedArea->ConnectTo( newArea, WEST ); + newArea->ConnectTo( markedArea, EAST ); + } + else if (anchor.y > extent->hi.y && cursor.y > extent->hi.y) + { + markedArea->ConnectTo( newArea, SOUTH ); + newArea->ConnectTo( markedArea, NORTH ); + } + else if (anchor.y < extent->lo.y && cursor.y < extent->lo.y) + { + markedArea->ConnectTo( newArea, NORTH ); + newArea->ConnectTo( markedArea, SOUTH ); + } + + // propogate marked area to new area + markedArea = newArea; + } + + isCreatingNavArea = false; + } + else + { + EMIT_SOUND_DYN( ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/button11.wav", 1, ATTN_NORM, 0, 100 ); + } + break; + } + } + } + + + // if our last command was not mark (or no command), clear the mark area + if (cmd != EDIT_MARK && cmd != EDIT_BEGIN_AREA && cmd != EDIT_END_AREA && + cmd != EDIT_MARK_UNNAMED && cmd != EDIT_WARP_TO_MARK && + cmd != EDIT_SELECT_CORNER && cmd != EDIT_RAISE_CORNER && cmd != EDIT_LOWER_CORNER && + cmd != EDIT_NONE) + markedArea = NULL; + + // if our last command was not affecting the corner, clear the corner selection + if (cmd != EDIT_SELECT_CORNER && cmd != EDIT_RAISE_CORNER && cmd != EDIT_LOWER_CORNER && cmd != EDIT_NONE) + markedCorner = NUM_CORNERS; + + + if (isCreatingNavArea && cmd != EDIT_BEGIN_AREA && cmd != EDIT_END_AREA && cmd != EDIT_NONE) + isCreatingNavArea = false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the ground height below this point in "height". + * Return false if position is invalid (outside of map, in a solid area, etc). + */ +bool GetGroundHeight( const Vector *pos, float *height, Vector *normal ) +{ + Vector to; + to.x = pos->x; + to.y = pos->y; + to.z = pos->z - 9999.9f; + + float offset; + Vector from; + TraceResult result; + edict_t *ignore = NULL; + float ground = 0.0f; + + const float maxOffset = 100.0f; + const float inc = 10.0f; + + #define MAX_GROUND_LAYERS 16 + struct GroundLayerInfo + { + float ground; + Vector normal; + } + layer[ MAX_GROUND_LAYERS ]; + int layerCount = 0; + + for( offset = 1.0f; offset < maxOffset; offset += inc ) + { + from = *pos + Vector( 0, 0, offset ); + + UTIL_TraceLine( from, to, ignore_monsters, dont_ignore_glass, ignore, &result ); + + // if the trace came down thru a door, ignore the door and try again + // also ignore breakable floors + if (result.pHit) + { + if (FClassnameIs( VARS( result.pHit ), "func_door" ) || + FClassnameIs( VARS( result.pHit ), "func_door_rotating" ) || + (FClassnameIs( VARS( result.pHit ), "func_breakable" ) && VARS( result.pHit )->takedamage == DAMAGE_YES)) + { + ignore = result.pHit; + // keep incrementing to avoid infinite loop if more than one entity is along the traceline... + /// @todo Deal with multiple ignore entities in a single TraceLine() + //offset -= inc; + continue; + } + } + + if (result.fStartSolid == false) + { + // if we didnt start inside a solid area, the trace hit a ground layer + + // if this is a new ground layer, add it to the set + if (layerCount == 0 || result.vecEndPos.z > layer[ layerCount-1 ].ground) + { + layer[ layerCount ].ground = result.vecEndPos.z; + layer[ layerCount ].normal = result.vecPlaneNormal; + ++layerCount; + + if (layerCount == MAX_GROUND_LAYERS) + break; + } + } + } + + if (layerCount == 0) + return false; + + // find the lowest layer that allows a player to stand or crouch upon it + int i; + for( i=0; i= HalfHumanHeight) + break; + } + + *height = layer[ i ].ground; + + if (normal) + *normal = layer[ i ].normal; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the "simple" ground height below this point in "height". + * This function is much faster, but less tolerant. Make sure the give position is "well behaved". + * Return false if position is invalid (outside of map, in a solid area, etc). + */ +bool GetSimpleGroundHeight( const Vector *pos, float *height, Vector *normal ) +{ + Vector to; + to.x = pos->x; + to.y = pos->y; + to.z = pos->z - 9999.9f; + + TraceResult result; + + UTIL_TraceLine( *pos, to, ignore_monsters, dont_ignore_glass, NULL, &result ); + + if (result.fStartSolid) + return false; + + *height = result.vecEndPos.z; + + if (normal) + *normal = result.vecPlaneNormal; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +enum { MAX_BLOCKED_AREAS = 256 }; +static unsigned int BlockedID[ MAX_BLOCKED_AREAS ]; +static int BlockedIDCount = 0; + +/** + * Shortest path cost, paying attention to "blocked" areas + */ +class ApproachAreaCost +{ +public: + float operator() ( CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder ) + { + // check if this area is "blocked" + for( int i=0; iGetID() == BlockedID[i]) + return -1.0f; + + if (fromArea == NULL) + { + // first area in path, no cost + return 0.0f; + } + else + { + // compute distance travelled along path so far + float dist; + + if (ladder) + dist = ladder->m_length; + else + dist = (*area->GetCenter() - *fromArea->GetCenter()).Length(); + + float cost = dist + fromArea->GetCostSoFar(); + + return cost; + } + } +}; + +/** + * Can we see this area? + * For now, if we can see any corner, we can see the area + * @todo Need to check LOS to more than the corners for large and/or long areas + */ +inline bool IsAreaVisible( const Vector *pos, const CNavArea *area ) +{ + Vector corner; + TraceResult result; + + for( int c=0; cGetCorner( (NavCornerType)c ); + corner.z += 0.75f * HumanHeight; + + UTIL_TraceLine( *pos, corner, ignore_monsters, NULL, &result ); + if (result.flFraction == 1.0f) + { + // we can see this area + return true; + } + } + + return false; +} + +/** + * Determine the set of "approach areas". + * An approach area is an area representing a place where players + * move into/out of our local neighborhood of areas. + */ +void CNavArea::ComputeApproachAreas( void ) +{ + m_approachCount = 0; + + if (cv_bot_quicksave.value > 0.0f) + return; + + // use the center of the nav area as the "view" point + Vector eye = m_center; + if (GetGroundHeight( &eye, &eye.z ) == false) + return; + + // approximate eye position + if (GetAttributes() & NAV_CROUCH) + eye.z += 0.9f * HalfHumanHeight; + else + eye.z += 0.9f * HumanHeight; + + enum { MAX_PATH_LENGTH = 256 }; + CNavArea *path[ MAX_PATH_LENGTH ]; + + // + // In order to enumerate all of the approach areas, we need to + // run the algorithm many times, once for each "far away" area + // and keep the union of the approach area sets + // + NavAreaList::iterator iter; + for( iter = goodSizedAreaList.begin(); iter != goodSizedAreaList.end(); ++iter ) + { + CNavArea *farArea = *iter; + + BlockedIDCount = 0; + + // if we can see 'farArea', try again - the whole point is to go "around the bend", so to speak + if (IsAreaVisible( &eye, farArea )) + continue; + + // make first path to far away area + ApproachAreaCost cost; + if (NavAreaBuildPath( this, farArea, NULL, cost ) == false) + continue; + + // + // Keep building paths to farArea and blocking them off until we + // cant path there any more. + // As areas are blocked off, all exits will be enumerated. + // + while( m_approachCount < MAX_APPROACH_AREAS ) + { + // find number of areas on path + int count = 0; + CNavArea *area; + for( area = farArea; area; area = area->GetParent() ) + ++count; + + if (count > MAX_PATH_LENGTH) + count = MAX_PATH_LENGTH; + + // build path in correct order - from eye outwards + int i = count; + for( area = farArea; i && area; area = area->GetParent() ) + path[ --i ] = area; + + // traverse path to find first area we cannot see (skip the first area) + for( i=1; iGetID(); + + if (block == 0) + break; + + // store new approach area if not already in set + int a; + for( a=0; a= 2) ? path[block-2] : NULL; + + m_approach[ m_approachCount ].here.area = path[block-1]; + m_approach[ m_approachCount ].prevToHereHow = path[block-1]->GetParentHow(); + + m_approach[ m_approachCount ].next.area = path[block]; + m_approach[ m_approachCount ].hereToNextHow = path[block]->GetParentHow(); + + ++m_approachCount; + } + + // we are done with this path + break; + } + + // find another path to 'farArea' + ApproachAreaCost cost; + if (NavAreaBuildPath( this, farArea, NULL, cost ) == false) + { + // can't find a path to 'farArea' means all exits have been already tested and blocked + break; + } + } + } +} + + +//-------------------------------------------------------------------------------------------------------------- + +/** + * The singleton for accessing the grid + */ +CNavAreaGrid TheNavAreaGrid; + + +CNavAreaGrid::CNavAreaGrid( void ) : m_cellSize( 300.0f ) +{ + m_grid = NULL; + Reset(); +} + +CNavAreaGrid::~CNavAreaGrid() +{ + delete [] m_grid; + m_grid = NULL; +} + +/** + * Clear the grid + */ +void CNavAreaGrid::Reset( void ) +{ + if (m_grid) + delete [] m_grid; + + m_grid = NULL; + m_gridSizeX = 0; + m_gridSizeY = 0; + + // clear the hash table + for( int i=0; iGetExtent(); + + int loX = WorldToGridX( extent->lo.x ); + int loY = WorldToGridY( extent->lo.y ); + int hiX = WorldToGridX( extent->hi.x ); + int hiY = WorldToGridY( extent->hi.y ); + + for( int y = loY; y <= hiY; ++y ) + for( int x = loX; x <= hiX; ++x ) + m_grid[ x + y*m_gridSizeX ].push_back( const_cast( area ) ); + + // add to hash table + int key = ComputeHashKey( area->GetID() ); + + if (m_hashTable[key]) + { + // add to head of list in this slot + area->m_prevHash = NULL; + area->m_nextHash = m_hashTable[key]; + m_hashTable[key]->m_prevHash = area; + m_hashTable[key] = area; + } + else + { + // first entry in this slot + m_hashTable[key] = area; + area->m_nextHash = NULL; + area->m_prevHash = NULL; + } + + ++m_areaCount; +} + +/** + * Remove an area from the grid + */ +void CNavAreaGrid::RemoveNavArea( CNavArea *area ) +{ + // add to grid + const Extent *extent = area->GetExtent(); + + int loX = WorldToGridX( extent->lo.x ); + int loY = WorldToGridY( extent->lo.y ); + int hiX = WorldToGridX( extent->hi.x ); + int hiY = WorldToGridY( extent->hi.y ); + + for( int y = loY; y <= hiY; ++y ) + for( int x = loX; x <= hiX; ++x ) + m_grid[ x + y*m_gridSizeX ].remove( area ); + + // remove from hash table + int key = ComputeHashKey( area->GetID() ); + + if (area->m_prevHash) + { + area->m_prevHash->m_nextHash = area->m_nextHash; + } + else + { + // area was at start of list + m_hashTable[key] = area->m_nextHash; + + if (m_hashTable[key]) + m_hashTable[key]->m_prevHash = NULL; + } + + if (area->m_nextHash) + { + area->m_nextHash->m_prevHash = area->m_prevHash; + } + + --m_areaCount; +} + +/** + * Given a position, return the nav area that IsOverlapping and is *immediately* beneath it + */ +CNavArea *CNavAreaGrid::GetNavArea( const Vector *pos, float beneathLimit ) const +{ + if (m_grid == NULL) + return NULL; + + // get list in cell that contains position + int x = WorldToGridX( pos->x ); + int y = WorldToGridY( pos->y ); + NavAreaList *list = &m_grid[ x + y*m_gridSizeX ]; + + + // search cell list to find correct area + CNavArea *use = NULL; + float useZ = -99999999.9f; + Vector testPos = *pos + Vector( 0, 0, 5 ); + + for( NavAreaList::iterator iter = list->begin(); iter != list->end(); ++iter ) + { + CNavArea *area = *iter; + + // check if position is within 2D boundaries of this area + if (area->IsOverlapping( &testPos )) + { + // project position onto area to get Z + float z = area->GetZ( &testPos ); + + // if area is above us, skip it + if (z > testPos.z) + continue; + + // if area is too far below us, skip it + if (z < pos->z - beneathLimit) + continue; + + // if area is higher than the one we have, use this instead + if (z > useZ) + { + use = area; + useZ = z; + } + } + } + + return use; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Given a position in the world, return the nav area that is closest + * and at the same height, or beneath it. + * Used to find initial area if we start off of the mesh. + */ +CNavArea *CNavAreaGrid::GetNearestNavArea( const Vector *pos, bool anyZ ) const +{ + if (m_grid == NULL) + return NULL; + + CNavArea *close = NULL; + float closeDistSq = 99999999.9f; + + // quick check + close = GetNavArea( pos ); + if (close) + return close; + + // ensure source position is well behaved + Vector source; + source.x = pos->x; + source.y = pos->y; + if (GetGroundHeight( pos, &source.z ) == false) + return NULL; + + source.z += HalfHumanHeight; + + /// @todo Step incrementally using grid for speed + + // find closest nav area + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + Vector areaPos; + area->GetClosestPointOnArea( &source, &areaPos ); + + float distSq = (areaPos - source).LengthSquared(); + + // keep the closest area + if (distSq < closeDistSq) + { + // check LOS to area + if (!anyZ) + { + TraceResult result; + UTIL_TraceLine( source, areaPos + Vector( 0, 0, HalfHumanHeight ), ignore_monsters, ignore_glass, NULL, &result ); + if (result.flFraction != 1.0f) + continue; + } + + closeDistSq = distSq; + close = area; + } + } + + return close; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Given an ID, return the associated area + */ +CNavArea *CNavAreaGrid::GetNavAreaByID( unsigned int id ) const +{ + if (id == 0) + return NULL; + + int key = ComputeHashKey( id ); + + for( CNavArea *area = m_hashTable[key]; area; area = area->m_nextHash ) + if (area->GetID() == id) + return area; + + return NULL; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return radio chatter place for given coordinate + */ +unsigned int CNavAreaGrid::GetPlace( const Vector *pos ) const +{ + CNavArea *area = GetNearestNavArea( pos, true ); + + if (area) + return area->GetPlace(); + + return UNDEFINED_PLACE; +} + + diff --git a/game_shared/bot/nav_area.h b/game_shared/bot/nav_area.h new file mode 100644 index 0000000..a7e0c6d --- /dev/null +++ b/game_shared/bot/nav_area.h @@ -0,0 +1,1231 @@ +// nav_area.h +// Navigation areas +// Author: Michael S. Booth (mike@turtlerockstudios.com), January 2003 + +#ifndef _NAV_AREA_H_ +#define _NAV_AREA_H_ + +#include +#include "nav.h" +#include "steam_util.h" + +class CNavArea; + +void DestroyHidingSpots( void ); +void StripNavigationAreas( void ); +bool SaveNavigationMap( const char *filename ); +NavErrorType LoadNavigationMap( void ); +void DestroyNavigationMap( void ); + +//------------------------------------------------------------------------------------------------------------------- +/** + * Used when building a path to determine the kind of path to build + */ +enum RouteType +{ + FASTEST_ROUTE, + SAFEST_ROUTE, +}; + + +//------------------------------------------------------------------------------------------------------------------- +/** + * The NavConnect union is used to refer to connections to areas + */ +union NavConnect +{ + unsigned int id; + CNavArea *area; + + bool operator==( const NavConnect &other ) const + { + return (area == other.area) ? true : false; + } +}; +typedef std::list NavConnectList; + +//-------------------------------------------------------------------------------------------------------------- +enum LadderDirectionType +{ + LADDER_UP = 0, + LADDER_DOWN, + + NUM_LADDER_DIRECTIONS +}; + +/** + * The NavLadder class encapsulates traversable ladders, and their connections to NavAreas + * @todo Deal with ladders that allow jumping off to areas in the middle + */ +class CNavLadder +{ +public: + CNavLadder( void ) + { + m_topForwardArea = NULL; + m_topRightArea = NULL; + m_topLeftArea = NULL; + m_topBehindArea = NULL; + m_bottomArea = NULL; + m_entity = NULL; + } + + Vector m_top; ///< world coords of the top of the ladder + Vector m_bottom; ///< world coords of the top of the ladder + float m_length; ///< the length of the ladder + NavDirType m_dir; ///< which way the ladder faces (ie: surface normal of climbable side) + Vector2D m_dirVector; ///< unit vector representation of m_dir + CBaseEntity *m_entity; ///< the ladder itself + + CNavArea *m_topForwardArea; ///< the area at the top of the ladder + CNavArea *m_topLeftArea; + CNavArea *m_topRightArea; + CNavArea *m_topBehindArea; ///< area at top of ladder "behind" it - only useful for descending + CNavArea *m_bottomArea; ///< the area at the bottom of the ladder + + bool m_isDangling; ///< if true, the bottom of the ladder is hanging too high to climb up + + void OnDestroyNotify( CNavArea *dead ) ///< invoked when given area is going away + { + if (dead == m_topForwardArea) + m_topForwardArea = NULL; + + if (dead == m_topLeftArea) + m_topLeftArea = NULL; + + if (dead == m_topRightArea) + m_topRightArea = NULL; + + if (dead == m_topBehindArea) + m_topBehindArea = NULL; + + if (dead == m_bottomArea) + m_bottomArea = NULL; + } +}; +typedef std::list NavLadderList; +extern NavLadderList TheNavLadderList; + +//-------------------------------------------------------------------------------------------------------------- +/** + * A HidingSpot is a good place for a bot to crouch and wait for enemies + */ +class HidingSpot +{ +public: + HidingSpot( void ); ///< for use when loading from a file + HidingSpot( const Vector *pos, unsigned char flags ); ///< for use when generating - assigns unique ID + + enum + { + IN_COVER = 0x01, ///< in a corner with good hard cover nearby + GOOD_SNIPER_SPOT = 0x02, ///< had at least one decent sniping corridor + IDEAL_SNIPER_SPOT = 0x04 ///< can see either very far, or a large area, or both + }; + + bool HasGoodCover( void ) const { return (m_flags & IN_COVER) ? true : false; } ///< return true if hiding spot in in cover + bool IsGoodSniperSpot( void ) const { return (m_flags & GOOD_SNIPER_SPOT) ? true : false; } + bool IsIdealSniperSpot( void ) const { return (m_flags & IDEAL_SNIPER_SPOT) ? true : false; } + + void SetFlags( unsigned char flags ) { m_flags |= flags; } ///< FOR INTERNAL USE ONLY + unsigned char GetFlags( void ) const { return m_flags; } + + void Save( int fd, unsigned int version ) const; + void Load( SteamFile *file, unsigned int version ); + + const Vector *GetPosition( void ) const { return &m_pos; } ///< get the position of the hiding spot + unsigned int GetID( void ) const { return m_id; } + + void Mark( void ) { m_marker = m_masterMarker; } + bool IsMarked( void ) const { return (m_marker == m_masterMarker) ? true : false; } + static void ChangeMasterMarker( void ) { ++m_masterMarker; } + +private: + friend void DestroyHidingSpots( void ); + + Vector m_pos; ///< world coordinates of the spot + unsigned int m_id; ///< this spot's unique ID + unsigned int m_marker; ///< this spot's unique marker + + unsigned char m_flags; ///< bit flags + + static unsigned int m_nextID; ///< used when allocating spot ID's + static unsigned int m_masterMarker; ///< used to mark spots +}; +typedef std::list HidingSpotList; +extern HidingSpotList TheHidingSpotList; + +extern HidingSpot *GetHidingSpotByID( unsigned int id ); + +//-------------------------------------------------------------------------------------------------------------- +/** + * Stores a pointer to an interesting "spot", and a parametric distance along a path + */ +struct SpotOrder +{ + float t; ///< parametric distance along ray where this spot first has LOS to our path + union + { + HidingSpot *spot; ///< the spot to look at + unsigned int id; ///< spot ID for save/load + }; +}; +typedef std::list SpotOrderList; + +/** + * This struct stores possible path segments thru a CNavArea, and the dangerous spots + * to look at as we traverse that path segment. + */ +struct SpotEncounter +{ + NavConnect from; + NavDirType fromDir; + NavConnect to; + NavDirType toDir; + Ray path; ///< the path segment + SpotOrderList spotList; ///< list of spots to look at, in order of occurrence +}; +typedef std::list SpotEncounterList; + + +//------------------------------------------------------------------------------------------------------------------- +/** + * A CNavArea is a rectangular region defining a walkable area in the map + */ +class CNavArea +{ +public: + CNavArea( CNavNode *nwNode, CNavNode *neNode, CNavNode *seNode, CNavNode *swNode ); + CNavArea( void ); + CNavArea( const Vector *corner, const Vector *otherCorner ); + CNavArea( const Vector *nwCorner, const Vector *neCorner, const Vector *seCorner, const Vector *swCorner ); + + ~CNavArea(); + + void ConnectTo( CNavArea *area, NavDirType dir ); ///< connect this area to given area in given direction + void Disconnect( CNavArea *area ); ///< disconnect this area from given area + + void Save( FILE *fp ) const; + void Save( int fd, unsigned int version ); + void Load( SteamFile *file, unsigned int version ); + NavErrorType PostLoad( void ); + + unsigned int GetID( void ) const { return m_id; } + + void SetAttributes( unsigned char bits ) { m_attributeFlags = bits; } + unsigned char GetAttributes( void ) const { return m_attributeFlags; } + + void SetPlace( Place place ) { m_place = place; } ///< set place descriptor + Place GetPlace( void ) const { return m_place; } ///< get place descriptor + + bool IsOverlapping( const Vector *pos ) const; ///< return true if 'pos' is within 2D extents of area. + bool IsOverlapping( const CNavArea *area ) const; ///< return true if 'area' overlaps our 2D extents + bool IsOverlappingX( const CNavArea *area ) const; ///< return true if 'area' overlaps our X extent + bool IsOverlappingY( const CNavArea *area ) const; ///< return true if 'area' overlaps our Y extent + int GetPlayerCount( int teamID = 0, CBasePlayer *ignore = NULL ) const; ///< return number of players with given teamID in this area (teamID == 0 means any/all) + float GetZ( const Vector *pos ) const; ///< return Z of area at (x,y) of 'pos' + float GetZ( float x, float y ) const; ///< return Z of area at (x,y) of 'pos' + bool Contains( const Vector *pos ) const; ///< return true if given point is on or above this area, but no others + bool IsCoplanar( const CNavArea *area ) const; ///< return true if this area and given area are approximately co-planar + void GetClosestPointOnArea( const Vector *pos, Vector *close ) const; ///< return closest point to 'pos' on this area - returned point in 'close' + float GetDistanceSquaredToPoint( const Vector *pos ) const; ///< return shortest distance between point and this area + bool IsDegenerate( void ) const; ///< return true if this area is badly formed + + bool IsEdge( NavDirType dir ) const; ///< return true if there are no bi-directional links on the given side + + int GetAdjacentCount( NavDirType dir ) const { return m_connect[ dir ].size(); } ///< return number of connected areas in given direction + CNavArea *GetAdjacentArea( NavDirType dir, int i ) const; /// return the i'th adjacent area in the given direction + CNavArea *GetRandomAdjacentArea( NavDirType dir ) const; + + const NavConnectList *GetAdjacentList( NavDirType dir ) const { return &m_connect[dir]; } + bool IsConnected( const CNavArea *area, NavDirType dir ) const; ///< return true if given area is connected in given direction + float ComputeHeightChange( const CNavArea *area ); ///< compute change in height from this area to given area + + const NavLadderList *GetLadderList( LadderDirectionType dir ) const { return &m_ladder[dir]; } + + void ComputePortal( const CNavArea *to, NavDirType dir, Vector *center, float *halfWidth ) const; ///< compute portal to adjacent area + void ComputeClosestPointInPortal( const CNavArea *to, NavDirType dir, const Vector *fromPos, Vector *closePos ) const; ///< compute closest point within the "portal" between to adjacent areas + NavDirType ComputeDirection( Vector *point ) const; ///< return direction from this area to the given point + + //- for hunting algorithm --------------------------------------------------------------------------- + void SetClearedTimestamp( int teamID ) { m_clearedTimestamp[ teamID ] = gpGlobals->time; } ///< set this area's "clear" timestamp to now + float GetClearedTimestamp( int teamID ) { return m_clearedTimestamp[ teamID ]; } ///< get time this area was marked "clear" + + //- hiding spots ------------------------------------------------------------------------------------ + const HidingSpotList *GetHidingSpotList( void ) const { return &m_hidingSpotList; } + void ComputeHidingSpots( void ); ///< analyze local area neighborhood to find "hiding spots" in this area - for map learning + void ComputeSniperSpots( void ); ///< analyze local area neighborhood to find "sniper spots" in this area - for map learning + + SpotEncounter *GetSpotEncounter( const CNavArea *from, const CNavArea *to ); ///< given the areas we are moving between, return the spots we will encounter + void ComputeSpotEncounters( void ); ///< compute spot encounter data - for map learning + + //- "danger" ---------------------------------------------------------------------------------------- + void IncreaseDanger( int teamID, float amount ); ///< increase the danger of this area for the given team + float GetDanger( int teamID ); ///< return the danger of this area (decays over time) + + float GetSizeX( void ) const { return m_extent.hi.x - m_extent.lo.x; } + float GetSizeY( void ) const { return m_extent.hi.y - m_extent.lo.y; } + const Extent *GetExtent( void ) const { return &m_extent; } + const Vector *GetCenter( void ) const { return &m_center; } + const Vector *GetCorner( NavCornerType corner ) const; + + //- approach areas ---------------------------------------------------------------------------------- + struct ApproachInfo + { + NavConnect here; ///< the approach area + NavConnect prev; ///< the area just before the approach area on the path + NavTraverseType prevToHereHow; + NavConnect next; ///< the area just after the approach area on the path + NavTraverseType hereToNextHow; + }; + const ApproachInfo *GetApproachInfo( int i ) const { return &m_approach[i]; } + int GetApproachInfoCount( void ) const { return m_approachCount; } + void ComputeApproachAreas( void ); ///< determine the set of "approach areas" - for map learning + + //- A* pathfinding algorithm ------------------------------------------------------------------------ + static void MakeNewMarker( void ) { ++m_masterMarker; if (m_masterMarker == 0) m_masterMarker = 1; } + void Mark( void ) { m_marker = m_masterMarker; } + BOOL IsMarked( void ) const { return (m_marker == m_masterMarker) ? true : false; } + + void SetParent( CNavArea *parent, NavTraverseType how = NUM_TRAVERSE_TYPES ) { m_parent = parent; m_parentHow = how; } + CNavArea *GetParent( void ) const { return m_parent; } + NavTraverseType GetParentHow( void ) const { return m_parentHow; } + + bool IsOpen( void ) const; ///< true if on "open list" + void AddToOpenList( void ); ///< add to open list in decreasing value order + void UpdateOnOpenList( void ); ///< a smaller value has been found, update this area on the open list + void RemoveFromOpenList( void ); + static bool IsOpenListEmpty( void ); + static CNavArea *PopOpenList( void ); ///< remove and return the first element of the open list + + bool IsClosed( void ) const; ///< true if on "closed list" + void AddToClosedList( void ); ///< add to the closed list + void RemoveFromClosedList( void ); + + static void ClearSearchLists( void ); ///< clears the open and closed lists for a new search + + void SetTotalCost( float value ) { m_totalCost = value; } + float GetTotalCost( void ) const { return m_totalCost; } + + void SetCostSoFar( float value ) { m_costSoFar = value; } + float GetCostSoFar( void ) const { return m_costSoFar; } + + //- editing ----------------------------------------------------------------------------------------- + void Draw( byte red, byte green, byte blue, int duration = 50 ); ///< draw area for debugging & editing + void DrawConnectedAreas( void ); + void DrawMarkedCorner( NavCornerType corner, byte red, byte green, byte blue, int duration = 50 ); + bool SplitEdit( bool splitAlongX, float splitEdge, CNavArea **outAlpha = NULL, CNavArea **outBeta = NULL ); ///< split this area into two areas at the given edge + bool MergeEdit( CNavArea *adj ); ///< merge this area and given adjacent area + bool SpliceEdit( CNavArea *other ); ///< create a new area between this area and given area + void RaiseCorner( NavCornerType corner, int amount ); ///< raise/lower a corner (or all corners if corner == NUM_CORNERS) + + //- ladders ----------------------------------------------------------------------------------------- + void AddLadderUp( CNavLadder *ladder ) { m_ladder[ LADDER_UP ].push_back( ladder ); } + void AddLadderDown( CNavLadder *ladder ) { m_ladder[ LADDER_DOWN ].push_back( ladder ); } + +private: + friend void ConnectGeneratedAreas( void ); + friend void MergeGeneratedAreas( void ); + friend void MarkJumpAreas( void ); + friend bool SaveNavigationMap( const char *filename ); + friend NavErrorType LoadNavigationMap( void ); + friend void DestroyNavigationMap( void ); + friend void DestroyHidingSpots( void ); + friend void StripNavigationAreas( void ); + friend class CNavAreaGrid; + friend class CCSBotManager; + + void Initialize( void ); ///< to keep constructors consistent + static bool m_isReset; ///< if true, don't bother cleaning up in destructor since everything is going away + + static unsigned int m_nextID; ///< used to allocate unique IDs + unsigned int m_id; ///< unique area ID + Extent m_extent; ///< extents of area in world coords (NOTE: lo.z is not necessarily the minimum Z, but corresponds to Z at point (lo.x, lo.y), etc + Vector m_center; ///< centroid of area + unsigned char m_attributeFlags; ///< set of attribute bit flags (see NavAttributeType) + Place m_place; ///< place descriptor + + /// height of the implicit corners + float m_neZ; + float m_swZ; + + enum { MAX_AREA_TEAMS = 2 }; + + //- for hunting ------------------------------------------------------------------------------------- + float m_clearedTimestamp[ MAX_AREA_TEAMS ]; ///< time this area was last "cleared" of enemies + + //- "danger" ---------------------------------------------------------------------------------------- + float m_danger[ MAX_AREA_TEAMS ]; ///< danger of this area, allowing bots to avoid areas where they died in the past - zero is no danger + float m_dangerTimestamp[ MAX_AREA_TEAMS ]; ///< time when danger value was set - used for decaying + void DecayDanger( void ); + + //- hiding spots ------------------------------------------------------------------------------------ + HidingSpotList m_hidingSpotList; + bool IsHidingSpotCollision( const Vector *pos ) const; ///< returns true if an existing hiding spot is too close to given position + + //- encounter spots --------------------------------------------------------------------------------- + SpotEncounterList m_spotEncounterList; ///< list of possible ways to move thru this area, and the spots to look at as we do + void AddSpotEncounters( const CNavArea *from, NavDirType fromDir, const CNavArea *to, NavDirType toDir ); ///< add spot encounter data when moving from area to area + + //- approach areas ---------------------------------------------------------------------------------- + enum { MAX_APPROACH_AREAS = 16 }; + ApproachInfo m_approach[ MAX_APPROACH_AREAS ]; + unsigned char m_approachCount; + + void Strip( void ); ///< remove "analyzed" data from nav area + + //- A* pathfinding algorithm ------------------------------------------------------------------------ + static unsigned int m_masterMarker; + unsigned int m_marker; ///< used to flag the area as visited + CNavArea *m_parent; ///< the area just prior to this on in the search path + NavTraverseType m_parentHow; ///< how we get from parent to us + float m_totalCost; ///< the distance so far plus an estimate of the distance left + float m_costSoFar; ///< distance travelled so far + + static CNavArea *m_openList; + CNavArea *m_nextOpen, *m_prevOpen; ///< only valid if m_openMarker == m_masterMarker + unsigned int m_openMarker; ///< if this equals the current marker value, we are on the open list + + //- connections to adjacent areas ------------------------------------------------------------------- + NavConnectList m_connect[ NUM_DIRECTIONS ]; ///< a list of adjacent areas for each direction + NavLadderList m_ladder[ NUM_LADDER_DIRECTIONS ]; ///< list of ladders leading up and down from this area + + //--------------------------------------------------------------------------------------------------- + CNavNode *m_node[ NUM_CORNERS ]; ///< nav nodes at each corner of the area + + void FinishMerge( CNavArea *adjArea ); ///< recompute internal data once nodes have been adjusted during merge + void MergeAdjacentConnections( CNavArea *adjArea ); ///< for merging with "adjArea" - pick up all of "adjArea"s connections + void AssignNodes( CNavArea *area ); ///< assign internal nodes to the given area + + void FinishSplitEdit( CNavArea *newArea, NavDirType ignoreEdge ); ///< given the portion of the original area, update its internal data + + std::list m_overlapList; ///< list of areas that overlap this area + + void OnDestroyNotify( CNavArea *dead ); ///< invoked when given area is going away + + CNavArea *m_prevHash, *m_nextHash; ///< for hash table in CNavAreaGrid +}; + +typedef std::list NavAreaList; +extern NavAreaList TheNavAreaList; + + +// +// Inlines +// + +inline bool CNavArea::IsDegenerate( void ) const +{ + return (m_extent.lo.x >= m_extent.hi.x || m_extent.lo.y >= m_extent.hi.y); +} + +inline CNavArea *CNavArea::GetAdjacentArea( NavDirType dir, int i ) const +{ + NavConnectList::const_iterator iter; + for( iter = m_connect[dir].begin(); iter != m_connect[dir].end(); ++iter ) + { + if (i == 0) + return (*iter).area; + --i; + } + + return NULL; +} + +inline bool CNavArea::IsOpen( void ) const +{ + return (m_openMarker == m_masterMarker) ? true : false; +} + +inline bool CNavArea::IsOpenListEmpty( void ) +{ + return (m_openList) ? false : true; +} + +inline CNavArea *CNavArea::PopOpenList( void ) +{ + if (m_openList) + { + CNavArea *area = m_openList; + + // disconnect from list + area->RemoveFromOpenList(); + + return area; + } + + return NULL; +} + +inline bool CNavArea::IsClosed( void ) const +{ + if (IsMarked() && !IsOpen()) + return true; + + return false; +} + +inline void CNavArea::AddToClosedList( void ) +{ + Mark(); +} + +inline void CNavArea::RemoveFromClosedList( void ) +{ + // since "closed" is defined as visited (marked) and not on open list, do nothing +} + +//-------------------------------------------------------------------------------------------------------------- + +/** + * The CNavAreaGrid is used to efficiently access navigation areas by world position. + * Each cell of the grid contains a list of areas that overlap it. + * Given a world position, the corresponding grid cell is ( x/cellsize, y/cellsize ). + */ +class CNavAreaGrid +{ +public: + CNavAreaGrid( void ); + ~CNavAreaGrid(); + + void Reset( void ); ///< clear the grid to empty + void Initialize( float minX, float maxX, float minY, float maxY ); ///< clear and reset the grid to the given extents + void AddNavArea( CNavArea *area ); ///< add an area to the grid + void RemoveNavArea( CNavArea *area ); ///< remove an area from the grid + unsigned int GetNavAreaCount( void ) const { return m_areaCount; } ///< return total number of nav areas + + CNavArea *GetNavArea( const Vector *pos, float beneathLimt = 120.0f ) const; ///< given a position, return the nav area that IsOverlapping and is *immediately* beneath it + CNavArea *GetNavAreaByID( unsigned int id ) const; + CNavArea *GetNearestNavArea( const Vector *pos, bool anyZ = false ) const; + + Place GetPlace( const Vector *pos ) const; ///< return radio chatter place for given coordinate + +private: + const float m_cellSize; + NavAreaList *m_grid; + int m_gridSizeX; + int m_gridSizeY; + float m_minX; + float m_minY; + unsigned int m_areaCount; ///< total number of nav areas + + enum { HASH_TABLE_SIZE = 256 }; + CNavArea *m_hashTable[ HASH_TABLE_SIZE ]; ///< hash table to optimize lookup by ID + inline int ComputeHashKey( unsigned int id ) const ///< returns a hash key for the given nav area ID + { + return id & 0xFF; + } + + + inline int WorldToGridX( float wx ) const + { + int x = (wx - m_minX) / m_cellSize; + if (x < 0) + x = 0; + else if (x >= m_gridSizeX) + x = m_gridSizeX-1; + + return x; + } + + inline int WorldToGridY( float wy ) const + { + int y = (wy - m_minY) / m_cellSize; + if (y < 0) + y = 0; + else if (y >= m_gridSizeY) + y = m_gridSizeY-1; + + return y; + } +}; + +extern CNavAreaGrid TheNavAreaGrid; + +//-------------------------------------------------------------------------------------------------------------- +// +// Function prototypes +// +extern NavErrorType LoadNavigationMap( void ); +extern void GenerateNavigationAreaMesh( void ); + +extern void SanityCheckNavigationMap( const char *mapName ); ///< Performs a lightweight sanity-check of the specified map's nav mesh + +extern void ApproachAreaAnalysisPrep( void ); +extern void CleanupApproachAreaAnalysisPrep( void ); + +extern void BuildLadders( void ); + +extern bool TestArea( CNavNode *node, int width, int height ); +extern int BuildArea( CNavNode *node, int width, int height ); + +extern bool GetGroundHeight( const Vector *pos, float *height, Vector *normal = NULL ); +extern bool GetSimpleGroundHeight( const Vector *pos, float *height, Vector *normal = NULL ); + +class CBasePlayer; +class CBaseEntity; + +extern bool IsSpotOccupied( CBaseEntity *me, const Vector *pos ); // if a player is at the given spot, return true + +extern const Vector *FindNearbyHidingSpot( CBaseEntity *me, const Vector *pos, CNavArea *currentArea, float maxRange = 1000.0f, bool isSniper = false, bool useNearest = false ); +extern const Vector *FindRandomHidingSpot( CBaseEntity *me, Place place, bool isSniper = false ); + +#define NO_CROUCH_SPOTS false +extern const Vector *FindNearbyRetreatSpot( CBaseEntity *me, const Vector *start, CNavArea *startArea, float maxRange = 1000.0f, int avoidTeam = 0, bool useCrouchAreas = true ); + +/// return true if moving from "start" to "finish" will cross a player's line of fire. +extern bool IsCrossingLineOfFire( const Vector &start, const Vector &finish, CBaseEntity *ignore = NULL, int ignoreTeam = 0 ); + +extern void IncreaseDangerNearby( int teamID, float amount, CNavArea *area, const Vector *pos, float maxRadius ); +extern void DrawDanger( void ); + +enum NavEditCmdType +{ + EDIT_NONE, + EDIT_DELETE, ///< delete current area + EDIT_SPLIT, ///< split current area + EDIT_MERGE, ///< merge adjacent areas + EDIT_JOIN, ///< define connection between areas + EDIT_BREAK, ///< break connection between areas + EDIT_MARK, ///< mark an area for further operations + EDIT_ATTRIB_CROUCH, ///< toggle crouch attribute on current area + EDIT_ATTRIB_JUMP, ///< toggle jump attribute on current area + EDIT_ATTRIB_PRECISE, ///< toggle precise attribute on current area + EDIT_ATTRIB_NO_JUMP, ///< toggle inhibiting discontinuity jumping in current area + EDIT_BEGIN_AREA, ///< begin creating a new nav area + EDIT_END_AREA, ///< end creation of the new nav area + EDIT_CONNECT, ///< connect marked area to selected area + EDIT_DISCONNECT, ///< disconnect marked area from selected area + EDIT_SPLICE, ///< create new area in between marked and selected areas + EDIT_TOGGLE_PLACE_MODE, ///< switch between normal and place editing + EDIT_TOGGLE_PLACE_PAINTING, ///< switch between "painting" places onto areas + EDIT_PLACE_FLOODFILL, ///< floodfill areas out from current area + EDIT_PLACE_PICK, ///< "pick up" the place at the current area + EDIT_MARK_UNNAMED, ///< mark an unnamed area for further operations + EDIT_WARP_TO_MARK, ///< warp a spectating local player to the selected mark + EDIT_SELECT_CORNER, ///< select a corner on the current area + EDIT_RAISE_CORNER, ///< raise a corner on the current area + EDIT_LOWER_CORNER, ///< lower a corner on the current area +}; + +extern void EditNavAreasReset( void ); +extern void EditNavAreas( NavEditCmdType cmd ); +extern CNavArea *GetMarkedArea( void ); + + + +//-------------------------------------------------------------------------------------------------------------- +// +// Templates +// + +//-------------------------------------------------------------------------------------------------------------- +/** + * Functor used with NavAreaBuildPath() + */ +class ShortestPathCost +{ +public: + float operator() ( CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder ) + { + if (fromArea == NULL) + { + // first area in path, no cost + return 0.0f; + } + else + { + // compute distance travelled along path so far + float dist; + + if (ladder) + dist = ladder->m_length; + else + dist = (*area->GetCenter() - *fromArea->GetCenter()).Length(); + + float cost = dist + fromArea->GetCostSoFar(); + + // if this is a "crouch" area, add penalty + if (area->GetAttributes() & NAV_CROUCH) + { + const float crouchPenalty = 20.0f; // 10 + cost += crouchPenalty * dist; + } + + // if this is a "jump" area, add penalty + if (area->GetAttributes() & NAV_JUMP) + { + const float jumpPenalty = 5.0f; + cost += jumpPenalty * dist; + } + + return cost; + } + } +}; + +//-------------------------------------------------------------------------------------------------------------- +/** + * Find path from startArea to goalArea via an A* search, using supplied cost heuristic. + * If cost functor returns -1 for an area, that area is considered a dead end. + * This doesn't actually build a path, but the path is defined by following parent + * pointers back from goalArea to startArea. + * If 'closestArea' is non-NULL, the closest area to the goal is returned (useful if the path fails). + * If 'goalArea' is NULL, will compute a path as close as possible to 'goalPos'. + * If 'goalPos' is NULL, will use the center of 'goalArea' as the goal position. + * Returns true if a path exists. + */ +template< typename CostFunctor > +bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, CostFunctor &costFunc, CNavArea **closestArea = NULL ) +{ + if (closestArea) + *closestArea = NULL; + + if (startArea == NULL) + return false; + + // + // If goalArea is NULL, this function will return the closest area to the goal. + // However, if there is also no goal, we can't do anything. + // + if (goalArea == NULL && goalPos == NULL) + { + return false; + } + + startArea->SetParent( NULL ); + + // if we are already in the goal area, build trivial path + if (startArea == goalArea) + { + goalArea->SetParent( NULL ); + + if (closestArea) + *closestArea = goalArea; + + return true; + } + + // determine actual goal position + Vector actualGoalPos = (goalPos) ? *goalPos : *goalArea->GetCenter(); + + // start search + CNavArea::ClearSearchLists(); + + // compute estimate of path length + /// @todo Cost might work as "manhattan distance" + startArea->SetTotalCost( (*startArea->GetCenter() - actualGoalPos).Length() ); + + float initCost = costFunc( startArea, NULL, NULL ); + if (initCost < 0.0f) + return false; + startArea->SetCostSoFar( initCost ); + + startArea->AddToOpenList(); + + // keep track of the area we visit that is closest to the goal + if (closestArea) + *closestArea = startArea; + float closestAreaDist = startArea->GetTotalCost(); + + // do A* search + while( !CNavArea::IsOpenListEmpty() ) + { + // get next area to check + CNavArea *area = CNavArea::PopOpenList(); + + // check if we have found the goal area + if (area == goalArea) + { + if (closestArea) + *closestArea = goalArea; + + return true; + } + + // search adjacent areas + bool searchFloor = true; + int dir = NORTH; + const NavConnectList *floorList = area->GetAdjacentList( NORTH ); + NavConnectList::const_iterator floorIter = floorList->begin(); + + bool ladderUp = true; + const NavLadderList *ladderList = NULL; + NavLadderList::const_iterator ladderIter; + enum { AHEAD = 0, LEFT, RIGHT, BEHIND, NUM_TOP_DIRECTIONS }; + int ladderTopDir; + + while(true) + { + CNavArea *newArea; + NavTraverseType how; + const CNavLadder *ladder = NULL; + + // + // Get next adjacent area - either on floor or via ladder + // + if (searchFloor) + { + // if exhausted adjacent connections in current direction, begin checking next direction + if (floorIter == floorList->end()) + { + ++dir; + + if (dir == NUM_DIRECTIONS) + { + // checked all directions on floor - check ladders next + searchFloor = false; + + ladderList = area->GetLadderList( LADDER_UP ); + ladderIter = ladderList->begin(); + ladderTopDir = AHEAD; + } + else + { + // start next direction + floorList = area->GetAdjacentList( (NavDirType)dir ); + floorIter = floorList->begin(); + } + + continue; + } + + newArea = (*floorIter).area; + how = (NavTraverseType)dir; + ++floorIter; + } + else // search ladders + { + if (ladderIter == ladderList->end()) + { + if (!ladderUp) + { + // checked both ladder directions - done + break; + } + else + { + // check down ladders + ladderUp = false; + ladderList = area->GetLadderList( LADDER_DOWN ); + ladderIter = ladderList->begin(); + } + continue; + } + + if (ladderUp) + { + ladder = *ladderIter; + + // cannot use this ladder if the ladder bottom is hanging above our head + if (ladder->m_isDangling) + { + ++ladderIter; + continue; + } + + // do not use BEHIND connection, as its very hard to get to when going up a ladder + if (ladderTopDir == AHEAD) + newArea = ladder->m_topForwardArea; + else if (ladderTopDir == LEFT) + newArea = ladder->m_topLeftArea; + else if (ladderTopDir == RIGHT) + newArea = ladder->m_topRightArea; + else + { + ++ladderIter; + continue; + } + + how = GO_LADDER_UP; + ++ladderTopDir; + } + else + { + newArea = (*ladderIter)->m_bottomArea; + how = GO_LADDER_DOWN; + ladder = (*ladderIter); + ++ladderIter; + } + + if (newArea == NULL) + continue; + } + + // don't backtrack + if (newArea == area) + continue; + + float newCostSoFar = costFunc( newArea, area, ladder ); + + // check if cost functor says this area is a dead-end + if (newCostSoFar < 0.0f) + continue; + + if ((newArea->IsOpen() || newArea->IsClosed()) && newArea->GetCostSoFar() <= newCostSoFar) + { + // this is a worse path - skip it + continue; + } + else + { + // compute estimate of distance left to go + float newCostRemaining = (*newArea->GetCenter() - actualGoalPos).Length(); + + // track closest area to goal in case path fails + if (closestArea && newCostRemaining < closestAreaDist) + { + *closestArea = newArea; + closestAreaDist = newCostRemaining; + } + + newArea->SetParent( area, how ); + newArea->SetCostSoFar( newCostSoFar ); + newArea->SetTotalCost( newCostSoFar + newCostRemaining ); + + if (newArea->IsClosed()) + newArea->RemoveFromClosedList(); + + if (newArea->IsOpen()) + { + // area already on open list, update the list order to keep costs sorted + newArea->UpdateOnOpenList(); + } + else + { + newArea->AddToOpenList(); + } + } + } + + // we have searched this area + area->AddToClosedList(); + } + + return false; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute distance between two areas. Return -1 if can't reach 'endArea' from 'startArea'. + */ +template< typename CostFunctor > +float NavAreaTravelDistance( CNavArea *startArea, CNavArea *endArea, CostFunctor &costFunc ) +{ + if (startArea == NULL) + return -1.0f; + + if (endArea == NULL) + return -1.0f; + + if (startArea == endArea) + return 0.0f; + + // compute path between areas using given cost heuristic + if (NavAreaBuildPath( startArea, endArea, NULL, costFunc ) == false) + return -1.0f; + + // compute distance along path + float distance = 0.0f; + for( CNavArea *area = endArea; area->GetParent(); area = area->GetParent() ) + { + distance += (*area->GetCenter() - *area->GetParent()->GetCenter()).Length(); + } + + return distance; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute distance from area to position. Return -1 if can't reach position. + */ +template< typename CostFunctor > +float NavAreaTravelDistance( const Vector *startPos, CNavArea *startArea, const Vector *goalPos, CostFunctor &costFunc ) +{ + if (startArea == NULL || startPos == NULL || goalPos == NULL) + return -1.0f; + + // compute path between areas using given cost heuristic + CNavArea *goalArea = NULL; + if (NavAreaBuildPath( startArea, TheNavAreaGrid.GetNearestNavArea( goalPos ), goalPos, costFunc, &goalArea ) == false) + return -1.0f; + + if (goalArea == NULL) + return -1.0f; + + // compute distance along path + if (goalArea->GetParent() == NULL) + { + return (*goalPos - *startPos).Length(); + } + else + { + CNavArea *area = goalArea->GetParent(); + + float distance = (*goalPos - *area->GetCenter()).Length(); + + for( ; area->GetParent(); area = area->GetParent() ) + { + distance += (*area->GetCenter() - *area->GetParent()->GetCenter()).Length(); + } + + return distance; + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Do a breadth-first search, invoking functor on each area. + * If functor returns 'true', continue searching from this area. + * If functor returns 'false', the area's adjacent areas are not explored (dead end). + * If 'maxRange' is 0 or less, no range check is done (all areas will be examined). + * + * NOTE: Returns all areas that overlap range, even partially + * + * @todo Use ladder connections + */ + +// helper function +inline void AddAreaToOpenList( CNavArea *area, CNavArea *parent, const Vector *startPos, float maxRange ) +{ + if (area == NULL) + return; + + if (!area->IsMarked()) + { + area->Mark(); + area->SetTotalCost( 0.0f ); + area->SetParent( parent ); + + if (maxRange > 0.0f) + { + // make sure this area overlaps range + Vector closePos; + area->GetClosestPointOnArea( startPos, &closePos ); + if ((closePos - *startPos).Make2D().IsLengthLessThan( maxRange )) + { + // compute approximate distance along path to limit travel range, too + float distAlong = parent->GetCostSoFar(); + distAlong += (*area->GetCenter() - *parent->GetCenter()).Length(); + area->SetCostSoFar( distAlong ); + + // allow for some fudge due to large size areas + if (distAlong <= 1.5f * maxRange) + area->AddToOpenList(); + } + } + else + { + // infinite range + area->AddToOpenList(); + } + } +} + + +template < typename Functor > +void SearchSurroundingAreas( CNavArea *startArea, const Vector *startPos, Functor &func, float maxRange = -1.0f ) +{ + if (startArea == NULL || startPos == NULL) + return; + + CNavArea::MakeNewMarker(); + CNavArea::ClearSearchLists(); + + startArea->AddToOpenList(); + startArea->SetTotalCost( 0.0f ); + startArea->SetCostSoFar( 0.0f ); + startArea->SetParent( NULL ); + startArea->Mark(); + + while( !CNavArea::IsOpenListEmpty() ) + { + // get next area to check + CNavArea *area = CNavArea::PopOpenList(); + + // invoke functor on area + if (func( area )) + { + // explore adjacent floor areas + for( int dir=0; dirGetAdjacentCount( (NavDirType)dir ); + for( int i=0; iGetAdjacentArea( (NavDirType)dir, i ); + + AddAreaToOpenList( adjArea, area, startPos, maxRange ); + } + } + + + // explore adjacent areas connected by ladders + NavLadderList::const_iterator ladderIt; + + // check up ladders + const NavLadderList *ladderList = area->GetLadderList( LADDER_UP ); + if (ladderList) + { + for( ladderIt = ladderList->begin(); ladderIt != ladderList->end(); ++ladderIt ) + { + const CNavLadder *ladder = *ladderIt; + + // cannot use this ladder if the ladder bottom is hanging above our head + if (ladder->m_isDangling) + { + continue; + } + + // do not use BEHIND connection, as its very hard to get to when going up a ladder + AddAreaToOpenList( ladder->m_topForwardArea, area, startPos, maxRange ); + AddAreaToOpenList( ladder->m_topLeftArea, area, startPos, maxRange ); + AddAreaToOpenList( ladder->m_topRightArea, area, startPos, maxRange ); + } + } + + // check down ladders + ladderList = area->GetLadderList( LADDER_DOWN ); + if (ladderList) + { + for( ladderIt = ladderList->begin(); ladderIt != ladderList->end(); ++ladderIt ) + { + const CNavLadder *ladder = *ladderIt; + + AddAreaToOpenList( ladder->m_bottomArea, area, startPos, maxRange ); + } + } + } + } +} + + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Apply the functor to all navigation areas + */ +template < typename Functor > +void ForAllAreas( Functor &func ) +{ + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + func( area ); + } +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Fuctor that returns lowest cost for farthest away areas + * For use with FindMinimumCostArea() + */ +class FarAwayFunctor +{ +public: + float operator() ( CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder ) + { + if (area == fromArea) + return 9999999.9f; + + return 1.0f/(*fromArea->GetCenter() - *area->GetCenter()).Length(); + } +}; + +/** + * Fuctor that returns lowest cost for areas farthest from given position + * For use with FindMinimumCostArea() + */ +class FarAwayFromPositionFunctor +{ +public: + FarAwayFromPositionFunctor( const Vector *pos ) + { + m_pos = pos; + } + + float operator() ( CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder ) + { + return 1.0f/(*m_pos - *area->GetCenter()).Length(); + } + +private: + const Vector *m_pos; +}; + + +/** + * Pick a low-cost area of "decent" size + */ +template< typename CostFunctor > +CNavArea *FindMinimumCostArea( CNavArea *startArea, CostFunctor &costFunc ) +{ + const float minSize = 150.0f; + + // collect N low-cost areas of a decent size + enum { NUM_CHEAP_AREAS = 32 }; + struct + { + CNavArea *area; + float cost; + } + cheapAreaSet[ NUM_CHEAP_AREAS ]; + int cheapAreaSetCount = 0; + + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + + // skip the small areas + const Extent *extent = area->GetExtent(); + if (extent->hi.x - extent->lo.x < minSize || extent->hi.y - extent->lo.y < minSize) + continue; + + // compute cost of this area + float cost = costFunc( area, startArea, NULL ); + + if (cheapAreaSetCount < NUM_CHEAP_AREAS) + { + cheapAreaSet[ cheapAreaSetCount ].area = area; + cheapAreaSet[ cheapAreaSetCount++ ].cost = cost; + } + else + { + // replace most expensive cost if this is cheaper + int expensive = 0; + for( int i=1; i cheapAreaSet[expensive].cost) + expensive = i; + + if (cheapAreaSet[expensive].cost > cost) + { + cheapAreaSet[expensive].area = area; + cheapAreaSet[expensive].cost = cost; + } + } + } + + if (cheapAreaSetCount) + { + // pick one of the areas at random + return cheapAreaSet[ RANDOM_LONG( 0, cheapAreaSetCount-1 ) ].area; + } + else + { + // degenerate case - no decent sized areas - pick a random area + int numAreas = TheNavAreaList.size(); + int which = RANDOM_LONG( 0, numAreas-1 ); + + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + if (which-- == 0) + break; + + return *iter; + } +} + + +#endif // _NAV_AREA_H_ diff --git a/game_shared/bot/nav_file.cpp b/game_shared/bot/nav_file.cpp new file mode 100644 index 0000000..d765a47 --- /dev/null +++ b/game_shared/bot/nav_file.cpp @@ -0,0 +1,1080 @@ +// nav_file.cpp +// Reading and writing nav files +// Author: Michael S. Booth (mike@turtlerockstudios.com), January-September 2003 + +#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning +#pragma warning( disable : 4786 ) // long STL names get truncated in browse info. + +#include +#include +#include + +#include +#include +#include + +#ifdef _WIN32 +#include + +#else +#include +#define _write write +#define _close close +#define MAX_OSPATH PATH_MAX +#endif + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "player.h" +#include "gamerules.h" + +#include "bot_util.h" + +/// @todo Abstract these out of here (TheBotPhrases) +#include "cs_bot.h" +#include "cs_bot_manager.h" + +#include "nav.h" +#include "nav_node.h" +#include "nav_area.h" + + +// +// The 'place directory' is used to save and load places from +// nav files in a size-efficient manner that also allows for the +// order of the place ID's to change without invalidating the +// nav files. +// +// The place directory is stored in the nav file as a list of +// place name strings. Each nav area then contains an index +// into that directory, or zero if no place has been assigned to +// that area. +// +class PlaceDirectory +{ +public: + + typedef unsigned short EntryType; + + void Reset( void ) + { + m_directory.clear(); + } + + /// return true if this place is already in the directory + bool IsKnown( Place place ) const + { + std::vector::const_iterator it = std::find( m_directory.begin(), m_directory.end(), place ); + + return (it != m_directory.end()); + } + + /// return the directory entry corresponding to this Place (0 = no entry) + EntryType GetEntry( Place place ) const + { + if (place == UNDEFINED_PLACE) + return 0; + + std::vector::const_iterator it = std::find( m_directory.begin(), m_directory.end(), place ); + + if (it == m_directory.end()) + { + assert( false && "PlaceDirectory::GetEntry failure" ); + return 0; + } + + return 1 + (it - m_directory.begin()); + } + + /// add the place to the directory if not already known + void AddPlace( Place place ) + { + if (place == UNDEFINED_PLACE) + return; + + assert( place < 1000 ); + + if (IsKnown( place )) + return; + + m_directory.push_back( place ); + } + + /// given an entry, return the Place + Place EntryToPlace( EntryType entry ) const + { + if (entry == 0) + return UNDEFINED_PLACE; + + int i = entry-1; + + if (i > m_directory.size()) + { + assert( false && "PlaceDirectory::EntryToPlace: Invalid entry" ); + return UNDEFINED_PLACE; + } + + return m_directory[ i ]; + } + + /// store the directory + void Save( int fd ) + { + // store number of entries in directory + EntryType count = m_directory.size(); + _write( fd, &count, sizeof(EntryType) ); + + // store entries + std::vector::iterator it; + for( it = m_directory.begin(); it != m_directory.end(); ++it ) + { + const char *placeName = TheBotPhrases->IDToName( *it ); + + // store string length followed by string itself + unsigned short len = strlen(placeName)+1; + _write( fd, &len, sizeof(unsigned short) ); + _write( fd, placeName, len ); + } + } + + /// load the directory + void Load( SteamFile *file ) + { + // read number of entries + EntryType count; + file->Read( &count, sizeof(EntryType) ); + + m_directory.reserve( count ); + + // read each entry + char placeName[256]; + unsigned short len; + for( int i=0; iRead( &len, sizeof(unsigned short) ); + file->Read( placeName, len ); + + AddPlace( TheBotPhrases->NameToID( placeName ) ); + } + } + +private: + std::vector m_directory; +}; + +static PlaceDirectory placeDirectory; + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Replace extension with "bsp" + */ +char *GetBspFilename( const char *navFilename ) +{ + static char bspFilename[256]; + + sprintf( bspFilename, "maps\\%s.bsp", STRING( gpGlobals->mapname ) ); + + int len = strlen( bspFilename ); + if (len < 3) + return NULL; + + bspFilename[ len-3 ] = 'b'; + bspFilename[ len-2 ] = 's'; + bspFilename[ len-1 ] = 'p'; + + return bspFilename; +} + +//-------------------------------------------------------------------------------------------------------------- +void CNavArea::Save( FILE *fp ) const +{ + fprintf( fp, "v %f %f %f\n", m_extent.lo.x, m_extent.lo.y, m_extent.lo.z ); + fprintf( fp, "v %f %f %f\n", m_extent.hi.x, m_extent.lo.y, m_neZ ); + fprintf( fp, "v %f %f %f\n", m_extent.hi.x, m_extent.hi.y, m_extent.hi.z ); + fprintf( fp, "v %f %f %f\n", m_extent.lo.x, m_extent.hi.y, m_swZ ); + + static int base = 1; + fprintf( fp, "\n\ng %04dArea%s%s%s%s\n", m_id, + (GetAttributes() & NAV_CROUCH) ? "CROUCH" : "", + (GetAttributes() & NAV_JUMP) ? "JUMP" : "", + (GetAttributes() & NAV_PRECISE) ? "PRECISE" : "", + (GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP" : "" ); + fprintf( fp, "f %d %d %d %d\n\n", base, base+1, base+2, base+3 ); + base += 4; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Save a navigation area to the opened binary stream + */ +void CNavArea::Save( int fd, unsigned int version ) +{ + // save ID + _write( fd, &m_id, sizeof(unsigned int) ); + + // save attribute flags + _write( fd, &m_attributeFlags, sizeof(unsigned char) ); + + // save extent of area + _write( fd, &m_extent, 6*sizeof(float) ); + + // save heights of implicit corners + _write( fd, &m_neZ, sizeof(float) ); + _write( fd, &m_swZ, sizeof(float) ); + + // save connections to adjacent areas + // in the enum order NORTH, EAST, SOUTH, WEST + for( int d=0; dm_id, sizeof(unsigned int) ); + } + } + + // + // Store hiding spots for this area + // + unsigned char count; + if (m_hidingSpotList.size() > 255) + { + count = 255; + CONSOLE_ECHO( "Warning: NavArea #%d: Truncated hiding spot list to 255\n", m_id ); + } + else + { + count = m_hidingSpotList.size(); + } + _write( fd, &count, sizeof(unsigned char) ); + + // store HidingSpot objects + unsigned int saveCount = 0; + for( HidingSpotList::iterator iter = m_hidingSpotList.begin(); iter != m_hidingSpotList.end(); ++iter ) + { + HidingSpot *spot = *iter; + + spot->Save( fd, version ); + + // overflow check + if (++saveCount == count) + break; + } + + // + // Save the approach areas for this area + // + + // save number of approach areas + _write( fd, &m_approachCount, sizeof(unsigned char) ); + if (cv_bot_debug.value > 0.0f) + CONSOLE_ECHO( " m_approachCount = %d\n", m_approachCount ); + + // save approach area info + unsigned char type; + unsigned int zero = 0; + for( int a=0; am_id, sizeof(unsigned int) ); + else + _write( fd, &zero, sizeof(unsigned int) ); + + if (m_approach[a].prev.area) + _write( fd, &m_approach[a].prev.area->m_id, sizeof(unsigned int) ); + else + _write( fd, &zero, sizeof(unsigned int) ); + type = (unsigned char)m_approach[a].prevToHereHow; + _write( fd, &type, sizeof(unsigned char) ); + + if (m_approach[a].next.area) + _write( fd, &m_approach[a].next.area->m_id, sizeof(unsigned int) ); + else + _write( fd, &zero, sizeof(unsigned int) ); + type = (unsigned char)m_approach[a].hereToNextHow; + _write( fd, &type, sizeof(unsigned char) ); + } + + // + // Save encounter spots for this area + // + { + // save number of encounter paths for this area + unsigned int count = m_spotEncounterList.size(); + _write( fd, &count, sizeof(unsigned int) ); + + if (cv_bot_debug.value > 0.0f) + CONSOLE_ECHO( " m_spotEncounterList.size() = %d\n", count ); + + SpotEncounter *e; + for( SpotEncounterList::iterator iter = m_spotEncounterList.begin(); iter != m_spotEncounterList.end(); ++iter ) + { + e = &(*iter); + + if (e->from.area) + _write( fd, &e->from.area->m_id, sizeof(unsigned int) ); + else + _write( fd, &zero, sizeof(unsigned int) ); + + unsigned char dir = e->fromDir; + _write( fd, &dir, sizeof(unsigned char) ); + + if (e->to.area) + _write( fd, &e->to.area->m_id, sizeof(unsigned int) ); + else + _write( fd, &zero, sizeof(unsigned int) ); + + dir = e->toDir; + _write( fd, &dir, sizeof(unsigned char) ); + + // write list of spots along this path + unsigned char spotCount; + if (e->spotList.size() > 255) + { + spotCount = 255; + CONSOLE_ECHO( "Warning: NavArea #%d: Truncated encounter spot list to 255\n", m_id ); + } + else + { + spotCount = e->spotList.size(); + } + _write( fd, &spotCount, sizeof(unsigned char) ); + + saveCount = 0; + for( SpotOrderList::iterator oiter = e->spotList.begin(); oiter != e->spotList.end(); ++oiter ) + { + SpotOrder *order = &(*oiter); + + // order->spot may be NULL if we've loaded a nav mesh that has been edited but not re-analyzed + unsigned int id = (order->spot) ? order->spot->GetID() : 0; + _write( fd, &id, sizeof(unsigned int) ); + + unsigned char t = 255 * order->t; + _write( fd, &t, sizeof(unsigned char) ); + + // overflow check + if (++saveCount == spotCount) + break; + } + } + } + + // store place dictionary entry + PlaceDirectory::EntryType entry = placeDirectory.GetEntry( GetPlace() ); + _write( fd, &entry, sizeof(entry) ); + +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Load a navigation area from the file + */ +void CNavArea::Load( SteamFile *file, unsigned int version ) +{ + // load ID + file->Read( &m_id, sizeof(unsigned int) ); + + // update nextID to avoid collisions + if (m_id >= m_nextID) + m_nextID = m_id+1; + + // load attribute flags + file->Read( &m_attributeFlags, sizeof(unsigned char) ); + + // load extent of area + file->Read( &m_extent, 6*sizeof(float) ); + + m_center.x = (m_extent.lo.x + m_extent.hi.x)/2.0f; + m_center.y = (m_extent.lo.y + m_extent.hi.y)/2.0f; + m_center.z = (m_extent.lo.z + m_extent.hi.z)/2.0f; + + // load heights of implicit corners + file->Read( &m_neZ, sizeof(float) ); + file->Read( &m_swZ, sizeof(float) ); + + // load connections (IDs) to adjacent areas + // in the enum order NORTH, EAST, SOUTH, WEST + for( int d=0; dRead( &count, sizeof(unsigned int) ); + + for( unsigned int i=0; iRead( &connect.id, sizeof(unsigned int) ); + + m_connect[d].push_back( connect ); + } + } + + // + // Load hiding spots + // + + // load number of hiding spots + unsigned char hidingSpotCount; + file->Read( &hidingSpotCount, sizeof(unsigned char) ); + + if (version == 1) + { + // load simple vector array + Vector pos; + for( int h=0; hRead( &pos, 3 * sizeof(float) ); + + // create new hiding spot and put on master list + HidingSpot *spot = new HidingSpot( &pos, HidingSpot::IN_COVER ); + + m_hidingSpotList.push_back( spot ); + } + } + else + { + // load HidingSpot objects for this area + for( int h=0; hLoad( file, version ); + + m_hidingSpotList.push_back( spot ); + } + } + + // + // Load number of approach areas + // + file->Read( &m_approachCount, sizeof(unsigned char) ); + + // load approach area info (IDs) + unsigned char type; + for( int a=0; aRead( &m_approach[a].here.id, sizeof(unsigned int) ); + + file->Read( &m_approach[a].prev.id, sizeof(unsigned int) ); + file->Read( &type, sizeof(unsigned char) ); + m_approach[a].prevToHereHow = (NavTraverseType)type; + + file->Read( &m_approach[a].next.id, sizeof(unsigned int) ); + file->Read( &type, sizeof(unsigned char) ); + m_approach[a].hereToNextHow = (NavTraverseType)type; + } + + + // + // Load encounter paths for this area + // + unsigned int count; + file->Read( &count, sizeof(unsigned int) ); + + if (version < 3) + { + // old data, read and discard + for( unsigned int e=0; eRead( &encounter.from.id, sizeof(unsigned int) ); + file->Read( &encounter.to.id, sizeof(unsigned int) ); + + file->Read( &encounter.path.from.x, 3 * sizeof(float) ); + file->Read( &encounter.path.to.x, 3 * sizeof(float) ); + + // read list of spots along this path + unsigned char spotCount; + file->Read( &spotCount, sizeof(unsigned char) ); + + for( int s=0; sRead( &pos, 3*sizeof(float) ); + file->Read( &pos, sizeof(float) ); + } + } + return; + } + + for( unsigned int e=0; eRead( &encounter.from.id, sizeof(unsigned int) ); + + unsigned char dir; + file->Read( &dir, sizeof(unsigned char) ); + encounter.fromDir = static_cast( dir ); + + file->Read( &encounter.to.id, sizeof(unsigned int) ); + + file->Read( &dir, sizeof(unsigned char) ); + encounter.toDir = static_cast( dir ); + + // read list of spots along this path + unsigned char spotCount; + file->Read( &spotCount, sizeof(unsigned char) ); + + SpotOrder order; + for( int s=0; sRead( &order.id, sizeof(unsigned int) ); + + unsigned char t; + file->Read( &t, sizeof(unsigned char) ); + + order.t = (float)t/255.0f; + + encounter.spotList.push_back( order ); + } + + m_spotEncounterList.push_back( encounter ); + } + + if (version < 5) + return; + + // + // Load Place data + // + PlaceDirectory::EntryType entry; + file->Read( &entry, sizeof(entry) ); + + // convert entry to actual Place + SetPlace( placeDirectory.EntryToPlace( entry ) ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Convert loaded IDs to pointers + * Make sure all IDs are converted, even if corrupt data is encountered. + */ +NavErrorType CNavArea::PostLoad( void ) +{ + NavErrorType error = NAV_OK; + + // connect areas together + for( int d=0; did; + connect->area = TheNavAreaGrid.GetNavAreaByID( id ); + if (id && connect->area == NULL) + { + CONSOLE_ECHO( "ERROR: Corrupt navigation data. Cannot connect Navigation Areas.\n" ); + error = NAV_CORRUPT_DATA; + } + } + } + + // resolve approach area IDs + for( int a=0; afrom.area = TheNavAreaGrid.GetNavAreaByID( e->from.id ); + if (e->from.area == NULL) + { + CONSOLE_ECHO( "ERROR: Corrupt navigation data. Missing \"from\" Navigation Area for Encounter Spot.\n" ); + error = NAV_CORRUPT_DATA; + } + + e->to.area = TheNavAreaGrid.GetNavAreaByID( e->to.id ); + if (e->to.area == NULL) + { + CONSOLE_ECHO( "ERROR: Corrupt navigation data. Missing \"to\" Navigation Area for Encounter Spot.\n" ); + error = NAV_CORRUPT_DATA; + } + + if (e->from.area && e->to.area) + { + // compute path + float halfWidth; + ComputePortal( e->to.area, e->toDir, &e->path.to, &halfWidth ); + ComputePortal( e->from.area, e->fromDir, &e->path.from, &halfWidth ); + + const float eyeHeight = HalfHumanHeight; + e->path.from.z = e->from.area->GetZ( &e->path.from ) + eyeHeight; + e->path.to.z = e->to.area->GetZ( &e->path.to ) + eyeHeight; + } + + // resolve HidingSpot IDs + for( SpotOrderList::iterator oiter = e->spotList.begin(); oiter != e->spotList.end(); ++oiter ) + { + SpotOrder *order = &(*oiter); + + order->spot = GetHidingSpotByID( order->id ); + if (order->spot == NULL) + { + CONSOLE_ECHO( "ERROR: Corrupt navigation data. Missing Hiding Spot\n" ); + error = NAV_CORRUPT_DATA; + } + } + } + + // build overlap list + /// @todo Optimize this + for( NavAreaList::iterator oiter = TheNavAreaList.begin(); oiter != TheNavAreaList.end(); ++oiter ) + { + CNavArea *area = *oiter; + + if (area == this) + continue; + + if (IsOverlapping( area )) + m_overlapList.push_back( area ); + } + + return error; +} + + +//-------------------------------------------------------------------------------------------------------------- +/* +============ +COM_FixSlashes + +Changes all '/' characters into '\' characters, in place. +============ +*/ +inline void COM_FixSlashes( char *pname ) +{ +#ifdef _WIN32 + while ( *pname ) + { + if ( *pname == '/' ) + *pname = '\\'; + pname++; + } +#else + while ( *pname ) + { + if ( *pname == '\\' ) + *pname = '/'; + pname++; + } +#endif +} + +/** + * Store AI navigation data to a file + */ +bool SaveNavigationMap( const char *filename ) +{ + if (filename == NULL) + return false; + + // + // Store the NAV file + // + COM_FixSlashes( const_cast(filename) ); + +#ifdef WIN32 + int fd = _open( filename, _O_BINARY | _O_CREAT | _O_WRONLY, _S_IREAD | _S_IWRITE ); +#else +#define _write write + int fd = creat( filename, S_IRUSR | S_IWUSR | S_IRGRP ); +#endif + + if (fd < 0) + return false; + + // store "magic number" to help identify this kind of file + unsigned int magic = NAV_MAGIC_NUMBER; + _write( fd, &magic, sizeof(unsigned int) ); + + // store version number of file + // 1 = hiding spots as plain vector array + // 2 = hiding spots as HidingSpot objects + // 3 = Encounter spots use HidingSpot ID's instead of storing vector again + // 4 = Includes size of source bsp file to verify nav data correlation + // ---- Beta Release at V4 ----- + // 5 = Added Place info + unsigned int version = 5; + _write( fd, &version, sizeof(unsigned int) ); + + + // get size of source bsp file and store it in the nav file + // so we can test if the bsp changed since the nav file was made + char *bspFilename = GetBspFilename( filename ); + if (bspFilename == NULL) + return false; + + unsigned int bspSize = (unsigned int)GET_FILE_SIZE( bspFilename ); + CONSOLE_ECHO( "Size of bsp file '%s' is %u bytes.\n", bspFilename, bspSize ); + + _write( fd, &bspSize, sizeof(unsigned int) ); + + + // + // Build a directory of the Places in this map + // + placeDirectory.Reset(); + + NavAreaList::iterator it; + for( it = TheNavAreaList.begin(); it != TheNavAreaList.end(); ++it ) + { + CNavArea *area = *it; + + Place place = area->GetPlace(); + + if (place) + { + placeDirectory.AddPlace( place ); + } + } + + placeDirectory.Save( fd ); + + + // + // Store navigation areas + // + + // store number of areas + unsigned int count = TheNavAreaList.size(); + _write( fd, &count, sizeof(unsigned int) ); + + // store each area + for( it = TheNavAreaList.begin(); it != TheNavAreaList.end(); ++it ) + { + CNavArea *area = *it; + + area->Save( fd, version ); + } + + _close( fd ); + + +#ifdef _WIN32 + // output a simple Wavefront file to visualize the generated areas in 3DSMax + FILE *fp = fopen( "c:\\tmp\\nav.obj", "w" ); + if (fp) + { + for( NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + (*iter)->Save( fp ); + + fclose( fp ); + } +#endif + + + return true; +} + + +//-------------------------------------------------------------------------------------------------------------- +// +// Load place map +// This is legacy code - Places are stored directly in the nav file now +// +void LoadLocationFile( const char *filename ) +{ + char locFilename[256]; + strcpy( locFilename, filename ); + + char *dot = strchr( locFilename, '.' ); + if (dot) + { + strcpy( dot, ".loc" ); + + int locDataLength; + char *locDataFile = (char *)LOAD_FILE_FOR_ME( const_cast( locFilename ), &locDataLength ); + char *locData = locDataFile; + + if (locData) + { + CONSOLE_ECHO( "Loading legacy 'location file' '%s'\n", locFilename ); + + // read directory + locData = MP_COM_Parse( locData ); + int dirSize = atoi( MP_COM_GetToken() ); + + if (dirSize) + { + std::vector directory; + + directory.reserve( dirSize ); + + for( int i=0; iNameToID( MP_COM_GetToken() ) ); + } + + // read places for each nav area + unsigned int areaID, locDirIndex; + while(true) + { + locData = MP_COM_Parse( locData ); + if (locData == NULL) + break; + + areaID = atoi( MP_COM_GetToken() ); + + locData = MP_COM_Parse( locData ); + locDirIndex = atoi( MP_COM_GetToken() ); + + CNavArea *area = TheNavAreaGrid.GetNavAreaByID( areaID ); + unsigned int place = (locDirIndex > 0) ? directory[ locDirIndex-1 ] : UNDEFINED_PLACE; + + if (area) + area->SetPlace( place ); + } + } + + FREE_FILE( locDataFile ); + } + } +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Performs a lightweight sanity-check of the specified map's nav mesh + */ +void SanityCheckNavigationMap( const char *mapName ) +{ + if ( !mapName ) + { + CONSOLE_ECHO( "ERROR: navigation file not specified.\n" ); + return; + } + + // nav filename is derived from map filename + const int BufLen = MAX_OSPATH; + char bspFilename[MAX_OSPATH]; + char navFilename[MAX_OSPATH]; + snprintf( bspFilename, MAX_OSPATH, "maps\\%s.bsp", mapName ); + snprintf( navFilename, MAX_OSPATH, "maps\\%s.nav", mapName ); + + SteamFile navFile( navFilename ); + + if (!navFile.IsValid()) + { + CONSOLE_ECHO( "ERROR: navigation file %s does not exist.\n", navFilename ); + return; + } + + // check magic number + bool result; + unsigned int magic; + result = navFile.Read( &magic, sizeof(unsigned int) ); + if (!result || magic != NAV_MAGIC_NUMBER) + { + CONSOLE_ECHO( "ERROR: Invalid navigation file '%s'.\n", navFilename ); + return; + } + + // read file version number + unsigned int version; + result = navFile.Read( &version, sizeof(unsigned int) ); + if (!result || version > 5) + { + CONSOLE_ECHO( "ERROR: Unknown version in navigation file %s.\n", navFilename ); + return; + } + + if (version >= 4) + { + // get size of source bsp file and verify that the bsp hasn't changed + unsigned int saveBspSize; + navFile.Read( &saveBspSize, sizeof(unsigned int) ); + + // verify size + if (bspFilename == NULL) + { + CONSOLE_ECHO( "ERROR: No map corresponds to navigation file %s.\n", navFilename ); + return; + } + + unsigned int bspSize = (unsigned int)GET_FILE_SIZE( bspFilename ); + + if (bspSize != saveBspSize) + { + // this nav file is out of date for this bsp file + CONSOLE_ECHO( "ERROR: Out-of-date navigation data in navigation file %s.\n", navFilename ); + return; + } + } + CONSOLE_ECHO( "navigation file %s passes the sanity check.\n", navFilename ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Load AI navigation data from a file + */ +NavErrorType LoadNavigationMap( void ) +{ + // since the navigation map is destroyed on map change, + // if it exists it has already been loaded for this map + if (!TheNavAreaList.empty()) + return NAV_OK; + + // nav filename is derived from map filename + char filename[256]; + sprintf( filename, "maps\\%s.nav", STRING( gpGlobals->mapname ) ); + + + // free previous navigation map data + DestroyNavigationMap(); + placeDirectory.Reset(); + + CNavArea::m_nextID = 1; + + SteamFile navFile( filename ); + + if (!navFile.IsValid()) + return NAV_CANT_ACCESS_FILE; + + // check magic number + bool result; + unsigned int magic; + result = navFile.Read( &magic, sizeof(unsigned int) ); + if (!result || magic != NAV_MAGIC_NUMBER) + { + CONSOLE_ECHO( "ERROR: Invalid navigation file '%s'.\n", filename ); + return NAV_INVALID_FILE; + } + + // read file version number + unsigned int version; + result = navFile.Read( &version, sizeof(unsigned int) ); + if (!result || version > 5) + { + CONSOLE_ECHO( "ERROR: Unknown navigation file version.\n" ); + return NAV_BAD_FILE_VERSION; + } + + if (version >= 4) + { + // get size of source bsp file and verify that the bsp hasn't changed + unsigned int saveBspSize; + navFile.Read( &saveBspSize, sizeof(unsigned int) ); + + // verify size + char *bspFilename = GetBspFilename( filename ); + if (bspFilename == NULL) + return NAV_INVALID_FILE; + + unsigned int bspSize = (unsigned int)GET_FILE_SIZE( bspFilename ); + + if (bspSize != saveBspSize) + { + // this nav file is out of date for this bsp file + char *msg = "*** WARNING ***\nThe AI navigation data is from a different version of this map.\nThe CPU players will likely not perform well.\n"; + HintMessageToAllPlayers( msg ); + CONSOLE_ECHO( "\n-----------------\n" ); + CONSOLE_ECHO( msg ); + CONSOLE_ECHO( "-----------------\n\n" ); + } + } + + // load Place directory + if (version >= 5) + { + placeDirectory.Load( &navFile ); + } + + // get number of areas + unsigned int count; + result = navFile.Read( &count, sizeof(unsigned int) ); + + Extent extent; + extent.lo.x = 9999999999.9f; + extent.lo.y = 9999999999.9f; + extent.hi.x = -9999999999.9f; + extent.hi.y = -9999999999.9f; + + // load the areas and compute total extent + for( unsigned int i=0; iLoad( &navFile, version ); + TheNavAreaList.push_back( area ); + + const Extent *areaExtent = area->GetExtent(); + + // check validity of nav area + if (areaExtent->lo.x >= areaExtent->hi.x || areaExtent->lo.y >= areaExtent->hi.y) + CONSOLE_ECHO( "WARNING: Degenerate Navigation Area #%d at ( %g, %g, %g )\n", + area->GetID(), area->m_center.x, area->m_center.y, area->m_center.z ); + + if (areaExtent->lo.x < extent.lo.x) + extent.lo.x = areaExtent->lo.x; + if (areaExtent->lo.y < extent.lo.y) + extent.lo.y = areaExtent->lo.y; + if (areaExtent->hi.x > extent.hi.x) + extent.hi.x = areaExtent->hi.x; + if (areaExtent->hi.y > extent.hi.y) + extent.hi.y = areaExtent->hi.y; + } + + // add the areas to the grid + TheNavAreaGrid.Initialize( extent.lo.x, extent.hi.x, extent.lo.y, extent.hi.y ); + + NavAreaList::iterator iter; + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + TheNavAreaGrid.AddNavArea( *iter ); + + + // allow areas to connect to each other, etc + for( iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter ) + { + CNavArea *area = *iter; + area->PostLoad(); + } + + // load legacy location file (Places) + if (version < 5) + { + LoadLocationFile( filename ); + } + + // + // Set up all the ladders + // + BuildLadders(); + + return NAV_OK; +} diff --git a/game_shared/bot/nav_node.cpp b/game_shared/bot/nav_node.cpp new file mode 100644 index 0000000..d28115b --- /dev/null +++ b/game_shared/bot/nav_node.cpp @@ -0,0 +1,111 @@ +// nav_node.cpp +// AI Navigation Nodes +// Author: Michael S. Booth (mike@turtlerockstudios.com), January 2003 + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "bot_util.h" +#include "nav_node.h" + +NavDirType Opposite[ NUM_DIRECTIONS ] = { SOUTH, WEST, NORTH, EAST }; + +CNavNode *CNavNode::m_list = NULL; +unsigned int CNavNode::m_listLength = 0; + +Extent NodeMapExtent; + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Constructor + */ +CNavNode::CNavNode( const Vector *pos, const Vector *normal, CNavNode *parent ) +{ + m_pos = *pos; + m_normal = *normal; + + static unsigned int nextID = 1; + m_id = nextID++; + + for( int i=0; ix, pos->y, pos->z ); +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Create a connection FROM this node TO the given node, in the given direction + */ +void CNavNode::ConnectTo( CNavNode *node, NavDirType dir ) +{ + m_to[ dir ] = node; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return node at given position. + * @todo Need a hash table to make this lookup fast + */ +const CNavNode *CNavNode::GetNode( const Vector *pos ) +{ + const float tolerance = 0.45f * GenerationStepSize; // 1.0f + + for( const CNavNode *node = m_list; node; node = node->m_next ) + { + float dx = ABS( node->m_pos.x - pos->x ); + float dy = ABS( node->m_pos.y - pos->y ); + float dz = ABS( node->m_pos.z - pos->z ); + + if (dx < tolerance && dy < tolerance && dz < tolerance) + return node; + } + + return NULL; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if this node is bidirectionally linked to + * another node in the given direction + */ +BOOL CNavNode::IsBiLinked( NavDirType dir ) const +{ + if (m_to[ dir ] && + m_to[ dir ]->m_to[ Opposite[dir] ] == this) + return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if this node is the NW corner of a quad of nodes + * that are all bidirectionally linked. + */ +BOOL CNavNode::IsClosedCell( void ) const +{ + if (IsBiLinked( SOUTH ) && + IsBiLinked( EAST ) && + m_to[ EAST ]->IsBiLinked( SOUTH ) && + m_to[ SOUTH ]->IsBiLinked( EAST ) && + m_to[ EAST ]->m_to[ SOUTH ] == m_to[ SOUTH ]->m_to[ EAST ]) + return true; + + return false; +} + diff --git a/game_shared/bot/nav_node.h b/game_shared/bot/nav_node.h new file mode 100644 index 0000000..9e8e5c7 --- /dev/null +++ b/game_shared/bot/nav_node.h @@ -0,0 +1,113 @@ +// nav_node.h +// AI Navigation Nodes +// Author: Michael S. Booth (mike@turtlerockstudios.com), January 2003 + +#ifndef _NAV_NODE_H_ +#define _NAV_NODE_H_ + +#include "nav.h" + +//-------------------------------------------------------------------------------------------------------------- +/** + * Navigation Nodes. + * These Nodes encapsulate world locations, and ways to get from one location to an adjacent one. + * Note that these links are not necessarily commutative (falling off of a ledge, for example). + */ +class CNavNode +{ +public: + CNavNode( const Vector *pos, const Vector *normal, CNavNode *parent = NULL ); + + static const CNavNode *GetNode( const Vector *pos ); ///< return navigation node at the position, or NULL if none exists + + CNavNode *GetConnectedNode( NavDirType dir ) const; ///< get navigation node connected in given direction, or NULL if cant go that way + const Vector *GetPosition( void ) const; + const Vector *GetNormal( void ) const { return &m_normal; } + unsigned int GetID( void ) const { return m_id; } + + static CNavNode *GetFirst( void ) { return m_list; } + static unsigned int GetListLength( void ) { return m_listLength; } + CNavNode *GetNext( void ) { return m_next; } + + void ConnectTo( CNavNode *node, NavDirType dir ); ///< create a connection FROM this node TO the given node, in the given direction + CNavNode *GetParent( void ) const; + + void MarkAsVisited( NavDirType dir ); ///< mark the given direction as having been visited + BOOL HasVisited( NavDirType dir ); ///< return TRUE if the given direction has already been searched + BOOL IsBiLinked( NavDirType dir ) const; ///< node is bidirectionally linked to another node in the given direction + BOOL IsClosedCell( void ) const; ///< node is the NW corner of a bi-linked quad of nodes + + void Cover( void ) { m_isCovered = true; } ///< @todo Should pass in area that is covering + BOOL IsCovered( void ) const { return m_isCovered; } ///< return true if this node has been covered by an area + + void AssignArea( CNavArea *area ); ///< assign the given area to this node + CNavArea *GetArea( void ) const; ///< return associated area + + void SetAttributes( unsigned char bits ) { m_attributeFlags = bits; } + unsigned char GetAttributes( void ) const { return m_attributeFlags; } + +private: + friend void DestroyNavigationMap( void ); + + Vector m_pos; ///< position of this node in the world + Vector m_normal; ///< surface normal at this location + CNavNode *m_to[ NUM_DIRECTIONS ]; ///< links to north, south, east, and west. NULL if no link + unsigned int m_id; ///< unique ID of this node + unsigned char m_attributeFlags; ///< set of attribute bit flags (see NavAttributeType) + + static CNavNode *m_list; ///< the master list of all nodes for this map + static unsigned int m_listLength; + CNavNode *m_next; ///< next link in master list + + // below are only needed when generating + unsigned char m_visited; ///< flags for automatic node generation. If direction bit is clear, that direction hasn't been explored yet. + CNavNode *m_parent; ///< the node prior to this in the search, which we pop back to when this node's search is done (a stack) + BOOL m_isCovered; ///< true when this node is "covered" by a CNavArea + CNavArea *m_area; ///< the area this node is contained within +}; + +//-------------------------------------------------------------------------------------------------------------- +// +// Inlines +// + +inline CNavNode *CNavNode::GetConnectedNode( NavDirType dir ) const +{ + return m_to[ dir ]; +} + +inline const Vector *CNavNode::GetPosition( void ) const +{ + return &m_pos; +} + +inline CNavNode *CNavNode::GetParent( void ) const +{ + return m_parent; +} + +inline void CNavNode::MarkAsVisited( NavDirType dir ) +{ + m_visited |= (1 << dir); +} + +inline BOOL CNavNode::HasVisited( NavDirType dir ) +{ + if (m_visited & (1 << dir)) + return true; + + return false; +} + +inline void CNavNode::AssignArea( CNavArea *area ) +{ + m_area = area; +} + +inline CNavArea *CNavNode::GetArea( void ) const +{ + return m_area; +} + + +#endif // _NAV_NODE_H_ diff --git a/game_shared/bot/nav_path.cpp b/game_shared/bot/nav_path.cpp new file mode 100644 index 0000000..192dc79 --- /dev/null +++ b/game_shared/bot/nav_path.cpp @@ -0,0 +1,1192 @@ +// nav_path.cpp +// Encapsulation of a path through space +// Author: Michael S. Booth (mike@turtlerockstudios.com), November 2003 + +#include "extdll.h" +#include "util.h" +#include "cbase.h" +#include "weapons.h" +#include "soundent.h" +#include "gamerules.h" +#include "player.h" +#include "client.h" +#include "cmd.h" + +#include "nav.h" +#include "nav_path.h" +#include "bot_util.h" +#include "improv.h" + +//-------------------------------------------------------------------------------------------------------------- +/** + * Determine actual path positions + */ +bool CNavPath::ComputePathPositions( void ) +{ + if (m_segmentCount == 0) + return false; + + // start in first area's center + m_path[0].pos = *m_path[0].area->GetCenter(); + m_path[0].ladder = NULL; + m_path[0].how = NUM_TRAVERSE_TYPES; + + for( int i=1; ihow <= GO_WEST) // walk along the floor to the next area + { + to->ladder = NULL; + + // compute next point, keeping path as straight as possible + from->area->ComputeClosestPointInPortal( to->area, (NavDirType)to->how, &from->pos, &to->pos ); + + // move goal position into the goal area a bit + const float stepInDist = 5.0f; // how far to "step into" an area - must be less than min area size + AddDirectionVector( &to->pos, (NavDirType)to->how, stepInDist ); + + // we need to walk out of "from" area, so keep Z where we can reach it + to->pos.z = from->area->GetZ( &to->pos ); + + // if this is a "jump down" connection, we must insert an additional point on the path + if (to->area->IsConnected( from->area, NUM_DIRECTIONS ) == false) + { + // this is a "jump down" link + + // compute direction of path just prior to "jump down" + Vector2D dir; + DirectionToVector2D( (NavDirType)to->how, &dir ); + + // shift top of "jump down" out a bit to "get over the ledge" + const float pushDist = 25.0f; + to->pos.x += pushDist * dir.x; + to->pos.y += pushDist * dir.y; + + // insert a duplicate node to represent the bottom of the fall + if (m_segmentCount < MAX_PATH_SEGMENTS-1) + { + // copy nodes down + for( int j=m_segmentCount; j>i; --j ) + m_path[j] = m_path[j-1]; + + // path is one node longer + ++m_segmentCount; + + // move index ahead into the new node we just duplicated + ++i; + + m_path[i].pos.x = to->pos.x + pushDist * dir.x; + m_path[i].pos.y = to->pos.y + pushDist * dir.y; + + // put this one at the bottom of the fall + m_path[i].pos.z = to->area->GetZ( &m_path[i].pos ); + } + } + } + else if (to->how == GO_LADDER_UP) // to get to next area, must go up a ladder + { + // find our ladder + const NavLadderList *list = from->area->GetLadderList( LADDER_UP ); + NavLadderList::const_iterator iter; + for( iter = list->begin(); iter != list->end(); ++iter ) + { + CNavLadder *ladder = *iter; + + // can't use "behind" area when ascending... + if (ladder->m_topForwardArea == to->area || + ladder->m_topLeftArea == to->area || + ladder->m_topRightArea == to->area) + { + to->ladder = ladder; + to->pos = ladder->m_bottom; + AddDirectionVector( &to->pos, ladder->m_dir, 2.0f*HalfHumanWidth ); + break; + } + } + + if (iter == list->end()) + { + //PrintIfWatched( "ERROR: Can't find ladder in path\n" ); + return false; + } + } + else if (to->how == GO_LADDER_DOWN) // to get to next area, must go down a ladder + { + // find our ladder + const NavLadderList *list = from->area->GetLadderList( LADDER_DOWN ); + NavLadderList::const_iterator iter; + for( iter = list->begin(); iter != list->end(); ++iter ) + { + CNavLadder *ladder = *iter; + + if (ladder->m_bottomArea == to->area) + { + to->ladder = ladder; + to->pos = ladder->m_top; + AddDirectionVector( &to->pos, OppositeDirection( ladder->m_dir ), 2.0f*HalfHumanWidth ); + break; + } + } + + if (iter == list->end()) + { + //PrintIfWatched( "ERROR: Can't find ladder in path\n" ); + return false; + } + } + } + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return true if position is at the end of the path + */ +bool CNavPath::IsAtEnd( const Vector &pos ) const +{ + if (!IsValid()) + return false; + + const float epsilon = 20.0f; + return (pos - GetEndpoint()).IsLengthLessThan( epsilon ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return length of path from start to finish + */ +float CNavPath::GetLength( void ) const +{ + float length = 0.0f; + for( int i=1; i= distAlong) + { + // desired point is on this segment of the path + float delta = distAlong - lengthSoFar; + float t = delta / segmentLength; + + *pointOnPath = m_path[i].pos + t * dir; + + return true; + } + + lengthSoFar += segmentLength; + } + + *pointOnPath = m_path[ GetSegmentCount()-1 ].pos; + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the node index closest to the given distance along the path without going over - returns (-1) if error + */ +int CNavPath::GetSegmentIndexAlongPath( float distAlong ) const +{ + if (!IsValid()) + return -1; + + if (distAlong <= 0.0f) + { + return 0; + } + + float lengthSoFar = 0.0f; + Vector dir; + for( int i=1; i distAlong) + { + return i-1; + } + } + + return GetSegmentCount()-1; +} + + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute closest point on path to given point + * NOTE: This does not do line-of-sight tests, so closest point may be thru the floor, etc + */ +bool CNavPath::FindClosestPointOnPath( const Vector *worldPos, int startIndex, int endIndex, Vector *close ) const +{ + if (!IsValid() || close == NULL) + return false; + + Vector along, toWorldPos; + Vector pos; + const Vector *from, *to; + float length; + float closeLength; + float closeDistSq = 9999999999.9; + float distSq; + + for( int i=startIndex; i<=endIndex; ++i ) + { + from = &m_path[i-1].pos; + to = &m_path[i].pos; + + // compute ray along this path segment + along = *to - *from; + + // make it a unit vector along the path + length = along.NormalizeInPlace(); + + // compute vector from start of segment to our point + toWorldPos = *worldPos - *from; + + // find distance of closest point on ray + closeLength = DotProduct( toWorldPos, along ); + + // constrain point to be on path segment + if (closeLength <= 0.0f) + pos = *from; + else if (closeLength >= length) + pos = *to; + else + pos = *from + closeLength * along; + + distSq = (pos - *worldPos).LengthSquared(); + + // keep the closest point so far + if (distSq < closeDistSq) + { + closeDistSq = distSq; + *close = pos; + } + } + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Build trivial path when start and goal are in the same nav area + */ +bool CNavPath::BuildTrivialPath( const Vector *start, const Vector *goal ) +{ + m_segmentCount = 0; + + CNavArea *startArea = TheNavAreaGrid.GetNearestNavArea( start ); + if (startArea == NULL) + return false; + + CNavArea *goalArea = TheNavAreaGrid.GetNearestNavArea( goal ); + if (goalArea == NULL) + return false; + + m_segmentCount = 2; + + m_path[0].area = startArea; + m_path[0].pos.x = start->x; + m_path[0].pos.y = start->y; + m_path[0].pos.z = startArea->GetZ( start ); + m_path[0].ladder = NULL; + m_path[0].how = NUM_TRAVERSE_TYPES; + + m_path[1].area = goalArea; + m_path[1].pos.x = goal->x; + m_path[1].pos.y = goal->y; + m_path[1].pos.z = goalArea->GetZ( goal ); + m_path[1].ladder = NULL; + m_path[1].how = NUM_TRAVERSE_TYPES; + + return true; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Draw the path for debugging. + */ +void CNavPath::Draw( void ) +{ + if (!IsValid()) + return; + + for( int i=1; i anchor) + { + // remove redundant nodes between anchor and nextAnchor + int removeCount = nextAnchor - anchor - 1; + if (removeCount > 0) + { + for( int i=nextAnchor; iIsValid() == false) + return; + + const CNavPath::PathSegment *node = (*m_path)[ m_segmentIndex ]; + + if (node == NULL) + { + m_improv->OnMoveToFailure( m_path->GetEndpoint(), IImprovEvent::FAIL_INVALID_PATH ); + m_path->Invalidate(); + return; + } + + // handle ladders + if (node->ladder) + { + const Vector *approachPos = NULL; + const Vector *departPos = NULL; + + if (m_segmentIndex) + approachPos = &(*m_path)[ m_segmentIndex-1 ]->pos; + + if (m_segmentIndex < m_path->GetSegmentCount()-1) + departPos = &(*m_path)[ m_segmentIndex+1 ]->pos; + + if (!m_isLadderStarted) + { + // set up ladder movement + m_improv->StartLadder( node->ladder, node->how, approachPos, departPos ); + m_isLadderStarted = true; + } + + // move improv along ladder + if (m_improv->TraverseLadder( node->ladder, node->how, approachPos, departPos, deltaT )) + { + // completed ladder + ++m_segmentIndex; + } + return; + } + + // reset ladder init flag + m_isLadderStarted = false; + + // + // Check if we reached the end of the path + // + const float closeRange = 20.0f; + if ((m_improv->GetFeet() - node->pos).IsLengthLessThan( closeRange )) + { + ++m_segmentIndex; + + if (m_segmentIndex >= m_path->GetSegmentCount()) + { + m_improv->OnMoveToSuccess( m_path->GetEndpoint() ); + m_path->Invalidate(); + return; + } + } + + + m_goal = node->pos; + + const float aheadRange = 300.0f; + m_segmentIndex = FindPathPoint( aheadRange, &m_goal, &m_behindIndex ); + if (m_segmentIndex >= m_path->GetSegmentCount()) + m_segmentIndex = m_path->GetSegmentCount()-1; + + + bool isApproachingJumpArea = false; + + // + // Crouching + // + if (!m_improv->IsUsingLadder()) + { + // because hostage crouching is not really supported by the engine, + // if we are standing in a crouch area, we must crouch to avoid collisions + if (m_improv->GetLastKnownArea() && + m_improv->GetLastKnownArea()->GetAttributes() & NAV_CROUCH && + !(m_improv->GetLastKnownArea()->GetAttributes() & NAV_JUMP)) + { + m_improv->Crouch(); + } + + // if we are approaching a crouch area, crouch + // if there are no crouch areas coming up, stand + const float crouchRange = 50.0f; + bool didCrouch = false; + for( int i=m_segmentIndex; iGetSegmentCount(); ++i ) + { + const CNavArea *to = (*m_path)[i]->area; + + // if there is a jump area on the way to the crouch area, don't crouch as it messes up the jump + if (to->GetAttributes() & NAV_JUMP) + { + isApproachingJumpArea = true; + break; + } + + Vector close; + to->GetClosestPointOnArea( &m_improv->GetCentroid(), &close ); + + if ((close - m_improv->GetFeet()).Make2D().IsLengthGreaterThan( crouchRange )) + break; + + if (to->GetAttributes() & NAV_CROUCH) + { + m_improv->Crouch(); + didCrouch = true; + break; + } + + } + + if (!didCrouch && !m_improv->IsJumping()) + { + // no crouch areas coming up + m_improv->StandUp(); + } + + } // end crouching logic + + + if (m_isDebug) + { + m_path->Draw(); + UTIL_DrawBeamPoints( m_improv->GetCentroid(), m_goal + Vector( 0, 0, StepHeight ), 1, 255, 0, 255 ); + UTIL_DrawBeamPoints( m_goal + Vector( 0, 0, StepHeight ), m_improv->GetCentroid(), 1, 255, 0, 255 ); + } + + // check if improv becomes stuck + m_stuckMonitor.Update( m_improv ); + + + // if improv has been stuck for too long, give up + const float giveUpTime = 2.0f; + if (m_stuckMonitor.GetDuration() > giveUpTime) + { + m_improv->OnMoveToFailure( m_path->GetEndpoint(), IImprovEvent::FAIL_STUCK ); + m_path->Invalidate(); + return; + } + + + // if our goal is high above us, we must have fallen + if (m_goal.z - m_improv->GetFeet().z > JumpCrouchHeight) + { + const float closeRange = 75.0f; + Vector2D to( m_improv->GetFeet().x - m_goal.x, m_improv->GetFeet().y - m_goal.y ); + if (to.IsLengthLessThan( closeRange )) + { + // we can't reach the goal position + // check if we can reach the next node, in case this was a "jump down" situation + const CNavPath::PathSegment *nextNode = (*m_path)[ m_behindIndex+1 ]; + if (m_behindIndex >=0 && nextNode) + { + if (nextNode->pos.z - m_improv->GetFeet().z > JumpCrouchHeight) + { + // the next node is too high, too - we really did fall of the path + m_improv->OnMoveToFailure( m_path->GetEndpoint(), IImprovEvent::FAIL_FELL_OFF ); + m_path->Invalidate(); + return; + } + } + else + { + // fell trying to get to the last node in the path + m_improv->OnMoveToFailure( m_path->GetEndpoint(), IImprovEvent::FAIL_FELL_OFF ); + m_path->Invalidate(); + return; + } + } + } + + + // avoid small obstacles + if (avoidObstacles && !isApproachingJumpArea && !m_improv->IsJumping() && m_segmentIndex < m_path->GetSegmentCount()-1) + { + FeelerReflexAdjustment( &m_goal ); + + // currently, this is only used for hostages, and their collision physics stinks + // do more feeler checks to avoid short obstacles + /* + const float inc = 0.25f; + for( float t = 0.5f; t < 1.0f; t += inc ) + { + FeelerReflexAdjustment( &m_goal, t * StepHeight ); + } + */ + + } + + // move improv along path + m_improv->TrackPath( m_goal, deltaT ); +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Return the closest point to our current position on our current path + * If "local" is true, only check the portion of the path surrounding m_pathIndex. + */ +int CNavPathFollower::FindOurPositionOnPath( Vector *close, bool local ) const +{ + if (!m_path->IsValid()) + return -1; + + Vector along, toFeet; + Vector feet = m_improv->GetFeet(); + Vector eyes = m_improv->GetEyes(); + Vector pos; + const Vector *from, *to; + float length; + float closeLength; + float closeDistSq = 9999999999.9; + int closeIndex = -1; + float distSq; + + int start, end; + + if (local) + { + start = m_segmentIndex - 3; + if (start < 1) + start = 1; + + end = m_segmentIndex + 3; + if (end > m_path->GetSegmentCount()) + end = m_path->GetSegmentCount(); + } + else + { + start = 1; + end = m_path->GetSegmentCount(); + } + + for( int i=start; ipos; + to = &(*m_path)[i]->pos; + + // compute ray along this path segment + along = *to - *from; + + // make it a unit vector along the path + length = along.NormalizeInPlace(); + + // compute vector from start of segment to our point + toFeet = feet - *from; + + // find distance of closest point on ray + closeLength = DotProduct( toFeet, along ); + + // constrain point to be on path segment + if (closeLength <= 0.0f) + pos = *from; + else if (closeLength >= length) + pos = *to; + else + pos = *from + closeLength * along; + + distSq = (pos - feet).LengthSquared(); + + // keep the closest point so far + if (distSq < closeDistSq) + { + // don't use points we cant see + Vector probe = pos + Vector( 0, 0, HalfHumanHeight ); + if (!IsWalkableTraceLineClear( eyes, probe, WALK_THRU_DOORS | WALK_THRU_BREAKABLES )) + continue; + + // don't use points we cant reach + //if (!IsStraightLinePathWalkable( &pos )) + // continue; + + closeDistSq = distSq; + if (close) + *close = pos; + closeIndex = i-1; + } + } + + return closeIndex; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Compute a point a fixed distance ahead along our path. + * Returns path index just after point. + */ +int CNavPathFollower::FindPathPoint( float aheadRange, Vector *point, int *prevIndex ) +{ + // find path index just past aheadRange + int afterIndex; + + // finds the closest point on local area of path, and returns the path index just prior to it + Vector close; + int startIndex = FindOurPositionOnPath( &close, true ); + + if (prevIndex) + *prevIndex = startIndex; + + if (startIndex <= 0) + { + // went off the end of the path + // or next point in path is unwalkable (ie: jump-down) + // keep same point + return m_segmentIndex; + } + + // if we are crouching, just follow the path exactly + if (m_improv->IsCrouching()) + { + // we want to move to the immediately next point along the path from where we are now + int index = startIndex+1; + if (index >= m_path->GetSegmentCount()) + index = m_path->GetSegmentCount()-1; + + *point = (*m_path)[ index ]->pos; + + // if we are very close to the next point in the path, skip ahead to the next one to avoid wiggling + // we must do a 2D check here, in case the goal point is floating in space due to jump down, etc + const float closeEpsilon = 20.0f; // 10 + while ((*point - close).Make2D().IsLengthLessThan( closeEpsilon )) + { + ++index; + + if (index >= m_path->GetSegmentCount()) + { + index = m_path->GetSegmentCount()-1; + break; + } + + *point = (*m_path)[ index ]->pos; + } + + return index; + } + + // make sure we use a node a minimum distance ahead of us, to avoid wiggling + while (startIndex < m_path->GetSegmentCount()-1) + { + Vector pos = (*m_path)[ startIndex+1 ]->pos; + + // we must do a 2D check here, in case the goal point is floating in space due to jump down, etc + const float closeEpsilon = 20.0f; + if ((pos - close).Make2D().IsLengthLessThan( closeEpsilon )) + { + ++startIndex; + } + else + { + break; + } + } + + // if we hit a ladder or jump area, must stop (dont use ladder behind us) + if (startIndex > m_segmentIndex && startIndex < m_path->GetSegmentCount() && + ((*m_path)[ startIndex ]->ladder || (*m_path)[ startIndex ]->area->GetAttributes() & NAV_JUMP)) + { + *point = (*m_path)[ startIndex ]->pos; + return startIndex; + } + + // we need the point just *ahead* of us + ++startIndex; + if (startIndex >= m_path->GetSegmentCount()) + startIndex = m_path->GetSegmentCount()-1; + + // if we hit a ladder or jump area, must stop + if (startIndex < m_path->GetSegmentCount() && + ((*m_path)[ startIndex ]->ladder || (*m_path)[ startIndex ]->area->GetAttributes() & NAV_JUMP)) + { + *point = (*m_path)[ startIndex ]->pos; + return startIndex; + } + + // note direction of path segment we are standing on + Vector initDir = (*m_path)[ startIndex ]->pos - (*m_path)[ startIndex-1 ]->pos; + initDir.NormalizeInPlace(); + + Vector feet = m_improv->GetFeet(); + Vector eyes = m_improv->GetEyes(); + float rangeSoFar = 0; + + // this flag is true if our ahead point is visible + bool visible = true; + + Vector prevDir = initDir; + + // step along the path until we pass aheadRange + bool isCorner = false; + int i; + for( i=startIndex; iGetSegmentCount(); ++i ) + { + Vector pos = (*m_path)[i]->pos; + Vector to = pos - (*m_path)[i-1]->pos; + Vector dir = to.Normalize(); + + // don't allow path to double-back from our starting direction (going upstairs, down curved passages, etc) + if (DotProduct( dir, initDir ) < 0.0f) // -0.25f + { + --i; + break; + } + + // if the path turns a corner, we want to move towards the corner, not into the wall/stairs/etc + if (DotProduct( dir, prevDir ) < 0.5f) + { + isCorner = true; + --i; + break; + } + prevDir = dir; + + // don't use points we cant see + Vector probe = pos + Vector( 0, 0, HalfHumanHeight ); + if (!IsWalkableTraceLineClear( eyes, probe, WALK_THRU_BREAKABLES )) + { + // presumably, the previous point is visible, so we will interpolate + visible = false; + break; + } + + // if we encounter a ladder or jump area, we must stop + if (i < m_path->GetSegmentCount() && + ((*m_path)[ i ]->ladder || (*m_path)[ i ]->area->GetAttributes() & NAV_JUMP)) + break; + + // Check straight-line path from our current position to this position + // Test for un-jumpable height change, or unrecoverable fall + //if (!IsStraightLinePathWalkable( &pos )) + //{ + // --i; + // break; + //} + + Vector along = (i == startIndex) ? (pos - feet) : (pos - (*m_path)[i-1]->pos); + rangeSoFar += along.Length2D(); + + // stop if we have gone farther than aheadRange + if (rangeSoFar >= aheadRange) + break; + } + + if (i < startIndex) + afterIndex = startIndex; + else if (i < m_path->GetSegmentCount()) + afterIndex = i; + else + afterIndex = m_path->GetSegmentCount()-1; + + + // compute point on the path at aheadRange + if (afterIndex == 0) + { + *point = (*m_path)[0]->pos; + } + else + { + // interpolate point along path segment + const Vector *afterPoint = &(*m_path)[ afterIndex ]->pos; + const Vector *beforePoint = &(*m_path)[ afterIndex-1 ]->pos; + + Vector to = *afterPoint - *beforePoint; + float length = to.Length2D(); + + float t = 1.0f - ((rangeSoFar - aheadRange) / length); + + if (t < 0.0f) + t = 0.0f; + else if (t > 1.0f) + t = 1.0f; + + *point = *beforePoint + t * to; + + // if afterPoint wasn't visible, slide point backwards towards beforePoint until it is + if (!visible) + { + const float sightStepSize = 25.0f; + float dt = sightStepSize / length; + + Vector probe = *point + Vector( 0, 0, HalfHumanHeight ); + while( t > 0.0f && !IsWalkableTraceLineClear( eyes, probe, WALK_THRU_BREAKABLES ) ) + { + t -= dt; + *point = *beforePoint + t * to; + } + + if (t <= 0.0f) + *point = *beforePoint; + } + } + + // if position found is too close to us, or behind us, force it farther down the path so we don't stop and wiggle + if (!isCorner) + { + const float epsilon = 50.0f; + Vector2D toPoint; + Vector2D centroid( m_improv->GetCentroid().x, m_improv->GetCentroid().y ); + + toPoint.x = point->x - centroid.x; + toPoint.y = point->y - centroid.y; + + if (DotProduct( toPoint, initDir.Make2D() ) < 0.0f || toPoint.IsLengthLessThan( epsilon )) + { + int i; + for( i=startIndex; iGetSegmentCount(); ++i ) + { + toPoint.x = (*m_path)[i]->pos.x - centroid.x; + toPoint.y = (*m_path)[i]->pos.y - centroid.y; + if ((*m_path)[i]->ladder || (*m_path)[i]->area->GetAttributes() & NAV_JUMP || toPoint.IsLengthGreaterThan( epsilon )) + { + *point = (*m_path)[i]->pos; + startIndex = i; + break; + } + } + + if (i == m_path->GetSegmentCount()) + { + *point = m_path->GetEndpoint(); + startIndex = m_path->GetSegmentCount()-1; + } + } + } + + // m_pathIndex should always be the next point on the path, even if we're not moving directly towards it + if (startIndex < m_path->GetSegmentCount()) + return startIndex; + + return m_path->GetSegmentCount()-1; +} + + +//-------------------------------------------------------------------------------------------------------------- +/** + * Do reflex avoidance movements if our "feelers" are touched + * @todo Parameterize feeler spacing + */ +void CNavPathFollower::FeelerReflexAdjustment( Vector *goalPosition, float height ) +{ + // if we are in a "precise" area, do not do feeler adjustments + if (m_improv->GetLastKnownArea() && m_improv->GetLastKnownArea()->GetAttributes() & NAV_PRECISE) + return; + + Vector dir( BotCOS( m_improv->GetMoveAngle() ), BotSIN( m_improv->GetMoveAngle() ), 0.0f ); + dir.z = 0.0f; + dir.NormalizeInPlace(); + + Vector lat( -dir.y, dir.x, 0.0f ); + + const float feelerOffset = (m_improv->IsCrouching()) ? 20.0f : 25.0f; // 15, 20 + const float feelerLengthRun = 50.0f; // 100 - too long for tight hallways (cs_747) + const float feelerLengthWalk = 30.0f; + + const float feelerHeight = (height > 0.0f) ? height : StepHeight + 0.1f; // if obstacle is lower than StepHeight, we'll walk right over it + + float feelerLength = (m_improv->IsRunning()) ? feelerLengthRun : feelerLengthWalk; + + feelerLength = (m_improv->IsCrouching()) ? 20.0f : feelerLength; + + // + // Feelers must follow floor slope + // + float ground; + Vector normal; + if (m_improv->GetSimpleGroundHeightWithFloor( &m_improv->GetEyes(), &ground, &normal ) == false) + return; + + // get forward vector along floor + dir = CrossProduct( lat, normal ); + + // correct the sideways vector + lat = CrossProduct( dir, normal ); + + + Vector feet = m_improv->GetFeet(); + feet.z += feelerHeight; + + Vector from = feet + feelerOffset * lat; + Vector to = from + feelerLength * dir; + + bool leftClear = IsWalkableTraceLineClear( from, to, WALK_THRU_DOORS | WALK_THRU_BREAKABLES ); + + // draw debug beams + if (m_isDebug) + { + if (leftClear) + UTIL_DrawBeamPoints( from, to, 1, 0, 255, 0 ); + else + UTIL_DrawBeamPoints( from, to, 1, 255, 0, 0 ); + } + + from = feet - feelerOffset * lat; + to = from + feelerLength * dir; + + bool rightClear = IsWalkableTraceLineClear( from, to, WALK_THRU_DOORS | WALK_THRU_BREAKABLES ); + + // draw debug beams + if (m_isDebug) + { + if (rightClear) + UTIL_DrawBeamPoints( from, to, 1, 0, 255, 0 ); + else + UTIL_DrawBeamPoints( from, to, 1, 255, 0, 0 ); + } + + + + const float avoidRange = (m_improv->IsCrouching()) ? 150.0f : 300.0f; + + if (!rightClear) + { + if (leftClear) + { + // right hit, left clear - veer left + *goalPosition = *goalPosition + avoidRange * lat; + //*goalPosition = m_improv->GetFeet() + avoidRange * lat; + + //m_improv->StrafeLeft(); + } + } + else if (!leftClear) + { + // right clear, left hit - veer right + *goalPosition = *goalPosition - avoidRange * lat; + //*goalPosition = m_improv->GetFeet() - avoidRange * lat; + + //m_improv->StrafeRight(); + } + +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Reset the stuck-checker. + */ +CStuckMonitor::CStuckMonitor( void ) +{ + m_isStuck = false; + m_avgVelIndex = 0; + m_avgVelCount = 0; +} + +/** + * Reset the stuck-checker. + */ +void CStuckMonitor::Reset( void ) +{ + m_isStuck = false; + m_avgVelIndex = 0; + m_avgVelCount = 0; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * Test if the improv has become stuck + */ +void CStuckMonitor::Update( CImprov *improv ) +{ + if (m_isStuck) + { + // improv is stuck - see if it has moved far enough to be considered unstuck + const float unstuckRange = 75.0f; + if ((improv->GetCentroid() - m_stuckSpot).IsLengthGreaterThan( unstuckRange )) + { + // no longer stuck + Reset(); + //PrintIfWatched( "UN-STUCK\n" ); + } + } + else + { + // check if improv has become stuck + + // compute average velocity over a short period (for stuck check) + Vector vel = improv->GetCentroid() - m_lastCentroid; + + // if we are jumping, ignore Z + //if (improv->IsJumping()) + // vel.z = 0.0f; + + // ignore Z unless we are on a ladder (which is only Z) + if (!improv->IsUsingLadder()) + vel.z = 0.0f; + + // cannot be Length2D, or will break ladder movement (they are only Z) + float moveDist = vel.Length(); + + float deltaT = gpGlobals->time - m_lastTime; + if (deltaT <= 0.0f) + return; + + m_lastTime = gpGlobals->time; + + // compute current velocity + m_avgVel[ m_avgVelIndex++ ] = moveDist/deltaT; + + if (m_avgVelIndex == MAX_VEL_SAMPLES) + m_avgVelIndex = 0; + + if (m_avgVelCount < MAX_VEL_SAMPLES) + { + ++m_avgVelCount; + } + else + { + // we have enough samples to know if we're stuck + + float avgVel = 0.0f; + for( int t=0; tIsUsingLadder()) ? 10.0f : 20.0f; + + if (avgVel < stuckVel) + { + // note when and where we initially become stuck + m_stuckTimer.Start(); + m_stuckSpot = improv->GetCentroid(); + m_isStuck = true; + } + } + } + + // always need to track this + m_lastCentroid = improv->GetCentroid(); +} + diff --git a/game_shared/bot/nav_path.h b/game_shared/bot/nav_path.h new file mode 100644 index 0000000..45b9997 --- /dev/null +++ b/game_shared/bot/nav_path.h @@ -0,0 +1,230 @@ +// nav_path.h +// Navigation Path encapsulation +// Author: Michael S. Booth (mike@turtlerockstudios.com), November 2003 + +#ifndef _NAV_PATH_H_ +#define _NAV_PATH_H_ + +#pragma warning( disable : 4530 ) // STL uses exceptions, but we are not compiling with them - ignore warning + +#include "nav_area.h" +#include "bot_util.h" + +class CImprov; + +//-------------------------------------------------------------------------------------------------------- +/** + * The CNavPath class encapsulates a path through space + */ +class CNavPath +{ +public: + CNavPath( void ) + { + m_segmentCount = 0; + } + + struct PathSegment + { + CNavArea *area; ///< the area along the path + NavTraverseType how; ///< how to enter this area from the previous one + Vector pos; ///< our movement goal position at this point in the path + const CNavLadder *ladder; ///< if "how" refers to a ladder, this is it + }; + + const PathSegment * operator[] ( int i ) { return (i >= 0 && i < m_segmentCount) ? &m_path[i] : NULL; } + int GetSegmentCount( void ) const { return m_segmentCount; } + const Vector &GetEndpoint( void ) const { return m_path[ m_segmentCount-1 ].pos; } + bool IsAtEnd( const Vector &pos ) const; ///< return true if position is at the end of the path + + float GetLength( void ) const; ///< return length of path from start to finish + bool GetPointAlongPath( float distAlong, Vector *pointOnPath ) const; ///< return point a given distance along the path - if distance is out of path bounds, point is clamped to start/end + + /// return the node index closest to the given distance along the path without going over - returns (-1) if error + int GetSegmentIndexAlongPath( float distAlong ) const; + + bool IsValid( void ) const { return (m_segmentCount > 0); } + void Invalidate( void ) { m_segmentCount = 0; } + + void Draw( void ); ///< draw the path for debugging + + /// compute closest point on path to given point + bool FindClosestPointOnPath( const Vector *worldPos, int startIndex, int endIndex, Vector *close ) const; + + void Optimize( void ); + + /** + * Compute shortest path from 'start' to 'goal' via A* algorithm + */ + template< typename CostFunctor > + bool Compute( const Vector *start, const Vector *goal, CostFunctor &costFunc ) + { + Invalidate(); + + if (start == NULL || goal == NULL) + return false; + + CNavArea *startArea = TheNavAreaGrid.GetNearestNavArea( start ); + if (startArea == NULL) + return false; + + CNavArea *goalArea = TheNavAreaGrid.GetNavArea( goal ); + + // if we are already in the goal area, build trivial path + if (startArea == goalArea) + { + BuildTrivialPath( start, goal ); + return true; + } + + // make sure path end position is on the ground + Vector pathEndPosition = *goal; + if (goalArea) + pathEndPosition.z = goalArea->GetZ( &pathEndPosition ); + else + GetGroundHeight( &pathEndPosition, &pathEndPosition.z ); + + // + // Compute shortest path to goal + // + CNavArea *closestArea; + bool pathToGoalExists = NavAreaBuildPath( startArea, goalArea, goal, costFunc, &closestArea ); + + CNavArea *effectiveGoalArea = (pathToGoalExists) ? goalArea : closestArea; + + // + // Build path by following parent links + // + + // get count + int count = 0; + CNavArea *area; + for( area = effectiveGoalArea; area; area = area->GetParent() ) + ++count; + + // save room for endpoint + if (count > MAX_PATH_SEGMENTS-1) + count = MAX_PATH_SEGMENTS-1; + + if (count == 0) + return false; + + if (count == 1) + { + BuildTrivialPath( start, goal ); + return true; + } + + // build path + m_segmentCount = count; + for( area = effectiveGoalArea; count && area; area = area->GetParent() ) + { + --count; + m_path[ count ].area = area; + m_path[ count ].how = area->GetParentHow(); + } + + // compute path positions + if (ComputePathPositions() == false) + { + //PrintIfWatched( "Error building path\n" ); + Invalidate(); + return false; + } + + // append path end position + m_path[ m_segmentCount ].area = effectiveGoalArea; + m_path[ m_segmentCount ].pos = pathEndPosition; + m_path[ m_segmentCount ].ladder = NULL; + m_path[ m_segmentCount ].how = NUM_TRAVERSE_TYPES; + ++m_segmentCount; + + return true; + } + +private: + enum { MAX_PATH_SEGMENTS = 256 }; + PathSegment m_path[ MAX_PATH_SEGMENTS ]; + int m_segmentCount; + + bool ComputePathPositions( void ); ///< determine actual path positions + bool BuildTrivialPath( const Vector *start, const Vector *goal ); ///< utility function for when start and goal are in the same area + + int FindNextOccludedNode( int anchor ); ///< used by Optimize() +}; + +//-------------------------------------------------------------------------------------------------------- +/** + * Monitor improv movement and determine if it becomes stuck + */ +class CStuckMonitor +{ +public: + CStuckMonitor( void ); + + void Reset( void ); + void Update( CImprov *improv ); + bool IsStuck( void ) const { return m_isStuck; } + + float GetDuration( void ) const { return (m_isStuck) ? m_stuckTimer.GetElapsedTime() : 0.0f; } + +private: + bool m_isStuck; ///< if true, we are stuck + Vector m_stuckSpot; ///< the location where we became stuck + IntervalTimer m_stuckTimer; ///< how long we have been stuck + + enum { MAX_VEL_SAMPLES = 5 }; + float m_avgVel[ MAX_VEL_SAMPLES ]; + int m_avgVelIndex; + int m_avgVelCount; + Vector m_lastCentroid; + float m_lastTime; +}; + +//-------------------------------------------------------------------------------------------------------- +/** + * The CNavPathFollower class implements path following behavior + */ +class CNavPathFollower +{ +public: + CNavPathFollower( void ); + + void SetImprov( CImprov *improv ) { m_improv = improv; } + void SetPath( CNavPath *path ) { m_path = path; } + + void Reset( void ); + + #define DONT_AVOID_OBSTACLES false + void Update( float deltaT, bool avoidObstacles = true ); ///< move improv along path + void Debug( bool status ) { m_isDebug = status; } ///< turn debugging on/off + + bool IsStuck( void ) const { return m_stuckMonitor.IsStuck(); } ///< return true if improv is stuck + void ResetStuck( void ) { m_stuckMonitor.Reset(); } + float GetStuckDuration( void ) const { return m_stuckMonitor.GetDuration(); } ///< return how long we've been stuck + + void FeelerReflexAdjustment( Vector *goalPosition, float height = -1.0f ); ///< adjust goal position if "feelers" are touched + +private: + CImprov *m_improv; ///< who is doing the path following + + CNavPath *m_path; ///< the path being followed + + int m_segmentIndex; ///< the point on the path the improv is moving towards + int m_behindIndex; ///< index of the node on the path just behind us + Vector m_goal; ///< last computed follow goal + + bool m_isLadderStarted; + + bool m_isDebug; + + int FindOurPositionOnPath( Vector *close, bool local ) const; ///< return the closest point to our current position on current path + int FindPathPoint( float aheadRange, Vector *point, int *prevIndex ); ///< compute a point a fixed distance ahead along our path. + + CStuckMonitor m_stuckMonitor; +}; + + + +#endif // _NAV_PATH_H_ + diff --git a/game_shared/bot/simple_state_machine.h b/game_shared/bot/simple_state_machine.h new file mode 100644 index 0000000..b1ea660 --- /dev/null +++ b/game_shared/bot/simple_state_machine.h @@ -0,0 +1,85 @@ +// simple_state_machine.h +// Simple finite state machine encapsulation +// Author: Michael S. Booth (mike@turtlerockstudios.com), November 2003 + +#ifndef _SIMPLE_STATE_MACHINE_H_ +#define _SIMPLE_STATE_MACHINE_H_ + +//-------------------------------------------------------------------------------------------------------- +/** + * Encapsulation of a finite-state-machine state + */ +template < typename T > +class SimpleState +{ +public: + SimpleState( void ) + { + m_parent = NULL; + } + + virtual ~SimpleState() { } + + virtual void OnEnter( T userData ) { } ///< when state is entered + virtual void OnUpdate( T userData ) { } ///< state behavior + virtual void OnExit( T userData ) { } ///< when state exited + virtual const char *GetName( void ) const = 0; ///< return state name + + void SetParent( SimpleState *parent ) { m_parent = parent; } + SimpleState *GetParent( void ) const { return m_parent; } + +private: + SimpleState *m_parent; ///< the parent state that contains this state +}; + +//-------------------------------------------------------------------------------------------------------- +/** + * Encapsulation of a finite state machine + */ +template < typename T, typename S > +class SimpleStateMachine +{ +public: + SimpleStateMachine( void ) + { + m_state = NULL; + } + + void Reset( T userData ) + { + m_userData = userData; + m_state = NULL; + } + + /// change behavior state - WARNING: not re-entrant. Do not SetState() from within OnEnter() or OnExit() + void SetState( S *newState ) + { + if (m_state) + m_state->OnExit( m_userData ); + + newState->OnEnter( m_userData ); + + m_state = newState; + m_stateTimer.Start(); + } + + float GetStateDuration( void ) const { return m_stateTimer.GetElapsedTime(); } ///< how long have we been in the current state + + bool IsState( const S *state ) const { return (state == m_state); } ///< return true if given state is current state of machine + + /// execute current state of machine + void Update( void ) + { + if (m_state) + m_state->OnUpdate( m_userData ); + } + +protected: + S *m_state; ///< current behavior state + IntervalTimer m_stateTimer; ///< how long have we been in the current state + T m_userData; +}; + + +#endif // _SIMPLE_STATE_MACHINE_H_ + diff --git a/game_shared/perf_counter.h b/game_shared/perf_counter.h new file mode 100644 index 0000000..ed81198 --- /dev/null +++ b/game_shared/perf_counter.h @@ -0,0 +1,176 @@ +//========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// Extracted from dbg.c (Michael S. Booth) + +#ifndef _PERF_COUNTER_H_ +#define _PERF_COUNTER_H_ + +#ifdef _WIN32 + #include // Currently needed for IsBadReadPtr and IsBadWritePtr + #include + #include +#else + #include + #include + #include + #include + #ifdef OSX + #include + #else + #include + #endif + #define MAX_PATH PATH_MAX + #include +#endif + +#include +//#include +#include +#include +#include +#include +#include + + +//----------------------------------------------------------------------------- +// Purpose: quick hacky timer class +//----------------------------------------------------------------------------- +class CPerformanceCounter +{ +public: + CPerformanceCounter(); + void InitializePerformanceCounter(); + double GetCurTime(); + +private: + int m_iLowShift; + double m_flPerfCounterFreq; + double m_flCurrentTime; + double m_flLastCurrentTime; +}; + + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +inline CPerformanceCounter::CPerformanceCounter() +{ + InitializePerformanceCounter(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +inline void CPerformanceCounter::InitializePerformanceCounter() +{ +#ifdef _WIN32 + LARGE_INTEGER performanceFreq; + QueryPerformanceFrequency(&performanceFreq); + + // get 32 out of the 64 time bits such that we have around + // 1 microsecond resolution + unsigned int lowpart, highpart; + lowpart = (unsigned int)performanceFreq.LowPart; + highpart = (unsigned int)performanceFreq.HighPart; + m_iLowShift = 0; + + while (highpart || (lowpart > 2000000.0)) + { + m_iLowShift++; + lowpart >>= 1; + lowpart |= (highpart & 1) << 31; + highpart >>= 1; + } + + m_flPerfCounterFreq = 1.0 / (double)lowpart; +#endif +} + +//----------------------------------------------------------------------------- +// Purpose: returns the current time +//----------------------------------------------------------------------------- +inline double CPerformanceCounter::GetCurTime() +{ +#ifdef _WIN32 + static int sametimecount; + static unsigned int oldtime; + static int first = 1; + LARGE_INTEGER PerformanceCount; + unsigned int temp, t2; + double time; + + QueryPerformanceCounter(&PerformanceCount); + if (m_iLowShift == 0) + { + temp = (unsigned int)PerformanceCount.LowPart; + } + else + { + temp = ((unsigned int)PerformanceCount.LowPart >> m_iLowShift) | + ((unsigned int)PerformanceCount.HighPart << (32 - m_iLowShift)); + } + + if (first) + { + oldtime = temp; + first = 0; + } + else + { + // check for turnover or backward time + if ((temp <= oldtime) && ((oldtime - temp) < 0x10000000)) + { + oldtime = temp; // so we can't get stuck + } + else + { + t2 = temp - oldtime; + + time = (double)t2 * m_flPerfCounterFreq; + oldtime = temp; + + m_flCurrentTime += time; + + if (m_flCurrentTime == m_flLastCurrentTime) + { + sametimecount++; + + if (sametimecount > 100000) + { + m_flCurrentTime += 1.0; + sametimecount = 0; + } + } + else + { + sametimecount = 0; + } + + m_flLastCurrentTime = m_flCurrentTime; + } + } + + return m_flCurrentTime; + +#else + struct timeval tp; + static int secbase = 0; + + gettimeofday( &tp, NULL ); + + if ( !secbase ) + { + secbase = tp.tv_sec; + return ( tp.tv_usec / 1000000.0 ); + } + + return ( ( tp.tv_sec - secbase ) + tp.tv_usec / 1000000.0 ); +#endif /* _WIN32 */ +} + +#endif // _PERF_COUNTER_H_ diff --git a/game_shared/shared_util.cpp b/game_shared/shared_util.cpp new file mode 100644 index 0000000..e6b209c --- /dev/null +++ b/game_shared/shared_util.cpp @@ -0,0 +1,261 @@ +//========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: dll-agnostic routines (no dll dependencies here) +// +// $NoKeywords: $ +//============================================================================= + +// Author: Matthew D. Campbell (matt@turtlerockstudios.com), 2003 + +#include +#include +#include "shared_util.h" + +#ifndef _WIN32 +#define _vsnwprintf vswprintf +#endif + +static char s_shared_token[ 1500 ]; +static char s_shared_quote = '\"'; + +//-------------------------------------------------------------------------------------------------------------- +/** + * Wrapper for vgui::localize()->Find() that doesn't return NULL + */ +#ifdef CLIENT_DLL +#include +#include // for localize() +#include +wchar_t* SharedFindString( char *asciiIdentifier ) +{ + const int BufLen = 1024; + const int NumBuffers = 4; + static wchar_t string[NumBuffers][BufLen]; + static int curstring = 0; + + wchar_t *identifier = vgui::localize()->Find( asciiIdentifier ); + if ( !identifier ) + { + identifier = string[curstring]; + curstring = ( curstring + 1 ) % NumBuffers; + + vgui::localize()->ConvertANSIToUnicode( asciiIdentifier, identifier, BufLen*2 ); + } + + return identifier; +} +#endif + +//-------------------------------------------------------------------------------------------------------------- +wchar_t * SharedWVarArgs(wchar_t *format, ...) +{ + va_list argptr; + const int BufLen = 1024; + const int NumBuffers = 4; + static wchar_t string[NumBuffers][BufLen]; + static int curstring = 0; + + curstring = ( curstring + 1 ) % NumBuffers; + + va_start (argptr, format); + _vsnwprintf( string[curstring], BufLen, format, argptr ); + va_end (argptr); + + return string[curstring]; +} + +//-------------------------------------------------------------------------------------------------------------- +char * SharedVarArgs(char *format, ...) +{ + va_list argptr; + const int BufLen = 1024; + const int NumBuffers = 4; + static char string[NumBuffers][BufLen]; + static int curstring = 0; + + curstring = ( curstring + 1 ) % NumBuffers; + + va_start (argptr, format); +#ifdef _WIN32 + _vsnprintf( string[curstring], BufLen, format, argptr ); +#else + vsnprintf( string[curstring], BufLen, format, argptr ); +#endif + va_end (argptr); + + return string[curstring]; +} + +//-------------------------------------------------------------------------------------------------------------- +char * BufPrintf(char *buf, int& len, const char *fmt, ...) +{ + if (len <= 0) + return NULL; + + va_list argptr; + + va_start(argptr, fmt); + vsnprintf(buf, len, fmt, argptr); + va_end(argptr); + + len -= strlen(buf); + return buf + strlen(buf); +} + +//-------------------------------------------------------------------------------------------------------------- +wchar_t * BufWPrintf(wchar_t *buf, int& len, const wchar_t *fmt, ...) +{ + if (len <= 0) + return NULL; + + va_list argptr; + + va_start(argptr, fmt); + _vsnwprintf(buf, len, fmt, argptr); + va_end(argptr); + + len -= wcslen(buf); + return buf + wcslen(buf); +} + +//-------------------------------------------------------------------------------------------------------------- +const wchar_t * NumAsWString( int val ) +{ + const int BufLen = 16; + const int NumBuffers = 4; + static wchar_t string[NumBuffers][BufLen]; + static int curstring = 0; + + curstring = ( curstring + 1 ) % NumBuffers; + + int len = BufLen; + BufWPrintf( string[curstring], len, L"%d", val ); + return string[curstring]; +} + +//-------------------------------------------------------------------------------------------------------------- +const char * NumAsString( int val ) +{ + const int BufLen = 16; + const int NumBuffers = 4; + static char string[NumBuffers][BufLen]; + static int curstring = 0; + + curstring = ( curstring + 1 ) % NumBuffers; + + int len = BufLen; + BufPrintf( string[curstring], len, "%d", val ); + return string[curstring]; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Returns the token parsed by SharedParse() + */ +char *SharedGetToken( void ) +{ + return s_shared_token; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Returns the token parsed by SharedParse() + */ +void SharedSetQuoteChar( char c ) +{ + s_shared_quote = c; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Parse a token out of a string + */ +const char *SharedParse( const char *data ) +{ + int c; + int len; + + len = 0; + s_shared_token[0] = 0; + + if (!data) + return NULL; + +// skip whitespace +skipwhite: + while ( (c = *data) <= ' ') + { + if (c == 0) + return NULL; // end of file; + data++; + } + +// skip // comments + if (c=='/' && data[1] == '/') + { + while (*data && *data != '\n') + data++; + goto skipwhite; + } + + +// handle quoted strings specially + if (c == s_shared_quote) + { + data++; + while (1) + { + c = *data++; + if (c==s_shared_quote || !c) + { + s_shared_token[len] = 0; + return data; + } + s_shared_token[len] = c; + len++; + } + } + +// parse single characters + if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c == ',' ) + { + s_shared_token[len] = c; + len++; + s_shared_token[len] = 0; + return data+1; + } + +// parse a regular word + do + { + s_shared_token[len] = c; + data++; + len++; + c = *data; + if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c == ',' ) + break; + } while (c>32); + + s_shared_token[len] = 0; + return data; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Returns true if additional data is waiting to be processed on this line + */ +bool SharedTokenWaiting( const char *buffer ) +{ + const char *p; + + p = buffer; + while ( *p && *p!='\n') + { + if ( !isspace( *p ) || isalnum( *p ) ) + return true; + + p++; + } + + return false; +} diff --git a/game_shared/shared_util.h b/game_shared/shared_util.h new file mode 100644 index 0000000..5511944 --- /dev/null +++ b/game_shared/shared_util.h @@ -0,0 +1,120 @@ +//========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: dll-agnostic routines (no dll dependencies here) +// +// $NoKeywords: $ +//============================================================================= + +// Author: Matthew D. Campbell (matt@turtlerockstudios.com), 2003 + +#ifndef SHARED_UTIL_H +#define SHARED_UTIL_H +#ifdef LINUX +#include +#include +#endif +#include + +//-------------------------------------------------------------------------------------------------------- +/** + * Returns the token parsed by SharedParse() + */ +char *SharedGetToken( void ); + +//-------------------------------------------------------------------------------------------------------- +/** + * Sets the character used to delimit quoted strings. Default is '\"'. Be sure to set it back when done. + */ +void SharedSetQuoteChar( char c ); + +//-------------------------------------------------------------------------------------------------------- +/** + * Parse a token out of a string + */ +const char *SharedParse( const char *data ); + +//-------------------------------------------------------------------------------------------------------- +/** + * Returns true if additional data is waiting to be processed on this line + */ +bool SharedTokenWaiting( const char *buffer ); + +//-------------------------------------------------------------------------------------------------------- +/** + * Simple utility function to allocate memory and duplicate a string + */ +inline char *CloneString( const char *str ) +{ + if ( !str ) + { + char *cloneStr = new char[1]; + cloneStr[0] = '\0'; + return cloneStr; + } + char *cloneStr = new char [ strlen(str)+1 ]; + strcpy( cloneStr, str ); + return cloneStr; +} + +//-------------------------------------------------------------------------------------------------------- +/** + * Simple utility function to allocate memory and duplicate a wide string + */ +inline wchar_t *CloneWString( const wchar_t *str ) +{ + if ( !str ) + { + wchar_t *cloneStr = new wchar_t[1]; + cloneStr[0] = L'\0'; + return cloneStr; + } + wchar_t *cloneStr = new wchar_t [ wcslen(str)+1 ]; + wcscpy( cloneStr, str ); + return cloneStr; +} + +//-------------------------------------------------------------------------------------------------------------- +/** + * snprintf-alike that allows multiple prints into a buffer + */ +char * BufPrintf(char *buf, int& len, const char *fmt, ...); + +//-------------------------------------------------------------------------------------------------------------- +/** + * wide char version of BufPrintf + */ +wchar_t * BufWPrintf(wchar_t *buf, int& len, const wchar_t *fmt, ...); + +//-------------------------------------------------------------------------------------------------------------- +/** + * convenience function that prints an int into a static wchar_t* + */ +const wchar_t * NumAsWString( int val ); + +//-------------------------------------------------------------------------------------------------------------- +/** + * convenience function that prints an int into a static char* + */ +const char * NumAsString( int val ); + +//-------------------------------------------------------------------------------------------------------------- +/** + * convenience function that composes a string into a static char* + */ +char * SharedVarArgs(char *format, ...); + +//-------------------------------------------------------------------------------------------------------------- +/** + * convenience function that composes a string into a static wchar_t* (Win32-only) + */ +wchar_t * SharedWVarArgs(wchar_t *format, ...); + +//-------------------------------------------------------------------------------------------------------------- +/** + * Wrapper for vgui::localize()->Find() that doesn't return NULL (client-only) + */ +#ifdef CLIENT_DLL +wchar_t* SharedFindString( char *asciiIdentifier ); +#endif + +#endif // SHARED_UTIL_H diff --git a/game_shared/simple_checksum.h b/game_shared/simple_checksum.h new file mode 100644 index 0000000..b73ccab --- /dev/null +++ b/game_shared/simple_checksum.h @@ -0,0 +1,25 @@ +// simple_checksum.h +// Functions to compute a simple checksum value for a file +// Author: Michael S. Booth, Turtle Rock Studios (www.turtlerockstudios.com), September 2003 + +#ifndef _SIMPLE_CHECKSUM_H_ +#define _SIMPLE_CHECKSUM_H_ + +/** + * Compute a simple checksum for the given data. + * Each byte in the data is multiplied by its position to track re-ordering changes + */ +inline unsigned int ComputeSimpleChecksum( const unsigned char *dataPointer, int dataLength ) +{ + unsigned int checksum = 0; + + for( int i=1; i<=dataLength; ++i ) + { + checksum += (*dataPointer) * i; + ++dataPointer; + } + + return checksum; +} + +#endif // _SIMPLE_CHECKSUM_H_ diff --git a/game_shared/steam_util.h b/game_shared/steam_util.h new file mode 100644 index 0000000..21cada5 --- /dev/null +++ b/game_shared/steam_util.h @@ -0,0 +1,58 @@ +// steam_util.h +// Steam utility classes +// Author: Michael S. Booth (mike@turtlerockstudios.com), April 2003 + +#ifndef _STEAM_UTIL_H_ +#define _STEAM_UTIL_H_ + +//-------------------------------------------------------------------------------------------------------------- +/** + * Used to load a file via Steam + */ +class SteamFile +{ +public: + SteamFile( const char *filename ); + ~SteamFile(); + + bool IsValid( void ) const { return (m_fileData) ? true : false; } ///< returns true if this file object is attached to a file + bool Read( void *data, int length ); ///< read 'length' bytes from the file + +private: + byte *m_fileData; ///< the file read into memory + int m_fileDataLength; ///< the length of the file + + byte *m_cursor; ///< where we are in the file + int m_bytesLeft; ///< the number of bytes left in the file +}; + +inline SteamFile::SteamFile( const char *filename ) +{ + m_fileData = (byte *)LOAD_FILE_FOR_ME( const_cast( filename ), &m_fileDataLength ); + m_cursor = m_fileData; + m_bytesLeft = m_fileDataLength; +} + +inline SteamFile::~SteamFile() +{ + if (m_fileData) + FREE_FILE( m_fileData ); +} + +inline bool SteamFile::Read( void *data, int length ) +{ + if (length > m_bytesLeft || m_cursor == NULL || m_bytesLeft <= 0) + return false; + + byte *readCursor = static_cast( data ); + + for( int i=0; igetBounds(x,y,w,h); return y;} diff --git a/game_shared/vgui_listbox.h b/game_shared/vgui_listbox.h index a48acef..641465f 100644 --- a/game_shared/vgui_listbox.h +++ b/game_shared/vgui_listbox.h @@ -15,8 +15,8 @@ #include "VGUI_Panel.h" #include "VGUI_IntChangeSignal.h" -#include "VGUI_Slider2.h" -#include "VGUI_ScrollBar2.h" +#include "vgui_slider2.h" +#include "vgui_scrollbar2.h" namespace vgui diff --git a/game_shared/vgui_loadtga.cpp b/game_shared/vgui_loadtga.cpp index d7e1f5e..ae6ec0b 100644 --- a/game_shared/vgui_loadtga.cpp +++ b/game_shared/vgui_loadtga.cpp @@ -7,9 +7,9 @@ #include "../cl_dll/wrect.h" #include "../cl_dll/cl_dll.h" -#include "vgui.h" +#include "VGUI.h" #include "vgui_loadtga.h" -#include "vgui_inputstream.h" +#include "VGUI_InputStream.h" // ---------------------------------------------------------------------- // diff --git a/game_shared/vgui_loadtga.h b/game_shared/vgui_loadtga.h index 8930e4e..fe4ec12 100644 --- a/game_shared/vgui_loadtga.h +++ b/game_shared/vgui_loadtga.h @@ -12,7 +12,7 @@ #endif -#include "vgui_bitmaptga.h" +#include "VGUI_BitmapTGA.h" vgui::BitmapTGA* vgui_LoadTGA(char const *pFilename); diff --git a/game_shared/vgui_scrollbar2.cpp b/game_shared/vgui_scrollbar2.cpp index 7b240e6..e41f8b7 100644 --- a/game_shared/vgui_scrollbar2.cpp +++ b/game_shared/vgui_scrollbar2.cpp @@ -6,8 +6,8 @@ //============================================================================= -#include "VGUI_ScrollBar2.h" -#include "VGUI_Slider2.h" +#include "vgui_scrollbar2.h" +#include "vgui_slider2.h" #include "vgui_loadtga.h" #include diff --git a/game_shared/vgui_slider2.cpp b/game_shared/vgui_slider2.cpp index 7a220b5..12128c1 100644 --- a/game_shared/vgui_slider2.cpp +++ b/game_shared/vgui_slider2.cpp @@ -5,7 +5,7 @@ // $NoKeywords: $ //============================================================================= -#include "VGUI_Slider2.h" +#include "vgui_slider2.h" #include #include @@ -433,4 +433,4 @@ void Slider2::setRangeWindowEnabled(bool state) void Slider2::setButtonOffset(int buttonOffset) { _buttonOffset=buttonOffset; -} \ No newline at end of file +} diff --git a/game_shared/voice_gamemgr.cpp b/game_shared/voice_gamemgr.cpp index 5ba2edf..b1ec2c6 100644 --- a/game_shared/voice_gamemgr.cpp +++ b/game_shared/voice_gamemgr.cpp @@ -1,10 +1,11 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: // // $NoKeywords: $ //============================================================================= +#include "archtypes.h" // DAL #include "voice_gamemgr.h" #include #include @@ -35,7 +36,7 @@ cvar_t voice_serverdebug = {"voice_serverdebug", "0"}; // Set game rules to allow all clients to talk to each other. // Muted players still can't talk to each other. -cvar_t sv_alltalk = {"sv_alltalk", "0"}; +cvar_t sv_alltalk = {"sv_alltalk", "0", FCVAR_SERVER}; // ------------------------------------------------------------------------ // // Static helpers. @@ -178,7 +179,7 @@ bool CVoiceGameMgr::ClientCommand(CBasePlayer *pPlayer, const char *cmd) { for(int i=1; i < CMD_ARGC(); i++) { - unsigned long mask = 0; + uint32 mask = 0; sscanf(CMD_ARGV(i), "%x", &mask); if(i <= VOICE_MAX_PLAYERS_DW) @@ -215,7 +216,7 @@ void CVoiceGameMgr::UpdateMasks() { m_UpdateInterval = 0; - bool bAllTalk = !!g_engfuncs.pfnCVarGetFloat( "sv_alltalk" ); + bool bAllTalk = !!(sv_alltalk.value); for(int iClient=0; iClient < m_nMaxPlayers; iClient++) { @@ -239,8 +240,7 @@ void CVoiceGameMgr::UpdateMasks() for(int iOtherClient=0; iOtherClient < m_nMaxPlayers; iOtherClient++) { CBaseEntity *pEnt = UTIL_PlayerByIndex(iOtherClient+1); - if(pEnt && pEnt->IsPlayer() && - (bAllTalk || m_pHelper->CanPlayerHearPlayer(pPlayer, (CBasePlayer*)pEnt)) ) + if(pEnt && (bAllTalk || m_pHelper->CanPlayerHearPlayer(pPlayer, (CBasePlayer*)pEnt)) ) { gameRulesMask[iOtherClient] = true; } diff --git a/game_shared/voice_gamemgr.h b/game_shared/voice_gamemgr.h index 9605c5c..23b0efe 100644 --- a/game_shared/voice_gamemgr.h +++ b/game_shared/voice_gamemgr.h @@ -7,7 +7,10 @@ #ifndef VOICE_GAMEMGR_H #define VOICE_GAMEMGR_H + +#ifdef _WIN32 #pragma once +#endif #include "voice_common.h" diff --git a/game_shared/voice_status.cpp b/game_shared/voice_status.cpp index e5378d0..3d44a55 100644 --- a/game_shared/voice_status.cpp +++ b/game_shared/voice_status.cpp @@ -1,85 +1,34 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= -// There are hud.h's coming out of the woodwork so this ensures that we get the right one. -#if defined( DMC_BUILD ) - #include "../dmc/cl_dll/hud.h" - #include "../dmc/cl_dll/cl_util.h" -#elif defined( RICOCHET_BUILD ) - #include "../ricochet/cl_dll/hud.h" - #include "../ricochet/cl_dll/cl_util.h" -#else - #include "../cl_dll/hud.h" - #include "../cl_dll/cl_util.h" -#endif - -#include -#include #include +#include -#if defined( DMC_BUILD ) - #include "../dmc/cl_dll/parsemsg.h" - #include "../dmc/cl_dll/hud_servers.h" - #include "../dmc/cl_dll/demo.h" -#elif defined( RICOCHET_BUILD ) - #include "../ricochet/cl_dll/parsemsg.h" - #include "../ricochet/cl_dll/hud_servers.h" - #include "../ricochet/cl_dll/demo.h" -#else - #include "../cl_dll/parsemsg.h" - #include "../cl_dll/hud_servers.h" - #include "../cl_dll/demo.h" -#endif +#include "wrect.h" +#include "cl_dll.h" +#include "cl_util.h" +#include "cl_entity.h" +#include "const.h" + +#include "parsemsg.h" // BEGIN_READ(), ... -#include "demo_api.h" #include "voice_status.h" -#include "r_efx.h" -#include "entity_types.h" -#include "VGUI_ActionSignal.h" -#include "VGUI_Scheme.h" -#include "VGUI_TextImage.h" -#include "vgui_loadtga.h" -#include "vgui_helpers.h" -#include "vgui_mousecode.h" - - - -using namespace vgui; - - -extern int cam_thirdperson; - - -#define VOICE_MODEL_INTERVAL 0.3 -#define SCOREBOARD_BLINK_FREQUENCY 0.3 // How often to blink the scoreboard icons. -#define SQUELCHOSCILLATE_PER_SECOND 2.0f - - -extern BitmapTGA *LoadTGA( const char* pImageName ); + +#pragma warning( disable : 4800 ) // disable forcing int to bool performance warning +static CVoiceStatus *g_pInternalVoiceStatus = NULL; // ---------------------------------------------------------------------- // // The voice manager for the client. // ---------------------------------------------------------------------- // CVoiceStatus g_VoiceStatus; -CVoiceStatus* GetClientVoiceMgr() +CVoiceStatus* GetClientVoice() { return &g_VoiceStatus; } -// ---------------------------------------------------------------------- // -// CVoiceStatus. -// ---------------------------------------------------------------------- // - -static CVoiceStatus *g_pInternalVoiceStatus = NULL; int __MsgFunc_VoiceMask(const char *pszName, int iSize, void *pbuf) { @@ -98,6 +47,8 @@ int __MsgFunc_ReqState(const char *pszName, int iSize, void *pbuf) } + + int g_BannedPlayerPrintCount; void ForEachBannedPlayer(char id[16]) { @@ -109,7 +60,9 @@ void ForEachBannedPlayer(char id[16]) id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15] ); +#ifdef _WIN32 strupr(str); +#endif gEngfuncs.pfnConsolePrint(str); } @@ -120,36 +73,26 @@ void ShowBannedCallback() { g_BannedPlayerPrintCount = 0; gEngfuncs.pfnConsolePrint("------- BANNED PLAYERS -------\n"); - g_pInternalVoiceStatus->m_BanMgr.ForEachBannedPlayer(ForEachBannedPlayer); + g_pInternalVoiceStatus->GetBanMgr()->ForEachBannedPlayer(ForEachBannedPlayer); gEngfuncs.pfnConsolePrint("------------------------------\n"); } } -// ---------------------------------------------------------------------- // -// CVoiceStatus. -// ---------------------------------------------------------------------- // + + + + + + CVoiceStatus::CVoiceStatus() { m_bBanMgrInitialized = false; m_LastUpdateServerState = 0; - m_pSpeakerLabelIcon = NULL; - m_pScoreboardNeverSpoken = NULL; - m_pScoreboardNotSpeaking = NULL; - m_pScoreboardSpeaking = NULL; - m_pScoreboardSpeaking2 = NULL; - m_pScoreboardSquelch = NULL; - m_pScoreboardBanned = NULL; - - m_pLocalBitmap = NULL; - m_pAckBitmap = NULL; - m_bTalking = m_bServerAcked = false; - memset(m_pBanButtons, 0, sizeof(m_pBanButtons)); - m_bServerModEnable = -1; m_pchGameDir = NULL; @@ -158,24 +101,8 @@ CVoiceStatus::CVoiceStatus() CVoiceStatus::~CVoiceStatus() { + g_pInternalVoiceStatus = NULL; - - for(int i=0; i < MAX_VOICE_SPEAKERS; i++) - { - delete m_Labels[i].m_pLabel; - m_Labels[i].m_pLabel = NULL; - - delete m_Labels[i].m_pIcon; - m_Labels[i].m_pIcon = NULL; - - delete m_Labels[i].m_pBackground; - m_Labels[i].m_pBackground = NULL; - } - - delete m_pLocalLabel; - m_pLocalLabel = NULL; - - FreeBitmaps(); if(m_pchGameDir) { @@ -186,12 +113,12 @@ CVoiceStatus::~CVoiceStatus() free(m_pchGameDir); } + } -int CVoiceStatus::Init( - IVoiceStatusHelper *pHelper, - Panel **pParentPanel) + +void CVoiceStatus::Init( IVoiceStatusHelper *pHelper) { // Setup the voice_modenable cvar. gEngfuncs.pfnRegisterVariable("voice_modenable", "1", FCVAR_ARCHIVE); @@ -200,120 +127,36 @@ int CVoiceStatus::Init( gEngfuncs.pfnAddCommand("voice_showbanned", ShowBannedCallback); - if(gEngfuncs.pfnGetGameDirectory()) + // Cache the game directory for use when we shut down + const char *pchGameDirT = gEngfuncs.pfnGetGameDirectory(); + m_pchGameDir = (char *)malloc(strlen(pchGameDirT) + 1); + + if(m_pchGameDir) { - m_BanMgr.Init(gEngfuncs.pfnGetGameDirectory()); + strcpy(m_pchGameDir, pchGameDirT); + } + + if(m_pchGameDir) + { + m_BanMgr.Init(m_pchGameDir); m_bBanMgrInitialized = true; } assert(!g_pInternalVoiceStatus); g_pInternalVoiceStatus = this; - m_BlinkTimer = 0; - m_VoiceHeadModel = NULL; - memset(m_Labels, 0, sizeof(m_Labels)); - - for(int i=0; i < MAX_VOICE_SPEAKERS; i++) - { - CVoiceLabel *pLabel = &m_Labels[i]; - - pLabel->m_pBackground = new Label(""); - - if(pLabel->m_pLabel = new Label("")) - { - pLabel->m_pLabel->setVisible( true ); - pLabel->m_pLabel->setFont( Scheme::sf_primary2 ); - pLabel->m_pLabel->setTextAlignment( Label::a_east ); - pLabel->m_pLabel->setContentAlignment( Label::a_east ); - pLabel->m_pLabel->setParent( pLabel->m_pBackground ); - } - - if( pLabel->m_pIcon = new ImagePanel( NULL ) ) - { - pLabel->m_pIcon->setVisible( true ); - pLabel->m_pIcon->setParent( pLabel->m_pBackground ); - } - - pLabel->m_clientindex = -1; - } - - m_pLocalLabel = new ImagePanel(NULL); - m_bInSquelchMode = false; m_pHelper = pHelper; - m_pParentPanel = pParentPanel; - gHUD.AddHudElem(this); - m_iFlags = HUD_ACTIVE; + HOOK_MESSAGE(VoiceMask); HOOK_MESSAGE(ReqState); - // Cache the game directory for use when we shut down - const char *pchGameDirT = gEngfuncs.pfnGetGameDirectory(); - m_pchGameDir = (char *)malloc(strlen(pchGameDirT) + 1); - strcpy(m_pchGameDir, pchGameDirT); - return 1; -} - - -int CVoiceStatus::VidInit() -{ - FreeBitmaps(); - - - if( m_pLocalBitmap = vgui_LoadTGA("gfx/vgui/icntlk_pl.tga") ) - { - m_pLocalBitmap->setColor(Color(255,255,255,135)); - } - - if( m_pAckBitmap = vgui_LoadTGA("gfx/vgui/icntlk_sv.tga") ) - { - m_pAckBitmap->setColor(Color(255,255,255,135)); // Give just a tiny bit of translucency so software draws correctly. - } - - m_pLocalLabel->setImage( m_pLocalBitmap ); - m_pLocalLabel->setVisible( false ); - - - if( m_pSpeakerLabelIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/speaker4.tga" ) ) - m_pSpeakerLabelIcon->setColor( Color(255,255,255,1) ); // Give just a tiny bit of translucency so software draws correctly. - - if (m_pScoreboardNeverSpoken = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker1.tga")) - m_pScoreboardNeverSpoken->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. - - if(m_pScoreboardNotSpeaking = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker2.tga")) - m_pScoreboardNotSpeaking->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. + GetClientVoiceHud()->Init(pHelper,this); - if(m_pScoreboardSpeaking = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker3.tga")) - m_pScoreboardSpeaking->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. - - if(m_pScoreboardSpeaking2 = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_speaker4.tga")) - m_pScoreboardSpeaking2->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. - - if(m_pScoreboardSquelch = vgui_LoadTGA("gfx/vgui/icntlk_squelch.tga")) - m_pScoreboardSquelch->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. - if(m_pScoreboardBanned = vgui_LoadTGA("gfx/vgui/640_voiceblocked.tga")) - m_pScoreboardBanned->setColor(Color(255,255,255,1)); // Give just a tiny bit of translucency so software draws correctly. - // Figure out the voice head model height. - m_VoiceHeadModelHeight = 45; - char *pFile = (char *)gEngfuncs.COM_LoadFile("scripts/voicemodel.txt", 5, NULL); - if(pFile) - { - char token[4096]; - gEngfuncs.COM_ParseFile(pFile, token); - if(token[0] >= '0' && token[0] <= '9') - { - m_VoiceHeadModelHeight = (float)atof(token); - } - - gEngfuncs.COM_FreeFile(pFile); - } - - m_VoiceHeadModel = gEngfuncs.pfnSPR_Load("sprites/voiceicon.spr"); - return TRUE; } @@ -325,166 +168,27 @@ void CVoiceStatus::Frame(double frametime) UpdateServerState(false); } - m_BlinkTimer += frametime; - // Update speaker labels. - if( m_pHelper->CanShowSpeakerLabels() ) - { - for( int i=0; i < MAX_VOICE_SPEAKERS; i++ ) - m_Labels[i].m_pBackground->setVisible( m_Labels[i].m_clientindex != -1 ); - } - else - { - for( int i=0; i < MAX_VOICE_SPEAKERS; i++ ) - m_Labels[i].m_pBackground->setVisible( false ); - } - for(int i=0; i < VOICE_MAX_PLAYERS; i++) - UpdateBanButton(i); } - -void CVoiceStatus::CreateEntities() +void CVoiceStatus::StartSquelchMode() { - if(!m_VoiceHeadModel) + if(m_bInSquelchMode) return; - cl_entity_t *localPlayer = gEngfuncs.GetLocalPlayer(); - - int iOutModel = 0; - for(int i=0; i < VOICE_MAX_PLAYERS; i++) - { - if(!m_VoicePlayers[i]) - continue; - - cl_entity_s *pClient = gEngfuncs.GetEntityByIndex(i+1); - - // Don't show an icon if the player is not in our PVS. - if(!pClient || pClient->curstate.messagenum < localPlayer->curstate.messagenum) - continue; - - // Don't show an icon for dead or spectating players (ie: invisible entities). - if(pClient->curstate.effects & EF_NODRAW) - continue; - - // Don't show an icon for the local player unless we're in thirdperson mode. - if(pClient == localPlayer && !cam_thirdperson) - continue; - - cl_entity_s *pEnt = &m_VoiceHeadModels[iOutModel]; - ++iOutModel; - - memset(pEnt, 0, sizeof(*pEnt)); - - pEnt->curstate.rendermode = kRenderTransAdd; - pEnt->curstate.renderamt = 255; - pEnt->baseline.renderamt = 255; - pEnt->curstate.renderfx = kRenderFxNoDissipation; - pEnt->curstate.framerate = 1; - pEnt->curstate.frame = 0; - pEnt->model = (struct model_s*)gEngfuncs.GetSpritePointer(m_VoiceHeadModel); - pEnt->angles[0] = pEnt->angles[1] = pEnt->angles[2] = 0; - pEnt->curstate.scale = 0.5f; - - pEnt->origin[0] = pEnt->origin[1] = 0; - pEnt->origin[2] = 45; - - VectorAdd(pEnt->origin, pClient->origin, pEnt->origin); - - // Tell the engine. - gEngfuncs.CL_CreateVisibleEntity(ET_NORMAL, pEnt); - } + m_bInSquelchMode = true; } - -void CVoiceStatus::UpdateSpeakerStatus(int entindex, qboolean bTalking) +void CVoiceStatus::StopSquelchMode() { - if(!*m_pParentPanel) - return; - - if( gEngfuncs.pfnGetCvarFloat("voice_clientdebug") ) - { - char msg[256]; - _snprintf( msg, sizeof(msg), "CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\n", entindex, bTalking ); - gEngfuncs.pfnConsolePrint( msg ); - } - - // Is it the local player talking? - if( entindex == -1 ) - { - m_bTalking = !!bTalking; - if( bTalking ) - { - // Enable voice for them automatically if they try to talk. - gEngfuncs.pfnClientCmd( "voice_modenable 1" ); - } - } - else if( entindex == -2 ) - { - m_bServerAcked = !!bTalking; - } - else if(entindex >= 0 && entindex <= VOICE_MAX_PLAYERS) - { - int iClient = entindex - 1; - if(iClient < 0) - return; - - CVoiceLabel *pLabel = FindVoiceLabel(iClient); - if(bTalking) - { - m_VoicePlayers[iClient] = true; - m_VoiceEnabledPlayers[iClient] = true; - - // If we don't have a label for this guy yet, then create one. - if(!pLabel) - { - if(pLabel = GetFreeVoiceLabel()) - { - // Get the name from the engine. - hud_player_info_t info; - memset(&info, 0, sizeof(info)); - GetPlayerInfo(entindex, &info); - - char paddedName[512]; - _snprintf(paddedName, sizeof(paddedName), "%s ", info.name); - - int color[3]; - m_pHelper->GetPlayerTextColor( entindex, color ); - - if( pLabel->m_pBackground ) - { - pLabel->m_pBackground->setBgColor( color[0], color[1], color[2], 135 ); - pLabel->m_pBackground->setParent( *m_pParentPanel ); - pLabel->m_pBackground->setVisible( m_pHelper->CanShowSpeakerLabels() ); - } - - if( pLabel->m_pLabel ) - { - pLabel->m_pLabel->setFgColor( 255, 255, 255, 0 ); - pLabel->m_pLabel->setBgColor( 0, 0, 0, 255 ); - pLabel->m_pLabel->setText( paddedName ); - } - - pLabel->m_clientindex = iClient; - } - } - } - else - { - m_VoicePlayers[iClient] = false; - - // If we have a label for this guy, kill it. - if(pLabel) - { - pLabel->m_pBackground->setVisible(false); - pLabel->m_clientindex = -1; - } - } - } - - RepositionLabels(); + m_bInSquelchMode = false; } +bool CVoiceStatus::IsInSquelchMode() +{ + return m_bInSquelchMode; +} void CVoiceStatus::UpdateServerState(bool bForce) { @@ -521,11 +225,11 @@ void CVoiceStatus::UpdateServerState(bool bForce) sprintf(str, "vban"); bool bChange = false; - for(unsigned long dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++) + for(uint32 dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++) { - unsigned long serverBanMask = 0; - unsigned long banMask = 0; - for(unsigned long i=0; i < 32; i++) + uint32 serverBanMask = 0; + uint32 banMask = 0; + for(uint32 i=0; i < 32; i++) { char playerID[16]; if(!gEngfuncs.GetPlayerUniqueID(i+1, playerID)) @@ -569,68 +273,50 @@ void CVoiceStatus::UpdateServerState(bool bForce) m_LastUpdateServerState = gEngfuncs.GetClientTime(); } -void CVoiceStatus::UpdateSpeakerImage(Label *pLabel, int iPlayer) -{ - m_pBanButtons[iPlayer-1] = pLabel; - UpdateBanButton(iPlayer-1); -} -void CVoiceStatus::UpdateBanButton(int iClient) -{ - Label *pPanel = m_pBanButtons[iClient]; - if (!pPanel) - return; +int CVoiceStatus::GetSpeakerStatus(int iPlayer) +{ + bool bTalking = static_cast(m_VoicePlayers[iPlayer]); + char playerID[16]; - extern bool HACK_GetPlayerUniqueID( int iPlayer, char playerID[16] ); - if(!HACK_GetPlayerUniqueID(iClient+1, playerID)) - return; + qboolean id = gEngfuncs.GetPlayerUniqueID( iPlayer+1, playerID ); + if(!id) + return VOICE_NEVERSPOKEN; + + bool bBanned = m_BanMgr.GetPlayerBan( playerID ); + bool bNeverSpoken = !m_VoiceEnabledPlayers[iPlayer]; - // Figure out if it's blinking or not. - bool bBlink = fmod(m_BlinkTimer, SCOREBOARD_BLINK_FREQUENCY*2) < SCOREBOARD_BLINK_FREQUENCY; - bool bTalking = !!m_VoicePlayers[iClient]; - bool bBanned = m_BanMgr.GetPlayerBan(playerID); - bool bNeverSpoken = !m_VoiceEnabledPlayers[iClient]; - // Get the appropriate image to display on the panel. - if (bBanned) + if(bBanned) { - pPanel->setImage(m_pScoreboardBanned); + return VOICE_BANNED; } - else if (bTalking) + else if(bNeverSpoken) { - if (bBlink) - { - pPanel->setImage(m_pScoreboardSpeaking2); - } - else - { - pPanel->setImage(m_pScoreboardSpeaking); - } - pPanel->setFgColor(255, 170, 0, 1); + return VOICE_NEVERSPOKEN; } - else if (bNeverSpoken) + else if(bTalking) { - pPanel->setImage(m_pScoreboardNeverSpoken); - pPanel->setFgColor(100, 100, 100, 1); + return VOICE_TALKING; } else - { - pPanel->setImage(m_pScoreboardNotSpeaking); - } + return VOICE_NOTTALKING; + } + void CVoiceStatus::HandleVoiceMaskMsg(int iSize, void *pbuf) { BEGIN_READ( pbuf, iSize ); - unsigned long dw; + uint32 dw; for(dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++) { - m_AudiblePlayers.SetDWord(dw, (unsigned long)READ_LONG()); - m_ServerBannedPlayers.SetDWord(dw, (unsigned long)READ_LONG()); + m_AudiblePlayers.SetDWord(dw, (uint32)READ_LONG()); + m_ServerBannedPlayers.SetDWord(dw, (uint32)READ_LONG()); if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) { @@ -658,164 +344,70 @@ void CVoiceStatus::HandleReqStateMsg(int iSize, void *pbuf) UpdateServerState(true); } -void CVoiceStatus::StartSquelchMode() + +void CVoiceStatus::UpdateSpeakerStatus(int entindex, bool bTalking) { - if(m_bInSquelchMode) - return; - - m_bInSquelchMode = true; - m_pHelper->UpdateCursorState(); -} - -void CVoiceStatus::StopSquelchMode() -{ - m_bInSquelchMode = false; - m_pHelper->UpdateCursorState(); -} - -bool CVoiceStatus::IsInSquelchMode() -{ - return m_bInSquelchMode; -} - -CVoiceLabel* CVoiceStatus::FindVoiceLabel(int clientindex) -{ - for(int i=0; i < MAX_VOICE_SPEAKERS; i++) - { - if(m_Labels[i].m_clientindex == clientindex) - return &m_Labels[i]; - } - - return NULL; -} - - -CVoiceLabel* CVoiceStatus::GetFreeVoiceLabel() -{ - return FindVoiceLabel(-1); -} - - -void CVoiceStatus::RepositionLabels() -{ - // find starting position to draw from, along right-hand side of screen - int y = ScreenHeight / 2; - int iconWide = 8, iconTall = 8; - if( m_pSpeakerLabelIcon ) + const char *levelName = gEngfuncs.pfnGetLevelName(); + if (levelName && levelName[0]) { - m_pSpeakerLabelIcon->getSize( iconWide, iconTall ); - } - - // Reposition active labels. - for(int i = 0; i < MAX_VOICE_SPEAKERS; i++) - { - CVoiceLabel *pLabel = &m_Labels[i]; - if( pLabel->m_clientindex == -1 || !pLabel->m_pLabel ) + if( gEngfuncs.pfnGetCvarFloat("voice_clientdebug") ) { - if( pLabel->m_pBackground ) - pLabel->m_pBackground->setVisible( false ); - - continue; + char msg[256]; + _snprintf( msg, sizeof(msg), "CVoiceStatus::UpdateSpeakerStatus: ent %d talking = %d\n", entindex, bTalking ); + gEngfuncs.pfnConsolePrint( msg ); } - int textWide, textTall; - pLabel->m_pLabel->getContentSize( textWide, textTall ); - - // Don't let it stretch too far across their screen. - if( textWide > (ScreenWidth*2)/3 ) - textWide = (ScreenWidth*2)/3; - - // Setup the background label to fit everything in. - int border = 2; - int bgWide = textWide + iconWide + border*3; - int bgTall = max( textTall, iconTall ) + border*2; - pLabel->m_pBackground->setBounds( ScreenWidth - bgWide - 8, y, bgWide, bgTall ); - - // Put the text at the left. - pLabel->m_pLabel->setBounds( border, (bgTall - textTall) / 2, textWide, textTall ); - - // Put the icon at the right. - int iconLeft = border + textWide + border; - int iconTop = (bgTall - iconTall) / 2; - if( pLabel->m_pIcon ) + // Is it the local player talking? + if( entindex == -1 ) { - pLabel->m_pIcon->setImage( m_pSpeakerLabelIcon ); - pLabel->m_pIcon->setBounds( iconLeft, iconTop, iconWide, iconTall ); + m_bTalking = bTalking; + if( bTalking ) + { + // Enable voice for them automatically if they try to talk. + gEngfuncs.pfnClientCmd( "voice_modenable 1" ); + } + if ( !gEngfuncs.GetLocalPlayer() ) + { + return; + } + + int entindex = gEngfuncs.GetLocalPlayer()->index; + GetClientVoiceHud()->UpdateSpeakerStatus(-2,bTalking); + + m_VoicePlayers[entindex-1] = m_bTalking; + m_VoiceEnabledPlayers[entindex-1]= true; } + else if( entindex == -2 ) + { + m_bServerAcked = bTalking; + } + else if(entindex >= 0 && entindex <= VOICE_MAX_PLAYERS) + { + int iClient = entindex - 1; + if(iClient < 0) + return; - y += bgTall + 2; - } - - if( m_pLocalBitmap && m_pAckBitmap && m_pLocalLabel && (m_bTalking || m_bServerAcked) ) - { - m_pLocalLabel->setParent(*m_pParentPanel); - m_pLocalLabel->setVisible( true ); - - if( m_bServerAcked && !!gEngfuncs.pfnGetCvarFloat("voice_clientdebug") ) - m_pLocalLabel->setImage( m_pAckBitmap ); - else - m_pLocalLabel->setImage( m_pLocalBitmap ); - - int sizeX, sizeY; - m_pLocalBitmap->getSize(sizeX, sizeY); - - int local_xPos = ScreenWidth - sizeX - 10; - int local_yPos = m_pHelper->GetAckIconHeight() - sizeY; + GetClientVoiceHud()->UpdateSpeakerStatus(entindex,bTalking); - m_pLocalLabel->setPos( local_xPos, local_yPos ); - } - else - { - m_pLocalLabel->setVisible( false ); - } -} - - -void CVoiceStatus::FreeBitmaps() -{ - // Delete all the images we have loaded. - delete m_pLocalBitmap; - m_pLocalBitmap = NULL; - - delete m_pAckBitmap; - m_pAckBitmap = NULL; - - delete m_pSpeakerLabelIcon; - m_pSpeakerLabelIcon = NULL; - - delete m_pScoreboardNeverSpoken; - m_pScoreboardNeverSpoken = NULL; - - delete m_pScoreboardNotSpeaking; - m_pScoreboardNotSpeaking = NULL; - - delete m_pScoreboardSpeaking; - m_pScoreboardSpeaking = NULL; - - delete m_pScoreboardSpeaking2; - m_pScoreboardSpeaking2 = NULL; - - delete m_pScoreboardSquelch; - m_pScoreboardSquelch = NULL; - - delete m_pScoreboardBanned; - m_pScoreboardBanned = NULL; - - // Clear references to the images in panels. - for(int i=0; i < VOICE_MAX_PLAYERS; i++) - { - if (m_pBanButtons[i]) - { - m_pBanButtons[i]->setImage(NULL); + if(bTalking) + { + m_VoicePlayers[iClient] = true; + m_VoiceEnabledPlayers[iClient] = true; + } + else + { + m_VoicePlayers[iClient] = false; + } } - } - if(m_pLocalLabel) - m_pLocalLabel->setImage(NULL); + GetClientVoiceHud()->RepositionLabels(); + } } + + //----------------------------------------------------------------------------- // Purpose: returns true if the target client has been banned // Input : playerID - @@ -872,3 +464,4 @@ void CVoiceStatus::SetPlayerBlockedState(int iPlayer, bool blocked) m_BanMgr.SetPlayerBan( playerID, blocked ); UpdateServerState(false); } + diff --git a/game_shared/voice_status.h b/game_shared/voice_status.h index 7825083..c14318e 100644 --- a/game_shared/voice_status.h +++ b/game_shared/voice_status.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -9,32 +9,10 @@ #define VOICE_STATUS_H #pragma once - -#include "VGUI_Label.h" -#include "VGUI_LineBorder.h" -#include "VGUI_ImagePanel.h" -#include "VGUI_BitmapTGA.h" -#include "VGUI_InputSignal.h" -#include "VGUI_Button.h" #include "voice_common.h" -#include "cl_entity.h" #include "voice_banmgr.h" -#include "vgui_checkbutton2.h" -#include "vgui_defaultinputsignal.h" -class CVoiceStatus; - - -class CVoiceLabel -{ -public: - vgui::Label *m_pLabel; - vgui::Label *m_pBackground; - vgui::ImagePanel *m_pIcon; // Voice icon next to player name. - int m_clientindex; // Client index of the speaker. -1 if this label isn't being used. -}; - // This is provided by each mod to access data that may not be the same across mods. class IVoiceStatusHelper @@ -45,81 +23,83 @@ public: // Get RGB color for voice status text about this player. virtual void GetPlayerTextColor(int entindex, int color[3]) = 0; - // Force it to update the cursor state. - virtual void UpdateCursorState() = 0; - // Return the height above the bottom that the voice ack icons should be drawn at. virtual int GetAckIconHeight() = 0; // Return true if the voice manager is allowed to show speaker labels // (mods usually return false when the scoreboard is up). virtual bool CanShowSpeakerLabels() = 0; -}; -//----------------------------------------------------------------------------- -// Purpose: Holds a color for the shared image -//----------------------------------------------------------------------------- -class VoiceImagePanel : public vgui::ImagePanel -{ - virtual void paintBackground() - { - if (_image!=null) - { - vgui::Color col; - getFgColor(col); - _image->setColor(col); - _image->doPaint(this); - } - } + // return a pre-translated string for the player's location. Defaults to empty string for games without locations + virtual const char * GetPlayerLocation(int entindex) { return ""; } }; -class CVoiceStatus : public CHudBase, public vgui::CDefaultInputSignal +class IVoiceStatus { public: - CVoiceStatus(); - virtual ~CVoiceStatus(); -// CHudBase overrides. + // returns the state of this player using the enum above + virtual int GetSpeakerStatus(int iPlayer) = 0; + virtual bool IsTalking() = 0; + virtual bool ServerAcked() = 0; + +}; + + + +class IVoiceHud +{ public: - - // Initialize the cl_dll's voice manager. - virtual int Init( - IVoiceStatusHelper *m_pHelper, - vgui::Panel **pParentPanel); + + virtual int Init(IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus)=0; // ackPosition is the bottom position of where CVoiceStatus will draw the voice acknowledgement labels. - virtual int VidInit(); + virtual int VidInit() = 0; + // Call from the HUD_CreateEntities function so it can add sprites above player heads. + virtual void CreateEntities() = 0; + + // Sets a player's location (can be a #-prefixed string for localization). + virtual void UpdateLocation(int entindex, const char *location) = 0; + + virtual void UpdateSpeakerStatus(int entindex, bool bTalking) = 0; + + virtual void RepositionLabels() = 0; + +}; + + +class CVoiceStatus: public IVoiceStatusHelper, public IVoiceStatus +{ public: - - // Call from HUD_Frame each frame. - void Frame(double frametime); + + CVoiceStatus(); + ~CVoiceStatus(); + + void Init(IVoiceStatusHelper *pHelper); // Called when a player starts or stops talking. // entindex is -1 to represent the local client talking (before the data comes back from the server). // When the server acknowledges that the local client is talking, then entindex will be gEngfuncs.GetLocalPlayer(). // entindex is -2 to represent the local client's voice being acked by the server. - void UpdateSpeakerStatus(int entindex, qboolean bTalking); + void UpdateSpeakerStatus(int entindex, bool bTalking); - // sets the correct image in the label for the player - void UpdateSpeakerImage(vgui::Label *pLabel, int iPlayer); + // returns the state of this player using the enum above + int GetSpeakerStatus(int iPlayer); - // Call from the HUD_CreateEntities function so it can add sprites above player heads. - void CreateEntities(); - // Called when the server registers a change to who this client can hear. + // Called when the server registers a change to who this client can hear. void HandleVoiceMaskMsg(int iSize, void *pbuf); // The server sends this message initially to tell the client to send their state. void HandleReqStateMsg(int iSize, void *pbuf); -// Squelch mode functions. -public: + void Frame(double frametime); - // When you enter squelch mode, pass in + // When you enter squelch mode, pass in void StartSquelchMode(); void StopSquelchMode(); bool IsInSquelchMode(); @@ -134,31 +114,50 @@ public: // blocks the target client from being heard void SetPlayerBlockedState(int iPlayerIndex, bool blocked); -public: - - CVoiceLabel* FindVoiceLabel(int clientindex); // Find a CVoiceLabel representing the specified speaker. - // Returns NULL if none. - // entindex can be -1 if you want a currently-unused voice label. - CVoiceLabel* GetFreeVoiceLabel(); // Get an unused voice label. Returns NULL if none. - - void RepositionLabels(); - - void FreeBitmaps(); - void UpdateServerState(bool bForce); - // Update the button artwork to reflect the client's current state. - void UpdateBanButton(int iClient); + virtual bool CanShowSpeakerLabels() + { + return m_pHelper->CanShowSpeakerLabels(); + } + + virtual void GetPlayerTextColor(int entindex, int color[3]) + { + m_pHelper->GetPlayerTextColor(entindex,color); + } + + virtual int GetAckIconHeight() + { + return m_pHelper->GetAckIconHeight(); + } + + bool IsTalking() + { + return m_bTalking; + } + + bool ServerAcked() + { + return m_bServerAcked; + } + + CVoiceBanMgr *GetBanMgr() { return &m_BanMgr; } -public: - enum {MAX_VOICE_SPEAKERS=7}; + enum + { + VOICE_TALKING=1, // start from one because ImageList's don't use pos 0 + VOICE_BANNED, + VOICE_NEVERSPOKEN, + VOICE_NOTTALKING, + }; // various voice states + +private: float m_LastUpdateServerState; // Last time we called this function. int m_bServerModEnable; // What we've sent to the server about our "voice_modenable" cvar. - vgui::Panel **m_pParentPanel; CPlayerBitVec m_VoicePlayers; // Who is currently talking. Indexed by client index. // This is the gamerules-defined list of players that you can hear. It is based on what teams people are on @@ -172,57 +171,35 @@ public: // It is checked periodically, and the server is told to squelch or unsquelch the appropriate players. CPlayerBitVec m_ServerBannedPlayers; - cl_entity_s m_VoiceHeadModels[VOICE_MAX_PLAYERS]; // These aren't necessarily in the order of players. They are just - // a place for it to put data in during CreateEntities. - + IVoiceStatusHelper *m_pHelper; // Each mod provides an implementation of this. - - // Scoreboard icons. - double m_BlinkTimer; // Blink scoreboard icons.. - vgui::BitmapTGA *m_pScoreboardNeverSpoken; - vgui::BitmapTGA *m_pScoreboardNotSpeaking; - vgui::BitmapTGA *m_pScoreboardSpeaking; - vgui::BitmapTGA *m_pScoreboardSpeaking2; - vgui::BitmapTGA *m_pScoreboardSquelch; - vgui::BitmapTGA *m_pScoreboardBanned; - - vgui::Label *m_pBanButtons[VOICE_MAX_PLAYERS]; // scoreboard buttons. - // Squelch mode stuff. bool m_bInSquelchMode; + - HSPRITE m_VoiceHeadModel; // Voice head model (goes above players who are speaking). - float m_VoiceHeadModelHeight; // Height above their head to place the model. - - vgui::Image *m_pSpeakerLabelIcon; // Icon next to speaker labels. - - // Lower-right icons telling when the local player is talking.. - vgui::BitmapTGA *m_pLocalBitmap; // Represents the local client talking. - vgui::BitmapTGA *m_pAckBitmap; // Represents the server ack'ing the client talking. - vgui::ImagePanel *m_pLocalLabel; // Represents the local client talking. - bool m_bTalking; // Set to true when the client thinks it's talking. bool m_bServerAcked; // Set to true when the server knows the client is talking. -public: - - CVoiceBanMgr m_BanMgr; // Tracks which users we have squelched and don't want to hear. -public: + CVoiceBanMgr m_BanMgr; // Tracks which users we have squelched and don't want to hear. bool m_bBanMgrInitialized; - // Labels telling who is speaking. - CVoiceLabel m_Labels[MAX_VOICE_SPEAKERS]; - - // Cache the game directory for use when we shut down + // Cache the game directory for use when we shut down char * m_pchGameDir; + + + }; +CVoiceStatus* GetClientVoice(); // Get the (global) voice manager. -CVoiceStatus* GetClientVoiceMgr(); +IVoiceHud* GetClientVoiceHud(); -#endif // VOICE_STATUS_H + + + +#endif // VOICE_STATUS_H \ No newline at end of file diff --git a/game_shared/voice_status_hud.cpp b/game_shared/voice_status_hud.cpp new file mode 100644 index 0000000..f203763 --- /dev/null +++ b/game_shared/voice_status_hud.cpp @@ -0,0 +1,412 @@ +//========= Copyright 1996-2001, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// There are hud.h's coming out of the woodwork so this ensures that we get the right one. +#if defined(THREEWAVE) || defined(DMC_BUILD) + #include "../dmc/cl_dll/hud.h" +#elif defined(CZERO) + #include "../czero/cl_dll/hud.h" +#elif defined(CSTRIKE) + #include "../cstrike/cl_dll/hud.h" +#elif defined(DOD) + #include "../dod/cl_dll/hud.h" +#elif defined(BLUESHIFT) + #include "../blueshift/cl_dll/hud.h" +#else + #include "../cl_dll/hud.h" +#endif + +#include "cl_util.h" +#include +#include +#include +#include "parsemsg.h" +#include "demo.h" +#include "demo_api.h" +#include "r_efx.h" +#include "entity_types.h" +#include "shared_util.h" + +#include "voice_status.h" +#include "voice_status_hud.h" + +using namespace vgui; + +#include +#include + +#include + +extern int cam_thirdperson; + + +#define VOICE_MODEL_INTERVAL 0.3 +//#define SCOREBOARD_BLINK_FREQUENCY 0.3 // How often to blink the scoreboard icons. +#define SQUELCHOSCILLATE_PER_SECOND 2.0f + + + +// ---------------------------------------------------------------------- // +// The voice manager for the client. +// ---------------------------------------------------------------------- // +CVoiceStatusHud g_VoiceStatusHud; + +IVoiceHud* GetClientVoiceHud() +{ + return &g_VoiceStatusHud; +} + + + +// ---------------------------------------------------------------------- // +// CVoiceLabel. +// ---------------------------------------------------------------------- // +void CVoiceLabel::SetLocation( const char *location ) +{ + if ( !location || !*location ) + { + if ( m_locationString ) + { + delete[] m_locationString; + m_locationString = NULL; + RebuildLabelText(); + } + return; + } + + const wchar_t *newLocation = vgui::localize()->Find( location ); + if ( newLocation ) + { + // localized version + if ( m_locationString && wcscmp( newLocation, m_locationString ) ) + { + delete[] m_locationString; + m_locationString = NULL; + } + + if ( !m_locationString ) + { + m_locationString = CloneWString( newLocation ); + RebuildLabelText(); + } + } + else + { + // just convert the ANSI version to Unicode + wchar_t *tmpBuf = new wchar_t[ strlen(location) + 1 ]; + localize()->ConvertANSIToUnicode( location, tmpBuf, sizeof(tmpBuf) ); + + if ( m_locationString && wcscmp( tmpBuf, m_locationString ) ) + { + delete[] m_locationString; + m_locationString = NULL; + } + + if ( !m_locationString ) + { + m_locationString = CloneWString( tmpBuf ); + RebuildLabelText(); + } + + delete[] tmpBuf; + } +} + +void CVoiceLabel::SetPlayerName( const char *name ) +{ + if ( m_playerName ) + { + delete[] m_playerName; + m_playerName = NULL; + } + + if ( name ) + { + m_playerName = CloneString( name ); + } + + RebuildLabelText(); +} + +void CVoiceLabel::RebuildLabelText() +{ + const int BufLen = 512; + wchar_t buf[BufLen] = L""; + if ( m_playerName ) + { + wchar_t wsPlayer[BufLen] = L""; + + localize()->ConvertANSIToUnicode(m_playerName, wsPlayer, sizeof(wsPlayer)); + + const wchar_t *formatStr = L"%ls "; + if ( m_locationString ) + { + formatStr = localize()->Find( "#Voice_Location" ); + if ( !formatStr ) + formatStr = L"%ls/%ls "; + } + _snwprintf( buf, BufLen, formatStr, wsPlayer, m_locationString ); + } + m_pLabel->SetText( buf ); + //gEngfuncs.Con_DPrintf( "CVoiceLabel::RebuildLabelText() - [%ls]\n", buf ); +} + + + +// ---------------------------------------------------------------------- // +// CVoiceStatus. +// ---------------------------------------------------------------------- // + +CVoiceStatusHud::CVoiceStatusHud() +{ +} + + +CVoiceStatusHud::~CVoiceStatusHud() +{ +} + + +int CVoiceStatusHud::Init(IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus) +{ + m_VoiceHeadModel = NULL; + + m_pHelper = pHelper; + m_pStatus = pStatus; + + gHUD.AddHudElem(this); + m_iFlags = HUD_ACTIVE; + + m_pLocalPlayerTalkIcon = new vgui::ImagePanel( NULL, "LocalPlayerIcon"); + m_pLocalPlayerTalkIcon->SetParent( gViewPortInterface->GetViewPortPanel() ); + m_pLocalPlayerTalkIcon->SetVisible( false ); + m_pLocalPlayerTalkIcon->SetImage( scheme()->GetImage("gfx/vgui/icntlk_pl", false) ); + + return 1; +} + + +int CVoiceStatusHud::VidInit() +{ + // Figure out the voice head model height. + m_VoiceHeadModelHeight = 45; + char *pFile = (char *)gEngfuncs.COM_LoadFile("scripts/voicemodel.txt", 5, NULL); + if(pFile) + { + char token[4096]; + gEngfuncs.COM_ParseFile(pFile, token); + if(token[0] >= '0' && token[0] <= '9') + { + m_VoiceHeadModelHeight = (float)atof(token); + } + + gEngfuncs.COM_FreeFile(pFile); + } + + m_VoiceHeadModel = gEngfuncs.pfnSPR_Load("sprites/voiceicon.spr"); + return TRUE; +} + +void CVoiceStatusHud::CreateEntities() +{ + if(!m_VoiceHeadModel) + return; + + cl_entity_t *localPlayer = gEngfuncs.GetLocalPlayer(); + + int iOutModel = 0; + for(int i=0; i < VOICE_MAX_PLAYERS; i++) + { + if(m_pStatus->GetSpeakerStatus(i)!=CVoiceStatus::VOICE_TALKING) + { + continue; + } + + cl_entity_s *pClient = gEngfuncs.GetEntityByIndex(i+1); + + // Don't show an icon if the player is not in our PVS. + if(!pClient || pClient->curstate.messagenum < localPlayer->curstate.messagenum) + continue; + + // Don't show an icon for dead or spectating players (ie: invisible entities). + if(pClient->curstate.effects & EF_NODRAW) + continue; + + // Don't show an icon for the local player unless we're in thirdperson mode. + if(pClient == localPlayer && !cam_thirdperson) + continue; + + cl_entity_s *pEnt = &m_VoiceHeadModels[iOutModel]; + ++iOutModel; + + memset(pEnt, 0, sizeof(*pEnt)); + + pEnt->curstate.rendermode = kRenderTransAdd; + pEnt->curstate.renderamt = 255; + pEnt->baseline.renderamt = 255; + pEnt->curstate.renderfx = kRenderFxNoDissipation; + pEnt->curstate.framerate = 1; + pEnt->curstate.frame = 0; + pEnt->model = (struct model_s*)gEngfuncs.GetSpritePointer(m_VoiceHeadModel); + pEnt->angles[0] = pEnt->angles[1] = pEnt->angles[2] = 0; + pEnt->curstate.scale = 0.5f; + + pEnt->origin[0] = pEnt->origin[1] = 0; + pEnt->origin[2] = 45; + + VectorAdd(pEnt->origin, pClient->origin, pEnt->origin); + + // Tell the engine. + gEngfuncs.CL_CreateVisibleEntity(ET_NORMAL, pEnt); + } +} + + + + +void CVoiceStatusHud::UpdateLocation(int entindex, const char *location) +{ + int iClient = entindex - 1; + if(iClient < 0) + return; + + CVoiceLabel *pLabel = FindVoiceLabel( iClient ); + if ( !pLabel ) + return; + + pLabel->SetLocation( location ); + + RepositionLabels(); +} + +CVoiceLabel* CVoiceStatusHud::FindVoiceLabel(int clientindex) +{ + for(int i=0; i < m_Labels.Count(); i++) + { + if(m_Labels[i]->GetClientIndex() == clientindex) + return m_Labels[i]; + } + + return NULL; +} + + +CVoiceLabel* CVoiceStatusHud::GetFreeVoiceLabel() +{ + CVoiceLabel *lab = FindVoiceLabel(-1); + if( !lab ) + { + lab = new CVoiceLabel(); + m_Labels.AddToTail( lab ); + } + return lab; +} + + +void CVoiceStatusHud::RepositionLabels() +{ + // find starting position to draw from, along right-hand side of screen + int y = ScreenHeight / 2; + + // Reposition active labels. + for(int i = 0; i < m_Labels.Count(); i++) + { + CVoiceLabel *pLabel = m_Labels[i]; + + int textWide, textTall; + pLabel->GetContentSize( textWide, textTall ); + pLabel->SetBounds( ScreenWidth - textWide - 8, y ); // if you adjust the x pos also play with VoiceVGUILabel in voice_status_hud.h + + y += textTall + 2; + } +} + + +void CVoiceStatusHud::UpdateSpeakerStatus(int entindex, bool bTalking) +{ + if( entindex == -2 ) // this is the local player + { + if( bTalking ) + { + int sizeX,sizeY; + IImage *image = m_pLocalPlayerTalkIcon->GetImage(); + if( image ) + { + image->GetContentSize( sizeX, sizeY ); + + int local_xPos = ScreenWidth - sizeX - 10; + int local_yPos = ScreenHeight - m_pHelper->GetAckIconHeight() - sizeY; + m_pLocalPlayerTalkIcon->SetPos( local_xPos, local_yPos ); + m_pLocalPlayerTalkIcon->SetVisible( true ); + } + } + else + { + m_pLocalPlayerTalkIcon->SetVisible( false ); + } + + } + else // a remote player, draw a label for them + { + if(entindex >= 0 && entindex <= MAX_PLAYERS) + { + int iClient = entindex - 1; + if(iClient < 0) + return; + + CVoiceLabel *pLabel = FindVoiceLabel(iClient); + if(bTalking) + { + // If we don't have a label for this guy yet, then create one. + if(!pLabel) + { + if(pLabel = GetFreeVoiceLabel()) + { + // Get the name from the engine. + hud_player_info_t info; + memset(&info, 0, sizeof(info)); + gEngfuncs.pfnGetPlayerInfo(entindex, &info); + + int color[3]; + m_pHelper->GetPlayerTextColor( entindex, color ); + + pLabel->SetFgColor( Color(255, 255, 255, 255) ); + pLabel->SetBgColor( Color(color[0], color[1], color[2], 180) ); + pLabel->SetPlayerName( info.name ); + pLabel->SetLocation( m_pHelper->GetPlayerLocation( entindex ) ); + pLabel->SetClientIndex( iClient ); + if ( m_pHelper ) + { + if ( m_pHelper->CanShowSpeakerLabels() ) + { + pLabel->SetVisible(true); + } + } + else + { + pLabel->SetVisible( true ); + } + + } + } + } + else + { + // If we have a label for this guy, kill it. + if(pLabel) + { + pLabel->SetVisible(false); + pLabel->SetClientIndex( -1 ); + } + } + } + } + + RepositionLabels(); +} + + diff --git a/game_shared/voice_status_hud.h b/game_shared/voice_status_hud.h new file mode 100644 index 0000000..fe97d60 --- /dev/null +++ b/game_shared/voice_status_hud.h @@ -0,0 +1,158 @@ +//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef VOICE_STATUS_HUD_H +#define VOICE_STATUS_HUD_H +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#ifdef CZERO +#include "vgui/hl_base/iviewport.h" +#else +#include +#endif + +#include "voice_common.h" +#include "cl_entity.h" +#include "voice_banmgr.h" + + +//----------------------------------------------------------------------------- +// Purpose: a label which displays a name and a speaking icon +//----------------------------------------------------------------------------- +class CVoiceLabel +{ +public: + CVoiceLabel() + { + m_pLabel = new VoiceVGUILabel( NULL, "VoiceLabel", ""); + m_pLabel->SetParent( gViewPortInterface->GetViewPortPanel() ); + m_pLabel->SetProportional(true); + m_pLabel->SetScheme("ClientScheme"); + vgui::SETUP_PANEL(m_pLabel); + m_clientindex = -1; // -1 means unassigned + m_locationString = NULL; + m_playerName = NULL; + } + + ~CVoiceLabel() + { + m_pLabel->MarkForDeletion(); + } + + // pass throughs for various label calls + void SetFgColor( Color c ) { m_pLabel->SetFgColor( c ); } + void SetBgColor( Color c ) { m_pLabel->SetBgColor( c ); } + void SetVisible( bool state ) { m_pLabel->SetVisible( state ); } + bool GetVisible() { return m_pLabel->IsVisible(); } + + void GetContentSize( int &wide, int &tall ) { m_pLabel->GetContentSize( wide, tall ); if( tall < 32 ) tall =32; } + void SetBounds( int x, int y ) { + m_pLabel->SetPos( x, y ); + int wide, tall; + m_pLabel->GetContentSize( wide, tall ); + m_pLabel->SetSize( wide, tall ); + } + + void SetClientIndex( int in ) { m_clientindex = in; } + int GetClientIndex() { return m_clientindex; } + + void SetLocation( const char *location ); + void SetPlayerName( const char *name ); + +private: + + //----------------------------------------------------------------------------- + // Purpose: inner class that overrides ApplySchemeSettings() for the label so an image can be loaded, also saves colors away + // so ApplySchemeSettings() doesn't override them + //----------------------------------------------------------------------------- + class VoiceVGUILabel : public vgui::Label + { + public: + VoiceVGUILabel( vgui::Panel *parent, const char *name, const char *text): Label(parent, name, text) {} + + + private: + // VGUI2 overrides + virtual void ApplySchemeSettings(vgui::IScheme *pScheme) + { + Label::ApplySchemeSettings(pScheme); + SetTextImageIndex(1); + SetImagePreOffset( 1, 2); // shift the text over a little + // you need to load the image here, after Label::ApplySchemeSettings()(as applysettings nulls out all existing images) + SetImageAtIndex( 0, vgui::scheme()->GetImage( "gfx/vgui/speaker4", false), 1 ); + } + + }; + + void RebuildLabelText(); + + VoiceVGUILabel *m_pLabel; // the label with the user name and icon + int m_clientindex; // Client index of the speaker. -1 if this label isn't being used. + wchar_t *m_locationString; // localized location string. NULL if the location is "". + char *m_playerName; +}; + + + +//----------------------------------------------------------------------------- +// Purpose: Handles the displaying of labels on the hud and icons above players in game when they talk +//----------------------------------------------------------------------------- +class CVoiceStatusHud : public IVoiceHud, public CHudBase +{ +public: + CVoiceStatusHud(); + virtual ~CVoiceStatusHud(); + + // CHudBase overrides. + // Initialize the cl_dll's voice manager. + virtual int Init(IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus); + + // ackPosition is the bottom position of where CVoiceStatus will draw the voice acknowledgement labels. + virtual int VidInit(); + + // Call from the HUD_CreateEntities function so it can add sprites above player heads. + void CreateEntities(); + + void UpdateLocation(int entindex, const char *location); + + void UpdateSpeakerStatus(int entindex, bool bTalking); + + + CVoiceLabel* FindVoiceLabel(int clientindex); // Find a CVoiceLabel representing the specified speaker. + // Returns NULL if none. + // entindex can be -1 if you want a currently-unused voice label. + CVoiceLabel* GetFreeVoiceLabel(); // Get an unused voice label. Returns NULL if none. + void RepositionLabels(); + + +private: + + cl_entity_s m_VoiceHeadModels[VOICE_MAX_PLAYERS]; // These aren't necessarily in the order of players. They are just + // a place for it to put data in during CreateEntities. + HSPRITE m_VoiceHeadModel; // Voice head model (goes above players who are speaking). + float m_VoiceHeadModelHeight; // Height above their head to place the model. + + IVoiceStatusHelper *m_pHelper; + IVoiceStatus *m_pStatus; + + // Labels telling who is speaking. + CUtlVector m_Labels; + + vgui::ImagePanel *m_pLocalPlayerTalkIcon; +}; + + + +#endif // VOICE_STATUS_HUD_H diff --git a/lib/public/SDL2.lib b/lib/public/SDL2.lib new file mode 100644 index 0000000..cc89dba Binary files /dev/null and b/lib/public/SDL2.lib differ diff --git a/lib/public/game_controls.lib b/lib/public/game_controls.lib new file mode 100644 index 0000000..02fec5c Binary files /dev/null and b/lib/public/game_controls.lib differ diff --git a/linux/Makefile b/linux/Makefile new file mode 100644 index 0000000..80bbe6e --- /dev/null +++ b/linux/Makefile @@ -0,0 +1,170 @@ + +# +# Half-life Makefile for x86 Linux +# +# + +OS:=$(shell uname) +HOSTNAME:=$(shell hostname) + +ifeq "$(CFG)" "" +CFG=release +endif + +SOURCE_DIR=.. +BUILD_DIR=$(CFG) + +ENGINE_SRC_DIR=$(SOURCE_DIR)/engine +COMMON_SRC_DIR=$(SOURCE_DIR)/common +PM_SRC_DIR=$(SOURCE_DIR)/pm_shared +GAME_SHARED_SRC_DIR=$(SOURCE_DIR)/game_shared +GAMEDB_SRC_DIR=$(COMMON_SRC_DIR)/gamedb +PUBLIC_SRC_DIR=$(SOURCE_DIR)/public +DBG_SRC_DIR=$(SOURCE_DIR)/dbg + + +BUILD_OBJ_DIR=$(BUILD_DIR)/obj + +ARCH=i386 +ELF-GC-DYNSTR=./elf-gc-dynstr + +ifeq ($(OS),Linux) + CC="/valve/bin/gcc-4.6 -m32" + CPLUS="/valve/bin/g++-4.6 -m32" + CPP_LIB:=-L$(shell /valve/bin/g++-4.6 -m32 -print-file-name=libstdc++.so | xargs dirname) -lstdc++ -ldl -lpthread +endif + +ifeq ($(OS),Darwin) + OSXVER := $(shell sw_vers -productVersion) + DEVELOPER_DIR := $(shell /usr/bin/xcode-select -print-path) + ifeq (,$(findstring 10.7, $(OSXVER))) + BUILDING_ON_LION := 0 + COMPILER_BIN_DIR := $(DEVELOPER_DIR)/usr/bin + SDK_DIR := $(DEVELOPER_DIR)/SDKs + else + BUILDING_ON_LION := 1 + COMPILER_BIN_DIR := $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin + SDK_DIR := $(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/SDKs + endif + + #SDKROOT ?= $(SDK_DIR)/MacOSX10.6.sdk + SDKROOT ?= $(SDK_DIR)/MacOSX10.8.sdk + + ARCH_FLAGS ?= -arch i386 -m32 -march=prescott -gdwarf-2 -g2 -Wno-typedef-redefinition -momit-leaf-frame-pointer -mtune=core2 + CPP_LIB=-lstdc++ -lpthread + + ifeq ($(origin AR), default) + AR = libtool -static -o + endif + ifeq ($(origin CC), default) + CC ="$(COMPILER_BIN_DIR)/clang -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)" + endif + ifeq ($(origin CXX), default) + CPLUS ="$(COMPILER_BIN_DIR)/clang++ -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)" + endif + LINK ?= $(CXX) +endif + +CLINK=$(CC) + +ifeq "$(CFG)" "release" +ARCH_CFLAGS_I486=-O3 -gdwarf-2 -g2 +ARCH_CFLAGS_I686=-O3 -gdwarf-2 -g2 +ARCH_CFLAGS_AMD=-O3 -gdwarf-2 -g2 +ARCH_CFLAGS_AMD64=-m64 -O3 -gdwarf-2 -g2 +else +ARCH_CFLAGS_I486=-gdwarf-2 -g2 +ARCH_CFLAGS_I686=-gdwarf-2 -g2 +ARCH_CFLAGS_AMD=-gdwarf-2 -g2 +ARCH_CFLAGS_AMD64=-m64 -gdwarf-2 -g2 +endif + +ifeq ($(OS),Linux) +ARCH_CFLAGS_I486+=-march=pentium-m -mfpmath=387 +ARCH_CFLAGS_I686+=-march=pentium-m -mfpmath=387 +ARCH_CFLAGS_AMD+=-march=k6 -mfpmath=387 +endif + +ifeq ($(OS),Darwin) +# force 387 for FP math so the precision between win32 and linux and osx match +ARCH_CFLAGS_I486+=-march=pentium-m -mfpmath=387 +ARCH_CFLAGS_I686+=-march=pentium-m -mfpmath=387 +ARCH_CFLAGS_AMD+=-mfpmath=387 +endif + + +ARCH_CFLAGS="$(ARCH_CFLAGS_I486)" + +BASE_CFLAGS=-fpermissive -fno-strict-aliasing -DNDEBUG -DPOSIX -D_POSIX -DLINUX -D_LINUX -DGNUC -DHL1 -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -DQUIVER -DQUAKE2 -DVALVE_DLL -D_alloca=alloca -fno-exceptions -fexpensive-optimizations -D_vsnprintf=vsnprintf -DNO_MALLOC_OVERRIDE -Werror=return-type +BASE_CFLAGS+=-w + +ifeq ($(OS),Darwin) + BASE_CFLAGS += -DOSX -D_OSX -fvisibility=hidden +else + BASE_CFLAGS+= -DLINUX -D_LINUX +endif + +DEDICATED_CFLAGS="-DDEDICATED -DSWDS" +ifeq ($(OS),Darwin) +SHLIBEXT=dylib +SHLIBCFLAGS= +SHLIBLDFLAGS="-shared -gdwarf-2 -g2" +else +SHLIBEXT=so +SHLIBCFLAGS= +SHLIBLDFLAGS="-shared -gdwarf-2 -g2 -Wl,-Map,$@_map.txt" +endif +AR=ar +LIBEXT=a +MAKE+= -j8 + +MAKE_HL_LIB=$(MAKE) -f Makefile.hldll +MAKE_DMC_LIB=$(MAKE) -f Makefile.dmcdll +MAKE_RICOCHET_LIB=$(MAKE) -f Makefile.ricochetdll +MAKE_HL_CDLL=$(MAKE) -f Makefile.hl_cdll +MAKE_DMC_CDLL=$(MAKE) -f Makefile.dmc_cdll +MAKE_RICOCHET_CDLL=$(MAKE) -f Makefile.ricochet_cdll + +############################################################################# +# SETUP AND BUILD +############################################################################# + +all: build_dir targets + +TARGETS= + +TARGETS+= \ + hl \ + dmc \ + ricochet \ + hl_cdll \ + dmc_cdll \ + ricochet_cdll \ + +build_dir: + -mkdir $(BUILD_DIR); + cd $(BUILD_DIR) + +targets: $(TARGETS) + + +hl_cdll: build_dir + $(MAKE_HL_CDLL) ARCH=i686 CC=$(CC) CPLUS=$(CPLUS) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) DBG_SRC_DIR=$(DBG_SRC_DIR) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) CLINK=$(CLINK) PM_SRC_DIR=$(PM_SRC_DIR) SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) CFG=$(CFG) OS=$(OS) + +dmc_cdll: build_dir + $(MAKE_DMC_CDLL) ARCH=i686 CC=$(CC) CPLUS=$(CPLUS) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) DBG_SRC_DIR=$(DBG_SRC_DIR) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) CLINK=$(CLINK) PM_SRC_DIR=$(PM_SRC_DIR) SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) CFG=$(CFG) OS=$(OS) + +ricochet_cdll: build_dir + $(MAKE_RICOCHET_CDLL) ARCH=i686 CC=$(CC) CPLUS=$(CPLUS) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) DBG_SRC_DIR=$(DBG_SRC_DIR) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) CLINK=$(CLINK) PM_SRC_DIR=$(PM_SRC_DIR) SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) CFG=$(CFG) OS=$(OS) + +hl: build_dir + $(MAKE_HL_LIB) CC=$(CC) ARCH=$(ARCH) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) PM_SRC_DIR=$(PM_SRC_DIR) GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) GAMEDB_SRC_DIR=$(GAMEDB_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) CFG=$(CFG) OS=$(OS) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" + +dmc: build_dir + $(MAKE_DMC_LIB) CC=$(CC) CPLUS=$(CPLUS) CPP_LIB="$(CPP_LIB)" ARCH=$(ARCH) BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) CFG=$(CFG) OS=$(OS) CLINK=$(CLINK) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" + +ricochet: build_dir + $(MAKE_RICOCHET_LIB) CC=$(CC) CPLUS=$(CPLUS) CPP_LIB="$(CPP_LIB)" ARCH=$(ARCH) BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) CFG=$(CFG) OS=$(OS) CLINK=$(CLINK) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" + +clean: + -rm -rf $(BUILD_OBJ_DIR) diff --git a/linux/Makefile.hl_cdll b/linux/Makefile.hl_cdll new file mode 100644 index 0000000..3b3d97c --- /dev/null +++ b/linux/Makefile.hl_cdll @@ -0,0 +1,195 @@ +# +# launcher Makefile for x86 Linux +# +# + +HL_SRC_DIR=$(SOURCE_DIR)/cl_dll +HL_SERVER_SRC_DIR=$(SOURCE_DIR)/dlls +GAME_SHARED_SRC_DIR=$(SOURCE_DIR)/game_shared +PM_SHARED_SRC_DIR=$(SOURCE_DIR)/pm_shared + +HL1_OBJ_DIR=$(BUILD_OBJ_DIR)/hl1_client +PUBLIC_OBJ_DIR=$(HL1_OBJ_DIR)/public +COMMON_OBJ_DIR=$(HL1_OBJ_DIR)/common +GAME_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/game_shared +HL1_SERVER_OBJ_DIR=$(HL1_OBJ_DIR)/server +PM_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/pm_shared + +CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -DCLIENT_WEAPONS -DHL_DLL -I/usr/include/malloc -D_snwprintf=swprintf \ + -DDISABLE_JUMP_ORIGIN -DDISABLE_VEC_ORIGIN + +INCLUDEDIRS=-I$(HL_SRC_DIR) -I../dlls -I../tfc -I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I../pm_shared -I../engine -I../utils/vgui/include -I ../game_shared -I../external + +ifeq ($(OS),Darwin) +LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -framework Carbon $(CFG)/vgui.dylib -L. -lSDL2-2.0.0 +else +LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -L$(CFG) vgui.so -L. libSDL2-2.0.so.0 +endif + +DO_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) -o $@ -c $< +DO_PUBLIC_CC=$(CPLUS) $(COMMON_INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< +DO_COMMON_CC=$(CPLUS) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< +DO_PM_SHARED_CC=$(CC) $(INCLUDEDIRS) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< + +##################################################################### + +HL1_OBJS = \ + $(HL1_OBJ_DIR)/hud_spectator.o \ + $(HL1_OBJ_DIR)/ev_hldm.o \ + $(HL1_OBJ_DIR)/hl/hl_baseentity.o \ + $(HL1_OBJ_DIR)/hl/hl_events.o \ + $(HL1_OBJ_DIR)/hl/hl_objects.o \ + $(HL1_OBJ_DIR)/hl/hl_weapons.o \ + $(HL1_OBJ_DIR)/hud.o \ + $(HL1_OBJ_DIR)/inputw32.o \ + $(HL1_OBJ_DIR)/ammo.o \ + $(HL1_OBJ_DIR)/ammo_secondary.o \ + $(HL1_OBJ_DIR)/ammohistory.o \ + $(HL1_OBJ_DIR)/battery.o \ + $(HL1_OBJ_DIR)/cdll_int.o \ + $(HL1_OBJ_DIR)/com_weapons.o \ + $(HL1_OBJ_DIR)/death.o \ + $(HL1_OBJ_DIR)/demo.o \ + $(HL1_OBJ_DIR)/entity.o \ + $(HL1_OBJ_DIR)/ev_common.o \ + $(HL1_OBJ_DIR)/events.o \ + $(HL1_OBJ_DIR)/flashlight.o \ + $(HL1_OBJ_DIR)/GameStudioModelRenderer.o \ + $(HL1_OBJ_DIR)/geiger.o \ + $(HL1_OBJ_DIR)/health.o \ + $(HL1_OBJ_DIR)/hud_bench.o \ + $(HL1_OBJ_DIR)/hud_benchtrace.o \ + $(HL1_OBJ_DIR)/hud_msg.o \ + $(HL1_OBJ_DIR)/hud_redraw.o \ + $(HL1_OBJ_DIR)/hud_update.o \ + $(HL1_OBJ_DIR)/in_camera.o \ + $(HL1_OBJ_DIR)/input.o \ + $(HL1_OBJ_DIR)/interpolation.o \ + $(HL1_OBJ_DIR)/menu.o \ + $(HL1_OBJ_DIR)/message.o \ + $(HL1_OBJ_DIR)/saytext.o \ + $(HL1_OBJ_DIR)/status_icons.o \ + $(HL1_OBJ_DIR)/statusbar.o \ + $(HL1_OBJ_DIR)/studio_util.o \ + $(HL1_OBJ_DIR)/StudioModelRenderer.o \ + $(HL1_OBJ_DIR)/text_message.o \ + $(HL1_OBJ_DIR)/train.o \ + $(HL1_OBJ_DIR)/tri.o \ + $(HL1_OBJ_DIR)/util.o \ + $(HL1_OBJ_DIR)/view.o \ + $(HL1_OBJ_DIR)/vgui_int.o \ + $(HL1_OBJ_DIR)/vgui_ClassMenu.o \ + $(HL1_OBJ_DIR)/vgui_ConsolePanel.o \ + $(HL1_OBJ_DIR)/vgui_ControlConfigPanel.o \ + $(HL1_OBJ_DIR)/vgui_CustomObjects.o \ + $(HL1_OBJ_DIR)/vgui_MOTDWindow.o \ + $(HL1_OBJ_DIR)/vgui_SchemeManager.o \ + $(HL1_OBJ_DIR)/vgui_ScorePanel.o \ + $(HL1_OBJ_DIR)/vgui_ServerBrowser.o \ + $(HL1_OBJ_DIR)/vgui_TeamFortressViewport.o \ + $(HL1_OBJ_DIR)/vgui_SpectatorPanel.o \ + $(HL1_OBJ_DIR)/vgui_teammenu.o \ + $(HL1_OBJ_DIR)/voice_status.o \ + $(HL1_OBJ_DIR)/hud_servers.o \ + + +DLL_OBJS = \ + $(HL1_SERVER_OBJ_DIR)/crossbow.o \ + $(HL1_SERVER_OBJ_DIR)/crowbar.o \ + $(HL1_SERVER_OBJ_DIR)/egon.o \ + $(HL1_SERVER_OBJ_DIR)/gauss.o \ + $(HL1_SERVER_OBJ_DIR)/handgrenade.o \ + $(HL1_SERVER_OBJ_DIR)/hornetgun.o \ + $(HL1_SERVER_OBJ_DIR)/mp5.o \ + $(HL1_SERVER_OBJ_DIR)/python.o \ + $(HL1_SERVER_OBJ_DIR)/rpg.o \ + $(HL1_SERVER_OBJ_DIR)/satchel.o \ + $(HL1_SERVER_OBJ_DIR)/shotgun.o \ + $(HL1_SERVER_OBJ_DIR)/squeakgrenade.o \ + $(HL1_SERVER_OBJ_DIR)/tripmine.o \ + $(HL1_SERVER_OBJ_DIR)/wpn_shared/hl_wpn_glock.o \ + + +PUBLIC_OBJS = \ + $(PUBLIC_OBJ_DIR)/interface.o \ + +COMMON_OBJS = \ + $(COMMON_OBJ_DIR)/parsemsg.o \ + +GAME_SHARED_OBJS = \ + $(GAME_SHARED_OBJ_DIR)/vgui_checkbutton2.o \ + $(GAME_SHARED_OBJ_DIR)/vgui_grid.o \ + $(GAME_SHARED_OBJ_DIR)/vgui_helpers.o \ + $(GAME_SHARED_OBJ_DIR)/vgui_listbox.o \ + $(GAME_SHARED_OBJ_DIR)/vgui_loadtga.o \ + $(GAME_SHARED_OBJ_DIR)/vgui_scrollbar2.o \ + $(GAME_SHARED_OBJ_DIR)/vgui_slider2.o \ + $(GAME_SHARED_OBJ_DIR)/voice_banmgr.o \ + +PM_SHARED_OBJS = \ + $(PM_SHARED_OBJ_DIR)/pm_debug.o \ + $(PM_SHARED_OBJ_DIR)/pm_shared.o \ + $(PM_SHARED_OBJ_DIR)/pm_math.o \ + + + +all: client.$(SHLIBEXT) + +client.$(SHLIBEXT): $(HL1_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(DLL_OBJS) $(PM_SHARED_OBJS) + $(CLINK) -o $(BUILD_DIR)/$@ $(HL1_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(DLL_OBJS) $(PM_SHARED_OBJS) $(LDFLAGS) $(CPP_LIB) + p4 edit ../../game/mod/cl_dlls/$@ + cp $(BUILD_DIR)/$@ ../../game/mod/cl_dlls + ./gendbg.sh ../../game/mod/cl_dlls/client.$(SHLIBEXT) + +$(HL1_OBJ_DIR): + mkdir -p $(HL1_OBJ_DIR) + mkdir -p $(HL1_OBJ_DIR)/hl + mkdir -p $(HL1_OBJ_DIR)/dlls/wpn_shared + mkdir -p $(HL1_OBJ_DIR)/VGUI + +$(HL1_SERVER_OBJ_DIR): + mkdir -p $(HL1_SERVER_OBJ_DIR) + mkdir -p $(HL1_SERVER_OBJ_DIR)/wpn_shared + +$(PUBLIC_OBJ_DIR): + mkdir -p $(PUBLIC_OBJ_DIR) + +$(COMMON_OBJ_DIR): + mkdir -p $(COMMON_OBJ_DIR) + +$(GAME_SHARED_OBJ_DIR): + mkdir -p $(GAME_SHARED_OBJ_DIR) + +$(PM_SHARED_OBJ_DIR): + mkdir -p $(PM_SHARED_OBJ_DIR) + +$(HL1_OBJ_DIR)/%.o: $(HL_SRC_DIR)/%.cpp $(filter-out $(wildcard $(HL1_OBJ_DIR)), $(HL1_OBJ_DIR)) + $(DO_CC) + +$(HL1_SERVER_OBJ_DIR)/%.o: $(HL_SERVER_SRC_DIR)/%.cpp $(filter-out $(wildcard $(HL1_SERVER_OBJ_DIR)), $(HL1_SERVER_OBJ_DIR)) + $(DO_CC) + +$(HL1_OBJ_DIR)/%.o: $(HL_SRC_DIR)/hl/%.cpp $(filter-out $(wildcard $(HL1_OBJ_DIR)), $(HL1_OBJ_DIR)) + $(DO_CC) + +$(HL1_OBJ_DIR)/%.o: $(HL_SRC_DIR)/dlls/wpn_shared/%.cpp $(filter-out $(wildcard $(HL1_OBJ_DIR)), $(HL1_OBJ_DIR)) + $(DO_CC) + +$(HL1_OBJ_DIR)/%.o: $(HL_SRC_DIR)/VGUI/%.cpp $(filter-out $(wildcard $(HL1_OBJ_DIR)), $(HL1_OBJ_DIR)) + $(DO_CC) + +$(PUBLIC_OBJ_DIR)/%.o : $(PUBLIC_SRC_DIR)/%.cpp $(filter-out $(wildcard $(PUBLIC_OBJ_DIR)), $(PUBLIC_OBJ_DIR)) + $(DO_PUBLIC_CC) + +$(COMMON_OBJ_DIR)/%.o : $(COMMON_SRC_DIR)/%.cpp $(filter-out $(wildcard $(COMMON_OBJ_DIR)), $(COMMON_OBJ_DIR)) + $(DO_COMMON_CC) + +$(GAME_SHARED_OBJ_DIR)/%.o : $(GAME_SHARED_SRC_DIR)/%.cpp $(filter-out $(wildcard $(GAME_SHARED_OBJ_DIR)), $(GAME_SHARED_OBJ_DIR)) + $(DO_COMMON_CC) + +$(PM_SHARED_OBJ_DIR)/%.o : $(PM_SHARED_SRC_DIR)/%.c $(filter-out $(wildcard $(PM_SHARED_OBJ_DIR)), $(PM_SHARED_OBJ_DIR)) + $(DO_PM_SHARED_CC) + +clean: + -rm -rf $(HL1_OBJ_DIR) + -rm -f client.$(SHLIBEXT) diff --git a/linux/Makefile.hldll b/linux/Makefile.hldll new file mode 100644 index 0000000..9609e58 --- /dev/null +++ b/linux/Makefile.hldll @@ -0,0 +1,175 @@ +# +# HL game library Makefile for x86 Linux +# +# Feb 2001 by Leon Hartwig (hartwig@valvesoftware.com) +# + +HLDLL_SRC_DIR=$(SOURCE_DIR)/dlls +HLWPN_SRC_DIR=$(HLDLL_SRC_DIR)/wpn_shared + +HLDLL_OBJ_DIR=$(BUILD_OBJ_DIR)/hldll +HLWPN_OBJ_DIR=$(HLDLL_OBJ_DIR)/wpn_shared +PM_OBJ_DIR=$(HLDLL_OBJ_DIR)/pm_shared +GAME_SHARED_OBJ_DIR=$(HLDLL_OBJ_DIR)/game_shared + +#CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) $(SHLIBCFLAGS) -DCLIENT_WEAPONS +CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_WEAPONS +#-O3 -ffast-math -fno-strength-reduce + +HLDLL_INCLUDEDIRS=-I$(ENGINE_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PM_SRC_DIR) -I$(GAME_SHARED_SRC_DIR) -I$(PUBLIC_SRC_DIR) +HLWPN_INCLUDEDIRS=-I$(HLDLL_SRC_DIR) -I$(ENGINE_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PM_SRC_DIR) -I$(PUBLIC_SRC_DIR) +PM_INCLUDEDIRS=-I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) +GAME_SHARED_INCLUDEDIRS=-I$(HLDLL_SRC_DIR) -I$(ENGINE_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PM_SRC_DIR) -I$(PUBLIC_SRC_DIR) + +LDFLAGS= -lm -lstdc++ + +DO_HLDLL_CC=$(CC) $(HLDLL_INCLUDEDIRS) $(CFLAGS) -o $@ -c $< +DO_HLWPN_CC=$(CC) $(HLWPN_INCLUDEDIRS) $(CFLAGS) -o $@ -c $< +DO_PM_CC=$(CC) $(PM_INCLUDEDIRS) $(CFLAGS) -o $@ -c $< +DO_GAME_SHARED_CC=$(CC) $(GAME_SHARED_INCLUDEDIRS) $(CFLAGS) -o $@ -c $< + +##################################################################### + +HLDLL_OBJS = \ + $(HLDLL_OBJ_DIR)/aflock.o \ + $(HLDLL_OBJ_DIR)/agrunt.o \ + $(HLDLL_OBJ_DIR)/airtank.o \ + $(HLDLL_OBJ_DIR)/animating.o \ + $(HLDLL_OBJ_DIR)/animation.o \ + $(HLDLL_OBJ_DIR)/apache.o \ + $(HLDLL_OBJ_DIR)/barnacle.o \ + $(HLDLL_OBJ_DIR)/barney.o \ + $(HLDLL_OBJ_DIR)/bigmomma.o \ + $(HLDLL_OBJ_DIR)/bloater.o \ + $(HLDLL_OBJ_DIR)/bmodels.o \ + $(HLDLL_OBJ_DIR)/bullsquid.o \ + $(HLDLL_OBJ_DIR)/buttons.o \ + $(HLDLL_OBJ_DIR)/cbase.o \ + $(HLDLL_OBJ_DIR)/client.o \ + $(HLDLL_OBJ_DIR)/combat.o \ + $(HLDLL_OBJ_DIR)/controller.o \ + $(HLDLL_OBJ_DIR)/crossbow.o \ + $(HLDLL_OBJ_DIR)/crowbar.o \ + $(HLDLL_OBJ_DIR)/defaultai.o \ + $(HLDLL_OBJ_DIR)/doors.o \ + $(HLDLL_OBJ_DIR)/effects.o \ + $(HLDLL_OBJ_DIR)/egon.o \ + $(HLDLL_OBJ_DIR)/explode.o \ + $(HLDLL_OBJ_DIR)/flyingmonster.o \ + $(HLDLL_OBJ_DIR)/func_break.o \ + $(HLDLL_OBJ_DIR)/func_tank.o \ + $(HLDLL_OBJ_DIR)/game.o \ + $(HLDLL_OBJ_DIR)/gamerules.o \ + $(HLDLL_OBJ_DIR)/gargantua.o \ + $(HLDLL_OBJ_DIR)/gauss.o \ + $(HLDLL_OBJ_DIR)/genericmonster.o \ + $(HLDLL_OBJ_DIR)/ggrenade.o \ + $(HLDLL_OBJ_DIR)/globals.o \ + $(HLDLL_OBJ_DIR)/gman.o \ + $(HLDLL_OBJ_DIR)/h_ai.o \ + $(HLDLL_OBJ_DIR)/h_battery.o \ + $(HLDLL_OBJ_DIR)/h_cine.o \ + $(HLDLL_OBJ_DIR)/h_cycler.o \ + $(HLDLL_OBJ_DIR)/h_export.o \ + $(HLDLL_OBJ_DIR)/handgrenade.o \ + $(HLDLL_OBJ_DIR)/hassassin.o \ + $(HLDLL_OBJ_DIR)/headcrab.o \ + $(HLDLL_OBJ_DIR)/healthkit.o \ + $(HLDLL_OBJ_DIR)/hgrunt.o \ + $(HLDLL_OBJ_DIR)/hornet.o \ + $(HLDLL_OBJ_DIR)/hornetgun.o \ + $(HLDLL_OBJ_DIR)/houndeye.o \ + $(HLDLL_OBJ_DIR)/ichthyosaur.o \ + $(HLDLL_OBJ_DIR)/islave.o \ + $(HLDLL_OBJ_DIR)/items.o \ + $(HLDLL_OBJ_DIR)/leech.o \ + $(HLDLL_OBJ_DIR)/lights.o \ + $(HLDLL_OBJ_DIR)/maprules.o \ + $(HLDLL_OBJ_DIR)/monstermaker.o \ + $(HLDLL_OBJ_DIR)/monsters.o \ + $(HLDLL_OBJ_DIR)/monsterstate.o \ + $(HLDLL_OBJ_DIR)/mortar.o \ + $(HLDLL_OBJ_DIR)/mp5.o \ + $(HLDLL_OBJ_DIR)/nihilanth.o \ + $(HLDLL_OBJ_DIR)/nodes.o \ + $(HLDLL_OBJ_DIR)/observer.o \ + $(HLDLL_OBJ_DIR)/osprey.o \ + $(HLDLL_OBJ_DIR)/pathcorner.o \ + $(HLDLL_OBJ_DIR)/plane.o \ + $(HLDLL_OBJ_DIR)/plats.o \ + $(HLDLL_OBJ_DIR)/player.o \ + $(HLDLL_OBJ_DIR)/python.o \ + $(HLDLL_OBJ_DIR)/rat.o \ + $(HLDLL_OBJ_DIR)/roach.o \ + $(HLDLL_OBJ_DIR)/rpg.o \ + $(HLDLL_OBJ_DIR)/satchel.o \ + $(HLDLL_OBJ_DIR)/schedule.o \ + $(HLDLL_OBJ_DIR)/scientist.o \ + $(HLDLL_OBJ_DIR)/scripted.o \ + $(HLDLL_OBJ_DIR)/shotgun.o \ + $(HLDLL_OBJ_DIR)/skill.o \ + $(HLDLL_OBJ_DIR)/sound.o \ + $(HLDLL_OBJ_DIR)/soundent.o \ + $(HLDLL_OBJ_DIR)/spectator.o \ + $(HLDLL_OBJ_DIR)/squadmonster.o \ + $(HLDLL_OBJ_DIR)/squeakgrenade.o \ + $(HLDLL_OBJ_DIR)/subs.o \ + $(HLDLL_OBJ_DIR)/talkmonster.o \ + $(HLDLL_OBJ_DIR)/teamplay_gamerules.o \ + $(HLDLL_OBJ_DIR)/multiplay_gamerules.o \ + $(HLDLL_OBJ_DIR)/singleplay_gamerules.o \ + $(HLDLL_OBJ_DIR)/tempmonster.o \ + $(HLDLL_OBJ_DIR)/tentacle.o \ + $(HLDLL_OBJ_DIR)/triggers.o \ + $(HLDLL_OBJ_DIR)/tripmine.o \ + $(HLDLL_OBJ_DIR)/turret.o \ + $(HLDLL_OBJ_DIR)/util.o \ + $(HLDLL_OBJ_DIR)/weapons.o \ + $(HLDLL_OBJ_DIR)/world.o \ + $(HLDLL_OBJ_DIR)/xen.o \ + $(HLDLL_OBJ_DIR)/zombie.o + +HLWPN_OBJS = \ + $(HLWPN_OBJ_DIR)/hl_wpn_glock.o + +PM_OBJS = \ + $(PM_OBJ_DIR)/pm_shared.o \ + $(PM_OBJ_DIR)/pm_math.o \ + $(PM_OBJ_DIR)/pm_debug.o + +GAME_SHARED_OBJS = \ + $(GAME_SHARED_OBJ_DIR)/voice_gamemgr.o + +all: dirs hl.$(SHLIBEXT) + +dirs: + -mkdir $(BUILD_OBJ_DIR) + -mkdir $(HLDLL_OBJ_DIR) + -mkdir $(HLWPN_OBJ_DIR) + -mkdir $(PM_OBJ_DIR) + -mkdir $(GAME_SHARED_OBJ_DIR) + +hl.$(SHLIBEXT): $(HLDLL_OBJS) $(HLWPN_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS) + $(CC) $(LDFLAGS) $(SHLIBLDFLAGS) -o $(BUILD_DIR)/$@ $(HLDLL_OBJS) $(HLWPN_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS) + p4 edit ../../game/mod/dlls/hl.$(SHLIBEXT) + cp $(BUILD_DIR)/$@ ../../game/mod/dlls/hl.$(SHLIBEXT) + ./gendbg.sh ../../game/mod/dlls/hl.$(SHLIBEXT) + +$(HLWPN_OBJ_DIR)/%.o : $(HLWPN_SRC_DIR)/%.cpp + $(DO_HLWPN_CC) + +$(HLDLL_OBJ_DIR)/%.o : $(HLDLL_SRC_DIR)/%.cpp + $(DO_HLDLL_CC) + +$(PM_OBJ_DIR)/%.o : $(PM_SRC_DIR)/%.c + $(DO_PM_CC) + +$(GAME_SHARED_OBJ_DIR)/%.o : $(GAME_SHARED_SRC_DIR)/%.cpp + $(DO_GAME_SHARED_CC) + +clean: + -rm -rf $(GAME_SHARED_OBJ_DIR) + -rm -rf $(PM_OBJ_DIR) + -rm -rf $(HLWPN_OBJ_DIR) + -rm -rf $(HLDLL_OBJ_DIR) + -rm -f hl_$(ARCH).$(SHLIBEXT) diff --git a/linux/gendbg.sh b/linux/gendbg.sh new file mode 100755 index 0000000..af5e976 --- /dev/null +++ b/linux/gendbg.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +UNAME=`uname` +if [ "$UNAME" == "Darwin" ]; then + p4 edit $1.dSYM/... + dsymutil $1 + p4 revert -a $1.dSYM/... + exit 0; +fi + +OBJCOPY=/valve/bin/objcopy + +function usage { + echo "$0 /path/to/input/file [-o /path/to/output/file ]" + echo "" +} + +if [ $# == 0 ]; then + usage + exit 2 +fi + +if [ $(basename $1) == $1 ]; then + INFILEDIR=$PWD +else + INFILEDIR=$(cd ${1%/*} && echo $PWD) +fi +INFILE=$(basename $1) + +OUTFILEDIR=$INFILEDIR +OUTFILE=$INFILE.dbg + +while getopts "o:" opt; do + case $opt in + o) + OUTFILEDIR=$(cd ${OPTARG%/*} && echo $PWD) + OUTFILE=$(basename $OPTARG) + ;; + esac +done + +if [ "$OUTFILEDIR" != "$INFILEDIR" ]; then + INFILE=${INFILEDIR}/${INFILE} + OUTFILE=${OUTFILEDIR}/${OUTFILE} +fi + +pushd "$INFILEDIR" +p4 edit "$OUTFILE" +$OBJCOPY "$INFILE" "$OUTFILE" +$OBJCOPY --add-gnu-debuglink="$OUTFILE" "$INFILE" +p4 revert -a "$OUTFILE" +popd + diff --git a/linux/release/vgui.dylib b/linux/release/vgui.dylib new file mode 100755 index 0000000..5f4bd61 Binary files /dev/null and b/linux/release/vgui.dylib differ diff --git a/linux/release/vgui.so b/linux/release/vgui.so new file mode 100755 index 0000000..186f985 Binary files /dev/null and b/linux/release/vgui.so differ diff --git a/linux/vgui.so b/linux/vgui.so new file mode 100755 index 0000000..186f985 Binary files /dev/null and b/linux/vgui.so differ diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index ccaffb0..3259735 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -17,6 +17,7 @@ #define PM_DEFSH #pragma once +#include "archtypes.h" // DAL #define MAX_PHYSENTS 600 // Must have room for all entities in the world. #define MAX_MOVEENTS 64 #define MAX_CLIP_PLANES 5 @@ -196,7 +197,7 @@ typedef struct playermove_s int (*PM_HullPointContents) ( struct hull_s *hull, int num, float *p); pmtrace_t (*PM_PlayerTrace) (float *start, float *end, int traceFlags, int ignore_pe ); struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe ); - long (*RandomLong)( long lLow, long lHigh ); + int32 (*RandomLong)( int32 lLow, int32 lHigh ); float (*RandomFloat)( float flLow, float flHigh ); int (*PM_GetModelType)( struct model_s *mod ); void (*PM_GetModelBounds)( struct model_s *mod, float *mins, float *maxs ); diff --git a/pm_shared/pm_materials.h b/pm_shared/pm_materials.h index 5dba498..3b6a21e 100644 --- a/pm_shared/pm_materials.h +++ b/pm_shared/pm_materials.h @@ -29,5 +29,6 @@ #define CHAR_TEX_COMPUTER 'P' #define CHAR_TEX_GLASS 'Y' #define CHAR_TEX_FLESH 'F' +#define CHAR_TEX_SNOW 'N' #endif // !PM_MATERIALSH diff --git a/pm_shared/pm_math.c b/pm_shared/pm_math.c index a5d78dc..1dd4211 100644 --- a/pm_shared/pm_math.c +++ b/pm_shared/pm_math.c @@ -27,7 +27,9 @@ #pragma warning(disable : 4244) +#ifndef DISABLE_VEC_ORIGIN vec3_t vec3_origin = {0,0,0}; +#endif int nanmask = 255<<23; float anglemod(float a) @@ -106,7 +108,7 @@ void AngleVectorsTranspose (const vec3_t angles, vec3_t forward, vec3_t right, v } } - +#ifndef DISABLE_VEC_FUNCS void AngleMatrix (const vec3_t angles, float (*matrix)[4] ) { float angle; @@ -166,6 +168,7 @@ void AngleIMatrix (const vec3_t angles, float matrix[3][4] ) matrix[1][3] = 0.0; matrix[2][3] = 0.0; } +#endif void NormalizeAngles( float *angles ) { @@ -245,7 +248,7 @@ float AngleBetweenVectors( const vec3_t v1, const vec3_t v2 ) return angle; } - +#ifndef DISABLE_VEC_FUNCS void VectorTransform (const vec3_t in1, float in2[3][4], vec3_t out) { out[0] = DotProduct(in1, in2[0]) + in2[0][3]; @@ -253,7 +256,6 @@ void VectorTransform (const vec3_t in1, float in2[3][4], vec3_t out) out[2] = DotProduct(in1, in2[2]) + in2[2][3]; } - int VectorCompare (const vec3_t v1, const vec3_t v2) { int i; @@ -271,6 +273,7 @@ void VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc) vecc[1] = veca[1] + scale*vecb[1]; vecc[2] = veca[2] + scale*vecb[2]; } +#endif vec_t _DotProduct (vec3_t v1, vec3_t v2) @@ -299,15 +302,18 @@ void _VectorCopy (vec3_t in, vec3_t out) out[2] = in[2]; } +#ifndef DISABLE_VEC_FUNCS void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross) { cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; } +#endif double sqrt(double x); +#ifndef DISABLE_VEC_FUNCS float Length(const vec3_t v) { int i; @@ -319,6 +325,7 @@ float Length(const vec3_t v) return length; } +#endif float Distance(const vec3_t v1, const vec3_t v2) { @@ -327,6 +334,7 @@ float Distance(const vec3_t v1, const vec3_t v2) return Length(d); } +#ifndef DISABLE_VEC_FUNCS float VectorNormalize (vec3_t v) { float length, ilength; @@ -359,6 +367,7 @@ void VectorScale (const vec3_t in, vec_t scale, vec3_t out) out[1] = in[1]*scale; out[2] = in[2]*scale; } +#endif int Q_log2(int val) @@ -392,6 +401,7 @@ void VectorMatrix( vec3_t forward, vec3_t right, vec3_t up) } +#ifndef DISABLE_VEC_FUNCS void VectorAngles( const vec3_t forward, vec3_t angles ) { float tmp, yaw, pitch; @@ -420,3 +430,4 @@ void VectorAngles( const vec3_t forward, vec3_t angles ) angles[1] = yaw; angles[2] = 0; } +#endif diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index dfd0a0d..835fde1 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -30,8 +30,13 @@ #ifdef CLIENT_DLL // Spectator Mode int iJumpSpectator; +#ifndef DISABLE_JUMP_ORIGIN float vJumpOrigin[3]; float vJumpAngles[3]; +#else + extern float vJumpOrigin[3]; + extern float vJumpAngles[3]; +#endif #endif static int pm_shared_initialized = 0; @@ -68,18 +73,18 @@ typedef struct hull_s } hull_t; // Ducking time -#define TIME_TO_DUCK 0.4 +#define TIME_TO_DUCK 0.4 #define VEC_DUCK_HULL_MIN -18 #define VEC_DUCK_HULL_MAX 18 #define VEC_DUCK_VIEW 12 #define PM_DEAD_VIEWHEIGHT -8 -#define MAX_CLIMB_SPEED 200 -#define STUCK_MOVEUP 1 -#define STUCK_MOVEDOWN -1 +#define MAX_CLIMB_SPEED 200 +#define STUCK_MOVEUP 1 +#define STUCK_MOVEDOWN -1 #define VEC_HULL_MIN -36 #define VEC_HULL_MAX 36 #define VEC_VIEW 28 -#define STOP_EPSILON 0.1 +#define STOP_EPSILON 0.1 #define CTEXTURESMAX 512 // max number of textures loaded #define CBTEXTURENAMEMAX 13 // only load first n chars of name @@ -114,6 +119,8 @@ typedef struct hull_s #define PLAYER_LONGJUMP_SPEED 350 // how fast we longjump +#define PLAYER_DUCKING_MULTIPLIER 0.333 + // double to float warning #pragma warning(disable : 4244) #define max(a, b) (((a) > (b)) ? (a) : (b)) @@ -1773,9 +1780,9 @@ void PM_SpectatorMove (void) iJumpSpectator = 0; return; } - #endif +#endif // Move around in normal spectator method - + speed = Length (pmove->velocity); if (speed < 1) { @@ -1986,9 +1993,9 @@ void PM_Duck( void ) if ( pmove->flags & FL_DUCKING ) { - pmove->cmd.forwardmove *= 0.333; - pmove->cmd.sidemove *= 0.333; - pmove->cmd.upmove *= 0.333; + pmove->cmd.forwardmove *= PLAYER_DUCKING_MULTIPLIER; + pmove->cmd.sidemove *= PLAYER_DUCKING_MULTIPLIER; + pmove->cmd.upmove *= PLAYER_DUCKING_MULTIPLIER; } if ( ( pmove->cmd.buttons & IN_DUCK ) || ( pmove->bInDuck ) || ( pmove->flags & FL_DUCKING ) ) @@ -2057,6 +2064,12 @@ void PM_LadderMove( physent_t *pLadder ) if ( pmove->movetype == MOVETYPE_NOCLIP ) return; + +#if defined( _TFC ) + // this is how TFC freezes players, so we don't want them climbing ladders + if ( pmove->maxspeed <= 1.0 ) + return; +#endif pmove->PM_GetModelBounds( pLadder->model, modelmins, modelmaxs ); @@ -2081,16 +2094,37 @@ void PM_LadderMove( physent_t *pLadder ) { float forward = 0, right = 0; vec3_t vpn, v_right; + float flSpeed = MAX_CLIMB_SPEED; + + // they shouldn't be able to move faster than their maxspeed + if ( flSpeed > pmove->maxspeed ) + { + flSpeed = pmove->maxspeed; + } AngleVectors( pmove->angles, vpn, v_right, NULL ); + + if ( pmove->flags & FL_DUCKING ) + { + flSpeed *= PLAYER_DUCKING_MULTIPLIER; + } + if ( pmove->cmd.buttons & IN_BACK ) - forward -= MAX_CLIMB_SPEED; + { + forward -= flSpeed; + } if ( pmove->cmd.buttons & IN_FORWARD ) - forward += MAX_CLIMB_SPEED; + { + forward += flSpeed; + } if ( pmove->cmd.buttons & IN_MOVELEFT ) - right -= MAX_CLIMB_SPEED; + { + right -= flSpeed; + } if ( pmove->cmd.buttons & IN_MOVERIGHT ) - right += MAX_CLIMB_SPEED; + { + right += flSpeed; + } if ( pmove->cmd.buttons & IN_JUMP ) { @@ -2987,11 +3021,13 @@ void PM_PlayerMove ( qboolean server ) } } +#if !defined( _TFC ) // Slow down, I'm pulling it! (a box maybe) but only when I'm standing on ground if ( ( pmove->onground != -1 ) && ( pmove->cmd.buttons & IN_USE) ) { VectorScale( pmove->velocity, 0.3, pmove->velocity ); } +#endif // Handle movement switch ( pmove->movetype ) diff --git a/pm_shared/pm_shared.h b/pm_shared/pm_shared.h index c2d5285..08251f0 100644 --- a/pm_shared/pm_shared.h +++ b/pm_shared/pm_shared.h @@ -33,4 +33,4 @@ char PM_FindTextureType( char *name ); #define OBS_MAP_FREE 5 #define OBS_MAP_CHASE 6 -#endif \ No newline at end of file +#endif diff --git a/projects/readme.txt b/projects/readme.txt new file mode 100644 index 0000000..bfa7551 --- /dev/null +++ b/projects/readme.txt @@ -0,0 +1,14 @@ +Directory Contents +================== + +vs2010 + Contains Visual C++ 2010 Express project and solution files. + Please read readme.txt included in that folder for further instructions. + + +Other notes +=========== + +MSVC++ 6.0 .dsp files can be found in the appropriate folders. + +Linux Makefiles can be found in ../linux/ diff --git a/projects/vs2010/bspinfo.vcxproj b/projects/vs2010/bspinfo.vcxproj new file mode 100644 index 0000000..1a9aee6 --- /dev/null +++ b/projects/vs2010/bspinfo.vcxproj @@ -0,0 +1,96 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {B1227C36-C02C-4914-9675-C6D243D8B36E} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/vs2010/bspinfo.vcxproj.filters b/projects/vs2010/bspinfo.vcxproj.filters new file mode 100644 index 0000000..fd8d294 --- /dev/null +++ b/projects/vs2010/bspinfo.vcxproj.filters @@ -0,0 +1,57 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {63245e01-3884-4650-b2a4-90c672eb89e9} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + + + Source Files\utils\bspinfo + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + \ No newline at end of file diff --git a/projects/vs2010/hl_cdll.vcxproj b/projects/vs2010/hl_cdll.vcxproj new file mode 100644 index 0000000..40ddeb0 --- /dev/null +++ b/projects/vs2010/hl_cdll.vcxproj @@ -0,0 +1,241 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {DC1DD765-CFEB-47DA-A2EA-9F1E20A24272} + Win32Proj + hl_cdll + + + + DynamicLibrary + true + NotSet + + + DynamicLibrary + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + client + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + client + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;CLIENT_DLL;CLIENT_WEAPONS;HL_DLL;%(PreprocessorDefinitions) + MultiThreadedDebug + ..\..\dlls;..\..\cl_dll;..\..\public;..\..\common;..\..\pm_shared;..\..\engine;..\..\utils\vgui\include;..\..\game_shared;..\..\external;%(AdditionalIncludeDirectories) + true + + + Windows + true + ..\..\utils\vgui\lib\win32_vc6\vgui.lib;wsock32.lib;..\..\lib\public\sdl2.lib;%(AdditionalDependencies) + + + + + call ..\..\filecopy.bat $(TargetPath) ..\..\..\game\mod\cl_dlls\$(TargetName).dll +call ..\..\filecopy.bat $(TargetDir)\$(TargetName).pdb ..\..\..\game\mod\cl_dlls\$(TargetName).pdb + + + Performing Post-Build Event + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;CLIENT_DLL;CLIENT_WEAPONS;HL_DLL;%(PreprocessorDefinitions) + MultiThreaded + ..\..\dlls;..\..\cl_dll;..\..\public;..\..\common;..\..\pm_shared;..\..\engine;..\..\utils\vgui\include;..\..\game_shared;..\..\external;%(AdditionalIncludeDirectories) + true + + + Windows + true + true + true + ..\..\utils\vgui\lib\win32_vc6\vgui.lib;wsock32.lib;..\..\lib\public\sdl2.lib;%(AdditionalDependencies) + + + + + call ..\..\filecopy.bat $(TargetPath) ..\..\..\game\mod\cl_dlls\$(TargetName).dll +call ..\..\filecopy.bat $(TargetDir)\$(TargetName).pdb ..\..\..\game\mod\cl_dlls\$(TargetName).pdb + + + Performing Post-Build Event + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/vs2010/hl_cdll.vcxproj.filters b/projects/vs2010/hl_cdll.vcxproj.filters new file mode 100644 index 0000000..884467f --- /dev/null +++ b/projects/vs2010/hl_cdll.vcxproj.filters @@ -0,0 +1,435 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {01b8d565-8fa1-4999-8cb6-01da5dd1e555} + + + {6887a889-19a5-42f7-8af9-2af4b64cbf2b} + + + {7d8ce8c9-fed8-42ee-9ba0-73d0fee6006a} + + + {83318ea3-5019-4d8a-a9f9-4922cdb1c9bb} + + + {95dcdae3-b427-4517-a477-bfa2583b2e1f} + + + {54679c20-fece-4cb1-bef2-017d30f31af0} + + + {fb64b597-8c31-4391-b259-6121f67bbccb} + + + {dfaa6b94-3821-41ff-a9c2-ef94fbb0d7d1} + + + {c053705f-05f3-4d16-ab13-80bfa84cbe75} + + + {f033f23a-ab54-411c-bebf-72d10839418e} + + + {a2469e54-cb56-4161-b6b1-55c9d93676c1} + + + {a46a0ff1-e7ad-43c4-afb8-6c93e71803a1} + + + {5bff06ec-c232-4dd2-8642-4e2ce64f31ef} + + + {bd9d5958-4e67-4bff-bbd8-6ba6dfcdb720} + + + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\cl_dll + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\cl_dll\hl + + + Source Files\_hl\cl_dll\hl + + + Source Files\_hl\cl_dll\hl + + + Source Files\_hl\cl_dll\hl + + + Source Files\_hl\dlls\wpn_shared + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\_hl\dlls + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\common + + + Source Files\pm_shared + + + Source Files\pm_shared + + + Source Files\pm_shared + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\game_shared + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\game_shared + + + Source Files\game_shared + + + Source Files\cl_dll + + + Source Files\game_shared + + + Source Files\game_shared + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\game_shared + + + Source Files\game_shared + + + Source Files\game_shared + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\cl_dll + + + Source Files\public + + + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\common + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\game_shared + + + Header Files\game_shared + + + Header Files\game_shared + + + Header Files\game_shared + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + Header Files\cl_dll + + + + + + \ No newline at end of file diff --git a/projects/vs2010/hldll.vcxproj b/projects/vs2010/hldll.vcxproj new file mode 100644 index 0000000..f38b395 --- /dev/null +++ b/projects/vs2010/hldll.vcxproj @@ -0,0 +1,258 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {69DDADC0-97F4-419E-86EB-C91781A0D2E0} + Win32Proj + hldll + + + + DynamicLibrary + true + NotSet + + + DynamicLibrary + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + hl + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + hl + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;CLIENT_WEAPONS;%(PreprocessorDefinitions) + true + ..\..\dlls;..\..\engine;..\..\common;..\..\pm_shared;..\..\game_shared;..\..\public;%(AdditionalIncludeDirectories) + MultiThreadedDebug + + + Windows + true + $(ProjectDir)..\..\dlls\hl.def + + + call ..\..\filecopy.bat $(TargetPath) ..\..\..\game\mod\dlls\$(TargetName).dll +call ..\..\filecopy.bat $(TargetDir)\$(TargetName).pdb ..\..\..\game\mod\dlls\$(TargetName).pdb + + + Performing Post-Build Event + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;CLIENT_WEAPONS;%(PreprocessorDefinitions) + ..\..\dlls;..\..\engine;..\..\common;..\..\pm_shared;..\..\game_shared;..\..\public;%(AdditionalIncludeDirectories) + MultiThreaded + true + + + Windows + true + true + true + $(ProjectDir)..\..\dlls\hl.def + + + call ..\..\filecopy.bat $(TargetPath) ..\..\..\game\mod\dlls\$(TargetName).dll +call ..\..\filecopy.bat $(TargetDir)\$(TargetName).pdb ..\..\..\game\mod\dlls\$(TargetName).pdb + + + Performing Post-Build Event + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/vs2010/hldll.vcxproj.filters b/projects/vs2010/hldll.vcxproj.filters new file mode 100644 index 0000000..09bdd4e --- /dev/null +++ b/projects/vs2010/hldll.vcxproj.filters @@ -0,0 +1,483 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {a59f65b1-455f-459d-bc2a-75775255cd5c} + + + {000b311c-d555-467e-b6cb-5e669fb8c45e} + + + {7f184267-1d16-4bbc-9212-a804fcd04e6a} + + + {9cd951c6-53c4-4c79-826f-13ac1af8a8b6} + + + {e3b69fef-bfa6-4270-8280-f2b25793ac4e} + + + {b85e935a-5cc8-482d-b85f-6cdaa3452ccb} + + + {37941113-16fa-4ce0-9bdd-a72a1ced8902} + + + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls\wpn_shared + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\pm_shared + + + Source Files\pm_shared + + + Source Files\pm_shared + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\game_shared + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + Source Files\dlls + + + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\engine + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\pm_shared + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + Header Files\dlls + + + \ No newline at end of file diff --git a/projects/vs2010/light.vcxproj b/projects/vs2010/light.vcxproj new file mode 100644 index 0000000..4882195 --- /dev/null +++ b/projects/vs2010/light.vcxproj @@ -0,0 +1,98 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + {1D9A402B-C7AB-4DAA-AD3F-42195F283E64} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/light.vcxproj.filters b/projects/vs2010/light.vcxproj.filters new file mode 100644 index 0000000..7b9da8d --- /dev/null +++ b/projects/vs2010/light.vcxproj.filters @@ -0,0 +1,63 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {63245e01-3884-4650-b2a4-90c672eb89e9} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\light + + + Source Files\utils\light + + + Source Files\utils\light + + + + + Header Files\utils\light + + + \ No newline at end of file diff --git a/projects/vs2010/makefont.vcxproj b/projects/vs2010/makefont.vcxproj new file mode 100644 index 0000000..a4f74b7 --- /dev/null +++ b/projects/vs2010/makefont.vcxproj @@ -0,0 +1,108 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + {C47ACACA-7DA4-4741-A287-9215309949E7} + Win32Proj + bspinfo + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../common;../../utils/common + + + Console + true + winmm.lib;%(AdditionalDependencies) + + + xcopy $(TargetPath) ..\..\..\valve /r /i + + + Copyint to valve\ + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../common;../../utils/common + + + Console + true + true + true + winmm.lib;%(AdditionalDependencies) + + + xcopy $(TargetPath) ..\..\..\valve /r /i + + + Copyint to valve\ + + + + + + \ No newline at end of file diff --git a/projects/vs2010/makefont.vcxproj.filters b/projects/vs2010/makefont.vcxproj.filters new file mode 100644 index 0000000..5652c27 --- /dev/null +++ b/projects/vs2010/makefont.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {673592e5-697a-4bb6-b06b-8104dcc2c470} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\makefont + + + + + Header Files\utils\common + + + Header Files\utils\common + + + \ No newline at end of file diff --git a/projects/vs2010/makels.vcxproj b/projects/vs2010/makels.vcxproj new file mode 100644 index 0000000..52dcb71 --- /dev/null +++ b/projects/vs2010/makels.vcxproj @@ -0,0 +1,90 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + {8D9315B8-D428-411B-A60F-6AFD3CE0A687} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/makels.vcxproj.filters b/projects/vs2010/makels.vcxproj.filters new file mode 100644 index 0000000..b818a51 --- /dev/null +++ b/projects/vs2010/makels.vcxproj.filters @@ -0,0 +1,28 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {63245e01-3884-4650-b2a4-90c672eb89e9} + + + + + Source Files\utils\makels + + + \ No newline at end of file diff --git a/projects/vs2010/mdlviewer.vcxproj b/projects/vs2010/mdlviewer.vcxproj new file mode 100644 index 0000000..9d2c80c --- /dev/null +++ b/projects/vs2010/mdlviewer.vcxproj @@ -0,0 +1,100 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + {348EA74B-9E7E-4F35-9474-69A5DB1B5A42} + Win32Proj + bspinfo + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common;../../common + + + Console + true + opengl32.lib;glu32.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common;../../common + + + Console + true + true + true + opengl32.lib;glu32.lib;%(AdditionalDependencies) + + + + + + \ No newline at end of file diff --git a/projects/vs2010/mdlviewer.vcxproj.filters b/projects/vs2010/mdlviewer.vcxproj.filters new file mode 100644 index 0000000..f225ce5 --- /dev/null +++ b/projects/vs2010/mdlviewer.vcxproj.filters @@ -0,0 +1,60 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {7906402f-88d4-4690-a65a-bc8b7c7fe8a0} + + + {a2b18871-ad87-49ac-8bfd-23c47a207fa5} + + + + + Source Files\utils\common + + + Source Files\utils\mdlviewer + + + Source Files\utils\mdlviewer + + + Source Files\utils\mdlviewer + + + + + Header Files\utils\mdlviewer + + + Header Files\utils\common + + + + + + \ No newline at end of file diff --git a/projects/vs2010/mkmovie.vcxproj b/projects/vs2010/mkmovie.vcxproj new file mode 100644 index 0000000..9cdbd0c --- /dev/null +++ b/projects/vs2010/mkmovie.vcxproj @@ -0,0 +1,92 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + {67FAB994-BEE5-4537-8E00-60259F66F654} + Win32Proj + bspinfo + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/mkmovie.vcxproj.filters b/projects/vs2010/mkmovie.vcxproj.filters new file mode 100644 index 0000000..d2331f6 --- /dev/null +++ b/projects/vs2010/mkmovie.vcxproj.filters @@ -0,0 +1,42 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {62158a60-3771-4525-8b2c-953f323849d8} + + + + + Source Files\utils\mkmovie + + + + + Header Files\utils\common + + + Header Files\utils\common + + + \ No newline at end of file diff --git a/projects/vs2010/procinfo.vcxproj b/projects/vs2010/procinfo.vcxproj new file mode 100644 index 0000000..37d329c --- /dev/null +++ b/projects/vs2010/procinfo.vcxproj @@ -0,0 +1,99 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {2DE8C1AF-56AE-4B99-8AA5-BEDBF33D6216} + v4.0 + ManagedCProj + procinfo + + + + StaticLibrary + true + MultiByte + + + StaticLibrary + false + MultiByte + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + + + true + + + + + attrib -r ..\..\utils\procinfo\lib\win32_vc6\procinfo.lib +copy $(TargetPath) ..\..\utils\procinfo\lib\win32_vc6\procinfo.lib + + + Post-Build Event + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + + + true + + + + + attrib -r ..\..\utils\procinfo\lib\win32_vc6\procinfo.lib +copy $(TargetPath) ..\..\utils\procinfo\lib\win32_vc6\procinfo.lib + Post-Build Event + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/vs2010/procinfo.vcxproj.filters b/projects/vs2010/procinfo.vcxproj.filters new file mode 100644 index 0000000..e61f872 --- /dev/null +++ b/projects/vs2010/procinfo.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {3d07af82-de85-47cb-bd87-125a9043c5ad} + + + {b8aff63a-415c-4e31-ad22-ba822090e8a2} + + + {acb9edd8-ccf7-4221-8893-0cd5a3368fbc} + + + {93d4c035-5f6d-4ffd-83c0-af849ad01f21} + + + + + Source Files\utils\procinfo + + + + + Header Files\utils\procinfo + + + \ No newline at end of file diff --git a/projects/vs2010/projects.sln b/projects/vs2010/projects.sln new file mode 100644 index 0000000..7934130 --- /dev/null +++ b/projects/vs2010/projects.sln @@ -0,0 +1,50 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hldll", "hldll.vcxproj", "{69DDADC0-97F4-419E-86EB-C91781A0D2E0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hl_cdll", "hl_cdll.vcxproj", "{DC1DD765-CFEB-47DA-A2EA-9F1E20A24272}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmcdll", "dmcdll.vcxproj", "{6C5EBEF4-40AE-4167-B3D5-26F0AB47E382}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmc_cdll", "dmc_cdll.vcxproj", "{50BD4CD5-4043-4457-BA51-7CF8FFC43767}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ricochetdll", "ricochetdll.vcxproj", "{CE8DCBE4-D8DB-46E5-8607-8FCC5FA667FB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ricochet_cdll", "ricochet_cdll.vcxproj", "{EA7DE935-F997-4EA8-9135-E2FE5E5D2C1B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {69DDADC0-97F4-419E-86EB-C91781A0D2E0}.Debug|Win32.ActiveCfg = Debug|Win32 + {69DDADC0-97F4-419E-86EB-C91781A0D2E0}.Debug|Win32.Build.0 = Debug|Win32 + {69DDADC0-97F4-419E-86EB-C91781A0D2E0}.Release|Win32.ActiveCfg = Release|Win32 + {69DDADC0-97F4-419E-86EB-C91781A0D2E0}.Release|Win32.Build.0 = Release|Win32 + {DC1DD765-CFEB-47DA-A2EA-9F1E20A24272}.Debug|Win32.ActiveCfg = Debug|Win32 + {DC1DD765-CFEB-47DA-A2EA-9F1E20A24272}.Debug|Win32.Build.0 = Debug|Win32 + {DC1DD765-CFEB-47DA-A2EA-9F1E20A24272}.Release|Win32.ActiveCfg = Release|Win32 + {DC1DD765-CFEB-47DA-A2EA-9F1E20A24272}.Release|Win32.Build.0 = Release|Win32 + {6C5EBEF4-40AE-4167-B3D5-26F0AB47E382}.Debug|Win32.ActiveCfg = Debug|Win32 + {6C5EBEF4-40AE-4167-B3D5-26F0AB47E382}.Debug|Win32.Build.0 = Debug|Win32 + {6C5EBEF4-40AE-4167-B3D5-26F0AB47E382}.Release|Win32.ActiveCfg = Release|Win32 + {6C5EBEF4-40AE-4167-B3D5-26F0AB47E382}.Release|Win32.Build.0 = Release|Win32 + {50BD4CD5-4043-4457-BA51-7CF8FFC43767}.Debug|Win32.ActiveCfg = Debug|Win32 + {50BD4CD5-4043-4457-BA51-7CF8FFC43767}.Debug|Win32.Build.0 = Debug|Win32 + {50BD4CD5-4043-4457-BA51-7CF8FFC43767}.Release|Win32.ActiveCfg = Release|Win32 + {50BD4CD5-4043-4457-BA51-7CF8FFC43767}.Release|Win32.Build.0 = Release|Win32 + {CE8DCBE4-D8DB-46E5-8607-8FCC5FA667FB}.Debug|Win32.ActiveCfg = Debug|Win32 + {CE8DCBE4-D8DB-46E5-8607-8FCC5FA667FB}.Debug|Win32.Build.0 = Debug|Win32 + {CE8DCBE4-D8DB-46E5-8607-8FCC5FA667FB}.Release|Win32.ActiveCfg = Release|Win32 + {CE8DCBE4-D8DB-46E5-8607-8FCC5FA667FB}.Release|Win32.Build.0 = Release|Win32 + {EA7DE935-F997-4EA8-9135-E2FE5E5D2C1B}.Debug|Win32.ActiveCfg = Debug|Win32 + {EA7DE935-F997-4EA8-9135-E2FE5E5D2C1B}.Debug|Win32.Build.0 = Debug|Win32 + {EA7DE935-F997-4EA8-9135-E2FE5E5D2C1B}.Release|Win32.ActiveCfg = Release|Win32 + {EA7DE935-F997-4EA8-9135-E2FE5E5D2C1B}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/projects/vs2010/qbsp2.vcxproj b/projects/vs2010/qbsp2.vcxproj new file mode 100644 index 0000000..2edba44 --- /dev/null +++ b/projects/vs2010/qbsp2.vcxproj @@ -0,0 +1,111 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + {415A5B85-BEA0-4F96-BBB6-5447E4CF726F} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;DOUBLEVEC_T;_NOENUMQBOOL;%(PreprocessorDefinitions) + ../../utils/common;..\..\external + + + Console + true + opengl32.lib;glu32.lib;glaux.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;DOUBLEVEC_T;%(PreprocessorDefinitions) + ../../utils/common;..\..\external + + + Console + true + true + true + opengl32.lib;glu32.lib;glaux.lib;%(AdditionalDependencies) + + + + + + \ No newline at end of file diff --git a/projects/vs2010/qbsp2.vcxproj.filters b/projects/vs2010/qbsp2.vcxproj.filters new file mode 100644 index 0000000..f3a6f19 --- /dev/null +++ b/projects/vs2010/qbsp2.vcxproj.filters @@ -0,0 +1,99 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {d644c063-b652-4ccb-8bcb-f55aad917c62} + + + {b5377a13-8c89-4fca-9dc1-d94312a449cd} + + + + + Header Files\utils\qbsp2 + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\qbsp2 + + + Source Files\utils\qbsp2 + + + Source Files\utils\qbsp2 + + + Source Files\utils\qbsp2 + + + Source Files\utils\qbsp2 + + + Source Files\utils\qbsp2 + + + Source Files\utils\qbsp2 + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\qbsp2 + + + Source Files\utils\qbsp2 + + + \ No newline at end of file diff --git a/projects/vs2010/qcsg.vcxproj b/projects/vs2010/qcsg.vcxproj new file mode 100644 index 0000000..8a08901 --- /dev/null +++ b/projects/vs2010/qcsg.vcxproj @@ -0,0 +1,110 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + {0F44E796-FAFD-4D52-91DE-707B5FB27841} + Win32Proj + bspinfo + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;DOUBLEVEC_T;%(PreprocessorDefinitions) + ../../utils/common;../../external + + + Console + true + opengl32.lib;glu32.lib;glaux.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;DOUBLEVEC_T;%(PreprocessorDefinitions) + ../../utils/common;../../external + + + Console + true + true + true + opengl32.lib;glu32.lib;glaux.lib;%(AdditionalDependencies) + + + + + + \ No newline at end of file diff --git a/projects/vs2010/qcsg.vcxproj.filters b/projects/vs2010/qcsg.vcxproj.filters new file mode 100644 index 0000000..880ceb1 --- /dev/null +++ b/projects/vs2010/qcsg.vcxproj.filters @@ -0,0 +1,96 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {c207af92-a0f3-402b-b5c1-7ae72a1d972c} + + + {a4552d55-15d2-4b83-850f-cef12647285f} + + + + + Source Files\utils\qcsg + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\qcsg + + + Source Files\utils\qcsg + + + Source Files\utils\qcsg + + + Source Files\utils\qcsg + + + Source Files\utils\qcsg + + + Source Files\utils\common + + + Source Files\utils\common + + + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\qcsg + + + \ No newline at end of file diff --git a/projects/vs2010/qlumpy.vcxproj b/projects/vs2010/qlumpy.vcxproj new file mode 100644 index 0000000..934e2e1 --- /dev/null +++ b/projects/vs2010/qlumpy.vcxproj @@ -0,0 +1,100 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + {01780C5F-55A2-41D4-B27F-6383BB549DE4} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/qlumpy.vcxproj.filters b/projects/vs2010/qlumpy.vcxproj.filters new file mode 100644 index 0000000..b0206ba --- /dev/null +++ b/projects/vs2010/qlumpy.vcxproj.filters @@ -0,0 +1,72 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {40830782-1c0d-42a8-85f0-09f7e3f4ff75} + + + {b2425109-9ba3-4a19-9a54-7451f3a87a23} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\qlumpy + + + Source Files\utils\qlumpy + + + + + Header Files\utils\qlumpy + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + \ No newline at end of file diff --git a/projects/vs2010/qrad.vcxproj b/projects/vs2010/qrad.vcxproj new file mode 100644 index 0000000..e4f1b64 --- /dev/null +++ b/projects/vs2010/qrad.vcxproj @@ -0,0 +1,106 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + {A015F691-DF6B-4E05-AB3B-4B0A55C13EDC} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/qrad.vcxproj.filters b/projects/vs2010/qrad.vcxproj.filters new file mode 100644 index 0000000..f6de4f7 --- /dev/null +++ b/projects/vs2010/qrad.vcxproj.filters @@ -0,0 +1,90 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {bcc621aa-c3f2-45d3-8c92-d4c1dab462b4} + + + {67707ba9-3f42-423a-9494-4cbdce9f8710} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\qrad + + + Source Files\utils\qrad + + + Source Files\utils\qrad + + + Source Files\utils\qrad + + + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\qrad + + + \ No newline at end of file diff --git a/projects/vs2010/readme.txt b/projects/vs2010/readme.txt new file mode 100644 index 0000000..20b6b0d --- /dev/null +++ b/projects/vs2010/readme.txt @@ -0,0 +1,147 @@ +Directory Contents +================== + +projects.sln + Solution file for Visual C++ 2010 Express, containing the main projects for + compiling the valve, dmc and ricochet DLL files. + +utils.sln + Solution file containing projects for the utilities. + Special user interaction is required in order to compile a share of the + projects, see "Installing GLUT and GLAUX" bellow. + Special user interaction is also required for the smdlexp project, see + "smdlexp project" bellow. + The serverctrl project is problematic, see "serverctrl project" bellow. + Further project specific notes are also provided bellow. + +[other required files] + + + +Installing GLUT and GLAUX +========================= + +Some projects in utils.sln use the GLUT (mdlviwer) and the GLAUX (qbsp2, qcsg) +libraries, which are not shipped with Visual C++ 2010 Express / Windows SDK +v7.0A. + +Thus you need to install the GLUT and GLAUX libraries manually: + + +Installing GLUT library +----------------------- + +Required by: mdlviewer + +There are several ways to do this, an example can be found here: +http://stackoverflow.com/a/10467488 + +For alternate implementations check the web (i.e. freeglut). + + +Installing GLAUX library: +------------------------- + +Required by: qbsp2, qcsg + +Obtaining the library: +http://stackoverflow.com/a/6211119 + +Copy glaux.h into 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\GL\' +(You might need to create the GL directory.). +Copy glaux.lib into 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\'. + + +TODO +---- + +In the future the projects using GLUT and GLAUX could be ported to use the SDL2 +library shipped with the SDK, this should be fairly easy, however this might +be beyond the scope of the main repository. + + + +Other +===== + +Please note, that some of the utils have additional documentation (.doc / .txt) +in the appropriate sub-folders of the utils folder. + + + +qrad project +============ + +Please not that qrad.exe requires additional files lights.rad and valve.rad +side-by-side. You can find those files in the Half-Life SDK in the Hammer +tools folder. + + + +serverctrl project +================== + +The serverctrl project is problematic for the following reasons: +- It doesn't seem to work anymore, I tried with a recent HLDS beta installation + from steamcmd (make sure to set the hardcoded path in ServerCtrlDlg.cpp line + 477, i.e. to "." (which would mean current directory) or s.th. you like). + While the hlds.exe seems to know about the -HFILE -HCHILD and -HPARENT + command line arguments used by serverctrl, it doesn't seem to handle the + events properly anymore. +- It requires MFC to be installed and needs to be configured in order to find + the MFC installation (see "Installing MFC" bellow). + +A further note: +The serverctrl.vcxproj differs from the original .dsp project a bit: +It is compiled against dynamic libraries (MFC and Windows Runtime), meaning +/MD or /MDd instead of /MT or /MTd now. The reason is that the MFC from the +Windows Driver Kit won't compile in static mode (missing resource files i.e.). +This means you'll have to redistribute the runtime and MFC DLLs along with +serverctrl in case you install it on another system. + + +Installing MFC +-------------- + +Required by: serverctrl + +If you are not using an Express edition, you can most likely skip this step. + +The MFC is also shipped as part of the Windows Driver Kit for Windows XP. + +Download Windows Driver Kit Version 7.1.0: +http://www.microsoft.com/en-us/download/details.aspx?id=11800 + +Burn it to a CD and start KitSetup.exe. +It's enough to select "Build Environment" in the options you want to install. + +Now we need to point Visual C++ 2010 Express to the folders for the MFC/ATL +includes and libraries: + +To do this open utils.sln and right click the serverctrl project and select +Properties. Select Configuration: All Configurations, then select +Configuration -> VC++ Directories in the tree. Adjust the Include and +Library Directories settings to match your WDK installation (click on the lines +and then click on the drop-down selector that appears and select edit). + + + +smdlexp project +=============== + +Please note that this project requires the 3D Studio Max 4.2 SDK. +You might need to adjust Include and Additional Library Directories according +to your intallation in C++ and Linker settings. + +The MAX 4.2 SDK needs adjustment: +Comment out the following line in max.h +#include +So that it reads +//#include + + + + Debug + Win32 + + + Release + Win32 + + + + {AF96A753-E234-4692-90AB-CCD802E34E9C} + Win32Proj + serverctrl + + + + Application + true + MultiByte + Dynamic + + + Application + false + true + MultiByte + Dynamic + + + + + + + + + + + + + true + E:\WinDDK\7600.16385.1\inc\atl71;E:\WinDDK\7600.16385.1\inc\mfc42;$(IncludePath) + E:\WinDDK\7600.16385.1\lib\ATL\i386;E:\WinDDK\7600.16385.1\lib\Mfc\i386;$(LibraryPath) + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + E:\WinDDK\7600.16385.1\inc\atl71;E:\WinDDK\7600.16385.1\inc\mfc42;$(IncludePath) + E:\WinDDK\7600.16385.1\lib\ATL\i386;E:\WinDDK\7600.16385.1\lib\Mfc\i386;$(LibraryPath) + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Windows + true + winmm.lib;%(AdditionalDependencies) + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Windows + true + true + true + winmm.lib;%(AdditionalDependencies) + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/vs2010/serverctrl.vcxproj.filters b/projects/vs2010/serverctrl.vcxproj.filters new file mode 100644 index 0000000..7cbe9ef --- /dev/null +++ b/projects/vs2010/serverctrl.vcxproj.filters @@ -0,0 +1,76 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {b6851a08-110d-4b63-97bb-002b6c26576e} + + + {b210c226-0069-49ec-87ea-a3c9c16d737b} + + + {7ffbb312-a0a2-4787-af0a-d3e499f4c628} + + + {5de03485-5c29-4f54-95df-161e73d864e2} + + + {1b20963c-0f73-4f11-a8ff-8cec4041bf4c} + + + {f55832d2-48da-4c3e-90bd-66f24f495211} + + + {d2b2c612-d341-4167-80d5-a49ae6887f4a} + + + + + Source Files\utils\servertrl + + + Source Files\utils\servertrl + + + Source Files\utils\servertrl + + + + + Header Files\utils\serverctrl + + + Header Files\utils\serverctrl + + + Header Files\utils\serverctrl + + + Header Files\utils\serverctrl + + + + + Source Files\utils\servertrl + + + + + Resource Files\utils\serverctrl\res + + + Resource Files\utils\serverctrl\res + + + \ No newline at end of file diff --git a/projects/vs2010/smdlexp.vcxproj b/projects/vs2010/smdlexp.vcxproj new file mode 100644 index 0000000..726ce8c --- /dev/null +++ b/projects/vs2010/smdlexp.vcxproj @@ -0,0 +1,119 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {4BFEAD42-DBED-40F0-B30E-E5AF9EBA59A8} + v4.0 + ManagedCProj + procinfo + + + + DynamicLibrary + true + MultiByte + + + DynamicLibrary + false + MultiByte + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + c:\3dsmax42\maxsdk\include;c:\3dsmax42\cstudio\sdk;%(AdditionalIncludeDirectories) + false + + + true + COMCTL32.LIB;maxutil.lib;geom.lib;mesh.lib;core.lib;%(AdditionalDependencies) + c:\3dsmax42\maxsdk\lib;%(AdditionalLibraryDirectories) + c:\3dsmax42\plugins\smdlexp.dle + $(ProjectDir)..\..\utils\smdlexp\smdlexp.def + + + + + + + Post-Build Event + + + COMCTL32.LIB;maxutil.lib;geom.lib;mesh.lib;core.lib;%(AdditionalDependencies) + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + c:\3dsmax42\maxsdk\include;c:\3dsmax42\cstudio\sdk;%(AdditionalIncludeDirectories) + false + + + true + COMCTL32.LIB;maxutil.lib;geom.lib;mesh.lib;core.lib;%(AdditionalDependencies) + c:\3dsmax42\maxsdk\lib;%(AdditionalLibraryDirectories) + c:\3dsmax42\plugins\smdlexp.dle + $(ProjectDir)..\..\utils\smdlexp\smdlexp.def + + + + + Post-Build Event + + + COMCTL32.LIB;maxutil.lib;geom.lib;mesh.lib;core.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/vs2010/smdlexp.vcxproj.filters b/projects/vs2010/smdlexp.vcxproj.filters new file mode 100644 index 0000000..bec4eb7 --- /dev/null +++ b/projects/vs2010/smdlexp.vcxproj.filters @@ -0,0 +1,55 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {3d07af82-de85-47cb-bd87-125a9043c5ad} + + + {acb9edd8-ccf7-4221-8893-0cd5a3368fbc} + + + {c35dd471-5706-455f-bd22-6964d0906c6e} + + + {17940ef9-04e1-45c8-b52e-7030fbd6de03} + + + {3980e5e7-942c-40ad-9660-0a40a185ede0} + + + {d82ea4d8-83a8-4071-b2c6-379a38d00c5b} + + + + + Resource Files\utils\smdlexp + + + + + Source Files\utils\smdlexp + + + + + Source Files\utils\smdlexp + + + + + Header Files\utils\smdlexp + + + \ No newline at end of file diff --git a/projects/vs2010/sprgen.vcxproj b/projects/vs2010/sprgen.vcxproj new file mode 100644 index 0000000..ecbd79f --- /dev/null +++ b/projects/vs2010/sprgen.vcxproj @@ -0,0 +1,97 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + {2ADCE88F-5117-4D09-BE30-C8CBE902203E} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/sprgen.vcxproj.filters b/projects/vs2010/sprgen.vcxproj.filters new file mode 100644 index 0000000..5dd377d --- /dev/null +++ b/projects/vs2010/sprgen.vcxproj.filters @@ -0,0 +1,63 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {b4223f35-828f-4e8c-a089-ba9f4ca7e0ac} + + + {a02f46e8-81c1-476c-a7f2-b222251f96e7} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\sprgen + + + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\sprgen + + + \ No newline at end of file diff --git a/projects/vs2010/studiomdl.vcxproj b/projects/vs2010/studiomdl.vcxproj new file mode 100644 index 0000000..97d2c6b --- /dev/null +++ b/projects/vs2010/studiomdl.vcxproj @@ -0,0 +1,104 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + {5A257608-0B80-42ED-A037-C2A02E878301} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common;../../common;../../public + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common;../../common;../../public + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/studiomdl.vcxproj.filters b/projects/vs2010/studiomdl.vcxproj.filters new file mode 100644 index 0000000..ac9c9fe --- /dev/null +++ b/projects/vs2010/studiomdl.vcxproj.filters @@ -0,0 +1,84 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {11d3635c-ec17-499c-aed9-8ccc565db4ce} + + + {d8c1382c-f41c-4569-a63d-a9bb68fb7a8a} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\studiomdl + + + Source Files\utils\studiomdl + + + Source Files\utils\studiomdl + + + Source Files\utils\studiomdl + + + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\studiomdl + + + \ No newline at end of file diff --git a/projects/vs2010/utils.sln b/projects/vs2010/utils.sln new file mode 100644 index 0000000..da8b3ee --- /dev/null +++ b/projects/vs2010/utils.sln @@ -0,0 +1,116 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bspinfo", "bspinfo.vcxproj", "{B1227C36-C02C-4914-9675-C6D243D8B36E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "light", "light.vcxproj", "{1D9A402B-C7AB-4DAA-AD3F-42195F283E64}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makefont", "makefont.vcxproj", "{C47ACACA-7DA4-4741-A287-9215309949E7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makels", "makels.vcxproj", "{8D9315B8-D428-411B-A60F-6AFD3CE0A687}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdlviewer", "mdlviewer.vcxproj", "{348EA74B-9E7E-4F35-9474-69A5DB1B5A42}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mkmovie", "mkmovie.vcxproj", "{67FAB994-BEE5-4537-8E00-60259F66F654}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "procinfo", "procinfo.vcxproj", "{2DE8C1AF-56AE-4B99-8AA5-BEDBF33D6216}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qbsp2", "qbsp2.vcxproj", "{415A5B85-BEA0-4F96-BBB6-5447E4CF726F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qcsg", "qcsg.vcxproj", "{0F44E796-FAFD-4D52-91DE-707B5FB27841}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qlumpy", "qlumpy.vcxproj", "{01780C5F-55A2-41D4-B27F-6383BB549DE4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qrad", "qrad.vcxproj", "{A015F691-DF6B-4E05-AB3B-4B0A55C13EDC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smdlexp", "smdlexp.vcxproj", "{4BFEAD42-DBED-40F0-B30E-E5AF9EBA59A8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sprgen", "sprgen.vcxproj", "{2ADCE88F-5117-4D09-BE30-C8CBE902203E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studiomdl", "studiomdl.vcxproj", "{5A257608-0B80-42ED-A037-C2A02E878301}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vis", "vis.vcxproj", "{6CAC4D26-13B7-4701-A097-94C01340B345}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xwad", "xwad.vcxproj", "{8A13BDB4-772F-4D03-B343-B56A6D412149}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "serverctrl", "serverctrl.vcxproj", "{AF96A753-E234-4692-90AB-CCD802E34E9C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1227C36-C02C-4914-9675-C6D243D8B36E}.Debug|Win32.ActiveCfg = Debug|Win32 + {B1227C36-C02C-4914-9675-C6D243D8B36E}.Debug|Win32.Build.0 = Debug|Win32 + {B1227C36-C02C-4914-9675-C6D243D8B36E}.Release|Win32.ActiveCfg = Release|Win32 + {B1227C36-C02C-4914-9675-C6D243D8B36E}.Release|Win32.Build.0 = Release|Win32 + {1D9A402B-C7AB-4DAA-AD3F-42195F283E64}.Debug|Win32.ActiveCfg = Debug|Win32 + {1D9A402B-C7AB-4DAA-AD3F-42195F283E64}.Debug|Win32.Build.0 = Debug|Win32 + {1D9A402B-C7AB-4DAA-AD3F-42195F283E64}.Release|Win32.ActiveCfg = Release|Win32 + {1D9A402B-C7AB-4DAA-AD3F-42195F283E64}.Release|Win32.Build.0 = Release|Win32 + {C47ACACA-7DA4-4741-A287-9215309949E7}.Debug|Win32.ActiveCfg = Debug|Win32 + {C47ACACA-7DA4-4741-A287-9215309949E7}.Debug|Win32.Build.0 = Debug|Win32 + {C47ACACA-7DA4-4741-A287-9215309949E7}.Release|Win32.ActiveCfg = Release|Win32 + {C47ACACA-7DA4-4741-A287-9215309949E7}.Release|Win32.Build.0 = Release|Win32 + {8D9315B8-D428-411B-A60F-6AFD3CE0A687}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D9315B8-D428-411B-A60F-6AFD3CE0A687}.Debug|Win32.Build.0 = Debug|Win32 + {8D9315B8-D428-411B-A60F-6AFD3CE0A687}.Release|Win32.ActiveCfg = Release|Win32 + {8D9315B8-D428-411B-A60F-6AFD3CE0A687}.Release|Win32.Build.0 = Release|Win32 + {348EA74B-9E7E-4F35-9474-69A5DB1B5A42}.Debug|Win32.ActiveCfg = Debug|Win32 + {348EA74B-9E7E-4F35-9474-69A5DB1B5A42}.Debug|Win32.Build.0 = Debug|Win32 + {348EA74B-9E7E-4F35-9474-69A5DB1B5A42}.Release|Win32.ActiveCfg = Release|Win32 + {348EA74B-9E7E-4F35-9474-69A5DB1B5A42}.Release|Win32.Build.0 = Release|Win32 + {67FAB994-BEE5-4537-8E00-60259F66F654}.Debug|Win32.ActiveCfg = Debug|Win32 + {67FAB994-BEE5-4537-8E00-60259F66F654}.Debug|Win32.Build.0 = Debug|Win32 + {67FAB994-BEE5-4537-8E00-60259F66F654}.Release|Win32.ActiveCfg = Release|Win32 + {67FAB994-BEE5-4537-8E00-60259F66F654}.Release|Win32.Build.0 = Release|Win32 + {2DE8C1AF-56AE-4B99-8AA5-BEDBF33D6216}.Debug|Win32.ActiveCfg = Debug|Win32 + {2DE8C1AF-56AE-4B99-8AA5-BEDBF33D6216}.Debug|Win32.Build.0 = Debug|Win32 + {2DE8C1AF-56AE-4B99-8AA5-BEDBF33D6216}.Release|Win32.ActiveCfg = Release|Win32 + {2DE8C1AF-56AE-4B99-8AA5-BEDBF33D6216}.Release|Win32.Build.0 = Release|Win32 + {415A5B85-BEA0-4F96-BBB6-5447E4CF726F}.Debug|Win32.ActiveCfg = Debug|Win32 + {415A5B85-BEA0-4F96-BBB6-5447E4CF726F}.Debug|Win32.Build.0 = Debug|Win32 + {415A5B85-BEA0-4F96-BBB6-5447E4CF726F}.Release|Win32.ActiveCfg = Release|Win32 + {415A5B85-BEA0-4F96-BBB6-5447E4CF726F}.Release|Win32.Build.0 = Release|Win32 + {0F44E796-FAFD-4D52-91DE-707B5FB27841}.Debug|Win32.ActiveCfg = Debug|Win32 + {0F44E796-FAFD-4D52-91DE-707B5FB27841}.Debug|Win32.Build.0 = Debug|Win32 + {0F44E796-FAFD-4D52-91DE-707B5FB27841}.Release|Win32.ActiveCfg = Release|Win32 + {0F44E796-FAFD-4D52-91DE-707B5FB27841}.Release|Win32.Build.0 = Release|Win32 + {01780C5F-55A2-41D4-B27F-6383BB549DE4}.Debug|Win32.ActiveCfg = Debug|Win32 + {01780C5F-55A2-41D4-B27F-6383BB549DE4}.Debug|Win32.Build.0 = Debug|Win32 + {01780C5F-55A2-41D4-B27F-6383BB549DE4}.Release|Win32.ActiveCfg = Release|Win32 + {01780C5F-55A2-41D4-B27F-6383BB549DE4}.Release|Win32.Build.0 = Release|Win32 + {A015F691-DF6B-4E05-AB3B-4B0A55C13EDC}.Debug|Win32.ActiveCfg = Debug|Win32 + {A015F691-DF6B-4E05-AB3B-4B0A55C13EDC}.Debug|Win32.Build.0 = Debug|Win32 + {A015F691-DF6B-4E05-AB3B-4B0A55C13EDC}.Release|Win32.ActiveCfg = Release|Win32 + {A015F691-DF6B-4E05-AB3B-4B0A55C13EDC}.Release|Win32.Build.0 = Release|Win32 + {4BFEAD42-DBED-40F0-B30E-E5AF9EBA59A8}.Debug|Win32.ActiveCfg = Debug|Win32 + {4BFEAD42-DBED-40F0-B30E-E5AF9EBA59A8}.Debug|Win32.Build.0 = Debug|Win32 + {4BFEAD42-DBED-40F0-B30E-E5AF9EBA59A8}.Release|Win32.ActiveCfg = Release|Win32 + {4BFEAD42-DBED-40F0-B30E-E5AF9EBA59A8}.Release|Win32.Build.0 = Release|Win32 + {2ADCE88F-5117-4D09-BE30-C8CBE902203E}.Debug|Win32.ActiveCfg = Debug|Win32 + {2ADCE88F-5117-4D09-BE30-C8CBE902203E}.Debug|Win32.Build.0 = Debug|Win32 + {2ADCE88F-5117-4D09-BE30-C8CBE902203E}.Release|Win32.ActiveCfg = Release|Win32 + {2ADCE88F-5117-4D09-BE30-C8CBE902203E}.Release|Win32.Build.0 = Release|Win32 + {5A257608-0B80-42ED-A037-C2A02E878301}.Debug|Win32.ActiveCfg = Debug|Win32 + {5A257608-0B80-42ED-A037-C2A02E878301}.Debug|Win32.Build.0 = Debug|Win32 + {5A257608-0B80-42ED-A037-C2A02E878301}.Release|Win32.ActiveCfg = Release|Win32 + {5A257608-0B80-42ED-A037-C2A02E878301}.Release|Win32.Build.0 = Release|Win32 + {6CAC4D26-13B7-4701-A097-94C01340B345}.Debug|Win32.ActiveCfg = Debug|Win32 + {6CAC4D26-13B7-4701-A097-94C01340B345}.Debug|Win32.Build.0 = Debug|Win32 + {6CAC4D26-13B7-4701-A097-94C01340B345}.Release|Win32.ActiveCfg = Release|Win32 + {6CAC4D26-13B7-4701-A097-94C01340B345}.Release|Win32.Build.0 = Release|Win32 + {8A13BDB4-772F-4D03-B343-B56A6D412149}.Debug|Win32.ActiveCfg = Debug|Win32 + {8A13BDB4-772F-4D03-B343-B56A6D412149}.Debug|Win32.Build.0 = Debug|Win32 + {8A13BDB4-772F-4D03-B343-B56A6D412149}.Release|Win32.ActiveCfg = Release|Win32 + {8A13BDB4-772F-4D03-B343-B56A6D412149}.Release|Win32.Build.0 = Release|Win32 + {AF96A753-E234-4692-90AB-CCD802E34E9C}.Debug|Win32.ActiveCfg = Debug|Win32 + {AF96A753-E234-4692-90AB-CCD802E34E9C}.Debug|Win32.Build.0 = Debug|Win32 + {AF96A753-E234-4692-90AB-CCD802E34E9C}.Release|Win32.ActiveCfg = Release|Win32 + {AF96A753-E234-4692-90AB-CCD802E34E9C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/projects/vs2010/vis.vcxproj b/projects/vs2010/vis.vcxproj new file mode 100644 index 0000000..a80a218 --- /dev/null +++ b/projects/vs2010/vis.vcxproj @@ -0,0 +1,105 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + {6CAC4D26-13B7-4701-A097-94C01340B345} + Win32Proj + bspinfo + + + + Application + true + NotSet + + + Application + false + true + NotSet + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/vis.vcxproj.filters b/projects/vs2010/vis.vcxproj.filters new file mode 100644 index 0000000..6b4e4af --- /dev/null +++ b/projects/vs2010/vis.vcxproj.filters @@ -0,0 +1,90 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {6a461af5-7f20-49f1-b81b-684bd6dacbcc} + + + {c1ec9e3b-b79b-41c2-9151-22820cd13949} + + + {da7d197c-82da-4691-afd9-0249b0436923} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\vis + + + Source Files\utils\vis + + + Source Files\utils\vis + + + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\vis + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\common + + + Header Files\utils\qbsp2 + + + \ No newline at end of file diff --git a/projects/vs2010/xwad.vcxproj b/projects/vs2010/xwad.vcxproj new file mode 100644 index 0000000..2dc4550 --- /dev/null +++ b/projects/vs2010/xwad.vcxproj @@ -0,0 +1,91 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + {8A13BDB4-772F-4D03-B343-B56A6D412149} + Win32Proj + bspinfo + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + true + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + false + $(Configuration)\$(ProjectName)\ + $(Configuration)\$(ProjectName)\int\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;DOUBLEVEC_T;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;DOUBLEVEC_T;%(PreprocessorDefinitions) + ../../utils/common + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/projects/vs2010/xwad.vcxproj.filters b/projects/vs2010/xwad.vcxproj.filters new file mode 100644 index 0000000..5d16071 --- /dev/null +++ b/projects/vs2010/xwad.vcxproj.filters @@ -0,0 +1,49 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d5586ccb-fc7d-4e19-8bde-8656f3036ed7} + + + {23430839-825c-42f8-87f8-5ae8dbcbb612} + + + {b9529791-81ac-4e1b-86b7-e3ae05d40193} + + + {9e2cd4d4-3990-41a2-ae01-1cdcaeb123b2} + + + {ec10acce-757c-4a52-8d45-a0ff3057eef4} + + + {a00d342e-ddd3-4ad1-8c9e-28f591981c0a} + + + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\common + + + Source Files\utils\xwad + + + \ No newline at end of file diff --git a/public/FileSystem.h b/public/FileSystem.h new file mode 100644 index 0000000..f5ba9ca --- /dev/null +++ b/public/FileSystem.h @@ -0,0 +1,188 @@ +//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef FILESYSTEM_H +#define FILESYSTEM_H +#ifdef _WIN32 +#pragma once +#endif + +#include "archtypes.h" // DAL +#include "interface.h" + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +typedef void * FileHandle_t; +typedef int FileFindHandle_t; +typedef int WaitForResourcesHandle_t; + + +//----------------------------------------------------------------------------- +// Enums used by the interface +//----------------------------------------------------------------------------- +#ifndef FILESYSTEM_INTERNAL_H +typedef enum +{ + FILESYSTEM_SEEK_HEAD = 0, + FILESYSTEM_SEEK_CURRENT, + FILESYSTEM_SEEK_TAIL, +} FileSystemSeek_t; + +enum +{ + FILESYSTEM_INVALID_FIND_HANDLE = -1 +}; + +typedef enum +{ + // Don't print anything + FILESYSTEM_WARNING_QUIET = 0, + + // On shutdown, report names of files left unclosed + FILESYSTEM_WARNING_REPORTUNCLOSED, + + // Report number of times a file was opened, closed + FILESYSTEM_WARNING_REPORTUSAGE, + + // Report all open/close events to console ( !slow! ) + FILESYSTEM_WARNING_REPORTALLACCESSES +} FileWarningLevel_t; + +#define FILESYSTEM_INVALID_HANDLE ( FileHandle_t )0 +#endif + +// turn off any windows defines +#undef GetCurrentDirectory + +//----------------------------------------------------------------------------- +// Purpose: Main file system interface +//----------------------------------------------------------------------------- +class IFileSystem : public IBaseInterface +{ +public: + // Mount and unmount the filesystem + virtual void Mount(void) = 0; + virtual void Unmount(void) = 0; + + // Remove all search paths (including write path?) + virtual void RemoveAllSearchPaths( void ) = 0; + + // Add paths in priority order (mod dir, game dir, ....) + // If one or more .pak files are in the specified directory, then they are + // added after the file system path + // If the path is the relative path to a .bsp file, then any previous .bsp file + // override is cleared and the current .bsp is searched for an embedded PAK file + // and this file becomes the highest priority search path ( i.e., it's looked at first + // even before the mod's file system path ). + virtual void AddSearchPath( const char *pPath, const char *pathID ) = 0; + virtual bool RemoveSearchPath( const char *pPath ) = 0; + + // Deletes a file + virtual void RemoveFile( const char *pRelativePath, const char *pathID ) = 0; + + // this isn't implementable on STEAM as is. + virtual void CreateDirHierarchy( const char *path, const char *pathID ) = 0; + + // File I/O and info + virtual bool FileExists( const char *pFileName ) = 0; + virtual bool IsDirectory( const char *pFileName ) = 0; + + // opens a file + // if pathID is NULL, all paths will be searched for the file + virtual FileHandle_t Open( const char *pFileName, const char *pOptions, const char *pathID = 0L ) = 0; + + virtual void Close( FileHandle_t file ) = 0; + + virtual void Seek( FileHandle_t file, int pos, FileSystemSeek_t seekType ) = 0; + virtual unsigned int Tell( FileHandle_t file ) = 0; + + virtual unsigned int Size( FileHandle_t file ) = 0; + virtual unsigned int Size( const char *pFileName ) = 0; + + virtual long GetFileTime( const char *pFileName ) = 0; + virtual void FileTimeToString( char* pStrip, int maxCharsIncludingTerminator, long fileTime ) = 0; + + virtual bool IsOk( FileHandle_t file ) = 0; + + virtual void Flush( FileHandle_t file ) = 0; + virtual bool EndOfFile( FileHandle_t file ) = 0; + + virtual int Read( void* pOutput, int size, FileHandle_t file ) = 0; + virtual int Write( void const* pInput, int size, FileHandle_t file ) = 0; + virtual char *ReadLine( char *pOutput, int maxChars, FileHandle_t file ) = 0; + virtual int FPrintf( FileHandle_t file, char *pFormat, ... ) = 0; + + // direct filesystem buffer access + // returns a handle to a buffer containing the file data + // this is the optimal way to access the complete data for a file, + // since the file preloader has probably already got it in memory + virtual void *GetReadBuffer( FileHandle_t file, int *outBufferSize, bool failIfNotInCache ) = 0; + virtual void ReleaseReadBuffer( FileHandle_t file, void *readBuffer ) = 0; + + // FindFirst/FindNext + virtual const char *FindFirst( const char *pWildCard, FileFindHandle_t *pHandle, const char *pathID = 0L ) = 0; + virtual const char *FindNext( FileFindHandle_t handle ) = 0; + virtual bool FindIsDirectory( FileFindHandle_t handle ) = 0; + virtual void FindClose( FileFindHandle_t handle ) = 0; + + virtual void GetLocalCopy( const char *pFileName ) = 0; + + virtual const char *GetLocalPath( const char *pFileName, char *pLocalPath, int localPathBufferSize ) = 0; + + // Note: This is sort of a secondary feature; but it's really useful to have it here + virtual char *ParseFile( char* pFileBytes, char* pToken, bool* pWasQuoted ) = 0; + + // Returns true on success ( based on current list of search paths, otherwise false if + // it can't be resolved ) + virtual bool FullPathToRelativePath( const char *pFullpath, char *pRelative ) = 0; + + // Gets the current working directory + virtual bool GetCurrentDirectory( char* pDirectory, int maxlen ) = 0; + + // Dump to printf/OutputDebugString the list of files that have not been closed + virtual void PrintOpenedFiles( void ) = 0; + + virtual void SetWarningFunc( void (*pfnWarning)( const char *fmt, ... ) ) = 0; + virtual void SetWarningLevel( FileWarningLevel_t level ) = 0; + + virtual void LogLevelLoadStarted( const char *name ) = 0; + virtual void LogLevelLoadFinished( const char *name ) = 0; + virtual int HintResourceNeed( const char *hintlist, int forgetEverything ) = 0; + virtual int PauseResourcePreloading( void ) = 0; + virtual int ResumeResourcePreloading( void ) = 0; + virtual int SetVBuf( FileHandle_t stream, char *buffer, int mode, long size ) = 0; + virtual void GetInterfaceVersion( char *p, int maxlen ) = 0; + virtual bool IsFileImmediatelyAvailable(const char *pFileName) = 0; + + // starts waiting for resources to be available + // returns FILESYSTEM_INVALID_HANDLE if there is nothing to wait on + virtual WaitForResourcesHandle_t WaitForResources( const char *resourcelist ) = 0; + // get progress on waiting for resources; progress is a float [0, 1], complete is true on the waiting being done + // returns false if no progress is available + // any calls after complete is true or on an invalid handle will return false, 0.0f, true + virtual bool GetWaitForResourcesProgress( WaitForResourcesHandle_t handle, float *progress /* out */ , bool *complete /* out */ ) = 0; + // cancels a progress call + virtual void CancelWaitForResources( WaitForResourcesHandle_t handle ) = 0; + // returns true if the appID has all its caches fully preloaded + virtual bool IsAppReadyForOfflinePlay( int appID ) = 0; + + // interface for custom pack files > 4Gb + virtual bool AddPackFile( const char *fullpath, const char *pathID ) = 0; + + // open a file but force the data to come from the steam cache, NOT from disk + virtual FileHandle_t OpenFromCacheForRead( const char *pFileName, const char *pOptions, const char *pathID = 0L ) = 0; + + virtual void AddSearchPathNoWrite( const char *pPath, const char *pathID ) = 0; +}; + +// Steam3/Src compat +#define IBaseFileSystem IFileSystem + +#define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" + +#endif // FILESYSTEM_H diff --git a/public/archtypes.h b/public/archtypes.h new file mode 100644 index 0000000..deb438f --- /dev/null +++ b/public/archtypes.h @@ -0,0 +1,21 @@ +// +// Word size dependent definitions +// DAL 1/03 +// +#ifndef ARCHTYPES_H +#define ARCHTYPES_H + +#include "steam/steamtypes.h" + +#ifndef _WIN32 +#define MAX_PATH PATH_MAX +#include +#include +#include +#include +#define _S_IREAD S_IREAD +#define _S_IWRITE S_IWRITE +typedef long unsigned int ulong; +#endif + +#endif // ARCHTYPES_H diff --git a/public/cl_dll/IGameClientExports.h b/public/cl_dll/IGameClientExports.h new file mode 100644 index 0000000..f324878 --- /dev/null +++ b/public/cl_dll/IGameClientExports.h @@ -0,0 +1,34 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef IGAMECLIENTEXPORTS_H +#define IGAMECLIENTEXPORTS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "interface.h" + +//----------------------------------------------------------------------------- +// Purpose: Exports a set of functions for the GameUI interface to interact with the game client +//----------------------------------------------------------------------------- +class IGameClientExports : public IBaseInterface +{ +public: + // returns the name of the server the user is connected to, if any + virtual const char *GetServerHostName() = 0; + + // ingame voice manipulation + virtual bool IsPlayerGameVoiceMuted(int playerIndex) = 0; + virtual void MutePlayerGameVoice(int playerIndex) = 0; + virtual void UnmutePlayerGameVoice(int playerIndex) = 0; +}; + +#define GAMECLIENTEXPORTS_INTERFACE_VERSION "GameClientExports001" + + +#endif // IGAMECLIENTEXPORTS_H diff --git a/public/interface.cpp b/public/interface.cpp new file mode 100644 index 0000000..df73f58 --- /dev/null +++ b/public/interface.cpp @@ -0,0 +1,270 @@ +#include +#include +#include +#include "interface.h" + +#if !defined ( _WIN32 ) +// Linux doesn't have this function so this emulates its functionality +// +// +void *GetModuleHandle(const char *name) +{ + void *handle; + + + if( name == NULL ) + { + // hmm, how can this be handled under linux.... + // is it even needed? + return NULL; + } + + if( (handle=dlopen(name, RTLD_NOW))==NULL) + { + //printf("Error:%s\n",dlerror()); + // couldn't open this file + return NULL; + } + + // read "man dlopen" for details + // in short dlopen() inc a ref count + // so dec the ref count by performing the close + dlclose(handle); + return handle; +} +#endif + +// ------------------------------------------------------------------------------------ // +// InterfaceReg. +// ------------------------------------------------------------------------------------ // +InterfaceReg *InterfaceReg::s_pInterfaceRegs = NULL; + + +InterfaceReg::InterfaceReg( InstantiateInterfaceFn fn, const char *pName ) : + m_pName(pName) +{ + m_CreateFn = fn; + m_pNext = s_pInterfaceRegs; + s_pInterfaceRegs = this; +} + + + +// ------------------------------------------------------------------------------------ // +// CreateInterface. +// ------------------------------------------------------------------------------------ // +EXPORT_FUNCTION IBaseInterface *CreateInterface( const char *pName, int *pReturnCode ) +{ + InterfaceReg *pCur; + + for(pCur=InterfaceReg::s_pInterfaceRegs; pCur; pCur=pCur->m_pNext) + { + if(strcmp(pCur->m_pName, pName) == 0) + { + if ( pReturnCode ) + { + *pReturnCode = IFACE_OK; + } + return pCur->m_CreateFn(); + } + } + + if ( pReturnCode ) + { + *pReturnCode = IFACE_FAILED; + } + return NULL; +} + +#ifdef LINUX +static IBaseInterface *CreateInterfaceLocal( const char *pName, int *pReturnCode ) +{ + InterfaceReg *pCur; + + for(pCur=InterfaceReg::s_pInterfaceRegs; pCur; pCur=pCur->m_pNext) + { + if(strcmp(pCur->m_pName, pName) == 0) + { + if ( pReturnCode ) + { + *pReturnCode = IFACE_OK; + } + return pCur->m_CreateFn(); + } + } + + if ( pReturnCode ) + { + *pReturnCode = IFACE_FAILED; + } + return NULL; +} +#endif + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include "windows.h" +#endif + +//----------------------------------------------------------------------------- +// Purpose: returns a pointer to a function, given a module +// Input : pModuleName - module name +// *pName - proc name +//----------------------------------------------------------------------------- +//static hlds_run wants to use this function +static void *Sys_GetProcAddress( const char *pModuleName, const char *pName ) +{ + return GetProcAddress( GetModuleHandle(pModuleName), pName ); +} + +//----------------------------------------------------------------------------- +// Purpose: returns a pointer to a function, given a module +// Input : pModuleName - module name +// *pName - proc name +//----------------------------------------------------------------------------- +// hlds_run wants to use this function +void *Sys_GetProcAddress( void *pModuleHandle, const char *pName ) +{ +#if defined ( _WIN32 ) + return GetProcAddress( (HINSTANCE)pModuleHandle, pName ); +#else + return GetProcAddress( pModuleHandle, pName ); +#endif +} + +//----------------------------------------------------------------------------- +// Purpose: Loads a DLL/component from disk and returns a handle to it +// Input : *pModuleName - filename of the component +// Output : opaque handle to the module (hides system dependency) +//----------------------------------------------------------------------------- +CSysModule *Sys_LoadModule( const char *pModuleName ) +{ +#if defined ( _WIN32 ) + HMODULE hDLL = LoadLibrary( pModuleName ); +#else + HMODULE hDLL = NULL; + char szAbsoluteModuleName[1024]; + szAbsoluteModuleName[0] = 0; + if ( pModuleName[0] != '/' ) + { + char szCwd[1024]; + char szAbsoluteModuleName[1024]; + + getcwd( szCwd, sizeof( szCwd ) ); + if ( szCwd[ strlen( szCwd ) - 1 ] == '/' ) + szCwd[ strlen( szCwd ) - 1 ] = 0; + + _snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/%s", szCwd, pModuleName ); + + hDLL = dlopen( szAbsoluteModuleName, RTLD_NOW ); + } + else + { + _snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s", pModuleName ); + hDLL = dlopen( pModuleName, RTLD_NOW ); + } +#endif + + if( !hDLL ) + { + char str[512]; +#if defined ( _WIN32 ) + _snprintf( str, sizeof(str), "%s.dll", pModuleName ); + hDLL = LoadLibrary( str ); +#elif defined(OSX) + printf("Error:%s\n",dlerror()); + _snprintf( str, sizeof(str), "%s.dylib", szAbsoluteModuleName ); + hDLL = dlopen(str, RTLD_NOW); +#else + printf("Error:%s\n",dlerror()); + _snprintf( str, sizeof(str), "%s.so", szAbsoluteModuleName ); + hDLL = dlopen(str, RTLD_NOW); +#endif + } + + return reinterpret_cast(hDLL); +} + +//----------------------------------------------------------------------------- +// Purpose: Unloads a DLL/component from +// Input : *pModuleName - filename of the component +// Output : opaque handle to the module (hides system dependency) +//----------------------------------------------------------------------------- +void Sys_UnloadModule( CSysModule *pModule ) +{ + if ( !pModule ) + return; + + HMODULE hDLL = reinterpret_cast(pModule); +#if defined ( _WIN32 ) + FreeLibrary( hDLL ); +#else + dlclose((void *)hDLL); +#endif + +} + +//----------------------------------------------------------------------------- +// Purpose: returns a pointer to a function, given a module +// Input : module - windows HMODULE from Sys_LoadModule() +// *pName - proc name +// Output : factory for this module +//----------------------------------------------------------------------------- +CreateInterfaceFn Sys_GetFactory( CSysModule *pModule ) +{ + if ( !pModule ) + return NULL; + + HMODULE hDLL = reinterpret_cast(pModule); +#if defined ( _WIN32 ) + return reinterpret_cast(GetProcAddress( hDLL, CREATEINTERFACE_PROCNAME )); +#else +// Linux gives this error: +//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory +//(CSysModule *)) (const char *, int *)': +//../public/interface.cpp:154: ISO C++ forbids casting between +//pointer-to-function and pointer-to-object +// +// so lets get around it :) + return (CreateInterfaceFn)(GetProcAddress( hDLL, CREATEINTERFACE_PROCNAME )); +#endif +} + + + +//----------------------------------------------------------------------------- +// Purpose: returns the instance of this module +// Output : interface_instance_t +//----------------------------------------------------------------------------- +CreateInterfaceFn Sys_GetFactoryThis( void ) +{ +#ifdef LINUX + return CreateInterfaceLocal; +#else + return CreateInterface; +#endif +} + +//----------------------------------------------------------------------------- +// Purpose: returns the instance of the named module +// Input : *pModuleName - name of the module +// Output : interface_instance_t - instance of that module +//----------------------------------------------------------------------------- +CreateInterfaceFn Sys_GetFactory( const char *pModuleName ) +{ +#if defined ( _WIN32 ) + return static_cast( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) ); +#else +// Linux gives this error: +//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory +//(const char *)) (const char *, int *)': +//../public/interface.cpp:186: invalid static_cast from type `void *' to +//type `IBaseInterface *(*) (const char *, int *)' +// +// so lets use the old style cast. + return (CreateInterfaceFn)( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) ); +#endif +} + + + diff --git a/public/interface.h b/public/interface.h new file mode 100644 index 0000000..108b7e6 --- /dev/null +++ b/public/interface.h @@ -0,0 +1,149 @@ + +// This header defines the interface convention used in the valve engine. +// To make an interface and expose it: +// 1. Derive from IBaseInterface. +// 2. The interface must be ALL pure virtuals, and have no data members. +// 3. Define a name for it. +// 4. In its implementation file, use EXPOSE_INTERFACE or EXPOSE_SINGLE_INTERFACE. + +// Versioning +// There are two versioning cases that are handled by this: +// 1. You add functions to the end of an interface, so it is binary compatible with the previous interface. In this case, +// you need two EXPOSE_INTERFACEs: one to expose your class as the old interface and one to expose it as the new interface. +// 2. You update an interface so it's not compatible anymore (but you still want to be able to expose the old interface +// for legacy code). In this case, you need to make a new version name for your new interface, and make a wrapper interface and +// expose it for the old interface. + +//#if _MSC_VER >= 1300 // VC7 +//#include "tier1/interface.h" +//#else + +#ifndef INTERFACE_H +#define INTERFACE_H + +#if !defined ( _WIN32 ) + +#include // dlopen,dlclose, et al +#include + +#define HMODULE void * +#define GetProcAddress dlsym + +#define _snprintf snprintf + +#endif + +void *Sys_GetProcAddress( void *pModuleHandle, const char *pName ); + +// All interfaces derive from this. +class IBaseInterface +{ +public: + + virtual ~IBaseInterface() {} +}; + + +#define CREATEINTERFACE_PROCNAME "CreateInterface" +typedef IBaseInterface* (*CreateInterfaceFn)(const char *pName, int *pReturnCode); + + +typedef IBaseInterface* (*InstantiateInterfaceFn)(); + + +// Used internally to register classes. +class InterfaceReg +{ +public: + InterfaceReg(InstantiateInterfaceFn fn, const char *pName); + +public: + + InstantiateInterfaceFn m_CreateFn; + const char *m_pName; + + InterfaceReg *m_pNext; // For the global list. + static InterfaceReg *s_pInterfaceRegs; +}; + + +// Use this to expose an interface that can have multiple instances. +// e.g.: +// EXPOSE_INTERFACE( CInterfaceImp, IInterface, "MyInterface001" ) +// This will expose a class called CInterfaceImp that implements IInterface (a pure class) +// clients can receive a pointer to this class by calling CreateInterface( "MyInterface001" ) +// +// In practice, the shared header file defines the interface (IInterface) and version name ("MyInterface001") +// so that each component can use these names/vtables to communicate +// +// A single class can support multiple interfaces through multiple inheritance +// +// Use this if you want to write the factory function. +#define EXPOSE_INTERFACE_FN(functionName, interfaceName, versionName) \ + static InterfaceReg __g_Create##className##_reg(functionName, versionName); + +#define EXPOSE_INTERFACE(className, interfaceName, versionName) \ + static IBaseInterface* __Create##className##_interface() {return (interfaceName *)new className;}\ + static InterfaceReg __g_Create##className##_reg(__Create##className##_interface, versionName ); + +// Use this to expose a singleton interface with a global variable you've created. +#define EXPOSE_SINGLE_INTERFACE_GLOBALVAR(className, interfaceName, versionName, globalVarName) \ + static IBaseInterface* __Create##className##interfaceName##_interface() {return (IBaseInterface *)&globalVarName;}\ + static InterfaceReg __g_Create##className##interfaceName##_reg(__Create##className##interfaceName##_interface, versionName); + +// Use this to expose a singleton interface. This creates the global variable for you automatically. +#define EXPOSE_SINGLE_INTERFACE(className, interfaceName, versionName) \ + static className __g_##className##_singleton;\ + EXPOSE_SINGLE_INTERFACE_GLOBALVAR(className, interfaceName, versionName, __g_##className##_singleton) + + +#ifdef WIN32 + #define EXPORT_FUNCTION __declspec(dllexport) +#else + #define EXPORT_FUNCTION __attribute__ ((visibility("default"))) +#endif + + +// This function is automatically exported and allows you to access any interfaces exposed with the above macros. +// if pReturnCode is set, it will return one of the following values +// extend this for other error conditions/code +enum +{ + IFACE_OK = 0, + IFACE_FAILED +}; + + +extern "C" +{ + EXPORT_FUNCTION IBaseInterface* CreateInterface(const char *pName, int *pReturnCode); +}; + + +extern CreateInterfaceFn Sys_GetFactoryThis( void ); + + +//----------------------------------------------------------------------------- +// UNDONE: This is obsolete, use the module load/unload/get instead!!! +//----------------------------------------------------------------------------- +extern CreateInterfaceFn Sys_GetFactory( const char *pModuleName ); + + +// load/unload components +class CSysModule; + +//----------------------------------------------------------------------------- +// Load & Unload should be called in exactly one place for each module +// The factory for that module should be passed on to dependent components for +// proper versioning. +//----------------------------------------------------------------------------- +extern CSysModule *Sys_LoadModule( const char *pModuleName ); +extern void Sys_UnloadModule( CSysModule *pModule ); + +extern CreateInterfaceFn Sys_GetFactory( CSysModule *pModule ); + + +#endif +//#endif // MSVC 6.0 + + diff --git a/public/keydefs.h b/public/keydefs.h new file mode 100644 index 0000000..3e335bc --- /dev/null +++ b/public/keydefs.h @@ -0,0 +1,124 @@ +// keydefs.h +#ifndef KEYDEFS_H +#define KEYDEFS_H +#ifdef _WIN32 +#pragma once +#endif + +// +// these are the key numbers that should be passed to Key_Event +// +#define K_TAB 9 +#define K_ENTER 13 +#define K_ESCAPE 27 +#define K_SPACE 32 + +// normal keys should be passed as lowercased ascii + +#define K_BACKSPACE 127 +#define K_UPARROW 128 +#define K_DOWNARROW 129 +#define K_LEFTARROW 130 +#define K_RIGHTARROW 131 + +#define K_ALT 132 +#define K_CTRL 133 +#define K_SHIFT 134 +#define K_F1 135 +#define K_F2 136 +#define K_F3 137 +#define K_F4 138 +#define K_F5 139 +#define K_F6 140 +#define K_F7 141 +#define K_F8 142 +#define K_F9 143 +#define K_F10 144 +#define K_F11 145 +#define K_F12 146 +#define K_INS 147 +#define K_DEL 148 +#define K_PGDN 149 +#define K_PGUP 150 +#define K_HOME 151 +#define K_END 152 + +#define K_KP_HOME 160 +#define K_KP_UPARROW 161 +#define K_KP_PGUP 162 +#define K_KP_LEFTARROW 163 +#define K_KP_5 164 +#define K_KP_RIGHTARROW 165 +#define K_KP_END 166 +#define K_KP_DOWNARROW 167 +#define K_KP_PGDN 168 +#define K_KP_ENTER 169 +#define K_KP_INS 170 +#define K_KP_DEL 171 +#define K_KP_SLASH 172 +#define K_KP_MINUS 173 +#define K_KP_PLUS 174 +#define K_CAPSLOCK 175 +#define K_KP_MUL 176 +#define K_WIN 177 + + +// +// joystick buttons +// +#define K_JOY1 203 +#define K_JOY2 204 +#define K_JOY3 205 +#define K_JOY4 206 + +// +// aux keys are for multi-buttoned joysticks to generate so they can use +// the normal binding process +// +#define K_AUX1 207 +#define K_AUX2 208 +#define K_AUX3 209 +#define K_AUX4 210 +#define K_AUX5 211 +#define K_AUX6 212 +#define K_AUX7 213 +#define K_AUX8 214 +#define K_AUX9 215 +#define K_AUX10 216 +#define K_AUX11 217 +#define K_AUX12 218 +#define K_AUX13 219 +#define K_AUX14 220 +#define K_AUX15 221 +#define K_AUX16 222 +#define K_AUX17 223 +#define K_AUX18 224 +#define K_AUX19 225 +#define K_AUX20 226 +#define K_AUX21 227 +#define K_AUX22 228 +#define K_AUX23 229 +#define K_AUX24 230 +#define K_AUX25 231 +#define K_AUX26 232 +#define K_AUX27 233 +#define K_AUX28 234 +#define K_AUX29 235 +#define K_AUX30 236 +#define K_AUX31 237 +#define K_AUX32 238 +#define K_MWHEELDOWN 239 +#define K_MWHEELUP 240 + +#define K_PAUSE 255 + +// +// mouse buttons generate virtual keys +// +#define K_MOUSE1 241 +#define K_MOUSE2 242 +#define K_MOUSE3 243 +#define K_MOUSE4 244 +#define K_MOUSE5 245 + +#endif // KEYDEFS_H \ No newline at end of file diff --git a/public/particleman.h b/public/particleman.h new file mode 100644 index 0000000..ab65b13 --- /dev/null +++ b/public/particleman.h @@ -0,0 +1,101 @@ +#ifndef PARTICLEMAN_H +#define PARTICLEMAN_H + +#include "interface.h" +#include "pman_triangleffect.h" + +#define PARTICLEMAN_INTERFACE "create_particleman" + +#ifdef _WIN32 +#define PARTICLEMAN_DLLNAME "cl_dlls/particleman.dll" +#elif defined(OSX) +#define PARTICLEMAN_DLLNAME "cl_dlls/particleman.dylib" +#elif defined(LINUX) +#define PARTICLEMAN_DLLNAME "cl_dlls/particleman.so" +#else +#error +#endif + +class CBaseParticle; + +class IParticleMan : public IBaseInterface +{ + +protected: + virtual ~IParticleMan() {} + +public: + + virtual void SetUp( cl_enginefunc_t *pEnginefuncs ) = 0; + virtual void Update ( void ) = 0; + virtual void SetVariables ( float flGravity, Vector vViewAngles ) = 0; + virtual void ResetParticles ( void ) = 0; + virtual void ApplyForce ( Vector vOrigin, Vector vDirection, float flRadius, float flStrength, float flDuration ) = 0; + virtual void AddCustomParticleClassSize ( unsigned long lSize ) = 0; + + //Use this if you want to create a new particle without any overloaded functions, Think, Touch, etc. + //Just call this function, set the particle's behavior and let it rip. + virtual CBaseParticle *CreateParticle( Vector org, Vector normal, model_s * sprite, float size, float brightness, const char *classname ) = 0; + + //Use this to take a block from the mempool for custom particles ( used in new ). + virtual char *RequestNewMemBlock( int iSize ) = 0; + + //These ones are used along a custom Create for new particles you want to override their behavior. + //You can call these whenever you want, but they are mainly used by CBaseParticle. + virtual void CoreInitializeSprite ( CCoreTriangleEffect *pParticle, Vector org, Vector normal, model_s *sprite, float size, float brightness ) = 0; //Only use this for TrianglePlanes + virtual void CoreThink( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreDraw( CCoreTriangleEffect *pParticle ) = 0; + virtual void CoreAnimate( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreAnimateAndDie( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreExpand ( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreContract ( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreFade ( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreSpin ( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreCalculateVelocity( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreCheckCollision( CCoreTriangleEffect *pParticle, float time ) = 0; + virtual void CoreTouch ( CCoreTriangleEffect *pParticle, Vector pos, Vector normal, int index ) = 0; + virtual void CoreDie ( CCoreTriangleEffect *pParticle ) = 0; + virtual void CoreForce ( CCoreTriangleEffect *pParticle ) = 0; + virtual bool CoreCheckVisibility ( CCoreTriangleEffect *pParticle ) = 0; + virtual void SetRender( int iRender ) = 0; +}; + +extern IParticleMan *g_pParticleMan; + +class CBaseParticle : public CCoreTriangleEffect +{ +public: + virtual void Think( float time ){ g_pParticleMan->CoreThink( this, time ); } + virtual void Draw( void ) { g_pParticleMan->CoreDraw( this ); } + virtual void Animate( float time ) { g_pParticleMan->CoreAnimate( this, time ); } + virtual void AnimateAndDie( float time ) { g_pParticleMan->CoreAnimateAndDie( this, time ); } + virtual void Expand( float time ) { g_pParticleMan->CoreExpand( this, time ); } + virtual void Contract( float time ) { g_pParticleMan->CoreContract( this, time ); } + virtual void Fade( float time ) { g_pParticleMan->CoreFade( this, time ); } + virtual void Spin( float time ) { g_pParticleMan->CoreSpin( this, time ); } + virtual void CalculateVelocity( float time ) { g_pParticleMan->CoreCalculateVelocity( this, time ); } + virtual void CheckCollision( float time ) { g_pParticleMan->CoreCheckCollision( this, time ); } + virtual void Touch(Vector pos, Vector normal, int index) { g_pParticleMan->CoreTouch( this, pos, normal, index ); } + virtual void Die ( void ) { g_pParticleMan->CoreDie( this ); } + virtual void Force ( void ) { g_pParticleMan->CoreForce( this ); } + virtual bool CheckVisibility ( void ) { return g_pParticleMan->CoreCheckVisibility( this ); } + + virtual void InitializeSprite( Vector org, Vector normal, model_s *sprite, float size, float brightness ) + { + g_pParticleMan->CoreInitializeSprite ( this, org, normal, sprite, size, brightness ); + } + + void * operator new( size_t size ) //this asks for a new block of memory from the MiniMem class + { + return( g_pParticleMan->RequestNewMemBlock( size ) ); + } +#ifdef POSIX + void * operator new( size_t size, const std::nothrow_t&) throw() //this asks for a new block of memory from the MiniMem class + { + return( g_pParticleMan->RequestNewMemBlock( size ) ); + } +#endif +}; + + +#endif //PARTICLEMAN_H diff --git a/public/pman_particlemem.h b/public/pman_particlemem.h new file mode 100644 index 0000000..05f79bc --- /dev/null +++ b/public/pman_particlemem.h @@ -0,0 +1,197 @@ +#ifndef PARTICLEMEM_H__ +#define PARTICLEMEM_H__ + +#ifdef _WIN32 +#pragma once +#endif + +#include + +class CCoreTriangleEffect; + +#define TRIANGLE_FPS 30 + +typedef struct visibleparticles_s +{ + CCoreTriangleEffect *pVisibleParticle; +} visibleparticles_t; + +//--------------------------------------------------------------------------- +// Memory block record. +class MemoryBlock +{ +private: + char *m_pData; + //bool m_bBlockIsInUse; +public: + MemoryBlock(long lBlockSize) + : next(NULL), prev(NULL) + //m_bBlockIsInUse(false) // Initialize block to 'free' state. + { + // Allocate memory here. + m_pData = new char[lBlockSize]; + } + + virtual ~MemoryBlock() + { + // Free memory. + delete[] m_pData; + } + + inline char *Memory(void) { return m_pData; } + + MemoryBlock * next; + MemoryBlock * prev; +}; + +class MemList +{ +public: + MemList() : m_pHead(NULL) {} + + ~MemList() { Reset(); } + + void Push(MemoryBlock * newItem) + { + if(!m_pHead) + { + m_pHead = newItem; + newItem->next = NULL; + newItem->prev = NULL; + return; + } + + MemoryBlock * temp = m_pHead; + m_pHead = newItem; + m_pHead->next = temp; + m_pHead->prev = NULL; + + temp->prev = m_pHead; + } + + + MemoryBlock * Front( void ) + { + return(m_pHead); + } + + MemoryBlock * Pop( void ) + { + if(!m_pHead) + return(NULL); + + MemoryBlock * temp = m_pHead; + + m_pHead = m_pHead->next; + + if(m_pHead) + m_pHead->prev = NULL; + + temp->next = NULL; + temp->prev = NULL; + + return(temp); + } + + void Delete( MemoryBlock * pItem) + { + + if(m_pHead == pItem) + { + MemoryBlock * temp = m_pHead; + + m_pHead = m_pHead->next; + if(m_pHead) + m_pHead->prev = NULL; + + temp->next = NULL; + temp->prev = NULL; + return; + } + + MemoryBlock * prev = pItem->prev; + MemoryBlock * next = pItem->next; + + if(prev) + prev->next = next; + + if(next) + next->prev = prev; + + pItem->next = NULL; + pItem->prev = NULL; + } + + void Reset( void ) + { + while(m_pHead) + Delete(m_pHead); + } + +private: + MemoryBlock * m_pHead; +}; + + +// Some helpful typedefs. +typedef std::vector VectorOfMemoryBlocks; +typedef VectorOfMemoryBlocks::iterator MemoryBlockIterator; + +// Mini memory manager - singleton. +class CMiniMem +{ +private: + // Main memory pool. Array is fine, but vectors are + // easier. :) + static VectorOfMemoryBlocks m_vecMemoryPool; + // Size of memory blocks in pool. + static long m_lMemoryBlockSize; + static long m_lMaxBlocks; + static long m_lMemoryPoolSize; + static CMiniMem *_instance; + + int m_iTotalParticles; + int m_iParticlesDrawn; + +protected: + // private constructor and destructor. + CMiniMem(long lMemoryPoolSize, long lMaxBlockSize); + virtual ~CMiniMem(); + + // ------------ Memory pool manager calls. + // Find a free block and mark it as "in use". Return NULL + // if no free blocks found. + char *AllocateFreeBlock(void); +public: + + // Return a pointer to usable block of memory. + char *newBlock(void); + + // Mark a target memory item as no longer "in use". + void deleteBlock(MemoryBlock *p); + + // Return the remaining capacity of the memory pool as a percent. + long PercentUsed(void); + + void ProcessAll( void ); //Processes all + + void Reset( void ); //clears memory, setting all particles to not used. + + static int ApplyForce( Vector vOrigin, Vector vDirection, float flRadius, float flStrength ); + + static CMiniMem *Instance(void); + static long MaxBlockSize(void); + + bool CheckSize( int iSize ); + + int GetTotalParticles( void ) { return m_iTotalParticles; } + int GetDrawnParticles( void ) { return m_iParticlesDrawn; } + void IncreaseParticlesDrawn( void ){ m_iParticlesDrawn++; } + + void Shutdown( void ); + + visibleparticles_t *m_pVisibleParticles; +}; + + +#endif//PARTICLEMEM_H__ \ No newline at end of file diff --git a/public/pman_triangleffect.h b/public/pman_triangleffect.h new file mode 100644 index 0000000..7ab40da --- /dev/null +++ b/public/pman_triangleffect.h @@ -0,0 +1,209 @@ +#ifndef TRIANGLEEFFECT_H__ +#define TRIANGLEEFFECT_H__ + +#ifdef _WIN32 +#pragma once +#endif + +#define TRI_COLLIDEWORLD 0x00000020 +#define TRI_COLLIDEALL 0x00001000 // will collide with world and slideboxes +#define TRI_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything +#define TRI_SPIRAL 0x00008000 +#define TRI_ANIMATEDIE 0x00016000 //animate once and then die +#define TRI_WATERTRACE 0x00032000 + + +#define CULL_FRUSTUM_POINT ( 1 << 0 ) +#define CULL_FRUSTUM_SPHERE ( 1 << 1 ) +#define CULL_FRUSTUM_PLANE ( 1 << 2 ) +#define CULL_PVS ( 1 << 3 ) + +#define LIGHT_NONE ( 1 << 4 ) +#define LIGHT_COLOR ( 1 << 5 ) +#define LIGHT_INTENSITY ( 1 << 6 ) + +#define RENDER_FACEPLAYER ( 1 << 7 ) // m_vAngles == Player view angles +#define RENDER_FACEPLAYER_ROTATEZ ( 1 << 8 ) //Just like above but m_vAngles.z is untouched so the sprite can rotate. + + +#include "pman_particlemem.h" + +//pure virtual baseclass +class CCoreTriangleEffect +{ +private: + int m_iRenderFlags; + float m_flNextPVSCheck; + bool m_bInPVS; + + int m_iCollisionFlags; + float m_flPlayerDistance; //Used for sorting the particles, DO NOT TOUCH. + +public: + + void * operator new(size_t size) + { + // Requested size should match size of class. + if ( size != sizeof( CCoreTriangleEffect ) ) +#ifdef _WIN32 + throw "Error in requested size of new particle class instance."; +#else + return NULL; +#endif + + return((CCoreTriangleEffect *) CMiniMem::Instance()->newBlock()); + + }//this asks for a new block of memory from the MiniMen class + + virtual void Think( float time ) = 0; + virtual bool CheckVisibility ( void ) = 0; + virtual void Draw( void ) = 0; + virtual void Animate( float time ) = 0; + virtual void AnimateAndDie( float time ) = 0; + virtual void Expand( float time ) = 0; + virtual void Contract( float time ) = 0; + virtual void Fade( float time ) = 0; + virtual void Spin( float time ) = 0; + virtual void CalculateVelocity( float time ) = 0; + virtual void CheckCollision( float time ) = 0; + virtual void Touch(Vector pos, Vector normal, int index) = 0; + virtual void Die ( void ) = 0; + virtual void InitializeSprite( Vector org, Vector normal, model_s * sprite, float size, float brightness ) = 0; + virtual void Force ( void ) = 0; + + float m_flSize; //scale of object + float m_flScaleSpeed; //speed at which object expands + float m_flContractSpeed; //speed at which object expands + + float m_flStretchX; + float m_flStretchY; + + float m_flBrightness; //transparency of object + float m_flFadeSpeed; //speed at which object fades + + float m_flTimeCreated; //time object was instanced + float m_flDieTime; //time to remove an object + + float m_flGravity; //how effected by gravity is this object + float m_flAfterDampGrav; + float m_flDampingVelocity; + float m_flDampingTime; + + int m_iFramerate; + int m_iNumFrames; + int m_iFrame; + int m_iRendermode; + + Vector m_vOrigin; //object's position + Vector m_vAngles; //normal angles of object + + Vector m_vAVelocity; + + Vector m_vVelocity; + + Vector m_vLowLeft; + Vector m_vLowRight; + Vector m_vTopLeft; + + Vector m_vColor; + float m_flMass; + + model_s * m_pTexture; + + float m_flBounceFactor; + + char m_szClassname[32]; + + bool m_bInWater; + bool m_bAffectedByForce; + + int m_iAfterDampFlags; + + void SetLightFlag ( int iFlag ) + { + m_iRenderFlags &= ~( LIGHT_NONE | LIGHT_INTENSITY | LIGHT_COLOR ); + m_iRenderFlags |= iFlag; + } + + void SetCullFlag( int iFlag ) + { + m_iRenderFlags &= ~( CULL_PVS | CULL_FRUSTUM_POINT | CULL_FRUSTUM_PLANE | CULL_FRUSTUM_SPHERE ); + m_iRenderFlags |= iFlag; + } + + int GetRenderFlags( void ) + { + return m_iRenderFlags; + } + + bool GetParticlePVS ( void ) + { + return m_bInPVS; + } + + void SetParticlePVS ( bool bPVSStat ) + { + m_bInPVS = bPVSStat; + } + + float GetNextPVSCheck( void ) + { + return m_flNextPVSCheck; + } + + void SetNextPVSCheck( float flTime ) + { + m_flNextPVSCheck = flTime; + } + + void SetCollisionFlags ( int iFlag ) + { + m_iCollisionFlags |= iFlag; + } + + void ClearCollisionFlags ( int iFlag ) + { + m_iCollisionFlags &= ~iFlag; + } + + int GetCollisionFlags ( void ) + { + return m_iCollisionFlags; + } + + void SetRenderFlag( int iFlag ) + { + m_iRenderFlags |= iFlag; + } + + float GetPlayerDistance ( void ) { return m_flPlayerDistance; } + void SetPlayerDistance ( float flDistance ) { m_flPlayerDistance = flDistance; } + +protected: + float m_flOriginalSize; + Vector m_vOriginalAngles; + float m_flOriginalBrightness; + Vector m_vPrevOrigin; + + float m_flNextCollisionTime; + +protected: + static bool CheckSize(int size) + { + // This check will help prevent a class frome being defined later, + // that is larger than the max size MemoryPool is expecting, + // from being successfully allocated. + if (size > (unsigned long) CMiniMem::Instance()->MaxBlockSize()) + { +#ifdef _WIN32 + throw "New particle class is larger than memory pool max size, update lMaxParticleClassSize() function."; +#endif + return(false); + } + + return(true); + } +}; + + +#endif//TRIANGLEEFFECT_H__ diff --git a/public/steam/steamtypes.h b/public/steam/steamtypes.h new file mode 100644 index 0000000..3794790 --- /dev/null +++ b/public/steam/steamtypes.h @@ -0,0 +1,177 @@ +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +//============================================================================= + +#ifndef STEAMTYPES_H +#define STEAMTYPES_H +#ifdef _WIN32 +#pragma once +#endif + +// Steam-specific types. Defined here so this header file can be included in other code bases. +#if defined( __GNUC__ ) && !defined(POSIX) + #if __GNUC__ < 4 + #error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)" + #endif + #define POSIX 1 +#endif + +#if defined(__x86_64__) || defined(_WIN64) +#define X64BITS +#endif + +// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code. +#if !defined(VALVE_BIG_ENDIAN) && defined(_PS3) +#define VALVE_BIG_ENDIAN +#endif + +typedef unsigned char uint8; +typedef signed char int8; + +#if defined( _WIN32 ) + +typedef __int16 int16; +typedef unsigned __int16 uint16; +typedef __int32 int32; +typedef unsigned __int32 uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; + +#ifdef X64BITS +typedef __int64 intp; // intp is an integer that can accomodate a pointer +typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) +#else +typedef __int32 intp; +typedef unsigned __int32 uintp; +#endif + +#else // _WIN32 + +typedef short int16; +typedef unsigned short uint16; +typedef int int32; +typedef unsigned int uint32; +typedef long long int64; +typedef unsigned long long uint64; +#ifdef X64BITS +typedef long long intp; +typedef unsigned long long uintp; +#else +typedef int intp; +typedef unsigned int uintp; +#endif + +#endif // else _WIN32 + +#ifdef __cplusplus +const int k_cubSaltSize = 8; +#else +#define k_cubSaltSize 8 +#endif + +typedef uint8 Salt_t[ k_cubSaltSize ]; + +//----------------------------------------------------------------------------- +// GID (GlobalID) stuff +// This is a globally unique identifier. It's guaranteed to be unique across all +// racks and servers for as long as a given universe persists. +//----------------------------------------------------------------------------- +// NOTE: for GID parsing/rendering and other utils, see gid.h +typedef uint64 GID_t; + +#ifdef __cplusplus +const GID_t k_GIDNil = 0xfffffffffffffffful; +#else +#define k_GIDNil 0xffffffffffffffffull; +#endif + +// For convenience, we define a number of types that are just new names for GIDs +typedef GID_t JobID_t; // Each Job has a unique ID +typedef GID_t TxnID_t; // Each financial transaction has a unique ID + +#ifdef __cplusplus +const GID_t k_TxnIDNil = k_GIDNil; +const GID_t k_TxnIDUnknown = 0; +#else +#define k_TxnIDNil k_GIDNil; +#define k_TxnIDUnknown 0; +#endif + +// this is baked into client messages and interfaces as an int, +// make sure we never break this. +typedef uint32 PackageId_t; +#ifdef __cplusplus +const PackageId_t k_uPackageIdFreeSub = 0x0; +const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF; +#else +#define k_uPackageIdFreeSub 0x0; +#define k_uPackageIdInvalid 0xFFFFFFFF; +#endif + +// this is baked into client messages and interfaces as an int, +// make sure we never break this. +typedef uint32 AppId_t; +#ifdef __cplusplus +const AppId_t k_uAppIdInvalid = 0x0; +#else +#define k_uAppIdInvalid 0x0; +#endif + +typedef uint64 AssetClassId_t; +#ifdef __cplusplus +const AssetClassId_t k_ulAssetClassIdInvalid = 0x0; +#else +#define k_ulAssetClassIdInvalid 0x0; +#endif + +typedef uint32 PhysicalItemId_t; +#ifdef __cplusplus +const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0; +#else +#define k_uPhysicalItemIdInvalid 0x0; +#endif + + +// this is baked into client messages and interfaces as an int, +// make sure we never break this. AppIds and DepotIDs also presently +// share the same namespace, but since we'd like to change that in the future +// I've defined it seperately here. +typedef uint32 DepotId_t; +#ifdef __cplusplus +const DepotId_t k_uDepotIdInvalid = 0x0; +#else +#define k_uDepotIdInvalid 0x0; +#endif + +// RTime32 +// We use this 32 bit time representing real world time. +// It offers 1 second resolution beginning on January 1, 1970 (Unix time) +typedef uint32 RTime32; + +typedef uint32 CellID_t; +#ifdef __cplusplus +const CellID_t k_uCellIDInvalid = 0xFFFFFFFF; +#else +#define k_uCellIDInvalid 0x0; +#endif + +// handle to a Steam API call +typedef uint64 SteamAPICall_t; +#ifdef __cplusplus +const SteamAPICall_t k_uAPICallInvalid = 0x0; +#else +#define k_uAPICallInvalid 0x0; +#endif + +typedef uint32 AccountID_t; + +typedef uint32 PartnerId_t; +#ifdef __cplusplus +const PartnerId_t k_uPartnerIdInvalid = 0; +#else +#define k_uPartnerIdInvalid 0x0; +#endif + +#endif // STEAMTYPES_H diff --git a/utils/bspinfo/bspinfo.c b/utils/bspinfo/bspinfo.c index 7a7d97a..dd93521 100644 --- a/utils/bspinfo/bspinfo.c +++ b/utils/bspinfo/bspinfo.c @@ -10,7 +10,7 @@ #include "cmdlib.h" #include "mathlib.h" -#include "bspfile.h" +#include "bsplib.h" void main (int argc, char **argv) { diff --git a/utils/common/bsplib.c b/utils/common/bsplib.c new file mode 100644 index 0000000..abae7c0 --- /dev/null +++ b/utils/common/bsplib.c @@ -0,0 +1,709 @@ +/*** +* +* Copyright (c) 1998, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +****/ + +#include "cmdlib.h" +#include "mathlib.h" +#include "bsplib.h" +#include "scriplib.h" + +//============================================================================= + +int nummodels; +dmodel_t dmodels[MAX_MAP_MODELS]; +int dmodels_checksum; + +int visdatasize; +byte dvisdata[MAX_MAP_VISIBILITY]; +int dvisdata_checksum; + +int lightdatasize; +byte dlightdata[MAX_MAP_LIGHTING]; +int dlightdata_checksum; + +int texdatasize; +byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t) +int dtexdata_checksum; + +int entdatasize; +char dentdata[MAX_MAP_ENTSTRING]; +int dentdata_checksum; + +int numleafs; +dleaf_t dleafs[MAX_MAP_LEAFS]; +int dleafs_checksum; + +int numplanes; +dplane_t dplanes[MAX_MAP_PLANES]; +int dplanes_checksum; + +int numvertexes; +dvertex_t dvertexes[MAX_MAP_VERTS]; +int dvertexes_checksum; + +int numnodes; +dnode_t dnodes[MAX_MAP_NODES]; +int dnodes_checksum; + +int numtexinfo; +texinfo_t texinfo[MAX_MAP_TEXINFO]; +int texinfo_checksum; + +int numfaces; +dface_t dfaces[MAX_MAP_FACES]; +int dfaces_checksum; + +int numclipnodes; +dclipnode_t dclipnodes[MAX_MAP_CLIPNODES]; +int dclipnodes_checksum; + +int numedges; +dedge_t dedges[MAX_MAP_EDGES]; +int dedges_checksum; + +int nummarksurfaces; +unsigned short dmarksurfaces[MAX_MAP_MARKSURFACES]; +int dmarksurfaces_checksum; + +int numsurfedges; +int dsurfedges[MAX_MAP_SURFEDGES]; +int dsurfedges_checksum; + +int num_entities; +entity_t entities[MAX_MAP_ENTITIES]; + +/* +=============== +FastChecksum +=============== +*/ + +int FastChecksum(void *buffer, int bytes) +{ + int checksum = 0; + + while( bytes-- ) + checksum = _rotl(checksum, 4) ^ *((char *)buffer)++; + + return checksum; +} + +/* +=============== +CompressVis +=============== +*/ +int CompressVis (byte *vis, byte *dest) +{ + int j; + int rep; + int visrow; + byte *dest_p; + + dest_p = dest; + visrow = (numleafs + 7)>>3; + + for (j=0 ; j>3; + out = decompressed; + + do + { + if (*in) + { + *out++ = *in++; + continue; + } + + c = in[1]; + in += 2; + while (c) + { + *out++ = 0; + c--; + } + } while (out - decompressed < row); +} + +//============================================================================= + +/* +============= +SwapBSPFile + +Byte swaps all data in a bsp file. +============= +*/ +void SwapBSPFile (qboolean todisk) +{ + int i, j, c; + dmodel_t *d; + dmiptexlump_t *mtl; + + +// models + for (i=0 ; iheadnode[j] = LittleLong (d->headnode[j]); + + d->visleafs = LittleLong (d->visleafs); + d->firstface = LittleLong (d->firstface); + d->numfaces = LittleLong (d->numfaces); + + for (j=0 ; j<3 ; j++) + { + d->mins[j] = LittleFloat(d->mins[j]); + d->maxs[j] = LittleFloat(d->maxs[j]); + d->origin[j] = LittleFloat(d->origin[j]); + } + } + +// +// vertexes +// + for (i=0 ; inummiptex; + else + c = LittleLong(mtl->nummiptex); + mtl->nummiptex = LittleLong (mtl->nummiptex); + for (i=0 ; idataofs[i] = LittleLong(mtl->dataofs[i]); + } + +// +// marksurfaces +// + for (i=0 ; ilumps[lump].filelen; + ofs = header->lumps[lump].fileofs; + + if (length % size) + Error ("LoadBSPFile: odd lump size"); + + memcpy (dest, (byte *)header + ofs, length); + + return length / size; +} + +/* +============= +LoadBSPFile +============= +*/ +void LoadBSPFile (char *filename) +{ + int i; + +// +// load the file header +// + LoadFile (filename, (void **)&header); + +// swap the header + for (i=0 ; i< sizeof(dheader_t)/4 ; i++) + ((int *)header)[i] = LittleLong ( ((int *)header)[i]); + + if (header->version != BSPVERSION) + Error ("%s is version %i, not %i", filename, header->version, BSPVERSION); + + nummodels = CopyLump (LUMP_MODELS, dmodels, sizeof(dmodel_t)); + numvertexes = CopyLump (LUMP_VERTEXES, dvertexes, sizeof(dvertex_t)); + numplanes = CopyLump (LUMP_PLANES, dplanes, sizeof(dplane_t)); + numleafs = CopyLump (LUMP_LEAFS, dleafs, sizeof(dleaf_t)); + numnodes = CopyLump (LUMP_NODES, dnodes, sizeof(dnode_t)); + numtexinfo = CopyLump (LUMP_TEXINFO, texinfo, sizeof(texinfo_t)); + numclipnodes = CopyLump (LUMP_CLIPNODES, dclipnodes, sizeof(dclipnode_t)); + numfaces = CopyLump (LUMP_FACES, dfaces, sizeof(dface_t)); + nummarksurfaces = CopyLump (LUMP_MARKSURFACES, dmarksurfaces, sizeof(dmarksurfaces[0])); + numsurfedges = CopyLump (LUMP_SURFEDGES, dsurfedges, sizeof(dsurfedges[0])); + numedges = CopyLump (LUMP_EDGES, dedges, sizeof(dedge_t)); + + texdatasize = CopyLump (LUMP_TEXTURES, dtexdata, 1); + visdatasize = CopyLump (LUMP_VISIBILITY, dvisdata, 1); + lightdatasize = CopyLump (LUMP_LIGHTING, dlightdata, 1); + entdatasize = CopyLump (LUMP_ENTITIES, dentdata, 1); + + free (header); // everything has been copied out + +// +// swap everything +// + SwapBSPFile (false); + + dmodels_checksum = FastChecksum( dmodels, nummodels*sizeof(dmodels[0]) ); + dvertexes_checksum = FastChecksum( dvertexes, numvertexes*sizeof(dvertexes[0]) ); + dplanes_checksum = FastChecksum( dplanes, numplanes*sizeof(dplanes[0]) ); + dleafs_checksum = FastChecksum( dleafs, numleafs*sizeof(dleafs[0]) ); + dnodes_checksum = FastChecksum( dnodes, numnodes*sizeof(dnodes[0]) ); + texinfo_checksum = FastChecksum( texinfo, numtexinfo*sizeof(texinfo[0]) ); + dclipnodes_checksum = FastChecksum( dclipnodes, numclipnodes*sizeof(dclipnodes[0]) ); + dfaces_checksum = FastChecksum( dfaces, numfaces*sizeof(dfaces[0]) ); + dmarksurfaces_checksum = FastChecksum( dmarksurfaces, nummarksurfaces*sizeof(dmarksurfaces[0]) ); + dsurfedges_checksum = FastChecksum( dsurfedges, numsurfedges*sizeof(dsurfedges[0]) ); + dedges_checksum = FastChecksum( dedges, numedges*sizeof(dedges[0]) ); + dtexdata_checksum = FastChecksum( dtexdata, numedges*sizeof(dtexdata[0]) ); + dvisdata_checksum = FastChecksum( dvisdata, visdatasize*sizeof(dvisdata[0]) ); + dlightdata_checksum = FastChecksum( dlightdata, lightdatasize*sizeof(dlightdata[0]) ); + dentdata_checksum = FastChecksum( dentdata, entdatasize*sizeof(dentdata[0]) ); + +} + +//============================================================================ + +FILE *wadfile; +dheader_t outheader; + +void AddLump (int lumpnum, void *data, int len) +{ + lump_t *lump; + + lump = &header->lumps[lumpnum]; + + lump->fileofs = LittleLong( ftell(wadfile) ); + lump->filelen = LittleLong(len); + SafeWrite (wadfile, data, (len+3)&~3); +} + +/* +============= +WriteBSPFile + +Swaps the bsp file in place, so it should not be referenced again +============= +*/ +void WriteBSPFile (char *filename) +{ + header = &outheader; + memset (header, 0, sizeof(dheader_t)); + + SwapBSPFile (true); + + header->version = LittleLong (BSPVERSION); + + wadfile = SafeOpenWrite (filename); + SafeWrite (wadfile, header, sizeof(dheader_t)); // overwritten later + + AddLump (LUMP_PLANES, dplanes, numplanes*sizeof(dplane_t)); + AddLump (LUMP_LEAFS, dleafs, numleafs*sizeof(dleaf_t)); + AddLump (LUMP_VERTEXES, dvertexes, numvertexes*sizeof(dvertex_t)); + AddLump (LUMP_NODES, dnodes, numnodes*sizeof(dnode_t)); + AddLump (LUMP_TEXINFO, texinfo, numtexinfo*sizeof(texinfo_t)); + AddLump (LUMP_FACES, dfaces, numfaces*sizeof(dface_t)); + AddLump (LUMP_CLIPNODES, dclipnodes, numclipnodes*sizeof(dclipnode_t)); + AddLump (LUMP_MARKSURFACES, dmarksurfaces, nummarksurfaces*sizeof(dmarksurfaces[0])); + AddLump (LUMP_SURFEDGES, dsurfedges, numsurfedges*sizeof(dsurfedges[0])); + AddLump (LUMP_EDGES, dedges, numedges*sizeof(dedge_t)); + AddLump (LUMP_MODELS, dmodels, nummodels*sizeof(dmodel_t)); + + AddLump (LUMP_LIGHTING, dlightdata, lightdatasize); + AddLump (LUMP_VISIBILITY, dvisdata, visdatasize); + AddLump (LUMP_ENTITIES, dentdata, entdatasize); + AddLump (LUMP_TEXTURES, dtexdata, texdatasize); + + fseek (wadfile, 0, SEEK_SET); + SafeWrite (wadfile, header, sizeof(dheader_t)); + fclose (wadfile); +} + +//============================================================================ + +#define ENTRIES(a) (sizeof(a)/sizeof(*(a))) +#define ENTRYSIZE(a) (sizeof(*(a))) + +ArrayUsage( char *szItem, int items, int maxitems, int itemsize ) +{ + float percentage = maxitems ? items * 100.0 / maxitems : 0.0; + + printf("%-12s %7i/%-7i %7i/%-7i (%4.1f%%)", + szItem, items, maxitems, items * itemsize, maxitems * itemsize, percentage ); + if ( percentage > 80.0 ) + printf( "VERY FULL!\n" ); + else if ( percentage > 95.0 ) + printf( "SIZE DANGER!\n" ); + else if ( percentage > 99.9 ) + printf( "SIZE OVERFLOW!!!\n" ); + else + printf( "\n" ); + return items * itemsize; +} + +GlobUsage( char *szItem, int itemstorage, int maxstorage ) +{ + float percentage = maxstorage ? itemstorage * 100.0 / maxstorage : 0.0; + printf("%-12s [variable] %7i/%-7i (%4.1f%%)", + szItem, itemstorage, maxstorage, percentage ); + if ( percentage > 80.0 ) + printf( "VERY FULL!\n" ); + else if ( percentage > 95.0 ) + printf( "SIZE DANGER!\n" ); + else if ( percentage > 99.9 ) + printf( "SIZE OVERFLOW!!!\n" ); + else + printf( "\n" ); + return itemstorage; +} + +/* +============= +PrintBSPFileSizes + +Dumps info about current file +============= +*/ +void PrintBSPFileSizes (void) +{ + int numtextures = texdatasize ? ((dmiptexlump_t*)dtexdata)->nummiptex : 0; + int totalmemory = 0; + + printf("\n"); + printf("Object names Objects/Maxobjs Memory / Maxmem Fullness\n" ); + printf("------------ --------------- --------------- --------\n" ); + + totalmemory += ArrayUsage( "models", nummodels, ENTRIES(dmodels), ENTRYSIZE(dmodels) ); + totalmemory += ArrayUsage( "planes", numplanes, ENTRIES(dplanes), ENTRYSIZE(dplanes) ); + totalmemory += ArrayUsage( "vertexes", numvertexes, ENTRIES(dvertexes), ENTRYSIZE(dvertexes) ); + totalmemory += ArrayUsage( "nodes", numnodes, ENTRIES(dnodes), ENTRYSIZE(dnodes) ); + totalmemory += ArrayUsage( "texinfos", numtexinfo, ENTRIES(texinfo), ENTRYSIZE(texinfo) ); + totalmemory += ArrayUsage( "faces", numfaces, ENTRIES(dfaces), ENTRYSIZE(dfaces) ); + totalmemory += ArrayUsage( "clipnodes", numclipnodes, ENTRIES(dclipnodes), ENTRYSIZE(dclipnodes) ); + totalmemory += ArrayUsage( "leaves", numleafs, ENTRIES(dleafs), ENTRYSIZE(dleafs) ); + totalmemory += ArrayUsage( "marksurfaces", nummarksurfaces,ENTRIES(dmarksurfaces), ENTRYSIZE(dmarksurfaces) ); + totalmemory += ArrayUsage( "surfedges", numsurfedges, ENTRIES(dsurfedges), ENTRYSIZE(dsurfedges) ); + totalmemory += ArrayUsage( "edges", numedges, ENTRIES(dedges), ENTRYSIZE(dedges) ); + + totalmemory += GlobUsage( "texdata", texdatasize, sizeof(dtexdata) ); + totalmemory += GlobUsage( "lightdata", lightdatasize, sizeof(dlightdata) ); + totalmemory += GlobUsage( "visdata", visdatasize, sizeof(dvisdata) ); + totalmemory += GlobUsage( "entdata", entdatasize, sizeof(dentdata) ); + + printf( "=== Total BSP file data space used: %d bytes ===\n", totalmemory ); +} + + +/* +================= +ParseEpair +================= +*/ +epair_t *ParseEpair (void) +{ + epair_t *e; + + e = malloc (sizeof(epair_t)); + memset (e, 0, sizeof(epair_t)); + + if (strlen(token) >= MAX_KEY-1) + Error ("ParseEpar: token too long"); + e->key = copystring(token); + GetToken (false); + if (strlen(token) >= MAX_VALUE-1) + Error ("ParseEpar: token too long"); + e->value = copystring(token); + + return e; +} + + +/* +================ +ParseEntity +================ +*/ +qboolean ParseEntity (void) +{ + epair_t *e; + entity_t *mapent; + + if (!GetToken (true)) + return false; + + if (strcmp (token, "{") ) + Error ("ParseEntity: { not found"); + + if (num_entities == MAX_MAP_ENTITIES) + Error ("num_entities == MAX_MAP_ENTITIES"); + + mapent = &entities[num_entities]; + num_entities++; + + do + { + if (!GetToken (true)) + Error ("ParseEntity: EOF without closing brace"); + if (!strcmp (token, "}") ) + break; + e = ParseEpair (); + e->next = mapent->epairs; + mapent->epairs = e; + } while (1); + + return true; +} + +/* +================ +ParseEntities + +Parses the dentdata string into entities +================ +*/ +void ParseEntities (void) +{ + num_entities = 0; + ParseFromMemory (dentdata, entdatasize); + + while (ParseEntity ()) + { + } +} + + +/* +================ +UnparseEntities + +Generates the dentdata string from all the entities +================ +*/ +void UnparseEntities (void) +{ + char *buf, *end; + epair_t *ep; + char line[2048]; + int i; + + buf = dentdata; + end = buf; + *end = 0; + + for (i=0 ; inext) + { + sprintf (line, "\"%s\" \"%s\"\n", ep->key, ep->value); + strcat (end, line); + end += strlen(line); + } + strcat (end,"}\n"); + end += 2; + + if (end > buf + MAX_MAP_ENTSTRING) + Error ("Entity text too long"); + } + entdatasize = end - buf + 1; +} + + + +void SetKeyValue (entity_t *ent, char *key, char *value) +{ + epair_t *ep; + + for (ep=ent->epairs ; ep ; ep=ep->next) + if (!strcmp (ep->key, key) ) + { + free (ep->value); + ep->value = copystring(value); + return; + } + ep = malloc (sizeof(*ep)); + ep->next = ent->epairs; + ent->epairs = ep; + ep->key = copystring(key); + ep->value = copystring(value); +} + +char *ValueForKey (entity_t *ent, char *key) +{ + epair_t *ep; + + for (ep=ent->epairs ; ep ; ep=ep->next) + if (!strcmp (ep->key, key) ) + return ep->value; + return ""; +} + +vec_t FloatForKey (entity_t *ent, char *key) +{ + char *k; + + k = ValueForKey (ent, key); + return atof(k); +} + +void GetVectorForKey (entity_t *ent, char *key, vec3_t vec) +{ + char *k; + double v1, v2, v3; + + k = ValueForKey (ent, key); +// scanf into doubles, then assign, so it is vec_t size independent + v1 = v2 = v3 = 0; + sscanf (k, "%lf %lf %lf", &v1, &v2, &v3); + vec[0] = v1; + vec[1] = v2; + vec[2] = v3; +} + diff --git a/utils/common/bsplib.h b/utils/common/bsplib.h new file mode 100644 index 0000000..c15fc5d --- /dev/null +++ b/utils/common/bsplib.h @@ -0,0 +1,332 @@ +/*** +* +* Copyright (c) 1998, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +****/ + + +// upper design bounds + +#define MAX_MAP_HULLS 4 + +#define MAX_MAP_MODELS 400 +#define MAX_MAP_BRUSHES 4096 +#define MAX_MAP_ENTITIES 1024 +#define MAX_MAP_ENTSTRING (128*1024) + +#define MAX_MAP_PLANES 32767 +#define MAX_MAP_NODES 32767 // because negative shorts are contents +#define MAX_MAP_CLIPNODES 32767 // +#define MAX_MAP_LEAFS 8192 +#define MAX_MAP_VERTS 65535 +#define MAX_MAP_FACES 65535 +#define MAX_MAP_MARKSURFACES 65535 +#define MAX_MAP_TEXINFO 8192 +#define MAX_MAP_EDGES 256000 +#define MAX_MAP_SURFEDGES 512000 +#define MAX_MAP_TEXTURES 512 +#define MAX_MAP_MIPTEX 0x200000 +#define MAX_MAP_LIGHTING 0x200000 +#define MAX_MAP_VISIBILITY 0x200000 + +#define MAX_MAP_PORTALS 65536 + +// key / value pair sizes + +#define MAX_KEY 32 +#define MAX_VALUE 1024 + +//============================================================================= + + +#define BSPVERSION 30 +#define TOOLVERSION 2 + + +typedef struct +{ + int fileofs, filelen; +} lump_t; + +#define LUMP_ENTITIES 0 +#define LUMP_PLANES 1 +#define LUMP_TEXTURES 2 +#define LUMP_VERTEXES 3 +#define LUMP_VISIBILITY 4 +#define LUMP_NODES 5 +#define LUMP_TEXINFO 6 +#define LUMP_FACES 7 +#define LUMP_LIGHTING 8 +#define LUMP_CLIPNODES 9 +#define LUMP_LEAFS 10 +#define LUMP_MARKSURFACES 11 +#define LUMP_EDGES 12 +#define LUMP_SURFEDGES 13 +#define LUMP_MODELS 14 + +#define HEADER_LUMPS 15 + +typedef struct +{ + float mins[3], maxs[3]; + float origin[3]; + int headnode[MAX_MAP_HULLS]; + int visleafs; // not including the solid leaf 0 + int firstface, numfaces; +} dmodel_t; + +typedef struct +{ + int version; + lump_t lumps[HEADER_LUMPS]; +} dheader_t; + +typedef struct +{ + int nummiptex; + int dataofs[4]; // [nummiptex] +} dmiptexlump_t; + +#define MIPLEVELS 4 +typedef struct miptex_s +{ + char name[16]; + unsigned width, height; + unsigned offsets[MIPLEVELS]; // four mip maps stored +} miptex_t; + + +typedef struct +{ + float point[3]; +} dvertex_t; + + +// 0-2 are axial planes +#define PLANE_X 0 +#define PLANE_Y 1 +#define PLANE_Z 2 + +// 3-5 are non-axial planes snapped to the nearest +#define PLANE_ANYX 3 +#define PLANE_ANYY 4 +#define PLANE_ANYZ 5 + +typedef struct +{ + float normal[3]; + float dist; + int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate +} dplane_t; + + + +#define CONTENTS_EMPTY -1 +#define CONTENTS_SOLID -2 +#define CONTENTS_WATER -3 +#define CONTENTS_SLIME -4 +#define CONTENTS_LAVA -5 +#define CONTENTS_SKY -6 +#define CONTENTS_ORIGIN -7 // removed at csg time +#define CONTENTS_CLIP -8 // changed to contents_solid + +#define CONTENTS_CURRENT_0 -9 +#define CONTENTS_CURRENT_90 -10 +#define CONTENTS_CURRENT_180 -11 +#define CONTENTS_CURRENT_270 -12 +#define CONTENTS_CURRENT_UP -13 +#define CONTENTS_CURRENT_DOWN -14 + +#define CONTENTS_TRANSLUCENT -15 + +// !!! if this is changed, it must be changed in asm_i386.h too !!! +typedef struct +{ + int planenum; + short children[2]; // negative numbers are -(leafs+1), not nodes + short mins[3]; // for sphere culling + short maxs[3]; + unsigned short firstface; + unsigned short numfaces; // counting both sides +} dnode_t; + +typedef struct +{ + int planenum; + short children[2]; // negative numbers are contents +} dclipnode_t; + + +typedef struct texinfo_s +{ + float vecs[2][4]; // [s/t][xyz offset] + int miptex; + int flags; +} texinfo_t; +#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision + +// note that edge 0 is never used, because negative edge nums are used for +// counterclockwise use of the edge in a face +typedef struct +{ + unsigned short v[2]; // vertex numbers +} dedge_t; + +#define MAXLIGHTMAPS 4 +typedef struct +{ + short planenum; + short side; + + int firstedge; // we must support > 64k edges + short numedges; + short texinfo; + +// lighting info + byte styles[MAXLIGHTMAPS]; + int lightofs; // start of [numstyles*surfsize] samples +} dface_t; + + + +#define AMBIENT_WATER 0 +#define AMBIENT_SKY 1 +#define AMBIENT_SLIME 2 +#define AMBIENT_LAVA 3 + +#define NUM_AMBIENTS 4 // automatic ambient sounds + +// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas +// all other leafs need visibility info +typedef struct +{ + int contents; + int visofs; // -1 = no visibility info + + short mins[3]; // for frustum culling + short maxs[3]; + + unsigned short firstmarksurface; + unsigned short nummarksurfaces; + + byte ambient_level[NUM_AMBIENTS]; +} dleaf_t; + + +//============================================================================ + +#ifndef QUAKE_GAME + +#define ANGLE_UP -1 +#define ANGLE_DOWN -2 + + +// the utilities get to be lazy and just use large static arrays + +extern int nummodels; +extern dmodel_t dmodels[MAX_MAP_MODELS]; +extern int dmodels_checksum; + +extern int visdatasize; +extern byte dvisdata[MAX_MAP_VISIBILITY]; +extern int dvisdata_checksum; + +extern int lightdatasize; +extern byte dlightdata[MAX_MAP_LIGHTING]; +extern int dlightdata_checksum; + +extern int texdatasize; +extern byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t) +extern int dtexdata_checksum; + +extern int entdatasize; +extern char dentdata[MAX_MAP_ENTSTRING]; +extern int dentdata_checksum; + +extern int numleafs; +extern dleaf_t dleafs[MAX_MAP_LEAFS]; +extern int dleafs_checksum; + +extern int numplanes; +extern dplane_t dplanes[MAX_MAP_PLANES]; +extern int dplanes_checksum; + +extern int numvertexes; +extern dvertex_t dvertexes[MAX_MAP_VERTS]; +extern int dvertexes_checksum; + +extern int numnodes; +extern dnode_t dnodes[MAX_MAP_NODES]; +extern int dnodes_checksum; + +extern int numtexinfo; +extern texinfo_t texinfo[MAX_MAP_TEXINFO]; +extern int texinfo_checksum; + +extern int numfaces; +extern dface_t dfaces[MAX_MAP_FACES]; +extern int dfaces_checksum; + +extern int numclipnodes; +extern dclipnode_t dclipnodes[MAX_MAP_CLIPNODES]; +extern int dclipnodes_checksum; + +extern int numedges; +extern dedge_t dedges[MAX_MAP_EDGES]; +extern int dedges_checksum; + +extern int nummarksurfaces; +extern unsigned short dmarksurfaces[MAX_MAP_MARKSURFACES]; +extern int dmarksurfaces_checksum; + +extern int numsurfedges; +extern int dsurfedges[MAX_MAP_SURFEDGES]; +extern int dsurfedges_checksum; + +int FastChecksum(void *buffer, int bytes); + +void DecompressVis (byte *in, byte *decompressed); +int CompressVis (byte *vis, byte *dest); + +void LoadBSPFile (char *filename); +void WriteBSPFile (char *filename); +void PrintBSPFileSizes (void); + +//=============== + + +typedef struct epair_s +{ + struct epair_s *next; + char *key; + char *value; +} epair_t; + +typedef struct +{ + vec3_t origin; + int firstbrush; + int numbrushes; + epair_t *epairs; +} entity_t; + +extern int num_entities; +extern entity_t entities[MAX_MAP_ENTITIES]; + +void ParseEntities (void); +void UnparseEntities (void); + +void SetKeyValue (entity_t *ent, char *key, char *value); +char *ValueForKey (entity_t *ent, char *key); +// will return "" if not present + +vec_t FloatForKey (entity_t *ent, char *key); +void GetVectorForKey (entity_t *ent, char *key, vec3_t vec); + +epair_t *ParseEpair (void); + +#endif diff --git a/utils/common/l3dslib.c b/utils/common/l3dslib.c new file mode 100644 index 0000000..8b98d23 --- /dev/null +++ b/utils/common/l3dslib.c @@ -0,0 +1,282 @@ +// +// l3dslib.c: library for loading triangles from an Alias triangle file +// + +#include +#include "cmdlib.h" +#include "mathlib.h" +#include "trilib.h" +#include "l3dslib.h" + +#define MAIN3DS 0x4D4D +#define EDIT3DS 0x3D3D // this is the start of the editor config +#define EDIT_OBJECT 0x4000 +#define OBJ_TRIMESH 0x4100 +#define TRI_VERTEXL 0x4110 +#define TRI_FACEL1 0x4120 + +#define MAXVERTS 2000 + +typedef struct { + int v[4]; +} tri; + +float fverts[MAXVERTS][3]; +tri tris[MAXTRIANGLES]; + +int bytesread, level, numtris, totaltris; +int vertsfound, trisfound; + +triangle_t *ptri; + + +// Alias stores triangles as 3 explicit vertices in .tri files, so even though we +// start out with a vertex pool and vertex indices for triangles, we have to convert +// to raw, explicit triangles +void StoreAliasTriangles (void) +{ + int i, j, k; + + if ((totaltris + numtris) > MAXTRIANGLES) + Error ("Error: Too many triangles"); + + for (i=0; i MAXVERTS) + Error ("Error: Too many vertices"); + + for (i=0 ; i MAXTRIANGLES) + Error ("Error: Too many triangles"); + + for (i=0 ; i 0) + { + w -= ParseChunk (input); + } + + retval = length; + goto Done; + + default: + // skip other chunks + while (w > 0) + { + t = w; + + if (t > BLOCK_SIZE) + t = BLOCK_SIZE; + + if (feof(input)) + Error ("Error: unexpected end of file"); + + fread (&temp, t, 1, input); + bytesread += t; + + w -= t; + } + + retval = length; + goto Done; + } + +Done: + level--; + return retval; +} + + +void Load3DSTriangleList (char *filename, triangle_t **pptri, int *numtriangles) +{ + FILE *input; + float start; + char name[256], tex[256]; + short int tshort; + + bytesread = 0; + level = 0; + numtris = 0; + totaltris = 0; + vertsfound = 0; + trisfound = 0; + + if ((input = fopen(filename, "rb")) == 0) { + fprintf(stderr,"reader: could not open file '%s'\n", filename); + exit(0); + } + + fread(&tshort, sizeof(tshort), 1, input); + +// should only be MAIN3DS, but some files seem to start with EDIT3DS, with +// no MAIN3DS + if ((tshort != MAIN3DS) && (tshort != EDIT3DS)) { + fprintf(stderr,"File is not a 3DS file.\n"); + exit(0); + } + +// back to top of file so we can parse the first chunk descriptor + fseek(input, 0, SEEK_SET); + + ptri = malloc (MAXTRIANGLES * sizeof(triangle_t)); + + *pptri = ptri; + +// parse through looking for the relevant chunk tree (MAIN3DS | EDIT3DS | EDIT_OBJECT | +// OBJ_TRIMESH | {TRI_VERTEXL, TRI_FACEL1}) and skipping other chunks + ParseChunk (input); + + if (vertsfound || trisfound) + Error ("Incomplete triangle set"); + + *numtriangles = totaltris; + + fclose (input); +} + diff --git a/utils/common/l3dslib.h b/utils/common/l3dslib.h new file mode 100644 index 0000000..d155376 --- /dev/null +++ b/utils/common/l3dslib.h @@ -0,0 +1,5 @@ +// +// l3dslib.h: header file for loading triangles from a 3DS triangle file +// +void Load3DSTriangleList (char *filename, triangle_t **pptri, int *numtriangles); + diff --git a/utils/common/meter.c b/utils/common/meter.c new file mode 100644 index 0000000..bfdce0f --- /dev/null +++ b/utils/common/meter.c @@ -0,0 +1,34 @@ +/* + meter.c + + Implements a dorky progess meter +*/ + +int showmeter = 0; +static int meter_cur, meter_max; + +void MeterStart( int max ) +{ + meter_cur = 0; + meter_max = max; +} + + +void MeterAdvance( int amt ) +{ + float pct; + + meter_cur += amt; + + if( showmeter ) + { + pct = ( (float) meter_cur / (float) meter_max ) * 100.0; + printf( "\r%d/%d (%0.2f%%) ", meter_cur, meter_max, pct ); + } +} + + +void MeterEnd( void ) +{ + printf( "\n" ); +} diff --git a/utils/common/meter.h b/utils/common/meter.h new file mode 100644 index 0000000..58edf87 --- /dev/null +++ b/utils/common/meter.h @@ -0,0 +1,16 @@ +#ifndef _METER_H_ +#define _METER_H_ + +/* + meter.h + + Dorky status bar stuff +*/ + +void MeterStart( int max ); +void MeterAdvance( int amt ); +void MeterEnd( void ); + +extern int showmeter; + +#endif \ No newline at end of file diff --git a/utils/light/new/light.c b/utils/light/new/light.c new file mode 100644 index 0000000..d7427cd --- /dev/null +++ b/utils/light/new/light.c @@ -0,0 +1,193 @@ +// lighting.c + +#include "light.h" + +/* + +NOTES +----- + +*/ + +float scaledist = 1.0; +float scalecos = 0.5; +float rangescale = 0.5; + +byte *filebase, *file_p, *file_end; + +dmodel_t *bspmodel; + +vec3_t bsp_origin; + +qboolean extrasamples; + +float minlights[MAX_MAP_FACES]; + + + + +lightentity_t lightentities[MAX_MAP_ENTITIES]; +int numlightentities; + + +/* +================== +LoadEntities +================== +*/ +void LoadEntities (void) +{ + char *s, *s2; + entity_t *e; + lightentity_t *le; + int i, j; + + ParseEntities (); + +// go through all the entities + for (i=1 ; iclassname, s); + le->light = FloatForKey (e, "light"); + if (!le->light) + le->light = DEFAULTLIGHTLEVEL; + le->style = FloatForKey (e, "style"); + le->angle = FloatForKey (e, "angle"); + GetVectorForKey (e, "origin", le->origin); + + s = ValueForKey (e, "target"); + if (!s[0]) + continue; + + // find matching targetname + for (j=1 ; jtargetent = true; + GetVectorForKey (&entities[j], "origin", le->targetorigin); + break; + } + } + if (j == num_entities) + printf ("WARNING: entity %i has unmatched target %s\n", i, s); + } + + qprintf ("%d lightentities\n", numlightentities); + +} + + +byte *GetFileSpace (int size) +{ + byte *buf; + + ThreadLock(); + file_p = (byte *)(((long)file_p + 3)&~3); + buf = file_p; + file_p += size; + ThreadUnlock(); + if (file_p > file_end) + Error ("GetFileSpace: overrun"); + return buf; +} + + + +/* +============= +LightWorld +============= +*/ +void LightWorld (void) +{ + filebase = file_p = dlightdata; + file_end = filebase + MAX_MAP_LIGHTING; + + RunThreadsOnIndividual (numfaces, true, LightFace); + + lightdatasize = file_p - filebase; + + printf ("lightdatasize: %i\n", lightdatasize); +} + + +/* +======== +main + +light modelfile +======== +*/ +int main (int argc, char **argv) +{ + int i; + double start, end; + char source[1024]; + + printf ("----- LightFaces ----\n"); + + for (i=1 ; iface->texinfo]; + +// convert from float to vec_t + for (i=0 ; i<2 ; i++) + for (j=0 ; j<3 ; j++) + l->worldtotex[i][j] = tex->vecs[i][j]; + +// calculate a normal to the texture axis. points can be moved along this +// without changing their S/T + texnormal[0] = tex->vecs[1][1]*tex->vecs[0][2] + - tex->vecs[1][2]*tex->vecs[0][1]; + texnormal[1] = tex->vecs[1][2]*tex->vecs[0][0] + - tex->vecs[1][0]*tex->vecs[0][2]; + texnormal[2] = tex->vecs[1][0]*tex->vecs[0][1] + - tex->vecs[1][1]*tex->vecs[0][0]; + VectorNormalize (texnormal); + +// flip it towards plane normal + distscale = DotProduct (texnormal, l->facenormal); + if (!distscale) + Error ("Texture axis perpendicular to face"); + if (distscale < 0) + { + distscale = -distscale; + VectorSubtract (vec3_origin, texnormal, texnormal); + } + +// distscale is the ratio of the distance along the texture normal to +// the distance along the plane normal + distscale = 1/distscale; + + for (i=0 ; i<2 ; i++) + { + len = VectorLength (l->worldtotex[i]); + dist = DotProduct (l->worldtotex[i], l->facenormal); + dist *= distscale; + VectorMA (l->worldtotex[i], -dist, texnormal, l->textoworld[i]); + VectorScale (l->textoworld[i], (1/len)*(1/len), l->textoworld[i]); + } + + +// calculate texorg on the texture plane + for (i=0 ; i<3 ; i++) + l->texorg[i] = -tex->vecs[0][3]* l->textoworld[0][i] - tex->vecs[1][3] * l->textoworld[1][i]; + +// project back to the face plane + dist = DotProduct (l->texorg, l->facenormal) - l->facedist - 1; + dist *= distscale; + VectorMA (l->texorg, -dist, texnormal, l->texorg); + +} + +/* +================ +CalcFaceExtents + +Fills in s->texmins[] and s->texsize[] +also sets exactmins[] and exactmaxs[] +================ +*/ +void CalcFaceExtents (lightinfo_t *l) +{ + dface_t *s; + vec_t mins[2], maxs[2], val; + int i,j, e; + dvertex_t *v; + texinfo_t *tex; + + s = l->face; + + mins[0] = mins[1] = 999999; + maxs[0] = maxs[1] = -99999; + + tex = &texinfo[s->texinfo]; + + for (i=0 ; inumedges ; i++) + { + e = dsurfedges[s->firstedge+i]; + if (e >= 0) + v = dvertexes + dedges[e].v[0]; + else + v = dvertexes + dedges[-e].v[1]; + + for (j=0 ; j<2 ; j++) + { + val = v->point[0] * tex->vecs[j][0] + + v->point[1] * tex->vecs[j][1] + + v->point[2] * tex->vecs[j][2] + + tex->vecs[j][3]; + if (val < mins[j]) + mins[j] = val; + if (val > maxs[j]) + maxs[j] = val; + } + } + + for (i=0 ; i<2 ; i++) + { + l->exactmins[i] = mins[i]; + l->exactmaxs[i] = maxs[i]; + + mins[i] = floor(mins[i]/16); + maxs[i] = ceil(maxs[i]/16); + + l->texmins[i] = mins[i]; + l->texsize[i] = maxs[i] - mins[i]; + if (l->texsize[i] > 17) + Error ("Bad surface extents"); + } +} + +/* +================= +CalcPoints + +For each texture aligned grid point, back project onto the plane +to get the world xyz value of the sample point +================= +*/ +int c_bad; +void CalcPoints (lightinfo_t *l) +{ + int i; + int s, t, j; + int w, h, step; + vec_t starts, startt, us, ut; + vec_t *surf; + vec_t mids, midt; + vec3_t facemid, move; + +// +// fill in surforg +// the points are biased towards the center of the surface +// to help avoid edge cases just inside walls +// + surf = l->surfpt[0]; + mids = (l->exactmaxs[0] + l->exactmins[0])/2; + midt = (l->exactmaxs[1] + l->exactmins[1])/2; + + for (j=0 ; j<3 ; j++) + facemid[j] = l->texorg[j] + l->textoworld[0][j]*mids + l->textoworld[1][j]*midt; + + if (extrasamples) + { // extra filtering + h = (l->texsize[1]+1)*2; + w = (l->texsize[0]+1)*2; + starts = (l->texmins[0]-0.5)*16; + startt = (l->texmins[1]-0.5)*16; + step = 8; + } + else + { + h = l->texsize[1]+1; + w = l->texsize[0]+1; + starts = l->texmins[0]*16; + startt = l->texmins[1]*16; + step = 16; + } + + l->numsurfpt = w * h; + for (t=0 ; ttexorg[j] + l->textoworld[0][j]*us + + l->textoworld[1][j]*ut; + + if (CastRay (facemid, surf) != -1) + break; // got it + if (i & 1) + { + if (us > mids) + { + us -= 8; + if (us < mids) + us = mids; + } + else + { + us += 8; + if (us > mids) + us = mids; + } + } + else + { + if (ut > midt) + { + ut -= 8; + if (ut < midt) + ut = midt; + } + else + { + ut += 8; + if (ut > midt) + ut = midt; + } + } + + // move surf 8 pixels towards the center + VectorSubtract (facemid, surf, move); + VectorNormalize (move); + VectorMA (surf, 8, move, surf); + } + if (i == 2) + c_bad++; + } + } + +} + + +/* +=============================================================================== + +FACE LIGHTING + +=============================================================================== +*/ + +int c_culldistplane, c_proper; + +/* +================ +SingleLightFace +================ +*/ +void SingleLightFace (lightentity_t *light, lightinfo_t *l) +{ + vec_t dist; + vec3_t incoming; + vec_t angle; + vec_t add; + vec_t *surf; + qboolean hit; + int mapnum; + int size; + int c, i; + vec3_t rel; + vec3_t spotvec; + vec_t falloff; + vec_t *lightsamp; + + VectorSubtract (light->origin, bsp_origin, rel); + dist = scaledist * (DotProduct (rel, l->facenormal) - l->facedist); + +// don't bother with lights behind the surface + if (dist <= 0) + return; + +// don't bother with light too far away + if (dist > light->light) + { + c_culldistplane++; + return; + } + + if (light->targetent) + { + VectorSubtract (light->targetorigin, light->origin, spotvec); + VectorNormalize (spotvec); + if (!light->angle) + falloff = -cos(20*Q_PI/180); + else + falloff = -cos(light->angle/2*Q_PI/180); + } + else + falloff = 0; // shut up compiler warnings + + mapnum = 0; + for (mapnum=0 ; mapnumnumlightstyles ; mapnum++) + if (l->lightstyles[mapnum] == light->style) + break; + lightsamp = l->lightmaps[mapnum]; + if (mapnum == l->numlightstyles) + { // init a new light map + if (mapnum == MAXLIGHTMAPS) + { + printf ("WARNING: Too many light styles on a face\n"); + return; + } + size = (l->texsize[1]+1)*(l->texsize[0]+1); + for (i=0 ; isurfpt[0]; + for (c=0 ; cnumsurfpt ; c++, surf+=3) + { + dist = CastRay(light->origin, surf)*scaledist; + if (dist < 0) + continue; // light doesn't reach + + VectorSubtract (light->origin, surf, incoming); + VectorNormalize (incoming); + angle = DotProduct (incoming, l->facenormal); + if (light->targetent) + { // spotlight cutoff + if (DotProduct (spotvec, incoming) > falloff) + continue; + } + + angle = (1.0-scalecos) + scalecos*angle; + add = light->light - dist; + add *= angle; + if (add < 0) + continue; + lightsamp[c] += add; + if (lightsamp[c] > 1) // ignore real tiny lights + hit = true; + } + + if (mapnum == l->numlightstyles && hit) + { + l->lightstyles[mapnum] = light->style; + l->numlightstyles++; // the style has some real data now + } +} + +/* +============ +FixMinlight +============ +*/ +void FixMinlight (lightinfo_t *l) +{ + int i, j; + float minlight; + + minlight = minlights[l->surfnum]; + +// if minlight is set, there must be a style 0 light map + if (!minlight) + return; + + for (i=0 ; i< l->numlightstyles ; i++) + { + if (l->lightstyles[i] == 0) + break; + } + if (i == l->numlightstyles) + { + if (l->numlightstyles == MAXLIGHTMAPS) + return; // oh well.. + for (j=0 ; jnumsurfpt ; j++) + l->lightmaps[i][j] = minlight; + l->lightstyles[i] = 0; + l->numlightstyles++; + } + else + { + for (j=0 ; jnumsurfpt ; j++) + if ( l->lightmaps[i][j] < minlight) + l->lightmaps[i][j] = minlight; + } +} + + +/* +============ +LightFace +============ +*/ +void LightFace (int surfnum) +{ + dface_t *f; + lightinfo_t l; + int s, t; + int i,j,c; + vec_t total; + int size; + int lightmapwidth, lightmapsize; + byte *out; + vec_t *light; + int w, h; + + f = dfaces + surfnum; + +// +// some surfaces don't need lightmaps +// + f->lightofs = -1; + for (j=0 ; jstyles[j] = 255; + + if ( texinfo[f->texinfo].flags & TEX_SPECIAL) + { // non-lit texture + return; + } + + memset (&l, 0, sizeof(l)); + l.surfnum = surfnum; + l.face = f; + +// +// rotate plane +// + VectorCopy (dplanes[f->planenum].normal, l.facenormal); + l.facedist = dplanes[f->planenum].dist; + if (f->side) + { + VectorSubtract (vec3_origin, l.facenormal, l.facenormal); + l.facedist = -l.facedist; + } + + + + CalcFaceVectors (&l); + CalcFaceExtents (&l); + CalcPoints (&l); + + lightmapwidth = l.texsize[0]+1; + + size = lightmapwidth*(l.texsize[1]+1); + if (size > SINGLEMAP) + Error ("Bad lightmap size"); + + for (i=0 ; istyles[i] = l.lightstyles[i]; + + lightmapsize = size*l.numlightstyles; + + out = GetFileSpace (lightmapsize); + f->lightofs = out - filebase; + +// extra filtering + h = (l.texsize[1]+1)*2; + w = (l.texsize[0]+1)*2; + + for (i=0 ; i< l.numlightstyles ; i++) + { + if (l.lightstyles[i] == 0xff) + Error ("Wrote empty lightmap"); + light = l.lightmaps[i]; + c = 0; + for (t=0 ; t<=l.texsize[1] ; t++) + for (s=0 ; s<=l.texsize[0] ; s++, c++) + { + if (extrasamples) + { // filtered sample + total = light[t*2*w+s*2] + light[t*2*w+s*2+1] + + light[(t*2+1)*w+s*2] + light[(t*2+1)*w+s*2+1]; + total *= 0.25; + } + else + total = light[c]; + total *= rangescale; // scale before clamping + if (total > 255) + total = 255; + if (total < 0) + Error ("light < 0"); + *out++ = total; + } + } + + +} + diff --git a/utils/light/new/trace.c b/utils/light/new/trace.c new file mode 100644 index 0000000..63e224c --- /dev/null +++ b/utils/light/new/trace.c @@ -0,0 +1,199 @@ +// trace.c + +#include "light.h" + +typedef struct tnode_s +{ + int type; + vec3_t normal; + float dist; + int children[2]; + int pad; +} tnode_t; + +tnode_t *tnodes, *tnode_p; + +/* +============== +MakeTnode + +Converts the disk node structure into the efficient tracing structure +============== +*/ +void MakeTnode (int nodenum) +{ + tnode_t *t; + dplane_t *plane; + int i; + dnode_t *node; + + t = tnode_p++; + + node = dnodes + nodenum; + plane = dplanes + node->planenum; + + t->type = plane->type; + VectorCopy (plane->normal, t->normal); + t->dist = plane->dist; + + for (i=0 ; i<2 ; i++) + { + if (node->children[i] < 0) + t->children[i] = dleafs[-node->children[i] - 1].contents; + else + { + t->children[i] = tnode_p - tnodes; + MakeTnode (node->children[i]); + } + } + +} + + +/* +============= +MakeTnodes + +Loads the node structure out of a .bsp file to be used for light occlusion +============= +*/ +void MakeTnodes (dmodel_t *bm) +{ + if (!numnodes) + Error ("Map has no nodes\n"); + tnode_p = tnodes = malloc(numnodes * sizeof(tnode_t)); + + MakeTnode (0); +} + + + +/* +============================================================================== + +LINE TRACING + +The major lighting operation is a point to point visibility test, performed +by recursive subdivision of the line by the BSP tree. + +============================================================================== +*/ + +typedef struct +{ + vec3_t backpt; + int side; + int node; +} tracestack_t; + + +/* +============== +TestLine +============== +*/ +qboolean TestLine (vec3_t start, vec3_t stop) +{ + int node; + float front, back; + tracestack_t *tstack_p; + int side; + float frontx,fronty, frontz, backx, backy, backz; + tracestack_t tracestack[64]; + tnode_t *tnode; + + frontx = start[0]; + fronty = start[1]; + frontz = start[2]; + backx = stop[0]; + backy = stop[1]; + backz = stop[2]; + + tstack_p = tracestack; + node = 0; + + while (1) + { + while (node < 0 && node != CONTENTS_SOLID) + { + // pop up the stack for a back side + tstack_p--; + if (tstack_p < tracestack) + return true; + node = tstack_p->node; + + // set the hit point for this plane + + frontx = backx; + fronty = backy; + frontz = backz; + + // go down the back side + + backx = tstack_p->backpt[0]; + backy = tstack_p->backpt[1]; + backz = tstack_p->backpt[2]; + + node = tnodes[tstack_p->node].children[!tstack_p->side]; + } + + if (node == CONTENTS_SOLID) + return false; // DONE! + + tnode = &tnodes[node]; + + switch (tnode->type) + { + case PLANE_X: + front = frontx - tnode->dist; + back = backx - tnode->dist; + break; + case PLANE_Y: + front = fronty - tnode->dist; + back = backy - tnode->dist; + break; + case PLANE_Z: + front = frontz - tnode->dist; + back = backz - tnode->dist; + break; + default: + front = (frontx*tnode->normal[0] + fronty*tnode->normal[1] + frontz*tnode->normal[2]) - tnode->dist; + back = (backx*tnode->normal[0] + backy*tnode->normal[1] + backz*tnode->normal[2]) - tnode->dist; + break; + } + + if (front > -ON_EPSILON && back > -ON_EPSILON) +// if (front > 0 && back > 0) + { + node = tnode->children[0]; + continue; + } + + if (front < ON_EPSILON && back < ON_EPSILON) +// if (front <= 0 && back <= 0) + { + node = tnode->children[1]; + continue; + } + + side = front < 0; + + front = front / (front-back); + + tstack_p->node = node; + tstack_p->side = side; + tstack_p->backpt[0] = backx; + tstack_p->backpt[1] = backy; + tstack_p->backpt[2] = backz; + + tstack_p++; + + backx = frontx + front*(backx-frontx); + backy = fronty + front*(backy-fronty); + backz = frontz + front*(backz-frontz); + + node = tnode->children[side]; + } +} + + diff --git a/utils/mdlviewer/mdlviewer.cpp b/utils/mdlviewer/mdlviewer.cpp index d7e4081..a321401 100644 --- a/utils/mdlviewer/mdlviewer.cpp +++ b/utils/mdlviewer/mdlviewer.cpp @@ -15,6 +15,7 @@ #include #include "mathlib.h" +#include "../../public/steam/steamtypes.h" // defines int32, required by studio.h #include "..\..\engine\studio.h" #include "mdlviewer.h" diff --git a/utils/mdlviewer/studio_render.cpp b/utils/mdlviewer/studio_render.cpp index 6bbac2e..6df7338 100644 --- a/utils/mdlviewer/studio_render.cpp +++ b/utils/mdlviewer/studio_render.cpp @@ -22,6 +22,7 @@ //////////////////////////////////////////////////////////////////////// #include "mathlib.h" +#include "../../public/steam/steamtypes.h" // defines int32, required by studio.h #include "..\..\engine\studio.h" #include "mdlviewer.h" @@ -265,7 +266,7 @@ mstudioanim_t * StudioModel::GetAnim( mstudioseqdesc_t *pseqdesc ) if (pseqdesc->seqgroup == 0) { - return (mstudioanim_t *)((byte *)m_pstudiohdr + pseqgroup->data + pseqdesc->animindex); + return (mstudioanim_t *)((byte *)m_pstudiohdr + pseqgroup->unused2 /* was pseqgroup->data, will be almost always be 0 */ + pseqdesc->animindex); } return (mstudioanim_t *)((byte *)m_panimhdr[pseqdesc->seqgroup] + pseqdesc->animindex); diff --git a/utils/mdlviewer/studio_utils.cpp b/utils/mdlviewer/studio_utils.cpp index bee352a..9db1910 100644 --- a/utils/mdlviewer/studio_utils.cpp +++ b/utils/mdlviewer/studio_utils.cpp @@ -20,6 +20,7 @@ #include #include "mathlib.h" +#include "../../public/steam/steamtypes.h" // defines int32, required by studio.h #include "..\..\engine\studio.h" #include "mdlviewer.h" @@ -32,19 +33,20 @@ static int g_texnum = 1; void StudioModel::UploadTexture(mstudiotexture_t *ptexture, byte *data, byte *pal) { // unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight; + int outwidth, outheight; int i, j; int row1[256], row2[256], col1[256], col2[256]; byte *pix1, *pix2, *pix3, *pix4; byte *tex, *out; // convert texture to power of 2 - for (int outwidth = 1; outwidth < ptexture->width; outwidth <<= 1) + for (outwidth = 1; outwidth < ptexture->width; outwidth <<= 1) ; if (outwidth > 256) outwidth = 256; - for (int outheight = 1; outheight < ptexture->height; outheight <<= 1) + for (outheight = 1; outheight < ptexture->height; outheight <<= 1) ; if (outheight > 256) @@ -266,10 +268,11 @@ void StudioModel::GetSequenceInfo( float *pflFrameRate, float *pflGroundSpeed ) float StudioModel::SetController( int iController, float flValue ) { + int i; mstudiobonecontroller_t *pbonecontroller = (mstudiobonecontroller_t *)((byte *)m_pstudiohdr + m_pstudiohdr->bonecontrollerindex); // find first controller that matches the index - for (int i = 0; i < m_pstudiohdr->numbonecontrollers; i++, pbonecontroller++) + for (i = 0; i < m_pstudiohdr->numbonecontrollers; i++, pbonecontroller++) { if (pbonecontroller->index == iController) break; diff --git a/utils/mkmovie/mkmovie.dsp b/utils/mkmovie/mkmovie.dsp new file mode 100644 index 0000000..a34835b --- /dev/null +++ b/utils/mkmovie/mkmovie.dsp @@ -0,0 +1,103 @@ +# Microsoft Developer Studio Project File - Name="mkmovie" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=mkmovie - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "mkmovie.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "mkmovie.mak" CFG="mkmovie - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mkmovie - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "mkmovie - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "mkmovie - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "mkmovie - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "mkmovie - Win32 Release" +# Name "mkmovie - Win32 Debug" +# Begin Group "Source files" + +# PROP Default_Filter "*.c" +# Begin Source File + +SOURCE=.\mkmovie.c +# End Source File +# End Group +# Begin Group "Include files" + +# PROP Default_Filter "*.h" +# Begin Source File + +SOURCE=..\common\cmdlib.h +# End Source File +# Begin Source File + +SOURCE=..\common\movie.h +# End Source File +# End Group +# End Target +# End Project diff --git a/utils/procinfo/procinfo.cpp b/utils/procinfo/procinfo.cpp new file mode 100644 index 0000000..7ca1409 --- /dev/null +++ b/utils/procinfo/procinfo.cpp @@ -0,0 +1,189 @@ +/*************************************************************************** +; Copyright (C) 1998 Intel Corp. +; +; Subject to the terms and conditions set forth below, Intel hereby +; grants you a nonexclusive, nontransferable license, to use, +; reproduce and distribute the example code sequences contained +; herein, in object code format, solely as part of your computer +; program(s) and solely in order to allow your computer program(s) to +; implement the multimedia instruction extensions contained in such +; sequences solely with respect to the Intel instruction set +; architecture. No other license, express, implied, statutory, by +; estoppel or otherwise, to any other intellectual property rights is +; granted herein. +; +; ALL INFORMATION, SAMPLES AND OTHER MATERIALS PROVIDED HEREIN +; INCLUDING, WITHOUT LIMITATION, THE EXAMPLE CODE SEQUENCES ARE +; PROVIDED "AS IS" WITH NO WARRANTIES, EXPRESS, IMPLIED, STATUTORY OR +; OTHERWISE, AND INTEL SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF +; MERCHANTABILITY, NONINFRINGEMENT OR FITNESS FOR ANY PARTICULAR +; PURPOSE. +; +; THE MATERIALS PROVIDED HEREIN ARE PROVIDED WITHOUT CHARGE. +; THEREFORE, IN NO EVENT WILL INTEL BE LIABLE FOR ANY DAMAGES OF ANY +; KIND, INCLUDING DIRECT OR INDIRECT DAMAGES, LOSS OF DATA, LOST +; PROFITS, COST OF COVER OR SPECIAL, INCIDENTAL, CONSEQUENTIAL, +; DAMAGES ARISING FROM THE USE OF THE MATERIALS PROVIDED HEREIN, +; INCLUDING WITHOUT LIMITATION THE EXAMPLE CODE SEQUENCES, HOWEVER +; CAUSED AND ON ANY THEORY OF LIABILITY. THIS LIMITATION WILL APPLY +; EVEN IF INTEL OR ANY AUTHORIZED AGENT OF INTEL HAS BEEN ADVISED OF +; THE POSSIBILITY OF SUCH DAMAGE. +; +;***************************************************************************/ + + +#include "windows.h" + +typedef unsigned __int64 QWORD; + +#define RDTSC _asm _emit 0fh _asm _emit 031h +#define CPUID _asm _emit 0fh _asm _emit 0a2h +#define EMMS _asm _emit 0fh _asm _emit 077h + +// If CPUID supported return 1, else return 0 +unsigned int HasCpuid() +{ + unsigned int supported = 0; + + _asm { + push ebx ; save ebx + pushfd ; save flags + pushfd + pop eax + mov ebx,eax ; save old flags + xor eax,(1 SHL 21) ; flip id bit + push eax + popfd + pushfd + pop eax + popfd ; restore origional flags + cmp ebx,eax ; did ID bit change? + pop ebx + je Done ; if no change fail + mov supported,1 ; CPUID is supported + Done: + } + + return supported; +} + + +// If RDTSC supported return 1, else return 0 +unsigned int HasTsc() +{ + unsigned int supported = 0; + + if(! HasCpuid()) + return 0; + + _asm { + ; check that max cpuid levels must be at least 1 + mov eax,0 + CPUID + cmp eax,1 + jl Done + + ; check TSC bit in feature flags + mov eax,1 + CPUID + bt edx,4 ; check TSD bit + jnc Done + + ; RDTSC is supported + mov supported,1 + Done: + } + + return supported; +} + + +// -------------------------------------------------------------------------- +QWORD GetRDTSC(void) +{ + QWORD clock; + _asm + { + // cpuid serializes for out of order processors + push ebx + push ecx + xor eax, eax + CPUID + RDTSC + mov dword ptr clock, eax + mov dword ptr clock+4, edx + xor eax, eax + CPUID + pop ecx + pop ebx + } + return clock; +} +// ----------------------------------------------------------------------- +int PROC_GetSpeed(void) +{ + QWORD StartClock, ElapClock; + DWORD StartTime, times = 0; + int RetVal; + + if (!HasTsc()) + return 166; + + // try to get rid of the variability + StartClock = GetRDTSC(); + StartTime = timeGetTime(); + // this loop should take 1 sec +- 1 ms + while (timeGetTime() < StartTime + 250) + ; + ElapClock = GetRDTSC() - StartClock + 500000; + + // try to get rid of the variability + StartClock = GetRDTSC(); + StartTime = timeGetTime(); + // this loop should take 1 sec +- 1 ms + while (timeGetTime() < StartTime + 1000) + ; + ElapClock = GetRDTSC() - StartClock + 500000; + RetVal = (DWORD)(ElapClock/1000000); + return RetVal; +} + +#pragma optimize( "", off ) +// -------------------------------------------------------------------------- +int PROC_IsMMX(void) +{ + int retval = 1; + DWORD RegEDX; + + __try + { + _asm + { + mov eax, 1 // set up CPUID to return processor version and features + // 0 = vendor string, 1 = version info, 2 = cache info + CPUID // code bytes = 0fh, 0a2h + mov RegEDX, edx // features returned in edx + } + } __except(EXCEPTION_EXECUTE_HANDLER) { retval = FALSE; } + + if (retval == FALSE) + return 0; // processor does not support CPUID + + if (RegEDX & 0x800000) // bit 23 is set for MMX technology + { + __try { + EMMS // _asm emms + } // try executing the MMX instruction "emms" + __except(EXCEPTION_EXECUTE_HANDLER) { retval = FALSE; } + } + + else + return 0; // processor supports CPUID but does not support MMX technology + + // if retval == 0 here, it means the processor has MMX technology but + // floating-point emulation is on; so MMX technology is unavailable + + return retval; +} +// -------------------------------------------------------------------------- +#pragma optimize( "", on ) \ No newline at end of file diff --git a/utils/procinfo/procinfo.dsp b/utils/procinfo/procinfo.dsp new file mode 100644 index 0000000..d579b1f --- /dev/null +++ b/utils/procinfo/procinfo.dsp @@ -0,0 +1,118 @@ +# Microsoft Developer Studio Project File - Name="procinfo" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=procinfo - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "procinfo.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "procinfo.mak" CFG="procinfo - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "procinfo - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "procinfo - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "procinfo - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G5 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +# Begin Custom Build +InputPath=.\Release\procinfo.lib +SOURCE="$(InputPath)" + +"procinfo.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + attrib -r lib\win32_vc6\procinfo.lib + copy $(InputPath) lib\win32_vc6\procinfo.lib + +# End Custom Build + +!ELSEIF "$(CFG)" == "procinfo - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /G5 /MT /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +# Begin Custom Build +InputPath=.\Debug\procinfo.lib +SOURCE="$(InputPath)" + +"procinfo.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + attrib -r lib\win32_vc6\procinfo.lib + copy $(InputPath) lib\win32_vc6\procinfo.lib + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "procinfo - Win32 Release" +# Name "procinfo - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\procinfo.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\procinfo.h +# End Source File +# End Group +# End Target +# End Project diff --git a/utils/qbsp2/makefile b/utils/qbsp2/makefile new file mode 100644 index 0000000..875bb6d --- /dev/null +++ b/utils/qbsp2/makefile @@ -0,0 +1,65 @@ + +EXES = qbsp light vis bspinfo entmap visx +NTEXES = qbsp.exe light.exe vis.exe bspinfo.exe entmap.exe visx.exe + +#============================================================================== + +EXT= .o + +all: $(EXES) + +clean: + rm *.o *.obj $(EXES) $(NTEXES) + +next: + make "CFLAGS = -g -Wall -I.." + +nextinstall: + make "CFLAGS = -O4 -g -Wall -I.. -arch i386 -arch hppa" + cp $(EXES) /LocalApps + +alpha: + make "CFLAGS = -g -I.." "LDFLAGS = -lm" + +alphainstall: + make "CFLAGS = -O4 -I.." "LDFLAGS = -lm" + cp $(EXES) /LocalApps + +nt: + nmake /nologo "CFLAGS = -nologo -Zi -DWIN32 -I.." "LDFLAGS = " "EXT = .obj" + +ntinstall: + nmake /nologo "CFLAGS = -nologo -Ox -G5 -DWIN32 -I.." "LDFLAGS = " "EXT = .obj" + cp $(NTEXES) f:\nt\id + +#============================================================================== + + +QBSPFILES = region$(EXT) map$(EXT) brush$(EXT) cmdlib$(EXT) csg4$(EXT) surfaces$(EXT) mathlib$(EXT)\ + merge$(EXT) outside$(EXT) portals$(EXT) qbsp$(EXT) solidbsp$(EXT) tjunc$(EXT)\ + writebsp$(EXT) bspfile$(EXT) nodraw$(EXT) +qbsp : $(QBSPFILES) + $(CC) $(CFLAGS) -o qbsp $(QBSPFILES) + +light : threads$(EXT) bspfile$(EXT) cmdlib$(EXT) light$(EXT) ltface$(EXT) mathlib$(EXT) trace$(EXT) entities$(EXT) + $(CC) $(CFLAGS) -o light threads$(EXT) bspfile$(EXT) cmdlib$(EXT) light$(EXT) ltface$(EXT) mathlib$(EXT) trace$(EXT) entities$(EXT) + +vis : vis$(EXT) flow$(EXT) cmdlib$(EXT) mathlib$(EXT) bspfile$(EXT) soundpvs$(EXT) + $(CC) $(CFLAGS) -o vis vis$(EXT) flow$(EXT) cmdlib$(EXT) mathlib$(EXT) bspfile$(EXT) soundpvs$(EXT) + +visx : visx$(EXT) flowx$(EXT) cmdlib$(EXT) mathlib$(EXT) bspfile$(EXT) soundpvs$(EXT) + $(CC) $(CFLAGS) -o visx visx$(EXT) flowx$(EXT) cmdlib$(EXT) mathlib$(EXT) bspfile$(EXT) soundpvs$(EXT) + +bspinfo : bspinfo$(EXT) bspfile$(EXT) cmdlib$(EXT) + $(CC) $(CFLAGS) -o bspinfo bspinfo$(EXT) bspfile$(EXT) cmdlib$(EXT) + +entmap : entmap$(EXT) cmdlib$(EXT) + $(CC) $(CFLAGS) -o entmap entmap$(EXT) cmdlib$(EXT) + + +cmdlib$(EXT) : ../cmdlib.c + $(CC) $(CFLAGS) -c -o cmdlib$(EXT) ../cmdlib.c +mathlib$(EXT) : ../mathlib.c + $(CC) $(CFLAGS) -c -o mathlib$(EXT) ../mathlib.c + + diff --git a/utils/qbsp2/qbsp2.dsp b/utils/qbsp2/qbsp2.dsp index f46edf4..c62438b 100644 --- a/utils/qbsp2/qbsp2.dsp +++ b/utils/qbsp2/qbsp2.dsp @@ -23,7 +23,7 @@ CFG=qbsp2 - Win32 Release # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/SDKSrc/Tools/utils/qbsp2", VUGBAAAA" +# PROP Scc_ProjName ""$/Goldsrc/utils/qbsp2", VKBBAAAA" # PROP Scc_LocalPath "." CPP=cl.exe RSC=rc.exe @@ -64,7 +64,7 @@ LINK32=link.exe # PROP Intermediate_Dir ".\debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MT /Gm /GX /ZI /Od /I "..\common" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "DOUBLEVEC_T" /YX /FD /c +# ADD CPP /nologo /MT /Gm /GX /ZI /Od /I "..\common" /I "..\..\engine" /I "..\..\common" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "DOUBLEVEC_T" /D "_NOENUMQBOOL" /FR /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -82,14 +82,18 @@ LINK32=link.exe # Name "qbsp2 - Win32 Debug" # Begin Group "Source Files" -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" # Begin Source File SOURCE=.\bsp5.h # End Source File # Begin Source File -SOURCE=..\common\bspfile.c +SOURCE=..\common\bsplib.c +# End Source File +# Begin Source File + +SOURCE=..\common\bsplib.h # End Source File # Begin Source File @@ -149,10 +153,6 @@ SOURCE=.\writebsp.c # PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" # Begin Source File -SOURCE=..\common\bspfile.h -# End Source File -# Begin Source File - SOURCE=..\common\cmdlib.h # End Source File # Begin Source File diff --git a/utils/qlumpy/qlumpy.doc b/utils/qlumpy/qlumpy.doc new file mode 100644 index 0000000..21523d7 Binary files /dev/null and b/utils/qlumpy/qlumpy.doc differ diff --git a/utils/qrad/qrad.h b/utils/qrad/qrad.h index b64aec1..d05f2d1 100644 --- a/utils/qrad/qrad.h +++ b/utils/qrad/qrad.h @@ -23,7 +23,9 @@ #include #pragma warning(disable: 4142 4028) +#define filelength IO_filelength #include +#undef filelength #pragma warning(default: 4142 4028) #include diff --git a/utils/qrad/qrad.txt b/utils/qrad/qrad.txt new file mode 100644 index 0000000..59033a0 --- /dev/null +++ b/utils/qrad/qrad.txt @@ -0,0 +1,152 @@ +QRAD DOCUMENTATION + + +qrad [parameters] bspfile + +PARAMETERS YOU MIGHT WANT TO USE + +-bounce <0-???> default: 8 +Specifies the number of light bounces to perform. +0 gives direct lighting only, and does not calculate any +transfer functions, giving a very fast run. Under a minute +for a level with vis info, a few minutes without. +Because most of the time in full runs is in the transfer +function generation, the number of bounces greater than 0 +is not a crucial speed factor. + +-chop <16 - 256> default: 65 +Determines how finely patches will be chopped up for the +radiosity process. Smaller number give better results, +but use quadratically more ram and time. You can use +larger values like 96 or 128 to get the light properly +dispersed in the level (no need for a -ambient) but still +take lots less time than a full process. The older qrad +used a chop of 49, but it didn't do the direct lighting +as a seperate step. + +-ambient <0.0 - 1.0> default: 0.0 +This value is added to every light sample before any lighting +is done. An ambient of 0.1 (10%) or so can be used in +conjunction with a -bounce 0 to get a very fast aproximation +to the full process. + +-maxlight <1.0 - 2.0> default: 1.5 +If set to 1.0, no surface will ever be overbrighted, +no matter how much light shines on it. Artist types may +push for this to keep their textures from being abused by +the overbright tables. + + +PARAMETERS YOU AREN'T LIKELY TO USE + +-verbose +Turns on more detailed statistic printing. + +-dumppatches +Development aid -- writes bounce0.txt and bounce7.txt polygon +files for visualizing the radiosity process with glview.exe. + +-threads <1-???> default: number of cpus +Specifies the number of threads to use for calculations. +Set to 1 to isolate potential multithreaded errors. + +-scale <0.0 - ???> default: 1.0 +Multiplies all light values by this factor to brighten or +dim the entire level. If you are just way off either +overbright or almost black, you can easily try scales like +this. + + +USAGE IN DEVELOPMENT + +You should do a vis before performing a qrad. All of the +lighting tests are accelerated by the PVS information. + +If you haven't vised the map, subdiv will be forced to 9999 +to keep it from taking all day to complete. Even a fast vis +will help. + +The first part of the radiosity process is the accurate +calculation of direct lighting. + +All entity lights and the bright (5000 or greater) surface +patches exactly trace lines to the individual lightmap +samples. + +If -bounce 0 is specified, thats it for the lighting. +Otherwise, the lightmap values are summed up to give the +initial amount of light to be bounced around the world in the +radiosity pass. + + + +SURFACE LIGHTING + +All textures that are on the "light emiting" list will cast +light into the world, oriented down the surface normal. + +The lights.rad file is found inside the game directory +(f:\quake\id2, etc). It contains a list of texture names +and the amount of light they emit. + +A value of 100-300 is reasonable for a large, dim surface, like +slime, lava, or a dark sky. Lights that will illuminate large +areas with a small surface area will have values of 5000 +or greater. + +The total amount of light emited from a surface is proportional +to the surface's area, so the size of the brush face has as +much effect on the light sent into the world as the light value. + +Surface lighting falls off with the sqare of distance, so if +you double the height of a room, you will need to have four +times the light intensity on the ceiling to get the floor +the same brightness. The walls would then be much brighter +near the top than they were with the smaller room as well. + + +SKY LIGHTING + +Skys emit light like other surfaces, but have slightly +different characteristics. They emit light from all angles, +so it doesn't matter if you see a horizontal or vertical sky +brush. Light also does not bounce off of a sky in the +radiosity pass, if it flies out a sky texture it is just gone. + + +ENTITY LIGHTING + +You can use "light" entities to have light come from space +without a surface. A level designer goto. They should +function similar to quake 1 lights, with linear falloff +instead of inverse quadratic. + +The new class "light_spot" can be used to make a spotlight. +If it is targeted at another entity, the spotlight will point +directly at it, otherwise it will point in the direction of +its "angle" field, so you can easily make simple axial pointing +spotlights. + +The field "_cone" determines the spread of the spotlight. If +not specified, a _cone of 15 will default. + + + + +ISSUES WITH BMODELS + +Brush models emit and absorb light like other surfaces, but +they do not block light, so after normalization, a little less +light lands on the nearby surfaces, because it was absorbed +both by the door and the surfaces beyond it. You probably +won't notice anything unless you have a row of spotlights +on normal walls, then an identical one on a bmodel. + + +ISSUES WITH WATER + +Light does NOT cross through water surfaces if the vis has +been calculated, because the areas are in different potentially +visible sets, but if you run qrad without a vis, then light +will be sent through as well. + diff --git a/utils/smdlexp/smdlexp.cpp b/utils/smdlexp/smdlexp.cpp index 623f6ee..eaf7d3c 100644 --- a/utils/smdlexp/smdlexp.cpp +++ b/utils/smdlexp/smdlexp.cpp @@ -114,7 +114,7 @@ DESTRUCTOR SmdExportClass::~SmdExportClass(void) } -int SmdExportClass::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts) +int SmdExportClass::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options) { ExpInterface *pexpiface = ei; // Hungarian Interface *piface = i; // Hungarian @@ -122,10 +122,23 @@ int SmdExportClass::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BO // Reset the name-map property manager g_inmMac = 0; - // Present the user with the Export Options dialog - if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EXPORTOPTIONS), GetActiveWindow(), - ExportOptionsDlgProc, (LPARAM)this) <= 0) - return 0; // error or cancel + if ( hasStringPropertyValue( "referenceFrame", "YES", i ) ) + { + m_fReferenceFrame = TRUE ; + suppressPrompts = TRUE ; + } + else if ( hasStringPropertyValue( "referenceFrame", "NO", i ) ) + { + m_fReferenceFrame = FALSE ; + suppressPrompts = TRUE ; + } + + // Present the user with the Export Options dialog if desired + if ( !suppressPrompts ) + { + if (DialogBoxParam( hInstance, MAKEINTRESOURCE(IDD_EXPORTOPTIONS), GetActiveWindow(), ExportOptionsDlgProc, (LPARAM)this) <= 0) + return 0; // error or cancel + } // Break up filename, re-assemble longer versions TSTR strPath, strFile, strExt; @@ -170,10 +183,13 @@ int SmdExportClass::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BO DumpModel(pFile, pexpiface); } - // Tell user that exporting is finished (it can take a while with no feedback) - char szExportComplete[300]; - sprintf(szExportComplete, "Exported %s.", szFile); - MessageBox(GetActiveWindow(), szExportComplete, "Status", MB_OK); + if ( !suppressPrompts ) + { + // Tell user that exporting is finished (it can take a while with no feedback) + char szExportComplete[300]; + sprintf(szExportComplete, "Exported %s.", szFile); + MessageBox(GetActiveWindow(), szExportComplete, "Status", MB_OK); + } fclose( pFile ); @@ -660,6 +676,20 @@ int DumpModelTEP::callback(INode *pnode) UVVert UVvertex1( 1, 0, 0 ); UVVert UVvertex2( 0, 1, 0 ); + int numberMaps = pmesh->getNumMaps(); + for (int mapIdx = 1; mapIdx < numberMaps; ++mapIdx) + { + if (pmesh->getNumMapVerts(mapIdx) ) + { + UVvertex0 = pmesh->mapVerts( mapIdx )[pmesh->mapFaces(mapIdx)[iFace].getTVert( 0 )]; + UVvertex1 = pmesh->mapVerts( mapIdx )[pmesh->mapFaces(mapIdx)[iFace].getTVert( 1 )]; + UVvertex2 = pmesh->mapVerts( mapIdx )[pmesh->mapFaces(mapIdx)[iFace].getTVert( 2 )]; + break; + } + } + + + /* // All faces must have textures assigned to them if (pface->flags & HAS_TVERTS) { @@ -677,19 +707,6 @@ int DumpModelTEP::callback(INode *pnode) UVvertex1 = pmesh->getTVert(iTVertex1); UVvertex2 = pmesh->getTVert(iTVertex2); } - else - { - //sprintf(st_szDBG, "ERROR--Node %s has a textureless face. All faces must have an applied texture.", (char*)strNodeName); - //ASSERT_AND_ABORT(FALSE, st_szDBG); - } - - /* - const char *szExpectedExtension = ".bmp"; - if (stricmp(szBitmapName+strlen(szBitmapName)-strlen(szExpectedExtension), szExpectedExtension) != 0) - { - sprintf(st_szDBG, "Node %s uses %s, which is not a %s file", (char*)strNodeName, szBitmapName, szExpectedExtension); - ASSERT_AND_ABORT(FALSE, st_szDBG); - } */ // Determine owning bones for the vertices. @@ -804,7 +821,8 @@ Point3 DumpModelTEP::Pt3GetRVertexNormal(RVertex *prvertex, DWORD smGroupFace) return prvertex->rn.getNormal(); else { - for (int irn = 0; irn < cNormals; irn++) + int irn; + for (irn = 0; irn < cNormals; irn++) if (prvertex->ern[irn].getSmGroup() & smGroupFace) break; @@ -891,7 +909,8 @@ void SetIndexOfINode(INode *pnode, int inode) { TSTR strNodeName(pnode->GetName()); NAMEMAP *pnm; - for (int inm = 0; inm < g_inmMac; inm++) + int inm; + for (inm = 0; inm < g_inmMac; inm++) if (FStrEq(g_rgnm[inm].szNodeName, (char*)strNodeName)) break; if (inm < g_inmMac) @@ -949,3 +968,116 @@ static float FlReduceRotation(float fl) fl += TWOPI; return fl; } + + + +//=============================================================== +// Name: hasStringPropertyValue +// Class: +// +// Description: Determines if a Custom Property has been set on +// the scene to the specified value. +// +// Parameters: const char* -- the property +// const char* -- the expected value +// Interface* -- the max interface pointer +// +// Returns: bool -- true if the property is there and has the +// specified value. +// +//=============================================================== +bool SmdExportClass::hasStringPropertyValue +( + const char *propertyName, + const char *propertyValue, + Interface *ip +) +{ + const PROPVARIANT *propertyVariant = getPropertyVariant( propertyName, ip ); + if ( !propertyVariant ) return false ; + + TCHAR buffer[80] ; + VariantToString( propertyVariant, buffer, 80 ); + + if ( strcmp( buffer, propertyValue )==0) + return true ; + return false ; +} + +//=============================================================== +// Name: getPropertyVariant +// Class: +// +// Description: Retrieves the specified property variant by name. +// Returns 0 (NULL) if not found. +// +// Parameters: const char* -- the property's name +// Interface* -- the max interface pointer +// +// Returns: const PROPVARIANT* -- the property. Returns 0 +// (NULL) if not found. +// +//=============================================================== +const PROPVARIANT* SmdExportClass::getPropertyVariant +( + const char *propertyName, + Interface *ip +) +{ + TCHAR szBuf[80]; + int bufSize = 80; + int numProps = ip->GetNumProperties(PROPSET_USERDEFINED); + + for (int i=0; iGetPropertySpec(PROPSET_USERDEFINED, i); + const PROPVARIANT *pPropVar = ip->GetPropertyVariant(PROPSET_USERDEFINED, i); + + if ( pPropSpec->ulKind == PRSPEC_PROPID ) continue ; + _tcscpy(szBuf, TSTR(pPropSpec->lpwstr)); + + if ( strcmp( propertyName, szBuf ) == 0 ) + return pPropVar ; + } + + return 0 ; +} + + +// Convert (well, copy) a PROPVARIANT into a string +// +void SmdExportClass::VariantToString(const PROPVARIANT* pProp, TCHAR* szString, int bufSize) + { + switch (pProp->vt) { + case VT_LPWSTR: + _tcscpy(szString, TSTR(pProp->pwszVal)); + break; + case VT_LPSTR: + _tcscpy(szString, TSTR(pProp->pszVal)); + break; + case VT_I4: + _stprintf(szString, "%ld", pProp->lVal); + break; + case VT_R4: + _stprintf(szString, "%f", pProp->fltVal); + break; + case VT_R8: + _stprintf(szString, "%lf", pProp->dblVal); + break; + case VT_BOOL: + _stprintf(szString, "%s", pProp->boolVal ? "YES" : "NO" ); + break; + case VT_FILETIME: + SYSTEMTIME sysTime; + FileTimeToSystemTime(&pProp->filetime, &sysTime); + GetDateFormat(LOCALE_SYSTEM_DEFAULT, + DATE_SHORTDATE, + &sysTime, + NULL, + szString, + bufSize); + break; + default: + _tcscpy(szString, ""); + break; + } + } diff --git a/utils/smdlexp/smdlexp.dsp b/utils/smdlexp/smdlexp.dsp index 4eea037..501a341 100644 --- a/utils/smdlexp/smdlexp.dsp +++ b/utils/smdlexp/smdlexp.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "\3DSMAX2.5\MAXSDK\INCLUDE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "c:\3dsmax42\maxsdk\include" /I "c:\3dsmax42\cstudio\sdk" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib COMCTL32.LIB /nologo /subsystem:windows /dll /machine:I386 /out:"\3dsmax2.5\Plugins\smdlexp.dle" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib COMCTL32.LIB maxutil.lib geom.lib mesh.lib core.lib /nologo /subsystem:windows /dll /machine:I386 /out:"c:\3dsmax42\plugins\smdlexp.dle" /libpath:"c:\3dsmax42\maxsdk\lib" !ELSEIF "$(CFG)" == "smdlexp - Win32 Debug" @@ -69,7 +69,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "\3DSMAX2.5\MAXSDK\INCLUDE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "c:\3dsmax42\maxsdk\INCLUDE" /I "c:\3dsmax42\cstudio\sdk" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -79,7 +79,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib COMCTL32.LIB /nologo /subsystem:windows /dll /debug /machine:I386 /out:"\3DSMAX2.5\plugins\SMDLEXP.DLE" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib COMCTL32.LIB geom.lib mesh.lib core.lib maxutil.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"c:\3dsmax42\plugins\SMDLEXP.DLE" /libpath:"c:\3dsmax42\maxsdk\lib" !ENDIF @@ -115,21 +115,5 @@ SOURCE=.\smedefs.h # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" # End Group -# Begin Source File - -SOURCE=\3DSMAX2.5\Maxsdk\LIB\UTIL.LIB -# End Source File -# Begin Source File - -SOURCE=\3DSMAX2.5\Maxsdk\LIB\GEOM.LIB -# End Source File -# Begin Source File - -SOURCE=\3DSMAX2.5\Maxsdk\LIB\MESH.LIB -# End Source File -# Begin Source File - -SOURCE=\3DSMAX2.5\Maxsdk\LIB\CORE.LIB -# End Source File # End Target # End Project diff --git a/utils/smdlexp/smedefs.h b/utils/smdlexp/smedefs.h index f52ff49..b93c789 100644 --- a/utils/smdlexp/smedefs.h +++ b/utils/smdlexp/smedefs.h @@ -42,7 +42,7 @@ public: virtual unsigned int Version (void) { return 201; } virtual void ShowAbout (HWND hWnd) { return; } // virtual int DoExport (const TCHAR *name, ExpInterface *ei, Interface *i); - virtual int DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE); // Export file + virtual int DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0); // Export file // Integer constants for this class enum @@ -71,6 +71,12 @@ public: TimeValue m_tvEnd; int m_tpf; // ticks-per-frame +protected: + // Property stuff + bool hasStringPropertyValue( const char *propertyName, const char *propertyValue, Interface *ip ); + const PROPVARIANT* getPropertyVariant( const char *propertyName, Interface *ip ); + void VariantToString( const PROPVARIANT *propertyVariant, TCHAR *buffer, int bufferSize ); + private: BOOL CollectNodes (ExpInterface *expiface); BOOL DumpBones (FILE *pFile, ExpInterface *pexpiface); @@ -78,6 +84,7 @@ private: BOOL DumpModel (FILE *pFile, ExpInterface *pexpiface); BOOL DumpDeforms (FILE *pFile, ExpInterface *pexpiface); + // Is this MAX file just the reference frame, or an animation? // If TRUE, the "bones" and "mesh" files will be created. // If FALSE, the "rots" file will be created. diff --git a/utils/studiomdl/studiomdl.c b/utils/studiomdl/studiomdl.c index 350470a..8df8630 100644 --- a/utils/studiomdl/studiomdl.c +++ b/utils/studiomdl/studiomdl.c @@ -24,15 +24,16 @@ #include #include +#include "archtypes.h" #include "cmdlib.h" #include "lbmlib.h" #include "scriplib.h" #include "mathlib.h" #define EXTERN -#include "..\..\engine\studio.h" +#include "../../engine/studio.h" #include "studiomdl.h" -#include "..\..\dlls\activity.h" -#include "..\..\dlls\activitymap.h" +#include "../../dlls/activity.h" +#include "../../dlls/activitymap.h" static int force_powerof2_textures = 0; @@ -3121,6 +3122,61 @@ void Cmd_Renamebone( ) numrenamedbones++; } +/*add transparent texture support to models +=================== +Cmd_SetTextureRendermode + +//paramaters: + // "texturename" "rendermode" renderamt + // acceptable strings for rendermode are: + // "alpha" + // "additive" + // "masked" + +=================== +*/ +void Cmd_SetTextureRendermode( void ) +{ + int iTextureIndex; + + if(!TokenAvailable()) + { + printf("*********ERROR!!!*************"); + printf("\nmissing texturename after $texrendermode\n"); + exit(1); + } + + GetToken(false); + + iTextureIndex = lookup_texture(token); + + if(!TokenAvailable()) + { + printf("\n*********ERROR!!!*************\n"); + printf("\nmissing rendermode at $texrendermode\n"); + exit(1); + } + + GetToken(false); + + if(!strcmp(token, "additive")) + { + texture[iTextureIndex].flags |= STUDIO_NF_ADDITIVE; + return; + } + else if(!strcmp(token, "masked")) + { + texture[iTextureIndex].flags |= STUDIO_NF_MASKED; + return; + } + else + { + printf("\n*********ERROR!!!*************\n"); + printf("\ninvalid rendermode at $texrendermode, choices are :\nadditive\nmasked\n"); + exit(1); + } +} + /* =============== @@ -3262,14 +3318,17 @@ void ParseScript (void) } else if (!strcmp (token, "$cliptotextures")) { - clip_texcoords = 1; + clip_texcoords = 0; } else if (!strcmp (token, "$renamebone")) { Cmd_Renamebone (); } - - else + else if (!strcmp (token, "$texrendermode")) + { + Cmd_SetTextureRendermode(); + } + else { Error ("bad command %s\n", token); } diff --git a/utils/studiomdl/studiomdl.dsp b/utils/studiomdl/studiomdl.dsp index de7cb5b..1a12a8e 100644 --- a/utils/studiomdl/studiomdl.dsp +++ b/utils/studiomdl/studiomdl.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir ".\Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\common" /I "..\..\common" /I "..\..\public" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +64,7 @@ LINK32=link.exe # PROP Intermediate_Dir ".\Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common" /I "..\..\common" /I "..\..\public" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/utils/studiomdl/tristrip.c b/utils/studiomdl/tristrip.c index 2205f1e..2880c2b 100644 --- a/utils/studiomdl/tristrip.c +++ b/utils/studiomdl/tristrip.c @@ -19,6 +19,7 @@ #include #include +#include "archtypes.h" #include "cmdlib.h" #include "lbmlib.h" #include "scriplib.h" diff --git a/utils/studiomdl/write.c b/utils/studiomdl/write.c index 30986d7..777cd6a 100644 --- a/utils/studiomdl/write.c +++ b/utils/studiomdl/write.c @@ -23,6 +23,7 @@ #include #include +#include "archtypes.h" #include "cmdlib.h" #include "lbmlib.h" #include "scriplib.h" @@ -520,7 +521,7 @@ void WriteModel( ) -#define FILEBUFFER (2 * 1024 * 1024) +#define FILEBUFFER ( 16 * 1024 * 1024) void WriteFile (void) diff --git a/utils/vgui/include/VGUI.h b/utils/vgui/include/VGUI.h index acbd542..9cef3c6 100644 --- a/utils/vgui/include/VGUI.h +++ b/utils/vgui/include/VGUI.h @@ -80,7 +80,8 @@ #ifdef _WIN32 # define VGUIAPI __declspec( dllexport ) #else -# define VGUIAPI +# define VGUIAPI __attribute__ ((visibility("default"))) +#include // size_t define #endif #define null 0L @@ -93,7 +94,7 @@ typedef unsigned long ulong; namespace vgui { -VGUIAPI void vgui_setMalloc(void* (*malloc)(size_t size)); +VGUIAPI void vgui_setMalloc(void *(*malloc)(size_t size) ); VGUIAPI void vgui_setFree(void (*free)(void* memblock)); VGUIAPI void vgui_strcpy(char* dst,int dstLen,const char* src); VGUIAPI char* vgui_strdup(const char* src); diff --git a/utils/vgui/include/VGUI_App.h b/utils/vgui/include/VGUI_App.h index a13cdb5..1543aa0 100644 --- a/utils/vgui/include/VGUI_App.h +++ b/utils/vgui/include/VGUI_App.h @@ -17,8 +17,6 @@ namespace vgui { -enum MouseCode; -enum KeyCode; class Panel; class TickSignal; class Scheme; @@ -117,7 +115,7 @@ protected: bool _buildMode; bool _wantedBuildMode; Panel* _mouseArenaPanel; - Cursor* _cursor[Cursor::DefaultCursor::dc_last]; + Cursor* _cursor[Cursor::dc_last]; Cursor* _cursorOveride; private: long _nextTickMillis; diff --git a/utils/vgui/include/VGUI_BuildGroup.h b/utils/vgui/include/VGUI_BuildGroup.h index 694ac5c..9571eab 100644 --- a/utils/vgui/include/VGUI_BuildGroup.h +++ b/utils/vgui/include/VGUI_BuildGroup.h @@ -10,7 +10,8 @@ #include #include - +#include +#include namespace vgui { diff --git a/utils/vgui/include/VGUI_Dar.h b/utils/vgui/include/VGUI_Dar.h index c0f1990..8afc98b 100644 --- a/utils/vgui/include/VGUI_Dar.h +++ b/utils/vgui/include/VGUI_Dar.h @@ -166,6 +166,7 @@ protected: ELEMTYPE* _data; }; +#ifdef _WIN32 //forward referencing all the template types used so they get exported template class VGUIAPI Dar; template class VGUIAPI Dar; @@ -185,7 +186,7 @@ template class VGUIAPI Dar; template class VGUIAPI Dar; template class VGUIAPI Dar; template class VGUIAPI Dar; - +#endif } diff --git a/utils/vgui/include/VGUI_Font.h b/utils/vgui/include/VGUI_Font.h index 822722c..a65ed8b 100644 --- a/utils/vgui/include/VGUI_Font.h +++ b/utils/vgui/include/VGUI_Font.h @@ -32,6 +32,9 @@ class VGUIAPI Font virtual void getCharABCwide(int ch,int& a,int& b,int& c); virtual void getTextSize(const char* text,int& wide,int& tall); virtual int getTall(); +#ifndef _WIN32 + virtual int getWide(); +#endif virtual int getId(); protected: char* _name; diff --git a/utils/vgui/include/VGUI_Label.h b/utils/vgui/include/VGUI_Label.h index af90e9f..851e404 100644 --- a/utils/vgui/include/VGUI_Label.h +++ b/utils/vgui/include/VGUI_Label.h @@ -11,6 +11,7 @@ #include #include #include +#include //TODO: this should use a TextImage for the text diff --git a/utils/vgui/include/VGUI_Panel.h b/utils/vgui/include/VGUI_Panel.h index d5cbd7b..ad75677 100644 --- a/utils/vgui/include/VGUI_Panel.h +++ b/utils/vgui/include/VGUI_Panel.h @@ -28,6 +28,10 @@ TODO: #include #include #include +#include +#include +#include +#include namespace vgui { diff --git a/utils/vgui/include/VGUI_Point.h b/utils/vgui/include/VGUI_Point.h new file mode 100644 index 0000000..afa57ce --- /dev/null +++ b/utils/vgui/include/VGUI_Point.h @@ -0,0 +1,117 @@ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef VGUI_Point_H +#define VGUI_Point_H +#ifdef _WIN32 +#pragma once +#endif + +#include + +namespace vgui +{ + +//----------------------------------------------------------------------------- +// Purpose: Basic handler for a Points in 2 dimensions +// This class is fully inline +//----------------------------------------------------------------------------- +class Point +{ +public: + // constructors + Point() + { + SetPoint(0, 0); + } + Point(int x,int y) + { + SetPoint(x,y); + } + + void SetPoint(int x1, int y1) + { + x=x1; + y=y1; + } + + void GetPoint(int& x1,int& y1) const + { + x1 = x; + y1 = y; + + } + + bool operator == (Point &rhs) const + { + return ( x == rhs.x && y==rhs.y); + } + +private: + int x,y; +}; + +} + +#endif // VGUI_Point_H + + + +//## class Point +//## Point is a class to handle Points in VGUI. + +//## // The default Point is (0,0,0,0) +//## Point() +//## +//## // A Point may be created with x,yvalues. +//## Point(int x,int y) +//## +//## // Set the x,y components of the Point. +//## void SetPoint(int x1, int y1) +//## +//## // Get the position of the Point +//## void GetPoint(int& x1,int& y1) const +//## +//## // Point classes can be set equal to each other. +//## bool operator == (Point &rhs) const +//## +//## +//##
+//## +//## +//## Point() +//## Description: Default constructor. The default Point is (0,0,0,0) +//## +//## +//## Point(int x,int y) +//## Description: +//## A Point may be created with a x,y position. +//## Arguments: +//## x - x position (horizontal axis) (0-65535) +//## y - y position (vertical axis) (0-65535) +//## +//## +//## void SetPoint(int x1, int x1) +//## Description: +//## Set the position of the Point. +//## Arguments: +//## x - x position (horizontal axis) (0-65535) +//## y - y position (vertical axis) (0-65535) +//## +//## +//## void GetPoint(int& x1,int& y1) const +//## Description: +//## Get the x,y components of a Point +//## Arguments: +//## x - x position (horizontal axis) (0-65535) +//## y - y position (vertical axis) (0-65535) +//## +//## bool operator == (Point &rhs) const +//## Description: +//## Point classes can be set equal to each other. +//## +//## diff --git a/utils/vgui/include/VGUI_RepaintSignal.h b/utils/vgui/include/VGUI_RepaintSignal.h index e728a4b..2083724 100644 --- a/utils/vgui/include/VGUI_RepaintSignal.h +++ b/utils/vgui/include/VGUI_RepaintSignal.h @@ -12,7 +12,8 @@ namespace vgui { - +class Panel; + class RepaintSignal { public: diff --git a/utils/vgui/include/VGUI_Surface.h b/utils/vgui/include/VGUI_Surface.h index 7b5476a..c853e29 100644 --- a/utils/vgui/include/VGUI_Surface.h +++ b/utils/vgui/include/VGUI_Surface.h @@ -31,6 +31,7 @@ public: virtual void createPopup(Panel* embeddedPanel); virtual bool hasFocus(); virtual bool isWithin(int x,int y); + virtual void GetMousePos( int &x, int &y ); protected: virtual int createNewTextureID(void); virtual void drawSetColor(int r,int g,int b,int a); diff --git a/utils/vgui/include/VGUI_SurfaceBase.h b/utils/vgui/include/VGUI_SurfaceBase.h index f654f9a..f2ff216 100644 --- a/utils/vgui/include/VGUI_SurfaceBase.h +++ b/utils/vgui/include/VGUI_SurfaceBase.h @@ -44,6 +44,7 @@ public: virtual bool hasFocus()=0; virtual bool isWithin(int x,int y)=0; virtual int createNewTextureID(void)=0; + virtual void GetMousePos( int &x, int &y ) = 0; protected: virtual void addModeInfo(int wide,int tall,int bpp); protected: diff --git a/utils/vgui/include/VGUI_WizardPanel.h b/utils/vgui/include/VGUI_WizardPanel.h index d2f7a2b..5d0f47f 100644 --- a/utils/vgui/include/VGUI_WizardPanel.h +++ b/utils/vgui/include/VGUI_WizardPanel.h @@ -10,6 +10,7 @@ #include #include +#include namespace vgui { diff --git a/utils/vgui/lib/win32_vc6/vgui.lib b/utils/vgui/lib/win32_vc6/vgui.lib index aff7716..671afa6 100644 Binary files a/utils/vgui/lib/win32_vc6/vgui.lib and b/utils/vgui/lib/win32_vc6/vgui.lib differ diff --git a/utils/visx2/vis.dsp b/utils/visx2/vis.dsp index 9785c73..c451a5a 100644 --- a/utils/visx2/vis.dsp +++ b/utils/visx2/vis.dsp @@ -23,7 +23,7 @@ CFG=vis - Win32 Release # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/SDKSrc/Tools/utils/visx2", KVGBAAAA" +# PROP Scc_ProjName ""$/src/utils/visx2", OCFBAAAA" # PROP Scc_LocalPath "." CPP=cl.exe RSC=rc.exe @@ -41,8 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir ".\Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MT /GX /O2 /I "..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c -# SUBTRACT CPP /Fr +# ADD CPP /nologo /G6 /MT /GX /I "..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /Fr /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -63,9 +62,10 @@ LINK32=link.exe # PROP Use_Debug_Libraries 1 # PROP Output_Dir ".\Debug" # PROP Intermediate_Dir ".\Debug" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MT /Gm /GX /ZI /Od /I "..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /Fr /YX /FD /c +# ADD CPP /nologo /G6 /MT /Gm /GX /ZI /Od /I "..\common" /I "..\..\engine" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /Fr /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -73,7 +73,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /profile /debug /machine:I386 !ENDIF @@ -83,10 +83,14 @@ LINK32=link.exe # Name "vis - Win32 Debug" # Begin Group "Source Files" -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" # Begin Source File -SOURCE=..\common\bspfile.c +SOURCE=..\common\bsplib.c +# End Source File +# Begin Source File + +SOURCE=..\common\bsplib.h # End Source File # Begin Source File @@ -114,6 +118,10 @@ SOURCE=..\common\threads.c # End Source File # Begin Source File +SOURCE=..\common\threads.h +# End Source File +# Begin Source File + SOURCE=.\vis.c # End Source File # Begin Source File @@ -126,6 +134,10 @@ SOURCE=.\vis.h # PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" # Begin Source File +SOURCE=..\qbsp2\bsp5.h +# End Source File +# Begin Source File + SOURCE=..\common\bspfile.h # End Source File # Begin Source File @@ -140,10 +152,6 @@ SOURCE=..\common\mathlib.h SOURCE=..\common\scriplib.h # End Source File -# Begin Source File - -SOURCE=..\common\threads.h -# End Source File # End Group # Begin Group "Resource Files" diff --git a/utils/xwad/xwad.c b/utils/xwad/xwad.c index 8dffcb4..ad88acc 100644 --- a/utils/xwad/xwad.c +++ b/utils/xwad/xwad.c @@ -14,7 +14,7 @@ // #include "csg.h" #include "lbmlib.h" #include "mathlib.h" -#include "bspfile.h" +#include "bsplib.h" #define MAXLUMP (640*480*85/64) diff --git a/utils/xwad/xwad.dsp b/utils/xwad/xwad.dsp new file mode 100644 index 0000000..4f3a357 --- /dev/null +++ b/utils/xwad/xwad.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="xwad" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=xwad - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "xwad.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "xwad.mak" CFG="xwad - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "xwad - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "xwad - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/Goldsrc/utils/xwad", GVMBAAAA" +# PROP Scc_LocalPath "." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "xwad - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "DOUBLEVEC_T" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "xwad - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DOUBLEVEC_T" /FR /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "xwad - Win32 Release" +# Name "xwad - Win32 Debug" +# Begin Source File + +SOURCE=..\common\cmdlib.c +# End Source File +# Begin Source File + +SOURCE=..\common\lbmlib.c +# End Source File +# Begin Source File + +SOURCE=..\common\wadlib.c +# End Source File +# Begin Source File + +SOURCE=.\xwad.c +# End Source File +# End Target +# End Project