Skip to content

Commit

Permalink
[loda] Panorama screenshots first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
taysta committed May 31, 2024
1 parent 55aceb6 commit cd08334
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
13 changes: 11 additions & 2 deletions codemp/cgame/cg_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -3126,8 +3126,17 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
}
}

// actually issue the rendering calls
CG_DrawActive( stereoView );
if (pano.integer) { // let's grab a panorama!
cg.levelShot = qtrue; //hide the 2d
VectorClear(cg.refdef.viewangles);
cg.refdef.viewangles[YAW] = -360 * pano.integer / cg_panoNumShots.integer; //choose angle
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
CG_DrawActive(stereoView);
cg.levelShot = qfalse;
} else {
// actually issue the rendering calls
CG_DrawActive(stereoView);
}

CG_DrawAutoMap();

Expand Down
5 changes: 4 additions & 1 deletion codemp/cgame/cg_xcvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ XCVAR_DEF(cg_pitchHudAngle, "", NULL, CVAR_ARCHIVE )
XCVAR_DEF(cg_pitchHudThickness, "2", NULL, CVAR_ARCHIVE )
XCVAR_DEF(cg_pitchHudX, "320", NULL, CVAR_ARCHIVE )
XCVAR_DEF(cg_pitchHudWidth, "10", NULL, CVAR_ARCHIVE )
XCVAR_DEF(cg_pitchHudRgba, "204 204 204 204", CG_PitchHUDColorChange, CVAR_ARCHIVE )
XCVAR_DEF(cg_pitchHudRgba, "204 204 204 204", CG_PitchHUDColorChange, CVAR_ARCHIVE )

XCVAR_DEF(pano, "0", NULL, 0)
XCVAR_DEF(cg_panoNumShots, "10", NULL, 0)

#undef XCVAR_DEF
20 changes: 20 additions & 0 deletions codemp/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ cvar_t *cl_debugMove;
cvar_t *cl_noprint;
cvar_t *cl_motd;
cvar_t *cl_motdServer[MAX_MASTER_SERVERS];
cvar_t *cl_pano;
cvar_t *cl_panoNumShots;

cvar_t *rcon_client_password;
cvar_t *rconAddress;
Expand Down Expand Up @@ -2545,6 +2547,21 @@ void CL_Frame ( int msec ) {
// decide on the serverTime to render
CL_SetCGameTime();

if (cl_pano->integer && cls.state == CA_ACTIVE) { //grab some panoramic shots
int i = 1;
int pref = cl_pano->integer;
int oldnoprint = cl_noprint->integer;
Con_Close();
cl_noprint->integer = 1; //hide the screen shot msgs
for (; i <= cl_panoNumShots->integer; i++) {
Cvar_SetValue("pano", i);
SCR_UpdateScreen();// update the screen
Cbuf_ExecuteText(EXEC_NOW, va("screenshot %dpano%02d\n", pref, i)); //grab this screen
}
Cvar_SetValue("pano", 0); //done
cl_noprint->integer = oldnoprint;
}

if (render) {
// update the screen
SCR_UpdateScreen();
Expand Down Expand Up @@ -3313,6 +3330,9 @@ void CL_Init( void ) {
for ( int index = 2; index < MAX_MASTER_SERVERS; index++ )
cl_motdServer[index] = Cvar_Get( va( "cl_motdServer%d", index + 1 ), "", CVAR_ARCHIVE_ND );

cl_pano = Cvar_Get("pano", "0", 0);
cl_panoNumShots = Cvar_Get("cl_panoNumShots", "10", CVAR_ARCHIVE);

cl_timeout = Cvar_Get ("cl_timeout", "200", 0);

cl_timeNudge = Cvar_Get ("cl_timeNudge", "0", CVAR_TEMP );
Expand Down

0 comments on commit cd08334

Please sign in to comment.