From 86fcdc5d81cac8020ef6a85a4b07d6cc67b46524 Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Mon, 30 Nov 2009 19:11:46 +0000 Subject: [PATCH] Draw Endlevel sequence with correct DepthFunc --- CHANGELOG.txt | 1 + arch/ogl/ogl.c | 41 +++++++++++++++++------------------------ main/endlevel.c | 3 +++ 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 27da8b6b9..b93804c7a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D1X-Rebirth Changelog -------- d1x-rebirth/arch/carbon/conf.h, d1x-rebirth.xcodeproj/project.pbxproj: Update to not compile redundant net_ipx.c for Mac OS X main/newdemo.c, main/newdemo.h, main/gamerend.c, main/game.c, main/gauges.c, main/gamecntl.c: Reintroduced Newdemo_game_mode to prevent demo playback from entering code parts it should not and fixing a bug with Multiplayer demos along the way, introduced in rev. 953 +arch/ogl.c, main/endlevel.c: Draw Endlevel sequence with correct DepthFunc 20091129 -------- diff --git a/arch/ogl/ogl.c b/arch/ogl/ogl.c index 53e5eabd8..105ae8b3d 100644 --- a/arch/ogl/ogl.c +++ b/arch/ogl/ogl.c @@ -1,9 +1,7 @@ -/* $Id: ogl.c,v 1.1.1.1 2006/03/17 19:53:36 zicodxx Exp $ */ /* * * Graphics support functions for OpenGL. * - * */ //#include @@ -46,7 +44,6 @@ #include "polyobj.h" #include "gamefont.h" #include "byteswap.h" -#include "endlevel.h" #include "internal.h" #include "gauges.h" #include "playsave.h" @@ -63,18 +60,15 @@ #endif #if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__)) || defined(__sun__) || defined(macintosh) -#ifndef _MSC_VER #define cosf(a) cos(a) #define sinf(a) sin(a) #endif -#endif unsigned char *ogl_pal=gr_palette; int GL_needmipmaps=0; float OglTexMagFilt=GL_NEAREST; float OglTexMinFilt=GL_NEAREST; -int active_texture_unit=0; int last_width=-1,last_height=-1; int GL_TEXTURE_2D_enabled=-1; @@ -113,6 +107,7 @@ void ogl_init_texture_stats(ogl_texture* t){ t->lastrend=0; t->numrend=0; } + void ogl_init_texture(ogl_texture* t, int w, int h, int flags) { t->handle = 0; @@ -305,6 +300,7 @@ void ogl_cache_polymodel_textures(int model_num) ogl_loadbmtexture(&GameBitmaps[ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index]); } } + void ogl_cache_vclip_textures(vclip *vc){ int i; for (i=0;inum_frames;i++){ @@ -518,7 +514,6 @@ void ogl_draw_reticle(int cross,int primary,int secondary) glScalef(f2glf(size/scale),f2glf(size),f2glf(size)); } - glLineWidth(linedotscale*2); OGL_DISABLE(TEXTURE_2D); glDisable(GL_CULL_FACE); @@ -814,14 +809,11 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, object int i; r_bitmapc++; v1.z=0; - + OGL_ENABLE(TEXTURE_2D); ogl_bindbmtex(bm); ogl_texwrap(bm->gltexture,GL_CLAMP_TO_EDGE); - - if (Endlevel_sequence) - glDepthFunc(GL_ALWAYS); - + glBegin(GL_QUADS); // Define alpha by looking for object TYPE or ID. We do this here so we have it seperated from the rest of the code. @@ -836,7 +828,7 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, object glColor4f(1.0,1.0,1.0,0.6); // ... with 0.6 alpha 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++){ @@ -864,14 +856,14 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, object pv.y+=-height; break; } - + if (obj->id == 5 && obj->type == 1) // create small z-Offset for missile exploding effect - prevents ugly wall-clipping pv.z -= F1_0; - + glVertex3f(f2glf(pv.x),f2glf(pv.y),-f2glf(pv.z)); } glEnd(); - + return 0; } @@ -924,6 +916,7 @@ bool ogl_ubitmapm_c(int x, int y,grs_bitmap *bm,int c) return 0; } + bool ogl_ubitmapm(int x, int y,grs_bitmap *bm){ return ogl_ubitmapm_c(x,y,bm,-1); } @@ -1390,17 +1383,17 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags) if (bm->gltexture == NULL) ogl_init_texture(bm->gltexture = ogl_get_free_texture(), pdata.width, pdata.height, flags | ((pdata.alpha || bm->bm_flags & BM_FLAG_TRANSPARENT) ? OGL_FLAG_ALPHA : 0)); ogl_loadtexture(pdata.data, 0, 0, bm->gltexture, bm->bm_flags, pdata.paletted ? 0 : pdata.channels); - d_free(pdata.data); + free(pdata.data); if (pdata.palette) - d_free(pdata.palette); + free(pdata.palette); return; } else { con_printf(CON_DEBUG,"%s: unsupported texture format: must be rgb, rgba, or paletted, and depth 8\n", filename); - d_free(pdata.data); + free(pdata.data); if (pdata.palette) - d_free(pdata.palette); + free(pdata.palette); } } } @@ -1422,14 +1415,14 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags) unsigned char * dbits; unsigned char * sbits; int i, data_offset; - + data_offset = 1; if (bm->bm_flags & BM_FLAG_RLE_BIG) data_offset = 2; - + sbits = &bm->bm_data[4 + (bm->bm_h * data_offset)]; dbits = decodebuf; - + for (i=0; i < bm->bm_h; i++ ) { gr_rle_decode(sbits,dbits); if ( bm->bm_flags & BM_FLAG_RLE_BIG ) @@ -1440,7 +1433,7 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags) } buf=decodebuf; } - + ogl_loadtexture(buf, 0, 0, bm->gltexture, bm->bm_flags, 0); } diff --git a/main/endlevel.c b/main/endlevel.c index f56507321..89a2f7f2f 100644 --- a/main/endlevel.c +++ b/main/endlevel.c @@ -461,6 +461,9 @@ void do_endlevel_frame() tobj = object_create_explosion(exit_segnum,&mine_side_exit_point,i2f(50),VCLIP_BIG_PLAYER_EXPLOSION); + // Move explosion a bit to draw it in front of mine exit model + vm_vec_scale_add(&tobj->pos,&tobj->pos,&tobj->orient.rvec,i2f(20)); + if (tobj) { external_explosion = *tobj;