Browse Source

Refactor plPlates CreateResource function names.

Add support for external resource Cursors.
Add support for external resource Progress Linking Book.
Add support for external resource Voice Chat indicators.
Joseph Davies 14 years ago
parent
commit
3027e0605c
  1. 1
      Sources/Plasma/Apps/plClient/CMakeLists.txt
  2. 4
      Sources/Plasma/Apps/plClient/winmain.cpp
  3. 12
      Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp
  4. 8
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp
  5. 48
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h
  6. 2
      Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp
  7. 6
      Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp
  8. 8
      Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp
  9. 8
      Sources/Plasma/PubUtilLib/plPipeline/plPlates.h
  10. 41
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp
  11. 4
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

1
Sources/Plasma/Apps/plClient/CMakeLists.txt

@ -123,6 +123,7 @@ target_link_libraries(plClient plAudible)
target_link_libraries(plClient plAudio) target_link_libraries(plClient plAudio)
target_link_libraries(plClient plAudioCore) target_link_libraries(plClient plAudioCore)
target_link_libraries(plClient plAvatar) target_link_libraries(plClient plAvatar)
target_link_libraries(plClient plClientResMgr)
#target_link_libraries(plClient plClientKey) #target_link_libraries(plClient plClientKey)
target_link_libraries(plClient plCompression) target_link_libraries(plClient plCompression)
target_link_libraries(plClient plContainer) target_link_libraries(plClient plContainer)

4
Sources/Plasma/Apps/plClient/winmain.cpp

@ -39,6 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsStream.h" #include "hsStream.h"
#include "hsUtils.h" #include "hsUtils.h"
#include "plClient.h" #include "plClient.h"
#include "plClientResMgr/plClientResMgr.h"
#include "plNetClient/plNetClientMgr.h" #include "plNetClient/plNetClientMgr.h"
#include "plNetClient/plNetLinkingMgr.h" #include "plNetClient/plNetLinkingMgr.h"
#include "plInputCore/plInputManager.h" #include "plInputCore/plInputManager.h"
@ -754,6 +755,9 @@ bool InitClient( HWND hWnd )
plResManager *resMgr = TRACKED_NEW plResManager; plResManager *resMgr = TRACKED_NEW plResManager;
resMgr->SetDataPath("dat"); resMgr->SetDataPath("dat");
hsgResMgr::Init(resMgr); hsgResMgr::Init(resMgr);
plClientResMgr::Instance().ILoadResources("resource.dat");
gClient = TRACKED_NEW plClient; gClient = TRACKED_NEW plClient;
if( gClient == nil ) if( gClient == nil )
return false; return false;

12
Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp

@ -50,8 +50,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plPipeline/plDebugText.h" #include "plPipeline/plDebugText.h"
#include "plStatusLog/plStatusLog.h" #include "plStatusLog/plStatusLog.h"
#define MICROPHONE 121 #define MICROPHONE "ui_microphone.png"
#define TALKING 122 #define TALKING "ui_speaker.png"
#define NUM_CHANNELS 1 #define NUM_CHANNELS 1
#define VOICE_STOP_MS 2000 #define VOICE_STOP_MS 2000
#define MAX_DATA_SIZE 1024 * 4 // 4 KB #define MAX_DATA_SIZE 1024 * 4 // 4 KB
@ -68,13 +68,13 @@ hsBool plVoicePlayer::fEnabled = true;
plVoiceRecorder::plVoiceRecorder() plVoiceRecorder::plVoiceRecorder()
{ {
plPlateManager::Instance().CreatePlate( &fDisabledIcon ); plPlateManager::Instance().CreatePlate( &fDisabledIcon );
fDisabledIcon->CreateFromResource( MAKEINTRESOURCE( MICROPHONE ) ); fDisabledIcon->CreateFromResource( MICROPHONE );
fDisabledIcon->SetPosition(-0.90, -0.90); fDisabledIcon->SetPosition(-0.90, -0.90);
fDisabledIcon->SetSize(0.0675, 0.09); fDisabledIcon->SetSize(0.0675, 0.09);
fDisabledIcon->SetVisible(false); fDisabledIcon->SetVisible(false);
plPlateManager::Instance().CreatePlate( &fTalkIcon ); plPlateManager::Instance().CreatePlate( &fTalkIcon );
fTalkIcon->CreateFromResource( MAKEINTRESOURCE( TALKING ) ); fTalkIcon->CreateFromResource( TALKING );
fTalkIcon->SetPosition(-0.9,-0.9); fTalkIcon->SetPosition(-0.9,-0.9);
fTalkIcon->SetSize(0.0675, 0.09); fTalkIcon->SetSize(0.0675, 0.09);
fTalkIcon->SetVisible(false); fTalkIcon->SetVisible(false);
@ -192,7 +192,7 @@ void plVoiceRecorder::DrawDisabledIcon(hsBool b)
plPlateManager::Instance().CreatePlate( &fDisabledIcon ); plPlateManager::Instance().CreatePlate( &fDisabledIcon );
if (fDisabledIcon) if (fDisabledIcon)
{ {
fDisabledIcon->CreateFromResource( MAKEINTRESOURCE( MICROPHONE ) ); fDisabledIcon->CreateFromResource( MICROPHONE );
fDisabledIcon->SetPosition(-0.90, -0.90); fDisabledIcon->SetPosition(-0.90, -0.90);
fDisabledIcon->SetSize(0.0675, 0.09); fDisabledIcon->SetSize(0.0675, 0.09);
fDisabledIcon->SetVisible(false); fDisabledIcon->SetVisible(false);
@ -209,7 +209,7 @@ void plVoiceRecorder::DrawTalkIcon(hsBool b)
{ {
plPlateManager::Instance().CreatePlate( &fTalkIcon ); plPlateManager::Instance().CreatePlate( &fTalkIcon );
if (fTalkIcon) if (fTalkIcon)
{ fTalkIcon->CreateFromResource( MAKEINTRESOURCE( TALKING ) ); { fTalkIcon->CreateFromResource( TALKING );
fTalkIcon->SetPosition(-0.9,-0.9); fTalkIcon->SetPosition(-0.9,-0.9);
fTalkIcon->SetSize(0.0675, 0.09); fTalkIcon->SetSize(0.0675, 0.09);
fTalkIcon->SetVisible(false); fTalkIcon->SetVisible(false);

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

@ -296,16 +296,16 @@ void plMouseDevice::SetDisplayResolution(hsScalar Width, hsScalar Height)
IUpdateCursorSize(); IUpdateCursorSize();
} }
void plMouseDevice::CreateCursor( int cursor ) void plMouseDevice::CreateCursor( char* cursor )
{ {
if( fCursor == nil ) if( fCursor == nil )
{ {
plPlateManager::Instance().CreatePlate( &fCursor ); plPlateManager::Instance().CreatePlate( &fCursor );
fCursor->CreateFromResource( MAKEINTRESOURCE( cursor ) ); fCursor->CreateFromResource(cursor);
} }
else else
{ {
fCursor->ReloadFromResource( MAKEINTRESOURCE( cursor ) ); fCursor->ReloadFromResource(cursor);
} }
fCursor->SetPosition( 0, 0, 0 ); fCursor->SetPosition( 0, 0, 0 );
IUpdateCursorSize(); IUpdateCursorSize();
@ -406,7 +406,7 @@ void plMouseDevice::ShowCursor(hsBool override)
fInstance->fCursor->SetVisible( true ); fInstance->fCursor->SetVisible( true );
} }
void plMouseDevice::NewCursor(int cursor) void plMouseDevice::NewCursor(char* cursor)
{ {
fInstance->fCursorID = cursor; fInstance->fCursorID = cursor;
fInstance->CreateCursor(cursor); fInstance->CreateCursor(cursor);

48
Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h

@ -118,27 +118,27 @@ public:
class plPlate; class plPlate;
#define CURSOR_UP IDB_CURSOR_UP #define CURSOR_UP "cursor_up.png"
#define CURSOR_DOWN IDB_CURSOR_DOWN #define CURSOR_DOWN "cursor_down.png"
#define CURSOR_RIGHT IDB_CURSOR_RIGHT #define CURSOR_RIGHT "cursor_right.png"
#define CURSOR_LEFT IDB_CURSOR_LEFT #define CURSOR_LEFT "cursor_left.png"
#define CURSOR_OPEN IDB_CURSOR_OPEN #define CURSOR_OPEN "cursor_open.png"
#define CURSOR_GRAB IDB_CURSOR_GRAB #define CURSOR_GRAB "cursor_grab.png"
#define CURSOR_CLICKED IDB_CURSOR_CLICKED #define CURSOR_CLICKED "cursor_clicked.png"
#define CURSOR_POISED IDB_CURSOR_POISED #define CURSOR_POISED "cursor_poised.png"
#define CURSOR_ARROW IDB_CURSOR_ARROW #define CURSOR_ARROW "cursor_up.png"
#define CURSOR_4WAY_OPEN IDB_CURSOR_4WAYOPEN #define CURSOR_4WAY_OPEN "bitmap1.png"
#define CURSOR_4WAY_CLOSED IDB_CURSOR_4WAYCLOSED #define CURSOR_4WAY_CLOSED "bitmap3.png"
#define CURSOR_UPDOWN_CLOSED IDB_CURSOR_UPDOWNCLOSED #define CURSOR_UPDOWN_CLOSED "bmp00001.png"
#define CURSOR_UPDOWN_OPEN IDB_CURSOR_UPDOWNOPEN #define CURSOR_UPDOWN_OPEN "bitmap2.png"
#define CURSOR_LEFTRIGHT_CLOSED IDB_CURSOR_LEFTRIGHTCLOSED #define CURSOR_LEFTRIGHT_CLOSED "bmp00003.png"
#define CURSOR_LEFTRIGHT_OPEN IDB_CURSOR_LEFTRIGHTOPEN #define CURSOR_LEFTRIGHT_OPEN "bmp00002.png"
#define CURSOR_OFFER_BOOK IDB_CURSOR_BOOK #define CURSOR_OFFER_BOOK "book.png"
#define CURSOR_OFFER_BOOK_HI IDB_CURSOR_BOOK_HIGHLIGHT #define CURSOR_OFFER_BOOK_HI "book_hig.png"
#define CURSOR_OFFER_BOOK_CLICKED IDB_CURSOR_BOOK_CLICKED #define CURSOR_OFFER_BOOK_CLICKED "book_cli.png"
#define CURSOR_CLICK_DISABLED IDB_CURSOR_DISABLED #define CURSOR_CLICK_DISABLED "cursor_disabled.png"
#define CURSOR_HAND IDB_CURSOR_HAND #define CURSOR_HAND "cursor_up.png"
#define CURSOR_UPWARD IDB_CURSOR_UPWARD #define CURSOR_UPWARD "cursor_upward.png"
class plInputEventMsg; class plInputEventMsg;
@ -171,7 +171,7 @@ public:
static void SetMsgAlways(bool b) { plMouseDevice::bMsgAlways = b; } static void SetMsgAlways(bool b) { plMouseDevice::bMsgAlways = b; }
static void ShowCursor(hsBool override = false); static void ShowCursor(hsBool override = false);
static void NewCursor(int cursor); static void NewCursor(char* cursor);
static void HideCursor(hsBool override = false); static void HideCursor(hsBool override = false);
static bool GetHideCursor() { return plMouseDevice::bCursorHidden; } static bool GetHideCursor() { return plMouseDevice::bCursorHidden; }
static void SetCursorOpacity( hsScalar opacity = 1.f ); static void SetCursorOpacity( hsScalar opacity = 1.f );
@ -201,11 +201,11 @@ protected:
plPlate *fCursor; plPlate *fCursor;
int fCursorID; char* fCursorID;
static plMouseDevice* fInstance; static plMouseDevice* fInstance;
static plMouseInfo fDefaultMouseControlMap[]; static plMouseInfo fDefaultMouseControlMap[];
void CreateCursor( int cursor ); void CreateCursor( char* cursor );
void IUpdateCursorSize(); void IUpdateCursorSize();
static bool bMsgAlways; static bool bMsgAlways;
static bool bCursorHidden; static bool bCursorHidden;

2
Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp

@ -235,7 +235,7 @@ void plInputInterfaceMgr::ResetClickableState()
void plInputInterfaceMgr::IUpdateCursor( Int32 newCursor ) void plInputInterfaceMgr::IUpdateCursor( Int32 newCursor )
{ {
int mouseCursorResID; char* mouseCursorResID;
fCurrentCursor = newCursor; fCurrentCursor = newCursor;

6
Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp

@ -40,8 +40,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plDebugText.h" #include "plDebugText.h"
#include "plPlates.h" #include "plPlates.h"
#include "../../Apps/plClient/res/resource.h"
#include "hsTimer.h" #include "hsTimer.h"
@ -81,7 +79,7 @@ void plDTProgressMgr::Activate()
{ {
plPlateManager::Instance().CreatePlate( &fActivePlate ); plPlateManager::Instance().CreatePlate( &fActivePlate );
fActivePlate->CreateFromJPEGResource( MAKEINTRESOURCE( plProgressMgr::GetLoadingFrameID(fCurrentImage) ), 0 ); fActivePlate->CreateFromResource(plProgressMgr::GetLoadingFrameID(fCurrentImage));
fActivePlate->SetVisible(true); fActivePlate->SetVisible(true);
fActivePlate->SetOpacity(1.0f); fActivePlate->SetOpacity(1.0f);
fActivePlate->SetSize(0.6, 0.6, true); fActivePlate->SetSize(0.6, 0.6, true);
@ -143,7 +141,7 @@ void plDTProgressMgr::Draw( plPipeline *p )
fLastDraw = currentMs; fLastDraw = currentMs;
fActivePlate->ReloadFromJPEGResource(MAKEINTRESOURCE(plProgressMgr::GetInstance()->GetLoadingFrameID(fCurrentImage)), 0); fActivePlate->ReloadFromResource(plProgressMgr::GetLoadingFrameID(fCurrentImage));
fActivePlate->SetVisible(true); fActivePlate->SetVisible(true);
fActivePlate->SetOpacity(1.0f); fActivePlate->SetOpacity(1.0f);
fActivePlate->SetSize(0.6, 0.6, true); fActivePlate->SetSize(0.6, 0.6, true);

8
Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp

@ -295,7 +295,7 @@ void plPlate::ISetResourceAlphas(UInt32 colorKey)
} }
} }
void plPlate::CreateFromResource( const char *resName, UInt32 colorKey ) void plPlate::CreateFromBMPResource( const char *resName, UInt32 colorKey )
{ {
/* /*
Someday the following might actually work, once we get a plugin that Someday the following might actually work, once we get a plugin that
@ -374,7 +374,7 @@ void plPlate::CreateFromResource( const char *resName, UInt32 colorKey )
//// ReloadFromResource ////////////////////////////////////////////////////// //// ReloadFromResource //////////////////////////////////////////////////////
// Creates a plate's material from a resource of the given name. // Creates a plate's material from a resource of the given name.
void plPlate::ReloadFromResource( const char *resName, UInt32 colorKey ) void plPlate::ReloadFromBMPResource( const char *resName, UInt32 colorKey )
{ {
UInt32 width, height; UInt32 width, height;
@ -528,7 +528,7 @@ void plPlate::ReloadFromJPEGResource( const char *resName, UInt32 colorKey )
} }
} }
void plPlate::CreateFromResourceDat(const char *resName) void plPlate::CreateFromResource(const char *resName)
{ {
if (resName) if (resName)
{ {
@ -547,7 +547,7 @@ void plPlate::CreateFromResourceDat(const char *resName)
} }
} }
void plPlate::ReloadFromResourceDat(const char *resName) void plPlate::ReloadFromResource(const char *resName)
{ {
if (resName) if (resName)
{ {

8
Sources/Plasma/PubUtilLib/plPipeline/plPlates.h

@ -127,12 +127,12 @@ class plPlate
void SetSize( hsScalar width, hsScalar height, bool adjustByAspectRatio = false ); void SetSize( hsScalar width, hsScalar height, bool adjustByAspectRatio = false );
plMipmap *CreateMaterial( UInt32 width, UInt32 height, hsBool withAlpha, plMipmap* texture = NULL ); plMipmap *CreateMaterial( UInt32 width, UInt32 height, hsBool withAlpha, plMipmap* texture = NULL );
void CreateFromResource( const char *resName, UInt32 colorKey = 0x00ff00ff ); void CreateFromBMPResource( const char *resName, UInt32 colorKey = 0x00ff00ff );
void ReloadFromResource( const char *resName, UInt32 colorKey = 0x00ff00ff ); void ReloadFromBMPResource( const char *resName, UInt32 colorKey = 0x00ff00ff );
void CreateFromJPEGResource( const char *resName, UInt32 colorKey = 0x00ff00ff ); void CreateFromJPEGResource( const char *resName, UInt32 colorKey = 0x00ff00ff );
void ReloadFromJPEGResource( const char *resName, UInt32 colorKey = 0x00ff00ff ); void ReloadFromJPEGResource( const char *resName, UInt32 colorKey = 0x00ff00ff );
void CreateFromResourceDat( const char *resName ); void CreateFromResource( const char *resName );
void ReloadFromResourceDat( const char *resName ); void ReloadFromResource( const char *resName );
}; };
//// plGraphPlate Class Definition /////////////////////////////////////////// //// plGraphPlate Class Definition ///////////////////////////////////////////

41
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp

@ -50,26 +50,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plProgressMgr *plProgressMgr::fManager = nil; plProgressMgr *plProgressMgr::fManager = nil;
int plProgressMgr::fImageRotation[] = { #define LOADING_RES "xLoading_Linking.%02d.png"
IDR_LOADING_01, #define LOADING_RES_COUNT 18
IDR_LOADING_18,
IDR_LOADING_17, char* plProgressMgr::fImageRotation[LOADING_RES_COUNT];
IDR_LOADING_16,
IDR_LOADING_15,
IDR_LOADING_14,
IDR_LOADING_13,
IDR_LOADING_12,
IDR_LOADING_11,
IDR_LOADING_10,
IDR_LOADING_09,
IDR_LOADING_08,
IDR_LOADING_07,
IDR_LOADING_06,
IDR_LOADING_05,
IDR_LOADING_04,
IDR_LOADING_03,
IDR_LOADING_02
};
int plProgressMgr::fStaticTextIDs[] = { int plProgressMgr::fStaticTextIDs[] = {
0, 0,
@ -84,10 +68,23 @@ plProgressMgr::plProgressMgr()
fManager = this; fManager = this;
fCallbackProc = nil; fCallbackProc = nil;
fCurrentStaticText = kNone; fCurrentStaticText = kNone;
// Fill array with pre-computed loading frame IDs
for (int i=0; i < LOADING_RES_COUNT; i++)
{
char* frameID = TRACKED_NEW char[128];
sprintf(frameID, LOADING_RES, i);
fImageRotation[i] = frameID;
}
} }
plProgressMgr::~plProgressMgr() plProgressMgr::~plProgressMgr()
{ {
for (int i=0; i < LOADING_RES_COUNT; i++)
{
delete fImageRotation[i];
}
while( fOperations != nil ) while( fOperations != nil )
delete fOperations; delete fOperations;
fManager = nil; fManager = nil;
@ -229,9 +226,9 @@ void plProgressMgr::CancelAllOps( void )
fCurrentStaticText = kNone; fCurrentStaticText = kNone;
} }
int plProgressMgr::GetLoadingFrameID(int index) char* plProgressMgr::GetLoadingFrameID(int index)
{ {
if (index < (sizeof(fImageRotation) / sizeof(int))) if (index < LOADING_RES_COUNT)
return fImageRotation[index]; return fImageRotation[index];
else else
return fImageRotation[0]; return fImageRotation[0];

4
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

@ -180,7 +180,7 @@ class plProgressMgr
private: private:
static plProgressMgr *fManager; static plProgressMgr *fManager;
static int fImageRotation[]; static char* fImageRotation[];
static int fStaticTextIDs[]; static int fStaticTextIDs[];
protected: protected:
@ -213,7 +213,7 @@ class plProgressMgr
virtual ~plProgressMgr(); virtual ~plProgressMgr();
static plProgressMgr* GetInstance() { return fManager; } static plProgressMgr* GetInstance() { return fManager; }
static int GetLoadingFrameID(int index); static char* GetLoadingFrameID(int index);
static int GetStaticTextID(StaticText staticTextType); static int GetStaticTextID(StaticText staticTextType);
virtual void Draw( plPipeline *p ) { } virtual void Draw( plPipeline *p ) { }

Loading…
Cancel
Save