dxx-rebirth/common/2d/disc.cpp
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
Rename symbol OGL to DXX_USE_OGL to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
2016-09-24 18:06:11 +00:00

64 lines
1.1 KiB
C++

/*
* This file is part of the DXX-Rebirth project <http://www.dxx-rebirth.com/>.
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
/*
*
* Graphical routines for drawing a disk.
*
*/
#include "u_mem.h"
#include "gr.h"
#include "grdef.h"
namespace dcx {
#if !DXX_USE_OGL
int gr_disk(fix xc1,fix yc1,fix r1, const uint8_t color)
{
int p,x, y, xc, yc, r;
r = f2i(r1);
xc = f2i(xc1);
yc = f2i(yc1);
p=3-(r*2);
x=0;
y=r;
// Big clip
if ( (xc+r) < 0 ) return 1;
if ( (xc-r) > GWIDTH ) return 1;
if ( (yc+r) < 0 ) return 1;
if ( (yc-r) > GHEIGHT ) return 1;
while(x<y)
{
// Draw the first octant
gr_scanline(xc-y, xc+y, yc-x, color);
gr_scanline(xc-y, xc+y, yc+x, color);
if (p<0)
p=p+(x<<2)+6;
else {
// Draw the second octant
gr_scanline(xc-x, xc+x, yc-y, color);
gr_scanline(xc-x, xc+x, yc+y, color);
p=p+((x-y)<<2)+10;
y--;
}
x++;
}
if(x==y) {
gr_scanline(xc-x, xc+x, yc-y, color);
gr_scanline(xc-x, xc+x, yc+y, color);
}
return 0;
}
#endif
}