From 94839880d731449d6dd31dfdd2586fd10592b641 Mon Sep 17 00:00:00 2001 From: Chris Burt Date: Fri, 25 Mar 2005 14:57:25 +0000 Subject: [PATCH] Quickly hacked together a fix for game engine compiling. There were two missing files in Kester's new commits. This commit adds these two files so that compiling can continue as it is intended to. Emilie M. found a home for the files rather quickly, Ton recieived the files from Erwin via email, and we all tested. Works great! Thanks to everyone that helped! --- .../Physics/Sumo/SumoPHYCallbackBridge.cpp | 66 +++++++++++++++++++ .../Physics/Sumo/SumoPHYCallbackBridge.h | 27 ++++++++ 2 files changed, 93 insertions(+) create mode 100755 source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.cpp create mode 100755 source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.h diff --git a/source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.cpp b/source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.cpp new file mode 100755 index 00000000000..52d3888f58c --- /dev/null +++ b/source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.cpp @@ -0,0 +1,66 @@ +#include "SumoPHYCallbackBridge.h" +#include "PHY_IPhysicsController.h" +#include "SM_Object.h" + + +SumoPHYCallbackBridge::SumoPHYCallbackBridge(void* clientData,PHY_ResponseCallback phyCallback) +:m_orgClientData(clientData), +m_phyCallback(phyCallback) +{ + +} +DT_Bool SumoPHYCallbackBridge::StaticSolidToPHYCallback(void *client_data, + void *client_object1, + void *client_object2, + const DT_CollData *coll_data) +{ + SumoPHYCallbackBridge* bridge = static_cast(client_data); + bridge->SolidToPHY(client_object1,client_object2,coll_data); + return false; +} + +DT_Bool SumoPHYCallbackBridge::SolidToPHY(void *client_object1, + void *client_object2, + const DT_CollData *coll_data) +{ + + SM_Object* smObject1 = static_cast(client_object1); + SM_Object* smObject2 = static_cast(client_object2); + + PHY_IPhysicsController* ctrl1 = static_cast(smObject1->getPhysicsClientObject()); + PHY_IPhysicsController* ctrl2 = static_cast(smObject2->getPhysicsClientObject()); + + if (!ctrl1 || !ctrl2) + { + //todo: check which objects are not linked up properly + return false; + } + if (coll_data) + { + PHY_CollData phyCollData; + + phyCollData.m_point1[0] = coll_data->point1[0]; + phyCollData.m_point1[1] = coll_data->point1[1]; + phyCollData.m_point1[2] = coll_data->point1[2]; + phyCollData.m_point1[3] = 0.f; + + phyCollData.m_point2[0] = coll_data->point2[0]; + phyCollData.m_point2[1] = coll_data->point2[1]; + phyCollData.m_point2[2] = coll_data->point2[2]; + phyCollData.m_point2[3] = 0.f; + + phyCollData.m_normal[0] = coll_data->normal[0]; + phyCollData.m_normal[1] = coll_data->normal[1]; + phyCollData.m_normal[2] = coll_data->normal[2]; + phyCollData.m_normal[3] = 0.f; + + + return m_phyCallback(m_orgClientData, + ctrl1,ctrl2,&phyCollData); + } + + return m_phyCallback(m_orgClientData, + ctrl1,ctrl2,0); + + +} \ No newline at end of file diff --git a/source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.h b/source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.h new file mode 100755 index 00000000000..343fd7ce938 --- /dev/null +++ b/source/gameengine/Physics/Sumo/SumoPHYCallbackBridge.h @@ -0,0 +1,27 @@ +#ifndef SUMO_PHY_CALLBACK_BRIDGE_H +#define SUMO_PHY_CALLBACK_BRIDGE_H + +#include +#include "PHY_DynamicTypes.h" + +class SumoPHYCallbackBridge +{ + void* m_orgClientData; + PHY_ResponseCallback m_phyCallback; + +public: + + SumoPHYCallbackBridge::SumoPHYCallbackBridge(void* clientData,PHY_ResponseCallback phyCallback); + + static DT_Bool StaticSolidToPHYCallback(void *client_data, + void *client_object1, + void *client_object2, + const DT_CollData *coll_data); + + DT_Bool SolidToPHY(void *client_object1, + void *client_object2, + const DT_CollData *coll_data); + + +}; +#endif //SUMO_PHY_CALLBACK_BRIDGE_H \ No newline at end of file