mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 18:59:09 +00:00
Movie filename in plMovieMsg and plBinkPlayer => plString
This commit is contained in:
@ -860,7 +860,7 @@ bool plClient::MsgReceive(plMessage* msg)
|
||||
//============================================================================
|
||||
bool plClient::IHandleMovieMsg(plMovieMsg* mov)
|
||||
{
|
||||
if( !(mov->GetFileName() && *mov->GetFileName()) )
|
||||
if (mov->GetFileName().IsEmpty())
|
||||
return true;
|
||||
|
||||
int i;
|
||||
@ -869,7 +869,7 @@ bool plClient::IHandleMovieMsg(plMovieMsg* mov)
|
||||
{
|
||||
for( i = 0; i < fMovies.GetCount(); i++ )
|
||||
{
|
||||
if( !stricmp(mov->GetFileName(), fMovies[i]->GetFileName()) )
|
||||
if (mov->GetFileName().CompareI(fMovies[i]->GetFileName()) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -929,7 +929,7 @@ bool plClient::IHandleMovieMsg(plMovieMsg* mov)
|
||||
// If a movie has lost its filename, it means something went horribly wrong
|
||||
// with playing it and it has shutdown. Or we just stopped it. Either way,
|
||||
// we need to clear it out of our list.
|
||||
if( !(fMovies[i]->GetFileName() && *fMovies[i]->GetFileName()) )
|
||||
if (fMovies[i]->GetFileName().IsEmpty())
|
||||
{
|
||||
delete fMovies[i];
|
||||
fMovies.Remove(i);
|
||||
@ -1948,7 +1948,7 @@ void plClient::IServiceMovies()
|
||||
int i;
|
||||
for( i = 0; i < fMovies.GetCount(); i++ )
|
||||
{
|
||||
hsAssert(fMovies[i]->GetFileName() && *fMovies[i]->GetFileName(), "Lost our movie");
|
||||
hsAssert(!fMovies[i]->GetFileName().IsEmpty(), "Lost our movie");
|
||||
if( !fMovies[i]->NextFrame() )
|
||||
{
|
||||
delete fMovies[i];
|
||||
|
@ -54,12 +54,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plMessage/plMovieMsg.h"
|
||||
#include "pfMessage/pfMovieEventMsg.h"
|
||||
|
||||
pyMoviePlayer::pyMoviePlayer(const char* movieName,pyKey& selfKey)
|
||||
pyMoviePlayer::pyMoviePlayer(const plString& movieName, pyKey& selfKey)
|
||||
{
|
||||
fMovieName = hsStrcpy(movieName);
|
||||
fMovieName = movieName;
|
||||
fSelfKey = selfKey.getKey();
|
||||
// make the movie
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kMake | plMovieMsg::kAddCallbacks);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -75,17 +75,14 @@ pyMoviePlayer::pyMoviePlayer(const char* movieName,pyKey& selfKey)
|
||||
pyMoviePlayer::~pyMoviePlayer()
|
||||
{
|
||||
Stop();
|
||||
delete [] fMovieName;
|
||||
}
|
||||
|
||||
void pyMoviePlayer::MakeMovie(const char* movieName, pyKey& selfKey)
|
||||
void pyMoviePlayer::MakeMovie(const plString& movieName, pyKey& selfKey)
|
||||
{
|
||||
Stop();
|
||||
if (fMovieName)
|
||||
delete [] fMovieName;
|
||||
fMovieName = hsStrcpy(movieName);
|
||||
fMovieName = movieName;
|
||||
fSelfKey = selfKey.getKey();
|
||||
if (fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kMake | plMovieMsg::kAddCallbacks);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -99,7 +96,7 @@ void pyMoviePlayer::MakeMovie(const char* movieName, pyKey& selfKey)
|
||||
|
||||
void pyMoviePlayer::SetCenter(float x, float y)
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kMove);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -111,7 +108,7 @@ void pyMoviePlayer::SetCenter(float x, float y)
|
||||
|
||||
void pyMoviePlayer::SetScale(float width, float height)
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kScale);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -123,7 +120,7 @@ void pyMoviePlayer::SetScale(float width, float height)
|
||||
|
||||
void pyMoviePlayer::SetColor(pyColor color)
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kColor);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -134,7 +131,7 @@ void pyMoviePlayer::SetColor(pyColor color)
|
||||
|
||||
void pyMoviePlayer::SetVolume(float volume)
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kVolume);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -145,7 +142,7 @@ void pyMoviePlayer::SetVolume(float volume)
|
||||
|
||||
void pyMoviePlayer::SetOpacity(float opacity)
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kOpacity);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -157,7 +154,7 @@ void pyMoviePlayer::SetOpacity(float opacity)
|
||||
|
||||
void pyMoviePlayer::Play()
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kStart);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -167,7 +164,7 @@ void pyMoviePlayer::Play()
|
||||
|
||||
void pyMoviePlayer::PlayPaused()
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kStart | plMovieMsg::kPause);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -177,7 +174,7 @@ void pyMoviePlayer::PlayPaused()
|
||||
|
||||
void pyMoviePlayer::Pause()
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kPause);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -187,7 +184,7 @@ void pyMoviePlayer::Pause()
|
||||
|
||||
void pyMoviePlayer::Resume()
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kResume);
|
||||
mov->SetSender(fSelfKey);
|
||||
@ -197,7 +194,7 @@ void pyMoviePlayer::Resume()
|
||||
|
||||
void pyMoviePlayer::Stop()
|
||||
{
|
||||
if ( fMovieName)
|
||||
if (!fMovieName.IsEmpty())
|
||||
{
|
||||
plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kStop);
|
||||
mov->SetSender(fSelfKey);
|
||||
|
@ -56,24 +56,24 @@ class pyColor;
|
||||
class pyMoviePlayer
|
||||
{
|
||||
protected:
|
||||
char* fMovieName;
|
||||
plKey fSelfKey;
|
||||
plString fMovieName;
|
||||
plKey fSelfKey;
|
||||
|
||||
pyMoviePlayer(): fMovieName(nil), fSelfKey(nil) {} // only used by python glue, do NOT call
|
||||
pyMoviePlayer(const char* movieName,pyKey& selfKey);
|
||||
pyMoviePlayer(): fSelfKey(nil) {} // only used by python glue, do NOT call
|
||||
pyMoviePlayer(const plString& movieName, pyKey& selfKey);
|
||||
public:
|
||||
~pyMoviePlayer();
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PYTHON_CLASS_NEW_FRIEND(ptMoviePlayer);
|
||||
static PyObject *New(const char* movieName, pyKey& selfKey);
|
||||
static PyObject *New(const plString& movieName, pyKey& selfKey);
|
||||
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyMoviePlayer object
|
||||
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyMoviePlayer); // converts a PyObject to a pyMoviePlayer (throws error if not correct type)
|
||||
|
||||
static void AddPlasmaClasses(PyObject *m);
|
||||
static void AddPlasmaConstantsClasses(PyObject *m);
|
||||
|
||||
void MakeMovie(const char* movieName, pyKey& selfKey); // only used by python glue, do NOT call
|
||||
void MakeMovie(const plString& movieName, pyKey& selfKey); // only used by python glue, do NOT call
|
||||
|
||||
// getters and setters
|
||||
virtual void SetCenter(float x, float y);
|
||||
|
@ -164,7 +164,7 @@ PYTHON_END_METHODS_TABLE;
|
||||
PLASMA_DEFAULT_TYPE(ptMoviePlayer, "Params: movieName,selfKey\nAccessor class to play in the MoviePlayer");
|
||||
|
||||
// required functions for PyObject interoperability
|
||||
PyObject *pyMoviePlayer::New(const char* movieName, pyKey& selfKey)
|
||||
PyObject *pyMoviePlayer::New(const plString& movieName, pyKey& selfKey)
|
||||
{
|
||||
ptMoviePlayer *newObj = (ptMoviePlayer*)ptMoviePlayer_type.tp_new(&ptMoviePlayer_type, NULL, NULL);
|
||||
newObj->fThis->MakeMovie(movieName, selfKey);
|
||||
|
@ -78,35 +78,35 @@ protected:
|
||||
hsColorRGBA fColor;
|
||||
|
||||
hsColorRGBA fFadeInColor;
|
||||
float fFadeInSecs;
|
||||
float fFadeInSecs;
|
||||
|
||||
hsColorRGBA fFadeOutColor;
|
||||
float fFadeOutSecs;
|
||||
float fFadeOutSecs;
|
||||
|
||||
float fVolume;
|
||||
float fVolume;
|
||||
|
||||
char* fFileName;
|
||||
plString fFileName;
|
||||
|
||||
uint16_t fCmd;
|
||||
uint16_t fCmd;
|
||||
|
||||
hsTArray<plMessage*> fCallbacks;
|
||||
|
||||
public:
|
||||
plMovieMsg(const char* n, uint16_t cmd)
|
||||
plMovieMsg(const plString& name, uint16_t cmd)
|
||||
: plMessage(nil, nil, nil)
|
||||
{
|
||||
fFileName = hsStrcpy(n);
|
||||
fFileName = name;
|
||||
SetCmd(cmd).MakeDefault();
|
||||
}
|
||||
plMovieMsg() : fFileName(nil), fCmd(kIgnore)
|
||||
|
||||
plMovieMsg() : fCmd(kIgnore)
|
||||
{
|
||||
MakeDefault();
|
||||
}
|
||||
|
||||
virtual ~plMovieMsg()
|
||||
{
|
||||
delete [] fFileName;
|
||||
int i;
|
||||
for( i = 0; i < fCallbacks.GetCount(); i++ )
|
||||
for (int i = 0; i < fCallbacks.GetCount(); i++)
|
||||
{
|
||||
hsRefCnt_SafeUnRef(fCallbacks[i]);
|
||||
}
|
||||
@ -157,8 +157,8 @@ public:
|
||||
|
||||
// Include the movie folder, e.g. "avi/porno.bik"
|
||||
// String is copied, not pointer copy.
|
||||
const char* GetFileName() const { return fFileName; }
|
||||
plMovieMsg& SetFileName(const char* n) { delete [] fFileName; fFileName = hsStrcpy(n); return *this; }
|
||||
plString GetFileName() const { return fFileName; }
|
||||
plMovieMsg& SetFileName(const plString& name) { fFileName = name; return *this; }
|
||||
|
||||
// Color is mostly useful for alpha fade up and down.
|
||||
const hsColorRGBA& GetColor() const { return fColor; }
|
||||
|
@ -57,8 +57,7 @@ class plBinkPlayer
|
||||
{
|
||||
public:
|
||||
|
||||
plBinkPlayer() : fFileName(nil) { }
|
||||
~plBinkPlayer() { delete [] fFileName; }
|
||||
plBinkPlayer() { }
|
||||
|
||||
static bool Init( hsWindowHndl hWnd) { return true; }
|
||||
static bool DeInit() { return true; }
|
||||
@ -83,14 +82,12 @@ class plBinkPlayer
|
||||
for (int i = 0; i < fCallbacks.GetCount(); i++)
|
||||
fCallbacks[i]->Send();
|
||||
fCallbacks.Reset();
|
||||
delete [] fFileName;
|
||||
fFileName = nil;
|
||||
fFileName = plString::Null;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetFileName(const char* filename) {
|
||||
delete [] fFileName;
|
||||
fFileName = hsStrcpy(filename);
|
||||
void SetFileName(const plString& filename) {
|
||||
fFileName = filename;
|
||||
}
|
||||
void SetColor(const hsColorRGBA& c) { }
|
||||
void SetPosition(float x, float y) { }
|
||||
@ -102,7 +99,7 @@ class plBinkPlayer
|
||||
void SetPosition(const hsPoint2& p) { }
|
||||
void SetScale(const hsPoint2& s) { }
|
||||
|
||||
const char* GetFileName() const { return fFileName; }
|
||||
plString GetFileName() const { return fFileName; }
|
||||
const hsColorRGBA GetColor() const { return hsColorRGBA(); }
|
||||
const hsPoint2 GetPosition() const { return hsPoint2(); }
|
||||
const hsPoint2 GetScale() const { return hsPoint2(); }
|
||||
@ -125,7 +122,7 @@ class plBinkPlayer
|
||||
hsColorRGBA GetFadeToColor() const { return hsColorRGBA(); }
|
||||
|
||||
private:
|
||||
char* fFileName;
|
||||
plString fFileName;
|
||||
hsTArray<plMessage*> fCallbacks;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user