From 1b2e7b3c70bf72b069786c1ccd2a782028ae84ce Mon Sep 17 00:00:00 2001 From: jacob1 Date: Fri, 4 Jan 2013 13:54:25 -0500 Subject: fix Ctrl+x being one pixel off, better xor_rect from tpt, delete test.c diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index f8d8cd3..dfd4b40 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -1847,10 +1847,10 @@ void GameView::OnDraw() y2 = YRES-1; ren->fillrect(0, 0, XRES, y1, 0, 0, 0, 100); - ren->fillrect(0, y2, XRES, YRES-y2, 0, 0, 0, 100); + ren->fillrect(0, y2+1, XRES, YRES-y2-1, 0, 0, 0, 100); - ren->fillrect(0, y1, x1, (y2-y1), 0, 0, 0, 100); - ren->fillrect(x2, y1, XRES-x2, (y2-y1), 0, 0, 0, 100); + ren->fillrect(0, y1, x1, (y2-y1)+1, 0, 0, 0, 100); + ren->fillrect(x2+1, y1, XRES-x2-1, (y2-y1)+1, 0, 0, 0, 100); ren->xor_rect(x1, y1, (x2-x1)+1, (y2-y1)+1); } diff --git a/src/graphics/RasterDrawMethods.inl b/src/graphics/RasterDrawMethods.inl index 55a64c9..dec15f1 100644 --- a/src/graphics/RasterDrawMethods.inl +++ b/src/graphics/RasterDrawMethods.inl @@ -236,12 +236,29 @@ void PIXELMETHODS_CLASS::xor_rect(int x, int y, int w, int h) for (i=0; i10 && 34<85)) - return -1; - - trap_Print("Basic comparisons work\n"); - - b1 = 9 & 3; - b2 = 7 | 8; - b3 = 10 ^ 3; - - if (!(b1 == 1 && b2 == 15 && b3 == 9)) - return -1; - - trap_Print("Boolean functions work\n"); - - l = 2; - l = l<<2; - - r = 9; - r = r>>2; - - if (!(l == 8 && r == 2)) - return -1; - - trap_Print("Bit shifts work\n"); - - a = 6; - b = 2*2; - - m = a*b; - d = a/b; - s = a+b; - as = a-b; - - if (!(m == 24 && d == 1 && s == 10 && as == 2)) - return -1; - - trap_Print("Arithmetics works\n"); - - f = 5.1f; - dd = 3.1415f; - - if (!((f*dd)>15.0f && (f*dd)<17.0f && (f-dd)<2.0f && (f-dd)>1.0f)) - return -1; - - trap_Print("Floating point arithmetics works\n"); - - i = f*dd; - - if (!(i==16)) - return -1; - - trap_Print("Float to Int works\n"); - - f = i+1; - - if (!(f>16.0f && f<18.0f)) - return -1; - - trap_Print("Int to Float works\n"); - - j = 0; o = 0; - for(k=0; k<5; k++) - j++; - - for(k=5; k>0; k--) - o++; - - if (!(o == 5 && j == 5)) - return -1; - - trap_Print("Cycles work\n"); - - g = 11; - g++; - - if (!(g == 12)) - return -1; - - trap_Print("Global variables work\n"); - - ua = 6; - ub = 2*2; - - um = ua*ub; - ud = ua/ub; - us = ua+ub; - uas = ua-ub; - - if (!(um == 24 && ud == 1 && us == 10 && uas == 2)) - return -1; - - trap_Print("Unsigned ints work\n"); - - point = &arr[0]; - point += 2; - if (!(*point == 1.41f)) - return -1; - - trap_Print("Pointer arithmetics works\n"); - - re = trapp(12, 4); - - if (!(re == 8)) - return -1; - - trap_Print("Function calls work\n"); - - res = compl(arr, 4); - - if (!(res<0.01f && res>(-0.01f))) - return -1; - - trap_Print("Complex function call works\n"); - - for(i=0; i<1000000; i++) - spam(); - - trap_Print("Stack spam check passed\n"); - - trap_Print("All checks are passed!\n"); - - return 10; -} - -int trapp(int a, int b) -{ - int c; - c = (a+b)/2; - return c; -} - -float compl(float* a, unsigned int n) -{ - int s, i; - for(i=0; i