MD2 fixes

transparency fixes, and views (it would be so much better if they didn't
stop rendering past the camera y'know, especially if they're big.)
This commit is contained in:
yellowtd 2015-02-21 03:16:26 -05:00
parent d4d4d8691e
commit 1b5d88d290
2 changed files with 15 additions and 4 deletions

View file

@ -4028,7 +4028,8 @@ static void HWR_SortVisSprites(void)
gr_vsprsortedhead.next = gr_vsprsortedhead.prev = &gr_vsprsortedhead;
for (i = 0; i < gr_visspritecount; i++)
{
bestdist = ZCLIP_PLANE-1;
//bestdist = ZCLIP_PLANE-1;
bestdist = -66666.0f; //Yellow: Changing this value fixes the crash
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
{
if (ds->tz > bestdist)
@ -4561,7 +4562,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin);
// thing is behind view plane?
if (tz < ZCLIP_PLANE)
if (tz < ZCLIP_PLANE && md2_models[thing->sprite].notfound == true) //Yellow: Only MD2's dont disappear
return;
tx = (tr_x * gr_viewsin) - (tr_y * gr_viewcos);
@ -4589,8 +4590,9 @@ static void HWR_ProjectSprite(mobj_t *thing)
rot = thing->frame&FF_FRAMEMASK;
thing->state->sprite = thing->sprite;
thing->state->frame = thing->frame;
sprdef = &sprites[thing->sprite]; //Yellow: sprdef now updates rotations to fix the crash
}
sprframe = &sprdef->spriteframes[rot];
#ifdef PARANOIA

View file

@ -1899,7 +1899,7 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
#endif
}
DrawPolygon(NULL, NULL, 0, PF_Masked|PF_Modulated|PF_Occlude|PF_Clip);
DrawPolygon(NULL, NULL, 0, PF_Masked|PF_Modulated|PF_Occlude/*|PF_Clip*/); //Yellow: Fixes MD2 Transparency
pglPushMatrix(); // should be the same as glLoadIdentity
//Hurdler: now it seems to work
@ -1909,6 +1909,15 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
//Yellow: Fixes MD2 Transparency
// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites
if (color[3] < 255)
{
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
pglDepthMask(GL_FALSE);
}
val = *gl_cmd_buffer++;