diff options
author | Tim Angus <tim@ngus.net> | 2009-10-12 22:36:35 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:48 +0000 |
commit | 35249fc2c3762fe1690559772a6d89724fb7469c (patch) | |
tree | efad01bc9142be45298594fbf8c01fdcca5e8237 | |
parent | 6e5fbea644646afa82130be9bf366d866c9838ca (diff) |
* Add [trap_R|RE]_SetClipRegion to prevent rendering outside a specified area
* Rewrite CG_DrawTeamSpectators to scroll on a pixel basis rather than a character basis
-rw-r--r-- | src/cgame/cg_draw.c | 119 | ||||
-rw-r--r-- | src/cgame/cg_drawtools.c | 27 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 10 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 13 | ||||
-rw-r--r-- | src/cgame/cg_public.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.asm | 115 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.c | 5 | ||||
-rw-r--r-- | src/client/cl_cgame.c | 3 | ||||
-rw-r--r-- | src/client/cl_ui.c | 4 | ||||
-rw-r--r-- | src/renderer/tr_cmds.c | 97 | ||||
-rw-r--r-- | src/renderer/tr_init.c | 1 | ||||
-rw-r--r-- | src/renderer/tr_local.h | 3 | ||||
-rw-r--r-- | src/renderer/tr_public.h | 1 | ||||
-rw-r--r-- | src/ui/ui_local.h | 1 | ||||
-rw-r--r-- | src/ui/ui_public.h | 1 | ||||
-rw-r--r-- | src/ui/ui_syscalls.asm | 119 | ||||
-rw-r--r-- | src/ui/ui_syscalls.c | 5 |
17 files changed, 297 insertions, 228 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 73006beb..2a0a2ba5 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1269,108 +1269,44 @@ static void CG_DrawKiller( rectDef_t *rect, float scale, vec4_t color, } +#define SPECTATORS_PIXELS_PER_SECOND 30.0f + +/* +================== +CG_DrawTeamSpectators +================== +*/ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, int textvalign, vec4_t color, qhandle_t shader ) { float y; - qboolean isEmoticon; - qboolean emoticonEscaped; - char secondPart[ MAX_STRING_CHARS ] = ""; - int emoticonLen; - static char lastColorSeen = COLOR_WHITE; - - if( cg.spectatorLen ) - { - float maxX; - - if( cg.spectatorWidth == -1 ) - { - cg.spectatorWidth = 0; - cg.spectatorPaintX = rect->x + 1; - cg.spectatorPaintX2 = -1; - } + char *text = cg.spectatorList; + float textWidth = UI_Text_Width( text, scale, 0 ); - if( cg.spectatorOffset > cg.spectatorLen ) - { - cg.spectatorOffset = 0; - cg.spectatorPaintX = rect->x + 1; - cg.spectatorPaintX2 = -1; - } - - if( cg.time > cg.spectatorTime ) - { - cg.spectatorTime = cg.time + 10; + CG_AlignText( rect, text, scale, 0.0f, 0.0f, ALIGN_LEFT, textvalign, NULL, &y ); - if( cg.spectatorPaintX <= rect->x + 2 ) - { - if( cg.spectatorOffset < cg.spectatorLen ) - { - // skip colour directives - if( Q_IsColorString( &cg.spectatorList[ cg.spectatorOffset ] ) ) - { - lastColorSeen = cg.spectatorList[ cg.spectatorOffset + 1 ]; - cg.spectatorOffset += 2; - } - else - { - isEmoticon = UI_Text_Emoticon( &cg.spectatorList[ cg.spectatorOffset ], - &emoticonEscaped, &emoticonLen, NULL, NULL ); - if( isEmoticon ) - { - cg.spectatorOffset += emoticonLen; - if( emoticonEscaped ) cg.spectatorOffset++; // skip an extra char to not un-scape by eating the escaping [ - } - - cg.spectatorPaintX += UI_Text_Width( &cg.spectatorList[ cg.spectatorOffset ], scale, 1 ) - 1; - cg.spectatorOffset++; - } - } - else - { - cg.spectatorOffset = 0; + if( textWidth > rect->w ) + { + // The text is too wide to fit, so scroll it + int now = trap_Milliseconds( ); + int delta = now - cg.spectatorTime; - if( cg.spectatorPaintX2 >= 0 ) - cg.spectatorPaintX = cg.spectatorPaintX2; - else - cg.spectatorPaintX = rect->x + rect->w - 2; + CG_SetClipRegion( rect->x, rect->y, rect->w, rect->h ); - cg.spectatorPaintX2 = -1; - } - } - else - { - cg.spectatorPaintX--; + UI_Text_Paint( rect->x - cg.spectatorOffset, y, scale, color, text, 0, 0, 0 ); + UI_Text_Paint( rect->x + textWidth - cg.spectatorOffset, y, scale, color, text, 0, 0, 0 ); - if( cg.spectatorPaintX2 >= 0 ) - cg.spectatorPaintX2--; - } - } + CG_ClearClipRegion( ); - secondPart[ 0 ] = Q_COLOR_ESCAPE; - secondPart[ 1 ] = lastColorSeen; - Q_strncpyz( secondPart+2, &cg.spectatorList[ cg.spectatorOffset ], sizeof( secondPart ) - 2 ); + cg.spectatorOffset += ( delta / 1000.0f ) * SPECTATORS_PIXELS_PER_SECOND; - maxX = rect->x + rect->w - 2; - CG_AlignText( rect, NULL, 0.0f, 0.0f, UI_Text_EmHeight( scale ), - ALIGN_LEFT, textvalign, NULL, &y ); + while( cg.spectatorOffset > textWidth ) + cg.spectatorOffset -= textWidth; - UI_Text_Paint_Limit( &maxX, cg.spectatorPaintX, y, scale, color, - secondPart, 0, 0 ); - - if( cg.spectatorPaintX2 >= 0 ) - { - float maxX2 = rect->x + rect->w - 2; - UI_Text_Paint_Limit( &maxX2, cg.spectatorPaintX2, y, scale, - color, cg.spectatorList, 0, cg.spectatorOffset ); - } - - if( cg.spectatorOffset && maxX > 0 ) - { - // if we have an offset ( we are skipping the first part of the string ) and we fit the string - if( cg.spectatorPaintX2 == -1 ) - cg.spectatorPaintX2 = rect->x + rect->w - 2; - } - else - cg.spectatorPaintX2 = -1; + cg.spectatorTime = now; + } + else + { + UI_Text_Paint( rect->x, y, scale, color, text, 0, 0, 0 ); } } @@ -2864,6 +2800,7 @@ static qboolean CG_DrawScoreboard( void ) { if( firstTime ) { + cg.spectatorTime = trap_Milliseconds(); CG_SetScoreSelection( menuScoreboard ); firstTime = qfalse; } diff --git a/src/cgame/cg_drawtools.c b/src/cgame/cg_drawtools.c index b7b980f9..7d32fa1d 100644 --- a/src/cgame/cg_drawtools.c +++ b/src/cgame/cg_drawtools.c @@ -172,7 +172,34 @@ void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader ); } +/* +================ +CG_SetClipRegion +================= +*/ +void CG_SetClipRegion( float x, float y, float w, float h ) +{ + vec4_t clip; + + CG_AdjustFrom640( &x, &y, &w, &h ); + + clip[ 0 ] = x; + clip[ 1 ] = y; + clip[ 2 ] = x + w; + clip[ 3 ] = y + h; + trap_R_SetClipRegion( clip ); +} + +/* +================ +CG_ClearClipRegion +================= +*/ +void CG_ClearClipRegion( void ) +{ + trap_R_SetClipRegion( NULL ); +} /* ================ diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 248f4453..d14454a1 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1012,13 +1012,8 @@ typedef struct int scoreFadeTime; char killerName[ MAX_NAME_LENGTH ]; char spectatorList[ MAX_STRING_CHARS ]; // list of names - int spectatorLen; // length of list - float spectatorWidth; // width in device units int spectatorTime; // next time to offset - int spectatorPaintX; // current paint x - int spectatorPaintX2; // current paint x - int spectatorOffset; // current offset from start - int spectatorPaintLen; // current offset from start + float spectatorOffset; // current offset from start // centerprinting int centerPrintTime; @@ -1593,6 +1588,8 @@ void CG_FillRect( float x, float y, float width, float height, const floa void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader ); void CG_DrawFadePic( float x, float y, float width, float height, vec4_t fcolor, vec4_t tcolor, float amount, qhandle_t hShader ); +void CG_SetClipRegion( float x, float y, float w, float h ); +void CG_ClearClipRegion( void ); int CG_DrawStrlen( const char *str ); @@ -1992,6 +1989,7 @@ void trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, int trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir ); void trap_R_RenderScene( const refdef_t *fd ); void trap_R_SetColor( const float *rgba ); // NULL = 1,1,1,1 +void trap_R_SetClipRegion( const float *region ); void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ); void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index d7076a10..da607deb 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -882,15 +882,10 @@ void CG_BuildSpectatorString( void ) for( i = 0; i < MAX_CLIENTS; i++ ) { if( cgs.clientinfo[ i ].infoValid && cgs.clientinfo[ i ].team == TEAM_NONE ) - Q_strcat( cg.spectatorList, sizeof( cg.spectatorList ), va( S_COLOR_WHITE "%s ", cgs.clientinfo[ i ].name ) ); - } - - i = strlen( cg.spectatorList ); - - if( i != cg.spectatorLen ) - { - cg.spectatorLen = i; - cg.spectatorWidth = -1; + { + Q_strcat( cg.spectatorList, sizeof( cg.spectatorList ), + va( S_COLOR_WHITE "%s ", cgs.clientinfo[ i ].name ) ); + } } } diff --git a/src/cgame/cg_public.h b/src/cgame/cg_public.h index 98ffb00a..012e96a7 100644 --- a/src/cgame/cg_public.h +++ b/src/cgame/cg_public.h @@ -120,6 +120,7 @@ typedef enum CG_R_ADDLIGHTTOSCENE, CG_R_RENDERSCENE, CG_R_SETCOLOR, + CG_R_SETCLIPREGION, CG_R_DRAWSTRETCHPIC, CG_R_MODELBOUNDS, CG_R_LERPTAG, diff --git a/src/cgame/cg_syscalls.asm b/src/cgame/cg_syscalls.asm index a28c5db2..2537c91c 100644 --- a/src/cgame/cg_syscalls.asm +++ b/src/cgame/cg_syscalls.asm @@ -46,65 +46,66 @@ equ trap_R_AddPolyToScene -43 equ trap_R_AddLightToScene -44 equ trap_R_RenderScene -45 equ trap_R_SetColor -46 -equ trap_R_DrawStretchPic -47 -equ trap_R_ModelBounds -48 -equ trap_R_LerpTag -49 -equ trap_GetGlconfig -50 -equ trap_GetGameState -51 -equ trap_GetCurrentSnapshotNumber -52 -equ trap_GetSnapshot -53 -equ trap_GetServerCommand -54 -equ trap_GetCurrentCmdNumber -55 -equ trap_GetUserCmd -56 -equ trap_SetUserCmdValue -57 -equ trap_R_RegisterShaderNoMip -58 -equ trap_MemoryRemaining -59 -equ trap_R_RegisterFont -60 -equ trap_Key_IsDown -61 -equ trap_Key_GetCatcher -62 -equ trap_Key_SetCatcher -63 -equ trap_Key_GetKey -64 -equ trap_S_StopBackgroundTrack -65 -equ trap_RealTime -66 -equ trap_SnapVector -67 -equ trap_RemoveCommand -68 -equ trap_R_LightForPoint -69 -equ trap_CIN_PlayCinematic -70 -equ trap_CIN_StopCinematic -71 -equ trap_CIN_RunCinematic -72 -equ trap_CIN_DrawCinematic -73 -equ trap_CIN_SetExtents -74 -equ trap_R_RemapShader -75 -equ trap_S_AddRealLoopingSound -76 -equ trap_S_StopLoopingSound -77 -equ trap_CM_TempCapsuleModel -78 -equ trap_CM_CapsuleTrace -79 -equ trap_CM_TransformedCapsuleTrace -80 -equ trap_R_AddAdditiveLightToScene -81 -equ trap_GetEntityToken -82 -equ trap_R_AddPolysToScene -83 -equ trap_R_inPVS -84 -equ trap_FS_Seek -85 -equ trap_FS_GetFileList -86 -equ trap_LiteralArgs -87 -equ trap_CM_BiSphereTrace -88 -equ trap_CM_TransformedBiSphereTrace -89 -equ trap_GetDemoState -90 -equ trap_GetDemoPos -91 -equ trap_GetDemoName -92 -equ trap_Key_KeynumToStringBuf -93 -equ trap_Key_GetBindingBuf -94 -equ trap_Key_SetBinding -95 +equ trap_R_SetClipRegion -47 +equ trap_R_DrawStretchPic -48 +equ trap_R_ModelBounds -49 +equ trap_R_LerpTag -50 +equ trap_GetGlconfig -51 +equ trap_GetGameState -52 +equ trap_GetCurrentSnapshotNumber -53 +equ trap_GetSnapshot -54 +equ trap_GetServerCommand -55 +equ trap_GetCurrentCmdNumber -56 +equ trap_GetUserCmd -57 +equ trap_SetUserCmdValue -58 +equ trap_R_RegisterShaderNoMip -59 +equ trap_MemoryRemaining -60 +equ trap_R_RegisterFont -61 +equ trap_Key_IsDown -62 +equ trap_Key_GetCatcher -63 +equ trap_Key_SetCatcher -64 +equ trap_Key_GetKey -65 +equ trap_S_StopBackgroundTrack -66 +equ trap_RealTime -67 +equ trap_SnapVector -68 +equ trap_RemoveCommand -69 +equ trap_R_LightForPoint -70 +equ trap_CIN_PlayCinematic -71 +equ trap_CIN_StopCinematic -72 +equ trap_CIN_RunCinematic -73 +equ trap_CIN_DrawCinematic -74 +equ trap_CIN_SetExtents -75 +equ trap_R_RemapShader -76 +equ trap_S_AddRealLoopingSound -77 +equ trap_S_StopLoopingSound -78 +equ trap_CM_TempCapsuleModel -79 +equ trap_CM_CapsuleTrace -80 +equ trap_CM_TransformedCapsuleTrace -81 +equ trap_R_AddAdditiveLightToScene -82 +equ trap_GetEntityToken -83 +equ trap_R_AddPolysToScene -84 +equ trap_R_inPVS -85 +equ trap_FS_Seek -86 +equ trap_FS_GetFileList -87 +equ trap_LiteralArgs -88 +equ trap_CM_BiSphereTrace -89 +equ trap_CM_TransformedBiSphereTrace -90 +equ trap_GetDemoState -91 +equ trap_GetDemoPos -92 +equ trap_GetDemoName -93 +equ trap_Key_KeynumToStringBuf -94 +equ trap_Key_GetBindingBuf -95 +equ trap_Key_SetBinding -96 -equ trap_Parse_AddGlobalDefine -96 -equ trap_Parse_LoadSource -97 -equ trap_Parse_FreeSource -98 -equ trap_Parse_ReadToken -99 -equ trap_Parse_SourceFileAndLine -100 -equ trap_Key_SetOverstrikeMode -101 -equ trap_Key_GetOverstrikeMode -102 +equ trap_Parse_AddGlobalDefine -97 +equ trap_Parse_LoadSource -98 +equ trap_Parse_FreeSource -99 +equ trap_Parse_ReadToken -100 +equ trap_Parse_SourceFileAndLine -101 +equ trap_Key_SetOverstrikeMode -102 +equ trap_Key_GetOverstrikeMode -103 -equ trap_S_SoundDuration -103 +equ trap_S_SoundDuration -104 equ memset -201 equ memcpy -202 diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c index f7258efb..2c09134b 100644 --- a/src/cgame/cg_syscalls.c +++ b/src/cgame/cg_syscalls.c @@ -380,6 +380,11 @@ void trap_R_SetColor( const float *rgba ) syscall( CG_R_SETCOLOR, rgba ); } +void trap_R_SetClipRegion( const float *region ) +{ + syscall( CG_R_SETCLIPREGION, region ); +} + void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c index d30d4ac0..8bf10f6d 100644 --- a/src/client/cl_cgame.c +++ b/src/client/cl_cgame.c @@ -587,6 +587,9 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { case CG_R_SETCOLOR: re.SetColor( VMA(1) ); return 0; + case CG_R_SETCLIPREGION: + re.SetClipRegion( VMA(1) ); + return 0; case CG_R_DRAWSTRETCHPIC: re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), args[9] ); return 0; diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c index caf55ef0..1be4f9f3 100644 --- a/src/client/cl_ui.c +++ b/src/client/cl_ui.c @@ -820,6 +820,10 @@ intptr_t CL_UISystemCalls( intptr_t *args ) { re.SetColor( VMA(1) ); return 0; + case UI_R_SETCLIPREGION: + re.SetClipRegion( VMA(1) ); + return 0; + case UI_R_DRAWSTRETCHPIC: re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), args[9] ); return 0; diff --git a/src/renderer/tr_cmds.c b/src/renderer/tr_cmds.c index 1b39c56b..ce0fa680 100644 --- a/src/renderer/tr_cmds.c +++ b/src/renderer/tr_cmds.c @@ -245,9 +245,9 @@ Passing NULL will set the color to white void RE_SetColor( const float *rgba ) { setColorCommand_t *cmd; - if ( !tr.registered ) { - return; - } + if ( !tr.registered ) { + return; + } cmd = R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; @@ -265,6 +265,88 @@ void RE_SetColor( const float *rgba ) { cmd->color[3] = rgba[3]; } +/* +============= +R_ClipRegion +============= +*/ +static qboolean R_ClipRegion ( float *x, float *y, float *w, float *h, + float *s1, float *t1, float *s2, float *t2 ) { + float left, top, right, bottom; + float _s1, _t1, _s2, _t2; + float clipLeft, clipTop, clipRight, clipBottom; + + if (tr.clipRegion[2] <= tr.clipRegion[0] || + tr.clipRegion[3] <= tr.clipRegion[1] ) { + return qfalse; + } + + left = *x; + top = *y; + right = *x + *w; + bottom = *y + *h; + + _s1 = *s1; + _t1 = *t1; + _s2 = *s2; + _t2 = *t2; + + clipLeft = tr.clipRegion[0]; + clipTop = tr.clipRegion[1]; + clipRight = tr.clipRegion[2]; + clipBottom = tr.clipRegion[3]; + + // Completely clipped away + if ( right <= clipLeft || left >= clipRight || + bottom <= clipTop || top >= clipBottom ) { + return qtrue; + } + + // Clip left edge + if ( left < clipLeft ) { + float f = ( clipLeft - left ) / ( right - left ); + *s1 = ( f * ( _s2 - _s1 ) ) + _s1; + *x = clipLeft; + *w -= ( clipLeft - left ); + } + + // Clip right edge + if ( right > clipRight ) { + float f = ( clipRight - right ) / ( left - right ); + *s2 = ( f * ( _s1 - _s2 ) ) + _s2; + *w = clipRight - *x; + } + + // Clip top edge + if ( top < clipTop ) { + float f = ( clipTop - top ) / ( bottom - top ); + *t1 = ( f * ( _t2 - _t1 ) ) + _t1; + *y = clipTop; + *h -= ( clipTop - top ); + } + + // Clip bottom edge + if ( bottom > clipBottom ) { + float f = ( clipBottom - bottom ) / ( top - bottom ); + *t2 = ( f * ( _t1 - _t2 ) ) + _t2; + *h = clipBottom - *y; + } + + return qfalse; +} + +/* +============= +RE_SetClipRegion +============= +*/ +void RE_SetClipRegion( const float *region ) { + if ( region == NULL ) { + Com_Memset( tr.clipRegion, 0, sizeof( vec4_t ) ); + } else { + Vector4Copy( region, tr.clipRegion ); + } +} /* ============= @@ -275,9 +357,12 @@ void RE_StretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { stretchPicCommand_t *cmd; - if (!tr.registered) { - return; - } + if (!tr.registered) { + return; + } + if (R_ClipRegion(&x, &y, &w, &h, &s1, &t1, &s2, &t2)) { + return; + } cmd = R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; diff --git a/src/renderer/tr_init.c b/src/renderer/tr_init.c index ce2b8642..a0f301a5 100644 --- a/src/renderer/tr_init.c +++ b/src/renderer/tr_init.c @@ -1235,6 +1235,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) { re.RenderScene = RE_RenderScene; re.SetColor = RE_SetColor; + re.SetClipRegion = RE_SetClipRegion; re.DrawStretchPic = RE_StretchPic; re.DrawStretchRaw = RE_StretchRaw; re.UploadCinematic = RE_UploadCinematic; diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h index 9f8e44f9..4e0e27f8 100644 --- a/src/renderer/tr_local.h +++ b/src/renderer/tr_local.h @@ -943,6 +943,8 @@ typedef struct { frontEndCounters_t pc; int frontEndMsec; // not in pc due to clearing issue + vec4_t clipRegion; // 2D clipping region + // // put large tables at the end, so most elements will be // within the +/32K indexed range on risc processors @@ -1690,6 +1692,7 @@ void R_SyncRenderThread( void ); void R_AddDrawSurfCmd( drawSurf_t *drawSurfs, int numDrawSurfs ); void RE_SetColor( const float *rgba ); +void RE_SetClipRegion( const float *region ); void RE_StretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ); void RE_BeginFrame( stereoFrame_t stereoFrame ); diff --git a/src/renderer/tr_public.h b/src/renderer/tr_public.h index eac2cd29..a6c72893 100644 --- a/src/renderer/tr_public.h +++ b/src/renderer/tr_public.h @@ -71,6 +71,7 @@ typedef struct { void (*RenderScene)( const refdef_t *fd ); void (*SetColor)( const float *rgba ); // NULL = 1,1,1,1 + void (*SetClipRegion)( const float *region ); void (*DrawStretchPic) ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ); // 0 = white diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index 1f7ecf40..86649d62 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -344,6 +344,7 @@ void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVer void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ); void trap_R_RenderScene( const refdef_t *fd ); void trap_R_SetColor( const float *rgba ); +void trap_R_SetClipRegion( const float *region ); void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ); void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ); void trap_UpdateScreen( void ); diff --git a/src/ui/ui_public.h b/src/ui/ui_public.h index bcaf3d5c..9e77c4b9 100644 --- a/src/ui/ui_public.h +++ b/src/ui/ui_public.h @@ -66,6 +66,7 @@ typedef enum UI_R_ADDLIGHTTOSCENE, UI_R_RENDERSCENE, UI_R_SETCOLOR, + UI_R_SETCLIPREGION, UI_R_DRAWSTRETCHPIC, UI_UPDATESCREEN, UI_CM_LERPTAG, diff --git a/src/ui/ui_syscalls.asm b/src/ui/ui_syscalls.asm index 0880d419..1e797a97 100644 --- a/src/ui/ui_syscalls.asm +++ b/src/ui/ui_syscalls.asm @@ -27,67 +27,68 @@ equ trap_R_AddPolyToScene -24 equ trap_R_AddLightToScene -25 equ trap_R_RenderScene -26 equ trap_R_SetColor -27 -equ trap_R_DrawStretchPic -28 -equ trap_UpdateScreen -29 -equ trap_CM_LerpTag -30 -equ trap_CM_LoadModel -31 -equ trap_S_RegisterSound -32 -equ trap_S_StartLocalSound -33 -equ trap_Key_KeynumToStringBuf -34 -equ trap_Key_GetBindingBuf -35 -equ trap_Key_SetBinding -36 -equ trap_Key_IsDown -37 -equ trap_Key_GetOverstrikeMode -38 -equ trap_Key_SetOverstrikeMode -39 -equ trap_Key_ClearStates -40 -equ trap_Key_GetCatcher -41 -equ trap_Key_SetCatcher -42 -equ trap_GetClipboardData -43 -equ trap_GetGlconfig -44 -equ trap_GetClientState -45 -equ trap_GetConfigString -46 -equ trap_LAN_GetPingQueueCount -47 -equ trap_LAN_ClearPing -48 -equ trap_LAN_GetPing -49 -equ trap_LAN_GetPingInfo -50 -equ trap_Cvar_Register -51 -equ trap_Cvar_Update -52 -equ trap_MemoryRemaining -53 -equ trap_R_RegisterFont -54 -equ trap_R_ModelBounds -55 -equ trap_S_StopBackgroundTrack -56 -equ trap_S_StartBackgroundTrack -57 -equ trap_RealTime -58 -equ trap_LAN_GetServerCount -59 -equ trap_LAN_GetServerAddressString -60 -equ trap_LAN_GetServerInfo -61 -equ trap_LAN_MarkServerVisible -62 -equ trap_LAN_UpdateVisiblePings -63 -equ trap_LAN_ResetPings -64 -equ trap_LAN_LoadCachedServers -65 -equ trap_LAN_SaveCachedServers -66 -equ trap_LAN_AddServer -67 -equ trap_LAN_RemoveServer -68 -equ trap_CIN_PlayCinematic -69 -equ trap_CIN_StopCinematic -70 -equ trap_CIN_RunCinematic -71 -equ trap_CIN_DrawCinematic -72 -equ trap_CIN_SetExtents -73 -equ trap_R_RemapShader -74 -equ trap_LAN_ServerStatus -75 -equ trap_LAN_GetServerPing -76 -equ trap_LAN_ServerIsVisible -77 -equ trap_LAN_CompareServers -78 -equ trap_FS_Seek -79 -equ trap_SetPbClStatus -80 +equ trap_R_SetClipRegion -28 +equ trap_R_DrawStretchPic -29 +equ trap_UpdateScreen -30 +equ trap_CM_LerpTag -31 +equ trap_CM_LoadModel -32 +equ trap_S_RegisterSound -33 +equ trap_S_StartLocalSound -34 +equ trap_Key_KeynumToStringBuf -35 +equ trap_Key_GetBindingBuf -36 +equ trap_Key_SetBinding -37 +equ trap_Key_IsDown -38 +equ trap_Key_GetOverstrikeMode -39 +equ trap_Key_SetOverstrikeMode -40 +equ trap_Key_ClearStates -41 +equ trap_Key_GetCatcher -42 +equ trap_Key_SetCatcher -43 +equ trap_GetClipboardData -44 +equ trap_GetGlconfig -45 +equ trap_GetClientState -46 +equ trap_GetConfigString -47 +equ trap_LAN_GetPingQueueCount -48 +equ trap_LAN_ClearPing -49 +equ trap_LAN_GetPing -50 +equ trap_LAN_GetPingInfo -51 +equ trap_Cvar_Register -52 +equ trap_Cvar_Update -53 +equ trap_MemoryRemaining -54 +equ trap_R_RegisterFont -55 +equ trap_R_ModelBounds -56 +equ trap_S_StopBackgroundTrack -57 +equ trap_S_StartBackgroundTrack -58 +equ trap_RealTime -59 +equ trap_LAN_GetServerCount -60 +equ trap_LAN_GetServerAddressString -61 +equ trap_LAN_GetServerInfo -62 +equ trap_LAN_MarkServerVisible -63 +equ trap_LAN_UpdateVisiblePings -64 +equ trap_LAN_ResetPings -65 +equ trap_LAN_LoadCachedServers -66 +equ trap_LAN_SaveCachedServers -67 +equ trap_LAN_AddServer -68 +equ trap_LAN_RemoveServer -69 +equ trap_CIN_PlayCinematic -70 +equ trap_CIN_StopCinematic -71 +equ trap_CIN_RunCinematic -72 +equ trap_CIN_DrawCinematic -73 +equ trap_CIN_SetExtents -74 +equ trap_R_RemapShader -75 +equ trap_LAN_ServerStatus -76 +equ trap_LAN_GetServerPing -77 +equ trap_LAN_ServerIsVisible -78 +equ trap_LAN_CompareServers -79 +equ trap_FS_Seek -80 +equ trap_SetPbClStatus -81 -equ trap_Parse_AddGlobalDefine -81 -equ trap_Parse_LoadSource -82 -equ trap_Parse_FreeSource -83 -equ trap_Parse_ReadToken -84 -equ trap_Parse_SourceFileAndLine -85 -equ trap_GetNews -86 +equ trap_Parse_AddGlobalDefine -82 +equ trap_Parse_LoadSource -83 +equ trap_Parse_FreeSource -84 +equ trap_Parse_ReadToken -85 +equ trap_Parse_SourceFileAndLine -86 +equ trap_GetNews -87 equ memset -101 equ memcpy -102 diff --git a/src/ui/ui_syscalls.c b/src/ui/ui_syscalls.c index 29938149..4da66e03 100644 --- a/src/ui/ui_syscalls.c +++ b/src/ui/ui_syscalls.c @@ -197,6 +197,11 @@ void trap_R_SetColor( const float *rgba ) syscall( UI_R_SETCOLOR, rgba ); } +void trap_R_SetClipRegion( const float *region ) +{ + syscall( UI_R_SETCLIPREGION, region ); +} + void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { syscall( UI_R_DRAWSTRETCHPIC, PASSFLOAT( x ), PASSFLOAT( y ), PASSFLOAT( w ), PASSFLOAT( h ), PASSFLOAT( s1 ), PASSFLOAT( t1 ), PASSFLOAT( s2 ), PASSFLOAT( t2 ), hShader ); |