diff --git a/includes/graphics.h b/includes/graphics.h index 856722600..35fb4dc3b 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -29,6 +29,8 @@ #elif defined(PIX32OGL) #define PIXPACK(x) (0xFF000000|((x)&0xFFFFFF)) #define PIXRGB(r,g,b) (0xFF000000|((r)<<16)|((g)<<8)|((b)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXRGBA(r,g,b,a) (((a)<<24)|((r)<<16)|((g)<<8)|((b)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXA(x) (((x)>>24)&0xFF) #define PIXR(x) (((x)>>16)&0xFF) #define PIXG(x) (((x)>>8)&0xFF) #define PIXB(x) ((x)&0xFF) diff --git a/src/graphics.c b/src/graphics.c index 0b77fa5c0..182df0b6f 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -26,7 +26,7 @@ unsigned cmode = CM_FIRE; SDL_Surface *sdl_scrn; int sdl_scale = 1; -GLuint vidBuf, fireAlpha, glowAlpha, fireProg; +GLuint vidBuf, airBuf, fireAlpha, glowAlpha, fireProg; int sandcolour_r = 0; int sandcolour_g = 0; @@ -303,13 +303,13 @@ void ogl_blit(int x, int y, int w, int h, pixel *src, int pitch, int scale) glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, GL_BGRA, GL_UNSIGNED_BYTE, src); glBegin(GL_QUADS); glTexCoord2d(1, 0); - glVertex3f(XRES+BARSIZE, YRES+MENUSIZE, 1.0); + glVertex3f((XRES+BARSIZE)*sdl_scale, (YRES+MENUSIZE)*sdl_scale, 1.0); glTexCoord2d(0, 0); - glVertex3f(0, YRES+MENUSIZE, 1.0); + glVertex3f(0, (YRES+MENUSIZE)*sdl_scale, 1.0); glTexCoord2d(0, 1); glVertex3f(0, 0, 1.0); glTexCoord2d(1, 1); - glVertex3f(XRES+BARSIZE, 0, 1.0); + glVertex3f((XRES+BARSIZE)*sdl_scale, 0, 1.0); glEnd(); glDisable( GL_TEXTURE_2D ); @@ -718,8 +718,9 @@ inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) r = (a*r + (255-a)*PIXR(t)) >> 8; g = (a*g + (255-a)*PIXG(t)) >> 8; b = (a*b + (255-a)*PIXB(t)) >> 8; + a = a > PIXA(t) ? a : PIXA(t); } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); + vid[y*(XRES+BARSIZE)+x] = PIXRGBA(r,g,b,a); } #if defined(WIN32) && !defined(__GNUC__) @@ -902,9 +903,13 @@ void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a void clearrect(pixel *vid, int x, int y, int w, int h) { +#ifdef OGLR + fillrect(vid, x, y, w, h, 0, 0, 0, 255); +#else int i; for (i=1; i> 8; g = (a*g + (255-a)*PIXG(t)) >> 8; b = (a*b + (255-a)*PIXB(t)) >> 8; + a = a > PIXA(t) ? a : PIXA(t); } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); + vid[y*(XRES+BARSIZE)+x] = PIXRGBA(r,g,b,a); } void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) @@ -1098,15 +1104,13 @@ void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); } } - +pixel air_buf[YRES/CELL][XRES/CELL]; void draw_air(pixel *vid) { int x, y, i, j; pixel c; - if (cmode == CM_PERS)//this should never happen anyway return; - for (y=0; y1180) @@ -1922,8 +1936,11 @@ int main(int argc, char *argv[]) } fire_fc = (fire_fc+1) % 3; } + +#ifndef OGLR if (cmode==CM_FIRE||cmode==CM_BLOB||cmode==CM_FANCY) render_fire(part_vbuf); +#endif render_signs(part_vbuf);