screen_savers/Nebula: Rename variable in DrawStars.c.
Lots of cleanup here still needed, but it's OK for now.
This commit is contained in:
@@ -1,68 +1,63 @@
|
|||||||
// Hand-translated from x86 assembly.
|
// Hand-translated from x86 assembly.
|
||||||
|
|
||||||
/* this function needs a definition from outside (the width of the bitmap) */
|
|
||||||
|
|
||||||
// #define STAR_WIDTH 320
|
|
||||||
// #define STAR_FUNCTION draw_stars320
|
|
||||||
|
|
||||||
/* draw a star (5 pixels) */
|
/* draw a star (5 pixels) */
|
||||||
void draw_stars(int STAR_WIDTH, char* dstParam, char incParam)
|
void draw_stars(int star_width, char* dstParam, char incParam)
|
||||||
{
|
{
|
||||||
unsigned char* dst;
|
unsigned char* dst;
|
||||||
unsigned char inc;
|
unsigned char inc;
|
||||||
dst = (unsigned char*)dstParam;
|
dst = (unsigned char*)dstParam;
|
||||||
inc = (unsigned char)incParam;
|
inc = (unsigned char)incParam;
|
||||||
|
|
||||||
dst[STAR_WIDTH] += inc;
|
dst[star_width] += inc;
|
||||||
if (dst[STAR_WIDTH] < inc) {
|
if (dst[star_width] < inc) {
|
||||||
// Overflowed.
|
// Overflowed.
|
||||||
dst[STAR_WIDTH] = 255;
|
dst[star_width] = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
inc >>= 1;
|
inc >>= 1;
|
||||||
unsigned char al;
|
unsigned char al;
|
||||||
al = *dst;
|
al = *dst;
|
||||||
unsigned char cl;
|
unsigned char cl;
|
||||||
cl = dst[STAR_WIDTH - 1];
|
cl = dst[star_width - 1];
|
||||||
al += inc;
|
al += inc;
|
||||||
if (al >= inc) {
|
if (al >= inc) {
|
||||||
cl += inc;
|
cl += inc;
|
||||||
if (cl < inc) {
|
if (cl < inc) {
|
||||||
*dst = 255;
|
*dst = 255;
|
||||||
dst[STAR_WIDTH - 1] = 255;
|
dst[star_width - 1] = 255;
|
||||||
} else {
|
} else {
|
||||||
*dst = al;
|
*dst = al;
|
||||||
dst[STAR_WIDTH - 1] = cl;
|
dst[star_width - 1] = cl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cl += inc;
|
cl += inc;
|
||||||
if (cl < inc) {
|
if (cl < inc) {
|
||||||
*dst = 255;
|
*dst = 255;
|
||||||
dst[STAR_WIDTH - 1] = 255;
|
dst[star_width - 1] = 255;
|
||||||
} else {
|
} else {
|
||||||
*dst = 255;
|
*dst = 255;
|
||||||
dst[STAR_WIDTH - 1] = cl;
|
dst[star_width - 1] = cl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
al = dst[STAR_WIDTH * 2];
|
al = dst[star_width * 2];
|
||||||
cl = dst[STAR_WIDTH + 1];
|
cl = dst[star_width + 1];
|
||||||
al += inc;
|
al += inc;
|
||||||
if (al < inc) {
|
if (al < inc) {
|
||||||
cl += inc;
|
cl += inc;
|
||||||
if (cl >= inc) {
|
if (cl >= inc) {
|
||||||
dst[STAR_WIDTH * 2] = 255;
|
dst[star_width * 2] = 255;
|
||||||
dst[STAR_WIDTH + 1] = cl;
|
dst[star_width + 1] = cl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cl += inc;
|
cl += inc;
|
||||||
if (cl >= inc) {
|
if (cl >= inc) {
|
||||||
dst[STAR_WIDTH * 2] = al;
|
dst[star_width * 2] = al;
|
||||||
dst[STAR_WIDTH + 1] = cl;
|
dst[star_width + 1] = cl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dst[STAR_WIDTH * 2] = 255;
|
dst[star_width * 2] = 255;
|
||||||
dst[STAR_WIDTH + 1] = 255;
|
dst[star_width + 1] = 255;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user