MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / RayTraceCheck

Method RayTraceCheck

CrySystem/ScriptObjectSystem.cpp:2593–2620  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2591//-------------------------------------------------------------------------------------------------
2592//
2593int CScriptObjectSystem::RayTraceCheck(IFunctionHandler *pH)
2594{
2595 CHECK_PARAMETERS(4);
2596 CScriptObjectVector vPos(m_pScriptSystem, true);
2597 Vec3 src, dst;
2598 int skipId1, skipId2;
2599
2600 pH->GetParam(1, *vPos);
2601 src = vPos.Get();
2602 pH->GetParam(2, *vPos);
2603 dst = vPos.Get();
2604 pH->GetParam(3, skipId1);
2605 pH->GetParam(4, skipId2);
2606
2607 IEntity *skipEnt1 = m_pEntitySystem->GetEntity(skipId1);
2608 IEntity *skipEnt2 = m_pEntitySystem->GetEntity(skipId2);
2609 IPhysicalEntity *skipPhys1=NULL;
2610 IPhysicalEntity *skipPhys2=NULL;
2611
2612 if(skipEnt1) skipPhys1 = skipEnt1->GetPhysics();
2613 if(skipEnt2) skipPhys2 = skipEnt2->GetPhysics();
2614
2615 ray_hit RayHit;
2616 //TODO? add an extraparam to specify what kind of objects to check? now its world and static
2617 int nHits=m_pPhysicalWorld->RayWorldIntersection(src, dst-src, ent_static|ent_terrain, rwi_ignore_noncolliding | rwi_stop_at_pierceable, &RayHit, 1, skipPhys1, skipPhys2 );
2618
2619 return pH->EndFunction((bool)(nHits==0));
2620}
2621
2622
2623

Callers

nothing calls this directly

Calls 6

EndFunctionMethod · 0.80
GetParamMethod · 0.45
GetMethod · 0.45
GetEntityMethod · 0.45
GetPhysicsMethod · 0.45
RayWorldIntersectionMethod · 0.45

Tested by

no test coverage detected