freebsd-ports/games/asteroids3d/files/patch-src-texture.c
Guido Falsi 91907a3009 A simple first person shooter of blowing up asteroids in 3D space.
The codebase also serves as an introduction to trigonometry and OpenGL.

WWW: http://sourceforge.net/projects/a3d/
     http://staff.psc.edu/smp/a3d/

PR:		ports/168177
Submitted by:	nemysis@gmx.ch
Approved by:	tabthorpe (mentor)
2012-07-18 11:27:01 +00:00

28 lines
636 B
C

--- src/texture.c.orig 2008-04-06 16:37:29.000000000 +0200
+++ src/texture.c 2012-05-20 11:27:24.000000000 +0200
@@ -99,19 +99,19 @@
static void average_RGBA_alpha_and_floor(unsigned char *image,
int x, int y, int flr)
{
- int ir, ig, ib, ia, i, new_alpha;
+ int ir, ig, ib, ia, i;
for (i = 0; i < x * y * 4; i += 4) {
ir = image[i];
ig = image[i+1];
ib = image[i+2];
- ia = image[i+3];
+ /* ia = image[i+3]; */
- new_alpha = (ir + ig + ib) / 3;
- if (new_alpha < flr)
- new_alpha = 0;
+ ia = (ir + ig + ib) / 3;
+ if (ia < flr)
+ ia = 0;
- image[i+3] = new_alpha;
+ image[i+3] = ia;
}
return;