1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Merge remote-tracking branch 'origin/master' into plString

Conflicts:
	Sources/Plasma/CoreLib/hsStream.h
	Sources/Plasma/FeatureLib/pfAudio/plListener.cpp
	Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
	Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp
	Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp
	Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
	Sources/Plasma/FeatureLib/pfPython/cyMisc.h
	Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp
	Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
	Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h
	Sources/Plasma/FeatureLib/pfPython/pyImage.cpp
	Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp
	Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h
	Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp
	Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp
	Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp
	Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h
	Sources/Plasma/NucleusLib/pnMessage/plMessage.h
	Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h
	Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp
	Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp
	Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp
	Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp
	Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h
	Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h
	Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h
	Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp
	Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h
	Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h
	Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp
	Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp
	Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp
	Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp
	Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h
	Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp
	Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h
	Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp
	Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h
	Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp
This commit is contained in:
2012-01-28 17:20:01 -08:00
1722 changed files with 24149 additions and 27599 deletions

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIButtonMod.h"
#include "pfGUIDraggableMod.h"
#include "pfGameGUIMgr.h"
@ -93,7 +93,7 @@ class pfGUIButtonDragProc : public pfGUICtrlProcObject
fParent->StopDragging( false );
}
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event )
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event )
{
if( event == pfGUIDraggableMod::kDragging )
{
@ -113,7 +113,7 @@ class pfGUIButtonDragProc : public pfGUICtrlProcObject
fOrigProc->HandleExtendedEvent( ctrl, event );
}
virtual void UserCallback( UInt32 userValue )
virtual void UserCallback( uint32_t userValue )
{
if( fOrigProc != nil )
fOrigProc->UserCallback( userValue );
@ -142,7 +142,7 @@ void pfGUIButtonMod::StartDragging( void )
fOrigHandler = fDraggable->GetHandler();
fDraggable->SetVisible( true );
fDraggable->SetHandler( TRACKED_NEW pfGUIButtonDragProc( this, fDraggable, fOrigHandler, fOrigReportedDrag ) );
fDraggable->SetHandler( new pfGUIButtonDragProc( this, fDraggable, fOrigHandler, fOrigReportedDrag ) );
fDraggable->HandleMouseDown( fOrigMouseDownPt, 0 );
}
@ -169,7 +169,7 @@ pfGUIButtonMod::~pfGUIButtonMod()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIButtonMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIButtonMod::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -201,7 +201,7 @@ void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadLE32();
uint32_t i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
@ -213,14 +213,14 @@ void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr )
fMouseOverAnimName = s->ReadSafeString();
fNotifyType = s->ReadLE32();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef );
}
void pfGUIButtonMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
uint32_t i, count = fAnimationKeys.GetCount();
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
@ -249,12 +249,12 @@ void pfGUIButtonMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
fClicking = true;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetForewards );
msg->SetCmd( plAnimCmdMsg::kGoToBegin );
@ -274,7 +274,7 @@ void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
}
}
void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
// make sure that we got the down click first
@ -284,7 +284,7 @@ void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
fClicking = false;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetBackwards );
msg->SetCmd( plAnimCmdMsg::kGoToEnd );
@ -305,7 +305,7 @@ void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
fTriggering = false;
}
void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
if( !fClicking )
return;
@ -327,12 +327,12 @@ void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
}
}
void pfGUIButtonMod::SetNotifyType(Int32 kind)
void pfGUIButtonMod::SetNotifyType(int32_t kind)
{
fNotifyType = kind;
}
Int32 pfGUIButtonMod::GetNotifyType()
int32_t pfGUIButtonMod::GetNotifyType()
{
return fNotifyType;
}
@ -351,7 +351,7 @@ void pfGUIButtonMod::SetInteresting( hsBool i )
if( fMouseOverAnimKeys.GetCount() )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( fInteresting ? plAnimCmdMsg::kSetForewards : plAnimCmdMsg::kSetBackwards );
msg->SetAnimName( fMouseOverAnimName );
@ -372,7 +372,7 @@ void pfGUIButtonMod::SetAnimationKeys( hsTArray<plKey> &keys, const char *nam
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
@ -385,7 +385,7 @@ void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char
delete [] fMouseOverAnimName;
if( name != nil )
{
fMouseOverAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
fMouseOverAnimName = new char[ strlen( name ) + 1 ];
strcpy( fMouseOverAnimName, name );
}
else
@ -395,7 +395,7 @@ void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIButtonMod::IGetDesiredCursor( void ) const
uint32_t pfGUIButtonMod::IGetDesiredCursor( void ) const
{
if( fHandler == nil )
return 0;

View File

@ -74,11 +74,11 @@ class pfGUIButtonMod : public pfGUIControlMod
hsBool fOrigReportedDrag;
Int32 fNotifyType;
int32_t fNotifyType;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
@ -96,14 +96,14 @@ class pfGUIButtonMod : public pfGUIControlMod
virtual void SetInteresting( hsBool i );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetNotifyType(Int32 kind);
virtual Int32 GetNotifyType();
virtual void SetNotifyType(int32_t kind);
virtual int32_t GetNotifyType();
virtual hsBool IsButtonDown();
virtual hsBool IsTriggering() { return fTriggering; }
enum SoundEvents

View File

@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUICheckBoxCtrl.h"
#include "pfGameGUIMgr.h"
@ -79,7 +79,7 @@ pfGUICheckBoxCtrl::~pfGUICheckBoxCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUICheckBoxCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUICheckBoxCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -98,7 +98,7 @@ void pfGUICheckBoxCtrl::Read( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadLE32();
uint32_t i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
@ -110,7 +110,7 @@ void pfGUICheckBoxCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
uint32_t i, count = fAnimationKeys.GetCount();
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
@ -130,14 +130,14 @@ void pfGUICheckBoxCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool forc
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUICheckBoxCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
fClicking = true;
if(fPlaySound)
IPlaySound( kMouseDown );
}
void pfGUICheckBoxCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUICheckBoxCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fClicking )
{
@ -162,7 +162,7 @@ void pfGUICheckBoxCtrl::SetChecked( hsBool checked, hsBool immediate /*= fals
fChecked = checked;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
plAnimCmdMsg *msg = new plAnimCmdMsg();
if( fChecked )
{
// Moving to true
@ -203,7 +203,7 @@ void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
@ -212,7 +212,7 @@ void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUICheckBoxCtrl::IGetDesiredCursor( void ) const
uint32_t pfGUICheckBoxCtrl::IGetDesiredCursor( void ) const
{
if( fClicking )
return plInputInterface::kCursorClicked;

View File

@ -65,9 +65,9 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
hsBool fChecked;
hsBool fPlaySound;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
@ -83,8 +83,8 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIClickMapCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
@ -72,7 +72,7 @@ pfGUIClickMapCtrl::~pfGUIClickMapCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIClickMapCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIClickMapCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -96,14 +96,14 @@ void pfGUIClickMapCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr );
}
void pfGUIClickMapCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIClickMapCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
IScreenToLocalPt( mousePt );
fLastMousePt = fLastMouseDragPt = mousePt;
fTracking = true;
}
void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fTracking )
{
@ -114,7 +114,7 @@ void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
}
}
void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fTracking )
{
@ -125,7 +125,7 @@ void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
}
}
void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers )
{
IScreenToLocalPt( mousePt );
fLastMousePt = mousePt;
@ -136,10 +136,10 @@ void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIClickMapCtrl::IGetDesiredCursor( void ) const
uint32_t pfGUIClickMapCtrl::IGetDesiredCursor( void ) const
{
if( fCustomCursor != -1 )
return (UInt32)fCustomCursor;
return (uint32_t)fCustomCursor;
return plInputInterface::kCursorPoised;
}

View File

@ -58,11 +58,11 @@ class pfGUIClickMapCtrl : public pfGUIControlMod
hsPoint3 fLastMousePt, fLastMouseUpPt, fLastMouseDragPt;
hsBool fTracking;
Int32 fCustomCursor;
int32_t fCustomCursor;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
@ -85,10 +85,10 @@ class pfGUIClickMapCtrl : public pfGUIControlMod
kMouseHovered
};
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers );
virtual hsBool MsgReceive( plMessage* pMsg );
@ -99,7 +99,7 @@ class pfGUIClickMapCtrl : public pfGUIControlMod
const hsPoint3 &GetLastMouseUpPt( void ) const { return fLastMouseUpPt; }
const hsPoint3 &GetLastMouseDragPt( void ) const { return fLastMouseDragPt; }
void SetCustomCursor( Int32 cursor = -1 ) { fCustomCursor = cursor; }
void SetCustomCursor( int32_t cursor = -1 ) { fCustomCursor = cursor; }
};
#endif // _pfGUIClickMapCtrl_h

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIControlHandlers.h"
#include "pfGUIControlMod.h"
#include "pfGUIDialogMod.h"
@ -72,20 +72,20 @@ pfGUICtrlProcWriteableObject *pfGUICtrlProcWriteableObject::Read( hsStream *s )
{
pfGUICtrlProcWriteableObject *obj;
UInt32 type = s->ReadLE32();
uint32_t type = s->ReadLE32();
switch( type )
{
case kConsoleCmd:
obj = TRACKED_NEW pfGUIConsoleCmdProc;
obj = new pfGUIConsoleCmdProc;
break;
case kPythonScript:
obj = TRACKED_NEW pfGUIPythonScriptProc;
obj = new pfGUIPythonScriptProc;
break;
case kCloseDlg:
obj = TRACKED_NEW pfGUICloseDlgProc;
obj = new pfGUICloseDlgProc;
break;
case kNull:
@ -128,7 +128,7 @@ void pfGUIConsoleCmdProc::IRead( hsStream *s )
int i = s->ReadLE32();
if( i > 0 )
{
fCommand = TRACKED_NEW char[ i + 1 ];
fCommand = new char[ i + 1 ];
memset( fCommand, 0, i + 1 );
s->Read( i, fCommand );
}
@ -151,7 +151,7 @@ void pfGUIConsoleCmdProc::DoSomething( pfGUIControlMod *ctrl )
{
if( fCommand != nil )
{
plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kExecuteLine, fCommand );
plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kExecuteLine, fCommand );
plgDispatch::MsgSend( cMsg );
}
}
@ -164,7 +164,7 @@ void pfGUIConsoleCmdProc::SetCommand( const char *cmd )
fCommand = nil;
else
{
fCommand = TRACKED_NEW char[ strlen( cmd ) + 1 ];
fCommand = new char[ strlen( cmd ) + 1 ];
memset( fCommand, 0, strlen( cmd ) + 1 );
strcpy( fCommand, cmd );
}

View File

@ -81,7 +81,7 @@ class pfGUICtrlProcObject
{
protected:
UInt32 fRefCnt;
uint32_t fRefCnt;
public:
@ -90,9 +90,9 @@ class pfGUICtrlProcObject
virtual void DoSomething( pfGUIControlMod *ctrl ) = 0;
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) { ; }
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event ) { ; }
virtual void UserCallback( UInt32 userValue ) { ; }
virtual void UserCallback( uint32_t userValue ) { ; }
// ONLY THE GUI SYSTEM SHOULD CALL THESE
void IncRef( void ) { fRefCnt++; }
@ -110,7 +110,7 @@ class pfGUICtrlProcWriteableObject : public pfGUICtrlProcObject
{
protected:
UInt32 fType;
uint32_t fType;
virtual void IRead( hsStream *s ) = 0;
virtual void IWrite( hsStream *s ) = 0;
@ -126,7 +126,7 @@ class pfGUICtrlProcWriteableObject : public pfGUICtrlProcObject
};
pfGUICtrlProcWriteableObject() { fType = kNull; }
pfGUICtrlProcWriteableObject( UInt32 type ) : fType( type ) { ; }
pfGUICtrlProcWriteableObject( uint32_t type ) : fType( type ) { ; }
virtual ~pfGUICtrlProcWriteableObject() { ; }
virtual void DoSomething( pfGUIControlMod *ctrl ) = 0;

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIControlMod.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
@ -107,7 +107,7 @@ pfGUIColorScheme::pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backCol
fBackColor = backColor;
}
pfGUIColorScheme::pfGUIColorScheme( const char *face, UInt8 size, UInt8 fontFlags )
pfGUIColorScheme::pfGUIColorScheme( const char *face, uint8_t size, uint8_t fontFlags )
{
IReset();
fFontFace = hsStrcpy( face );
@ -180,7 +180,7 @@ pfGUIControlMod::~pfGUIControlMod()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIControlMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIControlMod::IEval( double secs, float del, uint32_t dirty )
{
// UpdateBounds();
return false;
@ -205,13 +205,13 @@ void pfGUIControlMod::SetTransform( const hsMatrix44 &l2w, const hsMatrix44 &
//// GetVectorAngle //////////////////////////////////////////////////////////
static hsScalar GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, const hsPoint3 &pointB )
static float GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, const hsPoint3 &pointB )
{
hsVector3 vectorA( &pointA, &basePt ), vectorB( &pointB, &basePt );
hsScalar dot = vectorA * vectorB;
float dot = vectorA * vectorB;
hsVector3 cross = vectorA % vectorB;
hsScalar crossLen = cross.fZ;
float crossLen = cross.fZ;
return atan2( crossLen, dot );
}
@ -225,7 +225,7 @@ static hsScalar GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA,
static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints )
{
int i, j, pointA, pointB, pointC;
hsScalar *angles;
float *angles;
if( numPoints < 3 )
return false;
@ -246,7 +246,7 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints )
// Step 2: Sort all the in points by the angle to the X axis (vector <1,0>).
// Step A: Calculate all the angles
angles = TRACKED_NEW hsScalar[ numPoints ];
angles = new float[ numPoints ];
hsPoint3 xAxisPoint( avgPoint.fX + 1, avgPoint.fY, avgPoint.fZ );
for( i = 0; i < numPoints; i++ )
angles[ i ] = GetVectorAngle( avgPoint, inPoints[ i ], xAxisPoint );
@ -258,7 +258,7 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints )
{
if( angles[ j ] < angles[ i ] )
{
hsScalar tempAngle = angles[ j ];
float tempAngle = angles[ j ];
angles[ j ] = angles[ i ];
angles[ i ] = tempAngle;
@ -283,12 +283,12 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints )
pointB += numPoints;
// For points A, B, and C, find the interior angle between them
hsScalar angle = GetVectorAngle( inPoints[ pointB ], inPoints[ pointA ], inPoints[ pointC ] );
float angle = GetVectorAngle( inPoints[ pointB ], inPoints[ pointA ], inPoints[ pointC ] );
// If the angle is < 180, then it's a good angle and we can advance all our points by 1...
// Note: we have a tolerance so that we don't get points that form edges that are pretty darned close...
const hsScalar tolerance = hsScalarPI / 90.f;
if( angle > tolerance && angle < hsScalarPI - tolerance )
const float tolerance = M_PI / 90.f;
if( angle > tolerance && angle < M_PI - tolerance )
{
pointA++;
pointB++;
@ -336,7 +336,7 @@ static void GetObjectPoints( plSceneObject *so, hsTArray<hsPoint3> &outPoints )
return;
// The following uses mf's spiffy plAccessGeometry/Spans stuff, which, in
// one word, kicksAss.
// one uint16_t, kicksAss.
hsTArray<plAccessSpan> spans;
plAccessGeometry::Instance()->OpenRO( di, spans );
@ -526,7 +526,7 @@ void pfGUIControlMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force
// Given the x/y coordinates in 0..1 space, recalcs the sceneObject position
// and moves the object to match, retaining the stored fCenterZ coordinate
void pfGUIControlMod::SetObjectCenter( hsScalar x, hsScalar y )
void pfGUIControlMod::SetObjectCenter( float x, float y )
{
hsMatrix44 xformMatrix, l2p, p2l;
hsPoint3 center, corners[ 8 ];
@ -656,7 +656,7 @@ hsBool pfGUIControlMod::ISetUpDynTextMap( plPipeline *pipe )
if( fDynTextLayer == nil || fInitialBounds.GetType() == kBoundsUninitialized )//|| fDialog == nil )
return false;
UInt32 scrnWidth, scrnHeight;
uint32_t scrnWidth, scrnHeight;
if( !HasFlag( kScaleTextWithResolution ) )
{
// Scale so that there is a 1:1 pixel:textel ratio
@ -677,12 +677,12 @@ hsBool pfGUIControlMod::ISetUpDynTextMap( plPipeline *pipe )
}
const hsBounds3 &bounds = fInitialBounds;//GetBounds();
UInt16 width = (UInt16)(( bounds.GetMaxs().fX - bounds.GetMins().fX ) * scrnWidth);
UInt16 height = (UInt16)(( bounds.GetMaxs().fY - bounds.GetMins().fY ) * scrnHeight);
uint16_t width = (uint16_t)(( bounds.GetMaxs().fX - bounds.GetMins().fX ) * scrnWidth);
uint16_t height = (uint16_t)(( bounds.GetMaxs().fY - bounds.GetMins().fY ) * scrnHeight);
// Allow derived controls to allocate some extra scratch space if desired
// (Do it this way so we can pass in our current calculated dimensions for them to play with)
UInt16 extraW = width, extraH = height;
uint16_t extraW = width, extraH = height;
IGrowDTMDimsToDesiredSize( extraW, extraH );
extraW -= width;
extraH -= height;
@ -737,8 +737,8 @@ void pfGUIControlMod::SetColorScheme( pfGUIColorScheme *newScheme )
void pfGUIControlMod::SetDynTextMap( plLayerInterface *layer, plDynamicTextMap *dynText )
{
hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextLayer ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( dynText->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextMap ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextLayer ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( dynText->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextMap ), plRefFlags::kActiveRef );
}
//// SetEnabled //////////////////////////////////////////////////////////////
@ -788,7 +788,7 @@ void pfGUIControlMod::SetVisible( hsBool vis )
fVisible = vis;
if (fTarget)
{
plEnableMsg *msg = TRACKED_NEW plEnableMsg();
plEnableMsg *msg = new plEnableMsg();
msg->SetCmd( fVisible ? plEnableMsg::kEnable : plEnableMsg::kDisable );
msg->SetCmd( plEnableMsg::kDrawable );
msg->AddReceiver( fTarget->GetKey() );
@ -818,8 +818,8 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr )
// Read in the dynTextMap if there is one
if( s->ReadBool() )
{
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextLayer ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextMap ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextLayer ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextMap ), plRefFlags::kActiveRef );
}
else
{
@ -830,12 +830,12 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr )
if( s->ReadBool() )
{
SetColorScheme( nil );
fColorScheme = TRACKED_NEW pfGUIColorScheme();
fColorScheme = new pfGUIColorScheme();
fColorScheme->Read( s );
}
// Read in our sound indices
UInt8 i, count = s->ReadByte();
uint8_t i, count = s->ReadByte();
if( count == 0 )
fSoundIndices.Reset();
else
@ -846,9 +846,9 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr )
}
if( HasFlag( kHasProxy ) )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefProxy ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefProxy ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
}
void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr )
@ -883,7 +883,7 @@ void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr )
// Write out our sound indices
s->WriteByte( fSoundIndices.GetCount() );
UInt8 i;
uint8_t i;
for( i = 0; i < fSoundIndices.GetCount(); i++ )
s->WriteLE32( fSoundIndices[ i ] );
@ -895,12 +895,12 @@ void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr )
//// HandleKeyPress/Event ////////////////////////////////////////////////////
hsBool pfGUIControlMod::HandleKeyPress( wchar_t key, UInt8 modifiers )
hsBool pfGUIControlMod::HandleKeyPress( wchar_t key, uint8_t modifiers )
{
return false;
}
hsBool pfGUIControlMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers )
hsBool pfGUIControlMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers )
{
return false;
}
@ -942,7 +942,7 @@ void pfGUIControlMod::DoSomething( void )
//// HandleExtendedEvent /////////////////////////////////////////////////////
void pfGUIControlMod::HandleExtendedEvent( UInt32 event )
void pfGUIControlMod::HandleExtendedEvent( uint32_t event )
{
if( fEnabled && fHandler != nil )
fHandler->HandleExtendedEvent( this, event );
@ -964,7 +964,7 @@ void pfGUIControlMod::SetDropTargetHdlr( pfGUIDropTargetProc *h )
// Associates the given GUI event with an index of a sound on the target SO's
// audioInterface. The guiCtrlEvent is specific to each type of control.
void pfGUIControlMod::SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex )
void pfGUIControlMod::SetSoundIndex( uint8_t guiCtrlEvent, int soundIndex )
{
if( fSoundIndices.GetCount() < guiCtrlEvent + 1 )
fSoundIndices.ExpandAndZero( guiCtrlEvent + 1 );
@ -976,7 +976,7 @@ void pfGUIControlMod::SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex )
// Sends a sound play message with the soundIndex associated with the given
// event.
void pfGUIControlMod::IPlaySound( UInt8 guiCtrlEvent, hsBool loop /* = false */ )
void pfGUIControlMod::IPlaySound( uint8_t guiCtrlEvent, hsBool loop /* = false */ )
{
if( guiCtrlEvent >= fSoundIndices.GetCount() || fSoundIndices[ guiCtrlEvent ] == 0 )
return;
@ -984,7 +984,7 @@ void pfGUIControlMod::IPlaySound( UInt8 guiCtrlEvent, hsBool loop /* = false
if( GetTarget() == nil || GetTarget()->GetAudioInterface() == nil )
return;
plSoundMsg *msg = TRACKED_NEW plSoundMsg;
plSoundMsg *msg = new plSoundMsg;
msg->fIndex = fSoundIndices[ guiCtrlEvent ] - 1;
msg->SetCmd( plSoundMsg::kGoToTime );
msg->fTime = 0.f;
@ -997,7 +997,7 @@ void pfGUIControlMod::IPlaySound( UInt8 guiCtrlEvent, hsBool loop /* = false
msg->Send( GetTarget()->GetAudioInterface()->GetKey() );
}
void pfGUIControlMod::IStopSound(UInt8 guiCtrlEvent)
void pfGUIControlMod::IStopSound(uint8_t guiCtrlEvent)
{
if (guiCtrlEvent >= fSoundIndices.GetCount() || fSoundIndices[guiCtrlEvent] == 0)
return;
@ -1005,7 +1005,7 @@ void pfGUIControlMod::IStopSound(UInt8 guiCtrlEvent)
if (GetTarget() == nil || GetTarget()->GetAudioInterface() == nil )
return;
plSoundMsg *msg = TRACKED_NEW plSoundMsg;
plSoundMsg *msg = new plSoundMsg;
msg->fIndex = fSoundIndices[guiCtrlEvent] - 1;
msg->SetCmd(plSoundMsg::kStop);
msg->Send(GetTarget()->GetAudioInterface()->GetKey());

View File

@ -75,8 +75,8 @@ class pfGUIColorScheme : public hsRefCnt
hsBool fTransparent;
char *fFontFace;
UInt8 fFontSize;
UInt8 fFontFlags;
uint8_t fFontSize;
uint8_t fFontFlags;
enum FontFlags
{
@ -88,7 +88,7 @@ class pfGUIColorScheme : public hsRefCnt
pfGUIColorScheme();
~pfGUIColorScheme();
pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backColor );
pfGUIColorScheme( const char *face, UInt8 size, UInt8 fontFlags );
pfGUIColorScheme( const char *face, uint8_t size, uint8_t fontFlags );
void SetFontFace( const char *face );
@ -113,13 +113,13 @@ class pfGUIControlMod : public plSingleModifier
protected:
UInt32 fTagID;
uint32_t fTagID;
hsBool fEnabled, fFocused, fVisible, fInteresting;
hsBool fNotifyOnInteresting;
pfGUIDialogMod *fDialog;
hsBounds3 fBounds, fInitialBounds; // Z component is 0-1
hsScalar fScreenMinZ; // Closest Z coordinate in screen space
float fScreenMinZ; // Closest Z coordinate in screen space
hsPoint3 fScreenCenter;
hsBool fBoundsValid, fCenterValid;
hsMatrix44 fXformMatrix; // Only used for doing drag work, etc.
@ -142,9 +142,9 @@ class pfGUIControlMod : public plSingleModifier
hsBool ISetUpDynTextMap( plPipeline *pipe );
virtual void IPostSetUpDynTextMap( void ) {}
virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height ) { }
virtual void IGrowDTMDimsToDesiredSize( uint16_t &width, uint16_t &height ) { }
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
void ISetDialog( pfGUIDialogMod *mod ) { fDialog = mod; }
void IScreenToLocalPt( hsPoint3 &pt );
@ -152,10 +152,10 @@ class pfGUIControlMod : public plSingleModifier
virtual void IUpdate( void ) {;}
void ISetHandler( pfGUICtrlProcObject *h, hsBool clearInheritFlag = false );
void IPlaySound( UInt8 guiCtrlEvent, hsBool loop = false );
void IStopSound( UInt8 guiCtrlEvent );
void IPlaySound( uint8_t guiCtrlEvent, hsBool loop = false );
void IStopSound( uint8_t guiCtrlEvent );
virtual UInt32 IGetDesiredCursor( void ) const { return 0; } // As specified in plInputInterface.h
virtual uint32_t IGetDesiredCursor( void ) const { return 0; } // As specified in plInputInterface.h
public:
@ -171,7 +171,7 @@ class pfGUIControlMod : public plSingleModifier
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
UInt32 GetTagID( void ) { return fTagID; }
uint32_t GetTagID( void ) { return fTagID; }
virtual void SetEnabled( hsBool e );
virtual hsBool IsEnabled( void ) { return fEnabled; }
@ -190,9 +190,9 @@ class pfGUIControlMod : public plSingleModifier
virtual void Refresh( void );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
void SetObjectCenter( hsScalar x, hsScalar y );
void SetObjectCenter( float x, float y );
virtual hsPoint3 GetObjectCenter() { return fScreenCenter; }
hsScalar GetScreenMinZ( void ) { return fScreenMinZ; }
float GetScreenMinZ( void ) { return fScreenMinZ; }
void CalcInitialBounds( void );
const hsBounds3 &GetBounds( void );
@ -203,18 +203,18 @@ class pfGUIControlMod : public plSingleModifier
// Return false if you actually DON'T want the mouse clicked at this point (should only be used for non-rectangular region rejection)
virtual hsBool FilterMousePosition( hsPoint3 &mousePt ) { return true; }
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) {;}
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) {;}
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) {;}
virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ) {;}
virtual void HandleMouseDblClick( hsPoint3 &mousePt, uint8_t modifiers ) {;}
virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers );
void SetHandler( pfGUICtrlProcObject *h ) { ISetHandler( h, true ); }
void DoSomething( void ); // Will call the handler
void HandleExtendedEvent( UInt32 event ); // Will call the handler
void HandleExtendedEvent( uint32_t event ); // Will call the handler
pfGUICtrlProcObject *GetHandler( void ) const { return fHandler; }
@ -254,13 +254,13 @@ class pfGUIControlMod : public plSingleModifier
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l);
// Forces an immediate play of the given GUI control event sound
void PlaySound( UInt8 guiCtrlEvent, hsBool loop = false ) { IPlaySound( guiCtrlEvent, loop ); }
void StopSound( UInt8 guiCtrlEvent ) { IStopSound( guiCtrlEvent ); }
void PlaySound( uint8_t guiCtrlEvent, hsBool loop = false ) { IPlaySound( guiCtrlEvent, loop ); }
void StopSound( uint8_t guiCtrlEvent ) { IStopSound( guiCtrlEvent ); }
// Export only
void SetTagID( UInt32 id ) { fTagID = id; }
void SetTagID( uint32_t id ) { fTagID = id; }
void SetDynTextMap( plLayerInterface *layer, plDynamicTextMap *dynText );
void SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex );
void SetSoundIndex( uint8_t guiCtrlEvent, int soundIndex );
};
#endif // _pfGUIControlMod_h

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUICtrlGenerator.h"
#include "pfGameGUIMgr.h"
#include "pfGUIControlMod.h"
@ -124,7 +124,7 @@ pfGUICtrlGenerator &pfGUICtrlGenerator::Instance( void )
plString pfGUICtrlGenerator::IGetNextKeyName( const char *prefix )
{
static UInt32 keyCount = 0;
static uint32_t keyCount = 0;
return plString::Format( "%s%d", prefix, keyCount++ );
}
@ -141,7 +141,7 @@ plKey pfGUICtrlGenerator::IAddKey( hsKeyedObject *ko, const char *prefix )
//// SetFont /////////////////////////////////////////////////////////////////
void pfGUICtrlGenerator::SetFont( const char *face, UInt16 size )
void pfGUICtrlGenerator::SetFont( const char *face, uint16_t size )
{
strcpy( fFontFace, face );
fFontSize = size;
@ -156,7 +156,7 @@ hsGMaterial *pfGUICtrlGenerator::ICreateSolidMaterial( hsColorRGBA &color )
// Create a material with a simple blank layer, fully ambient
hsGMaterial *material = TRACKED_NEW hsGMaterial;
hsGMaterial *material = new hsGMaterial;
IAddKey( material, "GUIMaterial" );
plLayer *lay = material->MakeBaseLayer();
@ -175,22 +175,22 @@ hsGMaterial *pfGUICtrlGenerator::ICreateSolidMaterial( hsColorRGBA &color )
hsGMaterial *pfGUICtrlGenerator::ICreateTextMaterial( const char *text, hsColorRGBA &bgColor,
hsColorRGBA &textColor, float objWidth, float objHeight )
{
UInt16 pixWidth, pixHeight, strWidth, strHeight;
uint16_t pixWidth, pixHeight, strWidth, strHeight;
hsColorRGBA black, white;
// Guess at some pixel width and heights we want. We're guessing b/c we want it to look reasonably
// good on the screen, but we don't know exactly how big is big, so we guess
pixWidth = (UInt16)(objWidth * 64.f);
pixHeight = (UInt16)(objHeight * 64.f);
pixWidth = (uint16_t)(objWidth * 64.f);
pixHeight = (uint16_t)(objHeight * 64.f);
// Create blank mipmap
plMipmap *bitmap = TRACKED_NEW plMipmap( 1, 1, plMipmap::kRGB32Config, 1 );
plMipmap *bitmap = new plMipmap( 1, 1, plMipmap::kRGB32Config, 1 );
IAddKey( bitmap, "GUIMipmap" );
// Create textGen to write string with
plTextGenerator *textGen = TRACKED_NEW plTextGenerator( bitmap, pixWidth, pixHeight );
textGen->SetFont( fFontFace, (UInt16)fFontSize );
plTextGenerator *textGen = new plTextGenerator( bitmap, pixWidth, pixHeight );
textGen->SetFont( fFontFace, (uint16_t)fFontSize );
textGen->ClearToColor( bgColor );
textGen->SetTextColor( textColor );
strWidth = textGen->CalcStringWidth( text, &strHeight );
@ -199,7 +199,7 @@ hsGMaterial *pfGUICtrlGenerator::ICreateTextMaterial( const char *text, hsColorR
fTextGens.Append( textGen );
// Create a material with a simple blank layer, fully ambient
hsGMaterial *material = TRACKED_NEW hsGMaterial;
hsGMaterial *material = new hsGMaterial;
IAddKey( material, "GUIMaterial" );
plLayer *lay = material->MakeBaseLayer();
@ -210,7 +210,7 @@ hsGMaterial *pfGUICtrlGenerator::ICreateTextMaterial( const char *text, hsColorR
lay->SetPreshadeColor( black );
lay->SetAmbientColor( white );
hsgResMgr::ResMgr()->AddViaNotify( bitmap->GetKey(), TRACKED_NEW plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( bitmap->GetKey(), new plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef );
// lay->SetTexture( bitmap );
lay->SetTransform( textGen->GetLayerTransform() );
@ -233,20 +233,20 @@ plSceneObject *pfGUICtrlGenerator::IGenSceneObject( pfGUIDialogMod *dlg, plDra
if( snKey == nil )
snKey = fDynDlgNodes.Peek()->GetKey();
hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), TRACKED_NEW plNodeRefMsg( snKey, plRefMsg::kOnCreate, 0, plNodeRefMsg::kDrawable ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), new plNodeRefMsg( snKey, plRefMsg::kOnCreate, 0, plNodeRefMsg::kDrawable ), plRefFlags::kActiveRef );
plDrawInterface *newDI = TRACKED_NEW plDrawInterface;
plDrawInterface *newDI = new plDrawInterface;
IAddKey( newDI, "GUIDrawIFace" );
plSceneObject *newObj = TRACKED_NEW plSceneObject;
plSceneObject *newObj = new plSceneObject;
IAddKey( newObj, "GUISceneObject" );
plCoordinateInterface *newCI = TRACKED_NEW plCoordinateInterface;
plCoordinateInterface *newCI = new plCoordinateInterface;
IAddKey( newCI, "GUICoordIFace" );
hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( newDI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), TRACKED_NEW plIntRefMsg( newDI->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kDrawable ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( newDI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), new plIntRefMsg( newDI->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kDrawable ), plRefFlags::kActiveRef );
if( parent == nil )
{
@ -256,8 +256,8 @@ plSceneObject *pfGUICtrlGenerator::IGenSceneObject( pfGUIDialogMod *dlg, plDra
}
if( parent != nil )
// hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plIntRefMsg( parent->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kChild ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plAttachMsg( parent->GetKey(), nil, plRefMsg::kOnRequest ), plRefFlags::kActiveRef );
// hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plIntRefMsg( parent->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kChild ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plAttachMsg( parent->GetKey(), nil, plRefMsg::kOnRequest ), plRefFlags::kActiveRef );
newObj->SetSceneNode( snKey );
@ -287,7 +287,7 @@ pfGUIButtonMod *pfGUICtrlGenerator::GenerateRectButton( const char *title, floa
pfGUIButtonMod *but = CreateRectButton( dlgToAddTo, title, x, y, width, height, material );
if( but != nil )
but->SetHandler( TRACKED_NEW pfGUIConsoleCmdProc( consoleCmd ) );
but->SetHandler( new pfGUIConsoleCmdProc( consoleCmd ) );
return but;
}
@ -327,11 +327,11 @@ pfGUIButtonMod *pfGUICtrlGenerator::CreateRectButton( pfGUIDialogMod *parent, c
plSceneObject *newObj = IGenSceneObject( parent, myDraw );
pfGUIButtonMod *newBtn = asMenuItem ? TRACKED_NEW pfGUIMenuItem : TRACKED_NEW pfGUIButtonMod;
pfGUIButtonMod *newBtn = asMenuItem ? new pfGUIMenuItem : new pfGUIButtonMod;
IAddKey( newBtn, "GUIButton" );
hsgResMgr::ResMgr()->SendRef( newBtn->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( newBtn->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
parent->AddControl( newBtn );
hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), TRACKED_NEW plGenRefMsg( parent->GetKey(), plRefMsg::kOnCreate, parent->GetNumControls() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), new plGenRefMsg( parent->GetKey(), plRefMsg::kOnCreate, parent->GetNumControls() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef );
return newBtn;
}
@ -371,10 +371,10 @@ pfGUIButtonMod *pfGUICtrlGenerator::GenerateSphereButton( float x, float y, flo
plSceneObject *newObj = IGenSceneObject( dlgToAddTo, myDraw );//, nil, &l2w, &w2l );
pfGUIButtonMod *newBtn = TRACKED_NEW pfGUIButtonMod;
pfGUIButtonMod *newBtn = new pfGUIButtonMod;
IAddKey( newBtn, "GUIButton" );
newBtn->SetHandler( TRACKED_NEW pfGUIConsoleCmdProc( consoleCmd ) );
hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
newBtn->SetHandler( new pfGUIConsoleCmdProc( consoleCmd ) );
hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
dlgToAddTo->AddControl( newBtn );
return newBtn;
@ -418,9 +418,9 @@ pfGUIDragBarCtrl *pfGUICtrlGenerator::GenerateDragBar( float x, float y, float w
fDynDragBars[ fDynDragBars.GetCount() - 1 ] = newObj;
pfGUIDragBarCtrl *newBtn = TRACKED_NEW pfGUIDragBarCtrl;
pfGUIDragBarCtrl *newBtn = new pfGUIDragBarCtrl;
IAddKey( newBtn, "GUIDragBar" );
hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
dlgToAddTo->AddControl( newBtn );
/* vec.Set( -x, y, 100 );
@ -454,7 +454,7 @@ pfGUIDialogMod *pfGUICtrlGenerator::IGenerateDialog( const char *name, float sc
// Create the rendermod
plPostEffectMod *renderMod = TRACKED_NEW plPostEffectMod;
plPostEffectMod *renderMod = new plPostEffectMod;
IAddKey( renderMod, "GUIRenderMod" );
renderMod->SetHither( 0.5f );
@ -464,31 +464,31 @@ pfGUIDialogMod *pfGUICtrlGenerator::IGenerateDialog( const char *name, float sc
fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f;
fovY = fovX;// * 3.f / 4.f;
renderMod->SetFovX( fovX * 180.f / hsScalarPI );
renderMod->SetFovY( fovY * 180.f / hsScalarPI );
renderMod->SetFovX( fovX * 180.f / M_PI );
renderMod->SetFovY( fovY * 180.f / M_PI );
// Create the sceneNode to go with it
node = TRACKED_NEW plSceneNode;
node = new plSceneNode;
IAddKey( node, "GUISceneNode" );
node->GetKey()->RefObject();
fDynDlgNodes.Append( node );
fDynDragBars.Append( nil );
hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), TRACKED_NEW plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef );
hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), new plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef );
// Create the dialog
dialog = TRACKED_NEW pfGUIDialogMod;
dialog = new pfGUIDialogMod;
IAddKey( dialog, "GUIDialog" );
dialog->SetRenderMod( renderMod );
dialog->SetName( name );
// Create the dummy scene object to hold the dialog
plSceneObject *newObj = TRACKED_NEW plSceneObject;
plSceneObject *newObj = new plSceneObject;
IAddKey( newObj, "GUISceneObject" );
// *#&$(*@&#$ need a coordIface...
plCoordinateInterface *newCI = TRACKED_NEW plCoordinateInterface;
plCoordinateInterface *newCI = new plCoordinateInterface;
IAddKey( newCI, "GUICoordIFace" );
hsMatrix44 l2w, w2l;
@ -499,13 +499,13 @@ pfGUIDialogMod *pfGUICtrlGenerator::IGenerateDialog( const char *name, float sc
// Using SendRef here because AddViaNotify will queue the messages up, which doesn't do us any good
// if we need these refs right away
hsgResMgr::ResMgr()->SendRef( dialog->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( dialog->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( newCI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( newCI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
// Add the dialog to the GUI mgr
plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(),
plGenRefMsg *refMsg = new plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(),
plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef );
hsgResMgr::ResMgr()->AddViaNotify( dialog->GetKey(), refMsg, plRefFlags::kActiveRef );

View File

@ -75,7 +75,7 @@ class pfGUICtrlGenerator
protected:
char fFontFace[ 256 ];
UInt32 fFontSize;
uint32_t fFontSize;
hsTArray<plTextGenerator *> fTextGens;
@ -104,7 +104,7 @@ class pfGUICtrlGenerator
void Shutdown( void );
void SetFont( const char *face, UInt16 size );
void SetFont( const char *face, uint16_t size );
pfGUIButtonMod *GenerateRectButton( const char *title, float x, float y, float width, float height,

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "pfGUIControlMod.h"
@ -88,7 +88,7 @@ pfGUIDialogMod::pfGUIDialogMod() : fRenderMod( nil ), fNext( nil ), fPrevPtr( ni
fDragTarget = nil;
fProcReceiver = nil;
fColorScheme = TRACKED_NEW pfGUIColorScheme();
fColorScheme = new pfGUIColorScheme();
}
pfGUIDialogMod::~pfGUIDialogMod()
@ -102,7 +102,7 @@ pfGUIDialogMod::~pfGUIDialogMod()
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
if( mgrKey )
{
plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( mgrKey, plRefMsg::kOnRemove, 0, pfGameGUIMgr::kDlgModRef );
plGenRefMsg *refMsg = new plGenRefMsg( mgrKey, plRefMsg::kOnRemove, 0, pfGameGUIMgr::kDlgModRef );
refMsg->SetRef( this );
plgDispatch::MsgSend( refMsg );
}
@ -117,7 +117,7 @@ pfGUIDialogMod::~pfGUIDialogMod()
// Sometimes it just sucks not having access to the pipeline at just the
// right time.
void pfGUIDialogMod::ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt )
void pfGUIDialogMod::ScreenToWorldPoint( float x, float y, float z, hsPoint3 &outPt )
{
plViewTransform view = fRenderMod->GetViewTransform();
view.SetScreenSize( 1, 1 );
@ -141,7 +141,7 @@ hsPoint3 pfGUIDialogMod::WorldToScreenPoint( const hsPoint3 &inPt )
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDialogMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIDialogMod::IEval( double secs, float del, uint32_t dirty )
{
return false;
}
@ -163,14 +163,14 @@ hsBool pfGUIDialogMod::MsgReceive( plMessage *msg )
if( fEnabled )
{
plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil );
plAnimCmdMsg *animMsg = new plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil );
animMsg->SetCmd( plAnimCmdMsg::kContinue );
plgDispatch::MsgSend( animMsg );
}
}
else if( ref->GetContext() & ( plRefMsg::kOnRemove | plRefMsg::kOnDestroy ) )
{
plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil );
plAnimCmdMsg *animMsg = new plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil );
animMsg->SetCmd( plAnimCmdMsg::kStop );
plgDispatch::MsgSend( animMsg );
@ -235,7 +235,7 @@ void pfGUIDialogMod::AddControl( pfGUIControlMod *ctrl )
void pfGUIDialogMod::AddControlOnExport( pfGUIControlMod *ctrl )
{
fControls.Append( ctrl );
hsgResMgr::ResMgr()->AddViaNotify( ctrl->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fControls.GetCount() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( ctrl->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fControls.GetCount() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef );
}
//// SetEnabled //////////////////////////////////////////////////////////////
@ -271,7 +271,7 @@ void pfGUIDialogMod::SetEnabled( hsBool e )
if( fRenderMod != nil )
{
plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil );
plAnimCmdMsg *animMsg = new plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil );
if( fEnabled )
{
animMsg->SetCmd( plAnimCmdMsg::kContinue );
@ -292,21 +292,21 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr )
{
plSingleModifier::Read(s, mgr);
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRenderModRef ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRenderModRef ), plRefFlags::kActiveRef );
s->Read( sizeof( fName ), fName );
UInt32 i, count = s->ReadLE32();
uint32_t i, count = s->ReadLE32();
fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kControlRef ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kControlRef ), plRefFlags::kActiveRef );
// Register us with the Game GUI manager
plUoid lu( kGameGUIMgr_KEY );
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
if( mgrKey )
{
plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( mgrKey, plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef );
plGenRefMsg *refMsg = new plGenRefMsg( mgrKey, plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef );
hsgResMgr::ResMgr()->AddViaNotify( GetKey(), refMsg, plRefFlags::kPassiveRef );
}
@ -314,7 +314,7 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr )
fProcReceiver = mgr->ReadKey( s );
if( fProcReceiver != nil )
SetHandler( TRACKED_NEW pfGUIDialogNotifyProc( fProcReceiver ) );
SetHandler( new pfGUIDialogNotifyProc( fProcReceiver ) );
s->ReadLE( &fVersion );
@ -325,7 +325,7 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr )
void pfGUIDialogMod::Write( hsStream *s, hsResMgr *mgr )
{
UInt32 i;
uint32_t i;
plSingleModifier::Write( s, mgr );
@ -364,7 +364,7 @@ plKey pfGUIDialogMod::GetSceneNodeKey( void )
// Really. We go through and make sure every control marked as interesting
// still has the mouse inside it and vice versa.
void pfGUIDialogMod::UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, hsBool modalPreset )
void pfGUIDialogMod::UpdateInterestingThings( float mouseX, float mouseY, uint8_t modifiers, hsBool modalPreset )
{
int i;
hsPoint3 mousePoint;
@ -405,21 +405,21 @@ void pfGUIDialogMod::UpdateInterestingThings( hsScalar mouseX, hsScalar mouse
#include "plPipeline/plDebugText.h"
#endif
hsBool pfGUIDialogMod::HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY,
UInt8 modifiers )
hsBool pfGUIDialogMod::HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY,
uint8_t modifiers )
{
hsPoint3 mousePoint;
UInt32 i;
uint32_t i;
pfGUIControlMod *oldInterestingCtrl = nil;
hsScalar smallestZ;
float smallestZ;
#ifdef HS_DEBUGGING // Debugging bounds rects
static bool showBounds = false;
if( showBounds )
{
UInt32 sW, sH;
uint32_t sW, sH;
plDebugText::Instance().GetScreenSize(&sW,&sH);
for( i = 0; i < fControls.GetCount(); i++ )
{
@ -431,30 +431,30 @@ static bool showBounds = false;
if( fControls[ i ]->fBoundsPoints.GetCount() > 0 )
{
const hsBounds3 &bnds = fControls[ i ]->GetBounds();
plDebugText::Instance().Draw3DBorder( (UInt16)(sW * bnds.GetMins().fX),
(UInt16)(sH * bnds.GetMins().fY),
(UInt16)(sW * bnds.GetMaxs().fX),
(UInt16)(sH * bnds.GetMaxs().fY), 0x3000ffff, 0x3000ffff );
plDebugText::Instance().Draw3DBorder( (uint16_t)(sW * bnds.GetMins().fX),
(uint16_t)(sH * bnds.GetMins().fY),
(uint16_t)(sW * bnds.GetMaxs().fX),
(uint16_t)(sH * bnds.GetMaxs().fY), 0x3000ffff, 0x3000ffff );
UInt32 color = 0xffff0000;
uint32_t color = 0xffff0000;
for( int j = 0; j < fControls[ i ]->fBoundsPoints.GetCount(); j++ )
{
// color = 0xff000000 | ( ( j * 16 ) << 16 );
float x = sW * fControls[ i ]->fBoundsPoints[ j ].fX;
float y = sH * fControls[ i ]->fBoundsPoints[ j ].fY;
plDebugText::Instance().DrawRect( (UInt16)(x - 2), (UInt16)(y - 2), (UInt16)(x + 2), (UInt16)(y + 2), color );
plDebugText::Instance().DrawRect( (uint16_t)(x - 2), (uint16_t)(y - 2), (uint16_t)(x + 2), (uint16_t)(y + 2), color );
char str[ 16 ];
snprintf(str, 16, "%d", j);
plDebugText::Instance().DrawString( (UInt16)(x + 8), (UInt16)(y - 8), str, color );
plDebugText::Instance().DrawString( (uint16_t)(x + 8), (uint16_t)(y - 8), str, color );
}
}
else
{
const hsBounds3 &bnds = fControls[ i ]->GetBounds();
plDebugText::Instance().Draw3DBorder( (UInt16)(sW * bnds.GetMins().fX),
(UInt16)(sH * bnds.GetMins().fY),
(UInt16)(sW * bnds.GetMaxs().fX),
(UInt16)(sH * bnds.GetMaxs().fY), 0x300000ff, 0x300000ff );
plDebugText::Instance().Draw3DBorder( (uint16_t)(sW * bnds.GetMins().fX),
(uint16_t)(sH * bnds.GetMins().fY),
(uint16_t)(sW * bnds.GetMaxs().fX),
(uint16_t)(sH * bnds.GetMaxs().fY), 0x300000ff, 0x300000ff );
}
}
}
@ -498,7 +498,7 @@ static bool showBounds = false;
if( showBounds )
{
const hsBounds3 &bnds = fMousedCtrl->GetBounds();
plDebugText::Instance().DrawString( (UInt16)(bnds.GetMins().fX), (UInt16)(bnds.GetMins().fY), fMousedCtrl->GetKeyName(), (UInt32)0xffffff00 );
plDebugText::Instance().DrawString( (uint16_t)(bnds.GetMins().fX), (uint16_t)(bnds.GetMins().fY), fMousedCtrl->GetKeyName(), (uint32_t)0xffffff00 );
}
#endif
@ -554,7 +554,7 @@ if( showBounds )
//// HandleKeyEvent //////////////////////////////////////////////////////////
hsBool pfGUIDialogMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers )
hsBool pfGUIDialogMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers )
{
// Only process if a control has focus...
if( fFocusCtrl != nil )
@ -567,7 +567,7 @@ hsBool pfGUIDialogMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKey
//// HandleKeyPress //////////////////////////////////////////////////////////
hsBool pfGUIDialogMod::HandleKeyPress( wchar_t key, UInt8 modifiers )
hsBool pfGUIDialogMod::HandleKeyPress( wchar_t key, uint8_t modifiers )
{
// Same deal as HandleKeyPress. Only problem is, we needed the msg to translate
// to a char, so it had to be done up at the mgr level (sadly)
@ -629,7 +629,7 @@ void pfGUIDialogMod::Hide( void )
//// GetControlFromTag ///////////////////////////////////////////////////////
pfGUIControlMod *pfGUIDialogMod::GetControlFromTag( UInt32 tagID )
pfGUIControlMod *pfGUIDialogMod::GetControlFromTag( uint32_t tagID )
{
int i;
@ -696,7 +696,7 @@ void pfGUIDialogMod::SetHandlerForAll( pfGUIDialogProc *hdlr )
//// SetControlHandler ///////////////////////////////////////////////////////
void pfGUIDialogMod::SetControlHandler( UInt32 tagID, pfGUIDialogProc *hdlr )
void pfGUIDialogMod::SetControlHandler( uint32_t tagID, pfGUIDialogProc *hdlr )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
@ -784,10 +784,10 @@ void pfGUIDialogMod::EnterDragMode( pfGUIControlMod *source )
// up, if the control is indeed receptive, we call its drag handler for each
// of our elements, and either way, exit drag mode.
void pfGUIDialogMod::IHandleDrag( hsPoint3 &mousePoint, pfGameGUIMgr::EventType event, UInt8 modifiers )
void pfGUIDialogMod::IHandleDrag( hsPoint3 &mousePoint, pfGameGUIMgr::EventType event, uint8_t modifiers )
{
int i;
hsScalar smallestZ;
float smallestZ;
// First, see if our target control has changed
@ -838,7 +838,7 @@ void pfGUIDialogMod::IHandleDrag( hsPoint3 &mousePoint, pfGameGUIMgr::EventTy
//// GetDesiredCursor ////////////////////////////////////////////////////////
UInt32 pfGUIDialogMod::GetDesiredCursor( void ) const
uint32_t pfGUIDialogMod::GetDesiredCursor( void ) const
{
if( fMousedCtrl != nil )
return fMousedCtrl->IGetDesiredCursor();

View File

@ -67,9 +67,9 @@ class pfGUIDialogMod : public plSingleModifier
protected:
UInt32 fTagID; // 0 if none
uint32_t fTagID; // 0 if none
UInt32 fVersion; // Nice for syncing to C++ code
uint32_t fVersion; // Nice for syncing to C++ code
plPostEffectMod *fRenderMod;
hsBool fEnabled;
@ -91,9 +91,9 @@ class pfGUIDialogMod : public plSingleModifier
plKey fSceneNodeKey;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
void IHandleDrag( hsPoint3 &mousePt, pfGameGUIMgr::EventType event, UInt8 modifiers );
void IHandleDrag( hsPoint3 &mousePt, pfGameGUIMgr::EventType event, uint8_t modifiers );
public:
@ -130,25 +130,25 @@ class pfGUIDialogMod : public plSingleModifier
const char *GetName( void ) { return fName; }
void ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt );
void ScreenToWorldPoint( float x, float y, float z, hsPoint3 &outPt );
hsPoint3 WorldToScreenPoint( const hsPoint3 &inPt );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers );
hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
hsBool HandleKeyPress( wchar_t key, UInt8 modifiers );
void UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, hsBool modalPreset );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers );
hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers );
hsBool HandleKeyPress( wchar_t key, uint8_t modifiers );
void UpdateInterestingThings( float mouseX, float mouseY, uint8_t modifiers, hsBool modalPreset );
void SetControlOfInterest( pfGUIControlMod *c );
pfGUIControlMod *GetControlOfInterest( void ) const { return fControlOfInterest; }
UInt32 GetDesiredCursor( void ) const;
uint32_t GetDesiredCursor( void ) const;
void UpdateAspectRatio( void );
void UpdateAllBounds( void );
void RefreshAllControls( void );
void AddControl( pfGUIControlMod *ctrl );
UInt32 GetNumControls( void ) { return fControls.GetCount(); }
pfGUIControlMod *GetControl( UInt32 idx ) { return fControls[ idx ]; }
uint32_t GetNumControls( void ) { return fControls.GetCount(); }
pfGUIControlMod *GetControl( uint32_t idx ) { return fControls[ idx ]; }
pfGUIColorScheme *GetColorScheme( void ) const { return fColorScheme; }
@ -180,8 +180,8 @@ class pfGUIDialogMod : public plSingleModifier
pfGUIControlMod *GetFocus( void ) { return fFocusCtrl; }
pfGUIDialogMod *GetNext( void ) { return fNext; }
UInt32 GetTagID( void ) { return fTagID; }
pfGUIControlMod *GetControlFromTag( UInt32 tagID );
uint32_t GetTagID( void ) { return fTagID; }
pfGUIControlMod *GetControlFromTag( uint32_t tagID );
void SetHandler( pfGUIDialogProc *hdlr );
pfGUIDialogProc *GetHandler( void ) const { return fHandler; }
@ -192,7 +192,7 @@ class pfGUIDialogMod : public plSingleModifier
void SetHandlerForAll( pfGUIDialogProc *hdlr );
// Just a little macro-type thing here
void SetControlHandler( UInt32 tagID, pfGUIDialogProc *hdlr );
void SetControlHandler( uint32_t tagID, pfGUIDialogProc *hdlr );
/// Methods for doing drag & drop of listElements
@ -200,15 +200,15 @@ class pfGUIDialogMod : public plSingleModifier
void AddToDragList( pfGUIListElement *e );
void EnterDragMode( pfGUIControlMod *source );
UInt32 GetVersion( void ) const { return fVersion; }
uint32_t GetVersion( void ) const { return fVersion; }
// Export only
void SetRenderMod( plPostEffectMod *mod ) { fRenderMod = mod; }
void SetName( const char *name ) { hsStrncpy( fName, name, sizeof( fName ) - 1 ); }
void AddControlOnExport( pfGUIControlMod *ctrl );
void SetTagID( UInt32 id ) { fTagID = id; }
void SetTagID( uint32_t id ) { fTagID = id; }
void SetProcReceiver( plKey key ) { fProcReceiver = key; }
void SetVersion( UInt32 version ) { fVersion = version; }
void SetVersion( uint32_t version ) { fVersion = version; }
};
#endif // _pfGUIDialogMod_h

View File

@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pfGUIDialogNotifyProc.h"
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "pfGUIControlMod.h"
@ -73,9 +73,9 @@ pfGUIDialogNotifyProc::pfGUIDialogNotifyProc( plKey &r )
}
void pfGUIDialogNotifyProc::ISendNotify( plKey ctrlKey, UInt32 event )
void pfGUIDialogNotifyProc::ISendNotify( plKey ctrlKey, uint32_t event )
{
pfGUINotifyMsg *notify = TRACKED_NEW pfGUINotifyMsg( fDialog->GetKey(), fReceiver, nil );
pfGUINotifyMsg *notify = new pfGUINotifyMsg( fDialog->GetKey(), fReceiver, nil );
notify->SetEvent( ctrlKey, event );
plgDispatch::MsgSend( notify );
}

View File

@ -63,7 +63,7 @@ class pfGUIDialogNotifyProc : public pfGUIDialogProc
plKey fReceiver;
void ISendNotify( plKey ctrlKey, UInt32 event );
void ISendNotify( plKey ctrlKey, uint32_t event );
public:

View File

@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIDragBarCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
@ -78,7 +78,7 @@ pfGUIDragBarCtrl::~pfGUIDragBarCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDragBarCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIDragBarCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -112,7 +112,7 @@ void pfGUIDragBarCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
@ -128,7 +128,7 @@ void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
fDialog->UpdateAllBounds();
}
void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
@ -139,7 +139,7 @@ void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
fDialog->UpdateAllBounds();
}
void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
@ -151,7 +151,7 @@ void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIDragBarCtrl::IGetDesiredCursor( void ) const
uint32_t pfGUIDragBarCtrl::IGetDesiredCursor( void ) const
{
// if we are anchored, then no cursors that say we can move
if ( fAnchored )

View File

@ -60,9 +60,9 @@ class pfGUIDragBarCtrl : public pfGUIControlMod
hsBool fDragging;
hsBool fAnchored;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
@ -78,9 +78,9 @@ class pfGUIDragBarCtrl : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void SetAnchored( hsBool anchored ) { fAnchored = anchored; }
virtual hsBool IsAnchored(void) { return fAnchored; }

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIDraggableMod.h"
#include "pfGameGUIMgr.h"
@ -72,7 +72,7 @@ pfGUIDraggableMod::~pfGUIDraggableMod()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDraggableMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIDraggableMod::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -106,7 +106,7 @@ void pfGUIDraggableMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool forc
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
if( !fDragging )
{
@ -122,7 +122,7 @@ void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
}
}
void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fDragging )
{
@ -137,7 +137,7 @@ void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
}
}
void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fDragging )
{
@ -152,7 +152,7 @@ void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIDraggableMod::IGetDesiredCursor( void ) const
uint32_t pfGUIDraggableMod::IGetDesiredCursor( void ) const
{
// if we are anchored, then no cursors that say we can move
if( fDragging )

View File

@ -61,9 +61,9 @@ class pfGUIDraggableMod : public pfGUIControlMod
hsBool fDragging;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
@ -93,9 +93,9 @@ class pfGUIDraggableMod : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIDynDisplayCtrl.h"
#include "pfGameGUIMgr.h"
@ -72,7 +72,7 @@ pfGUIDynDisplayCtrl::~pfGUIDynDisplayCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDynDisplayCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIDynDisplayCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -116,7 +116,7 @@ hsBool pfGUIDynDisplayCtrl::MsgReceive( plMessage *msg )
void pfGUIDynDisplayCtrl::Read( hsStream *s, hsResMgr *mgr )
{
UInt32 count, i;
uint32_t count, i;
pfGUIControlMod::Read(s, mgr);
@ -124,22 +124,22 @@ void pfGUIDynDisplayCtrl::Read( hsStream *s, hsResMgr *mgr )
count = s->ReadLE32();
fTextMaps.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef );
count = s->ReadLE32();
fLayers.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef );
count = s->ReadLE32();
fMaterials.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef );
}
void pfGUIDynDisplayCtrl::Write( hsStream *s, hsResMgr *mgr )
{
UInt32 i;
uint32_t i;
pfGUIControlMod::Write( s, mgr );
@ -163,7 +163,7 @@ void pfGUIDynDisplayCtrl::Write( hsStream *s, hsResMgr *mgr )
void pfGUIDynDisplayCtrl::AddMap( plDynamicTextMap *map )
{
fTextMaps.Append( map );
hsgResMgr::ResMgr()->AddViaNotify( map->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fTextMaps.GetCount() - 1, kRefTextMap ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( map->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fTextMaps.GetCount() - 1, kRefTextMap ), plRefFlags::kActiveRef );
}
//// AddLayer ////////////////////////////////////////////////////////////////
@ -172,7 +172,7 @@ void pfGUIDynDisplayCtrl::AddMap( plDynamicTextMap *map )
void pfGUIDynDisplayCtrl::AddLayer( plLayerInterface *layer )
{
fLayers.Append( layer );
hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fLayers.GetCount() - 1, kRefLayer ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fLayers.GetCount() - 1, kRefLayer ), plRefFlags::kActiveRef );
}
//// AddMaterial /////////////////////////////////////////////////////////////
@ -181,5 +181,5 @@ void pfGUIDynDisplayCtrl::AddLayer( plLayerInterface *layer )
void pfGUIDynDisplayCtrl::AddMaterial( hsGMaterial *material )
{
fMaterials.Append( material );
hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fMaterials.GetCount() - 1, kRefMaterial ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fMaterials.GetCount() - 1, kRefMaterial ), plRefFlags::kActiveRef );
}

View File

@ -79,7 +79,7 @@ class pfGUIDynDisplayCtrl : public pfGUIControlMod
hsTArray<hsGMaterial *> fMaterials;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
public:
@ -95,14 +95,14 @@ class pfGUIDynDisplayCtrl : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
UInt32 GetNumMaps( void ) const { return fTextMaps.GetCount(); }
plDynamicTextMap *GetMap( UInt32 i ) const { return fTextMaps[ i ]; }
uint32_t GetNumMaps( void ) const { return fTextMaps.GetCount(); }
plDynamicTextMap *GetMap( uint32_t i ) const { return fTextMaps[ i ]; }
UInt32 GetNumLayers( void ) const { return fLayers.GetCount(); }
plLayerInterface *GetLayer( UInt32 i ) const { return fLayers[ i ]; }
uint32_t GetNumLayers( void ) const { return fLayers.GetCount(); }
plLayerInterface *GetLayer( uint32_t i ) const { return fLayers[ i ]; }
UInt32 GetNumMaterials( void ) const { return fMaterials.GetCount(); }
hsGMaterial *GetMaterial( UInt32 i ) const { return fMaterials[ i ]; }
uint32_t GetNumMaterials( void ) const { return fMaterials.GetCount(); }
hsGMaterial *GetMaterial( uint32_t i ) const { return fMaterials[ i ]; }
// Export only
void AddMap( plDynamicTextMap *map );

View File

@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//#define LIMIT_VOICE_CHAT 1
#endif
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIEditBoxMod.h"
#include "pfGameGUIMgr.h"
@ -86,7 +86,7 @@ pfGUIEditBoxMod::~pfGUIEditBoxMod()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIEditBoxMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIEditBoxMod::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -126,7 +126,7 @@ void pfGUIEditBoxMod::IUpdate( void )
if( fBuffer != nil )
{
// First, calc the cursor position, so we can adjust the scrollPos as necessary
Int16 cursorPos, oldCursorPos;
int16_t cursorPos, oldCursorPos;
if( fFocused && !fSpecialCaptureKeyEventMode )
{
// Really cheap hack here to figure out where to draw the cursor
@ -136,7 +136,7 @@ void pfGUIEditBoxMod::IUpdate( void )
fBuffer[ fCursorPos ] = backup;
oldCursorPos = cursorPos;
cursorPos -= (Int16)fScrollPos;
cursorPos -= (int16_t)fScrollPos;
if( 4 + cursorPos > fDynTextMap->GetVisibleWidth() - 18 )
{
@ -149,7 +149,7 @@ void pfGUIEditBoxMod::IUpdate( void )
fScrollPos = 0;
}
cursorPos = (Int16)(oldCursorPos - fScrollPos);
cursorPos = (int16_t)(oldCursorPos - fScrollPos);
}
if ( fFocused && fSpecialCaptureKeyEventMode )
@ -159,7 +159,7 @@ void pfGUIEditBoxMod::IUpdate( void )
else
fDynTextMap->SetTextColor( GetColorScheme()->fForeColor, GetColorScheme()->fTransparent &&
GetColorScheme()->fBackColor.a == 0.f );
fDynTextMap->DrawClippedString( (Int16)(4 - fScrollPos), 4, fBuffer,
fDynTextMap->DrawClippedString( (int16_t)(4 - fScrollPos), 4, fBuffer,
4, 4, fDynTextMap->GetVisibleWidth() - 8, fDynTextMap->GetVisibleHeight() - 8 );
if( fFocused && !fSpecialCaptureKeyEventMode )
@ -193,10 +193,10 @@ void pfGUIEditBoxMod::Write( hsStream *s, hsResMgr *mgr )
// (if any). Shift-click and ctrl-click avoids the deselect and toggles
// the item clicked on.
void pfGUIEditBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIEditBoxMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
wchar_t backup;
UInt16 width;
uint16_t width;
if( fBuffer != nil && fDynTextMap != nil )
@ -225,17 +225,17 @@ void pfGUIEditBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
//// HandleMouseUp ///////////////////////////////////////////////////////////
void pfGUIEditBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIEditBoxMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
}
//// HandleMouseDrag /////////////////////////////////////////////////////////
void pfGUIEditBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIEditBoxMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
}
hsBool pfGUIEditBoxMod::HandleKeyPress( wchar_t key, UInt8 modifiers )
hsBool pfGUIEditBoxMod::HandleKeyPress( wchar_t key, uint8_t modifiers )
{
if( fBuffer == nil )
return false;
@ -262,7 +262,7 @@ hsBool pfGUIEditBoxMod::HandleKeyPress( wchar_t key, UInt8 modifiers )
return true;
}
hsBool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers )
hsBool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers )
{
if ( fSpecialCaptureKeyEventMode)
{
@ -470,14 +470,14 @@ void pfGUIEditBoxMod::SetText( const wchar_t *str )
}
}
void pfGUIEditBoxMod::SetBufferSize( UInt32 size )
void pfGUIEditBoxMod::SetBufferSize( uint32_t size )
{
delete [] fBuffer;
fBufferSize = size;
if( size > 0 )
{
fBuffer = TRACKED_NEW wchar_t[ size + 1 ];
fBuffer = new wchar_t[ size + 1 ];
memset( fBuffer, 0, (size + 1) * sizeof(wchar_t) );
}
else
@ -499,7 +499,7 @@ void pfGUIEditBoxMod::SetCursorToEnd( void )
fCursorPos = wcslen( fBuffer );
}
void pfGUIEditBoxMod::SetLastKeyCapture(UInt32 key, UInt8 modifiers)
void pfGUIEditBoxMod::SetLastKeyCapture(uint32_t key, uint8_t modifiers)
{
// capture the key
fSavedKey = (plKeyDef)key;

View File

@ -64,17 +64,17 @@ class pfGUIEditBoxMod : public pfGUIControlMod
protected:
wchar_t *fBuffer;
UInt32 fBufferSize, fCursorPos;
Int32 fScrollPos;
uint32_t fBufferSize, fCursorPos;
int32_t fScrollPos;
hsBool fIgnoreNextKey, fEscapedFlag;
hsBool fFirstHalfExitKeyPushed;
hsBool fSpecialCaptureKeyEventMode;
plKeyDef fSavedKey;
UInt8 fSavedModifiers;
uint8_t fSavedModifiers;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
@ -97,16 +97,16 @@ class pfGUIEditBoxMod : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers );
virtual void PurgeDynaTextMapImage();
void SetBufferSize( UInt32 size );
void SetBufferSize( uint32_t size );
std::string GetBuffer( void );
std::wstring GetBufferW( void ) { return fBuffer; }
@ -120,9 +120,9 @@ class pfGUIEditBoxMod : public pfGUIControlMod
hsBool WasEscaped( void ) { hsBool e = fEscapedFlag; fEscapedFlag = false; return e; }
void SetSpecialCaptureKeyMode(hsBool state) { fSpecialCaptureKeyEventMode = state; }
UInt32 GetLastKeyCaptured() { return (UInt32)fSavedKey; }
UInt8 GetLastModifiersCaptured() { return fSavedModifiers; }
void SetLastKeyCapture(UInt32 key, UInt8 modifiers);
uint32_t GetLastKeyCaptured() { return (uint32_t)fSavedKey; }
uint8_t GetLastModifiersCaptured() { return fSavedModifiers; }
void SetLastKeyCapture(uint32_t key, uint8_t modifiers);
void SetChatMode(hsBool state) { plKeyboardDevice::IgnoreCapsLock(state); }

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIKnobCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
@ -90,7 +90,7 @@ pfGUIKnobCtrl::~pfGUIKnobCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIKnobCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIKnobCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
@ -109,7 +109,7 @@ void pfGUIKnobCtrl::Read( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadLE32();
uint32_t i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
@ -124,7 +124,7 @@ void pfGUIKnobCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
uint32_t i, count = fAnimationKeys.GetCount();
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
@ -145,7 +145,7 @@ void pfGUIKnobCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
fDragStart = mousePt;
fDragValue = fValue;
@ -202,15 +202,15 @@ void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
fDragRangeMin = -1;
}
void pfGUIKnobCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIKnobCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
fDragging = false;
HandleMouseDrag( mousePt, modifiers );
}
void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
hsScalar oldValue = fValue, newValue = fDragValue;
float oldValue = fValue, newValue = fDragValue;
if( fDragRangeMin != -1 )
{
@ -242,7 +242,7 @@ void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
}
else
{
hsScalar diff;
float diff;
if( HasFlag( kLeftRightOrientation ) )
diff = ( mousePt.fX - fDragStart.fX ) * 20.f;
else
@ -268,7 +268,7 @@ void pfGUIKnobCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
@ -284,7 +284,7 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void )
if( fAnimTimesCalced )
return true;
hsScalar tBegin = 1e30, tEnd = -1e30;
float tBegin = 1e30, tEnd = -1e30;
bool foundOne = false;
for( int i = 0; i < fAnimationKeys.GetCount(); i++ )
@ -295,8 +295,8 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void )
{
for( int j = 0; j < mod->GetNumAnimations(); j++ )
{
hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
float begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
float end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
@ -308,8 +308,8 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void )
plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( layer != nil )
{
hsScalar begin = layer->GetTimeConvert().GetBegin();
hsScalar end = layer->GetTimeConvert().GetEnd();
float begin = layer->GetTimeConvert().GetBegin();
float end = layer->GetTimeConvert().GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
@ -331,7 +331,7 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void )
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIKnobCtrl::SetCurrValue( hsScalar v )
void pfGUIKnobCtrl::SetCurrValue( float v )
{
int old = (int)fValue;
pfGUIValueCtrl::SetCurrValue( v );
@ -343,8 +343,8 @@ void pfGUIKnobCtrl::SetCurrValue( hsScalar v )
{
ICalcAnimTimes();
hsScalar tLength = fAnimEnd - fAnimBegin;
hsScalar newTime = fMin;
float tLength = fAnimEnd - fAnimBegin;
float newTime = fMin;
if (fMin != fMax) // Protect against div by zero
{
@ -353,7 +353,7 @@ void pfGUIKnobCtrl::SetCurrValue( hsScalar v )
else
newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
}
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kGoToTime );
msg->SetAnimName( fAnimName );
msg->fTime = newTime;
@ -364,7 +364,7 @@ void pfGUIKnobCtrl::SetCurrValue( hsScalar v )
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIKnobCtrl::IGetDesiredCursor( void ) const
uint32_t pfGUIKnobCtrl::IGetDesiredCursor( void ) const
{
if( HasFlag( kLeftRightOrientation ) )
{

View File

@ -61,19 +61,19 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
char *fAnimName;
hsPoint3 fDragStart;
hsScalar fDragValue;
float fDragValue;
hsBool fDragging;
hsPoint3 fAnimStartPos, fAnimEndPos; // Calculated at export time for kMapToScreenRange
hsScalar fDragRangeMin, fDragRangeMax;
float fDragRangeMin, fDragRangeMax;
// Computed once, once an anim is loaded that we can compute this with
hsScalar fAnimBegin, fAnimEnd;
float fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
hsBool ICalcAnimTimes( void );
@ -100,13 +100,13 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetCurrValue( hsScalar v );
virtual void SetCurrValue( float v );
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIListBoxMod.h"
#include "pfGUIListElement.h"
#include "pfGameGUIMgr.h"
@ -68,7 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// plSmallRect Stuff ///////////////////////////////////////////////////////
void pfGUIListBoxMod::plSmallRect::Set( Int16 l, Int16 t, Int16 r, Int16 b )
void pfGUIListBoxMod::plSmallRect::Set( int16_t l, int16_t t, int16_t r, int16_t b )
{
fLeft = l;
fTop = t;
@ -76,7 +76,7 @@ void pfGUIListBoxMod::plSmallRect::Set( Int16 l, Int16 t, Int16 r, Int16 b )
fBottom = b;
}
hsBool pfGUIListBoxMod::plSmallRect::Contains( Int16 x, Int16 y )
hsBool pfGUIListBoxMod::plSmallRect::Contains( int16_t x, int16_t y )
{
if( x < fLeft || x > fRight || y < fTop || y > fBottom )
return false;
@ -140,7 +140,7 @@ pfGUIListBoxMod::~pfGUIListBoxMod()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIListBoxMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIListBoxMod::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -190,7 +190,7 @@ void pfGUIListBoxMod::IPostSetUpDynTextMap( void )
void pfGUIListBoxMod::IUpdate( void )
{
int i, j;
UInt16 x, y, width, height, maxHeight;
uint16_t x, y, width, height, maxHeight;
if( !fReadyToRoll )
@ -242,7 +242,7 @@ void pfGUIListBoxMod::IUpdate( void )
{
// Shit. Move the scrollPos up to this item at the very least
fScrollPos = j;
fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) );
fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) );
fCheckScroll = false;
break;
}
@ -345,7 +345,7 @@ void pfGUIListBoxMod::IUpdate( void )
if( anySelected )
{
fScrollPos = j;
fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) );
fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) );
IUpdate(); // Gotta update again, since we just changed the scrollPos after the fact
return;
}
@ -361,7 +361,7 @@ void pfGUIListBoxMod::IUpdate( void )
void pfGUIListBoxMod::ICalcWrapStarts( void )
{
UInt16 i, x, y, maxHeight, width, height;
uint16_t i, x, y, maxHeight, width, height;
fWrapStartIdxs.Reset();
@ -370,7 +370,7 @@ void pfGUIListBoxMod::ICalcWrapStarts( void )
{
if( !HasFlag( kScrollLeftToRight ) )
{
for( i = 0, x = (UInt16)-1, y = 4, maxHeight = 0; i < fElements.GetCount(); i++ )
for( i = 0, x = (uint16_t)-1, y = 4, maxHeight = 0; i < fElements.GetCount(); i++ )
{
fElements[ i ]->GetSize( fDynTextMap, &width, &height );
@ -387,7 +387,7 @@ void pfGUIListBoxMod::ICalcWrapStarts( void )
}
else
{
for( i = 0, y = (UInt16)-1, x = 4, maxHeight = 0; i < fElements.GetCount(); i++ )
for( i = 0, y = (uint16_t)-1, x = 4, maxHeight = 0; i < fElements.GetCount(); i++ )
{
fElements[ i ]->GetSize( fDynTextMap, &width, &height );
if( y + height >= fDynTextMap->GetVisibleHeight() )
@ -419,7 +419,7 @@ void pfGUIListBoxMod::ICalcWrapStarts( void )
void pfGUIListBoxMod::ICalcScrollRange( void )
{
UInt16 ctrlHt, ctrlWd, height, width, maxHeight;
uint16_t ctrlHt, ctrlWd, height, width, maxHeight;
int i, j, end;
@ -495,9 +495,9 @@ void pfGUIListBoxMod::ICalcScrollRange( void )
// Smaller than the viewing area, so we don't scroll at all
fScrollControl->SetRange( 0.f, 0.f );
else
fScrollControl->SetRange( 0.f, (hsScalar)( i + 1 ) );
fScrollControl->SetRange( 0.f, (float)( i + 1 ) );
fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) );
fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) );
}
}
@ -516,9 +516,9 @@ void pfGUIListBoxMod::Read( hsStream *s, hsResMgr *mgr )
fScrollControl = nil;
if( s->ReadBool() )
{
fScrollProc = TRACKED_NEW pfScrollProc( this );
fScrollProc = new pfScrollProc( this );
fScrollProc->IncRef();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef );
}
if( HasFlag( kDisableSelection ) )
@ -549,7 +549,7 @@ hsBool pfGUIListBoxMod::FilterMousePosition( hsPoint3 &mousePt )
if( !HasFlag( kAllowMousePassThrough ) )
return true;
Int32 hover = fCurrClick = IGetItemFromPoint( mousePt );
int32_t hover = fCurrClick = IGetItemFromPoint( mousePt );
if( hover == -1 )
return false;
@ -561,9 +561,9 @@ hsBool pfGUIListBoxMod::FilterMousePosition( hsPoint3 &mousePt )
// (if any). Shift-click and ctrl-click avoids the deselect and toggles
// the item clicked on.
void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
Int32 i;
int32_t i;
int lastSelection = -1;
if (HasFlag(kForbidNoSelection))
@ -597,15 +597,15 @@ void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
// Select our new range, deselect everything outside
if( fCurrClick <= fMaxSel )
{
ISelectRange( 0, (Int8)(fCurrClick - 1), false );
ISelectRange( (Int8)fCurrClick, (Int8)fMaxSel, true );
ISelectRange( (Int8)(fMaxSel + 1), -1, false );
ISelectRange( 0, (int8_t)(fCurrClick - 1), false );
ISelectRange( (int8_t)fCurrClick, (int8_t)fMaxSel, true );
ISelectRange( (int8_t)(fMaxSel + 1), -1, false );
}
else if( fCurrClick >= fMinSel )
{
ISelectRange( 0, (Int8)(fMinSel - 1), false );
ISelectRange( (Int8)fMinSel, (Int8)fCurrClick, true );
ISelectRange( (Int8)(fCurrClick + 1), -1, false );
ISelectRange( 0, (int8_t)(fMinSel - 1), false );
ISelectRange( (int8_t)fMinSel, (int8_t)fCurrClick, true );
ISelectRange( (int8_t)(fCurrClick + 1), -1, false );
}
fElements[ fCurrClick ]->SetSelected( true );
}
@ -633,13 +633,13 @@ void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
//// HandleMouseUp ///////////////////////////////////////////////////////////
void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
fClicking = false;
if( !( fModsAtDragTime & ( pfGameGUIMgr::kShiftDown | pfGameGUIMgr::kCtrlDown ) ) && !HasFlag( kHandsOffMultiSelect ) )
{
// No modifiers--simply select whatever item we're on
Int32 item = IGetItemFromPoint( mousePt );
int32_t item = IGetItemFromPoint( mousePt );
if( item != fCurrClick )
{
if( fCurrClick >= 0 && fCurrClick < fElements.GetCount() )
@ -665,8 +665,8 @@ void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
hsPoint3 localPt = mousePt;
IScreenToLocalPt( localPt );
UInt16 lX = (UInt16)(( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) ) - fElementBounds[ fCurrClick ].fLeft);
UInt16 lY = (UInt16)(( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) )- fElementBounds[ fCurrClick ].fTop);
uint16_t lX = (uint16_t)(( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) ) - fElementBounds[ fCurrClick ].fLeft);
uint16_t lY = (uint16_t)(( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) )- fElementBounds[ fCurrClick ].fTop);
if( fElements[ fCurrClick ]->MouseClicked( lX, lY ) )
{
@ -684,14 +684,14 @@ void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
//// HandleMouseHover ////////////////////////////////////////////////////////
// Just updates our currHover item so we can update the mouse appropriately
void pfGUIListBoxMod::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIListBoxMod::HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers )
{
fCurrHover = IGetItemFromPoint( mousePt );
}
//// HandleMouseDrag /////////////////////////////////////////////////////////
void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
int i;
@ -701,15 +701,15 @@ void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
// Select our new range, deselect everything outside
if( fCurrClick <= fMaxSel )
{
ISelectRange( 0, (Int8)(fCurrClick - 1), false );
ISelectRange( (Int8)fCurrClick, (Int8)fMaxSel, true );
ISelectRange( (Int8)(fMaxSel + 1), -1, false );
ISelectRange( 0, (int8_t)(fCurrClick - 1), false );
ISelectRange( (int8_t)fCurrClick, (int8_t)fMaxSel, true );
ISelectRange( (int8_t)(fMaxSel + 1), -1, false );
}
else if( fCurrClick >= fMinSel )
{
ISelectRange( 0, (Int8)(fMinSel - 1), false );
ISelectRange( (Int8)fMinSel, (Int8)fCurrClick, true );
ISelectRange( (Int8)(fCurrClick + 1), -1, false );
ISelectRange( 0, (int8_t)(fMinSel - 1), false );
ISelectRange( (int8_t)fMinSel, (int8_t)fCurrClick, true );
ISelectRange( (int8_t)(fCurrClick + 1), -1, false );
}
IUpdate();
}
@ -731,7 +731,7 @@ void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
}
else
{
Int32 item = IGetItemFromPoint( mousePt );
int32_t item = IGetItemFromPoint( mousePt );
if( item != fCurrClick )
{
if( fCurrClick >= 0 && fCurrClick < fElements.GetCount() )
@ -749,12 +749,12 @@ void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
//// HandleMouseDblClick /////////////////////////////////////////////////////
void pfGUIListBoxMod::HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIListBoxMod::HandleMouseDblClick( hsPoint3 &mousePt, uint8_t modifiers )
{
if( !HasFlag( kGrowLeavesAndProcessOxygen ) )
return; // We only care about double clicks if we make oxygen
Int32 item = IGetItemFromPoint( mousePt );
int32_t item = IGetItemFromPoint( mousePt );
if( item != -1 )
{
if( fElements[ item ]->GetType() == pfGUIListElement::kTreeRoot )
@ -774,20 +774,20 @@ void pfGUIListBoxMod::HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers
//// IGetItemFromPoint ///////////////////////////////////////////////////////
Int32 pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt )
int32_t pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt )
{
if( !fBounds.IsInside( &mousePt ) )
return -1;
hsPoint3 localPt = mousePt; // despite getting a ref to the point (why?) we do NOT want to modify it
IScreenToLocalPt( localPt );
UInt32 i;
Int16 clickItem = -1 , clickY = (Int16)( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) );
Int16 clickX = (Int16)( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) );
uint32_t i;
int16_t clickItem = -1 , clickY = (int16_t)( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) );
int16_t clickX = (int16_t)( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) );
// We have a nice array that has the starting (top) Y's of each visible element. So we just
// check against that.
UInt32 startAt = 0;
uint32_t startAt = 0;
// make sure that we have a valid fScrollPos
if ( fScrollPos != -1 )
{
@ -802,7 +802,7 @@ Int32 pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt )
{
if( i<fElementBounds.GetCount() && fElementBounds[ i ].Contains( clickX, clickY ) )
{
clickItem = (Int16)i;
clickItem = (int16_t)i;
break;
}
}
@ -817,9 +817,9 @@ Int32 pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt )
// Find the min and max item that's selected. Returns -1 for both if nobody
// is selected
void pfGUIListBoxMod::IFindSelectionRange( Int32 *min, Int32 *max )
void pfGUIListBoxMod::IFindSelectionRange( int32_t *min, int32_t *max )
{
Int32 i;
int32_t i;
*min = *max = -1;
@ -845,9 +845,9 @@ void pfGUIListBoxMod::IFindSelectionRange( Int32 *min, Int32 *max )
//// ISelectRange ////////////////////////////////////////////////////////////
void pfGUIListBoxMod::ISelectRange( Int8 min, Int8 max, hsBool select )
void pfGUIListBoxMod::ISelectRange( int8_t min, int8_t max, hsBool select )
{
Int16 i;
int16_t i;
if( max == -1 )
@ -859,7 +859,7 @@ void pfGUIListBoxMod::ISelectRange( Int8 min, Int8 max, hsBool select )
//// SetSelection ////////////////////////////////////////////////////////////
void pfGUIListBoxMod::SetSelection( Int32 item )
void pfGUIListBoxMod::SetSelection( int32_t item )
{
if( HasFlag( kSingleSelect ) )
{
@ -879,7 +879,7 @@ void pfGUIListBoxMod::SetSelection( Int32 item )
IUpdate();
}
void pfGUIListBoxMod::RemoveSelection( Int32 item )
void pfGUIListBoxMod::RemoveSelection( int32_t item )
{
// make sure the item is valid
if ( item != -1 && item < fElements.GetCount() )
@ -900,7 +900,7 @@ void pfGUIListBoxMod::RemoveSelection( Int32 item )
IUpdate();
}
void pfGUIListBoxMod::AddSelection( Int32 item )
void pfGUIListBoxMod::AddSelection( int32_t item )
{
// make sure the item is valid (can't add a non-selection!)
if ( item != -1 && item < fElements.GetCount() )
@ -921,12 +921,12 @@ void pfGUIListBoxMod::AddSelection( Int32 item )
//// HandleKeyPress //////////////////////////////////////////////////////////
hsBool pfGUIListBoxMod::HandleKeyPress( wchar_t key, UInt8 modifiers )
hsBool pfGUIListBoxMod::HandleKeyPress( wchar_t key, uint8_t modifiers )
{
return false;
}
hsBool pfGUIListBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers )
hsBool pfGUIListBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers )
{
if( key == KEY_CAPSLOCK )
return false;
@ -1029,7 +1029,7 @@ void pfGUIListBoxMod::ScrollToBegin( void )
void pfGUIListBoxMod::SetColorScheme( pfGUIColorScheme *newScheme )
{
UInt16 i;
uint16_t i;
pfGUIControlMod::SetColorScheme( newScheme );
@ -1040,22 +1040,22 @@ void pfGUIListBoxMod::SetColorScheme( pfGUIColorScheme *newScheme )
}
}
void pfGUIListBoxMod::SetScrollPos( Int32 pos )
void pfGUIListBoxMod::SetScrollPos( int32_t pos )
{
if ( pos >= (int)fScrollControl->GetMin() && pos <= (int)fScrollControl->GetMax() )
{
fScrollControl->SetCurrValue( (hsScalar)pos );
fScrollControl->SetCurrValue( (float)pos );
fScrollPos = (int)fScrollControl->GetMax() - pos;
}
IUpdate();
}
Int32 pfGUIListBoxMod::GetScrollPos( void )
int32_t pfGUIListBoxMod::GetScrollPos( void )
{
return (int)fScrollControl->GetCurrValue();
}
Int32 pfGUIListBoxMod::GetScrollRange( void )
int32_t pfGUIListBoxMod::GetScrollRange( void )
{
return (int)fScrollControl->GetMax() - (int)fScrollControl->GetMin();
}
@ -1065,9 +1065,9 @@ Int32 pfGUIListBoxMod::GetScrollRange( void )
//// Element Manipulation ////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
UInt16 pfGUIListBoxMod::AddElement( pfGUIListElement *el )
uint16_t pfGUIListBoxMod::AddElement( pfGUIListElement *el )
{
UInt16 idx = fElements.GetCount();
uint16_t idx = fElements.GetCount();
fElements.Append( el );
el->SetColorScheme( GetColorScheme() );
el->SetSkin( fSkin );
@ -1081,10 +1081,10 @@ UInt16 pfGUIListBoxMod::AddElement( pfGUIListElement *el )
return idx;
}
void pfGUIListBoxMod::RemoveElement( UInt16 index )
void pfGUIListBoxMod::RemoveElement( uint16_t index )
{
// Make sure no other elements care about this one
UInt16 i, j;
uint16_t i, j;
for( i = 0; i < fElements.GetCount(); i++ )
{
if( fElements[ i ]->GetType() == pfGUIListElement::kTreeRoot )
@ -1118,7 +1118,7 @@ void pfGUIListBoxMod::RemoveElement( UInt16 index )
}
}
Int16 pfGUIListBoxMod::FindElement( pfGUIListElement *toCompareTo )
int16_t pfGUIListBoxMod::FindElement( pfGUIListElement *toCompareTo )
{
int i;
@ -1129,7 +1129,7 @@ Int16 pfGUIListBoxMod::FindElement( pfGUIListElement *toCompareTo )
return i;
}
return (Int16)-1;
return (int16_t)-1;
}
void pfGUIListBoxMod::ClearAllElements( void )
@ -1152,34 +1152,34 @@ void pfGUIListBoxMod::ClearAllElements( void )
HandleExtendedEvent( pfGUIListBoxMod::kListCleared );
}
UInt16 pfGUIListBoxMod::AddString( const char *string )
uint16_t pfGUIListBoxMod::AddString( const char *string )
{
return AddElement( TRACKED_NEW pfGUIListText( string ) );
return AddElement( new pfGUIListText( string ) );
}
UInt16 pfGUIListBoxMod::AddString( const wchar_t *string )
uint16_t pfGUIListBoxMod::AddString( const wchar_t *string )
{
return AddElement( TRACKED_NEW pfGUIListText( string ) );
return AddElement( new pfGUIListText( string ) );
}
Int16 pfGUIListBoxMod::FindString( const char *toCompareTo )
int16_t pfGUIListBoxMod::FindString( const char *toCompareTo )
{
pfGUIListText text( toCompareTo );
return FindElement( &text );
}
Int16 pfGUIListBoxMod::FindString( const wchar_t *toCompareTo )
int16_t pfGUIListBoxMod::FindString( const wchar_t *toCompareTo )
{
pfGUIListText text( toCompareTo );
return FindElement( &text );
}
UInt16 pfGUIListBoxMod::GetNumElements( void )
uint16_t pfGUIListBoxMod::GetNumElements( void )
{
return fElements.GetCount();
}
pfGUIListElement *pfGUIListBoxMod::GetElement( UInt16 idx )
pfGUIListElement *pfGUIListBoxMod::GetElement( uint16_t idx )
{
return fElements[ idx ];
}
@ -1199,7 +1199,7 @@ void pfGUIListBoxMod::UnlockList( void )
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIListBoxMod::IGetDesiredCursor( void ) const
uint32_t pfGUIListBoxMod::IGetDesiredCursor( void ) const
{
if( fCurrHover == -1 )
return plInputInterface::kNullCursor;

View File

@ -65,10 +65,10 @@ class pfGUIListBoxMod : public pfGUIControlMod
struct plSmallRect
{
Int16 fLeft, fTop, fRight, fBottom;
int16_t fLeft, fTop, fRight, fBottom;
void Set( Int16 l, Int16 t, Int16 r, Int16 b );
hsBool Contains( Int16 x, Int16 y );
void Set( int16_t l, int16_t t, int16_t r, int16_t b );
hsBool Contains( int16_t x, int16_t y );
plSmallRect& operator=(const int zero) { fLeft = fTop = fRight = fBottom = 0; return *this; }
};
@ -78,29 +78,29 @@ class pfGUIListBoxMod : public pfGUIControlMod
pfScrollProc *fScrollProc;
hsTArray<pfGUIListElement *> fElements;
Int32 fCurrClick, fScrollPos, fCurrHover;
UInt8 fModsAtDragTime;
Int32 fMinSel, fMaxSel;
int32_t fCurrClick, fScrollPos, fCurrHover;
uint8_t fModsAtDragTime;
int32_t fMinSel, fMaxSel;
hsBool fCheckScroll, fClicking;
Int32 fSingleSelElement;
int32_t fSingleSelElement;
hsBool fScrollRangeUpdateDeferred;
hsBool fLocked, fReadyToRoll;
hsTArray<plSmallRect> fElementBounds;
hsTArray<Int16> fWrapStartIdxs;
hsTArray<int16_t> fWrapStartIdxs;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
void ICalcScrollRange( void );
void ICalcWrapStarts( void );
virtual void IUpdate( void );
virtual void IPostSetUpDynTextMap( void );
virtual UInt32 IGetDesiredCursor( void ) const;
virtual uint32_t IGetDesiredCursor( void ) const;
Int32 IGetItemFromPoint( hsPoint3 &mousePt );
void IFindSelectionRange( Int32 *min, Int32 *max );
void ISelectRange( Int8 min, Int8 max, hsBool select );
int32_t IGetItemFromPoint( hsPoint3 &mousePt );
void IFindSelectionRange( int32_t *min, int32_t *max );
void ISelectRange( int8_t min, int8_t max, hsBool select );
public:
@ -143,30 +143,30 @@ class pfGUIListBoxMod : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDblClick( hsPoint3 &mousePt, uint8_t modifiers );
virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers );
virtual hsBool FilterMousePosition( hsPoint3 &mousePt );
virtual void PurgeDynaTextMapImage();
// Returns selected element. Only valid for kSingleSelect list boxes
Int32 GetSelection( void ) { return fSingleSelElement; }
void SetSelection( Int32 item );
void RemoveSelection( Int32 item );
void AddSelection( Int32 item );
int32_t GetSelection( void ) { return fSingleSelElement; }
void SetSelection( int32_t item );
void RemoveSelection( int32_t item );
void AddSelection( int32_t item );
virtual void ScrollToBegin( void );
virtual void ScrollToEnd( void );
virtual void SetScrollPos( Int32 pos );
virtual Int32 GetScrollPos( void );
virtual Int32 GetScrollRange( void );
virtual void SetScrollPos( int32_t pos );
virtual int32_t GetScrollPos( void );
virtual int32_t GetScrollRange( void );
void Refresh( void ) { IUpdate(); }
@ -175,21 +175,21 @@ class pfGUIListBoxMod : public pfGUIControlMod
// Element manipulation
UInt16 AddElement( pfGUIListElement *el );
void RemoveElement( UInt16 index );
Int16 FindElement( pfGUIListElement *toCompareTo );
uint16_t AddElement( pfGUIListElement *el );
void RemoveElement( uint16_t index );
int16_t FindElement( pfGUIListElement *toCompareTo );
void ClearAllElements( void );
void LockList( void );
void UnlockList( void );
UInt16 GetNumElements( void );
pfGUIListElement *GetElement( UInt16 idx );
uint16_t GetNumElements( void );
pfGUIListElement *GetElement( uint16_t idx );
UInt16 AddString( const char *string );
UInt16 AddString( const wchar_t *string );
Int16 FindString( const char *toCompareTo );
Int16 FindString( const wchar_t *toCompareTo );
uint16_t AddString( const char *string );
uint16_t AddString( const wchar_t *string );
int16_t FindString( const char *toCompareTo );
int16_t FindString( const wchar_t *toCompareTo );
// Export only
void SetScrollCtrl( pfGUIValueCtrl *ctrl ) { fScrollControl = ctrl; }

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIListElement.h"
#include "pfGameGUIMgr.h"
@ -91,7 +91,7 @@ pfGUIListText::pfGUIListText( const char *text ) : pfGUIListElement( kText )
pfGUIListText::pfGUIListText( const wchar_t *text ) : pfGUIListElement( kText )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
fText = new wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
fJustify = kLeftJustify;
}
@ -121,7 +121,7 @@ void pfGUIListText::Write( hsStream *s, hsResMgr *mgr )
delete [] text;
}
hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight )
{
textGen->SetJustify( (plDynamicTextMap::Justify)fJustify );
if( fSelected )
@ -139,7 +139,7 @@ hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt
return true;
}
void pfGUIListText::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
void pfGUIListText::GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height )
{
*width = textGen->CalcStringWidth( GetText(), height );
if( height != nil )
@ -173,7 +173,7 @@ void pfGUIListText::SetText( const wchar_t *text )
delete [] fText;
if( text != nil )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
fText = new wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
else
@ -247,7 +247,7 @@ void pfGUIListPicture::Write( hsStream *s, hsResMgr *mgr )
}
hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight )
{
if( fSelected )
textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor );
@ -264,7 +264,7 @@ hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, U
return true;
}
void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height )
{
plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() );
if( mip == nil )
@ -274,9 +274,9 @@ void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, UInt16 *width, UIn
*height = 16;
}
*width = (UInt16)(mip->GetWidth() + fBorderSize + fBorderSize);
*width = (uint16_t)(mip->GetWidth() + fBorderSize + fBorderSize);
if( height != nil )
*height = (UInt16)(mip->GetHeight() + fBorderSize + fBorderSize);
*height = (uint16_t)(mip->GetHeight() + fBorderSize + fBorderSize);
}
int pfGUIListPicture::CompareTo( pfGUIListElement *rightSide )
@ -308,7 +308,7 @@ pfGUIListTreeRoot::pfGUIListTreeRoot( const char *text ) : pfGUIListElement( kTr
pfGUIListTreeRoot::pfGUIListTreeRoot( const wchar_t *text ) : pfGUIListElement( kTreeRoot )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
fText = new wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
@ -337,7 +337,7 @@ void pfGUIListTreeRoot::Write( hsStream *s, hsResMgr *mgr )
delete [] temp;
}
hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight )
{
textGen->SetJustify( plDynamicTextMap::kLeftJustify );
if( fSelected )
@ -355,7 +355,7 @@ hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y,
{
const pfGUISkin::pfSRect &r = fSkin->GetElement( fShowChildren ? pfGUISkin::kTreeButtonOpen : pfGUISkin::kTreeButtonClosed );
Int16 e = ( maxHeight - r.fHeight );
int16_t e = ( maxHeight - r.fHeight );
if( e < 0 )
e = 0;
e >>= 1;
@ -368,7 +368,7 @@ hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y,
return true;
}
hsBool pfGUIListTreeRoot::MouseClicked( UInt16 localX, UInt16 localY )
hsBool pfGUIListTreeRoot::MouseClicked( uint16_t localX, uint16_t localY )
{
if( fSkin != nil )
{
@ -387,7 +387,7 @@ hsBool pfGUIListTreeRoot::MouseClicked( UInt16 localX, UInt16 localY )
return false;
}
void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height )
{
*width = textGen->CalcStringWidth( GetTitle(), height );
if( height != nil )
@ -399,7 +399,7 @@ void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, UInt16 *width, UI
if( fSkin != nil )
{
UInt16 h = fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fHeight;
uint16_t h = fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fHeight;
if( *height < h )
*height = h;
}
@ -431,7 +431,7 @@ void pfGUIListTreeRoot::SetTitle( const wchar_t *text )
delete [] fText;
if( text != nil )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
fText = new wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
else
@ -445,14 +445,14 @@ void pfGUIListTreeRoot::AddChild( pfGUIListElement *el )
el->SetCollapsed( !fShowChildren );
}
void pfGUIListTreeRoot::RemoveChild( UInt32 idx )
void pfGUIListTreeRoot::RemoveChild( uint32_t idx )
{
fChildren.Remove( idx );
}
void pfGUIListTreeRoot::ShowChildren( hsBool s )
{
UInt32 i;
uint32_t i;
fShowChildren = s;
@ -462,7 +462,7 @@ void pfGUIListTreeRoot::ShowChildren( hsBool s )
void pfGUIListTreeRoot::SetCollapsed( hsBool c )
{
UInt32 i;
uint32_t i;
pfGUIListElement::SetCollapsed( c );

View File

@ -58,10 +58,10 @@ class pfGUIListElement
protected:
hsBool fSelected;
const UInt8 fType;
const uint8_t fType;
hsBool fCollapsed; // For tree view support
UInt8 fIndentLevel; // Ditto
uint8_t fIndentLevel; // Ditto
pfGUIColorScheme *fColors;
pfGUISkin *fSkin;
@ -75,14 +75,14 @@ class pfGUIListElement
kTreeRoot
};
pfGUIListElement( UInt8 type ) : fType( type ), fSelected( false ), fCollapsed( false ), fIndentLevel( 0 ) {}
pfGUIListElement( uint8_t type ) : fType( type ), fSelected( false ), fCollapsed( false ), fIndentLevel( 0 ) {}
virtual ~pfGUIListElement() {}
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) = 0;
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) = 0;
virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) = 0;
virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) = 0;
virtual int CompareTo( pfGUIListElement *rightSide ) = 0;
virtual void SetSelected( hsBool sel ) { fSelected = sel; }
@ -91,9 +91,9 @@ class pfGUIListElement
virtual hsBool CanBeDragged( void ) { return false; }
// Return true here if you need the list refreshed
virtual hsBool MouseClicked( UInt16 localX, UInt16 localY ) { return false; }
virtual hsBool MouseClicked( uint16_t localX, uint16_t localY ) { return false; }
UInt8 GetType( void ) { return fType; }
uint8_t GetType( void ) { return fType; }
void SetColorScheme( pfGUIColorScheme *scheme ) { fColors = scheme; }
void SetSkin( pfGUISkin *skin ) { fSkin = skin; }
@ -101,8 +101,8 @@ class pfGUIListElement
hsBool IsCollapsed( void ) const { return fCollapsed; }
virtual void SetCollapsed( hsBool c ) { fCollapsed = c; }
UInt8 GetIndentLevel( void ) const { return fIndentLevel; }
void SetIndentLevel( UInt8 i ) { fIndentLevel = i; }
uint8_t GetIndentLevel( void ) const { return fIndentLevel; }
void SetIndentLevel( uint8_t i ) { fIndentLevel = i; }
};
class pfGUIListText : public pfGUIListElement
@ -119,7 +119,7 @@ class pfGUIListText : public pfGUIListElement
protected:
wchar_t *fText;
UInt8 fJustify; // This is not our JustifyTypes, but from plDynamicTextMap
uint8_t fJustify; // This is not our JustifyTypes, but from plDynamicTextMap
public:
@ -131,8 +131,8 @@ class pfGUIListText : public pfGUIListElement
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool CanBeDragged( void ) { return true; }
@ -149,7 +149,7 @@ class pfGUIListPicture : public pfGUIListElement
protected:
plKey fMipmapKey;
UInt8 fBorderSize; // Defaults to 2
uint8_t fBorderSize; // Defaults to 2
hsBool fRespectAlpha;
public:
@ -161,13 +161,13 @@ class pfGUIListPicture : public pfGUIListElement
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool CanBeDragged( void ) { return false; }
void SetBorderSize( UInt32 size ) { fBorderSize = (UInt8)size; }
void SetBorderSize( uint32_t size ) { fBorderSize = (uint8_t)size; }
void SetRespectAlpha( hsBool r ) { fRespectAlpha = r; }
};
@ -191,21 +191,21 @@ class pfGUIListTreeRoot : public pfGUIListElement
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool MouseClicked( UInt16 localX, UInt16 localY );
virtual hsBool MouseClicked( uint16_t localX, uint16_t localY );
const wchar_t *GetTitle( void ) { return fText; }
void SetTitle( const char *text );
void SetTitle( const wchar_t *text );
UInt32 GetNumChildren( void ) const { return fChildren.GetCount(); }
pfGUIListElement *GetChild( UInt32 i ) const { return fChildren[ i ]; }
uint32_t GetNumChildren( void ) const { return fChildren.GetCount(); }
pfGUIListElement *GetChild( uint32_t i ) const { return fChildren[ i ]; }
void AddChild( pfGUIListElement *el );
void RemoveChild( UInt32 idx );
void RemoveChild( uint32_t idx );
virtual void SetCollapsed( hsBool c );
@ -227,7 +227,7 @@ class pfGUIDropTargetProc
{
protected:
UInt32 fRefCnt;
uint32_t fRefCnt;
public:

View File

@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIMenuItem.h"
#include "pfGameGUIMgr.h"
#include "pfGUIControlHandlers.h"
@ -89,7 +89,7 @@ void pfGUIMenuItem::SetName( const wchar_t *name )
delete [] fName;
if (name != nil)
{
fName = TRACKED_NEW wchar_t[wcslen(name)+1];
fName = new wchar_t[wcslen(name)+1];
wcscpy(fName,name);
}
else
@ -107,7 +107,7 @@ void pfGUIMenuItem::SetSkin( pfGUISkin *skin, HowToSkin s )
GetKey()->Release( fSkin->GetKey() );
if( skin != nil )
hsgResMgr::ResMgr()->SendRef( skin->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( skin->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
fHowToSkin = s;
@ -126,7 +126,7 @@ void pfGUIMenuItem::IPostSetUpDynTextMap( void )
// Overridden so we can enlarge our DTMap by 3 vertically, to use the extra
// space as basically a double buffer for our skinning
void pfGUIMenuItem::IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height )
void pfGUIMenuItem::IGrowDTMDimsToDesiredSize( uint16_t &width, uint16_t &height )
{
height *= 3;
}
@ -147,7 +147,7 @@ void pfGUIMenuItem::IUpdateSkinBuffers( void )
if( fSkin->GetTexture() == nil )
return;
UInt16 y = fDynTextMap->GetVisibleHeight();
uint16_t y = fDynTextMap->GetVisibleHeight();
IUpdateSingleSkinBuffer( y, false );
IUpdateSingleSkinBuffer( y << 1, true );
@ -158,14 +158,14 @@ void pfGUIMenuItem::IUpdateSkinBuffers( void )
//// IUpdateSingleSkinBuffer /////////////////////////////////////////////////
// Broken down functionality for the above function
void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
void pfGUIMenuItem::IUpdateSingleSkinBuffer( uint16_t y, hsBool sel )
{
hsAssert( fSkin != nil && fDynTextMap != nil, "Invalid pointers in IUpdateSingleSkinBuffer()" );
// Note: add 1 to the visible height so we get enough overlap to take care of mipmapping issues
UInt16 x = 0, totWidth = fDynTextMap->GetVisibleWidth();
UInt16 totHeight = y + fDynTextMap->GetVisibleHeight();
uint16_t x = 0, totWidth = fDynTextMap->GetVisibleWidth();
uint16_t totHeight = y + fDynTextMap->GetVisibleHeight();
pfGUISkin::pfSRect element;
@ -180,7 +180,7 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
element = fSkin->GetElement( pfGUISkin::kTopSpan );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
uint16_t wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite );
@ -199,12 +199,12 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
}
// Group drawing by skin elements for caching performance
UInt16 startY = y;
uint16_t startY = y;
x = 0;
element = fSkin->GetElement( pfGUISkin::kLeftSpan );
for( ; y < totHeight; )
{
UInt16 ht = element.fHeight;
uint16_t ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite );
@ -218,13 +218,13 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
element = fSkin->GetElement( pfGUISkin::kMiddleFill );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
uint16_t wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
for( y = startY; y < totHeight; )
{
UInt16 ht = element.fHeight;
uint16_t ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, ht, plDynamicTextMap::kImgSprite );
@ -237,7 +237,7 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
element = fSkin->GetElement( pfGUISkin::kRightSpan );
for( y = startY; y < totHeight; )
{
UInt16 ht = element.fHeight;
uint16_t ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite );
@ -256,7 +256,7 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
element = fSkin->GetElement( pfGUISkin::kBottomSpan );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
uint16_t wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite );
@ -285,7 +285,7 @@ void pfGUIMenuItem::IUpdate( void )
return;
// Copy now from our skin buffer, plus set our text color
UInt16 y = fDynTextMap->GetVisibleHeight();
uint16_t y = fDynTextMap->GetVisibleHeight();
if( IsInteresting() )
{
@ -316,10 +316,10 @@ void pfGUIMenuItem::IUpdate( void )
if( fName != nil )
{
UInt16 ht;
uint16_t ht;
fDynTextMap->CalcStringWidth( fName, &ht );
Int16 x = 0, y = ( fDynTextMap->GetVisibleHeight() - ht ) >> 1;
int16_t x = 0, y = ( fDynTextMap->GetVisibleHeight() - ht ) >> 1;
if( fHowToSkin == kTop && fSkin != nil )
y += fSkin->GetElement( pfGUISkin::kTopSpan ).fHeight >> 1;
else if( fHowToSkin == kBottom && fSkin != nil )
@ -376,7 +376,7 @@ void pfGUIMenuItem::PurgeDynaTextMapImage()
//// GetTextExtents //////////////////////////////////////////////////////////
// Calculate the size of the drawn text.
void pfGUIMenuItem::GetTextExtents( UInt16 &width, UInt16 &height )
void pfGUIMenuItem::GetTextExtents( uint16_t &width, uint16_t &height )
{
if( fName == nil )
width = height = 0;
@ -405,19 +405,19 @@ void pfGUIMenuItem::Write( hsStream *s, hsResMgr *mgr )
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIMenuItem::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIMenuItem::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
pfGUIButtonMod::HandleMouseDown( mousePt, modifiers );
IUpdate();
}
void pfGUIMenuItem::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIMenuItem::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
pfGUIButtonMod::HandleMouseUp( mousePt, modifiers );
IUpdate();
}
void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
/* if( !fClicking )
return;
@ -441,7 +441,7 @@ void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
pfGUIButtonMod::HandleMouseDrag( mousePt, modifiers );
}
void pfGUIMenuItem::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIMenuItem::HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers )
{
pfGUIButtonMod::HandleMouseHover( mousePt, modifiers );
if( HasFlag( kReportHovers ) )

View File

@ -73,12 +73,12 @@ class pfGUIMenuItem : public pfGUIButtonMod
HowToSkin fHowToSkin;
hsBool fSkinBuffersUpdated;
virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height );
virtual void IGrowDTMDimsToDesiredSize( uint16_t &width, uint16_t &height );
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void IUpdateSkinBuffers( void );
void IUpdateSingleSkinBuffer( UInt16 y, hsBool sel );
void IUpdateSingleSkinBuffer( uint16_t y, hsBool sel );
public:
@ -108,10 +108,10 @@ class pfGUIMenuItem : public pfGUIButtonMod
virtual void SetInteresting( hsBool i );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers );
virtual void PurgeDynaTextMapImage();
@ -120,7 +120,7 @@ class pfGUIMenuItem : public pfGUIButtonMod
void SetName( const wchar_t *name );
const wchar_t *GetName( void ) const { return fName; }
void GetTextExtents( UInt16 &width, UInt16 &height );
void GetTextExtents( uint16_t &width, uint16_t &height );
void SetSkin( pfGUISkin *skin, HowToSkin s );
};

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIMultiLineEditCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIUpDownPairMod.h"
@ -68,12 +68,12 @@ class plStringSlicer
{
wchar_t *fString;
wchar_t fTempChar;
UInt32 fStart, fEnd;
uint32_t fStart, fEnd;
typedef wchar_t *CharPtr;
public:
plStringSlicer( wchar_t *string, UInt32 start, UInt32 end )
plStringSlicer( wchar_t *string, uint32_t start, uint32_t end )
{
fString = string;
fTempChar = string[ end ];
@ -82,7 +82,7 @@ class plStringSlicer
fEnd = end;
}
plStringSlicer( hsTArray<wchar_t> &string, UInt32 start, UInt32 end )
plStringSlicer( hsTArray<wchar_t> &string, uint32_t start, uint32_t end )
{
fString = string.AcquireArray();
fStart = start;
@ -137,8 +137,8 @@ class pfMLScrollProc : public pfGUICtrlProcObject
wchar_t pfGUIMultiLineEditCtrl::fColorCodeChar = (wchar_t)1;
wchar_t pfGUIMultiLineEditCtrl::fStyleCodeChar = (wchar_t)2;
UInt32 pfGUIMultiLineEditCtrl::fColorCodeSize = (wchar_t)5;
UInt32 pfGUIMultiLineEditCtrl::fStyleCodeSize = (wchar_t)3;
uint32_t pfGUIMultiLineEditCtrl::fColorCodeSize = (wchar_t)5;
uint32_t pfGUIMultiLineEditCtrl::fStyleCodeSize = (wchar_t)3;
//// Constructor/Destructor //////////////////////////////////////////////////
@ -189,7 +189,7 @@ pfGUIMultiLineEditCtrl::~pfGUIMultiLineEditCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIMultiLineEditCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIMultiLineEditCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -221,7 +221,7 @@ hsBool pfGUIMultiLineEditCtrl::MsgReceive( plMessage *msg )
//// SetScrollPosition ///////////////////////////////////////////////////////
void pfGUIMultiLineEditCtrl::SetScrollPosition( Int32 topLine )
void pfGUIMultiLineEditCtrl::SetScrollPosition( int32_t topLine )
{
if( topLine < 0 )
topLine = 0;
@ -240,7 +240,7 @@ void pfGUIMultiLineEditCtrl::SetScrollPosition( Int32 topLine )
if( fScrollControl != nil )
// Scroll control values are reversed
fScrollControl->SetCurrValue( fScrollControl->GetMax() - (hsScalar)fScrollPos );
fScrollControl->SetCurrValue( fScrollControl->GetMax() - (float)fScrollPos );
HandleExtendedEvent( pfGUIMultiLineEditCtrl::kScrollPosChanged );
@ -267,16 +267,16 @@ void pfGUIMultiLineEditCtrl::IUpdateScrollRange( void )
{
// +1 here because the last visible line is only a partial, but we want to be able to view
// full lines all the way to the end.
hsScalar newMax = (hsScalar)( fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 );
float newMax = (float)( fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 );
if( newMax != fScrollControl->GetMax() )
{
fScrollControl->SetRange( 0, (hsScalar)(fLineStarts.GetCount() - ICalcNumVisibleLines() + 1) );
fScrollControl->SetRange( 0, (float)(fLineStarts.GetCount() - ICalcNumVisibleLines() + 1) );
fScrollControl->SetEnabled( true );
if( fScrollPos > fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 )
{
fScrollPos = fLineStarts.GetCount() - ICalcNumVisibleLines() + 1;
fScrollControl->SetCurrValue( fScrollControl->GetMax() - (hsScalar)fScrollPos );
fScrollControl->SetCurrValue( fScrollControl->GetMax() - (float)fScrollPos );
}
// All bets are off on scrolling, so refresh the whole area
@ -354,11 +354,11 @@ void pfGUIMultiLineEditCtrl::IPostSetUpDynTextMap( void )
//// ICalcNumVisibleLines ////////////////////////////////////////////////////
Int32 pfGUIMultiLineEditCtrl::ICalcNumVisibleLines( void ) const
int32_t pfGUIMultiLineEditCtrl::ICalcNumVisibleLines( void ) const
{
if (fDynTextMap == nil || fLineHeight == 0)
return 0;
Int32 numLines = 0;
int32_t numLines = 0;
numLines = (fDynTextMap->GetVisibleHeight() + fLineHeight - (fTopMargin+fBottomMargin+1))/fLineHeight;
return numLines;
}
@ -366,13 +366,13 @@ Int32 pfGUIMultiLineEditCtrl::ICalcNumVisibleLines( void ) const
//// IUpdate /////////////////////////////////////////////////////////////////
// Ranged version
void pfGUIMultiLineEditCtrl::IUpdate( Int32 startLine, Int32 endLine )
void pfGUIMultiLineEditCtrl::IUpdate( int32_t startLine, int32_t endLine )
{
hsColorRGBA c;
static int testingFlip = 0;
bool clearEachLine = true;
UInt32 line, x, y = 0;
Int32 numVisibleLines, lastVisibleLine;
uint32_t line, x, y = 0;
int32_t numVisibleLines, lastVisibleLine;
if( !fReadyToRender )
@ -427,41 +427,41 @@ void pfGUIMultiLineEditCtrl::IUpdate( Int32 startLine, Int32 endLine )
// Clear this line
if( clearEachLine )
{
fDynTextMap->FillRect( 0, (UInt16)y, fDynTextMap->GetVisibleWidth(), fLineHeight,
fDynTextMap->FillRect( 0, (uint16_t)y, fDynTextMap->GetVisibleWidth(), fLineHeight,
GetColorScheme()->fBackColor );
}
UInt32 start = fLineStarts[ line ], end;
uint32_t start = fLineStarts[ line ], end;
if( line == fLineStarts.GetCount() - 1 )
end = fBuffer.GetCount();
else
end = fLineStarts[ line + 1 ];
// Render the actual text
IRenderLine( fLeftMargin, (UInt16)y, start, end );
IRenderLine( fLeftMargin, (uint16_t)y, start, end );
// Render the cursor
if( fCursorPos >= start && fCursorPos < end && IsFocused() )
{
if( fCursorPos > start )
x = IRenderLine( fLeftMargin, (UInt16)y, start, fCursorPos, true );
x = IRenderLine( fLeftMargin, (uint16_t)y, start, fCursorPos, true );
else
x = fLeftMargin;
fDynTextMap->FrameRect( (UInt16)x, (UInt16)y, 2, fLineHeight, GetColorScheme()->fSelForeColor );
fDynTextMap->FrameRect( (uint16_t)x, (uint16_t)y, 2, fLineHeight, GetColorScheme()->fSelForeColor );
// Store the cursor X,Y pair. Go figure, the ONLY time we actually need this is
// to move up or down one line, and even then it's only because we want to keep
// the same approximate horizontal position (versus same character offset)
fCurrCursorX = (UInt16)x;
fCurrCursorY = (UInt16)y;
fCurrCursorX = (uint16_t)x;
fCurrCursorY = (uint16_t)y;
}
y += fLineHeight;
}
if( clearEachLine && line >= fLineStarts.GetCount() && y < fDynTextMap->GetVisibleHeight()-fBottomMargin )
{
// No lines left, so clear the rest of the visible area
fDynTextMap->FillRect( 0, (UInt16)y, fDynTextMap->GetVisibleWidth(), (UInt16)(fDynTextMap->GetVisibleHeight() - y),
fDynTextMap->FillRect( 0, (uint16_t)y, fDynTextMap->GetVisibleWidth(), (uint16_t)(fDynTextMap->GetVisibleHeight() - y),
GetColorScheme()->fBackColor );
}
fDynTextMap->FlushToHost();
@ -471,17 +471,17 @@ void pfGUIMultiLineEditCtrl::IUpdate( Int32 startLine, Int32 endLine )
// Reads a color code from the given position and advances the given position
// appropriately
void pfGUIMultiLineEditCtrl::IReadColorCode( Int32 &pos, hsColorRGBA &color ) const
void pfGUIMultiLineEditCtrl::IReadColorCode( int32_t &pos, hsColorRGBA &color ) const
{
UInt16 *buffer = (UInt16 *)fBuffer.AcquireArray() + pos;
UInt8 r, g, b;
uint16_t *buffer = (uint16_t *)fBuffer.AcquireArray() + pos;
uint8_t r, g, b;
hsAssert( buffer[ 0 ] == fColorCodeChar, "Invalid position in IReadColorCode()" );
buffer++;
r = (UInt8)buffer[ 0 ];
g = (UInt8)buffer[ 1 ];
b = (UInt8)buffer[ 2 ];
r = (uint8_t)buffer[ 0 ];
g = (uint8_t)buffer[ 1 ];
b = (uint8_t)buffer[ 2 ];
pos += fColorCodeSize; // We have a duplicate code at the end of this block, for searching backwards
color.Set( r / 255.f, g / 255.f, b / 255.f, fFontColor.a );
}
@ -490,13 +490,13 @@ void pfGUIMultiLineEditCtrl::IReadColorCode( Int32 &pos, hsColorRGBA &color )
// Reads a style code from the given position and advances the given position
// appropriately
void pfGUIMultiLineEditCtrl::IReadStyleCode( Int32 &pos, UInt8 &fontFlags ) const
void pfGUIMultiLineEditCtrl::IReadStyleCode( int32_t &pos, uint8_t &fontFlags ) const
{
UInt16 *buffer = (UInt16 *)fBuffer.AcquireArray() + pos;
uint16_t *buffer = (uint16_t *)fBuffer.AcquireArray() + pos;
hsAssert( buffer[ 0 ] == fStyleCodeChar, "Invalid position in IReadStyleCode()" );
fontFlags = (UInt8)buffer[ 1 ];
fontFlags = (uint8_t)buffer[ 1 ];
pos += fStyleCodeSize; // We have a duplicate code at the end of this block, for searching backwards
}
@ -516,7 +516,7 @@ inline bool pfGUIMultiLineEditCtrl::IIsCodeChar( const wchar_t c )
// type. If none is found, they set the given parameter to the default value
// and return false.
hsBool pfGUIMultiLineEditCtrl::IFindLastColorCode( Int32 pos, hsColorRGBA &color, hsBool ignoreFirstCharacter ) const
hsBool pfGUIMultiLineEditCtrl::IFindLastColorCode( int32_t pos, hsColorRGBA &color, hsBool ignoreFirstCharacter ) const
{
for( ; pos >= 0; pos -= IOffsetToNextCharFromPos( pos - 1 ) )
{
@ -531,7 +531,7 @@ hsBool pfGUIMultiLineEditCtrl::IFindLastColorCode( Int32 pos, hsColorRGBA &colo
return false;
}
hsBool pfGUIMultiLineEditCtrl::IFindLastStyleCode( Int32 pos, UInt8 &style, hsBool ignoreFirstCharacter ) const
hsBool pfGUIMultiLineEditCtrl::IFindLastStyleCode( int32_t pos, uint8_t &style, hsBool ignoreFirstCharacter ) const
{
for( ; pos >= 0; pos -= IOffsetToNextCharFromPos( pos - 1 ) )
{
@ -552,11 +552,11 @@ hsBool pfGUIMultiLineEditCtrl::IFindLastStyleCode( Int32 pos, UInt8 &style, hsB
// given. Takes into account style codes and special characters (like returns
// and tabs). Returns the final X value after rendering.
UInt32 pfGUIMultiLineEditCtrl::IRenderLine( UInt16 x, UInt16 y, Int32 start, Int32 end, hsBool dontRender )
uint32_t pfGUIMultiLineEditCtrl::IRenderLine( uint16_t x, uint16_t y, int32_t start, int32_t end, hsBool dontRender )
{
Int32 pos;
int32_t pos;
hsColorRGBA currColor = fFontColor;
UInt8 currStyle;
uint8_t currStyle;
const wchar_t *buffer = fBuffer.AcquireArray();
// First, gotta go back from our starting position and find a color and style code to use
@ -649,9 +649,9 @@ void pfGUIMultiLineEditCtrl::Read( hsStream *s, hsResMgr *mgr )
fScrollControl = nil;
if( s->ReadBool() )
{
fScrollProc = TRACKED_NEW pfMLScrollProc( this );
fScrollProc = new pfMLScrollProc( this );
fScrollProc->IncRef();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef );
}
}
@ -671,11 +671,11 @@ void pfGUIMultiLineEditCtrl::Write( hsStream *s, hsResMgr *mgr )
//// IPointToPosition ////////////////////////////////////////////////////////
// Translates a 2D point on the visible texture surface to a cursor position.
Int32 pfGUIMultiLineEditCtrl::IPointToPosition( Int16 ptX, Int16 ptY, hsBool searchOutsideBounds )
int32_t pfGUIMultiLineEditCtrl::IPointToPosition( int16_t ptX, int16_t ptY, hsBool searchOutsideBounds )
{
// Find our line
Int32 line, start, pos, end, lastVisibleLine;
Int16 x, y;
int32_t line, start, pos, end, lastVisibleLine;
int16_t x, y;
if (fPrevCtrl)
fScrollPos = GetFirstVisibleLine(); // update the scroll position if we are linked
@ -690,7 +690,7 @@ Int32 pfGUIMultiLineEditCtrl::IPointToPosition( Int16 ptX, Int16 ptY, hsBool s
}
line = searchOutsideBounds ? 0 : fScrollPos;
y = (Int16)(-( fScrollPos - line ) * fLineHeight);
y = (int16_t)(-( fScrollPos - line ) * fLineHeight);
y += fTopMargin;
for( ; line < lastVisibleLine; line++, y += fLineHeight )
{
@ -705,7 +705,7 @@ Int32 pfGUIMultiLineEditCtrl::IPointToPosition( Int16 ptX, Int16 ptY, hsBool s
for( pos = start; pos < end; pos++ )
{
x = (Int16)IRenderLine( fLeftMargin, 0, start, pos, true );
x = (int16_t)IRenderLine( fLeftMargin, 0, start, pos, true );
if( x > ptX )
break;
}
@ -729,7 +729,7 @@ inline bool IIsWordBreaker( const wchar_t c )
//// IOffsetToNextChar ///////////////////////////////////////////////////////
inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextChar( wchar_t stringChar )
inline int32_t pfGUIMultiLineEditCtrl::IOffsetToNextChar( wchar_t stringChar )
{
if( stringChar == fColorCodeChar )
return fColorCodeSize;
@ -739,7 +739,7 @@ inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextChar( wchar_t stringChar )
return 1;
}
inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( Int32 position ) const
inline int32_t pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( int32_t position ) const
{
if( position >= 0 )
return IOffsetToNextChar( fBuffer[ position ] );
@ -748,7 +748,7 @@ inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( Int32 position
}
//// IRecalcLineStarts ///////////////////////////////////////////////////////
// Recalculates all the word wrapping/line start values, starting at the
// Recalculates all the uint16_t wrapping/line start values, starting at the
// given line. If not forced, recalc will stop once a calculated line start
// matches one already stored (this implying that everything after will be
// the same as well, assuming contents are the same). If this assumption can't
@ -758,11 +758,11 @@ inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( Int32 position
// changed, so we assume as a hint that every line before the starting line
// is still valid. If startingLine = 0, we recalc 'em all.
Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool force, hsBool dontUpdate )
int32_t pfGUIMultiLineEditCtrl::IRecalcLineStarts( int32_t startingLine, hsBool force, hsBool dontUpdate )
{
UInt16 wrapWidth, widthCounter;
UInt32 charPos = 0, nextPos, startPos, lastStartPos;
Int32 currLine, realStartingLine;
uint16_t wrapWidth, widthCounter;
uint32_t charPos = 0, nextPos, startPos, lastStartPos;
int32_t currLine, realStartingLine;
bool firstLine;
wchar_t *buffer;
const wchar_t wordBreaks[] = L" \t,.";
@ -805,7 +805,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo
wrapWidth = fDynTextMap->GetVisibleWidth() - fRightMargin;
buffer = fBuffer.AcquireArray();
firstLine = true;
lastStartPos = (UInt32)-1;
lastStartPos = (uint32_t)-1;
for( ; charPos < fBuffer.GetCount(); currLine++ )
{
@ -831,7 +831,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo
firstLine = false;
//// We do a walk where we find the start of the next word (i.e. the end of this word plus
//// We do a walk where we find the start of the next uint16_t (i.e. the end of this uint16_t plus
//// any "white space"), and then see if we can fit everything up to that point. If we can,
//// keep walking, if not, stop at whatever we had as a starting point.
nextPos = charPos;
@ -855,7 +855,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo
nextPos += IOffsetToNextChar( buffer[ nextPos ] );
// Now see how much width this is
widthCounter = (UInt16)IRenderLine( fLeftMargin, 0, startPos, nextPos, true );
widthCounter = (uint16_t)IRenderLine( fLeftMargin, 0, startPos, nextPos, true );
// Now we loop. If wrapWidth is too much, we'll break the loop with charPos pointing to the
// end of our line. If not, charPos will advance to start the search again
@ -869,7 +869,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo
while( widthCounter >= wrapWidth && nextPos > startPos )
{
nextPos -= IOffsetToNextChar( buffer[ nextPos - 1 ] );
widthCounter = (UInt16)IRenderLine( fLeftMargin, 0, startPos, nextPos, true );
widthCounter = (uint16_t)IRenderLine( fLeftMargin, 0, startPos, nextPos, true );
}
charPos = nextPos;
@ -900,7 +900,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo
//// IStoreLineStart /////////////////////////////////////////////////////////
// Stores a single line start, expanding the array if necessary.
hsBool pfGUIMultiLineEditCtrl::IStoreLineStart( UInt32 line, Int32 start )
hsBool pfGUIMultiLineEditCtrl::IStoreLineStart( uint32_t line, int32_t start )
{
if( fLineStarts.GetCount() <= line )
{
@ -918,9 +918,9 @@ hsBool pfGUIMultiLineEditCtrl::IStoreLineStart( UInt32 line, Int32 start )
//// IFindCursorLine /////////////////////////////////////////////////////////
// Calculates the line the cursor is sitting on
Int32 pfGUIMultiLineEditCtrl::IFindCursorLine( Int32 cursorPos ) const
int32_t pfGUIMultiLineEditCtrl::IFindCursorLine( int32_t cursorPos ) const
{
Int32 line;
int32_t line;
if( cursorPos == -1 )
@ -951,9 +951,9 @@ void pfGUIMultiLineEditCtrl::IRecalcFromCursor( hsBool force )
// doing this, we are inserting into (and offseting inside) a selection,
// so we don't want the start moving around.
void pfGUIMultiLineEditCtrl::IOffsetLineStarts( UInt32 position, Int32 offset, hsBool offsetSelectionEnd )
void pfGUIMultiLineEditCtrl::IOffsetLineStarts( uint32_t position, int32_t offset, hsBool offsetSelectionEnd )
{
Int32 line;
int32_t line;
// Check our first line and make sure offsetting it won't make it invalid.
// If it will, we need to recalc the line starts entirely (which is fine,
@ -990,7 +990,7 @@ void pfGUIMultiLineEditCtrl::IOffsetLineStarts( UInt32 position, Int32 offset
//// HandleMouseDown /////////////////////////////////////////////////////////
void pfGUIMultiLineEditCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIMultiLineEditCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fDynTextMap == nil || !fBounds.IsInside( &mousePt ) )
return;
@ -999,12 +999,12 @@ void pfGUIMultiLineEditCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifi
mousePt.fX *= fDynTextMap->GetVisibleWidth();
mousePt.fY *= fDynTextMap->GetVisibleHeight();
IMoveCursorTo( IPointToPosition( (Int16)(mousePt.fX), (Int16)(mousePt.fY) ) );
IMoveCursorTo( IPointToPosition( (int16_t)(mousePt.fX), (int16_t)(mousePt.fY) ) );
}
//// HandleMouseUp ///////////////////////////////////////////////////////////
void pfGUIMultiLineEditCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIMultiLineEditCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fDynTextMap == nil || !fBounds.IsInside( &mousePt ) )
return;
@ -1013,12 +1013,12 @@ void pfGUIMultiLineEditCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifier
mousePt.fX *= fDynTextMap->GetVisibleWidth();
mousePt.fY *= fDynTextMap->GetVisibleHeight();
IMoveCursorTo( IPointToPosition( (Int16)(mousePt.fX), (Int16)(mousePt.fY) ) );
IMoveCursorTo( IPointToPosition( (int16_t)(mousePt.fX), (int16_t)(mousePt.fY) ) );
}
//// HandleMouseDrag /////////////////////////////////////////////////////////
void pfGUIMultiLineEditCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUIMultiLineEditCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
if( fDynTextMap == nil || !fBounds.IsInside( &mousePt ) )
return;
@ -1027,10 +1027,10 @@ void pfGUIMultiLineEditCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifi
mousePt.fX *= fDynTextMap->GetVisibleWidth();
mousePt.fY *= fDynTextMap->GetVisibleHeight();
IMoveCursorTo( IPointToPosition( (Int16)(mousePt.fX), (Int16)(mousePt.fY) ) );
IMoveCursorTo( IPointToPosition( (int16_t)(mousePt.fX), (int16_t)(mousePt.fY) ) );
}
hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, UInt8 modifiers )
hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, uint8_t modifiers )
{
if ((fPrevCtrl || fNextCtrl) && (fLineStarts.GetCount() <= GetFirstVisibleLine()))
return true; // we're ignoring if we can't actually edit our visible frame (and we're linked)
@ -1062,7 +1062,7 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, UInt8 modifiers )
return true;
}
hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers )
hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers )
{
if( key == KEY_CAPSLOCK )
return false;
@ -1136,11 +1136,11 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, p
// should probably call IMoveCursorTo() unless you really know what you're
// doing and don't want the current selection updated.
void pfGUIMultiLineEditCtrl::ISetCursor( Int32 newPosition )
void pfGUIMultiLineEditCtrl::ISetCursor( int32_t newPosition )
{
fCursorPos = newPosition;
Int32 newLine = IFindCursorLine();
int32_t newLine = IFindCursorLine();
// Rescroll if necessary
if( fLastCursorLine != newLine )
@ -1161,7 +1161,7 @@ void pfGUIMultiLineEditCtrl::ISetCursor( Int32 newPosition )
{
// -2 here for a reason: 1 because we want the last fully visible line, not partially visible,
// and 1 because we want the actual last visible line index, which is of course start + len - 1
Int32 delta = newLine - ( fScrollPos + ICalcNumVisibleLines() - 2 );
int32_t delta = newLine - ( fScrollPos + ICalcNumVisibleLines() - 2 );
if( delta > 0 )
{
if (fNextCtrl) // we are linked
@ -1190,7 +1190,7 @@ void pfGUIMultiLineEditCtrl::ISetCursor( Int32 newPosition )
void pfGUIMultiLineEditCtrl::IMoveCursor( pfGUIMultiLineEditCtrl::Direction dir )
{
Int32 cursor = fCursorPos, line, offset, end;
int32_t cursor = fCursorPos, line, offset, end;
switch( dir )
@ -1299,7 +1299,7 @@ void pfGUIMultiLineEditCtrl::IMoveCursor( pfGUIMultiLineEditCtrl::Direction d
// Moves the cursor to the given absolute position and updates the selection
// area accordingly and if necessary.
void pfGUIMultiLineEditCtrl::IMoveCursorTo( Int32 position )
void pfGUIMultiLineEditCtrl::IMoveCursorTo( int32_t position )
{
ISetCursor( position );
}
@ -1387,14 +1387,14 @@ void pfGUIMultiLineEditCtrl::InsertColor( hsColorRGBA &color )
// insertion of this code changes appearance of following characters
}
void pfGUIMultiLineEditCtrl::IActuallyInsertColor( Int32 pos, hsColorRGBA &color )
void pfGUIMultiLineEditCtrl::IActuallyInsertColor( int32_t pos, hsColorRGBA &color )
{
if ( fBufferLimit == -1 || fBuffer.GetCount()+4 < fBufferLimit-1 )
{
fBuffer.Insert( pos, fColorCodeChar );
fBuffer.Insert( pos + 1, (UInt8)( color.r * 255.f ) );
fBuffer.Insert( pos + 2, (UInt8)( color.g * 255.f ) );
fBuffer.Insert( pos + 3, (UInt8)( color.b * 255.f ) );
fBuffer.Insert( pos + 1, (uint8_t)( color.r * 255.f ) );
fBuffer.Insert( pos + 2, (uint8_t)( color.g * 255.f ) );
fBuffer.Insert( pos + 3, (uint8_t)( color.b * 255.f ) );
fBuffer.Insert( pos + 4, fColorCodeChar );
}
}
@ -1402,7 +1402,7 @@ void pfGUIMultiLineEditCtrl::IActuallyInsertColor( Int32 pos, hsColorRGBA &co
//// InsertStyle /////////////////////////////////////////////////////////////
// Same thing as InsertColor(), only with a style code (or two).
void pfGUIMultiLineEditCtrl::InsertStyle( UInt8 fontStyle )
void pfGUIMultiLineEditCtrl::InsertStyle( uint8_t fontStyle )
{
IActuallyInsertStyle( fCursorPos, fontStyle );
@ -1412,7 +1412,7 @@ void pfGUIMultiLineEditCtrl::InsertStyle( UInt8 fontStyle )
// insertion of this code changes appearance of following characters
}
void pfGUIMultiLineEditCtrl::IActuallyInsertStyle( Int32 pos, UInt8 style )
void pfGUIMultiLineEditCtrl::IActuallyInsertStyle( int32_t pos, uint8_t style )
{
if ( fBufferLimit == -1 || fBuffer.GetCount() + 3 < fBufferLimit-1 )
{
@ -1431,7 +1431,7 @@ void pfGUIMultiLineEditCtrl::DeleteChar( void )
{
if( fCursorPos < fBuffer.GetCount() - 1 )
{
Int32 offset = IOffsetToNextChar( fBuffer[ fCursorPos ] );
int32_t offset = IOffsetToNextChar( fBuffer[ fCursorPos ] );
bool forceUpdate = IIsCodeChar( fBuffer[ fCursorPos ] );
fBuffer.Remove( fCursorPos, offset );
@ -1446,9 +1446,9 @@ void pfGUIMultiLineEditCtrl::DeleteChar( void )
// Generic coded-to-non-coded conversion. Returns a copy of the string that
// the caller must free.
wchar_t *pfGUIMultiLineEditCtrl::ICopyRange( Int32 start, Int32 end ) const
wchar_t *pfGUIMultiLineEditCtrl::ICopyRange( int32_t start, int32_t end ) const
{
Int32 stringSize, pos;
int32_t stringSize, pos;
wchar_t *string;
@ -1460,7 +1460,7 @@ wchar_t *pfGUIMultiLineEditCtrl::ICopyRange( Int32 start, Int32 end ) const
}
// Our string...
string = TRACKED_NEW wchar_t[ stringSize + 1 ];
string = new wchar_t[ stringSize + 1 ];
// Now actually copy the characters
for( stringSize = 0, pos = start; pos < end; pos = pos + IOffsetToNextChar( fBuffer[ pos ] ) )
@ -1493,29 +1493,29 @@ void pfGUIMultiLineEditCtrl::ClearBuffer( void )
void pfGUIMultiLineEditCtrl::SetBuffer( const char *asciiText )
{
SetBuffer( (const UInt8 *)asciiText, (UInt32)strlen( asciiText ) );
SetBuffer( (const uint8_t *)asciiText, (uint32_t)strlen( asciiText ) );
}
void pfGUIMultiLineEditCtrl::SetBuffer( const wchar_t *asciiText )
{
SetBuffer( (const UInt16 *)asciiText, (UInt32)wcslen( asciiText ) );
SetBuffer( (const uint16_t *)asciiText, (uint32_t)wcslen( asciiText ) );
}
//// SetBuffer ///////////////////////////////////////////////////////////////
// The non-0-terminated-string version that can handle buffers with style
// codes in them.
void pfGUIMultiLineEditCtrl::SetBuffer( const UInt8 *codedText, UInt32 length )
void pfGUIMultiLineEditCtrl::SetBuffer( const uint8_t *codedText, uint32_t length )
{
// convert to UInt16 and set
UInt16 *convertedText = TRACKED_NEW UInt16[ length ];
for( Int32 curChar = 0; curChar < length; curChar++ )
convertedText[ curChar ] = (UInt16)codedText[ curChar ];
// convert to uint16_t and set
uint16_t *convertedText = new uint16_t[ length ];
for( int32_t curChar = 0; curChar < length; curChar++ )
convertedText[ curChar ] = (uint16_t)codedText[ curChar ];
SetBuffer(convertedText,length);
delete [] convertedText;
}
void pfGUIMultiLineEditCtrl::SetBuffer( const UInt16 *codedText, UInt32 length )
void pfGUIMultiLineEditCtrl::SetBuffer( const uint16_t *codedText, uint32_t length )
{
// recursively call back to the first control and set it
if (fPrevCtrl)
@ -1574,7 +1574,7 @@ wchar_t *pfGUIMultiLineEditCtrl::GetNonCodedBufferW( void ) const
// Basically does a blanket copy of the entire buffer and returns it and
// the length. The caller is responsible for freeing the buffer.
UInt8 *pfGUIMultiLineEditCtrl::GetCodedBuffer( UInt32 &length ) const
uint8_t *pfGUIMultiLineEditCtrl::GetCodedBuffer( uint32_t &length ) const
{
// recursively search back to the first control in the linked list and grab its buffer
if (fPrevCtrl)
@ -1583,24 +1583,24 @@ UInt8 *pfGUIMultiLineEditCtrl::GetCodedBuffer( UInt32 &length ) const
{
length = fBuffer.GetCount() - 1;
// convert to UInt8 and return
UInt8 *buffer = TRACKED_NEW UInt8[ length ];
// convert to uint8_t and return
uint8_t *buffer = new uint8_t[ length ];
for (Int32 curChar = 0; curChar < length; curChar++)
for (int32_t curChar = 0; curChar < length; curChar++)
{
if (fBuffer[ curChar ] > (wchar_t)0xFF)
{
// char doesn't fit, fake it with a space
buffer[ curChar ] = (UInt8)(L' ');
buffer[ curChar ] = (uint8_t)(L' ');
}
else
buffer[ curChar ] = (UInt8)fBuffer[ curChar ];
buffer[ curChar ] = (uint8_t)fBuffer[ curChar ];
}
return buffer;
}
}
UInt16 *pfGUIMultiLineEditCtrl::GetCodedBufferW( UInt32 &length ) const
uint16_t *pfGUIMultiLineEditCtrl::GetCodedBufferW( uint32_t &length ) const
{
// recursively search back to the first control in the linked list and grab its buffer
if (fPrevCtrl)
@ -1609,16 +1609,16 @@ UInt16 *pfGUIMultiLineEditCtrl::GetCodedBufferW( UInt32 &length ) const
{
length = fBuffer.GetCount() - 1;
UInt16 *buffer = TRACKED_NEW UInt16[ length ];
uint16_t *buffer = new uint16_t[ length ];
// AcquireArray() isn't const...
memcpy( buffer, &fBuffer[ 0 ], length * sizeof(UInt16) );
memcpy( buffer, &fBuffer[ 0 ], length * sizeof(uint16_t) );
return buffer;
}
}
UInt32 pfGUIMultiLineEditCtrl::GetBufferSize()
uint32_t pfGUIMultiLineEditCtrl::GetBufferSize()
{
return fBuffer.GetCount() - 1;
}
@ -1627,9 +1627,9 @@ UInt32 pfGUIMultiLineEditCtrl::GetBufferSize()
// Given a character position (i.e. a buffer position if we didn't have
// control codes), returns the actual buffer pos.
Int32 pfGUIMultiLineEditCtrl::ICharPosToBufferPos( Int32 charPos ) const
int32_t pfGUIMultiLineEditCtrl::ICharPosToBufferPos( int32_t charPos ) const
{
Int32 pos;
int32_t pos;
for( pos = 0; charPos > 0 && pos < fBuffer.GetCount() - 1; pos += IOffsetToNextCharFromPos( pos ), charPos-- );
@ -1720,7 +1720,7 @@ void pfGUIMultiLineEditCtrl::ClearEventProc()
}
}
Int32 pfGUIMultiLineEditCtrl::GetFirstVisibleLine()
int32_t pfGUIMultiLineEditCtrl::GetFirstVisibleLine()
{
// recursively search back to the first control and work our way forwards to where we are supposed to be
if (fPrevCtrl)
@ -1728,13 +1728,13 @@ Int32 pfGUIMultiLineEditCtrl::GetFirstVisibleLine()
return fScrollPos; // we're the first control, so we show the first part of the buffer
}
Int32 pfGUIMultiLineEditCtrl::GetLastVisibleLine()
int32_t pfGUIMultiLineEditCtrl::GetLastVisibleLine()
{
// simply add our number of lines to our first visible line
return GetFirstVisibleLine()+ICalcNumVisibleLines()-1;
}
void pfGUIMultiLineEditCtrl::SetGlobalStartLine(Int32 line)
void pfGUIMultiLineEditCtrl::SetGlobalStartLine(int32_t line)
{
// recursively call back to the first control and set it
if (fPrevCtrl)
@ -1762,8 +1762,8 @@ void pfGUIMultiLineEditCtrl::IUpdateBuffer()
if (fPrevCtrl)
{
// copy the buffer from our global one
UInt32 length;
UInt16 *codedText = GetCodedBufferW(length);
uint32_t length;
uint16_t *codedText = GetCodedBufferW(length);
fBuffer.Reset();
fBuffer.Insert( 0, length, (wchar_t *)codedText );
fBuffer.Append( 0 );
@ -1783,7 +1783,7 @@ void pfGUIMultiLineEditCtrl::ISetGlobalBuffer()
}
}
void pfGUIMultiLineEditCtrl::ISetLineStarts(hsTArray<Int32> lineStarts)
void pfGUIMultiLineEditCtrl::ISetLineStarts(hsTArray<int32_t> lineStarts)
{
if (fNextCtrl)
fNextCtrl->ISetLineStarts(lineStarts); // pass it on down
@ -1803,7 +1803,7 @@ void pfGUIMultiLineEditCtrl::SetMargins(int top, int left, int bottom, int right
IRecalcLineStarts(0,false);
}
void pfGUIMultiLineEditCtrl::IHitEndOfControlList(Int32 cursorPos)
void pfGUIMultiLineEditCtrl::IHitEndOfControlList(int32_t cursorPos)
{
if (fPrevCtrl)
fPrevCtrl->IHitEndOfControlList(cursorPos);
@ -1814,7 +1814,7 @@ void pfGUIMultiLineEditCtrl::IHitEndOfControlList(Int32 cursorPos)
}
}
void pfGUIMultiLineEditCtrl::IHitBeginningOfControlList(Int32 cursorPos)
void pfGUIMultiLineEditCtrl::IHitBeginningOfControlList(int32_t cursorPos)
{
if (fPrevCtrl)
fPrevCtrl->IHitBeginningOfControlList(cursorPos);
@ -1834,7 +1834,7 @@ void pfGUIMultiLineEditCtrl::SetFontFace(std::string fontFace)
fDynTextMap->CalcStringWidth( "The quick brown fox jumped over the lazy dog.", &fLineHeight );
}
void pfGUIMultiLineEditCtrl::SetFontSize(UInt8 fontSize)
void pfGUIMultiLineEditCtrl::SetFontSize(uint8_t fontSize)
{
fFontSize = fontSize;
fFontFlagsSet |= kFontSizeSet;
@ -1867,8 +1867,8 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines)
if (fPrevCtrl || fNextCtrl)
return; // don't do anything
UInt32 bufferLen = 0;
UInt16* buffer = GetCodedBufferW(bufferLen);
uint32_t bufferLen = 0;
uint16_t* buffer = GetCodedBufferW(bufferLen);
if (bufferLen == 0)
{
@ -1883,7 +1883,7 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines)
// search for the first newline and nuke it and everything before it
bool skippingColor = false, skippingStyle = false;
int curColorPos = 0, curStylePos = 0;
for (UInt32 curChar = 0; curChar < bufferLen - 1; ++curChar)
for (uint32_t curChar = 0; curChar < bufferLen - 1; ++curChar)
{
// we need to skip the crappy color and style "tags" so non-character values inside them
// don't trigger our newline check
@ -1925,10 +1925,10 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines)
if ((buffer[curChar] == L'\n') || (buffer[curChar] == L'\r'))
{
hitEnd = false;
UInt32 newBufferStart = curChar + 1; // +1 so we eat the newline as well
UInt32 newBufferLen = bufferLen - newBufferStart;
MemCopy(buffer, buffer + newBufferStart, newBufferLen * sizeof(UInt16)); // copy all bytes after the newline to the beginning
MemSet(buffer + newBufferLen, 0, (bufferLen - newBufferLen) * sizeof(UInt16)); // fill out the rest of the buffer with null chars
uint32_t newBufferStart = curChar + 1; // +1 so we eat the newline as well
uint32_t newBufferLen = bufferLen - newBufferStart;
memcpy(buffer, buffer + newBufferStart, newBufferLen * sizeof(uint16_t)); // copy all bytes after the newline to the beginning
memset(buffer + newBufferLen, 0, (bufferLen - newBufferLen) * sizeof(uint16_t)); // fill out the rest of the buffer with null chars
bufferLen = newBufferLen;
break;
}

View File

@ -68,10 +68,10 @@ public:
virtual ~pfGUIMultiLineEditProc() {}
// we've hit the end of the control list (by moving the cursor)
virtual void OnEndOfControlList(Int32 cursorPos) {}
virtual void OnEndOfControlList(int32_t cursorPos) {}
// we've hit the beginning of the control ist (by moving the cursor)
virtual void OnBeginningOfControlList(Int32 cursorPos) {}
virtual void OnBeginningOfControlList(int32_t cursorPos) {}
};
class pfGUIMultiLineEditCtrl : public pfGUIControlMod
@ -97,32 +97,32 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
mutable hsTArray<wchar_t> fBuffer; // Because AcquireArray() isn't const
hsTArray<Int32> fLineStarts;
UInt16 fLineHeight, fCurrCursorX, fCurrCursorY;
Int32 fCursorPos, fLastCursorLine;
hsTArray<int32_t> fLineStarts;
uint16_t fLineHeight, fCurrCursorX, fCurrCursorY;
int32_t fCursorPos, fLastCursorLine;
hsBool fIgnoreNextKey, fReadyToRender;
hsBounds3Ext fLastP2PArea;
Int8 fLockCount;
UInt8 fCalcedFontSize; // The font size that we calced our line height at
int8_t fLockCount;
uint8_t fCalcedFontSize; // The font size that we calced our line height at
UInt8 fLastKeyModifiers;
uint8_t fLastKeyModifiers;
wchar_t fLastKeyPressed;
static wchar_t fColorCodeChar, fStyleCodeChar;
static UInt32 fColorCodeSize, fStyleCodeSize;
static uint32_t fColorCodeSize, fStyleCodeSize;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void IUpdate( Int32 startLine, Int32 endLine );
void IUpdate( int32_t startLine, int32_t endLine );
friend class pfMLScrollProc;
pfGUIValueCtrl *fScrollControl;
pfMLScrollProc *fScrollProc;
Int32 fScrollPos;
Int32 fBufferLimit;
int32_t fScrollPos;
int32_t fBufferLimit;
pfGUIMultiLineEditCtrl *fNextCtrl; // used for linking multiple controls together to share a buffer
pfGUIMultiLineEditCtrl *fPrevCtrl;
@ -131,8 +131,8 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
std::string fFontFace;
hsColorRGBA fFontColor;
UInt8 fFontSize;
UInt8 fFontStyle;
uint8_t fFontSize;
uint8_t fFontStyle;
enum flagsSet
{
kFontFaceSet = 1,
@ -140,49 +140,49 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
kFontSizeSet = 4,
kFontStyleSet = 8
};
UInt8 fFontFlagsSet;
uint8_t fFontFlagsSet;
int fTopMargin,fLeftMargin,fBottomMargin,fRightMargin;
void IMoveCursor( Direction dir );
void IMoveCursorTo( Int32 position ); // Updates selection
void ISetCursor( Int32 newPosition ); // Doesn't update selection
void IMoveCursorTo( int32_t position ); // Updates selection
void ISetCursor( int32_t newPosition ); // Doesn't update selection
Int32 IRecalcLineStarts( Int32 startingLine, hsBool force, hsBool dontUpdate = false );
int32_t IRecalcLineStarts( int32_t startingLine, hsBool force, hsBool dontUpdate = false );
void IRecalcFromCursor( hsBool forceUpdate = false );
Int32 IFindCursorLine( Int32 cursorPos = -1 ) const;
hsBool IStoreLineStart( UInt32 line, Int32 start );
void IOffsetLineStarts( UInt32 position, Int32 offset, hsBool offsetSelectionEnd = false );
Int32 IPointToPosition( Int16 x, Int16 y, hsBool searchOutsideBounds = false );
Int32 ICalcNumVisibleLines( void ) const;
int32_t IFindCursorLine( int32_t cursorPos = -1 ) const;
hsBool IStoreLineStart( uint32_t line, int32_t start );
void IOffsetLineStarts( uint32_t position, int32_t offset, hsBool offsetSelectionEnd = false );
int32_t IPointToPosition( int16_t x, int16_t y, hsBool searchOutsideBounds = false );
int32_t ICalcNumVisibleLines( void ) const;
void IReadColorCode( Int32 &pos, hsColorRGBA &color ) const;
void IReadStyleCode( Int32 &pos, UInt8 &fontStyle ) const;
UInt32 IRenderLine( UInt16 x, UInt16 y, Int32 start, Int32 end, hsBool dontRender = false );
hsBool IFindLastColorCode( Int32 pos, hsColorRGBA &color, hsBool ignoreFirstCharacter = false ) const;
hsBool IFindLastStyleCode( Int32 pos, UInt8 &style, hsBool ignoreFirstCharacter = false ) const;
void IReadColorCode( int32_t &pos, hsColorRGBA &color ) const;
void IReadStyleCode( int32_t &pos, uint8_t &fontStyle ) const;
uint32_t IRenderLine( uint16_t x, uint16_t y, int32_t start, int32_t end, hsBool dontRender = false );
hsBool IFindLastColorCode( int32_t pos, hsColorRGBA &color, hsBool ignoreFirstCharacter = false ) const;
hsBool IFindLastStyleCode( int32_t pos, uint8_t &style, hsBool ignoreFirstCharacter = false ) const;
inline static bool IIsCodeChar( const wchar_t c );
inline static bool IIsRenderable( const wchar_t c );
inline static Int32 IOffsetToNextChar( wchar_t stringChar );
inline Int32 IOffsetToNextCharFromPos( Int32 pos ) const;
inline static int32_t IOffsetToNextChar( wchar_t stringChar );
inline int32_t IOffsetToNextCharFromPos( int32_t pos ) const;
void IActuallyInsertColor( Int32 pos, hsColorRGBA &color );
void IActuallyInsertStyle( Int32 pos, UInt8 style );
void IActuallyInsertColor( int32_t pos, hsColorRGBA &color );
void IActuallyInsertStyle( int32_t pos, uint8_t style );
void IUpdateScrollRange( void );
wchar_t *ICopyRange( Int32 start, Int32 end ) const;
wchar_t *ICopyRange( int32_t start, int32_t end ) const;
Int32 ICharPosToBufferPos( Int32 charPos ) const;
int32_t ICharPosToBufferPos( int32_t charPos ) const;
void IUpdateBuffer();
void IUpdateLineStarts();
void ISetGlobalBuffer();
void ISetLineStarts(hsTArray<Int32> lineStarts);
void ISetLineStarts(hsTArray<int32_t> lineStarts);
void IHitEndOfControlList(Int32 cursorPos);
void IHitBeginningOfControlList(Int32 cursorPos);
void IHitEndOfControlList(int32_t cursorPos);
void IHitBeginningOfControlList(int32_t cursorPos);
public:
@ -202,12 +202,12 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers );
virtual void PurgeDynaTextMapImage();
@ -219,7 +219,7 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
kKeyPressedEvent
};
void SetScrollPosition( Int32 topLine );
void SetScrollPosition( int32_t topLine );
void MoveCursor( Direction dir );
void InsertChar( char c );
@ -227,23 +227,23 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
void InsertString( const char *string );
void InsertString( const wchar_t *string );
void InsertColor( hsColorRGBA &color );
void InsertStyle( UInt8 fontStyle );
void InsertStyle( uint8_t fontStyle );
void DeleteChar( void );
void ClearBuffer( void );
void SetBuffer( const char *asciiText );
void SetBuffer( const wchar_t *asciiText );
void SetBuffer( const UInt8 *codedText, UInt32 length );
void SetBuffer( const UInt16 *codedText, UInt32 length );
void SetBuffer( const uint8_t *codedText, uint32_t length );
void SetBuffer( const uint16_t *codedText, uint32_t length );
char *GetNonCodedBuffer( void ) const;
wchar_t *GetNonCodedBufferW( void ) const;
UInt8 *GetCodedBuffer( UInt32 &length ) const;
UInt16 *GetCodedBufferW( UInt32 &length ) const;
UInt32 GetBufferSize();
uint8_t *GetCodedBuffer( uint32_t &length ) const;
uint16_t *GetCodedBufferW( uint32_t &length ) const;
uint32_t GetBufferSize();
void SetBufferLimit(Int32 limit) { fBufferLimit = limit; }
Int32 GetBufferLimit() { return fBufferLimit; }
void SetBufferLimit(int32_t limit) { fBufferLimit = limit; }
int32_t GetBufferLimit() { return fBufferLimit; }
void GetThisKeyPressed( char &key, UInt8 &modifiers ) const { key = (char)fLastKeyPressed; modifiers = fLastKeyModifiers; }
void GetThisKeyPressed( char &key, uint8_t &modifiers ) const { key = (char)fLastKeyPressed; modifiers = fLastKeyModifiers; }
void Lock( void );
void Unlock( void );
@ -259,21 +259,21 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
void ClearPrev();
void SetEventProc( pfGUIMultiLineEditProc *eventProc );
void ClearEventProc();
Int32 GetFirstVisibleLine();
Int32 GetLastVisibleLine();
Int32 GetNumVisibleLines() {return ICalcNumVisibleLines();}
void SetGlobalStartLine(Int32 line);
int32_t GetFirstVisibleLine();
int32_t GetLastVisibleLine();
int32_t GetNumVisibleLines() {return ICalcNumVisibleLines();}
void SetGlobalStartLine(int32_t line);
void SetCursorToLoc(Int32 loc) {ISetCursor(loc);}
void SetCursorToLoc(int32_t loc) {ISetCursor(loc);}
void SetMargins(int top, int left, int bottom, int right);
UInt8 GetFontSize() {return fFontSize;} // because we're too cool to use the color scheme crap
uint8_t GetFontSize() {return fFontSize;} // because we're too cool to use the color scheme crap
void SetFontFace(std::string fontFace);
void SetFontColor(hsColorRGBA fontColor) {fFontColor = fontColor; fFontFlagsSet |= kFontColorSet;}
void SetFontSize(UInt8 fontSize);
void SetFontStyle(UInt8 fontStyle) {fFontStyle = fontStyle; fFontFlagsSet |= kFontStyleSet;}
void SetFontSize(uint8_t fontSize);
void SetFontStyle(uint8_t fontStyle) {fFontStyle = fontStyle; fFontFlagsSet |= kFontStyleSet;}
hsBool ShowingBeginningOfBuffer();
hsBool ShowingEndOfBuffer();

View File

@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGameGUIMgr.h"
#include "pfGUIPopUpMenu.h"
#include "pfGUIMenuItem.h"
@ -86,7 +86,7 @@ class pfPopUpKeyGenerator
{
public:
char fPrefix[ 128 ];
UInt32 fKeyCount;
uint32_t fKeyCount;
plLocation fLoc;
pfPopUpKeyGenerator( const char *p, const plLocation &loc )
@ -110,11 +110,11 @@ class pfGUIMenuItemProc : public pfGUICtrlProcObject
protected:
pfGUIPopUpMenu *fParent;
UInt32 fIndex;
uint32_t fIndex;
public:
pfGUIMenuItemProc( pfGUIPopUpMenu *parent, UInt32 idx )
pfGUIMenuItemProc( pfGUIPopUpMenu *parent, uint32_t idx )
{
fParent = parent;
fIndex = idx;
@ -125,9 +125,9 @@ class pfGUIMenuItemProc : public pfGUICtrlProcObject
fParent->IHandleMenuSomething( fIndex, ctrl );
}
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event )
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event )
{
fParent->IHandleMenuSomething( fIndex, ctrl, (Int32)event );
fParent->IHandleMenuSomething( fIndex, ctrl, (int32_t)event );
}
};
@ -235,13 +235,13 @@ void pfGUIPopUpMenu::Read( hsStream *s, hsResMgr *mgr )
pfGUIDialogMod::Read( s, mgr );
// In case we need it...
fKeyGen = TRACKED_NEW pfPopUpKeyGenerator( GetName(), GetKey()->GetUoid().GetLocation() );
fKeyGen = new pfPopUpKeyGenerator( GetName(), GetKey()->GetUoid().GetLocation() );
fOriginX = fOriginY = -1.f;
fMargin = s->ReadLE16();
UInt32 i, count = s->ReadLE32();
uint32_t i, count = s->ReadLE32();
fMenuItems.SetCountAndZero( count );
for( i = 0; i < count; i++ )
{
@ -253,12 +253,12 @@ void pfGUIPopUpMenu::Read( hsStream *s, hsResMgr *mgr )
fMenuItems[ i ].fHandler = pfGUICtrlProcWriteableObject::Read( s );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefSubMenu ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefSubMenu ), plRefFlags::kActiveRef );
}
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef );
fAlignment = (Alignment)s->ReadByte();
@ -273,7 +273,7 @@ void pfGUIPopUpMenu::Write( hsStream *s, hsResMgr *mgr )
s->WriteLE16( fMargin );
s->WriteLE32( fMenuItems.GetCount() );
UInt32 i;
uint32_t i;
for( i = 0; i < fMenuItems.GetCount(); i++ )
{
char writeTemp[ 256 ];
@ -298,15 +298,15 @@ void pfGUIPopUpMenu::Write( hsStream *s, hsResMgr *mgr )
mgr->WriteKey( s, fOriginAnchor );
mgr->WriteKey( s, fOriginContext );
s->WriteByte( (UInt8)fAlignment );
s->WriteByte( (uint8_t)fAlignment );
}
void pfGUIPopUpMenu::SetOriginAnchor( plSceneObject *anchor, pfGUIDialogMod *context )
{
fOriginAnchor = anchor;
fOriginContext = context;
hsgResMgr::ResMgr()->AddViaNotify( fOriginAnchor->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef );
hsgResMgr::ResMgr()->AddViaNotify( fOriginContext->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef );
hsgResMgr::ResMgr()->AddViaNotify( fOriginAnchor->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef );
hsgResMgr::ResMgr()->AddViaNotify( fOriginContext->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef );
}
//// SetEnabled //////////////////////////////////////////////////////////////
@ -335,7 +335,7 @@ void pfGUIPopUpMenu::SetEnabled( hsBool e )
pfGUIDialogMod::SetEnabled( e );
}
void pfGUIPopUpMenu::Show( hsScalar x, hsScalar y )
void pfGUIPopUpMenu::Show( float x, float y )
{
fOriginX = x;
fOriginY = y;
@ -346,7 +346,7 @@ void pfGUIPopUpMenu::Show( hsScalar x, hsScalar y )
void pfGUIPopUpMenu::ISeekToOrigin( void )
{
#if 0
UInt32 i;
uint32_t i;
float x = 0.5f/*fOriginX*/, y = fOriginY;
for( i = 0; i < fControls.GetCount(); i++ )
@ -379,7 +379,7 @@ void pfGUIPopUpMenu::ISeekToOrigin( void )
//// IHandleMenuSomething ////////////////////////////////////////////////////
// Handles a normal event from one of the item controls.
void pfGUIPopUpMenu::IHandleMenuSomething( UInt32 idx, pfGUIControlMod *ctrl, Int32 extended )
void pfGUIPopUpMenu::IHandleMenuSomething( uint32_t idx, pfGUIControlMod *ctrl, int32_t extended )
{
if( extended != -1 )
{
@ -437,7 +437,7 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void )
if( fWaitingForSkin && fSkin == nil )
return false; // Still waiting to get our skin before building
pfGUIColorScheme *scheme = TRACKED_NEW pfGUIColorScheme();
pfGUIColorScheme *scheme = new pfGUIColorScheme();
scheme->fForeColor.Set( 0, 0, 0, 1 );
scheme->fBackColor.Set( 1, 1, 1, 1 );
@ -472,11 +472,11 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void )
// The PROBLEM is that we can't do that unless we have a friggin surface on
// which to calculate the text extents! So sadly, we're going to have to create
// a whole new DTMap and use it to calculate some stuff
plDynamicTextMap *scratch = TRACKED_NEW plDynamicTextMap( 8, 8, false );
plDynamicTextMap *scratch = new plDynamicTextMap( 8, 8, false );
scratch->SetFont( scheme->fFontFace, scheme->fFontSize, scheme->fFontFlags, true );
for( i = 0; i < fMenuItems.GetCount(); i++ )
{
UInt16 thisW, thisH;
uint16_t thisW, thisH;
thisW = scratch->CalcStringWidth( fMenuItems[ i ].fName.c_str(), &thisH );
if( fMenuItems[ i ].fSubMenu != nil )
{
@ -504,7 +504,7 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void )
width += 4; // give us a little space, just in case
UInt32 scrnWidth, scrnHeight;
uint32_t scrnWidth, scrnHeight;
// A cheat here, I know, but I'm lazy
plDebugText::Instance().GetScreenSize( &scrnWidth, &scrnHeight );
@ -560,7 +560,7 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void )
{
button->SetColorScheme( scheme );
button->SetName( fMenuItems[ i ].fName.c_str() );
button->SetHandler( TRACKED_NEW pfGUIMenuItemProc( this, i ) );
button->SetHandler( new pfGUIMenuItemProc( this, i ) );
// make the tag ID the position in the menu list
button->SetTagID(i);
button->SetDynTextMap( mat->GetLayer( 0 ), plDynamicTextMap::ConvertNoRef( mat->GetLayer( 0 )->GetTexture() ) );
@ -621,8 +621,8 @@ void pfGUIPopUpMenu::ITearDownMenu( void )
//// HandleMouseEvent ////////////////////////////////////////////////////////
hsBool pfGUIPopUpMenu::HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY,
UInt8 modifiers )
hsBool pfGUIPopUpMenu::HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY,
uint8_t modifiers )
{
hsBool r = pfGUIDialogMod::HandleMouseEvent( event, mouseX, mouseY, modifiers );
if( r == false && event == pfGameGUIMgr::kMouseUp )
@ -703,11 +703,11 @@ hsGMaterial *pfGUIPopUpMenu::ICreateDynMaterial( void )
// Create the new dynTextMap
plDynamicTextMap *textMap = TRACKED_NEW plDynamicTextMap();
plDynamicTextMap *textMap = new plDynamicTextMap();
fKeyGen->CreateKey( textMap );
// Create the material
hsGMaterial *material = TRACKED_NEW hsGMaterial;
hsGMaterial *material = new hsGMaterial;
fKeyGen->CreateKey( material );
// Create the layer and attach
@ -721,7 +721,7 @@ hsGMaterial *pfGUIPopUpMenu::ICreateDynMaterial( void )
lay->SetClampFlags( hsGMatState::kClampTexture );
// Do sendRef here, since we're going to need it set pretty darned quick
hsgResMgr::ResMgr()->SendRef( textMap->GetKey(), TRACKED_NEW plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( textMap->GetKey(), new plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef );
return material;
@ -732,14 +732,14 @@ hsGMaterial *pfGUIPopUpMenu::ICreateDynMaterial( void )
#include "plJPEG/plJPEG.h"
pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc )
pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent, float x, float y, const plLocation &destLoc )
{
float fovX, fovY;
// Create the menu and give it a key gen
pfGUIPopUpMenu *menu = TRACKED_NEW pfGUIPopUpMenu();
menu->fKeyGen = TRACKED_NEW pfPopUpKeyGenerator( name, destLoc );
pfGUIPopUpMenu *menu = new pfGUIPopUpMenu();
menu->fKeyGen = new pfPopUpKeyGenerator( name, destLoc );
menu->fKeyGen->CreateKey( menu );
menu->fOriginX = x;
@ -749,7 +749,7 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent
if( parent != nil && ( (pfGUIPopUpMenu *)parent )->fSkin != nil )
{
menu->fWaitingForSkin = true;
hsgResMgr::ResMgr()->SendRef( ( (pfGUIPopUpMenu *)parent )->fSkin->GetKey(), TRACKED_NEW plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( ( (pfGUIPopUpMenu *)parent )->fSkin->GetKey(), new plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef );
}
// HACK for now: create us a temp skin to use
@ -760,12 +760,12 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent
loc.Set( 0x1425 );
plKey skinKey = hsgResMgr::ResMgr()->FindKey( plUoid( loc, pfGUISkin::Index(), "GUISkin01_GUISkin" ) );
menu->fWaitingForSkin = true;
hsgResMgr::ResMgr()->AddViaNotify( skinKey, TRACKED_NEW plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( skinKey, new plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef );
}
*/
// Create the rendermod
plPostEffectMod *renderMod = TRACKED_NEW plPostEffectMod;
plPostEffectMod *renderMod = new plPostEffectMod;
menu->fKeyGen->CreateKey( renderMod );
renderMod->SetHither( 0.5f );
@ -777,26 +777,26 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent
fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f;
fovY = fovX;// * 3.f / 4.f;
renderMod->SetFovX( fovX * 180.f / hsScalarPI );
renderMod->SetFovY( fovY * 180.f / hsScalarPI );
renderMod->SetFovX( fovX * 180.f / M_PI );
renderMod->SetFovY( fovY * 180.f / M_PI );
// Create the sceneNode to go with it
menu->fParentNode= TRACKED_NEW plSceneNode;
menu->fParentNode= new plSceneNode;
menu->fKeyGen->CreateKey( menu->fParentNode );
// menu->fParentNode->GetKey()->RefObject();
hsgResMgr::ResMgr()->SendRef( menu->fParentNode->GetKey(), TRACKED_NEW plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, 0, kRefParentNode ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( menu->fParentNode->GetKey(), new plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, 0, kRefParentNode ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->AddViaNotify( menu->fParentNode->GetKey(), TRACKED_NEW plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef );
hsgResMgr::ResMgr()->AddViaNotify( menu->fParentNode->GetKey(), new plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef );
menu->SetRenderMod( renderMod );
menu->SetName( name );
// Create the dummy scene object to hold the menu
plSceneObject *newObj = TRACKED_NEW plSceneObject;
plSceneObject *newObj = new plSceneObject;
menu->fKeyGen->CreateKey( newObj );
// *#&$(*@&#$ need a coordIface...
plCoordinateInterface *newCI = TRACKED_NEW plCoordinateInterface;
plCoordinateInterface *newCI = new plCoordinateInterface;
menu->fKeyGen->CreateKey( newCI );
hsMatrix44 l2w, w2l;
@ -805,15 +805,15 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent
// Using SendRef here because AddViaNotify will queue the messages up, which doesn't do us any good
// if we need these refs right away
hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( renderMod->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( renderMod->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
newObj->SetSceneNode( menu->fParentNode->GetKey() );
newObj->SetTransform( l2w, w2l );
hsgResMgr::ResMgr()->SendRef( menu->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( menu->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef );
// Add the menu to the GUI mgr
plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(),
plGenRefMsg *refMsg = new plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(),
plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef );
hsgResMgr::ResMgr()->AddViaNotify( menu->GetKey(), refMsg, plRefFlags::kActiveRef );
@ -832,7 +832,7 @@ void pfGUIPopUpMenu::SetSkin( pfGUISkin *skin )
if( skin != nil )
{
hsgResMgr::ResMgr()->SendRef( skin->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
hsgResMgr::ResMgr()->SendRef( skin->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
fWaitingForSkin = true;
}
else
@ -879,7 +879,7 @@ void pfGUISkin::SetTexture( plMipmap *tex )
}
}
void pfGUISkin::SetElement( UInt32 idx, UInt16 x, UInt16 y, UInt16 w, UInt16 h )
void pfGUISkin::SetElement( uint32_t idx, uint16_t x, uint16_t y, uint16_t w, uint16_t h )
{
fElements[ idx ].fX = x;
fElements[ idx ].fY = y;
@ -894,7 +894,7 @@ void pfGUISkin::Read( hsStream *s, hsResMgr *mgr )
s->ReadLE( &fItemMargin );
s->ReadLE( &fBorderMargin );
UInt32 i, count;
uint32_t i, count;
s->ReadLE( &count );
for( i = 0; i < count; i++ )
@ -903,7 +903,7 @@ void pfGUISkin::Read( hsStream *s, hsResMgr *mgr )
for( ; i < kNumElements; i++ )
fElements[ i ].Empty();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefMipmap ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefMipmap ), plRefFlags::kActiveRef );
}
void pfGUISkin::Write( hsStream *s, hsResMgr *mgr )
@ -913,7 +913,7 @@ void pfGUISkin::Write( hsStream *s, hsResMgr *mgr )
s->WriteLE( fItemMargin );
s->WriteLE( fBorderMargin );
UInt32 i = kNumElements;
uint32_t i = kNumElements;
s->WriteLE( i );
for( i = 0; i < kNumElements; i++ )

View File

@ -100,10 +100,10 @@ class pfGUIPopUpMenu : public pfGUIDialogMod
// Array of info to rebuild our menu from. Note that this is ONLY used when rebuilding
hsBool fNeedsRebuilding, fWaitingForSkin;
hsScalar fOriginX, fOriginY;
UInt16 fMargin;
float fOriginX, fOriginY;
uint16_t fMargin;
hsTArray<pfMenuItem> fMenuItems;
Int32 fSubMenuOpen;
int32_t fSubMenuOpen;
pfGUISkin *fSkin;
@ -118,7 +118,7 @@ class pfGUIPopUpMenu : public pfGUIDialogMod
hsGMaterial *ICreateDynMaterial( void );
void IHandleMenuSomething( UInt32 idx, pfGUIControlMod *ctrl, Int32 extended = -1 );
void IHandleMenuSomething( uint32_t idx, pfGUIControlMod *ctrl, int32_t extended = -1 );
void ISeekToOrigin( void );
@ -153,9 +153,9 @@ class pfGUIPopUpMenu : public pfGUIDialogMod
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetEnabled( hsBool e );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers );
void Show( hsScalar x, hsScalar y );
void Show( float x, float y );
void SetOriginAnchor( plSceneObject *anchor, pfGUIDialogMod *context );
void SetAlignment( Alignment a ) { fAlignment = a; }
@ -164,7 +164,7 @@ class pfGUIPopUpMenu : public pfGUIDialogMod
void AddItem( const wchar_t *name, pfGUICtrlProcObject *handler, pfGUIPopUpMenu *subMenu = nil );
void SetSkin( pfGUISkin *skin );
static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc = plLocation::kGlobalFixedLoc );
static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, float x, float y, const plLocation &destLoc = plLocation::kGlobalFixedLoc );
};
@ -195,7 +195,7 @@ class pfGUISkin : public hsKeyedObject
class pfSRect
{
public:
UInt16 fX, fY, fWidth, fHeight;
uint16_t fX, fY, fWidth, fHeight;
void Empty( void ) { fX = fY = fWidth = fHeight = 0; }
void Read( hsStream *s );
@ -206,7 +206,7 @@ class pfGUISkin : public hsKeyedObject
plMipmap *fTexture;
pfSRect fElements[ kNumElements ];
UInt16 fItemMargin, fBorderMargin;
uint16_t fItemMargin, fBorderMargin;
public:
@ -229,13 +229,13 @@ class pfGUISkin : public hsKeyedObject
plMipmap *GetTexture( void ) const { return fTexture; }
void SetTexture( plMipmap *tex );
const pfSRect &GetElement( UInt32 idx ) const { return fElements[ idx ]; }
hsBool IsElementSet( UInt32 idx ) const { return ( fElements[ idx ].fWidth > 0 && fElements[ idx ].fHeight > 0 ); }
void SetElement( UInt32 idx, UInt16 x, UInt16 y, UInt16 w, UInt16 h );
const pfSRect &GetElement( uint32_t idx ) const { return fElements[ idx ]; }
hsBool IsElementSet( uint32_t idx ) const { return ( fElements[ idx ].fWidth > 0 && fElements[ idx ].fHeight > 0 ); }
void SetElement( uint32_t idx, uint16_t x, uint16_t y, uint16_t w, uint16_t h );
void SetMargins( UInt16 item, UInt16 border ) { fItemMargin = item; fBorderMargin = border; }
UInt16 GetItemMargin( void ) const { return fItemMargin; }
UInt16 GetBorderMargin( void ) const { return fBorderMargin; }
void SetMargins( uint16_t item, uint16_t border ) { fItemMargin = item; fBorderMargin = border; }
uint16_t GetItemMargin( void ) const { return fItemMargin; }
uint16_t GetBorderMargin( void ) const { return fBorderMargin; }
};
#endif // _pfGUIPopUpMenu_h

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIProgressCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
@ -83,7 +83,7 @@ pfGUIProgressCtrl::~pfGUIProgressCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIProgressCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIProgressCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
@ -111,7 +111,7 @@ void pfGUIProgressCtrl::Read( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadLE32();
uint32_t i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
@ -123,7 +123,7 @@ void pfGUIProgressCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
uint32_t i, count = fAnimationKeys.GetCount();
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
@ -147,7 +147,7 @@ void pfGUIProgressCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
@ -163,7 +163,7 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void )
if( fAnimTimesCalced )
return true;
hsScalar tBegin = 1e30, tEnd = -1e30;
float tBegin = 1e30, tEnd = -1e30;
bool foundOne = false;
for( int i = 0; i < fAnimationKeys.GetCount(); i++ )
@ -174,8 +174,8 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void )
{
for( int j = 0; j < mod->GetNumAnimations(); j++ )
{
hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
float begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
float end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
@ -187,8 +187,8 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void )
plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( layer != nil )
{
hsScalar begin = layer->GetTimeConvert().GetBegin();
hsScalar end = layer->GetTimeConvert().GetEnd();
float begin = layer->GetTimeConvert().GetBegin();
float end = layer->GetTimeConvert().GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
@ -210,7 +210,7 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void )
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIProgressCtrl::SetCurrValue( hsScalar v )
void pfGUIProgressCtrl::SetCurrValue( float v )
{
int old = (int)fValue;
@ -223,15 +223,15 @@ void pfGUIProgressCtrl::SetCurrValue( hsScalar v )
{
ICalcAnimTimes();
hsScalar tLength = fAnimEnd - fAnimBegin;
hsScalar newTime;
float tLength = fAnimEnd - fAnimBegin;
float newTime;
if( HasFlag( kReverseValues ) )
newTime = ( ( fMax - fValue ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
else
newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kGoToTime );
msg->SetAnimName( fAnimName );
msg->fTime = newTime;
@ -240,7 +240,7 @@ void pfGUIProgressCtrl::SetCurrValue( hsScalar v )
}
}
void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent )
void pfGUIProgressCtrl::AnimateToPercentage( float percent )
{
// percent should be a value in range 0.0 to 1.0
if (percent >= 0.0f && percent <= 1.0f)
@ -249,7 +249,7 @@ void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent )
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kPlayToPercentage );
msg->SetAnimName( fAnimName );
msg->fTime = percent;
@ -262,8 +262,8 @@ void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent )
PlaySound(kAnimateSound, true);
// setup a timer to call back when we finish animating
hsScalar elapsedTime = (fAnimEnd - fAnimBegin) * percent;
plTimerCallbackMsg *timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(), fStopSoundTimer);
float elapsedTime = (fAnimEnd - fAnimBegin) * percent;
plTimerCallbackMsg *timerMsg = new plTimerCallbackMsg(GetKey(), fStopSoundTimer);
plgTimerCallbackMgr::NewTimer(elapsedTime, timerMsg);
}
}

View File

@ -61,15 +61,15 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
char *fAnimName;
// Computed once, once an anim is loaded that we can compute this with
hsScalar fAnimBegin, fAnimEnd;
float fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced;
hsBool fPlaySound;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
hsBool ICalcAnimTimes( void );
const UInt32 fStopSoundTimer;
const uint32_t fStopSoundTimer;
public:
@ -92,8 +92,8 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetCurrValue( hsScalar v );
virtual void AnimateToPercentage( hsScalar percent );
virtual void SetCurrValue( float v );
virtual void AnimateToPercentage( float percent );
enum SoundEvents
{

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIRadioGroupCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUICheckBoxCtrl.h"
@ -73,7 +73,7 @@ class pfGroupProc : public pfGUICtrlProcObject
virtual void DoSomething( pfGUIControlMod *ctrl )
{
Int32 newIdx;
int32_t newIdx;
// So one of our controls got clicked. That means that we change our value
@ -124,7 +124,7 @@ class pfGroupProc : public pfGUICtrlProcObject
pfGUIRadioGroupCtrl::pfGUIRadioGroupCtrl()
{
fButtonProc = TRACKED_NEW pfGroupProc( this );
fButtonProc = new pfGroupProc( this );
fButtonProc->IncRef();
SetFlag( kIntangible );
}
@ -137,7 +137,7 @@ pfGUIRadioGroupCtrl::~pfGUIRadioGroupCtrl()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIRadioGroupCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIRadioGroupCtrl::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -175,12 +175,12 @@ void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 i, count = s->ReadLE32();
uint32_t i, count = s->ReadLE32();
fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ )
{
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefControl ), plRefFlags::kActiveRef );
}
fValue = fDefaultValue = s->ReadLE16();
@ -190,7 +190,7 @@ void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr )
void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr )
{
UInt32 i;
uint32_t i;
pfGUIControlMod::Write( s, mgr );
@ -199,12 +199,12 @@ void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr )
for( i = 0; i < fControls.GetCount(); i++ )
mgr->WriteKey( s, fControls[ i ]->GetKey() );
s->WriteLE16( (UInt16)fDefaultValue );
s->WriteLE16( (uint16_t)fDefaultValue );
}
//// SetValue ////////////////////////////////////////////////////////////////
void pfGUIRadioGroupCtrl::SetValue( Int32 value )
void pfGUIRadioGroupCtrl::SetValue( int32_t value )
{
if( value != fValue && ( value != -1 || HasFlag( kAllowNoSelection ) ) )
{

View File

@ -70,9 +70,9 @@ class pfGUIRadioGroupCtrl : public pfGUIControlMod
hsTArray<pfGUICheckBoxCtrl *> fControls;
pfGroupProc *fButtonProc;
Int32 fValue, fDefaultValue;
int32_t fValue, fDefaultValue;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
public:
@ -92,8 +92,8 @@ class pfGUIRadioGroupCtrl : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
Int32 GetValue( void ) { return fValue; }
void SetValue( Int32 value );
int32_t GetValue( void ) { return fValue; }
void SetValue( int32_t value );
virtual void SetEnabled( hsBool e );
virtual void SetInteresting( hsBool e );
@ -104,7 +104,7 @@ class pfGUIRadioGroupCtrl : public pfGUIControlMod
/// Export ONLY
void ClearControlList( void );
void AddControl( pfGUICheckBoxCtrl *ctrl );
void SetDefaultValue( Int32 value ) { fDefaultValue = value; }
void SetDefaultValue( int32_t value ) { fDefaultValue = value; }
};
#endif // _pfGUIRadioGroupCtrl_h

View File

@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// Tag List ////////////////////////////////////////////////////////////////
// Here's the actual list of tags. It's basically a list of konstants, but
// they get translated into two things:
// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and
// 1. An enum, to send as a uint32_t to the GetDialogFromTag() and
// GetControlFromTag() functions.
// 2. A string, which gets put in a dropdown box in the appropriate
// MAX component, which sets the given control's tag ID to the

View File

@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// Tag List ////////////////////////////////////////////////////////////////
// Here's the actual list of tags. It's basically a list of konstants, but
// they get translated into two things:
// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and
// 1. An enum, to send as a uint32_t to the GetDialogFromTag() and
// GetControlFromTag() functions.
// 2. A string, which gets put in a dropdown box in the appropriate
// MAX component, which sets the given control's tag ID to the

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "hsStlUtils.h"
#include "pfGUITextBoxMod.h"
#include "pfGameGUIMgr.h"
@ -80,7 +80,7 @@ pfGUITextBoxMod::~pfGUITextBoxMod()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUITextBoxMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUITextBoxMod::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
@ -154,10 +154,10 @@ void pfGUITextBoxMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 len = s->ReadLE32();
uint32_t len = s->ReadLE32();
if( len > 0 )
{
char *text = TRACKED_NEW char[ len + 1 ];
char *text = new char[ len + 1 ];
s->Read( len, text );
text[ len ] = 0;
@ -201,15 +201,15 @@ void pfGUITextBoxMod::Write( hsStream *s, hsResMgr *mgr )
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUITextBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUITextBoxMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers )
{
}
void pfGUITextBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUITextBoxMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers )
{
}
void pfGUITextBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
void pfGUITextBoxMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
{
}
@ -232,7 +232,7 @@ void pfGUITextBoxMod::SetText( const wchar_t *text )
delete [] fText;
if (text)
{
fText = TRACKED_NEW wchar_t[wcslen(text)+1];
fText = new wchar_t[wcslen(text)+1];
wcscpy(fText,text);
}
else

View File

@ -63,7 +63,7 @@ class pfGUITextBoxMod : public pfGUIControlMod
bool fUseLocalizationPath;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual void IUpdate( void );
virtual void IPostSetUpDynTextMap( void );
@ -87,9 +87,9 @@ class pfGUITextBoxMod : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers );
virtual void PurgeDynaTextMapImage();

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIUpDownPairMod.h"
#include "pfGameGUIMgr.h"
#include "pfGUIButtonMod.h"
@ -106,7 +106,7 @@ pfGUIUpDownPairMod::pfGUIUpDownPairMod()
fDownControl = nil;
fValue = fMin = fMax = fStep = 0.f;
fButtonProc = TRACKED_NEW pfUpDownBtnProc( nil, nil, this );
fButtonProc = new pfUpDownBtnProc( nil, nil, this );
fButtonProc->IncRef();
SetFlag( kIntangible );
}
@ -119,7 +119,7 @@ pfGUIUpDownPairMod::~pfGUIUpDownPairMod()
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIUpDownPairMod::IEval( double secs, hsScalar del, UInt32 dirty )
hsBool pfGUIUpDownPairMod::IEval( double secs, float del, uint32_t dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
@ -205,8 +205,8 @@ void pfGUIUpDownPairMod::Read( hsStream *s, hsResMgr *mgr )
fUpControl = nil;
fDownControl = nil;
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefUpControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefUpControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef );
s->ReadLE( &fMin );
s->ReadLE( &fMax );
@ -228,13 +228,13 @@ void pfGUIUpDownPairMod::Write( hsStream *s, hsResMgr *mgr )
}
void pfGUIUpDownPairMod::SetRange( hsScalar min, hsScalar max )
void pfGUIUpDownPairMod::SetRange( float min, float max )
{
pfGUIValueCtrl::SetRange( min, max );
IUpdate();
}
void pfGUIUpDownPairMod::SetCurrValue( hsScalar v )
void pfGUIUpDownPairMod::SetCurrValue( float v )
{
pfGUIValueCtrl::SetCurrValue( v );
IUpdate();

View File

@ -70,7 +70,7 @@ class pfGUIUpDownPairMod : public pfGUIValueCtrl
pfUpDownBtnProc *fButtonProc;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
virtual void IUpdate( void );
public:
@ -89,8 +89,8 @@ class pfGUIUpDownPairMod : public pfGUIValueCtrl
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetRange( hsScalar min, hsScalar max );
virtual void SetCurrValue( hsScalar v );
virtual void SetRange( float min, float max );
virtual void SetCurrValue( float v );
/// Export ONLY

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGUIValueCtrl.h"
#include "pfGameGUIMgr.h"
@ -66,7 +66,7 @@ pfGUIValueCtrl::~pfGUIValueCtrl()
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIValueCtrl::SetCurrValue( hsScalar v )
void pfGUIValueCtrl::SetCurrValue( float v )
{
fValue = v;
if( fValue < fMin )
@ -77,7 +77,7 @@ void pfGUIValueCtrl::SetCurrValue( hsScalar v )
//// SetRange ////////////////////////////////////////////////////////////////
void pfGUIValueCtrl::SetRange( hsScalar min, hsScalar max )
void pfGUIValueCtrl::SetRange( float min, float max )
{
fMin = min;
fMax = max;

View File

@ -55,7 +55,7 @@ class pfGUIValueCtrl : public pfGUIControlMod
{
protected:
hsScalar fValue, fMin, fMax, fStep;
float fValue, fMin, fMax, fStep;
public:
@ -69,15 +69,15 @@ class pfGUIValueCtrl : public pfGUIControlMod
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual hsScalar GetCurrValue( void ) { return fValue; }
virtual void SetCurrValue( hsScalar v );
virtual float GetCurrValue( void ) { return fValue; }
virtual void SetCurrValue( float v );
virtual hsScalar GetMin( void ) { return fMin; }
virtual hsScalar GetMax( void ) { return fMax; }
virtual hsScalar GetStep( void ) { return fStep; }
virtual float GetMin( void ) { return fMin; }
virtual float GetMax( void ) { return fMax; }
virtual float GetStep( void ) { return fStep; }
virtual void SetRange( hsScalar min, hsScalar max );
virtual void SetStep( hsScalar step ) { fStep = step; }
virtual void SetRange( float min, float max );
virtual void SetStep( float step ) { fStep = step; }
};

View File

@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <stdlib.h>
#include "hsTimer.h"
#include "hsTypes.h"
#include "HeadSpin.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "pfGUIDialogHandlers.h"
@ -87,10 +87,10 @@ class pfGameUIInputInterface : public plInputInterface
protected:
pfGameGUIMgr * const fGUIManager;
UInt8 fModifiers;
UInt8 fButtonState;
uint8_t fModifiers;
uint8_t fButtonState;
hsBool fHaveInterestingCursor;
UInt32 fCurrentCursor;
uint32_t fCurrentCursor;
virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd );
virtual hsBool IControlCodeEnabled( ControlEventCode code );
@ -99,10 +99,10 @@ class pfGameUIInputInterface : public plInputInterface
pfGameUIInputInterface( pfGameGUIMgr * const mgr );
virtual UInt32 GetPriorityLevel( void ) const { return kGUISystemPriority; }
virtual uint32_t GetPriorityLevel( void ) const { return kGUISystemPriority; }
virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg );
virtual UInt32 GetCurrentCursorID( void ) const;
virtual hsScalar GetCurrentCursorOpacity( void ) const;
virtual uint32_t GetCurrentCursorID( void ) const;
virtual float GetCurrentCursorOpacity( void ) const;
virtual hsBool HasInterestingCursorID( void ) const { return fHaveInterestingCursor; }
virtual hsBool SwitchInterpretOrder( void ) const { return true; }
@ -324,7 +324,7 @@ void pfGameGUIMgr::LoadDialog( const char *name, plKey recvrKey, const char *
}
if (!alreadyLoaded)
{
pfDialogNameSetKey* pDNSK = TRACKED_NEW pfDialogNameSetKey(name,recvrKey);
pfDialogNameSetKey* pDNSK = new pfDialogNameSetKey(name,recvrKey);
fDialogToSetKeyOf.Append(pDNSK);
}
}
@ -333,13 +333,13 @@ void pfGameGUIMgr::LoadDialog( const char *name, plKey recvrKey, const char *
plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY );
plClientMsg *msg = TRACKED_NEW plClientMsg( plClientMsg::kLoadRoomHold );
plClientMsg *msg = new plClientMsg( plClientMsg::kLoadRoomHold );
msg->AddReceiver( clientKey );
msg->AddRoomLoc(plKeyFinder::Instance().FindLocation(ageName ? ageName : "GUI", name));
msg->Send();
// Now add this dialog to a list of pending loads (will remove it once it's fully loaded)
// fDlgsPendingLoad.Append( TRACKED_NEW pfDialogNameSetKey( name, nil ) );
// fDlgsPendingLoad.Append( new pfDialogNameSetKey( name, nil ) );
}
//// IShowDialog /////////////////////////////////////////////////////////////
@ -434,7 +434,7 @@ void pfGameGUIMgr::UnloadDialog( pfGUIDialogMod *dlg )
// IRemoveDlgFromList( dlg );
// Add the name to our list of dialogs pending unload
// fDlgsPendingUnload.Append( TRACKED_NEW pfDialogNameSetKey( dlg->GetName(), nil ) );
// fDlgsPendingUnload.Append( new pfDialogNameSetKey( dlg->GetName(), nil ) );
plKey sceneNodeKey = dlg->GetSceneNodeKey();
if( sceneNodeKey == nil )
@ -448,7 +448,7 @@ void pfGameGUIMgr::UnloadDialog( pfGUIDialogMod *dlg )
{
plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY );
plClientMsg *msg = TRACKED_NEW plClientMsg( plClientMsg::kUnloadRoom );
plClientMsg *msg = new plClientMsg( plClientMsg::kUnloadRoom );
msg->AddReceiver( clientKey );
// msg->SetProgressBarSuppression( true );
msg->AddRoomLoc(sceneNodeKey->GetUoid().GetLocation());
@ -523,7 +523,7 @@ void pfGameGUIMgr::SetDialogToNotify(const char *name, plKey recvrKey)
//
void pfGameGUIMgr::SetDialogToNotify(pfGUIDialogMod *dlg, plKey recvrKey)
{
pfGUIDialogNotifyProc* handler = TRACKED_NEW pfGUIDialogNotifyProc(recvrKey);
pfGUIDialogNotifyProc* handler = new pfGUIDialogNotifyProc(recvrKey);
dlg->SetHandler(handler);
handler->OnInit();
}
@ -540,14 +540,14 @@ void pfGameGUIMgr::IActivateGUI( hsBool activate )
if( activate )
{
fInputConfig = TRACKED_NEW pfGameUIInputInterface( this );
plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface );
fInputConfig = new pfGameUIInputInterface( this );
plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface );
msg->SetIFace( fInputConfig );
plgDispatch::MsgSend( msg );
}
else
{
plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface );
plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface );
msg->SetIFace( fInputConfig );
plgDispatch::MsgSend( msg );
@ -561,7 +561,7 @@ void pfGameGUIMgr::IActivateGUI( hsBool activate )
//// IHandleMouse ////////////////////////////////////////////////////////////
// Distributes mouse events to the dialogs currently active
hsBool pfGameGUIMgr::IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, UInt32 *desiredCursor )
hsBool pfGameGUIMgr::IHandleMouse( EventType event, float mouseX, float mouseY, uint8_t modifiers, uint32_t *desiredCursor )
{
pfGUIDialogMod *dlg;
@ -592,7 +592,7 @@ hsBool pfGameGUIMgr::IHandleMouse( EventType event, hsScalar mouseX, hsScalar m
//// IHandleKeyEvt ///////////////////////////////////////////////////////////
// Distributes mouse events to the dialogs currently active
hsBool pfGameGUIMgr::IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifiers )
hsBool pfGameGUIMgr::IHandleKeyEvt( EventType event, plKeyDef key, uint8_t modifiers )
{
pfGUIDialogMod *dlg;
@ -610,7 +610,7 @@ hsBool pfGameGUIMgr::IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifi
// Like IHandleKeyPress, but takes in a char for distributing actual
// characters typed.
hsBool pfGameGUIMgr::IHandleKeyPress( wchar_t key, UInt8 modifiers )
hsBool pfGameGUIMgr::IHandleKeyPress( wchar_t key, uint8_t modifiers )
{
pfGUIDialogMod *dlg;
@ -837,7 +837,7 @@ hsBool pfGameUIInputInterface::InterpretInputEvent( plInputEventMsg *pMsg )
return false;
}
UInt32 pfGameUIInputInterface::GetCurrentCursorID( void ) const
uint32_t pfGameUIInputInterface::GetCurrentCursorID( void ) const
{
if( fCurrentCursor == 0 )
{
@ -850,7 +850,7 @@ UInt32 pfGameUIInputInterface::GetCurrentCursorID( void ) const
return fCurrentCursor;
}
hsScalar pfGameUIInputInterface::GetCurrentCursorOpacity( void ) const
float pfGameUIInputInterface::GetCurrentCursorOpacity( void ) const
{
if ( pfGameGUIMgr::GetInstance() )
return pfGameGUIMgr::GetInstance()->GetCursorOpacity();
@ -866,7 +866,7 @@ extern pfGUITag gGUITags[]; // From pfGUITagDefs.cpp
//// GetDialogFromTag ////////////////////////////////////////////////////////
pfGUIDialogMod *pfGameGUIMgr::GetDialogFromTag( UInt32 tagID )
pfGUIDialogMod *pfGameGUIMgr::GetDialogFromTag( uint32_t tagID )
{
int i;
@ -898,16 +898,16 @@ pfGUIDialogMod *pfGameGUIMgr::GetDialogFromString( const char *name )
//// GetControlFromTag ///////////////////////////////////////////////////////
pfGUIControlMod *pfGameGUIMgr::GetControlFromTag( pfGUIDialogMod *dlg, UInt32 tagID )
pfGUIControlMod *pfGameGUIMgr::GetControlFromTag( pfGUIDialogMod *dlg, uint32_t tagID )
{
return dlg->GetControlFromTag( tagID );
}
//// GetNumTags //////////////////////////////////////////////////////////////
UInt32 pfGameGUIMgr::GetNumTags( void )
uint32_t pfGameGUIMgr::GetNumTags( void )
{
UInt32 count;
uint32_t count;
for( count = 0; gGUITags[ count ].fID != 0; count++ );
@ -916,9 +916,9 @@ UInt32 pfGameGUIMgr::GetNumTags( void )
//// GetTag //////////////////////////////////////////////////////////////////
pfGUITag *pfGameGUIMgr::GetTag( UInt32 tagIndex )
pfGUITag *pfGameGUIMgr::GetTag( uint32_t tagIndex )
{
UInt32 count;
uint32_t count;
for( count = 0; gGUITags[ count ].fID != 0; count++ );
@ -927,9 +927,9 @@ pfGUITag *pfGameGUIMgr::GetTag( UInt32 tagIndex )
return &gGUITags[ tagIndex ];
}
UInt32 pfGameGUIMgr::GetHighestTag( void )
uint32_t pfGameGUIMgr::GetHighestTag( void )
{
UInt32 i, id = 1;
uint32_t i, id = 1;
for( i = 0; gGUITags[ i ].fID != 0; i++ )
@ -942,12 +942,12 @@ UInt32 pfGameGUIMgr::GetHighestTag( void )
}
void pfGameGUIMgr::SetAspectRatio(hsScalar aspectratio)
void pfGameGUIMgr::SetAspectRatio(float aspectratio)
{
hsScalar oldAspectRatio = fAspectRatio;
float oldAspectRatio = fAspectRatio;
// don't allow the aspectratio below 4:3
hsScalar fourThree = 4.0f/3.0f;
float fourThree = 4.0f/3.0f;
fAspectRatio = aspectratio < fourThree ? fourThree : aspectratio;
if (fAspectRatio != oldAspectRatio)

View File

@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef _pfGameGUIMgr_h
#define _pfGameGUIMgr_h
#include "hsTypes.h"
#include "HeadSpin.h"
#include "hsTemplates.h"
#include "pnInputCore/plKeyDef.h"
#include "pnKeyedObject/hsKeyedObject.h"
@ -79,7 +79,7 @@ class plPostEffectMod;
class pfGUITag
{
public:
UInt32 fID;
uint32_t fID;
char fName[ 128 ];
};
@ -142,14 +142,14 @@ class pfGameGUIMgr : public hsKeyedObject
hsTArray<pfDialogNameSetKey *> fDlgsPendingUnload;
hsBool fActivated;
UInt32 fActiveDlgCount;
uint32_t fActiveDlgCount;
pfGameUIInputInterface *fInputConfig;
UInt32 fInputCtlIndex;
uint32_t fInputCtlIndex;
UInt32 fDefaultCursor;
hsScalar fCursorOpacity;
hsScalar fAspectRatio;
uint32_t fDefaultCursor;
float fCursorOpacity;
float fAspectRatio;
// This is an array of the dialogs (by name) that need their
// receiver key set once they are loaded.
@ -167,9 +167,9 @@ class pfGameGUIMgr : public hsKeyedObject
void IActivateGUI( hsBool activate );
hsBool IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, UInt32 *desiredCursor );
hsBool IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifiers );
hsBool IHandleKeyPress( wchar_t key, UInt8 modifiers );
hsBool IHandleMouse( EventType event, float mouseX, float mouseY, uint8_t modifiers, uint32_t *desiredCursor );
hsBool IHandleKeyEvt( EventType event, plKeyDef key, uint8_t modifiers );
hsBool IHandleKeyPress( wchar_t key, uint8_t modifiers );
hsBool IModalBlocking( void );
@ -210,10 +210,10 @@ class pfGameGUIMgr : public hsKeyedObject
void SetDialogToNotify(const char *name, plKey recvrKey);
void SetDialogToNotify(pfGUIDialogMod *dlg, plKey recvrKey);
void SetDefaultCursor(UInt32 defaultCursor) { fDefaultCursor = defaultCursor; }
UInt32 GetDefaultCursor() { return fDefaultCursor; }
void SetCursorOpacity(hsScalar opacity) { fCursorOpacity = opacity; }
hsScalar GetCursorOpacity() { return fCursorOpacity; }
void SetDefaultCursor(uint32_t defaultCursor) { fDefaultCursor = defaultCursor; }
uint32_t GetDefaultCursor() { return fDefaultCursor; }
void SetCursorOpacity(float opacity) { fCursorOpacity = opacity; }
float GetCursorOpacity() { return fCursorOpacity; }
pfGUIPopUpMenu *FindPopUpMenu( const char *name );
@ -221,14 +221,14 @@ class pfGameGUIMgr : public hsKeyedObject
hsBool IsModalBlocking( void ) {return IModalBlocking();}
// Tag ID stuff
pfGUIDialogMod *GetDialogFromTag( UInt32 tagID );
pfGUIControlMod *GetControlFromTag( pfGUIDialogMod *dlg, UInt32 tagID );
pfGUIDialogMod *GetDialogFromTag( uint32_t tagID );
pfGUIControlMod *GetControlFromTag( pfGUIDialogMod *dlg, uint32_t tagID );
static UInt32 GetNumTags( void );
static pfGUITag *GetTag( UInt32 tagIndex );
static UInt32 GetHighestTag( void );
void SetAspectRatio(hsScalar aspectratio);
hsScalar GetAspectRatio() { return fAspectRatio; }
static uint32_t GetNumTags( void );
static pfGUITag *GetTag( uint32_t tagIndex );
static uint32_t GetHighestTag( void );
void SetAspectRatio(float aspectratio);
float GetAspectRatio() { return fAspectRatio; }
static pfGameGUIMgr *GetInstance( void ) { return fInstance; }
};