CVector could have dot product as well : (vec1.x * vec2.x + vec1.y * vec2.y + vec1.z * vec2.z)
Some extensions I needed for CPathFind (it would be good to have them in original class) :
obs.: some node address I put as Integer (ugly but made my life easier). Having automatic conversion (via operator) would be great.
void CPathFind_Ext::loadSceneForPathNodes(float X, float Y, float Z)
{
((void(__thiscall *)(CPathFind *, float, float, float)) 0x44DE00)((CPathFind *)0x96F050, X, Y, Z);
}
char CPathFind_Ext::isAreaNodesAvailable(int AreaID)
{
return ((char(__thiscall *)(CPathFind *, int)) 0x420AA0)((CPathFind *)0x96F050, AreaID);
}
CPathNode * CPathFind_Ext::getPathNode(int nodeAddr)
{
return ((CPathNode *(__thiscall *)(CPathFind *, int)) 0x420AC0)((CPathFind *)0x96F050, nodeAddr);
}
int CPathFind_Ext::findRegionForCoors (float x, float y)
{
return ((int(__thiscall *)(CPathFind *, float, float)) 0x44D830)((CPathFind *)0x96F050, x, y);
}
int CPathFind_Ext::findNodeClosestInRegion(int * outNodeInfo, int region, CVector pos, int nodeType, float * pDistance, char flag1, char flag2, char bBoatsOnly, int a11)
{
return ((int(__thiscall *)(CPathFind *, int *, int , CVector , int , float *, char , char , char , int )) 0x44F2C0)((CPathFind *)0x96F050, outNodeInfo, region, pos, nodeType, pDistance, flag1, flag2, bBoatsOnly, a11);
}
float CPathFind_Ext::findNodeOrientationForCarPlacement(int nodeAddr)
{
return ((float(__thiscall *)(CPathFind *, int)) 0x450320)((CPathFind *)0x96F050, nodeAddr);
}
float CPathFind_Ext::findNodeCoorsForScript(CVector *Coors, int node1, int node2, float *heading, BYTE *direction)
{
return ((float(__thiscall *)(CPathFind *, CVector *, int, int, float *, BYTE *)) 0x450780)((CPathFind *)0x96F050, Coors, node1, node2, heading, direction);
}
float CPathFind_Ext::these2NodesAreAdjacent(int nodeA, int nodeB)
{
return ((char(__thiscall *)(CPathFind *, int, int)) 0x44D230)((CPathFind *)0x96F050, nodeA, nodeB);
}
char CPathFind_Ext::ThisNodeWillLeadIntoADeadEnd(CPathNode * pNode_1, CPathNode * pNode_2)
{
return ((char(__thiscall *)(CPathFind *, CPathNode*, CPathNode*)) 0x44D310)((CPathFind *)0x96F050, pNode_1, pNode_2);
}