From: <web...@pr...> - 2017-03-04 18:44:25
|
Author: entryway Date: Sat Mar 4 18:44:16 2017 New Revision: 4518 Log: Another try to fix sprites dissapearing on ludicrm.wad map03 in software mode. r4516 failed at non 4x3 aspects Also I noticed that old code don't draw many tall red firesticks on start position on sunder.wad map10 (240 sprites instead of 400+) Modified: branches/prboom-plus-24/prboom2/src/r_main.c branches/prboom-plus-24/prboom2/src/r_main.h branches/prboom-plus-24/prboom2/src/r_things.c Modified: branches/prboom-plus-24/prboom2/src/r_main.c ============================================================================== --- branches/prboom-plus-24/prboom2/src/r_main.c Sat Mar 4 16:33:12 2017 (r4517) +++ branches/prboom-plus-24/prboom2/src/r_main.c Sat Mar 4 18:44:16 2017 (r4518) @@ -92,6 +92,7 @@ fixed_t focallength; fixed_t focallengthy; +fixed_t globaluclip, globaldclip; fixed_t centerxfrac, centeryfrac; fixed_t yaspectmul; fixed_t viewheightfrac; //e6y: for correct cliping of things @@ -102,6 +103,7 @@ fixed_t viewx, viewy, viewz; angle_t viewangle; fixed_t viewcos, viewsin; +fixed_t viewtancos, viewtansin; player_t *viewplayer; // e6y: Added for more precise flats drawing fixed_t viewfocratio; @@ -904,6 +906,7 @@ { if (V_GetMode() != VID_MODEGL) { + fixed_t InvZtoScale; fixed_t dy; int i; @@ -914,6 +917,10 @@ centery += dy >> FRACBITS; } centeryfrac = centery<<FRACBITS; + + InvZtoScale = yaspectmul * centerx; + globaluclip = FixedDiv (-centeryfrac, InvZtoScale); + globaldclip = FixedDiv ((viewheight<<FRACBITS)-centeryfrac, InvZtoScale); for (i=0; i<viewheight; i++) { @@ -957,6 +964,8 @@ static void R_SetupFrame (player_t *player) { int i, cm; + + int FocalTangent = finetangent[FINEANGLES/4 + FieldOfView/2]; viewplayer = player; @@ -965,6 +974,9 @@ viewsin = finesine[viewangle>>ANGLETOFINESHIFT]; viewcos = finecosine[viewangle>>ANGLETOFINESHIFT]; + viewtansin = FixedMul(FocalTangent, viewsin); + viewtancos = FixedMul(FocalTangent, viewcos); + R_SetupFreelook(); // killough 3/20/98, 4/4/98: select colormap based on player status Modified: branches/prboom-plus-24/prboom2/src/r_main.h ============================================================================== --- branches/prboom-plus-24/prboom2/src/r_main.h Sat Mar 4 16:33:12 2017 (r4517) +++ branches/prboom-plus-24/prboom2/src/r_main.h Sat Mar 4 18:44:16 2017 (r4518) @@ -49,12 +49,16 @@ extern fixed_t viewcos; extern fixed_t viewsin; +extern fixed_t viewtancos; +extern fixed_t viewtansin; extern int viewwidth; extern int viewheight; extern int viewwindowx; extern int viewwindowy; extern int centerx; extern int centery; +extern fixed_t globaluclip; +extern fixed_t globaldclip; extern fixed_t centerxfrac; extern fixed_t centeryfrac; extern fixed_t yaspectmul; Modified: branches/prboom-plus-24/prboom2/src/r_things.c ============================================================================== --- branches/prboom-plus-24/prboom2/src/r_things.c Sat Mar 4 16:33:12 2017 (r4517) +++ branches/prboom-plus-24/prboom2/src/r_things.c Sat Mar 4 18:44:16 2017 (r4518) @@ -610,7 +610,7 @@ static void R_ProjectSprite (mobj_t* thing, int lightlevel) { - fixed_t gzt; // killough 3/27/98 + fixed_t gzt, gzb; // killough 3/27/98 fixed_t tx; fixed_t xscale; int x1; @@ -628,7 +628,7 @@ fixed_t tr_x, tr_y; fixed_t fx, fy, fz; fixed_t gxt, gyt; - fixed_t tz; + fixed_t tz, tz2; int width; #ifdef GL_DOOM @@ -736,6 +736,7 @@ x2 = ((centerxfrac + FixedMul (tx,xscale) - FRACUNIT/2) >> FRACBITS); gzt = fz + (patch->topoffset << FRACBITS); + gzb = gzt - (patch->height << FRACBITS); width = patch->width; R_UnlockPatchNum(lump+firstspritelump); } @@ -744,13 +745,13 @@ if (x1 > viewwidth || x2 < 0) return; - // killough 4/9/98: clip things which are out of view due to height - // e6y: fix of hanging decoration disappearing in Batman Doom MAP02 - // centeryfrac -> viewheightfrac - // [kb] add +1 so sprites are shown even with the extended freelook - if (thing->z > viewz + FixedDiv(viewheight << (FRACBITS + 1), xscale) || - gzt < viewz - FixedDiv((viewheight << (FRACBITS + 1)) - viewheight, xscale)) + // [RH] Reject sprites that are off the top or bottom of the screen + tz2 = FixedMul(tr_x, viewtancos) + FixedMul(tr_y, viewtansin); + if (FixedMul(globaluclip, tz2) > viewz - gzb || + FixedMul(globaldclip, tz2) < viewz - gzt) + { return; + } // killough 3/27/98: exclude things totally separated // from the viewer, by either water or fake ceilings |