model2.cpp: workaround hardlocks in fvipers and schamp (nw)

This commit is contained in:
angelosa 2018-03-01 01:39:03 +01:00
parent 231aa2cfa9
commit e2635c9e94

View File

@ -91,6 +91,7 @@
#include "video/segaic24.h"
#include "includes/model2.h"
#include <cmath>
#define pz p[0]
#define pu p[1]
@ -213,7 +214,10 @@ static int32_t clip_polygon(poly_vertex *v, int32_t num_vertices, plane *cp, pol
nextin = (nextdot >= cp->distance) ? 1 : 0;
/* Add a clipped vertex if one end of the current edge is inside the plane and the other is outside */
if ( curin != nextin )
// TODO: displaying Honey in Fighting Vipers and Bean in Sonic the Fighters somehow causes a NaN dot product here,
// causing MAME to hardlock in the renderer routine. They are also causing lots of invalid polygon renders
// which might be related.
if ( curin != nextin && std::isnan(curdot) == false && std::isnan(nextdot) == false )
{
scale = (cp->distance - curdot) / (nextdot - curdot);
@ -1946,7 +1950,7 @@ static uint32_t * geo_object_data( geo_state *geo, uint32_t opcode, uint32_t *in
// Virtual On & Gunblade NY
if(obc == 0)
obc = 0xfffff;
switch( geo->mode & 3 )
{
/* Normals present, No Specular */