mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: client: validate vid_rotate cvar value and save current rotation to ref global
This commit is contained in:
@@ -30,6 +30,8 @@ struct ref_state_s
|
||||
// depends on build configuration
|
||||
const char **short_names;
|
||||
const char **long_names;
|
||||
|
||||
ref_screen_rotation_t rotation;
|
||||
};
|
||||
|
||||
extern struct ref_state_s ref;
|
||||
|
||||
@@ -143,6 +143,9 @@ void VID_SetDisplayTransform( int *render_w, int *render_h )
|
||||
{
|
||||
uint rotate = vid_rotate.value;
|
||||
|
||||
if( rotate < REF_ROTATE_NONE || rotate > REF_ROTATE_CCW )
|
||||
rotate = REF_ROTATE_NONE;
|
||||
|
||||
if( ref.dllFuncs.R_SetDisplayTransform( rotate, 0, 0, vid_scale.value, vid_scale.value ))
|
||||
{
|
||||
if( rotate & 1 )
|
||||
@@ -155,10 +158,14 @@ void VID_SetDisplayTransform( int *render_w, int *render_h )
|
||||
|
||||
*render_h /= vid_scale.value;
|
||||
*render_w /= vid_scale.value;
|
||||
|
||||
ref.rotation = rotate;
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf( S_WARN "failed to setup screen transform\n" );
|
||||
|
||||
ref.rotation = REF_ROTATE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user