Browse Source

Fixes for plInputManager and plResponderModifier.

Darryl Pogue 13 years ago
parent
commit
1f0547279c
  1. 6
      Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h
  2. 8
      Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp
  3. 11
      Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h
  4. 10
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp
  5. 4
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h
  6. 2
      Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp

6
Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h

@ -125,14 +125,14 @@ struct CommandConvert
struct plMouseInfo struct plMouseInfo
{ {
plMouseInfo(ControlEventCode _code, uint32_t _flags, hsPoint4 _box, char* _desc) plMouseInfo(ControlEventCode _code, uint32_t _flags, hsPoint4 _box, const char* _desc)
{ {
fCode = _code; fCode = _code;
fControlFlags = _flags; fControlFlags = _flags;
fBox = _box; fBox = _box;
fControlDescription = _desc; fControlDescription = _desc;
} }
plMouseInfo(ControlEventCode _code, uint32_t _flags, float pt1, float pt2, float pt3, float pt4, char* _desc) plMouseInfo(ControlEventCode _code, uint32_t _flags, float pt1, float pt2, float pt3, float pt4, const char* _desc)
{ {
fCode = _code; fCode = _code;
fControlFlags = _flags; fControlFlags = _flags;
@ -142,7 +142,7 @@ struct plMouseInfo
ControlEventCode fCode; ControlEventCode fCode;
uint32_t fControlFlags; uint32_t fControlFlags;
hsPoint4 fBox; hsPoint4 fBox;
char* fControlDescription; const char* fControlDescription;
}; };

8
Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp

@ -117,7 +117,7 @@ typedef int (__stdcall * Pfunc1) (const DIDEVICEINSTANCE* device, void* pRef);
plInputManager* plInputManager::fInstance = nil; plInputManager* plInputManager::fInstance = nil;
plInputManager::plInputManager( HWND hWnd ) : plInputManager::plInputManager( hsWindowHndl hWnd ) :
fDInputMgr(nil), fDInputMgr(nil),
fInterfaceMgr(nil) fInterfaceMgr(nil)
{ {
@ -178,7 +178,7 @@ void plInputManager::CreateInterfaceMod(plPipeline* p)
fInterfaceMgr->Init(); fInterfaceMgr->Init();
} }
void plInputManager::InitDInput(HINSTANCE hInst, HWND hWnd) void plInputManager::InitDInput(hsWindowInst hInst, hsWindowHndl hWnd)
{ {
if (fUseDInput) if (fUseDInput)
{ {
@ -260,7 +260,8 @@ plKeyDef plInputManager::UntranslateKey(plKeyDef key, hsBool extended)
return key; return key;
} }
void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM Lparam, HWND hWnd) #if HS_BUILD_FOR_WIN32
void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM Lparam, hsWindowHndl hWnd)
{ {
if( !fhWnd ) if( !fhWnd )
fhWnd = hWnd; fhWnd = hWnd;
@ -431,6 +432,7 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM
} }
} }
#endif
//// Activate //////////////////////////////////////////////////////////////// //// Activate ////////////////////////////////////////////////////////////////
// Handles what happens when the app (window) activates/deactivates // Handles what happens when the app (window) activates/deactivates

11
Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h

@ -62,7 +62,7 @@ private:
static hsBool fUseDInput; static hsBool fUseDInput;
public: public:
plInputManager(); plInputManager();
plInputManager( HWND hWnd ); plInputManager( hsWindowHndl hWnd );
~plInputManager(); ~plInputManager();
CLASSNAME_REGISTER( plInputManager ); CLASSNAME_REGISTER( plInputManager );
@ -70,7 +70,7 @@ public:
void AddInputDevice(plInputDevice* pDev); void AddInputDevice(plInputDevice* pDev);
void InitDInput(HINSTANCE hInst, HWND hWnd); void InitDInput(hsWindowInst hInst, hsWindowHndl hWnd);
static void UseDInput(hsBool b) { fUseDInput = b; } static void UseDInput(hsBool b) { fUseDInput = b; }
void Update(); void Update();
@ -98,15 +98,18 @@ protected:
float fMouseScale; float fMouseScale;
static uint8_t bRecenterMouse; static uint8_t bRecenterMouse;
static HWND fhWnd; static hsWindowHndl fhWnd;
public: public:
#if HS_BUILD_FOR_WIN32
// event handlers // event handlers
void HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM Lparam, HWND hWnd); void HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM Lparam, HWND hWnd);
#endif
}; };
#if HS_BUILD_FOR_WIN32
// {049DE53E-23A2-4d43-BF68-36AC1B57E357} // {049DE53E-23A2-4d43-BF68-36AC1B57E357}
static const GUID PL_ACTION_GUID = { 0x49de53e, 0x23a2, 0x4d43, { 0xbf, 0x68, 0x36, 0xac, 0x1b, 0x57, 0xe3, 0x57 } }; static const GUID PL_ACTION_GUID = { 0x49de53e, 0x23a2, 0x4d43, { 0xbf, 0x68, 0x36, 0xac, 0x1b, 0x57, 0xe3, 0x57 } };
#endif
#endif #endif

10
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp

@ -109,7 +109,7 @@ plSceneInputInterface::plSceneInputInterface()
{ {
fPipe = nil; fPipe = nil;
fSpawnPoint = nil; fSpawnPoint = nil;
GuidClear(&fAgeInstanceGuid); fAgeInstanceGuid.Clear();
fInstance = this; fInstance = this;
SetEnabled( true ); // Always enabled SetEnabled( true ); // Always enabled
} }
@ -790,7 +790,7 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg )
} }
else if ( mgrMsg->GetCommand() == plInputIfaceMgrMsg::kSetShareAgeInstanceGuid ) else if ( mgrMsg->GetCommand() == plInputIfaceMgrMsg::kSetShareAgeInstanceGuid )
{ {
fAgeInstanceGuid = mgrMsg->GetAgeInstanceGuid(); fAgeInstanceGuid = plUUID(mgrMsg->GetAgeInstanceGuid());
} }
} }
plVaultNotifyMsg* pVaultMsg = plVaultNotifyMsg::ConvertNoRef(msg); plVaultNotifyMsg* pVaultMsg = plVaultNotifyMsg::ConvertNoRef(msg);
@ -817,15 +817,15 @@ void plSceneInputInterface::ILinkOffereeToAge()
info.SetAgeFilename(fOfferedAgeFile); info.SetAgeFilename(fOfferedAgeFile);
info.SetAgeInstanceName(fOfferedAgeInstance); info.SetAgeInstanceName(fOfferedAgeInstance);
bool isAgeInstanceGuidSet = !GuidIsNil(fAgeInstanceGuid); bool isAgeInstanceGuidSet = fAgeInstanceGuid.IsSet();
plAgeLinkStruct link; plAgeLinkStruct link;
if (isAgeInstanceGuidSet) { if (isAgeInstanceGuidSet) {
info.SetAgeInstanceGuid(&plUUID(fAgeInstanceGuid)); info.SetAgeInstanceGuid(&fAgeInstanceGuid);
link.GetAgeInfo()->CopyFrom(&info); link.GetAgeInfo()->CopyFrom(&info);
GuidClear(&fAgeInstanceGuid); fAgeInstanceGuid.Clear();
} }
else if (!VaultGetOwnedAgeLink(&info, &link)) { else if (!VaultGetOwnedAgeLink(&info, &link)) {

4
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h

@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plInputInterface.h" #include "plInputInterface.h"
#include "hsGeometry3.h" #include "hsGeometry3.h"
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
#include "pnUtils/pnUtils.h" #include "pnUUID/pnUUID.h"
//// Class Definition //////////////////////////////////////////////////////// //// Class Definition ////////////////////////////////////////////////////////
@ -86,7 +86,7 @@ class plSceneInputInterface : public plInputInterface
const char* fOfferedAgeFile; const char* fOfferedAgeFile;
const char* fOfferedAgeInstance; const char* fOfferedAgeInstance;
const char* fSpawnPoint; const char* fSpawnPoint;
Uuid fAgeInstanceGuid; plUUID fAgeInstanceGuid;
struct clickableTest struct clickableTest
{ {
clickableTest(plKey k) clickableTest(plKey k)

2
Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp

@ -788,7 +788,7 @@ void plResponderModifier::ILog(uint32_t color, const char* format, ...)
char buf[256]; char buf[256];
va_list args; va_list args;
va_start(args, format); va_start(args, format);
int numWritten = _vsnprintf(buf, sizeof(buf), format, args); int numWritten = hsVsnprintf(buf, sizeof(buf), format, args);
hsAssert(numWritten > 0, "Buffer too small"); hsAssert(numWritten > 0, "Buffer too small");
va_end(args); va_end(args);

Loading…
Cancel
Save