Merge remote-tracking branch 'yquake2/master'

This commit is contained in:
Denis Pauk 2024-06-08 22:47:14 +03:00
commit 1775874418
12 changed files with 132 additions and 136 deletions

View file

@ -492,11 +492,10 @@ Set `0` by default.
value, at least `1.0` - default is `2.0`. Applied when textures are value, at least `1.0` - default is `2.0`. Applied when textures are
loaded, so it needs a `vid_restart`. loaded, so it needs a `vid_restart`.
* **gl1_multitexture**: Enables (`1`) the blending of color and light * **gl1_multitexture**: Enables (`1`, default) the blending of color and
textures on a single drawing pass; disabling this (`0`) does one pass light textures on a single drawing pass; disabling this (`0`) does one
for color and another for light. Default is `2`, which also enables pass for color and another for light. Requires a `vid_restart` when
texture combine mode (`GL_ARB_texture_env_combine`) when supported. changed.
Requires a `vid_restart` when changed.
* **gl1_overbrightbits**: Enables overbright bits, brightness scaling of * **gl1_overbrightbits**: Enables overbright bits, brightness scaling of
lightmaps and models. Higher values make shadows less dark. Possible lightmaps and models. Higher values make shadows less dark. Possible
@ -622,6 +621,10 @@ Set `0` by default.
for people who hold the controller upright, or use a device with the for people who hold the controller upright, or use a device with the
controller attached to the screen, e.g. Steam Deck. controller attached to the screen, e.g. Steam Deck.
* **gyro_tightening**: Threshold of rotation in degrees per second,
where gyro inputs below it will be dampened. Meant to counter a
noisy gyro and involuntary hand movements. Default `3.5`.
* **gyro_calibration_(x/y/z)**: Offset values on each axis of the gyro * **gyro_calibration_(x/y/z)**: Offset values on each axis of the gyro
which helps it reach true "zero movement", complete stillness. These which helps it reach true "zero movement", complete stillness. These
values are wrong if you see your in-game view "drift" when leaving values are wrong if you see your in-game view "drift" when leaving

View file

@ -33,6 +33,9 @@ int cl_numparticles = MAX_PARTICLES;
void void
CL_ClearParticles(void) CL_ClearParticles(void)
{ {
if (cl_numparticles == 0)
return;
int i; int i;
free_particles = &particles[0]; free_particles = &particles[0];

View file

@ -162,6 +162,7 @@ cvar_t *gyro_turning_axis; // yaw or roll
// Gyro sensitivity // Gyro sensitivity
static cvar_t *gyro_yawsensitivity; static cvar_t *gyro_yawsensitivity;
static cvar_t *gyro_pitchsensitivity; static cvar_t *gyro_pitchsensitivity;
static cvar_t *gyro_tightening;
// Gyro is being used in this very moment // Gyro is being used in this very moment
static qboolean gyro_active = false; static qboolean gyro_active = false;
@ -726,14 +727,9 @@ IN_Update(void)
qboolean down = (event.type == SDL_CONTROLLERBUTTONDOWN); qboolean down = (event.type == SDL_CONTROLLERBUTTONDOWN);
unsigned char btn = event.cbutton.button; unsigned char btn = event.cbutton.button;
// Handle Back Button first, to override its original key // Handle Back Button, to override its original key
if (btn == sdl_back_button) Key_Event( (btn == sdl_back_button)? K_JOY_BACK : K_BTN_A + btn,
{ down, true );
Key_Event(K_JOY_BACK, down, true);
break;
}
Key_Event(K_BTN_A + btn, down, true);
break; break;
} }
@ -1074,6 +1070,30 @@ IN_ApplyExpo(thumbstick_t stick, float exponent)
return result; return result;
} }
/*
* Minimize gyro movement when under a small threshold.
* http://gyrowiki.jibbsmart.com/blog:good-gyro-controls-part-1:the-gyro-is-a-mouse#toc9
*/
static thumbstick_t
IN_TightenInput(float yaw, float pitch)
{
thumbstick_t input = { yaw, pitch };
const float magnitude = IN_StickMagnitude(input);
#ifdef NATIVE_SDL_GYRO
const float threshold = (M_PI / 180.0f) * gyro_tightening->value;
#else
const float threshold = (2560.0f / 180.0f) * gyro_tightening->value;
#endif
if (magnitude < threshold)
{
const float scale = magnitude / threshold;
input.x *= scale;
input.y *= scale;
}
return input;
}
/* /*
* Delete flick stick's buffer of angle samples for smoothing * Delete flick stick's buffer of angle samples for smoothing
*/ */
@ -1203,6 +1223,7 @@ IN_Move(usercmd_t *cmd)
static float joystick_yaw, joystick_pitch; static float joystick_yaw, joystick_pitch;
static float joystick_forwardmove, joystick_sidemove; static float joystick_forwardmove, joystick_sidemove;
static thumbstick_t left_stick = {0}, right_stick = {0}; static thumbstick_t left_stick = {0}, right_stick = {0};
thumbstick_t gyro_in = {0};
if (m_filter->value) if (m_filter->value)
{ {
@ -1383,16 +1404,21 @@ IN_Move(usercmd_t *cmd)
* cl_sidespeed->value * 2.0f * joystick_sidemove; * cl_sidespeed->value * 2.0f * joystick_sidemove;
} }
if (gyro_yaw) if (gyro_yaw || gyro_pitch)
{ {
cl.viewangles[YAW] += m_yaw->value * gyro_yawsensitivity->value gyro_in = IN_TightenInput(gyro_yaw, gyro_pitch);
* cl_yawspeed->value * gyro_yaw * gyroViewFactor;
} }
if (gyro_pitch) if (gyro_in.x)
{
cl.viewangles[YAW] += m_yaw->value * gyro_yawsensitivity->value
* cl_yawspeed->value * gyro_in.x * gyroViewFactor;
}
if (gyro_in.y)
{ {
cl.viewangles[PITCH] -= m_pitch->value * gyro_pitchsensitivity->value cl.viewangles[PITCH] -= m_pitch->value * gyro_pitchsensitivity->value
* cl_pitchspeed->value * gyro_pitch * gyroViewFactor; * cl_pitchspeed->value * gyro_in.y * gyroViewFactor;
} }
// Flick Stick: flick in progress, changing the yaw angle to the target progressively // Flick Stick: flick in progress, changing the yaw angle to the target progressively
@ -2181,6 +2207,7 @@ IN_Init(void)
gyro_yawsensitivity = Cvar_Get("gyro_yawsensitivity", "1.0", CVAR_ARCHIVE); gyro_yawsensitivity = Cvar_Get("gyro_yawsensitivity", "1.0", CVAR_ARCHIVE);
gyro_pitchsensitivity = Cvar_Get("gyro_pitchsensitivity", "1.0", CVAR_ARCHIVE); gyro_pitchsensitivity = Cvar_Get("gyro_pitchsensitivity", "1.0", CVAR_ARCHIVE);
gyro_tightening = Cvar_Get("gyro_tightening", "3.5", CVAR_ARCHIVE);
gyro_turning_axis = Cvar_Get("gyro_turning_axis", "0", CVAR_ARCHIVE); gyro_turning_axis = Cvar_Get("gyro_turning_axis", "0", CVAR_ARCHIVE);
gyro_mode = Cvar_Get("gyro_mode", "2", CVAR_ARCHIVE); gyro_mode = Cvar_Get("gyro_mode", "2", CVAR_ARCHIVE);

View file

@ -165,6 +165,7 @@ cvar_t *gyro_turning_axis; // yaw or roll
// Gyro sensitivity // Gyro sensitivity
static cvar_t *gyro_yawsensitivity; static cvar_t *gyro_yawsensitivity;
static cvar_t *gyro_pitchsensitivity; static cvar_t *gyro_pitchsensitivity;
static cvar_t *gyro_tightening;
// Gyro is being used in this very moment // Gyro is being used in this very moment
static qboolean gyro_active = false; static qboolean gyro_active = false;
@ -717,14 +718,9 @@ IN_Update(void)
qboolean down = (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN); qboolean down = (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN);
unsigned char btn = event.gbutton.button; unsigned char btn = event.gbutton.button;
// Handle Back Button first, to override its original key // Handle Back Button, to override its original key
if (btn == sdl_back_button) Key_Event( (btn == sdl_back_button)? K_JOY_BACK : K_BTN_A + btn,
{ down, true );
Key_Event(K_JOY_BACK, down, true);
break;
}
Key_Event(K_BTN_A + btn, down, true);
break; break;
} }
@ -1063,6 +1059,26 @@ IN_ApplyExpo(thumbstick_t stick, float exponent)
return result; return result;
} }
/*
* Minimize gyro movement when under a small threshold.
* http://gyrowiki.jibbsmart.com/blog:good-gyro-controls-part-1:the-gyro-is-a-mouse#toc9
*/
static thumbstick_t
IN_TightenInput(float yaw, float pitch)
{
thumbstick_t input = { yaw, pitch };
const float magnitude = IN_StickMagnitude(input);
const float threshold = (M_PI / 180.0f) * gyro_tightening->value;
if (magnitude < threshold)
{
const float scale = magnitude / threshold;
input.x *= scale;
input.y *= scale;
}
return input;
}
/* /*
* Delete flick stick's buffer of angle samples for smoothing * Delete flick stick's buffer of angle samples for smoothing
*/ */
@ -1192,6 +1208,7 @@ IN_Move(usercmd_t *cmd)
static float joystick_yaw, joystick_pitch; static float joystick_yaw, joystick_pitch;
static float joystick_forwardmove, joystick_sidemove; static float joystick_forwardmove, joystick_sidemove;
static thumbstick_t left_stick = {0}, right_stick = {0}; static thumbstick_t left_stick = {0}, right_stick = {0};
thumbstick_t gyro_in = {0};
if (m_filter->value) if (m_filter->value)
{ {
@ -1372,16 +1389,21 @@ IN_Move(usercmd_t *cmd)
* cl_sidespeed->value * 2.0f * joystick_sidemove; * cl_sidespeed->value * 2.0f * joystick_sidemove;
} }
if (gyro_yaw) if (gyro_yaw || gyro_pitch)
{ {
cl.viewangles[YAW] += m_yaw->value * gyro_yawsensitivity->value gyro_in = IN_TightenInput(gyro_yaw, gyro_pitch);
* cl_yawspeed->value * gyro_yaw * gyroViewFactor;
} }
if (gyro_pitch) if (gyro_in.x)
{
cl.viewangles[YAW] += m_yaw->value * gyro_yawsensitivity->value
* cl_yawspeed->value * gyro_in.x * gyroViewFactor;
}
if (gyro_in.y)
{ {
cl.viewangles[PITCH] -= m_pitch->value * gyro_pitchsensitivity->value cl.viewangles[PITCH] -= m_pitch->value * gyro_pitchsensitivity->value
* cl_pitchspeed->value * gyro_pitch * gyroViewFactor; * cl_pitchspeed->value * gyro_in.y * gyroViewFactor;
} }
// Flick Stick: flick in progress, changing the yaw angle to the target progressively // Flick Stick: flick in progress, changing the yaw angle to the target progressively
@ -2283,6 +2305,7 @@ IN_Init(void)
gyro_yawsensitivity = Cvar_Get("gyro_yawsensitivity", "1.0", CVAR_ARCHIVE); gyro_yawsensitivity = Cvar_Get("gyro_yawsensitivity", "1.0", CVAR_ARCHIVE);
gyro_pitchsensitivity = Cvar_Get("gyro_pitchsensitivity", "1.0", CVAR_ARCHIVE); gyro_pitchsensitivity = Cvar_Get("gyro_pitchsensitivity", "1.0", CVAR_ARCHIVE);
gyro_tightening = Cvar_Get("gyro_tightening", "3.5", CVAR_ARCHIVE);
gyro_turning_axis = Cvar_Get("gyro_turning_axis", "0", CVAR_ARCHIVE); gyro_turning_axis = Cvar_Get("gyro_turning_axis", "0", CVAR_ARCHIVE);
gyro_mode = Cvar_Get("gyro_mode", "2", CVAR_ARCHIVE); gyro_mode = Cvar_Get("gyro_mode", "2", CVAR_ARCHIVE);

View file

@ -1787,6 +1787,7 @@ static menuslider_s s_gyro_yawsensitivity_slider;
static menuslider_s s_gyro_pitchsensitivity_slider; static menuslider_s s_gyro_pitchsensitivity_slider;
static menulist_s s_gyro_invertyaw_box; static menulist_s s_gyro_invertyaw_box;
static menulist_s s_gyro_invertpitch_box; static menulist_s s_gyro_invertpitch_box;
static menuslider_s s_gyro_tightening_slider;
static menuseparator_s s_calibrating_text[2]; static menuseparator_s s_calibrating_text[2];
static menuaction_s s_calibrate_gyro; static menuaction_s s_calibrate_gyro;
@ -1924,6 +1925,15 @@ Gyro_MenuInit(void)
s_gyro_invertpitch_box.itemnames = yesno_names; s_gyro_invertpitch_box.itemnames = yesno_names;
s_gyro_invertpitch_box.curvalue = (Cvar_VariableValue("gyro_pitchsensitivity") < 0); s_gyro_invertpitch_box.curvalue = (Cvar_VariableValue("gyro_pitchsensitivity") < 0);
s_gyro_tightening_slider.generic.type = MTYPE_SLIDER;
s_gyro_tightening_slider.generic.x = 0;
s_gyro_tightening_slider.generic.y = (y += 20);
s_gyro_tightening_slider.generic.name = "tightening thresh";
s_gyro_tightening_slider.cvar = "gyro_tightening";
s_gyro_tightening_slider.minvalue = 0.0f;
s_gyro_tightening_slider.maxvalue = 12.0f;
s_gyro_tightening_slider.slidestep = 0.5f;
s_calibrating_text[0].generic.type = MTYPE_SEPARATOR; s_calibrating_text[0].generic.type = MTYPE_SEPARATOR;
s_calibrating_text[0].generic.x = 48 * scale + 32; s_calibrating_text[0].generic.x = 48 * scale + 32;
s_calibrating_text[0].generic.y = (y += 20); s_calibrating_text[0].generic.y = (y += 20);
@ -1946,6 +1956,7 @@ Gyro_MenuInit(void)
Menu_AddItem(&s_gyro_menu, (void *)&s_gyro_pitchsensitivity_slider); Menu_AddItem(&s_gyro_menu, (void *)&s_gyro_pitchsensitivity_slider);
Menu_AddItem(&s_gyro_menu, (void *)&s_gyro_invertyaw_box); Menu_AddItem(&s_gyro_menu, (void *)&s_gyro_invertyaw_box);
Menu_AddItem(&s_gyro_menu, (void *)&s_gyro_invertpitch_box); Menu_AddItem(&s_gyro_menu, (void *)&s_gyro_invertpitch_box);
Menu_AddItem(&s_gyro_menu, (void *)&s_gyro_tightening_slider);
Menu_AddItem(&s_gyro_menu, (void *)&s_calibrating_text[0]); Menu_AddItem(&s_gyro_menu, (void *)&s_calibrating_text[0]);
Menu_AddItem(&s_gyro_menu, (void *)&s_calibrating_text[1]); Menu_AddItem(&s_gyro_menu, (void *)&s_calibrating_text[1]);
Menu_AddItem(&s_gyro_menu, (void *)&s_calibrate_gyro); Menu_AddItem(&s_gyro_menu, (void *)&s_calibrate_gyro);

View file

@ -613,14 +613,10 @@ Separator_Draw(menuseparator_s *s)
void void
Slider_DoSlide(menuslider_s *s, int dir) Slider_DoSlide(menuslider_s *s, int dir)
{ {
const float step = (s->slidestep)? s->slidestep : 0.1f;
float value = Cvar_VariableValue(s->cvar); float value = Cvar_VariableValue(s->cvar);
float step = 0.1f;
float sign = 1.0f; float sign = 1.0f;
if (s->slidestep)
{
step = s->slidestep;
}
if (s->abs && value < 0) // absolute value treatment if (s->abs && value < 0) // absolute value treatment
{ {
value = -value; value = -value;
@ -641,48 +637,40 @@ Slider_DoSlide(menuslider_s *s, int dir)
void void
Slider_Draw(menuslider_s *s) Slider_Draw(menuslider_s *s)
{ {
const float scale = SCR_GetMenuScale();
const int x = s->generic.parent->x + s->generic.x;
const int y = s->generic.parent->y + s->generic.y;
const int x_rcol = x + (RCOLUMN_OFFSET * scale);
int i; int i;
char buffer[5]; char buffer[5];
const char * format;
float scale = SCR_GetMenuScale();
int x = s->generic.parent->x + s->generic.x;
int y = s->generic.parent->y + s->generic.y;
float value = Cvar_VariableValue(s->cvar); float value = Cvar_VariableValue(s->cvar);
if (s->abs && value < 0) // absolute value if (s->abs && value < 0) // absolute value
{ {
value = -value; value = -value;
} }
float range = (ClampCvar(s->minvalue, s->maxvalue, value) - s->minvalue) / const float range = (ClampCvar(s->minvalue, s->maxvalue, value) - s->minvalue) /
(s->maxvalue - s->minvalue); (s->maxvalue - s->minvalue);
Menu_DrawStringR2LDark(x + (LCOLUMN_OFFSET * scale), Menu_DrawStringR2LDark(x + (LCOLUMN_OFFSET * scale),
y, s->generic.name); y, s->generic.name);
Draw_CharScaled(x + (RCOLUMN_OFFSET * scale), Draw_CharScaled(x_rcol,
y * scale, 128, scale); y * scale, 128, scale);
for (i = 0; i < SLIDER_RANGE * scale; i++) for (i = 0; i < SLIDER_RANGE * scale; i++)
{ {
Draw_CharScaled(x + (RCOLUMN_OFFSET * scale) + (i * 8) + 8, Draw_CharScaled(x_rcol + (i * 8) + 8,
y * scale, 129, scale); y * scale, 129, scale);
} }
Draw_CharScaled(x + (RCOLUMN_OFFSET * scale) + (i * 8) + 8, Draw_CharScaled(x_rcol + (i * 8) + 8,
y * scale, 130, scale); y * scale, 130, scale);
Draw_CharScaled(x + ((int)((RCOLUMN_OFFSET * scale) + (SLIDER_RANGE * scale - 1) * 8 * range)) + 8, Draw_CharScaled(x_rcol + (int)((SLIDER_RANGE * scale - 1) * 8 * range) + 8,
y * scale, 131, scale); y * scale, 131, scale);
if (!s->printformat) snprintf(buffer, 5, (s->printformat)? s->printformat : "%.1f", value);
{ Menu_DrawString(x_rcol + ((SLIDER_RANGE + 2) * scale * 8),
format = "%.1f";
}
else
{
format = s->printformat;
}
snprintf(buffer, 5, format, value);
Menu_DrawString(x + (RCOLUMN_OFFSET * scale) + ((SLIDER_RANGE + 2) * scale * 8),
y, buffer); y, buffer);
} }

View file

@ -234,47 +234,14 @@ R_EnableMultitexture(qboolean enable)
{ {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
if (gl_config.mtexcombine) if (gl_lightmap->value)
{ {
R_TexEnv(GL_COMBINE); R_TexEnv(GL_REPLACE);
if (gl_lightmap->value)
{
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
}
else
{
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS);
}
R_SelectTexture(GL_TEXTURE0);
R_TexEnv(GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
return;
} }
else else
{ {
if (gl_lightmap->value) R_TexEnv(GL_MODULATE);
{
R_TexEnv(GL_REPLACE);
}
else
{
R_TexEnv(GL_MODULATE);
}
} }
} }
else // disable multitexturing else // disable multitexturing
{ {

View file

@ -414,6 +414,7 @@ R_DrawEntitiesOnList(void)
} }
glDepthMask(GL_TRUE); /* back to writing */ glDepthMask(GL_TRUE); /* back to writing */
R_EnableMultitexture(false);
} }
void void
@ -1233,7 +1234,7 @@ R_Register(void)
gl1_palettedtexture = ri.Cvar_Get("r_palettedtextures", "0", CVAR_ARCHIVE); gl1_palettedtexture = ri.Cvar_Get("r_palettedtextures", "0", CVAR_ARCHIVE);
gl1_pointparameters = ri.Cvar_Get("gl1_pointparameters", "1", CVAR_ARCHIVE); gl1_pointparameters = ri.Cvar_Get("gl1_pointparameters", "1", CVAR_ARCHIVE);
gl1_multitexture = ri.Cvar_Get("gl1_multitexture", "2", CVAR_ARCHIVE); gl1_multitexture = ri.Cvar_Get("gl1_multitexture", "1", CVAR_ARCHIVE);
gl1_biglightmaps = ri.Cvar_Get("gl1_biglightmaps", "1", CVAR_ARCHIVE); gl1_biglightmaps = ri.Cvar_Get("gl1_biglightmaps", "1", CVAR_ARCHIVE);
gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0); gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0);
@ -1600,7 +1601,7 @@ RI_Init(void)
// ---- // ----
/* Multitexturing */ /* Multitexturing */
gl_config.multitexture = gl_config.mtexcombine = false; gl_config.multitexture = false;
R_Printf(PRINT_ALL, " - Multitexturing: "); R_Printf(PRINT_ALL, " - Multitexturing: ");
@ -1635,29 +1636,6 @@ RI_Init(void)
// ---- // ----
/* Multi texturing combine */
R_Printf(PRINT_ALL, " - Multitexturing combine: ");
if ( ( strstr(gl_config.extensions_string, "GL_ARB_texture_env_combine")
|| strstr(gl_config.extensions_string, "GL_EXT_texture_env_combine") ) )
{
if (gl_config.multitexture && gl1_multitexture->value > 1)
{
gl_config.mtexcombine = true;
R_Printf(PRINT_ALL, "Okay\n");
}
else
{
R_Printf(PRINT_ALL, "Disabled\n");
}
}
else
{
R_Printf(PRINT_ALL, "Failed\n");
}
// ----
/* Big lightmaps */ /* Big lightmaps */
R_Printf(PRINT_ALL, " - Big lightmaps: "); R_Printf(PRINT_ALL, " - Big lightmaps: ");

View file

@ -711,14 +711,12 @@ R_DrawAliasModel(entity_t *currententity, const model_t *currentmodel)
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glBegin(GL_TRIANGLE_STRIP);
for (i = 0; i < 8; i++) glEnableClientState(GL_VERTEX_ARRAY);
{ glVertexPointer(3, GL_FLOAT, 0, bbox);
glVertex3fv(bbox[i]); glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);
} glDisableClientState(GL_VERTEX_ARRAY);
glEnd();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);

View file

@ -740,7 +740,7 @@ static void
R_RegenAllLightmaps() R_RegenAllLightmaps()
{ {
int i, map, smax, tmax, top, bottom, left, right, bt, bb, bl, br; int i, map, smax, tmax, top, bottom, left, right, bt, bb, bl, br;
qboolean affected_lightmap; qboolean affected_lightmap, pixelstore_set = false;
msurface_t *surf; msurface_t *surf;
byte *base; byte *base;
@ -749,8 +749,6 @@ R_RegenAllLightmaps()
return; return;
} }
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl_state.block_width);
for (i = 1; i < gl_state.max_lightmaps; i++) for (i = 1; i < gl_state.max_lightmaps; i++)
{ {
if (!gl_lms.lightmap_surfaces[i] || !gl_lms.lightmap_buffer[i]) if (!gl_lms.lightmap_surfaces[i] || !gl_lms.lightmap_buffer[i])
@ -811,6 +809,12 @@ R_RegenAllLightmaps()
continue; continue;
} }
if (!pixelstore_set)
{
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl_state.block_width);
pixelstore_set = true;
}
base = gl_lms.lightmap_buffer[i]; base = gl_lms.lightmap_buffer[i];
base += (bt * gl_state.block_width + bl) * LIGHTMAP_BYTES; base += (bt * gl_state.block_width + bl) * LIGHTMAP_BYTES;
@ -820,7 +824,10 @@ R_RegenAllLightmaps()
GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, base); GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, base);
} }
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); if (pixelstore_set)
{
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
} }
static void static void
@ -891,12 +898,11 @@ R_DrawTextureChains(const entity_t *currententity)
continue; continue;
} }
R_Bind(image->texnum); // no danger of resetting in R_RenderBrushPoly
for (s = image->texturechain; s; s = s->texturechain) for (s = image->texturechain; s; s = s->texturechain)
{ {
if (s->flags & SURF_DRAWTURB) if (s->flags & SURF_DRAWTURB)
{ {
R_Bind(image->texnum);
R_RenderBrushPoly(currententity, s); R_RenderBrushPoly(currententity, s);
} }
} }

View file

@ -340,7 +340,6 @@ typedef struct
qboolean palettedtexture; qboolean palettedtexture;
qboolean pointparameters; qboolean pointparameters;
qboolean multitexture; qboolean multitexture;
qboolean mtexcombine;
// ---- // ----

View file

@ -57,14 +57,7 @@
#define GL_TEXTURE1 0x84C1 #define GL_TEXTURE1 0x84C1
#define GL_MULTISAMPLE 0x809D #define GL_MULTISAMPLE 0x809D
#define GL_COMBINE 0x8570 #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_SOURCE0_ALPHA 0x8588
#define GL_SOURCE1_ALPHA 0x8589
#define GL_RGB_SCALE 0x8573 #define GL_RGB_SCALE 0x8573
#define GL_PREVIOUS 0x8578
#endif #endif
#ifndef GL_EXT_shared_texture_palette #ifndef GL_EXT_shared_texture_palette