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.
cursors2
Joseph Davies 13 years ago
parent
commit
508e431a99
  1. 4
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp
  2. 12
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp
  3. 8
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp
  4. 48
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h
  5. 2
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp
  6. 6
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp
  7. 8
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp
  8. 8
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h
  9. 41
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp
  10. 4
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -311,7 +311,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
@ -390,7 +390,7 @@ void plPlate::CreateFromResource( const char *resName, UInt32 colorKey )
//// ReloadFromResource //////////////////////////////////////////////////////
// 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;
@ -544,7 +544,7 @@ void plPlate::ReloadFromJPEGResource( const char *resName, UInt32 colorKey )
}
}
void plPlate::CreateFromResourceDat(const char *resName)
void plPlate::CreateFromResource(const char *resName)
{
if (resName)
{
@ -563,7 +563,7 @@ void plPlate::CreateFromResourceDat(const char *resName)
}
}
void plPlate::ReloadFromResourceDat(const char *resName)
void plPlate::ReloadFromResource(const char *resName)
{
if (resName)
{

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

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

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

@ -66,26 +66,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plProgressMgr *plProgressMgr::fManager = nil;
int plProgressMgr::fImageRotation[] = {
IDR_LOADING_01,
IDR_LOADING_18,
IDR_LOADING_17,
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
};
#define LOADING_RES "xLoading_Linking.%02d.png"
#define LOADING_RES_COUNT 18
char* plProgressMgr::fImageRotation[LOADING_RES_COUNT];
int plProgressMgr::fStaticTextIDs[] = {
0,
@ -100,10 +84,23 @@ plProgressMgr::plProgressMgr()
fManager = this;
fCallbackProc = nil;
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()
{
for (int i=0; i < LOADING_RES_COUNT; i++)
{
delete fImageRotation[i];
}
while( fOperations != nil )
delete fOperations;
fManager = nil;
@ -245,9 +242,9 @@ void plProgressMgr::CancelAllOps( void )
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];
else
return fImageRotation[0];

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

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

Loading…
Cancel
Save