bool RADAR::Hits( RCOORD *distance, PRAY pr ) // orogin, normal length of line. { // return time which line hits wall... // time time on wall // if time is withing // timeof( pr.o - pr.n )... 0 to what?? // RCOORD t1; // = distance... RCOORD t1, t2; // RAY dir; t1 = *distance; if( FindIntersectionTime( distance, Lines[0].d.n, Lines[0].d.o , &t2, pr->n, pr->o ) ) { if( t2 >= 1.0 || // don't collide ON bounds... t2 <= 0.0 || *distance <= 0.0 || *distance > t1 ) { *distance=t1; return false; } // shorter distance.... returned IN distance... return true; } return false; }
INDEX CPROC CheckWallSelect( PWALL wall, PWALLSELECTINFO si ) { GETWORLD(si->iWorld); //PWALL wall = GetWall( iWall ); PFLATLAND_MYLINESEG line = GetLine( wall->iLine ); RCOORD t1, t2; if( FindIntersectionTime( &t1, si->r.n, si->r.o , &t2, line->r.n, line->r.o ) ) { if( t1 >= 0 && t1 <= 1 && t2 >= line->dFrom && t2 <= line->dTo ) { if( si->nwalls < 2 ) { si->walls[si->nwalls++] = GetMemberIndex( WALL, &world->walls, wall ); } else return 1; // breaks for_all loop } //Log4( "Results: %g %g (%g %g)", t1, t2, line->start, line->dTo ); } return 0; }