diff --git a/client/cl_screen.c b/client/cl_screen.c index aa1d31c..34d6877 100644 --- a/client/cl_screen.c +++ b/client/cl_screen.c @@ -2368,13 +2368,13 @@ void SCR_TimeRefresh_f (void) if (Cmd_Argc() == 2) { // run without page flipping - R_BeginFrame( 0 ); + R_BeginFrame (0); for (i=0 ; i<128 ; i++) { cl.refdef.viewangles[1] = i/128.0*360.0; R_RenderFrame (&cl.refdef); } - GLimp_EndFrame(); + R_EndFrame (); } else { @@ -2382,9 +2382,9 @@ void SCR_TimeRefresh_f (void) { cl.refdef.viewangles[1] = i/128.0*360.0; - R_BeginFrame( 0 ); + R_BeginFrame (0); R_RenderFrame (&cl.refdef); - GLimp_EndFrame(); + R_EndFrame (); } } @@ -2559,7 +2559,7 @@ void SCR_UpdateScreen (void) for ( i = 0; i < numframes; i++ ) { - R_BeginFrame( separation[i] ); + R_BeginFrame (separation[i]); if (scr_draw_loading == 2) { // loading plaque over black screen @@ -2659,5 +2659,5 @@ void SCR_UpdateScreen (void) } SCR_DrawConsole (); } - GLimp_EndFrame(); + R_EndFrame (); } diff --git a/client/client.h b/client/client.h index 585edc8..43a18ee 100644 --- a/client/client.h +++ b/client/client.h @@ -815,7 +815,7 @@ void R_DrawStretchRaw (int x, int y, int w, int h, int cols, int rows, byte *dat */ void R_SetPalette (const unsigned char *palette); // NULL = game palette void R_BeginFrame (float camera_separation); -void GLimp_EndFrame (void); +void R_EndFrame (void); void GLimp_AppActivate (qboolean activate); diff --git a/renderer/r_alias.c b/renderer/r_alias.c index 64db206..ab91173 100644 --- a/renderer/r_alias.c +++ b/renderer/r_alias.c @@ -865,74 +865,13 @@ based on code from BeefQuake R6 */ void R_DrawAliasVolumeShadow (maliasmodel_t *paliashdr, vec3_t bbox[8]) { - vec3_t light, vecAdd; // temp + vec3_t light, vecAdd; vec3_t shadowVec, endBBox[8], volumeMins, volumeMaxs; float projected_distance; - int i, j, skinnum; // lnum + int i, j, skinnum; qboolean zFail = (r_shadow_zfail->integer != 0); qboolean inVolume = false; // GLenum incr, decr; -// float dist, highest, lowest; -// float angle, cosp, sinp, cosy, siny, cosr, sinr, ix, iy, iz; -// dlight_t *dl; - -#if 0 - dl = r_newrefdef.dlights; - - VectorSet(vecAdd, 680,0,1024); // set base vector, was 576,0,1024 - - // compute average light vector from dlights - for (i=0, lnum=0; iorigin, currententity->origin)) - continue; - - VectorSubtract(dl->origin, currententity->origin, temp); - dist = dl->intensity - VectorLength(temp); - if (dist <= 0) - continue; - - lnum++; - // Factor in the intensity of a dlight - VectorScale (temp, dist*0.25, temp); - VectorAdd (vecAdd, temp, vecAdd); - } - VectorNormalize(vecAdd); - VectorScale(vecAdd, 1024, vecAdd); - - // get projection distance from lightspot height - highest = lowest = bbox[0][2]; - for (i=0; i<8; i++) { - if (bbox[i][2] > highest) highest = bbox[i][2]; - if (bbox[i][2] < lowest) lowest = bbox[i][2]; - } - projected_distance = (fabs(highest - lightspot[2]) + (highest-lowest)) / vecAdd[2]; - - VectorCopy(vecAdd, light); - - // reverse-rotate light vector based on angles - angle = -currententity->angles[PITCH] / 180 * M_PI; - cosp = cos(angle), sinp = sin(angle); - angle = -currententity->angles[YAW] / 180 * M_PI; - cosy = cos(angle), siny = sin(angle); - angle = -currententity->angles[ROLL] / 180 * M_PI * R_RollMult(); // roll is backwards - cosr = cos(angle), sinr = sin(angle); - - // rotate for yaw (z axis) - ix = light[0], iy = light[1]; - light[0] = cosy * ix - siny * iy + 0; - light[1] = siny * ix + cosy * iy + 0; - - // rotate for pitch (y axis) - ix = light[0], iz = light[2]; - light[0] = cosp * ix + 0 + sinp * iz; - light[2] = -sinp * ix + 0 + cosp * iz; - - // rotate for roll (x axis) - iy = light[1], iz = light[2]; - light[1] = 0 + cosr * iy - sinr * iz; - light[2] = 0 + sinr * iy + cosr * iz; -#endif projected_distance = R_CalcAliasVolumeShadowLightVector (bbox, light); @@ -994,11 +933,11 @@ void R_DrawAliasVolumeShadow (maliasmodel_t *paliashdr, vec3_t bbox[8]) for (i=0; inum_meshes; i++) { skinnum = (currententity->skinnummeshes[i].num_skins)?currententity->skinnum:0; - if (paliashdr->meshes[i].skins[skinnum].renderparms.noshadow) + if (paliashdr->meshes[i].skins[skinnum].renderparms.nodraw || paliashdr->meshes[i].skins[skinnum].renderparms.noshadow) continue; R_BuildShadowVolume (paliashdr, i, light, projected_distance, r_shadowvolumes->integer); - GL_LockArrays (shadow_va); + // GL_LockArrays (shadow_va); if (!r_shadowvolumes->integer) { @@ -1070,7 +1009,7 @@ void R_DrawAliasVolumeShadow (maliasmodel_t *paliashdr, vec3_t bbox[8]) else R_DrawShadowVolume (); - GL_UnlockArrays (); + // GL_UnlockArrays (); } // end stenciling and draw stenciled volume diff --git a/renderer/r_alias_md2.c b/renderer/r_alias_md2.c index 1186467..6898ed4 100644 --- a/renderer/r_alias_md2.c +++ b/renderer/r_alias_md2.c @@ -533,7 +533,7 @@ void R_DrawAliasMD2VolumeShadow (dmd2_t *paliashdr, vec3_t bbox[8]) } R_BuildMD2ShadowVolume(paliashdr, light, projected_distance, r_shadowvolumes->integer||!zfail); - GL_LockArrays(md2shadow_va); +// GL_LockArrays(md2shadow_va); if (!r_shadowvolumes->integer) { // increment stencil if backface is behind depthbuffer @@ -565,7 +565,7 @@ void R_DrawAliasMD2VolumeShadow (dmd2_t *paliashdr, vec3_t bbox[8]) qglDrawRangeElements(GL_TRIANGLES, 0, md2shadow_va, md2shadow_index, GL_UNSIGNED_INT, indexArray); else qglDrawElements(GL_TRIANGLES, md2shadow_index, GL_UNSIGNED_INT, indexArray); - GL_UnlockArrays(); +// GL_UnlockArrays(); /*for (i=-1; igeneric.flags & QMF_GRAYED) UI_DrawStringDark (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET, - a->generic.y + a->generic.parent->y, a->generic.textSize, a->generic.name, alpha); + a->generic.y + a->generic.parent->y, a->generic.textSize, ALIGN_CENTER, a->generic.name, FONT_UI, alpha); else UI_DrawString (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET, - a->generic.y + a->generic.parent->y, a->generic.textSize, a->generic.name, alpha); + a->generic.y + a->generic.parent->y, a->generic.textSize, ALIGN_CENTER, a->generic.name, FONT_UI, alpha); } else { if (a->generic.flags & QMF_GRAYED) UI_DrawStringR2LDark (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET, - a->generic.y + a->generic.parent->y, a->generic.textSize, a->generic.name, alpha); + a->generic.y + a->generic.parent->y, a->generic.textSize, ALIGN_CENTER, a->generic.name, FONT_UI, alpha); else UI_DrawStringR2L (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET, - a->generic.y + a->generic.parent->y, a->generic.textSize, a->generic.name, alpha); + a->generic.y + a->generic.parent->y, a->generic.textSize, ALIGN_CENTER, a->generic.name, FONT_UI, alpha); } if (a->generic.ownerdraw) a->generic.ownerdraw(a); @@ -128,7 +128,7 @@ void MenuField_Draw (menufield_s *f) if (f->generic.name) UI_DrawStringR2LDark (f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET, - f->generic.y + f->generic.parent->y, f->generic.textSize, f->generic.name, 255); + f->generic.y + f->generic.parent->y, f->generic.textSize, ALIGN_CENTER, f->generic.name, FONT_UI, 255); if (xtra = stringLengthExtra(f->buffer)) { @@ -189,7 +189,7 @@ void MenuField_Draw (menufield_s *f) Com_sprintf (tempbuffer, sizeof(tempbuffer), "%s%c", tempbuffer, 11); UI_DrawString (f->generic.x + f->generic.parent->x + f->generic.textSize*3, - f->generic.y + f->generic.parent->y, f->generic.textSize, tempbuffer, alpha); + f->generic.y + f->generic.parent->y, f->generic.textSize, ALIGN_CENTER, tempbuffer, FONT_UI, alpha); } qboolean UI_MenuField_Key (menufield_s *f, int key) @@ -345,15 +345,15 @@ void Menulist_DoEnter (menulist_s *l) void MenuList_Draw (menulist_s *l) { - const char **n; - int y = 0, alpha; + const char **n; + int y = 0, alpha; if (!l) return; alpha = UI_MouseOverAlpha(&l->generic); UI_DrawStringR2LDark (l->generic.x + l->generic.parent->x + LCOLUMN_OFFSET, // - 2*MENU_FONT_SIZE, - l->generic.y + l->generic.parent->y, l->generic.textSize, l->generic.name, alpha); + l->generic.y + l->generic.parent->y, l->generic.textSize, ALIGN_CENTER, l->generic.name, FONT_UI, alpha); n = l->itemNames; @@ -365,7 +365,7 @@ void MenuList_Draw (menulist_s *l) while (*n) { UI_DrawStringR2LDark (l->generic.x + l->generic.parent->x + LCOLUMN_OFFSET, - l->generic.y + l->generic.parent->y + y + MENU_LINE_SIZE, l->generic.textSize, *n, alpha); + l->generic.y + l->generic.parent->y + y + MENU_LINE_SIZE, l->generic.textSize, ALIGN_CENTER, *n, FONT_UI, alpha); n++; y += MENU_LINE_SIZE; } @@ -383,7 +383,7 @@ void MenuSeparator_Draw (menuseparator_s *s) if (s->generic.name) UI_DrawStringR2LDark (s->generic.x + s->generic.parent->x, - s->generic.y + s->generic.parent->y, s->generic.textSize, s->generic.name, alpha); + s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, s->generic.name, FONT_UI, alpha); } //========================================================= @@ -445,7 +445,7 @@ void MenuSlider_Draw (menuslider_s *s) alpha = UI_MouseOverAlpha(&s->generic); UI_DrawStringR2LDark (s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET, - s->generic.y + s->generic.parent->y, s->generic.textSize, s->generic.name, alpha); + s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, s->generic.name, FONT_UI, alpha); if (!s->maxPos) s->maxPos = 1; @@ -502,9 +502,9 @@ void MenuSlider_Draw (menuslider_s *s) Com_sprintf (valueText, sizeof(valueText), "%4.2f", tmpValue); } UI_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET + 2*SLIDER_ENDCAP_WIDTH + i*SLIDER_SECTION_WIDTH + MENU_FONT_SIZE/2, - s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, valueText, alpha); + s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, ALIGN_CENTER, valueText, FONT_UI, alpha); // UI_DrawString (s->generic.x + s->generic.parent->x + s->generic.textSize*SLIDER_RANGE + RCOLUMN_OFFSET + 2.5*MENU_FONT_SIZE, -// s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, valueText, alpha); +// s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, ALIGN_CENTER, valueText, FONT_UI, alpha); } //========================================================= @@ -636,12 +636,12 @@ void MenuSpinControl_Draw (menulist_s *s) if (s->generic.name) { UI_DrawStringR2LDark (s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET, - s->generic.y + s->generic.parent->y, s->generic.textSize, s->generic.name, alpha); + s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, s->generic.name, FONT_UI, alpha); } if (!strchr(s->itemNames[s->curValue], '\n')) { UI_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET, - s->generic.y + s->generic.parent->y, s->generic.textSize, s->itemNames[s->curValue], alpha); + s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, s->itemNames[s->curValue], FONT_UI, alpha); } else { @@ -649,11 +649,11 @@ void MenuSpinControl_Draw (menulist_s *s) Q_strncpyz (buffer, sizeof(buffer), s->itemNames[s->curValue]); *strchr(buffer, '\n') = 0; UI_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET, - s->generic.y + s->generic.parent->y, s->generic.textSize, buffer, alpha); + s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, buffer, FONT_UI, alpha); // strncpy(buffer, strchr( s->itemnames[s->curvalue], '\n' ) + 1 ); Q_strncpyz (buffer, sizeof(buffer), strchr( s->itemNames[s->curValue], '\n' ) + 1); UI_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET, - s->generic.y + s->generic.parent->y + MENU_LINE_SIZE, s->generic.textSize, buffer, alpha); + s->generic.y + s->generic.parent->y + MENU_LINE_SIZE, s->generic.textSize, ALIGN_CENTER, buffer, FONT_UI, alpha); } } @@ -683,7 +683,7 @@ void MenuKeyBind_Draw (menukeybind_s *k) const char *keyName1, *keyName2; UI_DrawMenuString (menu->x + k->generic.x + LCOLUMN_OFFSET, - menu->y + k->generic.y, MENU_FONT_SIZE, k->generic.name, alpha, + menu->y + k->generic.y, MENU_FONT_SIZE, ALIGN_CENTER, k->generic.name, alpha, !(k->generic.flags & QMF_LEFT_JUSTIFY), (k->generic.flags & QMF_ALTCOLOR)); if (k->commandName) @@ -693,21 +693,21 @@ void MenuKeyBind_Draw (menukeybind_s *k) if (k->keys[0] == -1) { UI_DrawMenuString (menu->x + k->generic.x + RCOLUMN_OFFSET, - menu->y + k->generic.y, MENU_FONT_SIZE, "???", alpha, false, false); + menu->y + k->generic.y, MENU_FONT_SIZE, ALIGN_CENTER, "???", alpha, false, false); } else { keyName1 = Key_KeynumToString (k->keys[0]); UI_DrawMenuString (menu->x + k->generic.x + RCOLUMN_OFFSET, - menu->y + k->generic.y, MENU_FONT_SIZE, keyName1, alpha, false, false); + menu->y + k->generic.y, MENU_FONT_SIZE, ALIGN_CENTER, keyName1, alpha, false, false); if (k->keys[1] != -1) { x = (int)strlen(keyName1) * MENU_FONT_SIZE; keyName2 = Key_KeynumToString (k->keys[1]); UI_DrawMenuString (menu->x + k->generic.x + MENU_FONT_SIZE*3 + x, - menu->y + k->generic.y, MENU_FONT_SIZE, "or", alpha, false, false); + menu->y + k->generic.y, MENU_FONT_SIZE, ALIGN_CENTER, "or", alpha, false, false); UI_DrawMenuString (menu->x + k->generic.x + MENU_FONT_SIZE*6 + x, - menu->y + k->generic.y, MENU_FONT_SIZE, keyName2, alpha, false, false); + menu->y + k->generic.y, MENU_FONT_SIZE, ALIGN_CENTER, keyName2, alpha, false, false); } } } diff --git a/win32/glw_imp.c b/win32/glw_imp.c index b2f6c96..8a360ca 100644 --- a/win32/glw_imp.c +++ b/win32/glw_imp.c @@ -843,9 +843,9 @@ void GLimp_EndFrame (void) int err; err = qglGetError(); -// assert( err == GL_NO_ERROR ); if (err != GL_NO_ERROR) // Output error code instead - VID_Printf (PRINT_DEVELOPER, "OpenGL Error %i\n", err); + // VID_Printf (PRINT_DEVELOPER, "OpenGL Error %i\n", err); + GL_PrintError (err, "GLimp_EndFrame"); if ( stricmp( r_drawbuffer->string, "GL_BACK" ) == 0 ) {