added transparency effects for some bitmaps like explosions, powerups, weapons, etc. - to enable with -gl_transparency

This commit is contained in:
zicodxx 2007-01-29 23:31:20 +00:00
parent 6fb8e560e6
commit f9788e5b5f
7 changed files with 36 additions and 10 deletions

View file

@ -67,6 +67,7 @@ int gl_initialized=0;
int gl_reticle = 0;
int ogl_fullscreen;
int ogl_scissor_ok=1;
int glalpha_effects=0;
void gr_palette_clear(); // Function prototype for gr_init;
@ -523,6 +524,8 @@ int gr_init()
if ((t=FindArg("-gl_reticle"))){
gl_reticle=atoi(Args[t+1]);
}
if (FindArg("-gl_transparency"))
glalpha_effects=1;
//printf("ogl_mem_target=%i\n",ogl_mem_target);
ogl_init();//platform specific initialization

View file

@ -114,6 +114,7 @@ int cross_lh[2]={0,0};
int primary_lh[3]={0,0,0};
int secondary_lh[5]={0,0,0,0,0};
int bNoDepthTest=0;
extern int glalpha_effects;
/*int lastbound=-1;
#define OGL_BINDTEXTURE(a) if(gr_badtexture>0) glBindTexture(GL_TEXTURE_2D, 0);\
@ -1108,7 +1109,7 @@ bool g3_draw_tmap_2(int nv, g3s_point **pointlist, g3s_uvl *uvl_list, grs_bitmap
return 0;
}
bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, int orientation)
bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, int orientation, object *obj)
{
vms_vector pv,v1;//,v2;
int i;
@ -1122,7 +1123,11 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, int ori
glDisable(GL_DEPTH_TEST); // ZICO - disable to prevent sprites get cutted by polygons
glBegin(GL_QUADS);
glColor3f(1.0,1.0,1.0);
// Define alpha by looking for object TYPE or ID. We do this here so we have it seperated from the rest of the code.
if (glalpha_effects && (obj->type==OBJ_FIREBALL || obj->type==OBJ_WEAPON || obj->id==POW_EXTRA_LIFE || obj->id==POW_ENERGY || obj->id==POW_SHIELD_BOOST || obj->id==POW_HOARD_ORB || obj->id==POW_CLOAK || obj->id==POW_INVULNERABILITY))
glColor4f(1.0,1.0,1.0,0.6);
else
glColor3f(1.0,1.0,1.0);
width = fixmul(width,Matrix_scale.x);
height = fixmul(height,Matrix_scale.y);
for (i=0;i<4;i++){

View file

@ -39,6 +39,7 @@
;-gl_simple Set gl texture filters to gl_nearest for "original" look. (default)
;-gl_mipmap Set gl texture filters to "standard" options for mipmapping
;-gl_trilinear Set gl texture filters to trilinear mipmapping
;-gl_transparency Enable transparency effects
;-gl_reticle <r> Use OGL reticle 0=never 1=above 320x* 2=always
;-fixedfont Do not scale fonts to current resolution
;-gl_scissor_ok <r> Set glScissor. 0=off 1=on (default)

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20070130
--------
d2x.ini, arch/ogl/gr.c, arch/ogl/ogl.c, include/3d.h, main/inferno.c, main/object.c: added transparency effects for some bitmaps like explosions, powerups, weapons, etc. - to enable with -gl_transparency
20070129
--------
main/gamecntl.c: fixed energy->shield transfer message output showing 'No transfer: Shields already at max' everytime if there is enough energy

View file

@ -25,6 +25,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "fix.h"
#include "vecmat.h" //the vector/matrix library
#include "gr.h"
#include "object.h"
extern int g3d_interp_outline; //if on, polygon models outlined in white
@ -215,7 +216,11 @@ bool g3_draw_rod_tmap(grs_bitmap *bitmap,g3s_point *bot_point,fix bot_width,g3s_
//draws a bitmap with the specified 3d width & height
//returns 1 if off screen, 0 if drew
bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, int orientation);
bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, int orientation
#ifdef OGL
,object *obj
#endif
);
//specifies 2d drawing routines to use instead of defaults. Passing
//NULL for either or both restores defaults

View file

@ -226,6 +226,7 @@ void print_commandline_help()
printf( " -gl_simple %s\n", "Set gl texture filters to gl_nearest for \"original\" look. (default)");
printf( " -gl_mipmap %s\n", "Set gl texture filters to \"standard\" options for mipmapping");
printf( " -gl_trilinear %s\n", "Set gl texture filters to trilinear mipmapping");
printf( " -gl_transparency %s\n", "Enable transparency effects");
printf( " -gl_reticle <r> %s\n", "Use OGL reticle 0=never 1=above 320x* 2=always");
printf( " -gl_scissor_ok <r> %s\n", "Set glScissor. 0=off 1=on (default)");
printf( " -fixedfont %s\n", "Do not scale fonts to current resolution");

View file

@ -246,13 +246,20 @@ void draw_object_blob(object *obj,bitmap_index bmi)
PIGGY_PAGE_IN( bmi );
if (bm->bm_w > bm->bm_h)
g3_draw_bitmap(&obj->pos,obj->size,fixmuldiv(obj->size,bm->bm_h,bm->bm_w),bm, orientation);
else
g3_draw_bitmap(&obj->pos,fixmuldiv(obj->size,bm->bm_w,bm->bm_h),obj->size,bm, orientation);
if (bm->bm_w > bm->bm_h) {
g3_draw_bitmap(&obj->pos,obj->size,fixmuldiv(obj->size,bm->bm_h,bm->bm_w),bm, orientation
#ifdef OGL
,obj
#endif
);
}
else {
g3_draw_bitmap(&obj->pos,fixmuldiv(obj->size,bm->bm_w,bm->bm_h),obj->size,bm, orientation
#ifdef OGL
,obj
#endif
);
}
}
//draw an object that is a texture-mapped rod