diff --git a/include/QF/vid.h b/include/QF/vid.h index 699fa819b..20d068fb9 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -47,9 +47,9 @@ typedef struct { unsigned short *colormap16; // 256 * VID_GRADES size unsigned int *colormap32; // 256 * VID_GRADES size int fullbright; // index of first fullbright color - unsigned int rowbytes; // may be > width if displayed in a window - unsigned int width; - unsigned int height; + int rowbytes; // may be > width if displayed in a window + int width; + int height; float aspect; // width / height -- < 1 is taller than wide int numpages; qboolean recalc_refdef; // if true, recalc vid-based stuff @@ -57,8 +57,8 @@ typedef struct { quat_t cshift_color; void *conbuffer; int conrowbytes; - unsigned int conwidth; - unsigned int conheight; + int conwidth; + int conheight; int maxwarpwidth; int maxwarpheight; byte *direct; // direct drawing to framebuffer, if not diff --git a/include/d_local.h b/include/d_local.h index 86276986d..cc7c4591c 100644 --- a/include/d_local.h +++ b/include/d_local.h @@ -102,7 +102,7 @@ extern void D_PolysetAff8End (void); #endif extern short *d_pzbuffer; -extern unsigned int d_zrowbytes, d_zwidth; +extern int d_zrowbytes, d_zwidth; extern int *d_pscantable; extern int d_scantable[]; diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index 64825a055..c9334b377 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -93,10 +93,8 @@ gl_SCR_ScreenShot (int width, int height) qfglReadPixels (0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, snap); - w = (vid.width < (unsigned int) width) ? vid.width - : (unsigned int) width; - h = (vid.height < (unsigned int) height) ? vid.height - : (unsigned int) height; + w = (vid.width < width) ? vid.width : width; + h = (vid.height < height) ? vid.height : height; fracw = (float) vid.width / (float) w; frach = (float) vid.height / (float) h; diff --git a/libs/video/renderer/sw/d_fill.c b/libs/video/renderer/sw/d_fill.c index 506269330..be9bfd3ab 100644 --- a/libs/video/renderer/sw/d_fill.c +++ b/libs/video/renderer/sw/d_fill.c @@ -34,7 +34,7 @@ void D_FillRect (vrect_t *rect, int color) { - unsigned int rx, ry, rwidth, rheight; + int rx, ry, rwidth, rheight; unsigned char *dest; unsigned int *ldest; diff --git a/libs/video/renderer/sw/d_modech.c b/libs/video/renderer/sw/d_modech.c index 955ec8b76..1498829e7 100644 --- a/libs/video/renderer/sw/d_modech.c +++ b/libs/video/renderer/sw/d_modech.c @@ -100,7 +100,7 @@ D_ViewChanged (void) r_refdef.vrectbottom - (d_pix_max << d_y_aspect_shift); { - unsigned int i; + int i; for (i = 0; i < vid.height; i++) { d_scantable[i] = i * rowpixels; diff --git a/libs/video/renderer/sw/d_sky.c b/libs/video/renderer/sw/d_sky.c index 722fee7a3..6bc7872aa 100644 --- a/libs/video/renderer/sw/d_sky.c +++ b/libs/video/renderer/sw/d_sky.c @@ -48,8 +48,8 @@ D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t) else temp = (float) r_refdef.vrect.height; - wu = 8192.0 * (float) (u - ((int) vid.width >> 1)) / temp; - wv = 8192.0 * (float) (((int) vid.height >> 1) - v) / temp; + wu = 8192.0 * (float) (u - (vid.width >> 1)) / temp; + wv = 8192.0 * (float) ((vid.height >> 1) - v) / temp; end[0] = 4096 * vpn[0] + wu * vright[0] + wv * vup[0]; end[1] = 4096 * vpn[1] + wu * vright[1] + wv * vup[1]; diff --git a/libs/video/renderer/sw/d_vars.c b/libs/video/renderer/sw/d_vars.c index 6739654c3..96a0b0f4b 100644 --- a/libs/video/renderer/sw/d_vars.c +++ b/libs/video/renderer/sw/d_vars.c @@ -54,7 +54,7 @@ byte *cacheblock; int cachewidth; byte *d_viewbuffer; short *d_pzbuffer; -unsigned int d_zrowbytes; -unsigned int d_zwidth; +int d_zrowbytes; +int d_zwidth; #endif // !USE_INTEL_ASM diff --git a/libs/video/renderer/sw/draw.c b/libs/video/renderer/sw/draw.c index b645743b8..d0b8ea7f0 100644 --- a/libs/video/renderer/sw/draw.c +++ b/libs/video/renderer/sw/draw.c @@ -263,7 +263,7 @@ Draw_Character (int x, int y, unsigned int chr) if (y <= -8) return; // totally off screen - if (y > (int) vid.conheight - 8 || x < 0 || x > (int) vid.conwidth - 8) + if (y > vid.conheight - 8 || x < 0 || x > vid.conwidth - 8) return; if (chr < 0 || chr > 255) return; @@ -418,8 +418,8 @@ Draw_Pic (int x, int y, qpic_t *pic) byte *dest, *source, tbyte; int v, u; - if (x < 0 || (unsigned int) (x + pic->width) > vid.conwidth || y < 0 || - (unsigned int) (y + pic->height) > vid.conheight) { + if (x < 0 || (x + pic->width) > vid.conwidth + || y < 0 || (y + pic->height) > vid.conheight) { Sys_MaskPrintf (SYS_VID, "Draw_Pic: bad coordinates"); Draw_SubPic (x, y, pic, 0, 0, pic->width, pic->height); return; @@ -477,8 +477,8 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, byte *dest, *source, tbyte; int u, v; - if ((x < 0) || (x + width > (int) vid.conwidth) - || (y < 0) || (y + height > (int) vid.conheight)) { + if ((x < 0) || (x + width > vid.conwidth) + || (y < 0) || (y + height > vid.conheight)) { Sys_MaskPrintf (SYS_VID, "Draw_SubPic: bad coordinates"); } // first, clip to screen @@ -487,7 +487,7 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, width += x; x = 0; } - if (x + width > (int) vid.width) + if (x + width > vid.width) width = vid.width - x; if (width <= 0) return; @@ -496,7 +496,7 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, height += y; y = 0; } - if (y + height > (int) vid.height) + if (y + height > vid.height) height = vid.height - y; if (height <= 0) return; @@ -564,7 +564,7 @@ Draw_ConsoleBackground (int lines, byte alpha) else { f = 0; fstep = 320 * 0x10000 / vid.conwidth; - for (x = 0; x < (int) vid.conwidth; x += 4) { + for (x = 0; x < vid.conwidth; x += 4) { dest[x] = src[f >> 16]; f += fstep; dest[x + 1] = src[f >> 16]; @@ -630,7 +630,7 @@ Draw_TileClear (int x, int y, int w, int h) byte *psrc; vrect_t vr; - CLIP (x, y, w, h, (int) vid.width, (int) vid.height); + CLIP (x, y, w, h, vid.width, vid.height); r_rectdesc.rect.x = x; r_rectdesc.rect.y = y; @@ -693,12 +693,12 @@ Draw_Fill (int x, int y, int w, int h, int c) byte *dest; int u, v; - if (x < 0 || x + w > (int) vid.conwidth - || y < 0 || y + h > (int) vid.conheight) { + if (x < 0 || x + w > vid.conwidth + || y < 0 || y + h > vid.conheight) { Sys_MaskPrintf (SYS_VID, "Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c); } - CLIP (x, y, w, h, (int) vid.width, (int) vid.height); + CLIP (x, y, w, h, vid.width, vid.height); dest = ((byte*)vid.buffer) + y * vid.rowbytes + x; for (v = 0; v < h; v++, dest += vid.rowbytes) @@ -710,7 +710,7 @@ Draw_Fill (int x, int y, int w, int h, int c) void Draw_FadeScreen (void) { - unsigned int x, y; + int x, y; byte *pbuf; VID_UnlockBuffer (); diff --git a/libs/video/renderer/sw/screen.c b/libs/video/renderer/sw/screen.c index 6411f8e22..0c0cfafd8 100644 --- a/libs/video/renderer/sw/screen.c +++ b/libs/video/renderer/sw/screen.c @@ -95,10 +95,8 @@ SCR_ScreenShot (int width, int height) // enable direct drawing of console to back buffer D_EnableBackBufferAccess (); - w = (vid.width < (unsigned int) width) ? vid.width - : (unsigned int) width; - h = (vid.height < (unsigned int) height) ? vid.height - : (unsigned int) height; + w = (vid.width < width) ? vid.width : width; + h = (vid.height < height) ? vid.height : height; fracw = (float) vid.width / (float) w; frach = (float) vid.height / (float) h; diff --git a/libs/video/renderer/sw/sw_rmain.c b/libs/video/renderer/sw/sw_rmain.c index b24b90c8e..1b5e99a74 100644 --- a/libs/video/renderer/sw/sw_rmain.c +++ b/libs/video/renderer/sw/sw_rmain.c @@ -1083,8 +1083,8 @@ renderside (byte* bufs, double yaw, double pitch, double roll, int side) static void renderlookup (byte **offs, byte* bufs) { - byte *p = (byte*)vid.buffer; - unsigned int x, y; + byte *p = (byte*)vid.buffer; + int x, y; for (y = 0; y < vid.height; y++) { for (x = 0; x < vid.width; x++, offs++) p[x] = **offs; diff --git a/libs/video/renderer/sw32/d_fill.c b/libs/video/renderer/sw32/d_fill.c index 2e035b455..220806731 100644 --- a/libs/video/renderer/sw32/d_fill.c +++ b/libs/video/renderer/sw32/d_fill.c @@ -45,7 +45,7 @@ sw32_D_FillRect (vrect_t *rect, int color) { case 1: { - unsigned int rx, ry, rwidth, rheight; + int rx, ry, rwidth, rheight; byte *dest, pix; pix = color; @@ -83,7 +83,7 @@ sw32_D_FillRect (vrect_t *rect, int color) break; case 2: { - unsigned int rx, ry, rwidth, rheight; + int rx, ry, rwidth, rheight; unsigned short *dest, pix; pix = sw32_8to16table[color]; @@ -122,7 +122,7 @@ sw32_D_FillRect (vrect_t *rect, int color) break; case 4: { - unsigned int rx, ry, rwidth, rheight; + int rx, ry, rwidth, rheight; unsigned int *dest, pix; pix = d_8to24table[color]; diff --git a/libs/video/renderer/sw32/d_modech.c b/libs/video/renderer/sw32/d_modech.c index cf6008324..7ca3efec3 100644 --- a/libs/video/renderer/sw32/d_modech.c +++ b/libs/video/renderer/sw32/d_modech.c @@ -87,7 +87,7 @@ sw32_D_ViewChanged (void) r_refdef.vrectbottom - (sw32_d_pix_max << sw32_d_y_aspect_shift); { - unsigned int i; + int i; for (i = 0; i < vid.height; i++) { sw32_d_scantable[i] = i * rowpixels; diff --git a/libs/video/renderer/sw32/d_sky.c b/libs/video/renderer/sw32/d_sky.c index 1ac9f195a..20e2765b0 100644 --- a/libs/video/renderer/sw32/d_sky.c +++ b/libs/video/renderer/sw32/d_sky.c @@ -52,8 +52,8 @@ D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t) else temp = (float) r_refdef.vrect.height; - wu = 8192.0 * (float) (u - ((int) vid.width >> 1)) / temp; - wv = 8192.0 * (float) (((int) vid.height >> 1) - v) / temp; + wu = 8192.0 * (float) (u - (vid.width >> 1)) / temp; + wv = 8192.0 * (float) ((vid.height >> 1) - v) / temp; end[0] = 4096 * vpn[0] + wu * vright[0] + wv * vup[0]; end[1] = 4096 * vpn[1] + wu * vright[1] + wv * vup[1]; diff --git a/libs/video/renderer/sw32/d_vars.c b/libs/video/renderer/sw32/d_vars.c index 97af9eb94..f5e2752e1 100644 --- a/libs/video/renderer/sw32/d_vars.c +++ b/libs/video/renderer/sw32/d_vars.c @@ -51,5 +51,5 @@ byte *sw32_cacheblock; int sw32_cachewidth; byte *sw32_d_viewbuffer; short *sw32_d_pzbuffer; -unsigned int sw32_d_zrowbytes; -unsigned int sw32_d_zwidth; +int sw32_d_zrowbytes; +int sw32_d_zwidth; diff --git a/libs/video/renderer/sw32/draw.c b/libs/video/renderer/sw32/draw.c index ec91da314..74c40fc17 100644 --- a/libs/video/renderer/sw32/draw.c +++ b/libs/video/renderer/sw32/draw.c @@ -265,7 +265,7 @@ sw32_Draw_Character (int x, int y, unsigned int chr) if (y <= -8) return; // totally off screen - if (y > (int) vid.conheight - 8 || x < 0 || x > (int) vid.conwidth - 8) + if (y > vid.conheight - 8 || x < 0 || x > vid.conwidth - 8) return; if (chr < 0 || chr > 255) return; @@ -494,8 +494,8 @@ sw32_Draw_Pic (int x, int y, qpic_t *pic) byte *source, tbyte; int v, u; - if (x < 0 || (unsigned int) (x + pic->width) > vid.conwidth || y < 0 || - (unsigned int) (y + pic->height) > vid.conheight) { + if (x < 0 || (x + pic->width) > vid.conwidth + || y < 0 || (y + pic->height) > vid.conheight) { Sys_MaskPrintf (SYS_VID, "Draw_Pic: bad coordinates"); sw32_Draw_SubPic (x, y, pic, 0, 0, pic->width, pic->height); return; @@ -593,8 +593,8 @@ sw32_Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, byte *source, tbyte; int v, u; - if ((x < 0) || (x + width > (int) vid.conwidth) - || (y < 0) || (y + height > (int) vid.conheight)) { + if ((x < 0) || (x + width > vid.conwidth) + || (y < 0) || (y + height > vid.conheight)) { Sys_MaskPrintf (SYS_VID, "Draw_SubPic: bad coordinates"); } // first, clip to screen @@ -603,7 +603,7 @@ sw32_Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, width += x; x = 0; } - if (x + width > (int) vid.width) + if (x + width > vid.width) width = vid.width - x; if (width <= 0) return; @@ -612,7 +612,7 @@ sw32_Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, height += y; y = 0; } - if (y + height > (int) vid.height) + if (y + height > vid.height) height = vid.height - y; if (height <= 0) return; @@ -687,7 +687,7 @@ sw32_Draw_ConsoleBackground (int lines, byte alpha) else { f = 0; fstep = 320 * 0x10000 / vid.conwidth; - for (x = 0; x < (int) vid.conwidth; x += 4) { + for (x = 0; x < vid.conwidth; x += 4) { dest[x] = src[f >> 16]; f += fstep; dest[x + 1] = src[f >> 16]; @@ -712,7 +712,7 @@ sw32_Draw_ConsoleBackground (int lines, byte alpha) src = conback->data + v * 320; f = 0; fstep = 320 * 0x10000 / vid.conwidth; - for (x = 0; x < (int) vid.conwidth; x += 4) { + for (x = 0; x < vid.conwidth; x += 4) { dest[x] = sw32_8to16table[src[f >> 16]]; f += fstep; dest[x + 1] = sw32_8to16table[src[f >> 16]]; @@ -733,7 +733,7 @@ sw32_Draw_ConsoleBackground (int lines, byte alpha) src = conback->data + v * 320; f = 0; fstep = 320 * 0x10000 / vid.conwidth; - for (x = 0; x < (int) vid.conwidth; x += 4) { + for (x = 0; x < vid.conwidth; x += 4) { dest[x ] = d_8to24table[src[f >> 16]];f += fstep; dest[x + 1] = d_8to24table[src[f >> 16]];f += fstep; dest[x + 2] = d_8to24table[src[f >> 16]];f += fstep; @@ -1046,7 +1046,7 @@ sw32_Draw_TileClear (int x, int y, int w, int h) byte *psrc; vrect_t vr; - CLIP (x, y, w, h, (int) vid.width, (int) vid.height); + CLIP (x, y, w, h, vid.width, vid.height); r_rectdesc.rect.x = x; r_rectdesc.rect.y = y; @@ -1108,12 +1108,12 @@ sw32_Draw_Fill (int x, int y, int w, int h, int c) { int u, v; - if (x < 0 || x + w > (int) vid.conwidth - || y < 0 || y + h > (int) vid.conheight) { + if (x < 0 || x + w > vid.conwidth + || y < 0 || y + h > vid.conheight) { Sys_MaskPrintf (SYS_VID, "Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c); } - CLIP (x, y, w, h, (int) vid.width, (int) vid.height); + CLIP (x, y, w, h, vid.width, vid.height); switch (sw32_r_pixbytes) { case 1: @@ -1153,7 +1153,7 @@ sw32_Draw_Fill (int x, int y, int w, int h, int c) void sw32_Draw_FadeScreen (void) { - unsigned int x, y; + int x, y; VID_UnlockBuffer (); S_ExtraUpdate (); @@ -1237,7 +1237,7 @@ sw32_Draw_BlendScreen (quat_t color) break; case 2: { - unsigned int g1, g2, x, y; + int g1, g2, x, y; unsigned short rramp[32], gramp[64], bramp[32], *temp; for (i = 0; i < 32; i++) { r = i << 3; @@ -1264,7 +1264,8 @@ sw32_Draw_BlendScreen (quat_t color) break; case 4: { - unsigned int x, y; + int x, y; + byte ramp[256][4], *temp; for (i = 0; i < 256; i++) { r = i; @@ -1281,7 +1282,7 @@ sw32_Draw_BlendScreen (quat_t color) ramp[i][3] = 0; } temp = vid.buffer; - for (y = 0;y < vid.height;y++, temp += vid.rowbytes) + for (y = 0; y < vid.height; y++, temp += vid.rowbytes) { for (x = 0;x < vid.width;x++) { diff --git a/libs/video/renderer/sw32/sw32_rmisc.c b/libs/video/renderer/sw32/sw32_rmisc.c index 13bff55b5..b7af00c85 100644 --- a/libs/video/renderer/sw32/sw32_rmisc.c +++ b/libs/video/renderer/sw32/sw32_rmisc.c @@ -248,8 +248,8 @@ sw32_R_SetupFrame (void) if ((sw32_r_dowarp != sw32_r_dowarpold) || sw32_r_viewchanged) { if (sw32_r_dowarp) { - if ((vid.width <= (unsigned int) vid.maxwarpwidth) && - (vid.height <= (unsigned int) vid.maxwarpheight)) { + if ((vid.width <= vid.maxwarpwidth) + && (vid.height <= vid.maxwarpheight)) { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 292bc8a92..166595f51 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -339,8 +339,7 @@ check_mouse_event (Display *disp, XEvent *ev, XPointer arg) XMotionEvent *me = &ev->xmotion; if (ev->type != MotionNotify) return False; - if ((unsigned) me->x != viddef.width / 2 - || (unsigned) me->y != viddef.height / 2) + if (me->x != viddef.width / 2 || me->y != viddef.height / 2) return False; return True; } diff --git a/libs/video/targets/in_x11.c b/libs/video/targets/in_x11.c index 6b0c4d00f..a3c461fed 100644 --- a/libs/video/targets/in_x11.c +++ b/libs/video/targets/in_x11.c @@ -700,8 +700,8 @@ event_motion (XEvent *event) } else { if (vid_fullscreen->int_val || input_grabbed) { if (!event->xmotion.send_event) { - unsigned dist_x = abs (viddef.width / 2 - event->xmotion.x); - unsigned dist_y = abs (viddef.height / 2 - event->xmotion.y); + int dist_x = abs (viddef.width / 2 - event->xmotion.x); + int dist_y = abs (viddef.height / 2 - event->xmotion.y); in_mouse_x += (event->xmotion.x - p_mouse_x); in_mouse_y += (event->xmotion.y - p_mouse_y); if (dist_x > viddef.width / 4 || dist_y > viddef.height / 4) {