Skip to content

Commit

Permalink
Replace SetClipRegion with a null argument to ResetClipRegion
Browse files Browse the repository at this point in the history
  • Loading branch information
Kangz committed Sep 24, 2014
1 parent ba6299b commit 0e4a280
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/engine/client/cg_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ typedef enum cgameImport_s
CG_R_RENDERSCENE,
CG_R_SETCOLOR,
CG_R_SETCLIPREGION,
CG_R_RESETCLIPREGION,
CG_R_DRAWSTRETCHPIC,
CG_R_DRAWROTATEDPIC,
CG_R_MODELBOUNDS,
Expand Down Expand Up @@ -473,6 +474,8 @@ namespace Render {
typedef IPC::Message<IPC::Id<VM::QVM, CG_R_SETCOLOR>, std::array<float, 4>> SetColorMsg;
// SetClipRegionMsg
typedef IPC::Message<IPC::Id<VM::QVM, CG_R_SETCLIPREGION>, std::array<float, 4>> SetClipRegionMsg;
// ResetClipRegionMsg
typedef IPC::Message<IPC::Id<VM::QVM, CG_R_RESETCLIPREGION>> ResetClipRegionMsg;
// DrawStretchPicMsg
typedef IPC::Message<IPC::Id<VM::QVM, CG_R_DRAWSTRETCHPIC>, float, float, float, float, float, float, float, float, int> DrawStretchPicMsg;
// DrawRotatedPicMsg
Expand Down Expand Up @@ -941,6 +944,7 @@ void trap_GS_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin
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_ResetClipRegion( void );
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_DrawRotatedPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, float angle );
void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
Expand Down
6 changes: 6 additions & 0 deletions src/engine/client/cl_cgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2100,6 +2100,12 @@ void CGameVM::QVMSyscall(int index, IPC::Reader& reader, IPC::Channel& channel)
});
break;

case CG_R_RESETCLIPREGION:
IPC::HandleMsg<Render::ResetClipRegionMsg>(channel, std::move(reader), [this] {
re.SetClipRegion(nullptr);
});
break;

case CG_R_DRAWSTRETCHPIC:
IPC::HandleMsg<Render::DrawStretchPicMsg>(channel, std::move(reader), [this] (float x, float y, float w, float h, float s1, float t1, float s2, float t2, int shader) {
re.DrawStretchPic(x, y, w, h, s1, t1, s2, t2, shader);
Expand Down
5 changes: 5 additions & 0 deletions src/gamelogic/cgame/cg_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,11 @@ void trap_R_SetClipRegion( const float *region )
VM::SendMsg<Render::SetClipRegionMsg>(myregion);
}

void trap_R_ResetClipRegion( void )
{
VM::SendMsg<Render::ResetClipRegionMsg>();
}

void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader )
{
VM::SendMsg<Render::DrawStretchPicMsg>(x, y, w, h, s1, t1, s2, t2, hShader);
Expand Down
2 changes: 1 addition & 1 deletion src/gamelogic/cgame/cg_drawtools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ CG_ClearClipRegion
*/
void CG_ClearClipRegion( void )
{
trap_R_SetClipRegion( NULL );
trap_R_ResetClipRegion();
}

/*
Expand Down

0 comments on commit 0e4a280

Please sign in to comment.