fix Ctrl+x being one pixel off, better xor_rect from tpt, delete test.c

This commit is contained in:
jacob1 2013-01-04 13:54:25 -05:00
parent 8e50abcab9
commit 1b2e7b3c70
4 changed files with 24 additions and 178 deletions

View File

@ -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);
}

View File

@ -236,12 +236,29 @@ void PIXELMETHODS_CLASS::xor_rect(int x, int y, int w, int h)
for (i=0; i<w; i+=2)
{
xor_pixel(x+i, y);
xor_pixel(x+i, y+h-1);
}
if (h != 1)
{
if (h%2 == 1) i = 2;
else i = 1;
for (; i<w; i+=2)
{
xor_pixel(x+i, y+h-1);
}
}
for (i=2; i<h; i+=2)
{
xor_pixel(x, y+i);
xor_pixel(x+w-1, y+i);
}
if (w != 1)
{
if (w%2 == 1) i = 2;
else i = 1;
for (; i<h-1; i+=2)
{
xor_pixel(x+w-1, y+i);
}
}
}

View File

@ -343,9 +343,9 @@ void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h)
{
int cx = 0;
int cy = 0;
for (cy=0; cy<area_h; cy++)
for (cy=0; cy<=area_h; cy++)
{
for (cx=0; cx<area_w; cx++)
for (cx=0; cx<=area_w; cx++)
{
if(bmap[(cy+area_y)/CELL][(cx+area_x)/CELL] == WL_GRAV)
gravWallChanged = true;

View File

@ -1,171 +0,0 @@
int g;
int trapp(int a, int b);
float compl(float* a, unsigned int n);
void spam();
int main()
{
int l, r;
int a, b, m, d, s, as;
int b1, b2, b3;
float f, dd;
int i;
int k, j, o;
unsigned int ua, ub, um, ud, us, uas;
int re;
float arr[] = { 1.6f, -3.0f, 1.41f, -0.01f };
float* point;
float res;
trap_Print("System calls work\n");
if (!1)
return -1;
trap_Print("Negation works\n");
if (!(9 == 9 && 6!=4 && 100>10 && 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<n; i++)
s+=a[i];
return s;
}
void spam()
{
return;
}