2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Hoikas' subworld fixes including PhysX support

1) Allow plSubWorldMsg to be sent over the network
https://github.com/H-uru/Plasma/pull/107
2) Cleanup VolumeSensorConditionalObject
https://github.com/H-uru/Plasma/pull/537
3) Add two new compiler feature tests - HeadSpin.h changes ONLY, as
prerequisite for VolumeSensorConditionalObject
45be91c0e3
4) Fix a crash and a silly identified by Coverity - changes for
VolumeSensorConditionalObject ONLY
a702cb9d3f
5) PXSubworld (Havok/CC subworld physics support ported to PhysX/MOULa)
https://github.com/H-uru/Plasma/pull/555
This commit is contained in:
John Johns
2021-05-31 10:48:56 -07:00
parent c914ba5bac
commit 576ac25f03
25 changed files with 545 additions and 421 deletions

View File

@ -367,6 +367,7 @@ CLASS_INDEX_LIST_START
CLASS_INDEX(plDynamicCamMap),
CLASS_INDEX(plRidingAnimatedPhysicalDetector),
CLASS_INDEX(plVolumeSensorConditionalObjectNoArbitration),
CLASS_INDEX(plPXSubWorld),
//---------------------------------------------------------
// Keyed objects above this line, unkeyed (such as messages) below..
//---------------------------------------------------------

View File

@ -57,6 +57,8 @@ class hsResMgr;
class plServerReplyMsg : public plMessage
{
int fType;
bool fWasDelayed;
public:
enum
@ -67,10 +69,13 @@ public:
};
void SetType(int t) { fType = t; }
int GetType() { return fType; }
int GetType() const { return fType; }
plServerReplyMsg() : fType(kUnInit) { }
plServerReplyMsg(const plKey &s, const plKey &r, const double* t) : plMessage(s,r,t), fType(kUnInit) { }
void SetWasDelayed(bool v) { fWasDelayed = v; }
bool GetWasDelayed() const { return fWasDelayed; }
plServerReplyMsg() : fType(kUnInit), fWasDelayed(false) { }
plServerReplyMsg(const plKey &s, const plKey &r, const double* t) : plMessage(s,r,t), fType(kUnInit), fWasDelayed(false) { }
CLASSNAME_REGISTER( plServerReplyMsg );
GETINTERFACE_ANY( plServerReplyMsg, plMessage );

View File

@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plgDispatch.h"
#include "hsResMgr.h"
#include "hsTimer.h"
#include "../pnTimer/plTimerCallbackManager.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../pnNetCommon/plGenericVar.h"
#include "../pnNetCommon/plNetApp.h"
@ -53,6 +54,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "../pnMessage/plEnableMsg.h"
#include "../pnMessage/plServerReplyMsg.h"
uint32_t plLogicModBase::sArbitrationDelayMs = 0;
void plLogicModBase::ConsoleTrigger(plKey playerKey)
{
// Setup the event data in case this is a OneShot responder that needs it
@ -138,31 +141,12 @@ hsBool plLogicModBase::MsgReceive(plMessage* msg)
plServerReplyMsg* pSMsg = plServerReplyMsg::ConvertNoRef(msg);
if (pSMsg)
{
hsAssert(pSMsg->GetType() != plServerReplyMsg::kUnInit, "uninit server reply msg");
#if 1
char str[256];
sprintf(str, "LM: LogicModifier %s recvd trigger request reply:%s, wasRequesting=%d, t=%f\n", GetKeyName(),
pSMsg->GetType() == plServerReplyMsg::kDeny ? "denied" : "confirmed",
HasFlag(kRequestingTrigger), hsTimer::GetSysSeconds());
plNetClientApp::GetInstance()->DebugMsg(str);
#endif
if (pSMsg->GetType() == plServerReplyMsg::kDeny)
{
if (HasFlag(kRequestingTrigger))
{
plNetClientApp::GetInstance()->DebugMsg("\tLM: Denied, clearing requestingTrigger");
ClearFlag(kRequestingTrigger);
}
else
plNetClientApp::GetInstance()->DebugMsg("\tLM: Denied, but not requesting?");
}
else
{
hsBool netRequest=false; // we're triggering as a result of a local activation
PreTrigger(netRequest);
IUpdateSharedState(false /* untriggering */);
if (sArbitrationDelayMs == 0 || pSMsg->GetWasDelayed()) {
IHandleArbitration(pSMsg);
} else {
pSMsg->SetWasDelayed(true);
pSMsg->Ref(); // timer callback manager steals this reference
plgTimerCallbackMgr::NewTimer(static_cast<float>(sArbitrationDelayMs) / 1000, pSMsg);
}
return true;
}
@ -186,6 +170,28 @@ hsBool plLogicModBase::MsgReceive(plMessage* msg)
return plSingleModifier::MsgReceive(msg);
}
void plLogicModBase::IHandleArbitration(plServerReplyMsg* pSMsg)
{
hsAssert(pSMsg->GetType() != plServerReplyMsg::kUnInit, "uninit server reply msg");
plNetClientApp::GetInstance()->DebugMsg("LM: LogicModifier {} recvd trigger request reply:{}, wasRequesting={}, t={f}\n",
GetKeyName(),
pSMsg->GetType() == plServerReplyMsg::kDeny ? "denied" : "confirmed",
HasFlag(kRequestingTrigger), hsTimer::GetSysSeconds());
if (pSMsg->GetType() == plServerReplyMsg::kDeny) {
if (HasFlag(kRequestingTrigger)) {
plNetClientApp::GetInstance()->DebugMsg("\tLM: Denied, clearing requestingTrigger");
ClearFlag(kRequestingTrigger);
} else {
plNetClientApp::GetInstance()->DebugMsg("\tLM: Denied, but not requesting?");
}
} else {
bool netRequest=false; // we're triggering as a result of a local activation
PreTrigger(netRequest);
IUpdateSharedState(false /* untriggering */);
}
}
void plLogicModBase::RequestTrigger(hsBool netRequest)
{
if (HasFlag(kTriggered))

View File

@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plLogicModBase_inc
#define plLogicModBase_inc
#include <stdint.h>
#include "plSingleModifier.h"
#include "../pnNetCommon/plSynchedValue.h"
#include "hsTemplates.h"
@ -66,6 +67,8 @@ public:
};
protected:
static uint32_t sArbitrationDelayMs;
hsTArray<plMessage*> fCommandList;
hsTArray<plKey> fReceiverList;
UInt32 fCounterLimit;
@ -77,6 +80,7 @@ protected:
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return false;}
void IUpdateSharedState(bool triggered) const;
void IHandleArbitration(class plServerReplyMsg* msg);
hsBool IEvalCounter();
virtual void PreTrigger(hsBool netRequest);
virtual void Trigger(hsBool netRequest);
@ -85,7 +89,7 @@ protected:
void CreateNotifyMsg();
public:
friend plVolumeSensorConditionalObjectNoArbitration;
friend class plVolumeSensorConditionalObject;
plLogicModBase();
~plLogicModBase();
CLASSNAME_REGISTER( plLogicModBase );
@ -121,6 +125,9 @@ public:
// for debug purposes only!
void ConsoleTrigger(plKey playerKey);
void ConsoleRequestTrigger();
/** Specifies an amount of time (in milliseconds) to delay processing server arbitration responses */
static void SetArbitrationDelay(uint32_t ms) { sArbitrationDelayMs = ms; }
};