mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
SWORD25: unsigned int -> uint
svn-id: r53309
This commit is contained in:
parent
0cdb2ded85
commit
086f5961b6
@ -60,7 +60,7 @@ MoviePlayer::~MoviePlayer() {
|
||||
_decoder.close();
|
||||
}
|
||||
|
||||
bool MoviePlayer::LoadMovie(const Common::String &filename, unsigned int z) {
|
||||
bool MoviePlayer::LoadMovie(const Common::String &filename, uint z) {
|
||||
// Get the file and load it into the decoder
|
||||
Common::SeekableReadStream *in = Kernel::GetInstance()->GetPackage()->GetStream(filename);
|
||||
_decoder.load(in);
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
* @param Z Z indicates the position of the film on the main graphics layer
|
||||
* @return Returns false if an error occured while loading, otherwise true.
|
||||
*/
|
||||
bool LoadMovie(const Common::String &Filename, unsigned int Z);
|
||||
bool LoadMovie(const Common::String &Filename, uint Z);
|
||||
|
||||
/**
|
||||
* Unloads the currently loaded movie file.
|
||||
|
@ -49,7 +49,7 @@ int LoadMovie(lua_State *L) {
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushbooleancpp(L, FMVPtr->LoadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast<unsigned int>(luaL_checknumber(L, 2)) : 10));
|
||||
lua_pushbooleancpp(L, FMVPtr->LoadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast<uint>(luaL_checknumber(L, 2)) : 10));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ Animation::Animation(RenderObjectPtr<RenderObject> ParentPtr, const AnimationTem
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Animation::Animation(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle) :
|
||||
Animation::Animation(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle) :
|
||||
TimedRenderObject(ParentPtr, RenderObject::TYPE_ANIMATION, Handle) {
|
||||
// Das BS_RenderObject konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden.
|
||||
if (!m_InitSuccess) return;
|
||||
@ -179,7 +179,7 @@ void Animation::Stop() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Animation::SetFrame(unsigned int Nr) {
|
||||
void Animation::SetFrame(uint Nr) {
|
||||
AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
|
||||
BS_ASSERT(animationDescriptionPtr);
|
||||
|
||||
@ -283,7 +283,7 @@ void Animation::FrameNotification(int TimeElapsed) {
|
||||
BS_ASSERT(animationDescriptionPtr->GetAnimationType() == AT_JOJO);
|
||||
TmpCurFrame = - TmpCurFrame;
|
||||
m_Direction = FORWARD;
|
||||
} else if (static_cast<unsigned int>(TmpCurFrame) >= animationDescriptionPtr->GetFrameCount()) {
|
||||
} else if (static_cast<uint>(TmpCurFrame) >= animationDescriptionPtr->GetFrameCount()) {
|
||||
// Loop-Point Callbacks
|
||||
for (uint i = 0; i < m_LoopPointCallbacks.size();) {
|
||||
if ((m_LoopPointCallbacks[i].Callback)(m_LoopPointCallbacks[i].Data) == false) {
|
||||
@ -327,7 +327,7 @@ void Animation::FrameNotification(int TimeElapsed) {
|
||||
}
|
||||
}
|
||||
|
||||
m_CurrentFrame = static_cast<unsigned int>(TmpCurFrame);
|
||||
m_CurrentFrame = static_cast<uint>(TmpCurFrame);
|
||||
}
|
||||
|
||||
// Größe und Position der Animation anhand des aktuellen Frames bestimmen
|
||||
@ -368,7 +368,7 @@ bool Animation::LockAllFrames() {
|
||||
if (!m_FramesLocked) {
|
||||
AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
|
||||
BS_ASSERT(animationDescriptionPtr);
|
||||
for (unsigned int i = 0; i < animationDescriptionPtr->GetFrameCount(); ++i) {
|
||||
for (uint i = 0; i < animationDescriptionPtr->GetFrameCount(); ++i) {
|
||||
if (!Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->GetFrame(i).FileName)) {
|
||||
BS_LOG_ERRORLN("Could not lock all animation frames.");
|
||||
return false;
|
||||
@ -387,7 +387,7 @@ bool Animation::UnlockAllFrames() {
|
||||
if (m_FramesLocked) {
|
||||
AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
|
||||
BS_ASSERT(animationDescriptionPtr);
|
||||
for (unsigned int i = 0; i < animationDescriptionPtr->GetFrameCount(); ++i) {
|
||||
for (uint i = 0; i < animationDescriptionPtr->GetFrameCount(); ++i) {
|
||||
Resource *pResource;
|
||||
if (!(pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->GetFrame(i).FileName))) {
|
||||
BS_LOG_ERRORLN("Could not unlock all animation frames.");
|
||||
@ -494,7 +494,7 @@ void Animation::SetAlpha(int Alpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24;
|
||||
uint NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24;
|
||||
if (NewModulationColor != m_ModulationColor) {
|
||||
m_ModulationColor = NewModulationColor;
|
||||
ForceRefresh();
|
||||
@ -503,7 +503,7 @@ void Animation::SetAlpha(int Alpha) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Animation::SetModulationColor(unsigned int ModulationColor) {
|
||||
void Animation::SetModulationColor(uint ModulationColor) {
|
||||
AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
|
||||
BS_ASSERT(animationDescriptionPtr);
|
||||
if (!animationDescriptionPtr->IsColorModulationAllowed()) {
|
||||
@ -511,7 +511,7 @@ void Animation::SetModulationColor(unsigned int ModulationColor) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000);
|
||||
uint NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000);
|
||||
if (NewModulationColor != m_ModulationColor) {
|
||||
m_ModulationColor = NewModulationColor;
|
||||
ForceRefresh();
|
||||
@ -635,7 +635,7 @@ int Animation::ComputeYModifier() const {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Animation::RegisterActionCallback(ANIMATION_CALLBACK Callback, unsigned int Data) {
|
||||
void Animation::RegisterActionCallback(ANIMATION_CALLBACK Callback, uint Data) {
|
||||
ANIMATION_CALLBACK_DATA CD;
|
||||
CD.Callback = Callback;
|
||||
CD.Data = Data;
|
||||
@ -644,7 +644,7 @@ void Animation::RegisterActionCallback(ANIMATION_CALLBACK Callback, unsigned int
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Animation::RegisterLoopPointCallback(ANIMATION_CALLBACK Callback, unsigned int Data) {
|
||||
void Animation::RegisterLoopPointCallback(ANIMATION_CALLBACK Callback, uint Data) {
|
||||
ANIMATION_CALLBACK_DATA CD;
|
||||
CD.Callback = Callback;
|
||||
CD.Data = Data;
|
||||
@ -653,7 +653,7 @@ void Animation::RegisterLoopPointCallback(ANIMATION_CALLBACK Callback, unsigned
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Animation::RegisterDeleteCallback(ANIMATION_CALLBACK Callback, unsigned int Data) {
|
||||
void Animation::RegisterDeleteCallback(ANIMATION_CALLBACK Callback, uint Data) {
|
||||
ANIMATION_CALLBACK_DATA CD;
|
||||
CD.Callback = Callback;
|
||||
CD.Data = Data;
|
||||
@ -685,11 +685,11 @@ void Animation::UnpersistCallbackVector(InputPersistenceBlock &Reader, Common::A
|
||||
Vector.resize(0);
|
||||
|
||||
// Anzahl an Callbacks einlesen.
|
||||
unsigned int CallbackCount;
|
||||
uint CallbackCount;
|
||||
Reader.Read(CallbackCount);
|
||||
|
||||
// Alle Callbacks einzeln wieder herstellen.
|
||||
for (unsigned int i = 0; i < CallbackCount; ++i) {
|
||||
for (uint i = 0; i < CallbackCount; ++i) {
|
||||
ANIMATION_CALLBACK_DATA CallbackData;
|
||||
|
||||
Common::String CallbackFunctionName;
|
||||
@ -718,15 +718,15 @@ bool Animation::Persist(OutputPersistenceBlock &Writer) {
|
||||
Writer.Write(m_CurrentFrameTime);
|
||||
Writer.Write(m_Running);
|
||||
Writer.Write(m_Finished);
|
||||
Writer.Write(static_cast<unsigned int>(m_Direction));
|
||||
Writer.Write(static_cast<uint>(m_Direction));
|
||||
|
||||
// Je nach Animationstyp entweder das Template oder die Ressource speichern.
|
||||
if (m_AnimationResourcePtr) {
|
||||
unsigned int Marker = 0;
|
||||
uint Marker = 0;
|
||||
Writer.Write(Marker);
|
||||
Writer.Write(m_AnimationResourcePtr->GetFileName());
|
||||
} else if (m_AnimationTemplateHandle) {
|
||||
unsigned int Marker = 1;
|
||||
uint Marker = 1;
|
||||
Writer.Write(Marker);
|
||||
Writer.Write(m_AnimationTemplateHandle);
|
||||
} else {
|
||||
@ -761,12 +761,12 @@ bool Animation::Unpersist(InputPersistenceBlock &Reader) {
|
||||
Reader.Read(m_CurrentFrameTime);
|
||||
Reader.Read(m_Running);
|
||||
Reader.Read(m_Finished);
|
||||
unsigned int Direction;
|
||||
uint Direction;
|
||||
Reader.Read(Direction);
|
||||
m_Direction = static_cast<DIRECTION>(Direction);
|
||||
|
||||
// Animationstyp einlesen.
|
||||
unsigned int Marker;
|
||||
uint Marker;
|
||||
Reader.Read(Marker);
|
||||
if (Marker == 0) {
|
||||
Common::String ResourceFilename;
|
||||
|
@ -55,7 +55,7 @@ class Animation : public TimedRenderObject {
|
||||
private:
|
||||
Animation(RenderObjectPtr<RenderObject> ParentPtr, const Common::String &FileName);
|
||||
Animation(RenderObjectPtr<RenderObject> ParentPtr, const AnimationTemplate &Template);
|
||||
Animation(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle);
|
||||
Animation(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle);
|
||||
|
||||
public:
|
||||
enum ANIMATION_TYPES {
|
||||
@ -69,7 +69,7 @@ public:
|
||||
void Play();
|
||||
void Pause();
|
||||
void Stop();
|
||||
void SetFrame(unsigned int Nr);
|
||||
void SetFrame(uint Nr);
|
||||
|
||||
virtual void SetPos(int X, int Y);
|
||||
virtual void SetX(int X);
|
||||
@ -92,7 +92,7 @@ public:
|
||||
@param Color eine 24-Bit Farbe, die die Modulationsfarbe der Animation festlegt.
|
||||
@remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsColorModulationAllowed() true zurückgibt.
|
||||
*/
|
||||
void SetModulationColor(unsigned int ModulationColor);
|
||||
void SetModulationColor(uint ModulationColor);
|
||||
|
||||
/**
|
||||
@brief Setzt den Skalierungsfaktor der Animation.
|
||||
@ -142,7 +142,7 @@ public:
|
||||
bool IsScalingAllowed() const;
|
||||
bool IsAlphaAllowed() const;
|
||||
bool IsColorModulationAllowed() const;
|
||||
unsigned int GetCurrentFrame() const {
|
||||
uint GetCurrentFrame() const {
|
||||
return m_CurrentFrame;
|
||||
}
|
||||
const Common::String &GetCurrentAction() const ;
|
||||
@ -150,11 +150,11 @@ public:
|
||||
return m_Running;
|
||||
}
|
||||
|
||||
typedef bool (*ANIMATION_CALLBACK)(unsigned int);
|
||||
typedef bool (*ANIMATION_CALLBACK)(uint);
|
||||
|
||||
void RegisterLoopPointCallback(ANIMATION_CALLBACK Callback, unsigned int Data = 0);
|
||||
void RegisterActionCallback(ANIMATION_CALLBACK Callback, unsigned int Data = 0);
|
||||
void RegisterDeleteCallback(ANIMATION_CALLBACK Callback, unsigned int Data = 0);
|
||||
void RegisterLoopPointCallback(ANIMATION_CALLBACK Callback, uint Data = 0);
|
||||
void RegisterActionCallback(ANIMATION_CALLBACK Callback, uint Data = 0);
|
||||
void RegisterDeleteCallback(ANIMATION_CALLBACK Callback, uint Data = 0);
|
||||
|
||||
protected:
|
||||
virtual bool DoRender();
|
||||
@ -169,19 +169,19 @@ private:
|
||||
int m_RelY;
|
||||
float m_ScaleFactorX;
|
||||
float m_ScaleFactorY;
|
||||
unsigned int m_ModulationColor;
|
||||
unsigned int m_CurrentFrame;
|
||||
uint m_ModulationColor;
|
||||
uint m_CurrentFrame;
|
||||
int m_CurrentFrameTime;
|
||||
bool m_Running;
|
||||
bool m_Finished;
|
||||
DIRECTION m_Direction;
|
||||
AnimationResource *m_AnimationResourcePtr;
|
||||
unsigned int m_AnimationTemplateHandle;
|
||||
uint m_AnimationTemplateHandle;
|
||||
bool m_FramesLocked;
|
||||
|
||||
struct ANIMATION_CALLBACK_DATA {
|
||||
ANIMATION_CALLBACK Callback;
|
||||
unsigned int Data;
|
||||
uint Data;
|
||||
};
|
||||
Common::Array<ANIMATION_CALLBACK_DATA> m_LoopPointCallbacks;
|
||||
Common::Array<ANIMATION_CALLBACK_DATA> m_ActionCallbacks;
|
||||
|
@ -47,7 +47,7 @@ namespace Sword25 {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool AnimationDescription::Persist(OutputPersistenceBlock &Writer) {
|
||||
Writer.Write(static_cast<unsigned int>(m_AnimationType));
|
||||
Writer.Write(static_cast<uint>(m_AnimationType));
|
||||
Writer.Write(m_FPS);
|
||||
Writer.Write(m_MillisPerFrame);
|
||||
Writer.Write(m_ScalingAllowed);
|
||||
@ -60,7 +60,7 @@ bool AnimationDescription::Persist(OutputPersistenceBlock &Writer) {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool AnimationDescription::Unpersist(InputPersistenceBlock &Reader) {
|
||||
unsigned int AnimationType;
|
||||
uint AnimationType;
|
||||
Reader.Read(AnimationType);
|
||||
m_AnimationType = static_cast<Animation::ANIMATION_TYPES>(AnimationType);
|
||||
Reader.Read(m_FPS);
|
||||
|
@ -75,8 +75,8 @@ public:
|
||||
// Abstrakte Methoden
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
virtual const Frame &GetFrame(unsigned int Index) const = 0;
|
||||
virtual unsigned int GetFrameCount() const = 0;
|
||||
virtual const Frame &GetFrame(uint Index) const = 0;
|
||||
virtual uint GetFrameCount() const = 0;
|
||||
virtual void Unlock() = 0;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -80,7 +80,7 @@ AnimationResource::AnimationResource(const Common::String &filename) :
|
||||
}
|
||||
|
||||
// Load the contents of the file
|
||||
unsigned int fileSize;
|
||||
uint fileSize;
|
||||
char *xmlData = _pPackage->GetXmlFile(GetFileName(), &fileSize);
|
||||
if (!xmlData) {
|
||||
BS_LOG_ERRORLN("Could not read \"%s\".", GetFileName().c_str());
|
||||
|
@ -63,11 +63,11 @@ public:
|
||||
AnimationResource(const Common::String &filename);
|
||||
virtual ~AnimationResource();
|
||||
|
||||
virtual const Frame &GetFrame(unsigned int Index) const {
|
||||
virtual const Frame &GetFrame(uint Index) const {
|
||||
BS_ASSERT(Index < m_Frames.size());
|
||||
return m_Frames[Index];
|
||||
}
|
||||
virtual unsigned int GetFrameCount() const {
|
||||
virtual uint GetFrameCount() const {
|
||||
return m_Frames.size();
|
||||
}
|
||||
virtual void Unlock() {
|
||||
|
@ -53,7 +53,7 @@ namespace Sword25 {
|
||||
// Konstruktion / Destruktion
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int AnimationTemplate::Create(const Common::String &SourceAnimation) {
|
||||
uint AnimationTemplate::Create(const Common::String &SourceAnimation) {
|
||||
AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(SourceAnimation);
|
||||
|
||||
if (AnimationTemplatePtr->IsValid()) {
|
||||
@ -66,7 +66,7 @@ unsigned int AnimationTemplate::Create(const Common::String &SourceAnimation) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int AnimationTemplate::Create(const AnimationTemplate &Other) {
|
||||
uint AnimationTemplate::Create(const AnimationTemplate &Other) {
|
||||
AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(Other);
|
||||
|
||||
if (AnimationTemplatePtr->IsValid()) {
|
||||
@ -79,7 +79,7 @@ unsigned int AnimationTemplate::Create(const AnimationTemplate &Other) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int AnimationTemplate::Create(InputPersistenceBlock &Reader, unsigned int Handle) {
|
||||
uint AnimationTemplate::Create(InputPersistenceBlock &Reader, uint Handle) {
|
||||
AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(Reader, Handle);
|
||||
|
||||
if (AnimationTemplatePtr->IsValid()) {
|
||||
@ -133,7 +133,7 @@ AnimationTemplate::AnimationTemplate(const AnimationTemplate &Other) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
AnimationTemplate::AnimationTemplate(InputPersistenceBlock &Reader, unsigned int Handle) {
|
||||
AnimationTemplate::AnimationTemplate(InputPersistenceBlock &Reader, uint Handle) {
|
||||
// Objekt registrieren.
|
||||
AnimationTemplateRegistry::GetInstance().RegisterObject(this, Handle);
|
||||
|
||||
@ -183,7 +183,7 @@ void AnimationTemplate::SetFrame(int DestIndex, int SrcIndex) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool AnimationTemplate::ValidateSourceIndex(unsigned int Index) const {
|
||||
bool AnimationTemplate::ValidateSourceIndex(uint Index) const {
|
||||
if (Index > m_SourceAnimationPtr->GetFrameCount()) {
|
||||
BS_LOG_WARNINGLN("Tried to insert a frame (\"%d\") that does not exist in the source animation (\"%s\"). Ignoring call.",
|
||||
Index, m_SourceAnimationPtr->GetFileName().c_str());
|
||||
@ -194,7 +194,7 @@ bool AnimationTemplate::ValidateSourceIndex(unsigned int Index) const {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool AnimationTemplate::ValidateDestIndex(unsigned int Index) const {
|
||||
bool AnimationTemplate::ValidateDestIndex(uint Index) const {
|
||||
if (Index > m_Frames.size()) {
|
||||
BS_LOG_WARNINGLN("Tried to change a nonexistent frame (\"%d\") in a template animation. Ignoring call.",
|
||||
Index);
|
||||
@ -249,11 +249,11 @@ bool AnimationTemplate::Unpersist(InputPersistenceBlock &Reader) {
|
||||
Result &= AnimationDescription::Unpersist(Reader);
|
||||
|
||||
// Frameanzahl lesen.
|
||||
unsigned int FrameCount;
|
||||
uint FrameCount;
|
||||
Reader.Read(FrameCount);
|
||||
|
||||
// Frames einzeln wieder herstellen.
|
||||
for (unsigned int i = 0; i < FrameCount; ++i) {
|
||||
for (uint i = 0; i < FrameCount; ++i) {
|
||||
Frame frame;
|
||||
Reader.Read(frame.HotspotX);
|
||||
Reader.Read(frame.HotspotY);
|
||||
|
@ -57,24 +57,24 @@ class AnimationResource;
|
||||
|
||||
class AnimationTemplate : public AnimationDescription {
|
||||
public:
|
||||
static unsigned int Create(const Common::String &SourceAnimation);
|
||||
static unsigned int Create(const AnimationTemplate &Other);
|
||||
static unsigned int Create(InputPersistenceBlock &Reader, unsigned int Handle);
|
||||
AnimationTemplate *ResolveHandle(unsigned int Handle) const;
|
||||
static uint Create(const Common::String &SourceAnimation);
|
||||
static uint Create(const AnimationTemplate &Other);
|
||||
static uint Create(InputPersistenceBlock &Reader, uint Handle);
|
||||
AnimationTemplate *ResolveHandle(uint Handle) const;
|
||||
|
||||
private:
|
||||
AnimationTemplate(const Common::String &SourceAnimation);
|
||||
AnimationTemplate(const AnimationTemplate &Other);
|
||||
AnimationTemplate(InputPersistenceBlock &Reader, unsigned int Handle);
|
||||
AnimationTemplate(InputPersistenceBlock &Reader, uint Handle);
|
||||
|
||||
public:
|
||||
~AnimationTemplate();
|
||||
|
||||
virtual const Frame &GetFrame(unsigned int Index) const {
|
||||
virtual const Frame &GetFrame(uint Index) const {
|
||||
BS_ASSERT(Index < m_Frames.size());
|
||||
return m_Frames[Index];
|
||||
}
|
||||
virtual unsigned int GetFrameCount() const {
|
||||
virtual uint GetFrameCount() const {
|
||||
return m_Frames.size();
|
||||
}
|
||||
virtual void Unlock() {
|
||||
@ -124,8 +124,8 @@ private:
|
||||
bool m_Valid;
|
||||
|
||||
AnimationResource *RequestSourceAnimation(const Common::String &SourceAnimation) const;
|
||||
bool ValidateSourceIndex(unsigned int Index) const;
|
||||
bool ValidateDestIndex(unsigned int Index) const;
|
||||
bool ValidateSourceIndex(uint Index) const;
|
||||
bool ValidateDestIndex(uint Index) const;
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -100,13 +100,13 @@ bool AnimationTemplateRegistry::Unpersist(InputPersistenceBlock &Reader) {
|
||||
delete m_Handle2PtrMap.begin()->_value;
|
||||
|
||||
// Anzahl an BS_AnimationTemplates einlesen.
|
||||
unsigned int AnimationTemplateCount;
|
||||
uint AnimationTemplateCount;
|
||||
Reader.Read(AnimationTemplateCount);
|
||||
|
||||
// Alle gespeicherten BS_AnimationTemplates wieder herstellen.
|
||||
for (unsigned int i = 0; i < AnimationTemplateCount; ++i) {
|
||||
for (uint i = 0; i < AnimationTemplateCount; ++i) {
|
||||
// Handle lesen.
|
||||
unsigned int Handle;
|
||||
uint Handle;
|
||||
Reader.Read(Handle);
|
||||
|
||||
// BS_AnimationTemplate wieder herstellen.
|
||||
|
@ -52,7 +52,7 @@ namespace Sword25 {
|
||||
// Konstruktion / Destruktion
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Bitmap::Bitmap(RenderObjectPtr<RenderObject> ParentPtr, TYPES Type, unsigned int Handle) :
|
||||
Bitmap::Bitmap(RenderObjectPtr<RenderObject> ParentPtr, TYPES Type, uint Handle) :
|
||||
RenderObject(ParentPtr, Type, Handle),
|
||||
m_ModulationColor(0xffffffff),
|
||||
m_ScaleFactorX(1.0f),
|
||||
@ -85,7 +85,7 @@ void Bitmap::SetAlpha(int Alpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24;
|
||||
uint NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24;
|
||||
if (NewModulationColor != m_ModulationColor) {
|
||||
m_ModulationColor = NewModulationColor;
|
||||
ForceRefresh();
|
||||
@ -94,13 +94,13 @@ void Bitmap::SetAlpha(int Alpha) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Bitmap::SetModulationColor(unsigned int ModulationColor) {
|
||||
void Bitmap::SetModulationColor(uint ModulationColor) {
|
||||
if (!IsColorModulationAllowed()) {
|
||||
BS_LOG_WARNINGLN("Tried to set modulation color of a bitmap that does not support color modulation. Call was ignored.");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000);
|
||||
uint NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000);
|
||||
if (NewModulationColor != m_ModulationColor) {
|
||||
m_ModulationColor = NewModulationColor;
|
||||
ForceRefresh();
|
||||
|
@ -50,7 +50,7 @@ namespace Sword25 {
|
||||
|
||||
class Bitmap : public RenderObject {
|
||||
protected:
|
||||
Bitmap(RenderObjectPtr<RenderObject> ParentPtr, TYPES Type, unsigned int Handle = 0);
|
||||
Bitmap(RenderObjectPtr<RenderObject> ParentPtr, TYPES Type, uint Handle = 0);
|
||||
|
||||
public:
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
@param Color eine 24-Bit Farbe, die die Modulationsfarbe des Bitmaps festlegt.
|
||||
@remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsColorModulationAllowed() true zurückgibt.
|
||||
*/
|
||||
void SetModulationColor(unsigned int ModulationColor);
|
||||
void SetModulationColor(uint ModulationColor);
|
||||
|
||||
/**
|
||||
@brief Setzt den Skalierungsfaktor des Bitmaps.
|
||||
@ -159,7 +159,7 @@ public:
|
||||
@remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist
|
||||
eher dafür gedacht einzelne Pixel des Bildes auszulesen.
|
||||
*/
|
||||
virtual unsigned int GetPixel(int X, int Y) const = 0;
|
||||
virtual uint GetPixel(int X, int Y) const = 0;
|
||||
|
||||
/**
|
||||
@brief Füllt den Inhalt des Bildes mit Pixeldaten.
|
||||
@ -172,7 +172,7 @@ public:
|
||||
@return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
|
||||
@remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
|
||||
*/
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset = 0, unsigned int Stride = 0) = 0;
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset = 0, uint Stride = 0) = 0;
|
||||
|
||||
virtual bool IsScalingAllowed() const = 0;
|
||||
virtual bool IsAlphaAllowed() const = 0;
|
||||
@ -187,7 +187,7 @@ protected:
|
||||
bool m_FlipV;
|
||||
float m_ScaleFactorX;
|
||||
float m_ScaleFactorY;
|
||||
unsigned int m_ModulationColor;
|
||||
uint m_ModulationColor;
|
||||
int m_OriginalWidth;
|
||||
int m_OriginalHeight;
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ BitmapResource::~BitmapResource() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int BitmapResource::GetPixel(int X, int Y) const {
|
||||
uint BitmapResource::GetPixel(int X, int Y) const {
|
||||
BS_ASSERT(X >= 0 && X < m_pImage->GetWidth());
|
||||
BS_ASSERT(Y >= 0 && Y < m_pImage->GetHeight());
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
bool Blit(int PosX = 0, int PosY = 0,
|
||||
int Flipping = FLIP_NONE,
|
||||
Common::Rect *pSrcPartRect = NULL,
|
||||
unsigned int Color = BS_ARGB(255, 255, 255, 255),
|
||||
uint Color = BS_ARGB(255, 255, 255, 255),
|
||||
int Width = -1, int Height = -1) {
|
||||
BS_ASSERT(m_pImage);
|
||||
return m_pImage->Blit(PosX, PosY, Flipping, pSrcPartRect, Color, Width, Height);
|
||||
@ -144,7 +144,7 @@ public:
|
||||
BS_RGB und BS_ARGB benutzt werden.
|
||||
@remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
|
||||
*/
|
||||
bool Fill(const Common::Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0)) {
|
||||
bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0)) {
|
||||
BS_ASSERT(m_pImage);
|
||||
return m_pImage->Fill(pFillRect, Color);
|
||||
}
|
||||
@ -157,7 +157,7 @@ public:
|
||||
@remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist
|
||||
eher dafür gedacht einzelne Pixel des Bildes auszulesen.
|
||||
*/
|
||||
unsigned int GetPixel(int X, int Y) const;
|
||||
uint GetPixel(int X, int Y) const;
|
||||
|
||||
//@{
|
||||
/** @name Auskunfts-Methoden */
|
||||
|
@ -53,7 +53,7 @@ namespace Sword25 {
|
||||
// Konstruktion / Destruktion
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
DynamicBitmap::DynamicBitmap(RenderObjectPtr<RenderObject> ParentPtr, unsigned int Width, unsigned int Height) :
|
||||
DynamicBitmap::DynamicBitmap(RenderObjectPtr<RenderObject> ParentPtr, uint Width, uint Height) :
|
||||
Bitmap(ParentPtr, TYPE_DYNAMICBITMAP) {
|
||||
// Das BS_Bitmap konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden.
|
||||
if (!m_InitSuccess) return;
|
||||
@ -63,14 +63,14 @@ DynamicBitmap::DynamicBitmap(RenderObjectPtr<RenderObject> ParentPtr, unsigned i
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
DynamicBitmap::DynamicBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle) :
|
||||
DynamicBitmap::DynamicBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle) :
|
||||
Bitmap(ParentPtr, TYPE_DYNAMICBITMAP, Handle) {
|
||||
m_InitSuccess = Unpersist(Reader);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool DynamicBitmap::CreateGLImage(unsigned int Width, unsigned int Height) {
|
||||
bool DynamicBitmap::CreateGLImage(uint Width, uint Height) {
|
||||
// GLImage mit den gewünschten Maßen erstellen
|
||||
bool Result = false;
|
||||
m_Image.reset(new GLImage(Width, Height, Result));
|
||||
@ -88,7 +88,7 @@ DynamicBitmap::~DynamicBitmap() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int DynamicBitmap::GetPixel(int X, int Y) const {
|
||||
uint DynamicBitmap::GetPixel(int X, int Y) const {
|
||||
BS_ASSERT(X >= 0 && X < m_Width);
|
||||
BS_ASSERT(Y >= 0 && Y < m_Height);
|
||||
|
||||
@ -121,7 +121,7 @@ bool DynamicBitmap::DoRender() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool DynamicBitmap::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
bool DynamicBitmap::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) {
|
||||
return m_Image->SetContent(Pixeldata, size, Offset, Stride);
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,9 @@ class DynamicBitmap : public Bitmap {
|
||||
public:
|
||||
virtual ~DynamicBitmap();
|
||||
|
||||
virtual unsigned int GetPixel(int X, int Y) const;
|
||||
virtual uint GetPixel(int X, int Y) const;
|
||||
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride);
|
||||
|
||||
virtual bool IsScalingAllowed() const;
|
||||
virtual bool IsAlphaAllowed() const;
|
||||
@ -74,10 +74,10 @@ protected:
|
||||
virtual bool DoRender();
|
||||
|
||||
private:
|
||||
DynamicBitmap(RenderObjectPtr<RenderObject> ParentPtr, unsigned int Width, unsigned int Height);
|
||||
DynamicBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle);
|
||||
DynamicBitmap(RenderObjectPtr<RenderObject> ParentPtr, uint Width, uint Height);
|
||||
DynamicBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle);
|
||||
|
||||
bool CreateGLImage(unsigned int Width, unsigned int Height);
|
||||
bool CreateGLImage(uint Width, uint Height);
|
||||
|
||||
Common::ScopedPtr<GLImage> m_Image;
|
||||
};
|
||||
|
@ -50,8 +50,8 @@ namespace Sword25 {
|
||||
// Konstanten
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static const unsigned int DEFAULT_LINEHEIGHT = 20;
|
||||
static const unsigned int DEFAULT_GAPWIDTH = 1;
|
||||
static const uint DEFAULT_LINEHEIGHT = 20;
|
||||
static const uint DEFAULT_GAPWIDTH = 1;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Konstruktion / Destruktion
|
||||
@ -69,7 +69,7 @@ FontResource::FontResource(Kernel *pKernel, const Common::String &FileName) :
|
||||
BS_ASSERT(pPackage);
|
||||
|
||||
// Load the contents of the file
|
||||
unsigned int fileSize;
|
||||
uint fileSize;
|
||||
char *xmlData = pPackage->GetXmlFile(GetFileName(), &fileSize);
|
||||
if (!xmlData) {
|
||||
BS_LOG_ERRORLN("Could not read \"%s\".", GetFileName().c_str());
|
||||
|
@ -53,7 +53,7 @@ namespace Sword25 {
|
||||
|
||||
using namespace Lua;
|
||||
|
||||
static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird
|
||||
static const uint FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird
|
||||
|
||||
GraphicEngine::GraphicEngine(Kernel *pKernel) :
|
||||
m_Width(0),
|
||||
@ -82,13 +82,13 @@ void GraphicEngine::UpdateLastFrameDuration() {
|
||||
|
||||
// Verstrichene Zeit seit letztem Frame berechnen und zu große Zeitsprünge ( > 250 msek.) unterbinden
|
||||
// (kann vorkommen bei geladenen Spielständen, während des Debuggings oder Hardwareungenauigkeiten)
|
||||
m_FrameTimeSamples[m_FrameTimeSampleSlot] = static_cast<unsigned int>(CurrentTime - m_LastTimeStamp);
|
||||
m_FrameTimeSamples[m_FrameTimeSampleSlot] = static_cast<uint>(CurrentTime - m_LastTimeStamp);
|
||||
if (m_FrameTimeSamples[m_FrameTimeSampleSlot] > 250000) m_FrameTimeSamples[m_FrameTimeSampleSlot] = 250000;
|
||||
m_FrameTimeSampleSlot = (m_FrameTimeSampleSlot + 1) % FRAMETIME_SAMPLE_COUNT;
|
||||
|
||||
// Die Framezeit wird über mehrere Frames gemittelt um Ausreisser zu eliminieren
|
||||
Common::Array<unsigned int>::const_iterator it = m_FrameTimeSamples.begin();
|
||||
unsigned int Sum = *it;
|
||||
Common::Array<uint>::const_iterator it = m_FrameTimeSamples.begin();
|
||||
uint Sum = *it;
|
||||
for (it++; it != m_FrameTimeSamples.end(); it++) Sum += *it;
|
||||
m_LastFrameDuration = Sum / FRAMETIME_SAMPLE_COUNT;
|
||||
|
||||
@ -100,8 +100,8 @@ void GraphicEngine::UpdateLastFrameDuration() {
|
||||
|
||||
namespace {
|
||||
bool DoSaveScreenshot(GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) {
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
uint Width;
|
||||
uint Height;
|
||||
byte *Data;
|
||||
if (!GraphicEngine.GetScreenshot(Width, Height, &Data)) {
|
||||
BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot.");
|
||||
@ -129,7 +129,7 @@ bool GraphicEngine::SaveThumbnailScreenshot(const Common::String &Filename) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) {
|
||||
void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint Color) {
|
||||
lua_Number Components[4] = {
|
||||
(Color >> 16) & 0xff, // Rot
|
||||
(Color >> 8) & 0xff, // Grün
|
||||
@ -139,7 +139,7 @@ void GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) {
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
for (unsigned int i = 1; i <= 4; i++) {
|
||||
for (uint i = 1; i <= 4; i++) {
|
||||
lua_pushnumber(L, i);
|
||||
lua_pushnumber(L, Components[i - 1]);
|
||||
lua_settable(L, -3);
|
||||
@ -148,7 +148,7 @@ void GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) {
|
||||
uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) {
|
||||
#ifdef DEBUG
|
||||
int __startStackDepth = lua_gettop(L);
|
||||
#endif
|
||||
@ -156,33 +156,33 @@ unsigned int GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) {
|
||||
// Sicherstellen, dass wir wirklich eine Tabelle betrachten
|
||||
luaL_checktype(L, StackIndex, LUA_TTABLE);
|
||||
// Größe der Tabelle auslesen
|
||||
unsigned int n = luaL_getn(L, StackIndex);
|
||||
uint n = luaL_getn(L, StackIndex);
|
||||
// RGB oder RGBA Farben werden unterstützt und sonst keine
|
||||
if (n != 3 && n != 4) luaL_argcheck(L, 0, StackIndex, "at least 3 of the 4 color components have to be specified");
|
||||
|
||||
// Rote Farbkomponente auslesen
|
||||
lua_rawgeti(L, StackIndex, 1);
|
||||
unsigned int Red = static_cast<unsigned int>(lua_tonumber(L, -1));
|
||||
uint Red = static_cast<uint>(lua_tonumber(L, -1));
|
||||
if (!lua_isnumber(L, -1) || Red >= 256) luaL_argcheck(L, 0, StackIndex, "red color component must be an integer between 0 and 255");
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Grüne Farbkomponente auslesen
|
||||
lua_rawgeti(L, StackIndex, 2);
|
||||
unsigned int Green = static_cast<unsigned int>(lua_tonumber(L, -1));
|
||||
uint Green = static_cast<uint>(lua_tonumber(L, -1));
|
||||
if (!lua_isnumber(L, -1) || Green >= 256) luaL_argcheck(L, 0, StackIndex, "green color component must be an integer between 0 and 255");
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Blaue Farbkomponente auslesen
|
||||
lua_rawgeti(L, StackIndex, 3);
|
||||
unsigned int Blue = static_cast<unsigned int>(lua_tonumber(L, -1));
|
||||
uint Blue = static_cast<uint>(lua_tonumber(L, -1));
|
||||
if (!lua_isnumber(L, -1) || Blue >= 256) luaL_argcheck(L, 0, StackIndex, "blue color component must be an integer between 0 and 255");
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Alpha Farbkomponente auslesen
|
||||
unsigned int Alpha = 0xff;
|
||||
uint Alpha = 0xff;
|
||||
if (n == 4) {
|
||||
lua_rawgeti(L, StackIndex, 4);
|
||||
Alpha = static_cast<unsigned int>(lua_tonumber(L, -1));
|
||||
Alpha = static_cast<uint>(lua_tonumber(L, -1));
|
||||
if (!lua_isnumber(L, -1) || Alpha >= 256) luaL_argcheck(L, 0, StackIndex, "alpha color component must be an integer between 0 and 255");
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class Panel;
|
||||
class Screenshot;
|
||||
|
||||
// Typen
|
||||
typedef unsigned int BS_COLOR;
|
||||
typedef uint BS_COLOR;
|
||||
|
||||
// Makros
|
||||
#define BS_RGB(R,G,B) (0xFF000000 | ((R) << 16) | ((G) << 8) | (B))
|
||||
@ -174,7 +174,7 @@ public:
|
||||
* @param End The ending point of the line
|
||||
* @param Color The colour of the line. The default is BS_RGB (255,255,255) (White)
|
||||
*/
|
||||
virtual void DrawDebugLine(const Vertex &Start, const Vertex &End, unsigned int Color = BS_RGB(255, 255, 255)) = 0;
|
||||
virtual void DrawDebugLine(const Vertex &Start, const Vertex &End, uint Color = BS_RGB(255, 255, 255)) = 0;
|
||||
|
||||
/**
|
||||
* Creates a screenshot of the current frame buffer and writes it to a graphic file in PNG format.
|
||||
@ -201,7 +201,7 @@ public:
|
||||
* @param Height Returns the height of the frame buffer
|
||||
* @param Data Returns the raw data of the frame buffer as an array of 32-bit colour values.
|
||||
*/
|
||||
virtual bool GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data) = 0;
|
||||
virtual bool GetScreenshot(uint &Width, uint &Height, byte **Data) = 0;
|
||||
|
||||
|
||||
virtual RenderObjectPtr<Panel> GetMainPanel() = 0;
|
||||
@ -291,7 +291,7 @@ public:
|
||||
* @param Color The 32-bit colour with which the area is to be filled. The default is BS_RGB(0, 0, 0) (black)
|
||||
@remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
|
||||
*/
|
||||
virtual bool Fill(const Common::Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0)) = 0;
|
||||
virtual bool Fill(const Common::Rect *FillRectPtr = 0, uint Color = BS_RGB(0, 0, 0)) = 0;
|
||||
|
||||
// Debugging Methods
|
||||
|
||||
@ -362,8 +362,8 @@ public:
|
||||
virtual bool Persist(OutputPersistenceBlock &Writer);
|
||||
virtual bool Unpersist(InputPersistenceBlock &Reader);
|
||||
|
||||
static void ARGBColorToLuaColor(lua_State *L, unsigned int Color);
|
||||
static unsigned int LuaColorToARGBColor(lua_State *L, int StackIndex);
|
||||
static void ARGBColorToLuaColor(lua_State *L, uint Color);
|
||||
static uint LuaColorToARGBColor(lua_State *L, int StackIndex);
|
||||
|
||||
protected:
|
||||
// Constructor
|
||||
@ -382,7 +382,7 @@ protected:
|
||||
// -------------------
|
||||
Framecounter m_FPSCounter;
|
||||
|
||||
unsigned int m_RepaintedPixels;
|
||||
uint m_RepaintedPixels;
|
||||
|
||||
/**
|
||||
* Calculates the time since the last frame beginning has passed.
|
||||
@ -395,10 +395,10 @@ private:
|
||||
// LastFrameDuration Variables
|
||||
// ---------------------------
|
||||
uint64 m_LastTimeStamp;
|
||||
unsigned int m_LastFrameDuration;
|
||||
uint m_LastFrameDuration;
|
||||
bool m_TimerActive;
|
||||
Common::Array<unsigned int> m_FrameTimeSamples;
|
||||
unsigned int m_FrameTimeSampleSlot;
|
||||
Common::Array<uint> m_FrameTimeSamples;
|
||||
uint m_FrameTimeSampleSlot;
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -61,9 +61,9 @@ namespace Sword25 {
|
||||
// Callback-Objekte
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static bool AnimationDeleteCallback(unsigned int Data);
|
||||
static bool AnimationActionCallback(unsigned int Data);
|
||||
static bool AnimationLoopPointCallback(unsigned int Data);
|
||||
static bool AnimationDeleteCallback(uint Data);
|
||||
static bool AnimationActionCallback(uint Data);
|
||||
static bool AnimationLoopPointCallback(uint Data);
|
||||
|
||||
namespace {
|
||||
// -------------------------------------------------------------------------
|
||||
@ -133,7 +133,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void NewUintUserData(lua_State *L, unsigned int Value) {
|
||||
static void NewUintUserData(lua_State *L, uint Value) {
|
||||
void *UserData = lua_newuserdata(L, sizeof(Value));
|
||||
memcpy(UserData, &Value, sizeof(Value));
|
||||
}
|
||||
@ -142,8 +142,8 @@ static void NewUintUserData(lua_State *L, unsigned int Value) {
|
||||
|
||||
static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) {
|
||||
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate
|
||||
unsigned int AnimationTemplateHandle;
|
||||
if ((AnimationTemplateHandle = *reinterpret_cast<unsigned int *>(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) {
|
||||
uint AnimationTemplateHandle;
|
||||
if ((AnimationTemplateHandle = *reinterpret_cast<uint *>(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) {
|
||||
AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle);
|
||||
if (!AnimationTemplatePtr)
|
||||
luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle);
|
||||
@ -158,7 +158,7 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int NewAnimationTemplate(lua_State *L) {
|
||||
unsigned int AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1));
|
||||
uint AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1));
|
||||
AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle);
|
||||
if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) {
|
||||
NewUintUserData(L, AnimationTemplateHandle);
|
||||
@ -514,11 +514,11 @@ static const luaL_reg GFX_FUNCTIONS[] = {
|
||||
|
||||
static RenderObjectPtr<RenderObject> CheckRenderObject(lua_State *L, bool ErrorIfRemoved = true) {
|
||||
// Der erste Parameter muss vom Typ userdata sein und die Metatable einer Klasse haben, die von Gfx.RenderObject "erbt".
|
||||
unsigned int *UserDataPtr;
|
||||
if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
|
||||
(UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
|
||||
(UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
|
||||
(UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
|
||||
uint *UserDataPtr;
|
||||
if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0 ||
|
||||
(UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0 ||
|
||||
(UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 ||
|
||||
(UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
|
||||
RenderObjectPtr<RenderObject> ROPtr(* UserDataPtr);
|
||||
if (ROPtr.IsValid())
|
||||
return ROPtr;
|
||||
@ -776,8 +776,8 @@ static const luaL_reg RENDEROBJECT_METHODS[] = {
|
||||
|
||||
static RenderObjectPtr<Panel> CheckPanel(lua_State *L) {
|
||||
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Panel
|
||||
unsigned int *UserDataPtr;
|
||||
if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
|
||||
uint *UserDataPtr;
|
||||
if ((UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) {
|
||||
RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
|
||||
if (ROPtr.IsValid()) {
|
||||
return ROPtr->ToPanel();
|
||||
@ -831,8 +831,8 @@ static const luaL_reg PANEL_METHODS[] = {
|
||||
|
||||
static RenderObjectPtr<Bitmap> CheckBitmap(lua_State *L) {
|
||||
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Bitmap
|
||||
unsigned int *UserDataPtr;
|
||||
if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
|
||||
uint *UserDataPtr;
|
||||
if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) {
|
||||
RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
|
||||
if (ROPtr.IsValid()) {
|
||||
return ROPtr->ToBitmap();
|
||||
@ -850,7 +850,7 @@ static RenderObjectPtr<Bitmap> CheckBitmap(lua_State *L) {
|
||||
static int B_SetAlpha(lua_State *L) {
|
||||
RenderObjectPtr<Bitmap> BitmapPtr = CheckBitmap(L);
|
||||
BS_ASSERT(BitmapPtr.IsValid());
|
||||
BitmapPtr->SetAlpha(static_cast<unsigned int>(luaL_checknumber(L, 2)));
|
||||
BitmapPtr->SetAlpha(static_cast<uint>(luaL_checknumber(L, 2)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1036,8 +1036,8 @@ static const luaL_reg BITMAP_METHODS[] = {
|
||||
|
||||
static RenderObjectPtr<Animation> CheckAnimation(lua_State *L) {
|
||||
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Animation
|
||||
unsigned int *UserDataPtr;
|
||||
if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
|
||||
uint *UserDataPtr;
|
||||
if ((UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) {
|
||||
RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
|
||||
if (ROPtr.IsValid())
|
||||
return ROPtr->ToAnimation();
|
||||
@ -1083,7 +1083,7 @@ static int A_Stop(lua_State *L) {
|
||||
static int A_SetFrame(lua_State *L) {
|
||||
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
|
||||
BS_ASSERT(AnimationPtr.IsValid());
|
||||
AnimationPtr->SetFrame(static_cast<unsigned int>(luaL_checknumber(L, 2)));
|
||||
AnimationPtr->SetFrame(static_cast<uint>(luaL_checknumber(L, 2)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1245,7 +1245,7 @@ static int A_IsPlaying(lua_State *L) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static bool AnimationLoopPointCallback(unsigned int Handle) {
|
||||
static bool AnimationLoopPointCallback(uint Handle) {
|
||||
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->GetScriptObject());
|
||||
LoopPointCallbackPtr->InvokeCallbackFunctions(L, Handle);
|
||||
|
||||
@ -1280,7 +1280,7 @@ static int A_UnregisterLoopPointCallback(lua_State *L) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static bool AnimationActionCallback(unsigned int Handle) {
|
||||
static bool AnimationActionCallback(uint Handle) {
|
||||
RenderObjectPtr<Animation> AnimationPtr(Handle);
|
||||
if (AnimationPtr.IsValid()) {
|
||||
ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction();
|
||||
@ -1319,7 +1319,7 @@ static int A_UnregisterActionCallback(lua_State *L) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static bool AnimationDeleteCallback(unsigned int Handle) {
|
||||
static bool AnimationDeleteCallback(uint Handle) {
|
||||
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->GetScriptObject());
|
||||
LoopPointCallbackPtr->RemoveAllObjectCallbacks(L, Handle);
|
||||
|
||||
@ -1370,8 +1370,8 @@ static const luaL_reg ANIMATION_METHODS[] = {
|
||||
|
||||
static RenderObjectPtr<Text> CheckText(lua_State *L) {
|
||||
// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.Text
|
||||
unsigned int *UserDataPtr;
|
||||
if ((UserDataPtr = (unsigned int *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
|
||||
uint *UserDataPtr;
|
||||
if ((UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) {
|
||||
RenderObjectPtr<RenderObject> ROPtr(*UserDataPtr);
|
||||
if (ROPtr.IsValid())
|
||||
return ROPtr->ToText();
|
||||
@ -1434,7 +1434,7 @@ static int T_SetAutoWrap(lua_State *L) {
|
||||
static int T_SetAutoWrapThreshold(lua_State *L) {
|
||||
RenderObjectPtr<Text> TextPtr = CheckText(L);
|
||||
BS_ASSERT(TextPtr.IsValid());
|
||||
TextPtr->SetAutoWrapThreshold(static_cast<unsigned int>(luaL_checknumber(L, 2)));
|
||||
TextPtr->SetAutoWrapThreshold(static_cast<uint>(luaL_checknumber(L, 2)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -46,24 +46,24 @@ namespace Sword25 {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
unsigned int FindEmbeddedPNG(const byte *FileDataPtr, unsigned int FileSize) {
|
||||
uint FindEmbeddedPNG(const byte *FileDataPtr, uint FileSize) {
|
||||
if (memcmp(FileDataPtr, "BS25SAVEGAME", 12))
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
// Einen Stringstream mit dem Anfang der Datei intialisieren. 512 Byte sollten hierfür genügen.
|
||||
istringstream StringStream(string(FileDataPtr, FileDataPtr + min(static_cast<unsigned int>(512), FileSize)));
|
||||
istringstream StringStream(string(FileDataPtr, FileDataPtr + min(static_cast<uint>(512), FileSize)));
|
||||
|
||||
// Headerinformationen der Spielstandes einlesen.
|
||||
string Marker, VersionID;
|
||||
unsigned int CompressedGamedataSize, UncompressedGamedataSize;
|
||||
uint CompressedGamedataSize, UncompressedGamedataSize;
|
||||
StringStream >> Marker >> VersionID >> CompressedGamedataSize >> UncompressedGamedataSize;
|
||||
if (!StringStream.good()) return 0;
|
||||
|
||||
// Testen, ob wir tatsächlich einen Spielstand haben.
|
||||
if (Marker == "BS25SAVEGAME") {
|
||||
// Offset zum PNG innerhalb des Spielstandes berechnen und zurückgeben.
|
||||
return static_cast<unsigned int>(StringStream.tellg()) + CompressedGamedataSize + 1;
|
||||
return static_cast<uint>(StringStream.tellg()) + CompressedGamedataSize + 1;
|
||||
}
|
||||
#else
|
||||
warning("STUB:FindEmbeddedPNG()");
|
||||
@ -75,9 +75,9 @@ unsigned int FindEmbeddedPNG(const byte *FileDataPtr, unsigned int FileSize) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool B25SLoader::IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize) {
|
||||
bool B25SLoader::IsCorrectImageFormat(const byte *FileDataPtr, uint FileSize) {
|
||||
// PNG innerhalb des Spielstandes finden und den Methodenaufruf zu BS_PNGLoader weiterreichen.
|
||||
unsigned int PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize);
|
||||
uint PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize);
|
||||
if (PNGOffset > 0) {
|
||||
return PNGLoader::DoIsCorrectImageFormat(FileDataPtr + PNGOffset, FileSize - PNGOffset);
|
||||
}
|
||||
@ -87,10 +87,10 @@ bool B25SLoader::IsCorrectImageFormat(const byte *FileDataPtr, unsigned int File
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool B25SLoader::DecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
bool B25SLoader::DecodeImage(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
int &Width, int &Height, int &Pitch) {
|
||||
// PNG innerhalb des Spielstandes finden und den Methodenaufruf zu BS_PNGLoader weiterreichen.
|
||||
unsigned int PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize);
|
||||
uint PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize);
|
||||
if (PNGOffset > 0) {
|
||||
return PNGLoader::DoDecodeImage(FileDataPtr + PNGOffset, FileSize - PNGOffset, ColorFormat, UncompressedDataPtr, Width, Height, Pitch);
|
||||
}
|
||||
@ -100,9 +100,9 @@ bool B25SLoader::DecodeImage(const byte *FileDataPtr, unsigned int FileSize, Gra
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool B25SLoader::ImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) {
|
||||
bool B25SLoader::ImageProperties(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) {
|
||||
// PNG innerhalb des Spielstandes finden und den Methodenaufruf zu BS_PNGLoader weiterreichen.
|
||||
unsigned int PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize);
|
||||
uint PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize);
|
||||
if (PNGOffset > 0) {
|
||||
return PNGLoader::DoImageProperties(FileDataPtr + PNGOffset, FileSize - PNGOffset, ColorFormat, Width, Height);
|
||||
}
|
||||
|
@ -57,10 +57,10 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize);
|
||||
virtual bool DecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
virtual bool IsCorrectImageFormat(const byte *FileDataPtr, uint FileSize);
|
||||
virtual bool DecodeImage(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
int &Width, int &Height, int &Pitch);
|
||||
virtual bool ImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
|
||||
virtual bool ImageProperties(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
|
||||
|
||||
};
|
||||
|
||||
|
@ -134,7 +134,7 @@ public:
|
||||
virtual bool Blit(int PosX = 0, int PosY = 0,
|
||||
int Flipping = FLIP_NONE,
|
||||
Common::Rect *pPartRect = NULL,
|
||||
unsigned int Color = BS_ARGB(255, 255, 255, 255),
|
||||
uint Color = BS_ARGB(255, 255, 255, 255),
|
||||
int Width = -1, int Height = -1) = 0;
|
||||
|
||||
/**
|
||||
@ -149,7 +149,7 @@ public:
|
||||
BS_RGB und BS_ARGB benutzt werden.
|
||||
@remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
|
||||
*/
|
||||
virtual bool Fill(const Common::Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0)) = 0;
|
||||
virtual bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0)) = 0;
|
||||
|
||||
/**
|
||||
@brief Füllt den Inhalt des Bildes mit Pixeldaten.
|
||||
@ -162,7 +162,7 @@ public:
|
||||
@return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
|
||||
@remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
|
||||
*/
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) = 0;
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) = 0;
|
||||
|
||||
/**
|
||||
@brief Liest einen Pixel des Bildes.
|
||||
@ -172,7 +172,7 @@ public:
|
||||
@remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist
|
||||
eher dafür gedacht einzelne Pixel des Bildes auszulesen.
|
||||
*/
|
||||
virtual unsigned int GetPixel(int X, int Y) = 0;
|
||||
virtual uint GetPixel(int X, int Y) = 0;
|
||||
|
||||
//@{
|
||||
/** @name Auskunfts-Methoden */
|
||||
|
@ -46,7 +46,7 @@ bool ImageLoader::_ImageLoaderListInitialized = false;
|
||||
// Lade Methode
|
||||
// ------------
|
||||
|
||||
bool ImageLoader::LoadImage(const byte *pFileData, unsigned int FileSize,
|
||||
bool ImageLoader::LoadImage(const byte *pFileData, uint FileSize,
|
||||
GraphicEngine::COLOR_FORMATS ColorFormat,
|
||||
byte *&pUncompressedData,
|
||||
int &Width, int &Height,
|
||||
@ -71,7 +71,7 @@ bool ImageLoader::LoadImage(const byte *pFileData, unsigned int FileSize,
|
||||
// Info Methode
|
||||
// ------------
|
||||
|
||||
bool ImageLoader::ExtractImageProperties(const byte *pFileData, unsigned int FileSize,
|
||||
bool ImageLoader::ExtractImageProperties(const byte *pFileData, uint FileSize,
|
||||
GraphicEngine::COLOR_FORMATS &ColorFormat,
|
||||
int &Width, int &Height) {
|
||||
// Falls die Liste der BS_ImageLoader noch nicht initialisiert wurde, wird dies getan.
|
||||
@ -111,7 +111,7 @@ void ImageLoader::_DeinitializeLoaderList() {
|
||||
}
|
||||
}
|
||||
|
||||
ImageLoader *ImageLoader::_FindSuitableImageLoader(const byte *pFileData, unsigned int FileSize) {
|
||||
ImageLoader *ImageLoader::_FindSuitableImageLoader(const byte *pFileData, uint FileSize) {
|
||||
// Alle BS_ImageLoader-Objekte durchgehen, bis eins gefunden wurde, dass das Bild laden kann
|
||||
Common::List<ImageLoader *>::iterator Iter = _ImageLoaderList.begin();
|
||||
for (; Iter != _ImageLoaderList.end(); ++Iter) {
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
@remark Die Größe der Ausgabedaten in Bytes kann wie folgt berechnet werden: Pitch * Height.
|
||||
@remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben.
|
||||
*/
|
||||
static bool LoadImage(const byte *pFileData, unsigned int FileSize,
|
||||
static bool LoadImage(const byte *pFileData, uint FileSize,
|
||||
GraphicEngine::COLOR_FORMATS ColorFormat,
|
||||
byte *&pUncompressedData,
|
||||
int &Width, int &Height,
|
||||
@ -116,7 +116,7 @@ public:
|
||||
@return Gibt false zurück, wenn die Bildeigenschaften nicht ausgelesen werden konnten.
|
||||
@remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben.
|
||||
*/
|
||||
static bool ExtractImageProperties(const byte *pFileData, unsigned int FileSize,
|
||||
static bool ExtractImageProperties(const byte *pFileData, uint FileSize,
|
||||
GraphicEngine::COLOR_FORMATS &ColorFormat,
|
||||
int &Width, int &Height);
|
||||
//@}
|
||||
@ -148,7 +148,7 @@ protected:
|
||||
@return Gibt true zurück, wenn der #BS_ImageLoader das Bild lesen kann, ansonsten false.
|
||||
@remark Diese Methode muss von allen BS_ImageLoader Klassen implementiert werden.
|
||||
*/
|
||||
virtual bool IsCorrectImageFormat(const byte *pFileData, unsigned int FileSize) = 0;
|
||||
virtual bool IsCorrectImageFormat(const byte *pFileData, uint FileSize) = 0;
|
||||
|
||||
/**
|
||||
@brief Lädt eine Bilddatei.
|
||||
@ -170,7 +170,7 @@ protected:
|
||||
@remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben.
|
||||
@remark Diese Methode muss von allen BS_ImageLoader Klassen implementiert werden.
|
||||
*/
|
||||
virtual bool DecodeImage(const byte *pFileData, unsigned int FileSize,
|
||||
virtual bool DecodeImage(const byte *pFileData, uint FileSize,
|
||||
GraphicEngine::COLOR_FORMATS ColorFormat,
|
||||
byte *&pUncompressedData,
|
||||
int &Width, int &Height,
|
||||
@ -187,7 +187,7 @@ protected:
|
||||
@remark Es darf nicht vergessen werden, die Ausgabedaten nach erfolgter Benutzung mit delete freizugeben.
|
||||
@remark Diese Methode muss von allen BS_ImageLoader Klassen implementiert werden.
|
||||
*/
|
||||
virtual bool ImageProperties(const byte *pFileData, unsigned int FileSize,
|
||||
virtual bool ImageProperties(const byte *pFileData, uint FileSize,
|
||||
GraphicEngine::COLOR_FORMATS &ColorFormat,
|
||||
int &Width, int &Height) = 0;
|
||||
|
||||
@ -204,8 +204,8 @@ protected:
|
||||
@remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß ist.<br>
|
||||
Es sind mindestens Width * 2 Byte notwendig.
|
||||
*/
|
||||
static void RowARGB32ToRGB16(byte *pSrcData, byte *pDestData, unsigned int Width) {
|
||||
for (unsigned int i = 0; i < Width; i++) {
|
||||
static void RowARGB32ToRGB16(byte *pSrcData, byte *pDestData, uint Width) {
|
||||
for (uint i = 0; i < Width; i++) {
|
||||
((uint16_t *)pDestData)[i] = ((pSrcData[2] >> 3) << 11) | ((pSrcData[1] >> 2) << 5) | (pSrcData[0] >> 3);
|
||||
pSrcData += 4;
|
||||
}
|
||||
@ -219,8 +219,8 @@ protected:
|
||||
@remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß ist.<br>
|
||||
Es sind mindestens Width * 2 Byte notwendig.
|
||||
*/
|
||||
static void RowARGB32ToRGB15(byte *pSrcData, byte *pDestData, unsigned int Width) {
|
||||
for (unsigned int i = 0; i < Width; i++) {
|
||||
static void RowARGB32ToRGB15(byte *pSrcData, byte *pDestData, uint Width) {
|
||||
for (uint i = 0; i < Width; i++) {
|
||||
((uint16_t *)pDestData)[i] = ((pSrcData[2] >> 3) << 10) | ((pSrcData[1] >> 3) << 5) | (pSrcData[0] >> 3);
|
||||
pSrcData += 4;
|
||||
}
|
||||
@ -234,11 +234,11 @@ protected:
|
||||
@remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß sein muss.<br>
|
||||
Es sind mindestens ((Width + 3) / 4) * 12 Byte notwendig.
|
||||
*/
|
||||
static void RowARGB32ToRGB16_INTERLEAVED(byte *pSrcData, byte *pDestData, unsigned int Width) {
|
||||
static void RowARGB32ToRGB16_INTERLEAVED(byte *pSrcData, byte *pDestData, uint Width) {
|
||||
// Die Pixelblöcke erstellen, dabei werden immer jeweils 4 Pixel zu einem Block zusammengefasst
|
||||
unsigned int BlockFillCount = 0;
|
||||
unsigned int AlphaBlock = 0;
|
||||
for (unsigned int i = 0; i < Width; i++) {
|
||||
uint BlockFillCount = 0;
|
||||
uint AlphaBlock = 0;
|
||||
for (uint i = 0; i < Width; i++) {
|
||||
// Alphawert in den Alphablock schreiben
|
||||
AlphaBlock = (AlphaBlock >> 8) | (pSrcData[BlockFillCount * 4 + 3] << 24);
|
||||
|
||||
@ -252,7 +252,7 @@ protected:
|
||||
AlphaBlock >>= (4 - BlockFillCount) * 8;
|
||||
|
||||
// Alphablock schreiben
|
||||
*((unsigned int *)pDestData) = AlphaBlock;
|
||||
*((uint *)pDestData) = AlphaBlock;
|
||||
pDestData += 4;
|
||||
|
||||
// Pixel konvertieren und schreiben
|
||||
@ -278,11 +278,11 @@ protected:
|
||||
@remark Es gilt zu beachten, dass der Zielpuffer ausreichend groß ist.<br>
|
||||
Es sind mindestens (Width / 4 + Width % 4) * 3 Byte notwendig.
|
||||
*/
|
||||
static void RowARGB32ToRGB15_INTERLEAVED(byte *pSrcData, byte *pDestData, unsigned int Width) {
|
||||
static void RowARGB32ToRGB15_INTERLEAVED(byte *pSrcData, byte *pDestData, uint Width) {
|
||||
// Die Pixelblöcke erstellen, dabei werden immer jeweils 4 Pixel zu einem Block zusammengefasst
|
||||
unsigned int BlockFillCount = 0;
|
||||
unsigned int AlphaBlock = 0;
|
||||
for (unsigned int i = 0; i < Width; i++) {
|
||||
uint BlockFillCount = 0;
|
||||
uint AlphaBlock = 0;
|
||||
for (uint i = 0; i < Width; i++) {
|
||||
// Alphawert in den Alphablock schreiben
|
||||
AlphaBlock = (AlphaBlock >> 8) | (pSrcData[BlockFillCount * 4 + 3] << 24);
|
||||
|
||||
@ -296,7 +296,7 @@ protected:
|
||||
AlphaBlock >>= (4 - BlockFillCount) * 8;
|
||||
|
||||
// Alphablock schreiben
|
||||
*((unsigned int *)pDestData) = AlphaBlock;
|
||||
*((uint *)pDestData) = AlphaBlock;
|
||||
pDestData += 4;
|
||||
|
||||
// Pixel konvertieren und schreiben
|
||||
@ -320,8 +320,8 @@ protected:
|
||||
@param pDestData ein Pointer auf den Zielpuffern.
|
||||
@param Width die Anzahl der Pixel in der Bildzeile.
|
||||
*/
|
||||
static void RowARGB32ToABGR32(byte *pSrcData, byte *pDestData, unsigned int Width) {
|
||||
for (unsigned int i = 0; i < Width; ++i) {
|
||||
static void RowARGB32ToABGR32(byte *pSrcData, byte *pDestData, uint Width) {
|
||||
for (uint i = 0; i < Width; ++i) {
|
||||
*pDestData++ = pSrcData[2];
|
||||
*pDestData++ = pSrcData[1];
|
||||
*pDestData++ = pSrcData[0];
|
||||
@ -349,7 +349,7 @@ private:
|
||||
@brief Sucht zu Bilddaten ein BS_ImageLoader Objekt, dass die Bilddaten dekodieren kann.
|
||||
@return Gibt einen Pointer auf ein passendes BS_ImageLoader Objekt zurück, oder NULL, wenn kein passendes Objekt gefunden wurde.
|
||||
*/
|
||||
static ImageLoader *_FindSuitableImageLoader(const byte *pFileData, unsigned int FileSize);
|
||||
static ImageLoader *_FindSuitableImageLoader(const byte *pFileData, uint FileSize);
|
||||
|
||||
static Common::List<ImageLoader *> _ImageLoaderList; // Die Liste aller BS_ImageLoader-Objekte
|
||||
static bool _ImageLoaderListInitialized; // Gibt an, ob die Liste schon intialisiert wurde
|
||||
|
@ -62,7 +62,7 @@ static void png_user_read_data(png_structp png_ptr, png_bytep data, png_size_t l
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PNGLoader::DoDecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
bool PNGLoader::DoDecodeImage(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
int &Width, int &Height, int &Pitch) {
|
||||
png_structp png_ptr = NULL;
|
||||
png_infop info_ptr = NULL;
|
||||
@ -259,14 +259,14 @@ bool PNGLoader::DoDecodeImage(const byte *FileDataPtr, unsigned int FileSize, G
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PNGLoader::DecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
bool PNGLoader::DecodeImage(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
int &Width, int &Height, int &Pitch) {
|
||||
return DoDecodeImage(FileDataPtr, FileSize, ColorFormat, UncompressedDataPtr, Width, Height, Pitch);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PNGLoader::DoImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) {
|
||||
bool PNGLoader::DoImageProperties(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) {
|
||||
// PNG Signatur überprüfen
|
||||
if (!DoIsCorrectImageFormat(FileDataPtr, FileSize)) return false;
|
||||
|
||||
@ -310,7 +310,7 @@ bool PNGLoader::DoImageProperties(const byte *FileDataPtr, unsigned int FileSize
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PNGLoader::ImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) {
|
||||
bool PNGLoader::ImageProperties(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height) {
|
||||
return DoImageProperties(FileDataPtr, FileSize, ColorFormat, Width, Height);
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ bool PNGLoader::ImageProperties(const byte *FileDataPtr, unsigned int FileSize,
|
||||
// Header überprüfen
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PNGLoader::DoIsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize) {
|
||||
bool PNGLoader::DoIsCorrectImageFormat(const byte *FileDataPtr, uint FileSize) {
|
||||
if (FileSize > 8)
|
||||
return png_check_sig(const_cast<byte *>(FileDataPtr), 8) ? true : false;
|
||||
else
|
||||
@ -327,7 +327,7 @@ bool PNGLoader::DoIsCorrectImageFormat(const byte *FileDataPtr, unsigned int Fil
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PNGLoader::IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize) {
|
||||
bool PNGLoader::IsCorrectImageFormat(const byte *FileDataPtr, uint FileSize) {
|
||||
return DoIsCorrectImageFormat(FileDataPtr, FileSize);
|
||||
}
|
||||
|
||||
|
@ -60,20 +60,20 @@ public:
|
||||
|
||||
// Alle virtuellen Methoden von BS_ImageLoader sind hier als static-Methode implementiert, damit sie von BS_B25SLoader aufgerufen werden können.
|
||||
// Die virtuellen Methoden rufen diese Methoden auf.
|
||||
static bool DoIsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize);
|
||||
static bool DoDecodeImage(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
static bool DoIsCorrectImageFormat(const byte *FileDataPtr, uint FileSize);
|
||||
static bool DoDecodeImage(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
|
||||
int &Width, int &Height, int &Pitch);
|
||||
static bool DoImageProperties(const byte *FileDataPtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
|
||||
static bool DoImageProperties(const byte *FileDataPtr, uint FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
|
||||
|
||||
protected:
|
||||
PNGLoader();
|
||||
bool DecodeImage(const byte *pFileData, unsigned int FileSize,
|
||||
bool DecodeImage(const byte *pFileData, uint FileSize,
|
||||
GraphicEngine::COLOR_FORMATS ColorFormat,
|
||||
byte *&pUncompressedData,
|
||||
int &Width, int &Height,
|
||||
int &Pitch);
|
||||
bool IsCorrectImageFormat(const byte *FileDataPtr, unsigned int FileSize);
|
||||
bool ImageProperties(const byte *FileDatePtr, unsigned int FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
|
||||
bool IsCorrectImageFormat(const byte *FileDataPtr, uint FileSize);
|
||||
bool ImageProperties(const byte *FileDatePtr, uint FileSize, GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -60,11 +60,11 @@ namespace Sword25 {
|
||||
|
||||
class VectorImage::SWFBitStream {
|
||||
public:
|
||||
SWFBitStream(const byte *pData, unsigned int DataSize) :
|
||||
SWFBitStream(const byte *pData, uint DataSize) :
|
||||
m_Pos(pData), m_End(pData + DataSize), m_WordMask(0)
|
||||
{}
|
||||
|
||||
inline uint32 GetBits(unsigned int BitCount) {
|
||||
inline uint32 GetBits(uint BitCount) {
|
||||
if (BitCount == 0 || BitCount > 32) {
|
||||
error("SWFBitStream::GetBits() must read at least 1 and at most 32 bits at a time");
|
||||
}
|
||||
@ -83,7 +83,7 @@ public:
|
||||
return value;
|
||||
}
|
||||
|
||||
inline int32 GetSignedBits(unsigned int BitCount) {
|
||||
inline int32 GetSignedBits(uint BitCount) {
|
||||
// Bits einlesen
|
||||
uint32 Temp = GetBits(BitCount);
|
||||
|
||||
@ -130,7 +130,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
inline void SkipBytes(unsigned int SkipLength) {
|
||||
inline void SkipBytes(uint SkipLength) {
|
||||
FlushByte();
|
||||
if (m_Pos + SkipLength >= m_End) {
|
||||
error("Attempted to read past end of file");
|
||||
@ -145,7 +145,7 @@ private:
|
||||
const byte *m_End;
|
||||
|
||||
byte m_Word;
|
||||
unsigned int m_WordMask;
|
||||
uint m_WordMask;
|
||||
};
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ Common::Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) {
|
||||
// Konvertiert SWF-Farben in AntiGrain Farben
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
uint32 FlashColorToAGGRGBA8(unsigned int FlashColor) {
|
||||
uint32 FlashColorToAGGRGBA8(uint FlashColor) {
|
||||
uint32 ResultColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(FlashColor >> 24, (FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff);
|
||||
|
||||
return ResultColor;
|
||||
@ -224,7 +224,7 @@ Common::Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement)
|
||||
// Konstruktion
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
VectorImage::VectorImage(const byte *pFileData, unsigned int FileSize, bool &Success) {
|
||||
VectorImage::VectorImage(const byte *pFileData, uint FileSize, bool &Success) {
|
||||
Success = false;
|
||||
|
||||
// Bitstream-Objekt erzeugen
|
||||
@ -303,7 +303,7 @@ VectorImage::VectorImage(const byte *pFileData, unsigned int FileSize, bool &Suc
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) {
|
||||
bool VectorImage::ParseDefineShape(uint ShapeType, SWFBitStream &bs) {
|
||||
/*uint32 ShapeID = */bs.GetUInt16();
|
||||
|
||||
// Bounding Box auslesen
|
||||
@ -313,14 +313,14 @@ bool VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) {
|
||||
m_Elements.resize(1);
|
||||
|
||||
// Styles einlesen
|
||||
unsigned int NumFillBits;
|
||||
unsigned int NumLineBits;
|
||||
uint NumFillBits;
|
||||
uint NumLineBits;
|
||||
if (!ParseStyles(ShapeType, bs, NumFillBits, NumLineBits))
|
||||
return false;
|
||||
|
||||
unsigned int LineStyle = 0;
|
||||
unsigned int FillStyle0 = 0;
|
||||
unsigned int FillStyle1 = 0;
|
||||
uint LineStyle = 0;
|
||||
uint FillStyle0 = 0;
|
||||
uint FillStyle1 = 0;
|
||||
|
||||
// Shaperecord parsen
|
||||
// ------------------
|
||||
@ -451,20 +451,20 @@ bool VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool VectorImage::ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsigned int &NumFillBits, unsigned int &NumLineBits) {
|
||||
bool VectorImage::ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBits, uint &NumLineBits) {
|
||||
bs.FlushByte();
|
||||
|
||||
// Fillstyles parsen
|
||||
// -----------------
|
||||
|
||||
// Anzahl an Fillstyles bestimmen
|
||||
unsigned int FillStyleCount = bs.GetByte();
|
||||
uint FillStyleCount = bs.GetByte();
|
||||
if (FillStyleCount == 0xff) FillStyleCount = bs.GetUInt16();
|
||||
|
||||
// Alle Fillstyles einlesen, falls ein Fillstyle mit Typ != 0 gefunden wird, wird das Parsen abgebrochen.
|
||||
// Es wird nur "solid fill" (Typ 0) unterstützt.
|
||||
m_Elements.back().m_FillStyles.reserve(FillStyleCount);
|
||||
for (unsigned int i = 0; i < FillStyleCount; ++i) {
|
||||
for (uint i = 0; i < FillStyleCount; ++i) {
|
||||
byte Type = bs.GetByte();
|
||||
uint32 Color;
|
||||
if (ShapeType == 3) {
|
||||
@ -480,13 +480,13 @@ bool VectorImage::ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsigned
|
||||
// -----------------
|
||||
|
||||
// Anzahl an Linestyles bestimmen
|
||||
unsigned int LineStyleCount = bs.GetByte();
|
||||
uint LineStyleCount = bs.GetByte();
|
||||
if (LineStyleCount == 0xff)
|
||||
LineStyleCount = bs.GetUInt16();
|
||||
|
||||
// Alle Linestyles einlesen
|
||||
m_Elements.back().m_LineStyles.reserve(LineStyleCount);
|
||||
for (unsigned int i = 0; i < LineStyleCount; ++i) {
|
||||
for (uint i = 0; i < LineStyleCount; ++i) {
|
||||
double Width = bs.GetUInt16();
|
||||
uint32 Color;
|
||||
if (ShapeType == 3)
|
||||
@ -507,7 +507,7 @@ bool VectorImage::ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsigned
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool VectorImage::Fill(const Common::Rect *pFillRect, unsigned int Color) {
|
||||
bool VectorImage::Fill(const Common::Rect *pFillRect, uint Color) {
|
||||
BS_LOG_ERRORLN("Fill() is not supported.");
|
||||
return false;
|
||||
}
|
||||
@ -515,14 +515,14 @@ bool VectorImage::Fill(const Common::Rect *pFillRect, unsigned int Color) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int VectorImage::GetPixel(int X, int Y) {
|
||||
uint VectorImage::GetPixel(int X, int Y) {
|
||||
BS_LOG_ERRORLN("GetPixel() is not supported. Returning black.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool VectorImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
bool VectorImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) {
|
||||
BS_LOG_ERRORLN("SetContent() is not supported.");
|
||||
return 0;
|
||||
}
|
||||
|
@ -60,31 +60,31 @@ class VectorImage;
|
||||
|
||||
class VectorPathInfo {
|
||||
public:
|
||||
VectorPathInfo(unsigned int ID, unsigned int LineStyle, unsigned int FillStyle0, unsigned int FillStyle1) :
|
||||
VectorPathInfo(uint ID, uint LineStyle, uint FillStyle0, uint FillStyle1) :
|
||||
m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {}
|
||||
|
||||
VectorPathInfo() {
|
||||
m_ID = m_LineStyle = m_FillStyle0 = m_FillStyle1 = 0;
|
||||
}
|
||||
|
||||
unsigned int GetID() const {
|
||||
uint GetID() const {
|
||||
return m_ID;
|
||||
}
|
||||
unsigned int GetLineStyle() const {
|
||||
uint GetLineStyle() const {
|
||||
return m_LineStyle;
|
||||
}
|
||||
unsigned int GetFillStyle0() const {
|
||||
uint GetFillStyle0() const {
|
||||
return m_FillStyle0;
|
||||
}
|
||||
unsigned int GetFillStyle1() const {
|
||||
uint GetFillStyle1() const {
|
||||
return m_FillStyle1;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int m_ID;
|
||||
unsigned int m_LineStyle;
|
||||
unsigned int m_FillStyle0;
|
||||
unsigned int m_FillStyle1;
|
||||
uint m_ID;
|
||||
uint m_LineStyle;
|
||||
uint m_FillStyle0;
|
||||
uint m_FillStyle1;
|
||||
};
|
||||
|
||||
|
||||
@ -101,33 +101,33 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned int GetPathCount() const {
|
||||
uint GetPathCount() const {
|
||||
return m_PathInfos.size();
|
||||
}
|
||||
const VectorPathInfo &GetPathInfo(unsigned int PathNr) const {
|
||||
const VectorPathInfo &GetPathInfo(uint PathNr) const {
|
||||
BS_ASSERT(PathNr < GetPathCount());
|
||||
return m_PathInfos[PathNr];
|
||||
}
|
||||
|
||||
double GetLineStyleWidth(unsigned int LineStyle) const {
|
||||
double GetLineStyleWidth(uint LineStyle) const {
|
||||
BS_ASSERT(LineStyle < m_LineStyles.size());
|
||||
return m_LineStyles[LineStyle].Width;
|
||||
}
|
||||
|
||||
unsigned int GetLineStyleCount() const {
|
||||
uint GetLineStyleCount() const {
|
||||
return m_LineStyles.size();
|
||||
}
|
||||
|
||||
uint32 GetLineStyleColor(unsigned int LineStyle) const {
|
||||
uint32 GetLineStyleColor(uint LineStyle) const {
|
||||
BS_ASSERT(LineStyle < m_LineStyles.size());
|
||||
return m_LineStyles[LineStyle].Color;
|
||||
}
|
||||
|
||||
unsigned int GetFillStyleCount() const {
|
||||
uint GetFillStyleCount() const {
|
||||
return m_FillStyles.size();
|
||||
}
|
||||
|
||||
uint32 GetFillStyleColor(unsigned int FillStyle) const {
|
||||
uint32 GetFillStyleColor(uint FillStyle) const {
|
||||
BS_ASSERT(FillStyle < m_FillStyles.size());
|
||||
return m_FillStyles[FillStyle];
|
||||
}
|
||||
@ -162,12 +162,12 @@ private:
|
||||
|
||||
class VectorImage : public Image {
|
||||
public:
|
||||
VectorImage(const byte *pFileData, unsigned int FileSize, bool &Success);
|
||||
VectorImage(const byte *pFileData, uint FileSize, bool &Success);
|
||||
|
||||
unsigned int GetElementCount() const {
|
||||
uint GetElementCount() const {
|
||||
return m_Elements.size();
|
||||
}
|
||||
const VectorImageElement &GetElement(unsigned int ElementNr) const {
|
||||
const VectorImageElement &GetElement(uint ElementNr) const {
|
||||
BS_ASSERT(ElementNr < m_Elements.size());
|
||||
return m_Elements[ElementNr];
|
||||
}
|
||||
@ -187,8 +187,8 @@ public:
|
||||
virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const {
|
||||
return GraphicEngine::CF_ARGB32;
|
||||
}
|
||||
virtual bool Fill(const Common::Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0));
|
||||
virtual unsigned int GetPixel(int X, int Y);
|
||||
virtual bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0));
|
||||
virtual uint GetPixel(int X, int Y);
|
||||
virtual bool IsBlitSource() const {
|
||||
return true;
|
||||
}
|
||||
@ -210,18 +210,18 @@ public:
|
||||
virtual bool IsSetContentAllowed() const {
|
||||
return false;
|
||||
}
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride);
|
||||
virtual bool Blit(int PosX = 0, int PosY = 0,
|
||||
int Flipping = FLIP_NONE,
|
||||
Common::Rect *pPartRect = NULL,
|
||||
unsigned int Color = BS_ARGB(255, 255, 255, 255),
|
||||
uint Color = BS_ARGB(255, 255, 255, 255),
|
||||
int Width = -1, int Height = -1);
|
||||
|
||||
class SWFBitStream;
|
||||
|
||||
private:
|
||||
bool ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs);
|
||||
bool ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsigned int &NumFillBits, unsigned int &NumLineBits);
|
||||
bool ParseDefineShape(uint ShapeType, SWFBitStream &bs);
|
||||
bool ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBits, uint &NumLineBits);
|
||||
|
||||
Common::Array<VectorImageElement> m_Elements;
|
||||
Common::Rect m_BoundingBox;
|
||||
|
@ -95,7 +95,7 @@ class StyleHandler {
|
||||
public:
|
||||
StyleHandler(const BS_VectorImageElement &VectorImageElement) : m_ImageElement(VectorImageElement) {}
|
||||
|
||||
bool is_solid(unsigned int style) const {
|
||||
bool is_solid(uint style) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -120,12 +120,12 @@ BS_VectorImageRenderer::BS_VectorImageRenderer() :
|
||||
|
||||
bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
|
||||
float ScaleFactorX, float ScaleFactorY,
|
||||
unsigned int &Width, unsigned int &Height,
|
||||
uint &Width, uint &Height,
|
||||
byte *ImageData,
|
||||
float LineScaleFactor,
|
||||
bool NoAlphaShapes) {
|
||||
Width = static_cast<unsigned int>(VectorImage.GetWidth() * ScaleFactorX);
|
||||
Height = static_cast<unsigned int>(VectorImage.GetHeight() * ScaleFactorY);
|
||||
Width = static_cast<uint>(VectorImage.GetWidth() * ScaleFactorX);
|
||||
Height = static_cast<uint>(VectorImage.GetHeight() * ScaleFactorY);
|
||||
|
||||
ImageData.resize(Width * Height * 4);
|
||||
memset(&ImageData[0], 0, ImageData.size());
|
||||
@ -139,7 +139,7 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
|
||||
Scale = agg::trans_affine_translation(- VectorImage.GetBoundingBox().left, - VectorImage.GetBoundingBox().top);
|
||||
Scale *= agg::trans_affine_scaling(ScaleFactorX, ScaleFactorY);
|
||||
|
||||
for (unsigned int element = 0; element < VectorImage.GetElementCount(); ++element) {
|
||||
for (uint element = 0; element < VectorImage.GetElementCount(); ++element) {
|
||||
const BS_VectorImageElement &CurImageElement = VectorImage.GetElement(element);
|
||||
|
||||
CompoundShape ImageCompoundShape(CurImageElement);
|
||||
@ -151,9 +151,9 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
|
||||
//----------------------
|
||||
CompoundRasterizer.clip_box(0, 0, Width, Height);
|
||||
CompoundRasterizer.reset();
|
||||
for (unsigned int i = 0; i < CurImageElement.GetPathCount(); ++i) {
|
||||
unsigned int FillStyle0 = CurImageElement.GetPathInfo(i).GetFillStyle0();
|
||||
unsigned int FillStyle1 = CurImageElement.GetPathInfo(i).GetFillStyle1();
|
||||
for (uint i = 0; i < CurImageElement.GetPathCount(); ++i) {
|
||||
uint FillStyle0 = CurImageElement.GetPathInfo(i).GetFillStyle0();
|
||||
uint FillStyle1 = CurImageElement.GetPathInfo(i).GetFillStyle1();
|
||||
|
||||
if (NoAlphaShapes) {
|
||||
if (FillStyle0 != 0 && CurImageElement.GetFillStyleColor(FillStyle0 - 1).a != 255) FillStyle0 = 0;
|
||||
@ -173,10 +173,10 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
|
||||
Rasterizer.clip_box(0, 0, Width, Height);
|
||||
Stroke.line_join(agg::round_join);
|
||||
Stroke.line_cap(agg::round_cap);
|
||||
for (unsigned int i = 0; i < CurImageElement.GetPathCount(); ++i) {
|
||||
for (uint i = 0; i < CurImageElement.GetPathCount(); ++i) {
|
||||
Rasterizer.reset();
|
||||
|
||||
unsigned int CurrentLineStyle = CurImageElement.GetPathInfo(i).GetLineStyle();
|
||||
uint CurrentLineStyle = CurImageElement.GetPathInfo(i).GetLineStyle();
|
||||
if (CurrentLineStyle != 0) {
|
||||
Stroke.width(ScaleFactorX * CurImageElement.GetLineStyleWidth(CurrentLineStyle - 1) * LineScaleFactor);
|
||||
Rasterizer.add_path(Stroke, CurImageElement.GetPathInfo(i).GetID());
|
||||
@ -202,7 +202,7 @@ VectorImageRenderer::VectorImageRenderer() {}
|
||||
|
||||
bool VectorImageRenderer::Render(const VectorImage &VectorImage,
|
||||
float ScaleFactorX, float ScaleFactorY,
|
||||
unsigned int &Width, unsigned int &Height,
|
||||
uint &Width, uint &Height,
|
||||
byte *ImageData,
|
||||
float LineScaleFactor,
|
||||
bool NoAlphaShapes) {
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
|
||||
bool Render(const VectorImage &VectorImage,
|
||||
float ScaleFactorX, float ScaleFactorY,
|
||||
unsigned int &Width, unsigned int &Height,
|
||||
uint &Width, uint &Height,
|
||||
byte *ImageData,
|
||||
float LineScaleFactor = 1.0f,
|
||||
bool NoAlphaShapes = false);
|
||||
|
@ -64,7 +64,7 @@ GLImage::GLImage(const Common::String &Filename, bool &Result) :
|
||||
|
||||
// Datei laden
|
||||
byte *pFileData;
|
||||
unsigned int FileSize;
|
||||
uint FileSize;
|
||||
if (!(pFileData = (byte *) pPackage->GetFile(Filename, &FileSize))) {
|
||||
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str());
|
||||
return;
|
||||
@ -93,7 +93,7 @@ GLImage::GLImage(const Common::String &Filename, bool &Result) :
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
GLImage::GLImage(unsigned int Width, unsigned int Height, bool &Result) :
|
||||
GLImage::GLImage(uint Width, uint Height, bool &Result) :
|
||||
m_Width(Width),
|
||||
m_Height(Height) {
|
||||
Result = false;
|
||||
@ -114,16 +114,16 @@ GLImage::~GLImage() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool GLImage::Fill(const Common::Rect *pFillRect, unsigned int Color) {
|
||||
bool GLImage::Fill(const Common::Rect *pFillRect, uint Color) {
|
||||
BS_LOG_ERRORLN("Fill() is not supported.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool GLImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
bool GLImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) {
|
||||
// Überprüfen, ob PixelData ausreichend viele Pixel enthält um ein Bild der Größe Width * Height zu erzeugen
|
||||
if (size < static_cast<unsigned int>(m_Width * m_Height * 4)) {
|
||||
if (size < static_cast<uint>(m_Width * m_Height * 4)) {
|
||||
BS_LOG_ERRORLN("PixelData vector is too small to define a 32 bit %dx%d image.", m_Width, m_Height);
|
||||
return false;
|
||||
}
|
||||
@ -142,14 +142,14 @@ bool GLImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset,
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int GLImage::GetPixel(int X, int Y) {
|
||||
uint GLImage::GetPixel(int X, int Y) {
|
||||
BS_LOG_ERRORLN("GetPixel() is not supported. Returning black.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, unsigned int Color, int Width, int Height) {
|
||||
bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, uint Color, int Width, int Height) {
|
||||
int x1 = 0, y1 = 0;
|
||||
int w = m_Width, h = m_Height;
|
||||
if (pPartRect) {
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
@param Result gibt dem Aufrufer bekannt, ob der Konstruktor erfolgreich ausgeführt wurde. Wenn es nach dem Aufruf false enthalten sollte,
|
||||
dürfen keine Methoden am Objekt aufgerufen werden und das Objekt ist sofort zu zerstören.
|
||||
*/
|
||||
GLImage(unsigned int Width, unsigned int Height, bool &Result);
|
||||
GLImage(uint Width, uint Height, bool &Result);
|
||||
virtual ~GLImage();
|
||||
|
||||
virtual int GetWidth() const {
|
||||
@ -83,11 +83,11 @@ public:
|
||||
virtual bool Blit(int PosX = 0, int PosY = 0,
|
||||
int Flipping = Image::FLIP_NONE,
|
||||
Common::Rect *pPartRect = NULL,
|
||||
unsigned int Color = BS_ARGB(255, 255, 255, 255),
|
||||
uint Color = BS_ARGB(255, 255, 255, 255),
|
||||
int Width = -1, int Height = -1);
|
||||
virtual bool Fill(const Common::Rect *pFillRect, unsigned int Color);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset = 0, unsigned int Stride = 0);
|
||||
virtual unsigned int GetPixel(int X, int Y);
|
||||
virtual bool Fill(const Common::Rect *pFillRect, uint Color);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset = 0, uint Stride = 0);
|
||||
virtual uint GetPixel(int X, int Y);
|
||||
|
||||
virtual bool IsBlitSource() const {
|
||||
return true;
|
||||
|
@ -54,7 +54,7 @@ const float LINE_SCALE_FACTOR = 1.0f;
|
||||
bool VectorImage::Blit(int PosX, int PosY,
|
||||
int Flipping,
|
||||
Common::Rect *pPartRect,
|
||||
unsigned int Color,
|
||||
uint Color,
|
||||
int Width, int Height) {
|
||||
#if 0
|
||||
static BS_VectorImageRenderer VectorImageRenderer;
|
||||
@ -82,8 +82,8 @@ bool VectorImage::Blit(int PosX, int PosY,
|
||||
float ScaleFactorX = (Width == - 1) ? 1 : static_cast<float>(Width) / static_cast<float>(GetWidth());
|
||||
float ScaleFactorY = (Height == - 1) ? 1 : static_cast<float>(Height) / static_cast<float>(GetHeight());
|
||||
|
||||
unsigned int RenderedWidth;
|
||||
unsigned int RenderedHeight;
|
||||
uint RenderedWidth;
|
||||
uint RenderedHeight;
|
||||
if (!VectorImageRenderer.Render(*this, ScaleFactorX, ScaleFactorY, RenderedWidth, RenderedHeight, PixelData, LINE_SCALE_FACTOR)) {
|
||||
BS_LOG_ERRORLN("Call to BS_VectorImageRenderer::Render() failed.");
|
||||
return false;
|
||||
|
@ -166,7 +166,7 @@ bool OpenGLGfx::EndFrame() {
|
||||
|
||||
Common::Array<DebugLine>::const_iterator iter = m_DebugLines.begin();
|
||||
for (; iter != m_DebugLines.end(); ++iter) {
|
||||
const unsigned int &Color = (*iter).Color;
|
||||
const uint &Color = (*iter).Color;
|
||||
const BS_Vertex &Start = (*iter).Start;
|
||||
const BS_Vertex &End = (*iter).End;
|
||||
|
||||
@ -212,7 +212,7 @@ bool OpenGLGfx::GetVsync() const {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool OpenGLGfx::Fill(const Common::Rect *fillRectPtr, unsigned int color) {
|
||||
bool OpenGLGfx::Fill(const Common::Rect *fillRectPtr, uint color) {
|
||||
Common::Rect rect(m_Width - 1, m_Height - 1);
|
||||
|
||||
if (fillRectPtr) {
|
||||
@ -229,7 +229,7 @@ bool OpenGLGfx::Fill(const Common::Rect *fillRectPtr, unsigned int color) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data) {
|
||||
bool OpenGLGfx::GetScreenshot(uint &Width, uint &Height, byte **Data) {
|
||||
if (!ReadFramebufferContents(m_Width, m_Height, Data))
|
||||
return false;
|
||||
|
||||
@ -246,7 +246,7 @@ bool OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, byte **
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data) {
|
||||
bool OpenGLGfx::ReadFramebufferContents(uint Width, uint Height, byte **Data) {
|
||||
*Data = (byte *)malloc(Width * Height * 4);
|
||||
|
||||
return true;
|
||||
@ -258,7 +258,7 @@ void OpenGLGfx::ReverseRGBAComponentOrder(byte *Data, uint size) {
|
||||
uint32 *ptr = (uint32 *)Data;
|
||||
|
||||
for (uint i = 0; i < size; i++) {
|
||||
unsigned int Pixel = *ptr;
|
||||
uint Pixel = *ptr;
|
||||
*ptr = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16);
|
||||
++ptr;
|
||||
}
|
||||
@ -266,13 +266,13 @@ void OpenGLGfx::ReverseRGBAComponentOrder(byte *Data, uint size) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height, byte *Data) {
|
||||
void OpenGLGfx::FlipImagedataVertical(uint Width, uint Height, byte *Data) {
|
||||
#if 0 // TODO
|
||||
vector<unsigned int> LineBuffer(Width);
|
||||
vector<uint> LineBuffer(Width);
|
||||
|
||||
for (unsigned int Y = 0; Y < Height / 2; ++Y) {
|
||||
vector<unsigned int>::iterator Line1It = Data.begin() + Y * Width;
|
||||
vector<unsigned int>::iterator Line2It = Data.begin() + (Height - 1 - Y) * Width;
|
||||
for (uint Y = 0; Y < Height / 2; ++Y) {
|
||||
vector<uint>::iterator Line1It = Data.begin() + Y * Width;
|
||||
vector<uint>::iterator Line2It = Data.begin() + (Height - 1 - Y) * Width;
|
||||
copy(Line1It, Line1It + Width, LineBuffer.begin());
|
||||
copy(Line2It, Line2It + Width, Line1It);
|
||||
copy(LineBuffer.begin(), LineBuffer.end(), Line2It);
|
||||
@ -332,7 +332,7 @@ Resource *OpenGLGfx::LoadResource(const Common::String &FileName) {
|
||||
|
||||
// Datei laden
|
||||
byte *pFileData;
|
||||
unsigned int FileSize;
|
||||
uint FileSize;
|
||||
if (!(pFileData = static_cast<byte *>(pPackage->GetFile(FileName, &FileSize)))) {
|
||||
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", FileName.c_str());
|
||||
return 0;
|
||||
@ -398,7 +398,7 @@ bool OpenGLGfx::CanLoadResource(const Common::String &FileName) {
|
||||
// DEBUGGING
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OpenGLGfx::DrawDebugLine(const Vertex &Start, const Vertex &End, unsigned int Color) {
|
||||
void OpenGLGfx::DrawDebugLine(const Vertex &Start, const Vertex &End, uint Color) {
|
||||
m_DebugLines.push_back(DebugLine(Start, End, Color));
|
||||
}
|
||||
|
||||
|
@ -77,8 +77,8 @@ public:
|
||||
virtual void SetVsync(bool Vsync);
|
||||
virtual bool GetVsync() const;
|
||||
|
||||
virtual bool Fill(const Common::Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0));
|
||||
virtual bool GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data);
|
||||
virtual bool Fill(const Common::Rect *FillRectPtr = 0, uint Color = BS_RGB(0, 0, 0));
|
||||
virtual bool GetScreenshot(uint &Width, uint &Height, byte **Data);
|
||||
|
||||
// Resource-Managing Methoden
|
||||
// --------------------------
|
||||
@ -87,7 +87,7 @@ public:
|
||||
|
||||
// Debugging Methoden
|
||||
// ------------------
|
||||
virtual void DrawDebugLine(const Vertex &Start, const Vertex &End, unsigned int Color);
|
||||
virtual void DrawDebugLine(const Vertex &Start, const Vertex &End, uint Color);
|
||||
|
||||
// Persistenz Methoden
|
||||
// -------------------
|
||||
@ -103,7 +103,7 @@ private:
|
||||
Common::ScopedPtr<RenderObjectManager> m_RenderObjectManagerPtr;
|
||||
|
||||
struct DebugLine {
|
||||
DebugLine(const Vertex &_Start, const Vertex &_End, unsigned int _Color) :
|
||||
DebugLine(const Vertex &_Start, const Vertex &_End, uint _Color) :
|
||||
Start(_Start),
|
||||
End(_End),
|
||||
Color(_Color) {}
|
||||
@ -111,14 +111,14 @@ private:
|
||||
|
||||
Vertex Start;
|
||||
Vertex End;
|
||||
unsigned int Color;
|
||||
uint Color;
|
||||
};
|
||||
|
||||
Common::Array<DebugLine> m_DebugLines;
|
||||
|
||||
static bool ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data);
|
||||
static bool ReadFramebufferContents(uint Width, uint Height, byte **Data);
|
||||
static void ReverseRGBAComponentOrder(byte *Data, uint size);
|
||||
static void FlipImagedataVertical(unsigned int Width, unsigned int Height, byte *Data);
|
||||
static void FlipImagedataVertical(uint Width, uint Height, byte *Data);
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -61,7 +61,7 @@ SWImage::SWImage(const Common::String &Filename, bool &Result) :
|
||||
|
||||
// Datei laden
|
||||
byte *pFileData;
|
||||
unsigned int FileSize;
|
||||
uint FileSize;
|
||||
if (!(pFileData = (byte *) pPackage->GetFile(Filename, &FileSize))) {
|
||||
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str());
|
||||
return;
|
||||
@ -85,7 +85,7 @@ SWImage::SWImage(const Common::String &Filename, bool &Result) :
|
||||
// Dateidaten freigeben
|
||||
delete[] pFileData;
|
||||
|
||||
_ImageDataPtr = (unsigned int *) pUncompressedData;
|
||||
_ImageDataPtr = (uint *) pUncompressedData;
|
||||
|
||||
Result = true;
|
||||
return;
|
||||
@ -103,7 +103,7 @@ SWImage::~SWImage() {
|
||||
bool SWImage::Blit(int PosX, int PosY,
|
||||
int Flipping,
|
||||
Common::Rect *pPartRect,
|
||||
unsigned int Color,
|
||||
uint Color,
|
||||
int Width, int Height) {
|
||||
BS_LOG_ERRORLN("Blit() is not supported.");
|
||||
return false;
|
||||
@ -111,21 +111,21 @@ bool SWImage::Blit(int PosX, int PosY,
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool SWImage::Fill(const Common::Rect *pFillRect, unsigned int Color) {
|
||||
bool SWImage::Fill(const Common::Rect *pFillRect, uint Color) {
|
||||
BS_LOG_ERRORLN("Fill() is not supported.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool SWImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
bool SWImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) {
|
||||
BS_LOG_ERRORLN("SetContent() is not supported.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int SWImage::GetPixel(int X, int Y) {
|
||||
uint SWImage::GetPixel(int X, int Y) {
|
||||
BS_ASSERT(X >= 0 && X < m_Width);
|
||||
BS_ASSERT(Y >= 0 && Y < m_Height);
|
||||
|
||||
|
@ -68,11 +68,11 @@ public:
|
||||
virtual bool Blit(int PosX = 0, int PosY = 0,
|
||||
int Flipping = Image::FLIP_NONE,
|
||||
Common::Rect *pPartRect = NULL,
|
||||
unsigned int Color = BS_ARGB(255, 255, 255, 255),
|
||||
uint Color = BS_ARGB(255, 255, 255, 255),
|
||||
int Width = -1, int Height = -1);
|
||||
virtual bool Fill(const Common::Rect *FillRectPtr, unsigned int Color);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
virtual unsigned int GetPixel(int X, int Y);
|
||||
virtual bool Fill(const Common::Rect *FillRectPtr, uint Color);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride);
|
||||
virtual uint GetPixel(int X, int Y);
|
||||
|
||||
virtual bool IsBlitSource() const {
|
||||
return false;
|
||||
@ -96,7 +96,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
unsigned int *_ImageDataPtr;
|
||||
uint *_ImageDataPtr;
|
||||
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
|
@ -53,7 +53,7 @@ namespace Sword25 {
|
||||
// Construction/Destruction
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Panel::Panel(RenderObjectPtr<RenderObject> ParentPtr, int Width, int Height, unsigned int Color) :
|
||||
Panel::Panel(RenderObjectPtr<RenderObject> ParentPtr, int Width, int Height, uint Color) :
|
||||
RenderObject(ParentPtr, RenderObject::TYPE_PANEL),
|
||||
m_Color(Color) {
|
||||
m_InitSuccess = false;
|
||||
@ -76,7 +76,7 @@ Panel::Panel(RenderObjectPtr<RenderObject> ParentPtr, int Width, int Height, uns
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Panel::Panel(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle) :
|
||||
Panel::Panel(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle) :
|
||||
RenderObject(ParentPtr, RenderObject::TYPE_PANEL, Handle) {
|
||||
m_InitSuccess = Unpersist(Reader);
|
||||
}
|
||||
@ -122,7 +122,7 @@ bool Panel::Unpersist(InputPersistenceBlock &Reader) {
|
||||
|
||||
Result &= RenderObject::Unpersist(Reader);
|
||||
|
||||
unsigned int Color;
|
||||
uint Color;
|
||||
Reader.Read(Color);
|
||||
SetColor(Color);
|
||||
|
||||
|
@ -52,16 +52,16 @@ class Panel : public RenderObject {
|
||||
friend class RenderObject;
|
||||
|
||||
private:
|
||||
Panel(RenderObjectPtr<RenderObject> ParentPtr, int Width, int Height, unsigned int Color);
|
||||
Panel(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle);
|
||||
Panel(RenderObjectPtr<RenderObject> ParentPtr, int Width, int Height, uint Color);
|
||||
Panel(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle);
|
||||
|
||||
public:
|
||||
virtual ~Panel();
|
||||
|
||||
unsigned int GetColor() const {
|
||||
uint GetColor() const {
|
||||
return m_Color;
|
||||
}
|
||||
void SetColor(unsigned int Color) {
|
||||
void SetColor(uint Color) {
|
||||
m_Color = Color;
|
||||
ForceRefresh();
|
||||
}
|
||||
@ -73,7 +73,7 @@ protected:
|
||||
virtual bool DoRender();
|
||||
|
||||
private:
|
||||
unsigned int m_Color;
|
||||
uint m_Color;
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -55,7 +55,7 @@ namespace Sword25 {
|
||||
|
||||
// Konstruktion / Destruktion
|
||||
// --------------------------
|
||||
RenderObject::RenderObject(RenderObjectPtr<RenderObject> ParentPtr, TYPES Type, unsigned int Handle) :
|
||||
RenderObject::RenderObject(RenderObjectPtr<RenderObject> ParentPtr, TYPES Type, uint Handle) :
|
||||
m_ManagerPtr(0),
|
||||
m_ParentPtr(ParentPtr),
|
||||
m_X(0),
|
||||
@ -347,7 +347,7 @@ RenderObjectPtr<Bitmap> RenderObject::AddBitmap(const Common::String &Filename)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
RenderObjectPtr<Bitmap> RenderObject::AddDynamicBitmap(unsigned int Width, unsigned int Height) {
|
||||
RenderObjectPtr<Bitmap> RenderObject::AddDynamicBitmap(uint Width, uint Height) {
|
||||
RenderObjectPtr<Bitmap> BitmapPtr((new DynamicBitmap(this->GetHandle(), Width, Height))->GetHandle());
|
||||
if (BitmapPtr.IsValid() && BitmapPtr->GetInitSuccess())
|
||||
return BitmapPtr;
|
||||
@ -359,7 +359,7 @@ RenderObjectPtr<Bitmap> RenderObject::AddDynamicBitmap(unsigned int Width, unsig
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
RenderObjectPtr<Panel> RenderObject::AddPanel(int Width, int Height, unsigned int Color) {
|
||||
RenderObjectPtr<Panel> RenderObject::AddPanel(int Width, int Height, uint Color) {
|
||||
RenderObjectPtr<Panel> PanelPtr((new Panel(this->GetHandle(), Width, Height, Color))->GetHandle());
|
||||
if (PanelPtr.IsValid() && PanelPtr->GetInitSuccess())
|
||||
return PanelPtr;
|
||||
@ -387,7 +387,7 @@ RenderObjectPtr<Text> RenderObject::AddText(const Common::String &Font, const Co
|
||||
|
||||
bool RenderObject::Persist(OutputPersistenceBlock &Writer) {
|
||||
// Typ und Handle werden als erstes gespeichert, damit beim Laden ein Objekt vom richtigen Typ mit dem richtigen Handle erzeugt werden kann.
|
||||
Writer.Write(static_cast<unsigned int>(m_Type));
|
||||
Writer.Write(static_cast<uint>(m_Type));
|
||||
Writer.Write(m_Handle);
|
||||
|
||||
// Restliche Objekteigenschaften speichern.
|
||||
@ -445,7 +445,7 @@ bool RenderObject::Unpersist(InputPersistenceBlock &Reader) {
|
||||
Reader.Read(m_OldY);
|
||||
Reader.Read(m_OldZ);
|
||||
Reader.Read(m_OldVisible);
|
||||
unsigned int ParentHandle;
|
||||
uint ParentHandle;
|
||||
Reader.Read(ParentHandle);
|
||||
m_ParentPtr = RenderObjectPtr<RenderObject>(ParentHandle);
|
||||
Reader.Read(m_RefreshForced);
|
||||
@ -480,12 +480,12 @@ bool RenderObject::UnpersistChildren(InputPersistenceBlock &Reader) {
|
||||
bool Result = true;
|
||||
|
||||
// Kinderanzahl einlesen.
|
||||
unsigned int ChildrenCount;
|
||||
uint ChildrenCount;
|
||||
Reader.Read(ChildrenCount);
|
||||
if (!Reader.IsGood()) return false;
|
||||
|
||||
// Alle Kinder rekursiv wieder herstellen.
|
||||
for (unsigned int i = 0; i < ChildrenCount; ++i) {
|
||||
for (uint i = 0; i < ChildrenCount; ++i) {
|
||||
if (!RecreatePersistedRenderObject(Reader).IsValid()) return false;
|
||||
}
|
||||
|
||||
@ -498,8 +498,8 @@ RenderObjectPtr<RenderObject> RenderObject::RecreatePersistedRenderObject(InputP
|
||||
RenderObjectPtr<RenderObject> Result;
|
||||
|
||||
// Typ und Handle auslesen.
|
||||
unsigned int Type;
|
||||
unsigned int Handle;
|
||||
uint Type;
|
||||
uint Handle;
|
||||
Reader.Read(Type);
|
||||
Reader.Read(Handle);
|
||||
if (!Reader.IsGood()) return Result;
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
@return Gibt einen BS_RenderObjectPtr auf das erzeugte Objekt zurück.<br>
|
||||
Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben.
|
||||
*/
|
||||
RenderObjectPtr<Bitmap> AddDynamicBitmap(unsigned int Width, unsigned int Height);
|
||||
RenderObjectPtr<Bitmap> AddDynamicBitmap(uint Width, uint Height);
|
||||
/**
|
||||
@brief Erzeugt eine Animation auf Basis einer Animationsdatei als Kinderobjekt des Renderobjektes.
|
||||
@param FileName der Dateiname der Quelldatei
|
||||
@ -138,7 +138,7 @@ public:
|
||||
Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben.
|
||||
*/
|
||||
|
||||
RenderObjectPtr<Panel> AddPanel(int Width, int Height, unsigned int Color = 0xff000000);
|
||||
RenderObjectPtr<Panel> AddPanel(int Width, int Height, uint Color = 0xff000000);
|
||||
/**
|
||||
@brief Erzeugt ein Textobjekt als Kinderobjekt des Renderobjektes.
|
||||
@param Font der Dateiname des zu verwendenen Fonts
|
||||
@ -206,7 +206,7 @@ public:
|
||||
Es ist nicht notwendig alle BS_RenderObject Instanzen einzeln zu löschen. Dieses geschiet automatisch beim Löschen eines
|
||||
Vorfahren oder beim Löschen des zuständigen BS_RenderObjectManager.
|
||||
*/
|
||||
RenderObject(RenderObjectPtr<RenderObject> pParent, TYPES Type, unsigned int Handle = 0);
|
||||
RenderObject(RenderObjectPtr<RenderObject> pParent, TYPES Type, uint Handle = 0);
|
||||
virtual ~RenderObject();
|
||||
|
||||
// Interface
|
||||
@ -348,7 +348,7 @@ public:
|
||||
/**
|
||||
@brief Gibt das Handle des Objekte zurück.
|
||||
*/
|
||||
unsigned int GetHandle() const {
|
||||
uint GetHandle() const {
|
||||
return m_Handle;
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ private:
|
||||
/// Ist true, wenn das Objekt in nächsten Frame neu gezeichnet werden soll
|
||||
bool m_RefreshForced;
|
||||
|
||||
unsigned int m_Handle;
|
||||
uint m_Handle;
|
||||
|
||||
/**
|
||||
@brief Entfernt ein Objekt aus der Kinderliste.
|
||||
|
@ -158,10 +158,10 @@ bool RenderObjectManager::Unpersist(InputPersistenceBlock &Reader) {
|
||||
m_TimedRenderObjects.resize(0);
|
||||
|
||||
// Referenzen auf die TimedRenderObjects wieder herstellen.
|
||||
unsigned int TimedObjectCount;
|
||||
uint TimedObjectCount;
|
||||
Reader.Read(TimedObjectCount);
|
||||
for (unsigned int i = 0; i < TimedObjectCount; ++i) {
|
||||
unsigned int Handle;
|
||||
for (uint i = 0; i < TimedObjectCount; ++i) {
|
||||
uint Handle;
|
||||
Reader.Read(Handle);
|
||||
m_TimedRenderObjects.push_back(Handle);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class RenderObjectPtr {
|
||||
public:
|
||||
RenderObjectPtr() : m_Handle(0) {}
|
||||
|
||||
RenderObjectPtr(unsigned int Handle) : m_Handle(Handle) {}
|
||||
RenderObjectPtr(uint Handle) : m_Handle(Handle) {}
|
||||
|
||||
T *operator->() const {
|
||||
return static_cast<T *>(RenderObjectRegistry::GetInstance().ResolveHandle(m_Handle));
|
||||
@ -79,7 +79,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int m_Handle;
|
||||
uint m_Handle;
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -57,7 +57,7 @@ struct RGB_PIXEL {
|
||||
byte Blue;
|
||||
};
|
||||
|
||||
bool Screenshot::SaveToFile(unsigned int Width, unsigned int Height, const byte *Data, const Common::String &Filename) {
|
||||
bool Screenshot::SaveToFile(uint Width, uint Height, const byte *Data, const Common::String &Filename) {
|
||||
#if 0
|
||||
BS_ASSERT(Data.size() == Width * Height);
|
||||
|
||||
@ -66,10 +66,10 @@ bool Screenshot::SaveToFile(unsigned int Width, unsigned int Height, const byte
|
||||
PixelBuffer.reserve(Width * Height);
|
||||
|
||||
// Framebufferdaten pixelweise von RGBA nach RGB konvertieren
|
||||
vector<unsigned int>::const_iterator it = Data.begin();
|
||||
for (unsigned int y = 0; y < Height; y++) {
|
||||
for (unsigned int x = 0; x < Width; x++) {
|
||||
unsigned int SrcPixel = *it++;
|
||||
vector<uint>::const_iterator it = Data.begin();
|
||||
for (uint y = 0; y < Height; y++) {
|
||||
for (uint x = 0; x < Width; x++) {
|
||||
uint SrcPixel = *it++;
|
||||
PixelBuffer.push_back(RGB_PIXEL((SrcPixel >> 16) & 0xff, (SrcPixel >> 8) & 0xff, SrcPixel & 0xff));
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ bool Screenshot::SaveToFile(unsigned int Width, unsigned int Height, const byte
|
||||
// Rowpointer erstellen
|
||||
vector<png_bytep> RowPointers;
|
||||
RowPointers.reserve(Height);
|
||||
for (unsigned int i = 0; i < Height; i++) {
|
||||
for (uint i = 0; i < Height; i++) {
|
||||
RowPointers.push_back((png_bytep)(&PixelBuffer[Width * i]));
|
||||
}
|
||||
png_set_rows(png_ptr, info_ptr, &RowPointers[0]);
|
||||
@ -154,7 +154,7 @@ bool Screenshot::SaveToFile(unsigned int Width, unsigned int Height, const byte
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool Screenshot::SaveThumbnailToFile(unsigned int Width, unsigned int Height, const byte *Data, const Common::String &Filename) {
|
||||
bool Screenshot::SaveThumbnailToFile(uint Width, uint Height, const byte *Data, const Common::String &Filename) {
|
||||
#if 0
|
||||
//
|
||||
// Diese Methode nimmt ein Screenshot mit den Maßen von 800x600 und erzeugt einen Screenshot mit den Maßen von 200x125.
|
||||
@ -170,18 +170,18 @@ bool Screenshot::SaveThumbnailToFile(unsigned int Width, unsigned int Height, co
|
||||
}
|
||||
|
||||
// Buffer für die Zieldaten erstellen (RGBA Bild mit den Maßen 200x125).
|
||||
vector<unsigned int> ThumbnailData(200 * 125);
|
||||
vector<uint> ThumbnailData(200 * 125);
|
||||
|
||||
// Über das Zielbild iterieren und einen Pixel zur Zeit berechnen.
|
||||
unsigned int x, y;
|
||||
uint x, y;
|
||||
x = y = 0;
|
||||
for (vector<unsigned int>::iterator Iter = ThumbnailData.begin(); Iter != ThumbnailData.end(); ++Iter) {
|
||||
for (vector<uint>::iterator Iter = ThumbnailData.begin(); Iter != ThumbnailData.end(); ++Iter) {
|
||||
// Durchschnitt über 4x4 Pixelblock im Quellbild bilden.
|
||||
unsigned int Alpha, Red, Green, Blue;
|
||||
uint Alpha, Red, Green, Blue;
|
||||
Alpha = Red = Green = Blue = 0;
|
||||
for (unsigned int j = 0; j < 4; ++j) {
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
unsigned int Pixel = Data[((y * 4) + j + 50) * 800 + ((x * 4) + i)];
|
||||
for (uint j = 0; j < 4; ++j) {
|
||||
for (uint i = 0; i < 4; ++i) {
|
||||
uint Pixel = Data[((y * 4) + j + 50) * 800 + ((x * 4) + i)];
|
||||
Alpha += (Pixel >> 24);
|
||||
Red += (Pixel >> 16) & 0xff;
|
||||
Green += (Pixel >> 8) & 0xff;
|
||||
|
@ -49,8 +49,8 @@ namespace Sword25 {
|
||||
|
||||
class Screenshot {
|
||||
public:
|
||||
static bool SaveToFile(unsigned int Width, unsigned int Height, const byte *Data, const Common::String &Filename);
|
||||
static bool SaveThumbnailToFile(unsigned int Width, unsigned int Height, const byte *Data, const Common::String &Filename);
|
||||
static bool SaveToFile(uint Width, uint Height, const byte *Data, const Common::String &Filename);
|
||||
static bool SaveThumbnailToFile(uint Width, uint Height, const byte *Data, const Common::String &Filename);
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -64,7 +64,7 @@ StaticBitmap::StaticBitmap(RenderObjectPtr<RenderObject> ParentPtr, const Common
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
StaticBitmap::StaticBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle) :
|
||||
StaticBitmap::StaticBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle) :
|
||||
Bitmap(ParentPtr, TYPE_STATICBITMAP, Handle) {
|
||||
m_InitSuccess = Unpersist(Reader);
|
||||
}
|
||||
@ -138,21 +138,21 @@ bool StaticBitmap::DoRender() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int StaticBitmap::GetPixel(int X, int Y) const {
|
||||
uint StaticBitmap::GetPixel(int X, int Y) const {
|
||||
BS_ASSERT(X >= 0 && X < m_Width);
|
||||
BS_ASSERT(Y >= 0 && Y < m_Height);
|
||||
|
||||
Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(m_ResourceFilename);
|
||||
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
|
||||
BitmapResource *pBitmapResource = static_cast<BitmapResource *>(pResource);
|
||||
unsigned int Result = pBitmapResource->GetPixel(X, Y);
|
||||
uint Result = pBitmapResource->GetPixel(X, Y);
|
||||
pResource->Release();
|
||||
return Result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool StaticBitmap::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
|
||||
bool StaticBitmap::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) {
|
||||
BS_LOG_ERRORLN("SetContent() ist not supported with this object.");
|
||||
return false;
|
||||
}
|
||||
|
@ -56,14 +56,14 @@ private:
|
||||
@remark Filename muss absoluter Pfad sein
|
||||
*/
|
||||
StaticBitmap(RenderObjectPtr<RenderObject> ParentPtr, const Common::String &Filename);
|
||||
StaticBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle);
|
||||
StaticBitmap(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle);
|
||||
|
||||
public:
|
||||
virtual ~StaticBitmap();
|
||||
|
||||
virtual unsigned int GetPixel(int X, int Y) const;
|
||||
virtual uint GetPixel(int X, int Y) const;
|
||||
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
|
||||
virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride);
|
||||
|
||||
virtual bool IsScalingAllowed() const;
|
||||
virtual bool IsAlphaAllowed() const;
|
||||
|
@ -57,7 +57,7 @@ namespace Sword25 {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
const unsigned int AUTO_WRAP_THRESHOLD_DEFAULT = 300;
|
||||
const uint AUTO_WRAP_THRESHOLD_DEFAULT = 300;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -74,7 +74,7 @@ Text::Text(RenderObjectPtr<RenderObject> ParentPtr) :
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Text::Text(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle) :
|
||||
Text::Text(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle) :
|
||||
RenderObject(ParentPtr, TYPE_TEXT, Handle) {
|
||||
m_InitSuccess = Unpersist(Reader);
|
||||
}
|
||||
@ -105,8 +105,8 @@ void Text::SetText(const Common::String &text) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Text::SetColor(unsigned int ModulationColor) {
|
||||
unsigned int NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000);
|
||||
void Text::SetColor(uint ModulationColor) {
|
||||
uint NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000);
|
||||
if (NewModulationColor != m_ModulationColor) {
|
||||
m_ModulationColor = NewModulationColor;
|
||||
ForceRefresh();
|
||||
@ -117,7 +117,7 @@ void Text::SetColor(unsigned int ModulationColor) {
|
||||
|
||||
void Text::SetAlpha(int Alpha) {
|
||||
BS_ASSERT(Alpha >= 0 && Alpha < 256);
|
||||
unsigned int NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24;
|
||||
uint NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24;
|
||||
if (NewModulationColor != m_ModulationColor) {
|
||||
m_ModulationColor = NewModulationColor;
|
||||
ForceRefresh();
|
||||
@ -136,7 +136,7 @@ void Text::SetAutoWrap(bool AutoWrap) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Text::SetAutoWrapThreshold(unsigned int AutoWrapThreshold) {
|
||||
void Text::SetAutoWrapThreshold(uint AutoWrapThreshold) {
|
||||
if (AutoWrapThreshold != m_AutoWrapThreshold) {
|
||||
m_AutoWrapThreshold = AutoWrapThreshold;
|
||||
UpdateFormat();
|
||||
@ -182,7 +182,7 @@ bool Text::DoRender() {
|
||||
// Jeden Buchstaben einzeln Rendern.
|
||||
int CurX = m_AbsoluteX + (*Iter).BBox.left;
|
||||
int CurY = m_AbsoluteY + (*Iter).BBox.top;
|
||||
for (unsigned int i = 0; i < (*Iter).Text.size(); ++i) {
|
||||
for (uint i = 0; i < (*Iter).Text.size(); ++i) {
|
||||
Common::Rect CurRect = FontPtr->GetCharacterRect((byte)(*Iter).Text[i]);
|
||||
|
||||
Common::Rect RenderRect(CurX, CurY, CurX + CurRect.width(), CurY + CurRect.height());
|
||||
@ -245,16 +245,16 @@ void Text::UpdateFormat() {
|
||||
UpdateMetrics(*FontPtr);
|
||||
|
||||
m_Lines.resize(1);
|
||||
if (m_AutoWrap && (unsigned int) m_Width >= m_AutoWrapThreshold && m_Text.size() >= 2) {
|
||||
if (m_AutoWrap && (uint) m_Width >= m_AutoWrapThreshold && m_Text.size() >= 2) {
|
||||
m_Width = 0;
|
||||
unsigned int CurLineWidth = 0;
|
||||
unsigned int CurLineHeight = 0;
|
||||
unsigned int CurLine = 0;
|
||||
unsigned int TempLineWidth = 0;
|
||||
unsigned int LastSpace = 0; // we need at least 1 space character to start a new line...
|
||||
uint CurLineWidth = 0;
|
||||
uint CurLineHeight = 0;
|
||||
uint CurLine = 0;
|
||||
uint TempLineWidth = 0;
|
||||
uint LastSpace = 0; // we need at least 1 space character to start a new line...
|
||||
m_Lines[0].Text = "";
|
||||
for (unsigned int i = 0; i < m_Text.size(); ++i) {
|
||||
unsigned int j;
|
||||
for (uint i = 0; i < m_Text.size(); ++i) {
|
||||
uint j;
|
||||
TempLineWidth = 0;
|
||||
LastSpace = 0;
|
||||
for (j = i; j < m_Text.size(); ++j) {
|
||||
@ -278,12 +278,12 @@ void Text::UpdateFormat() {
|
||||
const Common::Rect &CurCharRect = FontPtr->GetCharacterRect((byte)m_Text[j]);
|
||||
CurLineWidth += CurCharRect.width();
|
||||
CurLineWidth += FontPtr->GetGapWidth();
|
||||
if ((unsigned int) CurCharRect.height() > CurLineHeight) CurLineHeight = CurCharRect.height();
|
||||
if ((uint) CurCharRect.height() > CurLineHeight) CurLineHeight = CurCharRect.height();
|
||||
}
|
||||
|
||||
m_Lines[CurLine].BBox.right = CurLineWidth;
|
||||
m_Lines[CurLine].BBox.bottom = CurLineHeight;
|
||||
if ((unsigned int) m_Width < CurLineWidth) m_Width = CurLineWidth;
|
||||
if ((uint) m_Width < CurLineWidth) m_Width = CurLineWidth;
|
||||
|
||||
if (LastSpace < m_Text.size()) {
|
||||
++CurLine;
|
||||
@ -321,7 +321,7 @@ void Text::UpdateMetrics(FontResource &FontResource) {
|
||||
m_Width = 0;
|
||||
m_Height = 0;
|
||||
|
||||
for (unsigned int i = 0; i < m_Text.size(); ++i) {
|
||||
for (uint i = 0; i < m_Text.size(); ++i) {
|
||||
const Common::Rect &CurRect = FontResource.GetCharacterRect((byte)m_Text[i]);
|
||||
m_Width += CurRect.width();
|
||||
if (i != m_Text.size() - 1) m_Width += FontResource.GetGapWidth();
|
||||
@ -372,7 +372,7 @@ bool Text::Unpersist(InputPersistenceBlock &Reader) {
|
||||
Reader.Read(AutoWrap);
|
||||
SetAutoWrap(AutoWrap);
|
||||
|
||||
unsigned int AutoWrapThreshold;
|
||||
uint AutoWrapThreshold;
|
||||
Reader.Read(AutoWrapThreshold);
|
||||
SetAutoWrapThreshold(AutoWrapThreshold);
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
@remark Dieses Attribut wird mit dem Wert 300 initialisiert.
|
||||
@remark Eine automatische Formatierung wird nur vorgenommen, wenn diese durch einen Aufruf von SetAutoWrap() aktiviert wurde.
|
||||
*/
|
||||
void SetAutoWrapThreshold(unsigned int AutoWrapThreshold);
|
||||
void SetAutoWrapThreshold(uint AutoWrapThreshold);
|
||||
|
||||
/**
|
||||
@brief Gibt den dargestellten Text zurück.
|
||||
@ -115,7 +115,7 @@ public:
|
||||
@brief Setzt die Farbe des Textes.
|
||||
@param Color eine 24-Bit RGB Farbe, die die Farbe des Textes festlegt.
|
||||
*/
|
||||
void SetColor(unsigned int ModulationColor);
|
||||
void SetColor(uint ModulationColor);
|
||||
|
||||
/**
|
||||
@brief Gibt den Alphawert des Textes zurück.
|
||||
@ -143,7 +143,7 @@ public:
|
||||
/**
|
||||
@brief Gibt die Längengrenze des Textes in Pixeln zurück, ab der eine automatische Formatierung vorgenommen wird.
|
||||
*/
|
||||
unsigned int GetAutoWrapThreshold() const {
|
||||
uint GetAutoWrapThreshold() const {
|
||||
return m_AutoWrapThreshold;
|
||||
}
|
||||
|
||||
@ -155,13 +155,13 @@ protected:
|
||||
|
||||
private:
|
||||
Text(RenderObjectPtr<RenderObject> ParentPtr);
|
||||
Text(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, unsigned int Handle);
|
||||
Text(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle);
|
||||
|
||||
unsigned int m_ModulationColor;
|
||||
uint m_ModulationColor;
|
||||
Common::String m_Font;
|
||||
Common::String m_Text;
|
||||
bool m_AutoWrap;
|
||||
unsigned int m_AutoWrapThreshold;
|
||||
uint m_AutoWrapThreshold;
|
||||
|
||||
struct LINE {
|
||||
Common::Rect BBox;
|
||||
|
@ -42,7 +42,7 @@ namespace Sword25 {
|
||||
// Konstruktion / Destruktion
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
TimedRenderObject::TimedRenderObject(RenderObjectPtr<RenderObject> pParent, TYPES Type, unsigned int Handle) :
|
||||
TimedRenderObject::TimedRenderObject(RenderObjectPtr<RenderObject> pParent, TYPES Type, uint Handle) :
|
||||
RenderObject(pParent, Type, Handle) {
|
||||
BS_ASSERT(GetManager());
|
||||
GetManager()->AttatchTimedRenderObject(this->GetHandle());
|
||||
|
@ -59,7 +59,7 @@ namespace Sword25 {
|
||||
|
||||
class TimedRenderObject : public RenderObject {
|
||||
public:
|
||||
TimedRenderObject(RenderObjectPtr<RenderObject> pParent, TYPES Type, unsigned int Handle = 0);
|
||||
TimedRenderObject(RenderObjectPtr<RenderObject> pParent, TYPES Type, uint Handle = 0);
|
||||
~TimedRenderObject();
|
||||
|
||||
/**
|
||||
|
@ -243,7 +243,7 @@ public:
|
||||
* @param KeyCode The key code to be checked
|
||||
* @return Returns true if the given key is done, otherwise false.
|
||||
*/
|
||||
virtual bool IsKeyDown(unsigned int KeyCode) = 0;
|
||||
virtual bool IsKeyDown(uint KeyCode) = 0;
|
||||
|
||||
/**
|
||||
* Returns true if a certain key was pushed and released.
|
||||
@ -253,7 +253,7 @@ public:
|
||||
* strings that users type.
|
||||
* @param KeyCode The key code to be checked
|
||||
*/
|
||||
virtual bool WasKeyDown(unsigned int KeyCode) = 0;
|
||||
virtual bool WasKeyDown(uint KeyCode) = 0;
|
||||
|
||||
typedef CallbackPtr CharacterCallback;
|
||||
|
||||
|
@ -210,7 +210,7 @@ static int GetMouseY(lua_State *L) {
|
||||
static int IsKeyDown(lua_State *L) {
|
||||
InputEngine *pIE = GetIE();
|
||||
|
||||
lua_pushbooleancpp(L, pIE->IsKeyDown((unsigned int) luaL_checknumber(L, 1)));
|
||||
lua_pushbooleancpp(L, pIE->IsKeyDown((uint) luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ static int IsKeyDown(lua_State *L) {
|
||||
static int WasKeyDown(lua_State *L) {
|
||||
InputEngine *pIE = GetIE();
|
||||
|
||||
lua_pushbooleancpp(L, pIE->WasKeyDown((unsigned int) luaL_checknumber(L, 1)));
|
||||
lua_pushbooleancpp(L, pIE->WasKeyDown((uint) luaL_checknumber(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ void ScummVMInput::TestForLeftDoubleClick() {
|
||||
// Only bother checking for a double click if the left mouse button was clicked
|
||||
if (WasLeftMouseDown()) {
|
||||
// Get the time now
|
||||
unsigned int Now = Kernel::GetInstance()->GetMilliTicks();
|
||||
uint Now = Kernel::GetInstance()->GetMilliTicks();
|
||||
|
||||
// A double click is signalled if
|
||||
// 1. The two clicks are close enough together
|
||||
@ -224,13 +224,13 @@ int ScummVMInput::GetMouseY() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool ScummVMInput::IsKeyDown(unsigned int KeyCode) {
|
||||
bool ScummVMInput::IsKeyDown(uint KeyCode) {
|
||||
return (m_KeyboardState[m_CurrentState][KeyCode] & 0x80) != 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool ScummVMInput::WasKeyDown(unsigned int KeyCode) {
|
||||
bool ScummVMInput::WasKeyDown(uint KeyCode) {
|
||||
return ((m_KeyboardState[m_CurrentState][KeyCode] & 0x80) == 0) &&
|
||||
((m_KeyboardState[m_CurrentState ^ 1][KeyCode] & 0x80) != 0);
|
||||
}
|
||||
@ -370,11 +370,11 @@ bool ScummVMInput::Unpersist(InputPersistenceBlock &Reader) {
|
||||
m_CommandCallbacks.clear();
|
||||
|
||||
// Anzahl an Command-Callbacks lesen.
|
||||
unsigned int CommandCallbackCount;
|
||||
uint CommandCallbackCount;
|
||||
Reader.Read(CommandCallbackCount);
|
||||
|
||||
// Alle Command-Callbacks wieder herstellen.
|
||||
for (unsigned int i = 0; i < CommandCallbackCount; ++i) {
|
||||
for (uint i = 0; i < CommandCallbackCount; ++i) {
|
||||
Common::String CallbackFunctionName;
|
||||
Reader.Read(CallbackFunctionName);
|
||||
|
||||
@ -386,11 +386,11 @@ bool ScummVMInput::Unpersist(InputPersistenceBlock &Reader) {
|
||||
m_CharacterCallbacks.clear();
|
||||
|
||||
// Anzahl an Character-Callbacks lesen.
|
||||
unsigned int CharacterCallbackCount;
|
||||
uint CharacterCallbackCount;
|
||||
Reader.Read(CharacterCallbackCount);
|
||||
|
||||
// Alle Character-Callbacks wieder herstellen.
|
||||
for (unsigned int i = 0; i < CharacterCallbackCount; ++i) {
|
||||
for (uint i = 0; i < CharacterCallbackCount; ++i) {
|
||||
Common::String CallbackFunctionName;
|
||||
Reader.Read(CallbackFunctionName);
|
||||
|
||||
|
@ -61,8 +61,8 @@ public:
|
||||
virtual bool IsLeftDoubleClick();
|
||||
virtual int GetMouseX();
|
||||
virtual int GetMouseY();
|
||||
virtual bool IsKeyDown(unsigned int KeyCode);
|
||||
virtual bool WasKeyDown(unsigned int KeyCode);
|
||||
virtual bool IsKeyDown(uint KeyCode);
|
||||
virtual bool WasKeyDown(uint KeyCode);
|
||||
virtual void SetMouseX(int PosX);
|
||||
virtual void SetMouseY(int PosY);
|
||||
virtual bool RegisterCharacterCallback(CallbackPtr Callback);
|
||||
@ -82,16 +82,16 @@ private:
|
||||
byte m_KeyboardState[2][256];
|
||||
bool m_LeftMouseState[2];
|
||||
bool m_RightMouseState[2];
|
||||
unsigned int m_CurrentState;
|
||||
uint m_CurrentState;
|
||||
int m_MouseX;
|
||||
int m_MouseY;
|
||||
bool m_LeftMouseDown;
|
||||
bool m_RightMouseDown;
|
||||
bool m_LeftDoubleClick;
|
||||
unsigned int m_DoubleClickTime;
|
||||
uint m_DoubleClickTime;
|
||||
int m_DoubleClickRectWidth;
|
||||
int m_DoubleClickRectHeight;
|
||||
unsigned int m_LastLeftClickTime;
|
||||
uint m_LastLeftClickTime;
|
||||
int m_LastLeftClickMouseX;
|
||||
int m_LastLeftClickMouseY;
|
||||
Common::List<CommandCallback> m_CommandCallbacks;
|
||||
|
@ -46,7 +46,7 @@ namespace Sword25 {
|
||||
// Constructor / Destructor
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
InputPersistenceBlock::InputPersistenceBlock(const void *Data, unsigned int DataLength) :
|
||||
InputPersistenceBlock::InputPersistenceBlock(const void *Data, uint DataLength) :
|
||||
m_Data(static_cast<const byte *>(Data), DataLength),
|
||||
m_ErrorState(NONE) {
|
||||
m_Iter = m_Data.begin();
|
||||
@ -81,9 +81,9 @@ void InputPersistenceBlock::Read(signed int &Value) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void InputPersistenceBlock::Read(unsigned int &Value) {
|
||||
void InputPersistenceBlock::Read(uint &Value) {
|
||||
if (CheckMarker(UINT_MARKER)) {
|
||||
RawRead(&Value, sizeof(unsigned int));
|
||||
RawRead(&Value, sizeof(uint));
|
||||
Value = ConvertEndianessFromStorageToSystem(Value);
|
||||
} else {
|
||||
Value = 0;
|
||||
@ -105,7 +105,7 @@ void InputPersistenceBlock::Read(float &Value) {
|
||||
|
||||
void InputPersistenceBlock::Read(bool &Value) {
|
||||
if (CheckMarker(BOOL_MARKER)) {
|
||||
unsigned int UIntBool;
|
||||
uint UIntBool;
|
||||
RawRead(&UIntBool, sizeof(float));
|
||||
UIntBool = ConvertEndianessFromStorageToSystem(UIntBool);
|
||||
Value = UIntBool == 0 ? false : true;
|
||||
@ -120,7 +120,7 @@ void InputPersistenceBlock::Read(Common::String &Value) {
|
||||
Value = "";
|
||||
|
||||
if (CheckMarker(STRING_MARKER)) {
|
||||
unsigned int Size;
|
||||
uint Size;
|
||||
Read(Size);
|
||||
|
||||
if (CheckBlockSize(Size)) {
|
||||
@ -134,7 +134,7 @@ void InputPersistenceBlock::Read(Common::String &Value) {
|
||||
|
||||
void InputPersistenceBlock::Read(Common::Array<byte> &Value) {
|
||||
if (CheckMarker(BLOCK_MARKER)) {
|
||||
unsigned int Size;
|
||||
uint Size;
|
||||
Read(Size);
|
||||
|
||||
if (CheckBlockSize(Size)) {
|
||||
|
@ -57,12 +57,12 @@ public:
|
||||
OUT_OF_SYNC
|
||||
};
|
||||
|
||||
InputPersistenceBlock(const void *Data, unsigned int DataLength);
|
||||
InputPersistenceBlock(const void *Data, uint DataLength);
|
||||
virtual ~InputPersistenceBlock();
|
||||
|
||||
void Read(int16 &Value);
|
||||
void Read(signed int &Value);
|
||||
void Read(unsigned int &Value);
|
||||
void Read(uint &Value);
|
||||
void Read(float &Value);
|
||||
void Read(bool &Value);
|
||||
void Read(Common::String &Value);
|
||||
|
@ -134,7 +134,7 @@ Kernel::Superclass::Superclass(Kernel *pKernel, const Common::String &Identifier
|
||||
_Identifier(Identifier),
|
||||
_ServiceCount(0),
|
||||
_ActiveService(NULL) {
|
||||
for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++)
|
||||
for (uint i = 0; i < BS_SERVICE_COUNT; i++)
|
||||
if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier)
|
||||
_ServiceCount++;
|
||||
}
|
||||
@ -152,11 +152,11 @@ Kernel::Superclass::~Superclass() {
|
||||
* Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen
|
||||
* 0 und GetServiceCount() - 1 sein.
|
||||
*/
|
||||
Common::String Kernel::Superclass::GetServiceIdentifier(unsigned int Number) {
|
||||
Common::String Kernel::Superclass::GetServiceIdentifier(uint Number) {
|
||||
if (Number > _ServiceCount) return NULL;
|
||||
|
||||
unsigned int CurServiceOrd = 0;
|
||||
for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++) {
|
||||
uint CurServiceOrd = 0;
|
||||
for (uint i = 0; i < BS_SERVICE_COUNT; i++) {
|
||||
if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier) {
|
||||
if (Number == CurServiceOrd)
|
||||
return BS_SERVICE_TABLE[i].ServiceIdentifier;
|
||||
@ -178,7 +178,7 @@ Common::String Kernel::Superclass::GetServiceIdentifier(unsigned int Number) {
|
||||
* For the superclass "sfx" an example could be "Fmod" or "directsound"
|
||||
*/
|
||||
Service *Kernel::Superclass::NewService(const Common::String &ServiceIdentifier) {
|
||||
for (unsigned int i = 0; i < BS_SERVICE_COUNT; i++)
|
||||
for (uint i = 0; i < BS_SERVICE_COUNT; i++)
|
||||
if (BS_SERVICE_TABLE[i].SuperclassIdentifier == _Identifier &&
|
||||
BS_SERVICE_TABLE[i].ServiceIdentifier == ServiceIdentifier) {
|
||||
Service *NewService_ = BS_SERVICE_TABLE[i].CreateMethod(_pKernel);
|
||||
@ -230,7 +230,7 @@ Kernel::Superclass *Kernel::GetSuperclassByIdentifier(const Common::String &Iden
|
||||
/**
|
||||
* Returns the number of register superclasses
|
||||
*/
|
||||
unsigned int Kernel::GetSuperclassCount() {
|
||||
uint Kernel::GetSuperclassCount() {
|
||||
return _SuperclassList.size();
|
||||
}
|
||||
|
||||
@ -240,10 +240,10 @@ unsigned int Kernel::GetSuperclassCount() {
|
||||
* @param Number The number of the superclass to return the identifier for.
|
||||
* It should be noted that the number should be between 0 und GetSuperclassCount() - 1.
|
||||
*/
|
||||
Common::String Kernel::GetSuperclassIdentifier(unsigned int Number) {
|
||||
Common::String Kernel::GetSuperclassIdentifier(uint Number) {
|
||||
if (Number > _SuperclassList.size()) return NULL;
|
||||
|
||||
unsigned int CurSuperclassOrd = 0;
|
||||
uint CurSuperclassOrd = 0;
|
||||
Common::Array<Superclass *>::iterator Iter;
|
||||
for (Iter = _SuperclassList.begin(); Iter != _SuperclassList.end(); ++Iter) {
|
||||
if (CurSuperclassOrd == Number)
|
||||
@ -260,7 +260,7 @@ Common::String Kernel::GetSuperclassIdentifier(unsigned int Number) {
|
||||
* @param SuperclassIdentifier The name of the superclass
|
||||
* z.B: "sfx", "gfx", "package" ...
|
||||
*/
|
||||
unsigned int Kernel::GetServiceCount(const Common::String &SuperclassIdentifier) {
|
||||
uint Kernel::GetServiceCount(const Common::String &SuperclassIdentifier) {
|
||||
Superclass *pSuperclass;
|
||||
if (!(pSuperclass = GetSuperclassByIdentifier(SuperclassIdentifier)))
|
||||
return 0;
|
||||
@ -278,7 +278,7 @@ unsigned int Kernel::GetServiceCount(const Common::String &SuperclassIdentifier)
|
||||
* Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen
|
||||
* 0 und GetServiceCount() - 1 sein.
|
||||
*/
|
||||
Common::String Kernel::GetServiceIdentifier(const Common::String &SuperclassIdentifier, unsigned int Number) {
|
||||
Common::String Kernel::GetServiceIdentifier(const Common::String &SuperclassIdentifier, uint Number) {
|
||||
Superclass *pSuperclass;
|
||||
if (!(pSuperclass = GetSuperclassByIdentifier(SuperclassIdentifier))) return NULL;
|
||||
|
||||
@ -358,7 +358,7 @@ int Kernel::GetRandomNumber(int Min, int Max) {
|
||||
/**
|
||||
* Returns the elapsed time since startup in milliseconds
|
||||
*/
|
||||
unsigned int Kernel::GetMilliTicks() {
|
||||
uint Kernel::GetMilliTicks() {
|
||||
return g_system->getMillis();
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ MoviePlayer *Kernel::GetFMV() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Kernel::Sleep(unsigned int Msecs) const {
|
||||
void Kernel::Sleep(uint Msecs) const {
|
||||
g_system->delayMillis(Msecs);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
/**
|
||||
* Returns the number of register superclasses
|
||||
*/
|
||||
unsigned int GetSuperclassCount();
|
||||
uint GetSuperclassCount();
|
||||
|
||||
/**
|
||||
* Returns the name of a superclass with the specified index.
|
||||
@ -134,14 +134,14 @@ public:
|
||||
* @param Number The number of the superclass to return the identifier for.
|
||||
* It should be noted that the number should be between 0 und GetSuperclassCount() - 1.
|
||||
*/
|
||||
Common::String GetSuperclassIdentifier(unsigned int Number);
|
||||
Common::String GetSuperclassIdentifier(uint Number);
|
||||
|
||||
/**
|
||||
* Returns the number of services registered with a given superclass
|
||||
* @param SuperclassIdentifier The name of the superclass
|
||||
* z.B: "sfx", "gfx", "package" ...
|
||||
*/
|
||||
unsigned int GetServiceCount(const Common::String &SuperclassIdentifier);
|
||||
uint GetServiceCount(const Common::String &SuperclassIdentifier);
|
||||
|
||||
/**
|
||||
* Gets the identifier of a service with a given superclass.
|
||||
@ -152,12 +152,12 @@ public:
|
||||
* Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen
|
||||
* 0 und GetServiceCount() - 1 sein.
|
||||
*/
|
||||
Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, unsigned int Number);
|
||||
Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, uint Number);
|
||||
|
||||
/**
|
||||
* Returns the elapsed time since startup in milliseconds
|
||||
*/
|
||||
unsigned int GetMilliTicks();
|
||||
uint GetMilliTicks();
|
||||
|
||||
/**
|
||||
* Returns the elapsed time since the system start in microseconds.
|
||||
@ -216,7 +216,7 @@ public:
|
||||
* Pauses for the specified amount of time
|
||||
* @param Msecs The amount of time in milliseconds
|
||||
*/
|
||||
void Sleep(unsigned int Msecs) const;
|
||||
void Sleep(uint Msecs) const;
|
||||
|
||||
/**
|
||||
* Returns the singleton instance for the kernel
|
||||
@ -264,7 +264,7 @@ private:
|
||||
class Superclass {
|
||||
private:
|
||||
Kernel *_pKernel;
|
||||
unsigned int _ServiceCount;
|
||||
uint _ServiceCount;
|
||||
Common::String _Identifier;
|
||||
Service *_ActiveService;
|
||||
Common::String _ActiveServiceName;
|
||||
@ -273,7 +273,7 @@ private:
|
||||
Superclass(Kernel *pKernel, const Common::String &Identifier);
|
||||
~Superclass();
|
||||
|
||||
unsigned int GetServiceCount() const {
|
||||
uint GetServiceCount() const {
|
||||
return _ServiceCount;
|
||||
}
|
||||
Common::String GetIdentifier() const {
|
||||
@ -285,7 +285,7 @@ private:
|
||||
Common::String GetActiveServiceName() const {
|
||||
return _ActiveServiceName;
|
||||
}
|
||||
Common::String GetServiceIdentifier(unsigned int Number);
|
||||
Common::String GetServiceIdentifier(uint Number);
|
||||
Service *NewService(const Common::String &ServiceIdentifier);
|
||||
bool DisconnectService();
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ static int GetSuperclassIdentifier(lua_State *L) {
|
||||
BS_ASSERT(pKernel);
|
||||
|
||||
lua_pushstring(L, pKernel->GetSuperclassIdentifier(
|
||||
static_cast<unsigned int>(luaL_checknumber(L, 1))).c_str());
|
||||
static_cast<uint>(luaL_checknumber(L, 1))).c_str());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -110,7 +110,7 @@ static int GetServiceIdentifier(lua_State *L) {
|
||||
BS_ASSERT(pKernel);
|
||||
|
||||
lua_pushstring(L, pKernel->GetServiceIdentifier(luaL_checkstring(L, 1),
|
||||
static_cast<unsigned int>(luaL_checknumber(L, 2))).c_str());
|
||||
static_cast<uint>(luaL_checknumber(L, 2))).c_str());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -153,7 +153,7 @@ static int StartService(lua_State *L) {
|
||||
static int Sleep(lua_State *L) {
|
||||
Kernel *pKernel = Kernel::GetInstance();
|
||||
BS_ASSERT(pKernel);
|
||||
pKernel->Sleep(static_cast<unsigned int>(luaL_checknumber(L, 1) * 1000));
|
||||
pKernel->Sleep(static_cast<uint>(luaL_checknumber(L, 1) * 1000));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ static int SetMaxMemoryUsage(lua_State *L) {
|
||||
ResourceManager *pResource = pKernel->GetResourceManager();
|
||||
BS_ASSERT(pResource);
|
||||
|
||||
pResource->SetMaxMemoryUsage(static_cast<unsigned int>(lua_tonumber(L, 1)));
|
||||
pResource->SetMaxMemoryUsage(static_cast<uint>(lua_tonumber(L, 1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -655,7 +655,7 @@ static int GetSlotCount(lua_State *L) {
|
||||
|
||||
static int IsSlotOccupied(lua_State *L) {
|
||||
lua_pushbooleancpp(L, PersistenceService::GetInstance().IsSlotOccupied(
|
||||
static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1));
|
||||
static_cast<uint>(luaL_checknumber(L, 1)) - 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ static int GetSavegameDirectory(lua_State *L) {
|
||||
|
||||
static int IsSavegameCompatible(lua_State *L) {
|
||||
lua_pushbooleancpp(L, PersistenceService::GetInstance().IsSavegameCompatible(
|
||||
static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1));
|
||||
static_cast<uint>(luaL_checknumber(L, 1)) - 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -678,28 +678,28 @@ static int IsSavegameCompatible(lua_State *L) {
|
||||
|
||||
static int GetSavegameDescription(lua_State *L) {
|
||||
lua_pushstring(L, PersistenceService::GetInstance().GetSavegameDescription(
|
||||
static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1).c_str());
|
||||
static_cast<uint>(luaL_checknumber(L, 1)) - 1).c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int GetSavegameFilename(lua_State *L) {
|
||||
lua_pushstring(L, PersistenceService::GetInstance().GetSavegameFilename(static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1).c_str());
|
||||
lua_pushstring(L, PersistenceService::GetInstance().GetSavegameFilename(static_cast<uint>(luaL_checknumber(L, 1)) - 1).c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int LoadGame(lua_State *L) {
|
||||
lua_pushbooleancpp(L, PersistenceService::GetInstance().LoadGame(static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1));
|
||||
lua_pushbooleancpp(L, PersistenceService::GetInstance().LoadGame(static_cast<uint>(luaL_checknumber(L, 1)) - 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static int SaveGame(lua_State *L) {
|
||||
lua_pushbooleancpp(L, PersistenceService::GetInstance().SaveGame(static_cast<unsigned int>(luaL_checknumber(L, 1)) - 1, luaL_checkstring(L, 2)));
|
||||
lua_pushbooleancpp(L, PersistenceService::GetInstance().SaveGame(static_cast<uint>(luaL_checknumber(L, 1)) - 1, luaL_checkstring(L, 2)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -54,17 +54,17 @@
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned int address;
|
||||
unsigned int size;
|
||||
uint address;
|
||||
uint size;
|
||||
std::string file;
|
||||
unsigned int line;
|
||||
uint line;
|
||||
} ALLOC_INFO;
|
||||
|
||||
static const char *MEMLEAK_LOG_FILE = "memory_leaks.txt";
|
||||
static const unsigned int BUCKET_COUNT = 1021;
|
||||
static const uint BUCKET_COUNT = 1021;
|
||||
std::vector< std::vector<ALLOC_INFO> > TrackData(BUCKET_COUNT);
|
||||
|
||||
static unsigned int TotalSize = 0;
|
||||
static uint TotalSize = 0;
|
||||
|
||||
// Diese Klasse stellt sicher, dass beim Programmende, das Memory-Leak Log geschrieben wird.
|
||||
static class LeakDumper {
|
||||
@ -102,7 +102,7 @@ void DumpUnfreed(const char *OutputFilename) {
|
||||
fclose(Log);
|
||||
}
|
||||
|
||||
void AddTrack(unsigned int addr, unsigned int asize, const char *fname, unsigned int lnum) {
|
||||
void AddTrack(uint addr, uint asize, const char *fname, uint lnum) {
|
||||
std::vector<ALLOC_INFO> & CurBucket = TrackData[(addr >> 3) % BUCKET_COUNT];
|
||||
ALLOC_INFO Info;
|
||||
Info.address = addr;
|
||||
@ -114,7 +114,7 @@ void AddTrack(unsigned int addr, unsigned int asize, const char *fname, unsign
|
||||
TotalSize += asize;
|
||||
}
|
||||
|
||||
void RemoveTrack(unsigned int addr) {
|
||||
void RemoveTrack(uint addr) {
|
||||
if (addr != 0 && TrackData.size() == BUCKET_COUNT) {
|
||||
std::vector<ALLOC_INFO> & CurBucket = TrackData[(addr >> 3) % BUCKET_COUNT];
|
||||
std::vector<ALLOC_INFO>::iterator Iter = CurBucket.begin();
|
||||
|
@ -44,22 +44,22 @@
|
||||
#include <malloc.h>
|
||||
|
||||
void DumpUnfreed(const char *OutputFilename);
|
||||
void AddTrack(unsigned int addr, unsigned int asize, const char *fname, unsigned int lnum);
|
||||
void RemoveTrack(unsigned int addr);
|
||||
void AddTrack(uint addr, uint asize, const char *fname, uint lnum);
|
||||
void RemoveTrack(uint addr);
|
||||
|
||||
inline void *__cdecl operator new(unsigned int size, const char *file, int line) {
|
||||
inline void *__cdecl operator new(uint size, const char *file, int line) {
|
||||
void *ptr = malloc(size);
|
||||
if (ptr) AddTrack((unsigned int)ptr, size, file, line);
|
||||
if (ptr) AddTrack((uint)ptr, size, file, line);
|
||||
return(ptr);
|
||||
};
|
||||
|
||||
inline void __cdecl operator delete(void *p) {
|
||||
RemoveTrack((unsigned int)p);
|
||||
RemoveTrack((uint)p);
|
||||
free(p);
|
||||
};
|
||||
|
||||
inline void __cdecl operator delete[](void *p) {
|
||||
RemoveTrack((unsigned int)p);
|
||||
RemoveTrack((uint)p);
|
||||
free(p);
|
||||
};
|
||||
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
unsigned int RegisterObject(T *ObjectPtr) {
|
||||
uint RegisterObject(T *ObjectPtr) {
|
||||
// Null-Pointer können nicht registriert werden.
|
||||
if (ObjectPtr == 0) {
|
||||
LogErrorLn("Cannot register a null pointer.");
|
||||
@ -66,7 +66,7 @@ public:
|
||||
}
|
||||
|
||||
// Falls das Objekt bereits registriert wurde, wird eine Warnung ausgeben und das Handle zurückgeben.
|
||||
unsigned int Handle = FindHandleByPtr(ObjectPtr);
|
||||
uint Handle = FindHandleByPtr(ObjectPtr);
|
||||
if (Handle != 0) {
|
||||
LogWarningLn("Tried to register a object that was already registered.");
|
||||
return Handle;
|
||||
@ -82,7 +82,7 @@ public:
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int RegisterObject(T *ObjectPtr, unsigned int Handle) {
|
||||
uint RegisterObject(T *ObjectPtr, uint Handle) {
|
||||
// Null-Pointer und Null-Handle können nicht registriert werden.
|
||||
if (ObjectPtr == 0 || Handle == 0) {
|
||||
LogErrorLn("Cannot register a null pointer or a null handle.");
|
||||
@ -90,7 +90,7 @@ public:
|
||||
}
|
||||
|
||||
// Falls das Objekt bereits registriert wurde, wird ein Fehler ausgegeben und 0 zurückgeben.
|
||||
unsigned int HandleTest = FindHandleByPtr(ObjectPtr);
|
||||
uint HandleTest = FindHandleByPtr(ObjectPtr);
|
||||
if (HandleTest != 0) {
|
||||
LogErrorLn("Tried to register a object that was already registered.");
|
||||
return 0;
|
||||
@ -116,7 +116,7 @@ public:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void DeregisterObject(T *ObjectPtr) {
|
||||
unsigned int Handle = FindHandleByPtr(ObjectPtr);
|
||||
uint Handle = FindHandleByPtr(ObjectPtr);
|
||||
|
||||
if (Handle != 0) {
|
||||
// Registriertes Objekt aus beiden Maps entfernen.
|
||||
@ -129,7 +129,7 @@ public:
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
T *ResolveHandle(unsigned int Handle) {
|
||||
T *ResolveHandle(uint Handle) {
|
||||
// Zum Handle gehöriges Objekt in der Hash-Map finden.
|
||||
T *ObjectPtr = FindPtrByHandle(Handle);
|
||||
|
||||
@ -139,9 +139,9 @@ public:
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int ResolvePtr(T *ObjectPtr) {
|
||||
uint ResolvePtr(T *ObjectPtr) {
|
||||
// Zum Pointer gehöriges Handle in der Hash-Map finden.
|
||||
unsigned int Handle = FindHandleByPtr(ObjectPtr);
|
||||
uint Handle = FindHandleByPtr(ObjectPtr);
|
||||
|
||||
// Handle zurückgeben. Im Fehlerfall ist dieses 0.
|
||||
return Handle;
|
||||
@ -160,16 +160,16 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
typedef Common::HashMap<unsigned int, T *> HANDLE2PTR_MAP;
|
||||
typedef Common::HashMap<T *, unsigned int, ClassPointer_Hash, ClassPointer_EqualTo> PTR2HANDLE_MAP;
|
||||
typedef Common::HashMap<uint, T *> HANDLE2PTR_MAP;
|
||||
typedef Common::HashMap<T *, uint, ClassPointer_Hash, ClassPointer_EqualTo> PTR2HANDLE_MAP;
|
||||
|
||||
HANDLE2PTR_MAP m_Handle2PtrMap;
|
||||
PTR2HANDLE_MAP m_Ptr2HandleMap;
|
||||
unsigned int m_NextHandle;
|
||||
uint m_NextHandle;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
T *FindPtrByHandle(unsigned int Handle) {
|
||||
T *FindPtrByHandle(uint Handle) {
|
||||
// Zum Handle gehörigen Pointer finden.
|
||||
typename HANDLE2PTR_MAP::const_iterator it = m_Handle2PtrMap.find(Handle);
|
||||
|
||||
@ -179,7 +179,7 @@ protected:
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int FindHandleByPtr(T *ObjectPtr) {
|
||||
uint FindHandleByPtr(T *ObjectPtr) {
|
||||
// Zum Pointer gehöriges Handle finden.
|
||||
typename PTR2HANDLE_MAP::const_iterator it = m_Ptr2HandleMap.find(ObjectPtr);
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
const unsigned int INITIAL_BUFFER_SIZE = 1024 * 64;
|
||||
const uint INITIAL_BUFFER_SIZE = 1024 * 64;
|
||||
}
|
||||
|
||||
namespace Sword25 {
|
||||
@ -70,7 +70,7 @@ void OutputPersistenceBlock::Write(signed int Value) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OutputPersistenceBlock::Write(unsigned int Value) {
|
||||
void OutputPersistenceBlock::Write(uint Value) {
|
||||
WriteMarker(UINT_MARKER);
|
||||
Value = ConvertEndianessFromSystemToStorage(Value);
|
||||
RawWrite(&Value, sizeof(Value));
|
||||
@ -89,7 +89,7 @@ void OutputPersistenceBlock::Write(float Value) {
|
||||
void OutputPersistenceBlock::Write(bool Value) {
|
||||
WriteMarker(BOOL_MARKER);
|
||||
|
||||
unsigned int UIntBool = Value ? 1 : 0;
|
||||
uint UIntBool = Value ? 1 : 0;
|
||||
UIntBool = ConvertEndianessFromSystemToStorage(UIntBool);
|
||||
RawWrite(&UIntBool, sizeof(UIntBool));
|
||||
}
|
||||
@ -122,7 +122,7 @@ void OutputPersistenceBlock::WriteMarker(byte Marker) {
|
||||
|
||||
void OutputPersistenceBlock::RawWrite(const void *DataPtr, size_t Size) {
|
||||
if (Size > 0) {
|
||||
unsigned int OldSize = m_Data.size();
|
||||
uint OldSize = m_Data.size();
|
||||
m_Data.resize(OldSize + Size);
|
||||
memcpy(&m_Data[OldSize], DataPtr, Size);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
OutputPersistenceBlock();
|
||||
|
||||
void Write(signed int Value);
|
||||
void Write(unsigned int Value);
|
||||
void Write(uint Value);
|
||||
void Write(float Value);
|
||||
void Write(bool Value);
|
||||
void Write(const Common::String &String);
|
||||
@ -62,7 +62,7 @@ public:
|
||||
const void *GetData() const {
|
||||
return &m_Data[0];
|
||||
}
|
||||
unsigned int GetDataSize() const {
|
||||
uint GetDataSize() const {
|
||||
return m_Data.size();
|
||||
}
|
||||
|
||||
|
@ -49,20 +49,20 @@ namespace Sword25 {
|
||||
|
||||
class PersistenceBlock {
|
||||
public:
|
||||
static unsigned int GetSInt32Size() {
|
||||
static uint GetSInt32Size() {
|
||||
return sizeof(signed int) + sizeof(byte);
|
||||
}
|
||||
static unsigned int GetUInt32Size() {
|
||||
return sizeof(unsigned int) + sizeof(byte);
|
||||
static uint GetUInt32Size() {
|
||||
return sizeof(uint) + sizeof(byte);
|
||||
}
|
||||
static unsigned int GetFloat32Size() {
|
||||
static uint GetFloat32Size() {
|
||||
return sizeof(float) + sizeof(byte);
|
||||
}
|
||||
static unsigned int GetBoolSize() {
|
||||
static uint GetBoolSize() {
|
||||
return sizeof(byte) + sizeof(byte);
|
||||
}
|
||||
static unsigned int GetStringSize(const Common::String &String) {
|
||||
return static_cast<unsigned int>(sizeof(unsigned int) + String.size() + sizeof(byte));
|
||||
static uint GetStringSize(const Common::String &String) {
|
||||
return static_cast<uint>(sizeof(uint) + String.size() + sizeof(byte));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -97,7 +97,7 @@ protected:
|
||||
|
||||
private:
|
||||
static bool IsBigEndian() {
|
||||
unsigned int Dummy = 1;
|
||||
uint Dummy = 1;
|
||||
byte *DummyPtr = reinterpret_cast<byte *>(&Dummy);
|
||||
return DummyPtr[0] == 0;
|
||||
}
|
||||
@ -124,7 +124,7 @@ private:
|
||||
#define CTASSERT(ex) typedef char ctassert_type[(ex) ? 1 : -1]
|
||||
CTASSERT(sizeof(byte) == 1);
|
||||
CTASSERT(sizeof(signed int) == 4);
|
||||
CTASSERT(sizeof(unsigned int) == 4);
|
||||
CTASSERT(sizeof(uint) == 4);
|
||||
CTASSERT(sizeof(float) == 4);
|
||||
#undef CTASSERT
|
||||
|
||||
|
@ -59,13 +59,13 @@ namespace Sword25 {
|
||||
const char *SAVEGAME_EXTENSION = ".b25s";
|
||||
const char *SAVEGAME_DIRECTORY = "saves";
|
||||
const char *FILE_MARKER = "BS25SAVEGAME";
|
||||
const unsigned int SLOT_COUNT = 18;
|
||||
const unsigned int FILE_COPY_BUFFER_SIZE = 1024 * 10;
|
||||
const uint SLOT_COUNT = 18;
|
||||
const uint FILE_COPY_BUFFER_SIZE = 1024 * 10;
|
||||
const char *VERSIONID = "1";
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Common::String GenerateSavegameFilename(unsigned int SlotID) {
|
||||
Common::String GenerateSavegameFilename(uint SlotID) {
|
||||
Common::String oss;
|
||||
oss += SlotID;
|
||||
oss += SAVEGAME_EXTENSION;
|
||||
@ -74,7 +74,7 @@ Common::String GenerateSavegameFilename(unsigned int SlotID) {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Common::String GenerateSavegamePath(unsigned int SlotID) {
|
||||
Common::String GenerateSavegamePath(uint SlotID) {
|
||||
Common::String oss;
|
||||
oss = PersistenceService::GetSavegameDirectory();
|
||||
oss += FileSystemUtil::GetInstance().GetPathSeparator();
|
||||
@ -124,9 +124,9 @@ struct SavegameInformation {
|
||||
bool IsCompatible;
|
||||
Common::String Description;
|
||||
Common::String Filename;
|
||||
unsigned int GamedataLength;
|
||||
unsigned int GamedataOffset;
|
||||
unsigned int GamedataUncompressedLength;
|
||||
uint GamedataLength;
|
||||
uint GamedataOffset;
|
||||
uint GamedataUncompressedLength;
|
||||
|
||||
SavegameInformation() {
|
||||
Clear();
|
||||
@ -156,12 +156,12 @@ struct PersistenceService::Impl {
|
||||
|
||||
void ReloadSlots() {
|
||||
// Über alle Spielstanddateien iterieren und deren Infos einlesen.
|
||||
for (unsigned int i = 0; i < SLOT_COUNT; ++i) {
|
||||
for (uint i = 0; i < SLOT_COUNT; ++i) {
|
||||
ReadSlotSavegameInformation(i);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadSlotSavegameInformation(unsigned int SlotID) {
|
||||
void ReadSlotSavegameInformation(uint SlotID) {
|
||||
// Aktuelle Slotinformationen in den Ausgangszustand versetzen, er wird im Folgenden neu gefüllt.
|
||||
SavegameInformation &CurSavegameInfo = m_SavegameInformations[SlotID];
|
||||
CurSavegameInfo.Clear();
|
||||
@ -194,7 +194,7 @@ struct PersistenceService::Impl {
|
||||
CurSavegameInfo.Description = FormatTimestamp(FileSystemUtil::GetInstance().GetFileTime(Filename));
|
||||
// Den Offset zu den gespeicherten Spieldaten innerhalb der Datei speichern.
|
||||
// Dieses entspricht der aktuellen Position + 1, da nach der letzten Headerinformation noch ein Leerzeichen als trenner folgt.
|
||||
CurSavegameInfo.GamedataOffset = static_cast<unsigned int>(File->pos()) + 1;
|
||||
CurSavegameInfo.GamedataOffset = static_cast<uint>(File->pos()) + 1;
|
||||
}
|
||||
|
||||
delete File;
|
||||
@ -233,7 +233,7 @@ void PersistenceService::ReloadSlots() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int PersistenceService::GetSlotCount() {
|
||||
uint PersistenceService::GetSlotCount() {
|
||||
return SLOT_COUNT;
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ Common::String PersistenceService::GetSavegameDirectory() {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
bool CheckSlotID(unsigned int SlotID) {
|
||||
bool CheckSlotID(uint SlotID) {
|
||||
// Überprüfen, ob die Slot-ID zulässig ist.
|
||||
if (SlotID >= SLOT_COUNT) {
|
||||
BS_LOG_ERRORLN("Tried to access an invalid slot (%d). Only slot ids from 0 to %d are allowed.", SlotID, SLOT_COUNT - 1);
|
||||
@ -259,21 +259,21 @@ bool CheckSlotID(unsigned int SlotID) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PersistenceService::IsSlotOccupied(unsigned int SlotID) {
|
||||
bool PersistenceService::IsSlotOccupied(uint SlotID) {
|
||||
if (!CheckSlotID(SlotID)) return false;
|
||||
return m_impl->m_SavegameInformations[SlotID].IsOccupied;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PersistenceService::IsSavegameCompatible(unsigned int SlotID) {
|
||||
bool PersistenceService::IsSavegameCompatible(uint SlotID) {
|
||||
if (!CheckSlotID(SlotID)) return false;
|
||||
return m_impl->m_SavegameInformations[SlotID].IsCompatible;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Common::String &PersistenceService::GetSavegameDescription(unsigned int SlotID) {
|
||||
Common::String &PersistenceService::GetSavegameDescription(uint SlotID) {
|
||||
static Common::String EmptyString;
|
||||
if (!CheckSlotID(SlotID)) return EmptyString;
|
||||
return m_impl->m_SavegameInformations[SlotID].Description;
|
||||
@ -281,7 +281,7 @@ Common::String &PersistenceService::GetSavegameDescription(unsigned int SlotID)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Common::String &PersistenceService::GetSavegameFilename(unsigned int SlotID) {
|
||||
Common::String &PersistenceService::GetSavegameFilename(uint SlotID) {
|
||||
static Common::String EmptyString;
|
||||
if (!CheckSlotID(SlotID)) return EmptyString;
|
||||
return m_impl->m_SavegameInformations[SlotID].Filename;
|
||||
@ -289,7 +289,7 @@ Common::String &PersistenceService::GetSavegameFilename(unsigned int SlotID) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PersistenceService::SaveGame(unsigned int SlotID, const Common::String &ScreenshotFilename) {
|
||||
bool PersistenceService::SaveGame(uint SlotID, const Common::String &ScreenshotFilename) {
|
||||
// Überprüfen, ob die Slot-ID zulässig ist.
|
||||
if (SlotID >= SLOT_COUNT) {
|
||||
BS_LOG_ERRORLN("Tried to save to an invalid slot (%d). Only slot ids form 0 to %d are allowed.", SlotID, SLOT_COUNT - 1);
|
||||
@ -376,7 +376,7 @@ bool PersistenceService::SaveGame(unsigned int SlotID, const Common::String &Scr
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool PersistenceService::LoadGame(unsigned int SlotID) {
|
||||
bool PersistenceService::LoadGame(uint SlotID) {
|
||||
Common::SaveFileManager *sfm = g_system->getSavefileManager();
|
||||
Common::InSaveFile *File;
|
||||
|
||||
|
@ -62,17 +62,17 @@ public:
|
||||
// Interface
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static unsigned int GetSlotCount();
|
||||
static uint GetSlotCount();
|
||||
static Common::String GetSavegameDirectory();
|
||||
|
||||
void ReloadSlots();
|
||||
bool IsSlotOccupied(unsigned int SlotID);
|
||||
bool IsSavegameCompatible(unsigned int SlotID);
|
||||
Common::String &GetSavegameDescription(unsigned int SlotID);
|
||||
Common::String &GetSavegameFilename(unsigned int SlotID);
|
||||
bool IsSlotOccupied(uint SlotID);
|
||||
bool IsSavegameCompatible(uint SlotID);
|
||||
Common::String &GetSavegameDescription(uint SlotID);
|
||||
Common::String &GetSavegameFilename(uint SlotID);
|
||||
|
||||
bool SaveGame(unsigned int SlotID, const Common::String &ScreenshotFilename);
|
||||
bool LoadGame(unsigned int SlotID);
|
||||
bool SaveGame(uint SlotID, const Common::String &ScreenshotFilename);
|
||||
bool LoadGame(uint SlotID);
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
|
@ -223,7 +223,7 @@ void ResourceManager::MoveToFront(Resource *pResource) {
|
||||
*/
|
||||
Resource *ResourceManager::LoadResource(const Common::String &FileName) {
|
||||
// ResourceService finden, der die Resource laden kann.
|
||||
for (unsigned int i = 0; i < m_ResourceServices.size(); ++i) {
|
||||
for (uint i = 0; i < m_ResourceServices.size(); ++i) {
|
||||
if (m_ResourceServices[i]->CanLoadResource(FileName)) {
|
||||
// If more memory is desired, memory must be released
|
||||
DeleteResourcesIfNecessary();
|
||||
@ -328,7 +328,7 @@ void ResourceManager::DumpLockedResources() {
|
||||
* as a guideline, and not as a fixed boundary. It is not guaranteed not to be exceeded;
|
||||
* the whole game engine may still use more memory than any amount specified.
|
||||
*/
|
||||
void ResourceManager::SetMaxMemoryUsage(unsigned int MaxMemoryUsage) {
|
||||
void ResourceManager::SetMaxMemoryUsage(uint MaxMemoryUsage) {
|
||||
m_MaxMemoryUsage = MaxMemoryUsage;
|
||||
DeleteResourcesIfNecessary();
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
* as a guideline, and not as a fixed boundary. It is not guaranteed not to be exceeded;
|
||||
* the whole game engine may still use more memory than any amount specified.
|
||||
*/
|
||||
void SetMaxMemoryUsage(unsigned int MaxMemoryUsage);
|
||||
void SetMaxMemoryUsage(uint MaxMemoryUsage);
|
||||
|
||||
/**
|
||||
* Specifies whether a warning is written to the log when a cache miss occurs.
|
||||
@ -181,7 +181,7 @@ private:
|
||||
void DeleteResourcesIfNecessary();
|
||||
|
||||
Kernel *m_KernelPtr;
|
||||
unsigned int m_MaxMemoryUsage;
|
||||
uint m_MaxMemoryUsage;
|
||||
Common::Array<ResourceService *> m_ResourceServices;
|
||||
Common::List<Resource *> m_Resources;
|
||||
Common::List<Resource *> m_ResourceHashTable[HASH_TABLE_BUCKETS];
|
||||
|
@ -91,14 +91,14 @@ public:
|
||||
/**
|
||||
* Returns the hash of the filename of a resource
|
||||
*/
|
||||
unsigned int GetFileNameHash() const {
|
||||
uint GetFileNameHash() const {
|
||||
return _FileNameHash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a resource's type
|
||||
*/
|
||||
unsigned int GetType() const {
|
||||
uint GetType() const {
|
||||
return _Type;
|
||||
}
|
||||
|
||||
@ -107,9 +107,9 @@ protected:
|
||||
|
||||
private:
|
||||
Common::String _FileName; ///< The absolute filename
|
||||
unsigned int _FileNameHash; ///< The hash value of the filename
|
||||
unsigned int _RefCount; ///< The number of locks
|
||||
unsigned int _Type; ///< The type of the resource
|
||||
uint _FileNameHash; ///< The hash value of the filename
|
||||
uint _RefCount; ///< The number of locks
|
||||
uint _Type; ///< The type of the resource
|
||||
Common::List<Resource *>::iterator _Iterator; ///< Points to the resource position in the LRU list
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ const BS_ServiceInfo BS_SERVICE_TABLE[] = {
|
||||
BS_ServiceInfo("fmv", "oggtheora", OggTheora_CreateObject),
|
||||
};
|
||||
|
||||
const unsigned int BS_SERVICE_COUNT = sizeof(BS_SERVICE_TABLE) / sizeof(BS_ServiceInfo);
|
||||
const uint BS_SERVICE_COUNT = sizeof(BS_SERVICE_TABLE) / sizeof(BS_ServiceInfo);
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
||||
|
@ -39,10 +39,10 @@
|
||||
|
||||
namespace BS_String {
|
||||
|
||||
inline unsigned int GetHash(const Common::String &Str) {
|
||||
unsigned int Result = 0;
|
||||
inline uint GetHash(const Common::String &Str) {
|
||||
uint Result = 0;
|
||||
|
||||
for (unsigned int i = 0; i < Str.size(); i++)
|
||||
for (uint i = 0; i < Str.size(); i++)
|
||||
Result = ((Result << 5) - Result) + Str[i];
|
||||
|
||||
return Result;
|
||||
|
@ -86,7 +86,7 @@ static void *my_checkudata(lua_State *L, int ud, const char *tname) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void NewUintUserData(lua_State *L, unsigned int Value) {
|
||||
static void NewUintUserData(lua_State *L, uint Value) {
|
||||
void *UserData = lua_newuserdata(L, sizeof(Value));
|
||||
memcpy(UserData, &Value, sizeof(Value));
|
||||
}
|
||||
@ -181,7 +181,7 @@ static void TablePolygonToPolygon(lua_State *L, Polygon &Polygon) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) {
|
||||
static uint TableRegionToRegion(lua_State *L, const char *ClassName) {
|
||||
#ifdef DEBUG
|
||||
int __startStackDepth = lua_gettop(L);
|
||||
#endif
|
||||
@ -199,7 +199,7 @@ static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int RegionHandle = 0;
|
||||
uint RegionHandle = 0;
|
||||
if (!strcmp(ClassName, REGION_CLASS_NAME)) {
|
||||
RegionHandle = Region::Create(Region::RT_REGION);
|
||||
} else if (!strcmp(ClassName, WALKREGION_CLASS_NAME)) {
|
||||
@ -268,7 +268,7 @@ static unsigned int TableRegionToRegion(lua_State *L, const char *ClassName) {
|
||||
static void NewUserdataRegion(lua_State *L, const char *ClassName) {
|
||||
// Region due to the Lua code to create
|
||||
// Any errors that occur will be intercepted to the luaL_error
|
||||
unsigned int RegionHandle = TableRegionToRegion(L, ClassName);
|
||||
uint RegionHandle = TableRegionToRegion(L, ClassName);
|
||||
BS_ASSERT(RegionHandle);
|
||||
|
||||
NewUintUserData(L, RegionHandle);
|
||||
@ -306,9 +306,9 @@ static const luaL_reg GEO_FUNCTIONS[] = {
|
||||
|
||||
static Region *CheckRegion(lua_State *L) {
|
||||
// The first parameter must be of type 'userdata', and the Metatable class Geo.Region or Geo.WalkRegion
|
||||
unsigned int *RegionHandlePtr;
|
||||
if ((RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 ||
|
||||
(RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) {
|
||||
uint *RegionHandlePtr;
|
||||
if ((RegionHandlePtr = reinterpret_cast<uint *>(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 ||
|
||||
(RegionHandlePtr = reinterpret_cast<uint *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) {
|
||||
return RegionRegistry::GetInstance().ResolveHandle(*RegionHandlePtr);
|
||||
} else {
|
||||
luaL_argcheck(L, 0, 1, "'" REGION_CLASS_NAME "' expected");
|
||||
@ -407,7 +407,7 @@ static int R_SetY(lua_State *L) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void DrawPolygon(const Polygon &Polygon, unsigned int Color, const Vertex &Offset) {
|
||||
static void DrawPolygon(const Polygon &Polygon, uint Color, const Vertex &Offset) {
|
||||
GraphicEngine *pGE = static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx"));
|
||||
BS_ASSERT(pGE);
|
||||
|
||||
@ -419,7 +419,7 @@ static void DrawPolygon(const Polygon &Polygon, unsigned int Color, const Vertex
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void DrawRegion(const Region &Region, unsigned int Color, const Vertex &Offset) {
|
||||
static void DrawRegion(const Region &Region, uint Color, const Vertex &Offset) {
|
||||
DrawPolygon(Region.GetContour(), Color, Offset);
|
||||
for (int i = 0; i < Region.GetHoleCount(); i++)
|
||||
DrawPolygon(Region.GetHole(i), Color, Offset);
|
||||
@ -490,8 +490,8 @@ static const luaL_reg REGION_METHODS[] = {
|
||||
|
||||
static WalkRegion *CheckWalkRegion(lua_State *L) {
|
||||
// The first parameter must be of type 'userdate', and the Metatable class Geo.WalkRegion
|
||||
unsigned int RegionHandle;
|
||||
if ((RegionHandle = *reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) {
|
||||
uint RegionHandle;
|
||||
if ((RegionHandle = *reinterpret_cast<uint *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) {
|
||||
return reinterpret_cast<WalkRegion *>(RegionRegistry::GetInstance().ResolveHandle(RegionHandle));
|
||||
} else {
|
||||
luaL_argcheck(L, 0, 1, "'" WALKREGION_CLASS_NAME "' expected");
|
||||
|
@ -52,14 +52,14 @@ Region::Region() : m_Valid(false), m_Type(RT_REGION) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Region::Region(InputPersistenceBlock &Reader, unsigned int Handle) : m_Valid(false), m_Type(RT_REGION) {
|
||||
Region::Region(InputPersistenceBlock &Reader, uint Handle) : m_Valid(false), m_Type(RT_REGION) {
|
||||
RegionRegistry::GetInstance().RegisterObject(this, Handle);
|
||||
Unpersist(Reader);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int Region::Create(REGION_TYPE Type) {
|
||||
uint Region::Create(REGION_TYPE Type) {
|
||||
Region *RegionPtr = NULL;
|
||||
switch (Type) {
|
||||
case RT_REGION:
|
||||
@ -79,9 +79,9 @@ unsigned int Region::Create(REGION_TYPE Type) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int Region::Create(InputPersistenceBlock &Reader, unsigned int Handle) {
|
||||
uint Region::Create(InputPersistenceBlock &Reader, uint Handle) {
|
||||
// Read type
|
||||
unsigned int Type;
|
||||
uint Type;
|
||||
Reader.Read(Type);
|
||||
|
||||
// Depending on the type, create a new BS_Region or BS_WalkRegion object
|
||||
@ -125,7 +125,7 @@ bool Region::Init(const Polygon &Contour, const Common::Array<Polygon> *pHoles)
|
||||
|
||||
// Place the hole polygons in the following positions
|
||||
if (pHoles) {
|
||||
for (unsigned int i = 0; i < pHoles->size(); ++i) {
|
||||
for (uint i = 0; i < pHoles->size(); ++i) {
|
||||
m_Polygons.push_back(Polygon());
|
||||
m_Polygons[i + 1].Init((*pHoles)[i].VertexCount, (*pHoles)[i].Vertecies);
|
||||
m_Polygons[i + 1].EnsureCWOrder();
|
||||
@ -171,7 +171,7 @@ void Region::SetPos(int X, int Y) {
|
||||
m_Position = Vertex(X, Y);
|
||||
|
||||
// Move all the vertecies
|
||||
for (unsigned int i = 0; i < m_Polygons.size(); ++i) {
|
||||
for (uint i = 0; i < m_Polygons.size(); ++i) {
|
||||
m_Polygons[i] += Delta;
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ bool Region::IsPointInRegion(int X, int Y) const {
|
||||
// Test whether the point is in the contour
|
||||
if (m_Polygons[0].IsPointInPolygon(X, Y, true)) {
|
||||
// Test whether the point is in a hole
|
||||
for (unsigned int i = 1; i < m_Polygons.size(); i++) {
|
||||
for (uint i = 1; i < m_Polygons.size(); i++) {
|
||||
if (m_Polygons[i].IsPointInPolygon(X, Y, false))
|
||||
return false;
|
||||
}
|
||||
@ -225,7 +225,7 @@ Vertex Region::FindClosestRegionPoint(const Vertex &Point) const {
|
||||
// point on the edge of the hole is determined
|
||||
int PolygonIdx = 0;
|
||||
{
|
||||
for (unsigned int i = 1; i < m_Polygons.size(); ++i) {
|
||||
for (uint i = 1; i < m_Polygons.size(); ++i) {
|
||||
if (m_Polygons[i].IsPointInPolygon(Point)) {
|
||||
PolygonIdx = i;
|
||||
break;
|
||||
@ -337,7 +337,7 @@ bool Region::IsLineOfSight(const Vertex &a, const Vertex &b) const {
|
||||
bool Region::Persist(OutputPersistenceBlock &Writer) {
|
||||
bool Result = true;
|
||||
|
||||
Writer.Write(static_cast<unsigned int>(m_Type));
|
||||
Writer.Write(static_cast<uint>(m_Type));
|
||||
Writer.Write(m_Valid);
|
||||
Writer.Write(m_Position.X);
|
||||
Writer.Write(m_Position.Y);
|
||||
@ -365,9 +365,9 @@ bool Region::Unpersist(InputPersistenceBlock &Reader) {
|
||||
Reader.Read(m_Position.Y);
|
||||
|
||||
m_Polygons.clear();
|
||||
unsigned int PolygonCount;
|
||||
uint PolygonCount;
|
||||
Reader.Read(PolygonCount);
|
||||
for (unsigned int i = 0; i < PolygonCount; ++i) {
|
||||
for (uint i = 0; i < PolygonCount; ++i) {
|
||||
m_Polygons.push_back(Polygon(Reader));
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ protected:
|
||||
*/
|
||||
Region();
|
||||
|
||||
Region(InputPersistenceBlock &Reader, unsigned int Handle);
|
||||
Region(InputPersistenceBlock &Reader, uint Handle);
|
||||
|
||||
public:
|
||||
enum REGION_TYPE {
|
||||
@ -70,8 +70,8 @@ public:
|
||||
RT_WALKREGION
|
||||
};
|
||||
|
||||
static unsigned int Create(REGION_TYPE Type);
|
||||
static unsigned int Create(InputPersistenceBlock &Reader, unsigned int Handle = 0);
|
||||
static uint Create(REGION_TYPE Type);
|
||||
static uint Create(InputPersistenceBlock &Reader, uint Handle = 0);
|
||||
|
||||
virtual ~Region();
|
||||
|
||||
@ -154,7 +154,7 @@ public:
|
||||
* The index must be between 0 and GetHoleCount() - 1.
|
||||
* @return Returns the desired hole polygon
|
||||
*/
|
||||
inline const Polygon &GetHole(unsigned int i) const;
|
||||
inline const Polygon &GetHole(uint i) const;
|
||||
|
||||
/**
|
||||
* For a point outside the region, finds the closest point inside the region
|
||||
@ -236,7 +236,7 @@ protected:
|
||||
// Inlines
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
inline const Polygon &Region::GetHole(unsigned int i) const {
|
||||
inline const Polygon &Region::GetHole(uint i) const {
|
||||
BS_ASSERT(i < m_Polygons.size() - 1);
|
||||
return m_Polygons[i + 1];
|
||||
}
|
||||
|
@ -106,13 +106,13 @@ bool RegionRegistry::Unpersist(InputPersistenceBlock &Reader) {
|
||||
while (!m_Handle2PtrMap.empty()) delete m_Handle2PtrMap.begin()->_value;
|
||||
|
||||
// Read in the number of BS_Regions
|
||||
unsigned int RegionCount;
|
||||
uint RegionCount;
|
||||
Reader.Read(RegionCount);
|
||||
|
||||
// Restore all the BS_Regions objects
|
||||
for (unsigned int i = 0; i < RegionCount; ++i) {
|
||||
for (uint i = 0; i < RegionCount; ++i) {
|
||||
// Handle read
|
||||
unsigned int Handle;
|
||||
uint Handle;
|
||||
Reader.Read(Handle);
|
||||
|
||||
// BS_Region restore
|
||||
|
@ -58,7 +58,7 @@ WalkRegion::WalkRegion() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
WalkRegion::WalkRegion(InputPersistenceBlock &Reader, unsigned int Handle) :
|
||||
WalkRegion::WalkRegion(InputPersistenceBlock &Reader, uint Handle) :
|
||||
Region(Reader, Handle) {
|
||||
m_Type = RT_WALKREGION;
|
||||
Unpersist(Reader);
|
||||
@ -155,7 +155,7 @@ static void RelaxNodes(DijkstraNode::Container &Nodes,
|
||||
// a shorter path has been found to them.
|
||||
|
||||
int CurNodeIndex = CurNodeIter - Nodes.begin();
|
||||
for (unsigned int i = 0; i < Nodes.size(); i++) {
|
||||
for (uint i = 0; i < Nodes.size(); i++) {
|
||||
int Cost = VisibilityMatrix[CurNodeIndex][i];
|
||||
if (!Nodes[i].Chosen && Cost != infinity) {
|
||||
int TotalCost = (*CurNodeIter).Cost + Cost;
|
||||
@ -193,7 +193,7 @@ bool WalkRegion::FindPath(const Vertex &Start, const Vertex &End, BS_Path &Path)
|
||||
|
||||
// Since a node is selected each round from the node list, and can never be selected again
|
||||
// after that, the maximum number of loop iterations is limited by the number of nodes
|
||||
for (unsigned int i = 0; i < m_Nodes.size(); i++) {
|
||||
for (uint i = 0; i < m_Nodes.size(); i++) {
|
||||
// Determine the nearest edge node in the node list
|
||||
DijkstraNode::Iter NodeInter = ChooseClosestNode(DijkstraNodes);
|
||||
|
||||
@ -245,14 +245,14 @@ void WalkRegion::InitNodeVector() {
|
||||
// Determine the number of nodes
|
||||
int NodeCount = 0;
|
||||
{
|
||||
for (unsigned int i = 0; i < m_Polygons.size(); i++)
|
||||
for (uint i = 0; i < m_Polygons.size(); i++)
|
||||
NodeCount += m_Polygons[i].VertexCount;
|
||||
}
|
||||
|
||||
// Knoten-Vector füllen
|
||||
m_Nodes.reserve(NodeCount);
|
||||
{
|
||||
for (unsigned int j = 0; j < m_Polygons.size(); j++)
|
||||
for (uint j = 0; j < m_Polygons.size(); j++)
|
||||
for (int i = 0; i < m_Polygons[j].VertexCount; i++)
|
||||
m_Nodes.push_back(m_Polygons[j].Vertecies[i]);
|
||||
}
|
||||
@ -272,8 +272,8 @@ void WalkRegion::ComputeVisibilityMatrix() {
|
||||
}
|
||||
|
||||
// Calculate visibility been vertecies
|
||||
for (unsigned int j = 0; j < m_Nodes.size(); ++j) {
|
||||
for (unsigned int i = j; i < m_Nodes.size(); ++i) {
|
||||
for (uint j = 0; j < m_Nodes.size(); ++j) {
|
||||
for (uint i = j; i < m_Nodes.size(); ++i) {
|
||||
if (IsLineOfSight(m_Nodes[i], m_Nodes[j])) {
|
||||
// There is a line of sight, so save the distance between the two
|
||||
int Distance = m_Nodes[i].Distance(m_Nodes[j]);
|
||||
@ -332,7 +332,7 @@ void WalkRegion::SetPos(int X, int Y) {
|
||||
Vertex Delta(X - m_Position.X, Y - m_Position.Y);
|
||||
|
||||
// Move all the nodes
|
||||
for (unsigned int i = 0; i < m_Nodes.size(); i++) m_Nodes[i] += Delta;
|
||||
for (uint i = 0; i < m_Nodes.size(); i++) m_Nodes[i] += Delta;
|
||||
|
||||
// Move regions
|
||||
Region::SetPos(X, Y);
|
||||
@ -381,7 +381,7 @@ bool WalkRegion::Unpersist(InputPersistenceBlock &Reader) {
|
||||
// this point only the additional data from BS_WalkRegion needs to be loaded
|
||||
|
||||
// Node load
|
||||
unsigned int NodeCount;
|
||||
uint NodeCount;
|
||||
Reader.Read(NodeCount);
|
||||
m_Nodes.clear();
|
||||
m_Nodes.resize(NodeCount);
|
||||
@ -393,13 +393,13 @@ bool WalkRegion::Unpersist(InputPersistenceBlock &Reader) {
|
||||
}
|
||||
|
||||
// Visibility matrix load
|
||||
unsigned int RowCount;
|
||||
uint RowCount;
|
||||
Reader.Read(RowCount);
|
||||
m_VisibilityMatrix.clear();
|
||||
m_VisibilityMatrix.resize(RowCount);
|
||||
Common::Array< Common::Array<int> >::iterator RowIter = m_VisibilityMatrix.begin();
|
||||
while (RowIter != m_VisibilityMatrix.end()) {
|
||||
unsigned int ColCount;
|
||||
uint ColCount;
|
||||
Reader.Read(ColCount);
|
||||
RowIter->resize(ColCount);
|
||||
Common::Array<int>::iterator ColIter = RowIter->begin();
|
||||
|
@ -59,7 +59,7 @@ class WalkRegion : public Region {
|
||||
|
||||
protected:
|
||||
WalkRegion();
|
||||
WalkRegion(InputPersistenceBlock &Reader, unsigned int Handle);
|
||||
WalkRegion(InputPersistenceBlock &Reader, uint Handle);
|
||||
|
||||
public:
|
||||
virtual ~WalkRegion();
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
* @return Specifies a pointer to the loaded data of the file
|
||||
* @remark The client must not forget to release the data of the file using BE_DELETE_A.
|
||||
*/
|
||||
virtual byte *GetFile(const Common::String &FileName, unsigned int *pFileSize = NULL) = 0;
|
||||
virtual byte *GetFile(const Common::String &FileName, uint *pFileSize = NULL) = 0;
|
||||
|
||||
/**
|
||||
* Returns a stream from file file from the virtual directory tree
|
||||
@ -116,9 +116,9 @@ public:
|
||||
* @return Specifies a pointer to the loaded data of the file
|
||||
* @remark The client must not forget to release the data of the file using BE_DELETE_A.
|
||||
*/
|
||||
char *GetXmlFile(const Common::String &FileName, unsigned int *pFileSize = NULL) {
|
||||
char *GetXmlFile(const Common::String &FileName, uint *pFileSize = NULL) {
|
||||
const char *versionStr = "<?xml version=\"1.0\"?>";
|
||||
unsigned int fileSize;
|
||||
uint fileSize;
|
||||
char *data = (char *)GetFile(FileName, &fileSize);
|
||||
char *result = (char *)malloc(fileSize + strlen(versionStr) + 1);
|
||||
strcpy(result, versionStr);
|
||||
@ -162,7 +162,7 @@ public:
|
||||
* @return Specifies a pointer to a BS_PackageManager::FileSearch object, or NULL if no file was found.
|
||||
* @remark Do not forget to delete the object after use.
|
||||
*/
|
||||
virtual int doSearch(Common::ArchiveMemberList &list, const Common::String &Filter, const Common::String &Path, unsigned int TypeFilter = FT_DIRECTORY | FT_FILE) = 0;
|
||||
virtual int doSearch(Common::ArchiveMemberList &list, const Common::String &Filter, const Common::String &Path, uint TypeFilter = FT_DIRECTORY | FT_FILE) = 0;
|
||||
|
||||
/**
|
||||
* Returns a file's size
|
||||
@ -170,7 +170,7 @@ public:
|
||||
* @return The file size. If an error occurs, then 0xffffffff is returned.
|
||||
* @remarks For files in packages, then uncompressed size is returned.
|
||||
**/
|
||||
virtual unsigned int GetFileSize(const Common::String &FileName) = 0;
|
||||
virtual uint GetFileSize(const Common::String &FileName) = 0;
|
||||
|
||||
/**
|
||||
* Returns the type of a file.
|
||||
@ -179,7 +179,7 @@ public:
|
||||
* or BS_PackageManager::FT_FILE).
|
||||
* If the file was not found, then 0 is returned.
|
||||
*/
|
||||
virtual unsigned int GetFileType(const Common::String &FileName) = 0;
|
||||
virtual uint GetFileType(const Common::String &FileName) = 0;
|
||||
|
||||
/**
|
||||
* Determines whether a file exists
|
||||
|
@ -146,7 +146,7 @@ static void SplitSearchPath(const Common::String &Path, Common::String &Director
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void DoSearch(lua_State *L, const Common::String &path, unsigned int type) {
|
||||
static void DoSearch(lua_State *L, const Common::String &path, uint type) {
|
||||
PackageManager *pPM = GetPM();
|
||||
|
||||
// Der Packagemanager-Service muss den Suchstring und den Pfad getrennt übergeben bekommen.
|
||||
@ -195,7 +195,7 @@ static int FindDirectories(lua_State *L) {
|
||||
static int GetFileAsString(lua_State *L) {
|
||||
PackageManager *pPM = GetPM();
|
||||
|
||||
unsigned int FileSize;
|
||||
uint FileSize;
|
||||
char *FileData = (char *)pPM->GetFile(luaL_checkstring(L, 1), &FileSize);
|
||||
if (FileData) {
|
||||
lua_pushlstring(L, FileData, FileSize);
|
||||
|
@ -130,7 +130,7 @@ bool ScummVMPackageManager::LoadDirectoryAsPackage(const Common::String &directo
|
||||
}
|
||||
}
|
||||
|
||||
byte *ScummVMPackageManager::GetFile(const Common::String &fileName, unsigned int *fileSizePtr) {
|
||||
byte *ScummVMPackageManager::GetFile(const Common::String &fileName, uint *fileSizePtr) {
|
||||
Common::SeekableReadStream *in;
|
||||
Common::ArchiveMemberPtr fileNode = GetArchiveMember(normalizePath(fileName, _currentDirectory));
|
||||
if (!fileNode)
|
||||
@ -177,7 +177,7 @@ Common::String ScummVMPackageManager::GetAbsolutePath(const Common::String &file
|
||||
return normalizePath(fileName, _currentDirectory);
|
||||
}
|
||||
|
||||
unsigned int ScummVMPackageManager::GetFileSize(const Common::String &fileName) {
|
||||
uint ScummVMPackageManager::GetFileSize(const Common::String &fileName) {
|
||||
Common::SeekableReadStream *in;
|
||||
Common::ArchiveMemberPtr fileNode = GetArchiveMember(normalizePath(fileName, _currentDirectory));
|
||||
if (!fileNode)
|
||||
@ -190,7 +190,7 @@ unsigned int ScummVMPackageManager::GetFileSize(const Common::String &fileName)
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
unsigned int ScummVMPackageManager::GetFileType(const Common::String &fileName) {
|
||||
uint ScummVMPackageManager::GetFileType(const Common::String &fileName) {
|
||||
warning("STUB: BS_ScummVMPackageManager::GetFileType(%s)", fileName.c_str());
|
||||
|
||||
//return fileNode.isDirectory() ? BS_PackageManager::FT_DIRECTORY : BS_PackageManager::FT_FILE;
|
||||
@ -202,7 +202,7 @@ bool ScummVMPackageManager::FileExists(const Common::String &fileName) {
|
||||
return fileNode;
|
||||
}
|
||||
|
||||
int ScummVMPackageManager::doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, unsigned int typeFilter) {
|
||||
int ScummVMPackageManager::doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, uint typeFilter) {
|
||||
Common::String normalizedFilter = normalizePath(filter, _currentDirectory);
|
||||
int num = 0;
|
||||
|
||||
|
@ -72,14 +72,14 @@ public:
|
||||
|
||||
virtual bool LoadPackage(const Common::String &fileName, const Common::String &mountPosition);
|
||||
virtual bool LoadDirectoryAsPackage(const Common::String &directoryName, const Common::String &mountPosition);
|
||||
virtual byte *GetFile(const Common::String &fileName, unsigned int *fileSizePtr = 0);
|
||||
virtual byte *GetFile(const Common::String &fileName, uint *fileSizePtr = 0);
|
||||
virtual Common::SeekableReadStream *GetStream(const Common::String &fileName);
|
||||
virtual Common::String GetCurrentDirectory();
|
||||
virtual bool ChangeDirectory(const Common::String &directory);
|
||||
virtual Common::String GetAbsolutePath(const Common::String &fileName);
|
||||
virtual int doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, unsigned int typeFilter = FT_DIRECTORY | FT_FILE);
|
||||
virtual unsigned int GetFileSize(const Common::String &fileName);
|
||||
virtual unsigned int GetFileType(const Common::String &fileName);
|
||||
virtual int doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, uint typeFilter = FT_DIRECTORY | FT_FILE);
|
||||
virtual uint GetFileSize(const Common::String &fileName);
|
||||
virtual uint GetFileType(const Common::String &fileName);
|
||||
virtual bool FileExists(const Common::String &fileName);
|
||||
};
|
||||
|
||||
|
@ -72,7 +72,7 @@ LuaCallback::~LuaCallback() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LuaCallback::RegisterCallbackFunction(lua_State *L, unsigned int ObjectHandle) {
|
||||
void LuaCallback::RegisterCallbackFunction(lua_State *L, uint ObjectHandle) {
|
||||
BS_ASSERT(lua_isfunction(L, -1));
|
||||
EnsureObjectCallbackTableExists(L, ObjectHandle);
|
||||
|
||||
@ -86,7 +86,7 @@ void LuaCallback::RegisterCallbackFunction(lua_State *L, unsigned int ObjectHand
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LuaCallback::UnregisterCallbackFunction(lua_State *L, unsigned int ObjectHandle) {
|
||||
void LuaCallback::UnregisterCallbackFunction(lua_State *L, uint ObjectHandle) {
|
||||
BS_ASSERT(lua_isfunction(L, -1));
|
||||
EnsureObjectCallbackTableExists(L, ObjectHandle);
|
||||
|
||||
@ -116,7 +116,7 @@ void LuaCallback::UnregisterCallbackFunction(lua_State *L, unsigned int ObjectHa
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LuaCallback::RemoveAllObjectCallbacks(lua_State *L, unsigned int ObjectHandle) {
|
||||
void LuaCallback::RemoveAllObjectCallbacks(lua_State *L, uint ObjectHandle) {
|
||||
PushCallbackTable(L);
|
||||
|
||||
// Remove the object callback from the callback table
|
||||
@ -129,7 +129,7 @@ void LuaCallback::RemoveAllObjectCallbacks(lua_State *L, unsigned int ObjectHand
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LuaCallback::InvokeCallbackFunctions(lua_State *L, unsigned int ObjectHandle) {
|
||||
void LuaCallback::InvokeCallbackFunctions(lua_State *L, uint ObjectHandle) {
|
||||
EnsureObjectCallbackTableExists(L, ObjectHandle);
|
||||
|
||||
// Iterate through the table and perform all the callbacks
|
||||
@ -161,7 +161,7 @@ void LuaCallback::InvokeCallbackFunctions(lua_State *L, unsigned int ObjectHandl
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LuaCallback::EnsureObjectCallbackTableExists(lua_State *L, unsigned int ObjectHandle) {
|
||||
void LuaCallback::EnsureObjectCallbackTableExists(lua_State *L, uint ObjectHandle) {
|
||||
PushObjectCallbackTable(L, ObjectHandle);
|
||||
|
||||
// If the table is nil, it must first be created
|
||||
@ -190,7 +190,7 @@ void LuaCallback::PushCallbackTable(lua_State *L) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LuaCallback::PushObjectCallbackTable(lua_State *L, unsigned int ObjectHandle) {
|
||||
void LuaCallback::PushObjectCallbackTable(lua_State *L, uint ObjectHandle) {
|
||||
PushCallbackTable(L);
|
||||
|
||||
// Push Object Callback table onto the stack
|
||||
|
@ -65,14 +65,14 @@ public:
|
||||
virtual ~LuaCallback();
|
||||
|
||||
// Funktion muss auf dem Lua-Stack liegen.
|
||||
void RegisterCallbackFunction(lua_State *L, unsigned int ObjectHandle);
|
||||
void RegisterCallbackFunction(lua_State *L, uint ObjectHandle);
|
||||
|
||||
// Funktion muss auf dem Lua-Stack liegen.
|
||||
void UnregisterCallbackFunction(lua_State *L, unsigned int ObjectHandle);
|
||||
void UnregisterCallbackFunction(lua_State *L, uint ObjectHandle);
|
||||
|
||||
void RemoveAllObjectCallbacks(lua_State *L, unsigned int ObjectHandle);
|
||||
void RemoveAllObjectCallbacks(lua_State *L, uint ObjectHandle);
|
||||
|
||||
void InvokeCallbackFunctions(lua_State *L, unsigned int ObjectHandle);
|
||||
void InvokeCallbackFunctions(lua_State *L, uint ObjectHandle);
|
||||
|
||||
protected:
|
||||
virtual int PreFunctionInvokation(lua_State *L) {
|
||||
@ -80,9 +80,9 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
void EnsureObjectCallbackTableExists(lua_State *L, unsigned int ObjectHandle);
|
||||
void EnsureObjectCallbackTableExists(lua_State *L, uint ObjectHandle);
|
||||
void PushCallbackTable(lua_State *L);
|
||||
void PushObjectCallbackTable(lua_State *L, unsigned int ObjectHandle);
|
||||
void PushObjectCallbackTable(lua_State *L, uint ObjectHandle);
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -181,7 +181,7 @@ bool LuaScriptEngine::ExecuteFile(const Common::String &FileName) {
|
||||
BS_ASSERT(pPackage);
|
||||
|
||||
// File read
|
||||
unsigned int FileSize;
|
||||
uint FileSize;
|
||||
byte *FileData = pPackage->GetFile(FileName, &FileSize);
|
||||
if (!FileData) {
|
||||
BS_LOG_ERRORLN("Couldn't read \"%s\".", FileName.c_str());
|
||||
@ -244,7 +244,7 @@ bool LuaScriptEngine::RegisterStandardLibs() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool LuaScriptEngine::ExecuteBuffer(const byte *Data, unsigned int Size, const Common::String &Name) const {
|
||||
bool LuaScriptEngine::ExecuteBuffer(const byte *Data, uint Size, const Common::String &Name) const {
|
||||
// Compile buffer
|
||||
if (luaL_loadbuffer(m_State, (const char *)Data, Size, Name.c_str()) != 0) {
|
||||
BS_LOG_ERRORLN("Couldn't compile \"%s\":\n%s", Name.c_str(), lua_tostring(m_State, -1));
|
||||
@ -361,7 +361,7 @@ bool PushPermanentsTable(lua_State *L, PERMANENT_TABLE_TYPE TableType) {
|
||||
lua_newtable(L);
|
||||
|
||||
// All standard permanents are inserted into this table
|
||||
unsigned int Index = 0;
|
||||
uint Index = 0;
|
||||
while (STANDARD_PERMANENTS[Index]) {
|
||||
// Permanents are placed onto the stack; if it does not exist, it is simply ignored
|
||||
lua_getglobal(L, STANDARD_PERMANENTS[Index]);
|
||||
|
@ -124,7 +124,7 @@ private:
|
||||
|
||||
bool RegisterStandardLibs();
|
||||
bool RegisterStandardLibExtensions();
|
||||
bool ExecuteBuffer(const byte *Data, unsigned int Size, const Common::String &Name) const;
|
||||
bool ExecuteBuffer(const byte *Data, uint Size, const Common::String &Name) const;
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -133,7 +133,7 @@ bool BS_FMODExChannel::SetLoop(bool Loop) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_FMODExChannel::SetLoopPoints(unsigned int LoopStart, unsigned int LoopEnd) {
|
||||
bool BS_FMODExChannel::SetLoopPoints(uint LoopStart, uint LoopEnd) {
|
||||
BS_ASSERT(m_ChannelPtr);
|
||||
|
||||
FMOD_RESULT Result = FMOD_Channel_SetLoopPoints(m_ChannelPtr, LoopStart, FMOD_TIMEUNIT_PCM, LoopEnd, FMOD_TIMEUNIT_PCM);
|
||||
@ -146,7 +146,7 @@ bool BS_FMODExChannel::SetLoopPoints(unsigned int LoopStart, unsigned int LoopEn
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool BS_FMODExChannel::SetPosition(unsigned int Position) {
|
||||
bool BS_FMODExChannel::SetPosition(uint Position) {
|
||||
BS_ASSERT(m_ChannelPtr);
|
||||
|
||||
FMOD_RESULT Result = FMOD_Channel_SetPosition(m_ChannelPtr, Position, FMOD_TIMEUNIT_PCM);
|
||||
@ -198,10 +198,10 @@ float BS_FMODExChannel::GetPanning() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int BS_FMODExChannel::GetPosition() {
|
||||
uint BS_FMODExChannel::GetPosition() {
|
||||
BS_ASSERT(m_ChannelPtr);
|
||||
|
||||
unsigned int Position = 0;
|
||||
uint Position = 0;
|
||||
FMOD_RESULT Result = FMOD_Channel_GetPosition(m_ChannelPtr, &Position, FMOD_TIMEUNIT_PCM);
|
||||
if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetPosition()", Result).Log();
|
||||
|
||||
@ -210,10 +210,10 @@ unsigned int BS_FMODExChannel::GetPosition() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int BS_FMODExChannel::GetTime() {
|
||||
uint BS_FMODExChannel::GetTime() {
|
||||
BS_ASSERT(m_ChannelPtr);
|
||||
|
||||
unsigned int Time = 0;
|
||||
uint Time = 0;
|
||||
FMOD_RESULT Result = FMOD_Channel_GetPosition(m_ChannelPtr, &Time, FMOD_TIMEUNIT_MS);
|
||||
if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetPosition()", Result).Log();
|
||||
|
||||
@ -222,9 +222,9 @@ unsigned int BS_FMODExChannel::GetTime() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int BS_FMODExChannel::GetLoopStart() {
|
||||
uint BS_FMODExChannel::GetLoopStart() {
|
||||
BS_ASSERT(m_ChannelPtr);
|
||||
unsigned int LoopStart = 0;
|
||||
uint LoopStart = 0;
|
||||
FMOD_RESULT Result = FMOD_Channel_GetLoopPoints(m_ChannelPtr, &LoopStart, FMOD_TIMEUNIT_PCM, 0, FMOD_TIMEUNIT_PCM);
|
||||
if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetLoopPoints()", Result).Log();
|
||||
|
||||
@ -233,9 +233,9 @@ unsigned int BS_FMODExChannel::GetLoopStart() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int BS_FMODExChannel::GetLoopEnd() {
|
||||
uint BS_FMODExChannel::GetLoopEnd() {
|
||||
BS_ASSERT(m_ChannelPtr);
|
||||
unsigned int LoopEnd = 0;
|
||||
uint LoopEnd = 0;
|
||||
FMOD_RESULT Result = FMOD_Channel_GetLoopPoints(m_ChannelPtr, 0, FMOD_TIMEUNIT_PCM, &LoopEnd, FMOD_TIMEUNIT_PCM);
|
||||
if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetLoopPoints()", Result).Log();
|
||||
|
||||
|
@ -61,16 +61,16 @@ public:
|
||||
bool SetVolume(float Volume);
|
||||
bool SetPanning(float Panning);
|
||||
bool SetLoop(bool Loop);
|
||||
bool SetLoopPoints(unsigned int LoopStart, unsigned int LoopEnd);
|
||||
bool SetPosition(unsigned int Position);
|
||||
bool SetLoopPoints(uint LoopStart, uint LoopEnd);
|
||||
bool SetPosition(uint Position);
|
||||
bool Stop();
|
||||
|
||||
float GetVolume();
|
||||
float GetPanning();
|
||||
unsigned int GetPosition();
|
||||
unsigned int GetTime();
|
||||
unsigned int GetLoopStart();
|
||||
unsigned int GetLoopEnd();
|
||||
uint GetPosition();
|
||||
uint GetTime();
|
||||
uint GetLoopStart();
|
||||
uint GetLoopEnd();
|
||||
bool IsLooping();
|
||||
bool IsPaused();
|
||||
bool IsPlaying();
|
||||
|
@ -53,7 +53,7 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
const unsigned int MAX_SAMPLE_SIZE = 100 * 1024; // Die Dateigröße in Byte ab der ein Sound als Stream abgespielt wird
|
||||
const uint MAX_SAMPLE_SIZE = 100 * 1024; // Die Dateigröße in Byte ab der ein Sound als Stream abgespielt wird
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -78,7 +78,7 @@ BS_FMODExResource::BS_FMODExResource(const std::string &FileName, FMOD_SYSTEM *F
|
||||
}
|
||||
|
||||
// Datei laden
|
||||
unsigned int FileSize;
|
||||
uint FileSize;
|
||||
char *FileDataPtr = (char *) PackagePtr->GetFile(GetFileName(), &FileSize);
|
||||
if (!FileDataPtr) {
|
||||
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", GetFileName().c_str());
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
private:
|
||||
FMOD_SOUND *m_SoundPtr;
|
||||
char *m_SoundDataPtr;
|
||||
unsigned int m_SoundDataSize;
|
||||
uint m_SoundDataSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -59,8 +59,8 @@ namespace Sword25 {
|
||||
const float DEFAULT_MUSIC_VOLUME = 1.0f;
|
||||
const float DEFAULT_SPEECH_VOLUME = 1.0f;
|
||||
const float DEFAULT_SFX_VOLUME = 1.0f;
|
||||
const unsigned int SOUNDTYPE_COUNT = 3;
|
||||
const unsigned int INVALID_SOUND_HANDLE = 0xffffffff;
|
||||
const uint SOUNDTYPE_COUNT = 3;
|
||||
const uint INVALID_SOUND_HANDLE = 0xffffffff;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -103,7 +103,7 @@ inline float NormalizeVolume(float Volume) {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
inline FMOD_SOUND_FORMAT BitsPerSampleToFMODExSoundFormat(unsigned int BitsPerSample) {
|
||||
inline FMOD_SOUND_FORMAT BitsPerSampleToFMODExSoundFormat(uint BitsPerSample) {
|
||||
switch (BitsPerSample) {
|
||||
case 8:
|
||||
return FMOD_SOUND_FORMAT_PCM8;
|
||||
@ -155,7 +155,7 @@ Service *FMODExSound_CreateObject(Kernel *pKernel) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool FMODExSound::Init(unsigned int SampleRate, unsigned int Channels) {
|
||||
bool FMODExSound::Init(uint SampleRate, uint Channels) {
|
||||
#if 0
|
||||
// Eine Warnung ausgeben, wenn dieser Service schon initialisiert wurde.
|
||||
// Allerdings wird trotzdem true zurückgegeben, weil kein Fehler aufgetreten ist, der Service ist noch benutzbar.
|
||||
@ -218,7 +218,7 @@ bool FMODExSound::PlaySound(const Common::String &FileName,
|
||||
float Pan,
|
||||
bool Loop,
|
||||
int LoopStart, int LoopEnd,
|
||||
unsigned int Layer) {
|
||||
uint Layer) {
|
||||
#if 0
|
||||
return PlaySoundInternal(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer, 0, 0) != 0;
|
||||
#else
|
||||
@ -228,13 +228,13 @@ bool FMODExSound::PlaySound(const Common::String &FileName,
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int FMODExSound::PlaySoundEx(const Common::String &FileName,
|
||||
uint FMODExSound::PlaySoundEx(const Common::String &FileName,
|
||||
SOUND_TYPES Type,
|
||||
float Volume,
|
||||
float Pan,
|
||||
bool Loop,
|
||||
int LoopStart, int LoopEnd,
|
||||
unsigned int Layer) {
|
||||
uint Layer) {
|
||||
#if 0
|
||||
return PlaySoundInternal(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer, 0, 0);
|
||||
#else
|
||||
@ -245,19 +245,19 @@ unsigned int FMODExSound::PlaySoundEx(const Common::String &FileName,
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype) {
|
||||
FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, uint position, FMOD_TIMEUNIT postype) {
|
||||
// In dynamischen Sounds wird nicht gesprungen, daher tut dieses Funktion nichts.
|
||||
return FMOD_OK;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, unsigned int datalen) {
|
||||
FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, uint datalen) {
|
||||
// Handle auf das aktuelle Soundsystem holen, dies ist wohl dieses hier.
|
||||
BS_FMODExSound *t = reinterpret_cast<BS_FMODExSound *>(BS_Kernel::GetInstance()->GetSfx());
|
||||
|
||||
// Handle auf den richtigen Sound holen, wurde als FMOD Ex Benutzerdaten gesetzt.
|
||||
unsigned int Handle;
|
||||
uint Handle;
|
||||
FMOD_RESULT Result = FMOD_Sound_GetUserData(sound, reinterpret_cast<void **>(&Handle));
|
||||
if (Result != FMOD_OK) {
|
||||
BS_FMODExException("FMOD_Sound_GetUserData()", Result).Log();
|
||||
@ -273,15 +273,15 @@ FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundReadCallback(FMOD_SOUND
|
||||
#endif
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback,
|
||||
uint FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback,
|
||||
void *UserData,
|
||||
SOUND_TYPES Type,
|
||||
unsigned int SampleRate,
|
||||
unsigned int BitsPerSample,
|
||||
unsigned int Channels,
|
||||
uint SampleRate,
|
||||
uint BitsPerSample,
|
||||
uint Channels,
|
||||
float Volume,
|
||||
float Pan,
|
||||
unsigned int Layer) {
|
||||
uint Layer) {
|
||||
#if 0
|
||||
// Parameter überprüfen
|
||||
if (BitsPerSampleToFMODExSoundFormat(BitsPerSample) == FMOD_SOUND_FORMAT_NONE) {
|
||||
@ -294,7 +294,7 @@ unsigned int FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallba
|
||||
}
|
||||
|
||||
// Zu vergebendes Handle bestimmen
|
||||
unsigned int Handle = m_NextHandle++;
|
||||
uint Handle = m_NextHandle++;
|
||||
|
||||
// Sound in die Sound-Map eintragen mit all den Informationen, die wir bisher haben.
|
||||
// Dies muss für dynamische Sounds so früh geschehen, da sofort nach dem Aufruf von FMOD_System_CreateSound der Callback aufgerufen wird um
|
||||
@ -351,15 +351,15 @@ unsigned int FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallba
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
unsigned int BS_FMODExSound::PlaySoundInternal(const Common::String &FileName,
|
||||
uint BS_FMODExSound::PlaySoundInternal(const Common::String &FileName,
|
||||
SOUND_TYPES Type,
|
||||
float Volume,
|
||||
float Pan,
|
||||
bool Loop,
|
||||
int LoopStart, int LoopEnd,
|
||||
unsigned int Layer,
|
||||
unsigned int Position,
|
||||
unsigned int Handle) {
|
||||
uint Layer,
|
||||
uint Position,
|
||||
uint Handle) {
|
||||
BS_ASSERT(m_FMOD);
|
||||
BS_ASSERT(Type < SOUNDTYPE_COUNT);
|
||||
|
||||
@ -384,8 +384,8 @@ unsigned int BS_FMODExSound::PlaySoundInternal(const Common::String &FileName,
|
||||
if (Loop) {
|
||||
// Bestimmen, welche Loop-Points benutzt werden. Falls ein Loop-Point als Parameter nicht spezifiziert wurde (Wert -1),
|
||||
// wird der Loop-Point von FMOD Ex benutzt.
|
||||
unsigned int RealLoopStart = (LoopStart > 0) ? LoopStart : ChannelPtr->GetLoopStart();
|
||||
unsigned int RealLoopEnd = (LoopEnd > 0) ? LoopEnd : ChannelPtr->GetLoopEnd();
|
||||
uint RealLoopStart = (LoopStart > 0) ? LoopStart : ChannelPtr->GetLoopStart();
|
||||
uint RealLoopEnd = (LoopEnd > 0) ? LoopEnd : ChannelPtr->GetLoopEnd();
|
||||
|
||||
// Loop-Points auf Gültigkeit überprüfen
|
||||
if (RealLoopStart > RealLoopEnd) {
|
||||
@ -424,15 +424,15 @@ unsigned int BS_FMODExSound::PlaySoundInternal(const Common::String &FileName,
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int MyLoopStart = ChannelPtr->GetLoopStart();
|
||||
unsigned int MyLoopEnd = ChannelPtr->GetLoopEnd();
|
||||
uint MyLoopStart = ChannelPtr->GetLoopStart();
|
||||
uint MyLoopEnd = ChannelPtr->GetLoopEnd();
|
||||
ChannelPtr->SetLoopPoints(MyLoopStart, MyLoopEnd);
|
||||
|
||||
// Sound abspielen
|
||||
ChannelPtr->SetPaused(false);
|
||||
|
||||
// Sound in die Sound-Map eintragen
|
||||
unsigned int NewHandle = (Handle != 0) ? Handle : m_NextHandle++;
|
||||
uint NewHandle = (Handle != 0) ? Handle : m_NextHandle++;
|
||||
m_PlayingSoundsMap[NewHandle] = PlayingSoundData(SoundResourcePtr, ChannelPtr, Type, Layer, Volume);
|
||||
|
||||
return NewHandle;
|
||||
@ -520,7 +520,7 @@ void FMODExSound::ResumeAll() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void FMODExSound::PauseLayer(unsigned int Layer) {
|
||||
void FMODExSound::PauseLayer(uint Layer) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
|
||||
@ -543,7 +543,7 @@ void FMODExSound::PauseLayer(unsigned int Layer) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void FMODExSound::ResumeLayer(unsigned int Layer) {
|
||||
void FMODExSound::ResumeLayer(uint Layer) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
|
||||
@ -567,7 +567,7 @@ void FMODExSound::ResumeLayer(unsigned int Layer) {
|
||||
// Sound Setter
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void FMODExSound::SetSoundVolume(unsigned int Handle, float Volume) {
|
||||
void FMODExSound::SetSoundVolume(uint Handle, float Volume) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -577,7 +577,7 @@ void FMODExSound::SetSoundVolume(unsigned int Handle, float Volume) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void FMODExSound::SetSoundPanning(unsigned int Handle, float Pan) {
|
||||
void FMODExSound::SetSoundPanning(uint Handle, float Pan) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -587,7 +587,7 @@ void FMODExSound::SetSoundPanning(unsigned int Handle, float Pan) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void FMODExSound::PauseSound(unsigned int Handle) {
|
||||
void FMODExSound::PauseSound(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -600,7 +600,7 @@ void FMODExSound::PauseSound(unsigned int Handle) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void FMODExSound::ResumeSound(unsigned int Handle) {
|
||||
void FMODExSound::ResumeSound(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -613,7 +613,7 @@ void FMODExSound::ResumeSound(unsigned int Handle) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void FMODExSound::StopSound(unsigned int Handle) {
|
||||
void FMODExSound::StopSound(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -625,7 +625,7 @@ void FMODExSound::StopSound(unsigned int Handle) {
|
||||
// Sound Getter
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool FMODExSound::IsSoundPaused(unsigned int Handle) {
|
||||
bool FMODExSound::IsSoundPaused(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -636,7 +636,7 @@ bool FMODExSound::IsSoundPaused(unsigned int Handle) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool FMODExSound::IsSoundPlaying(unsigned int Handle) {
|
||||
bool FMODExSound::IsSoundPlaying(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -647,7 +647,7 @@ bool FMODExSound::IsSoundPlaying(unsigned int Handle) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
float FMODExSound::GetSoundVolume(unsigned int Handle) {
|
||||
float FMODExSound::GetSoundVolume(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -658,7 +658,7 @@ float FMODExSound::GetSoundVolume(unsigned int Handle) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
float FMODExSound::GetSoundPanning(unsigned int Handle) {
|
||||
float FMODExSound::GetSoundPanning(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -669,7 +669,7 @@ float FMODExSound::GetSoundPanning(unsigned int Handle) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
float FMODExSound::GetSoundTime(unsigned int Handle) {
|
||||
float FMODExSound::GetSoundTime(uint Handle) {
|
||||
#if 0
|
||||
BS_ASSERT(m_FMOD);
|
||||
PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle);
|
||||
@ -705,7 +705,7 @@ void BS_FMODExSound::RemoveInactiveSounds() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
BS_FMODExSound::PlayingSoundData *BS_FMODExSound::GetPlayingSoundDataByHandle(unsigned int Handle) {
|
||||
BS_FMODExSound::PlayingSoundData *BS_FMODExSound::GetPlayingSoundDataByHandle(uint Handle) {
|
||||
// Zum Soundhandle gehörige Daten in der Hash-Map finden
|
||||
PSM_ITER it = m_PlayingSoundsMap.find(Handle);
|
||||
// Falls die Daten nicht gefunden werden konnten, Fehler zurückgebene, ansonsten ein Pointer auf die Daten.
|
||||
@ -715,8 +715,8 @@ BS_FMODExSound::PlayingSoundData *BS_FMODExSound::GetPlayingSoundDataByHandle(un
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
unsigned int BS_FMODExSound::CountPlayingDynamicSounds() {
|
||||
unsigned int Result = 0;
|
||||
uint BS_FMODExSound::CountPlayingDynamicSounds() {
|
||||
uint Result = 0;
|
||||
for (PSM_CONST_ITER it = m_PlayingSoundsMap.begin(); it != m_PlayingSoundsMap.end(); ++it) if (!it->second.ResourcePtr) ++Result;
|
||||
|
||||
return Result;
|
||||
@ -772,7 +772,7 @@ bool FMODExSound::Persist(OutputPersistenceBlock &Writer) {
|
||||
RemoveInactiveSounds();
|
||||
|
||||
// Warnung ausgeben, wenn dynamische Sounds abgespielt werden
|
||||
unsigned int PlayingDynamicSounds = CountPlayingDynamicSounds();
|
||||
uint PlayingDynamicSounds = CountPlayingDynamicSounds();
|
||||
if (PlayingDynamicSounds) BS_LOG_WARNINGLN("There are currently dynamic sounds playing. These will not be persisted.");
|
||||
|
||||
// Nächstes Handle speichern
|
||||
@ -792,7 +792,7 @@ bool FMODExSound::Persist(OutputPersistenceBlock &Writer) {
|
||||
|
||||
// Soundeigenschaften speichern
|
||||
Writer.Write(PSD.ResourcePtr->GetFileName());
|
||||
Writer.Write(static_cast<unsigned int>(PSD.Type));
|
||||
Writer.Write(static_cast<uint>(PSD.Type));
|
||||
Writer.Write(PSD.Layer);
|
||||
|
||||
Writer.Write(PSD.Volume);
|
||||
@ -835,22 +835,22 @@ bool FMODExSound::Unpersist(InputPersistenceBlock &Reader) {
|
||||
Reader.Read(m_NextHandle);
|
||||
|
||||
// Soundanzahl einlesen
|
||||
unsigned int SoundCount = 0;
|
||||
uint SoundCount = 0;
|
||||
Reader.Read(SoundCount);
|
||||
|
||||
// Informationen über jeden spielenden Sound einlesen und ihn mit den Parametern abspielen
|
||||
for (unsigned int i = 0; i < SoundCount; ++i) {
|
||||
unsigned int Handle;
|
||||
for (uint i = 0; i < SoundCount; ++i) {
|
||||
uint Handle;
|
||||
Common::String FileName;
|
||||
unsigned int Type;
|
||||
unsigned int Layer;
|
||||
uint Type;
|
||||
uint Layer;
|
||||
|
||||
float Volume;
|
||||
float Pan;
|
||||
bool Loop;
|
||||
unsigned int LoopStart;
|
||||
unsigned int LoopEnd;
|
||||
unsigned int Position;
|
||||
uint LoopStart;
|
||||
uint LoopEnd;
|
||||
uint Position;
|
||||
bool Paused;
|
||||
bool PausedLayer;
|
||||
bool PausedGlobal;
|
||||
|
@ -48,28 +48,28 @@ public:
|
||||
FMODExSound(Kernel *pKernel);
|
||||
virtual ~FMODExSound();
|
||||
|
||||
bool Init(unsigned int SampleRate, unsigned int Channels = 32);
|
||||
bool Init(uint SampleRate, uint Channels = 32);
|
||||
void Update();
|
||||
void SetVolume(float Volume, SOUND_TYPES Type);
|
||||
float GetVolume(SOUND_TYPES Type);
|
||||
void PauseAll();
|
||||
void ResumeAll();
|
||||
void PauseLayer(unsigned int Layer);
|
||||
void ResumeLayer(unsigned int Layer);
|
||||
bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, unsigned int Layer);
|
||||
unsigned int PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, unsigned int Layer);
|
||||
unsigned int PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, unsigned int SampleRate, unsigned int BitsPerSample, unsigned int Channels, float Volume = 1.0f, float Pan = 0.0f, unsigned int Layer = 0);
|
||||
void PauseLayer(uint Layer);
|
||||
void ResumeLayer(uint Layer);
|
||||
bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, uint Layer);
|
||||
uint PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, uint Layer);
|
||||
uint PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, uint SampleRate, uint BitsPerSample, uint Channels, float Volume = 1.0f, float Pan = 0.0f, uint Layer = 0);
|
||||
|
||||
void SetSoundVolume(unsigned int Handle, float Volume);
|
||||
void SetSoundPanning(unsigned int Handle, float Pan);
|
||||
void PauseSound(unsigned int Handle);
|
||||
void ResumeSound(unsigned int Handle);
|
||||
void StopSound(unsigned int Handle);
|
||||
bool IsSoundPaused(unsigned int Handle);
|
||||
bool IsSoundPlaying(unsigned int Handle);
|
||||
float GetSoundVolume(unsigned int Handle);
|
||||
float GetSoundPanning(unsigned int Handle);
|
||||
float GetSoundTime(unsigned int Handle);
|
||||
void SetSoundVolume(uint Handle, float Volume);
|
||||
void SetSoundPanning(uint Handle, float Pan);
|
||||
void PauseSound(uint Handle);
|
||||
void ResumeSound(uint Handle);
|
||||
void StopSound(uint Handle);
|
||||
bool IsSoundPaused(uint Handle);
|
||||
bool IsSoundPlaying(uint Handle);
|
||||
float GetSoundVolume(uint Handle);
|
||||
float GetSoundPanning(uint Handle);
|
||||
float GetSoundTime(uint Handle);
|
||||
|
||||
Resource *LoadResource(const Common::String &FileName);
|
||||
bool CanLoadResource(const Common::String &FileName);
|
||||
@ -85,7 +85,7 @@ public:
|
||||
private:
|
||||
struct PlayingSoundData {
|
||||
PlayingSoundData() {};
|
||||
PlayingSoundData(BS_Resource *ResourcePtr_, BS_FMODExChannel *ChannelPtr_, SOUND_TYPES Type_, unsigned int Layer_, float Volume_, DynamicSoundReadCallback ReadCallback_ = 0, void *UserData_ = 0) :
|
||||
PlayingSoundData(BS_Resource *ResourcePtr_, BS_FMODExChannel *ChannelPtr_, SOUND_TYPES Type_, uint Layer_, float Volume_, DynamicSoundReadCallback ReadCallback_ = 0, void *UserData_ = 0) :
|
||||
ResourcePtr(ResourcePtr_),
|
||||
ChannelPtr(ChannelPtr_),
|
||||
Type(Type_),
|
||||
@ -101,7 +101,7 @@ private:
|
||||
BS_Resource *ResourcePtr;
|
||||
BS_FMODExChannel *ChannelPtr;
|
||||
SOUND_TYPES Type;
|
||||
unsigned int Layer;
|
||||
uint Layer;
|
||||
DynamicSoundReadCallback ReadCallback;
|
||||
void *UserData;
|
||||
|
||||
@ -111,23 +111,23 @@ private:
|
||||
bool PausedGlobal;
|
||||
};
|
||||
|
||||
typedef BS_Hashmap<unsigned int, PlayingSoundData> PSM;
|
||||
typedef BS_Hashmap<unsigned int, PlayingSoundData>::iterator PSM_ITER;
|
||||
typedef BS_Hashmap<unsigned int, PlayingSoundData>::const_iterator PSM_CONST_ITER;
|
||||
typedef BS_Hashmap<uint, PlayingSoundData> PSM;
|
||||
typedef BS_Hashmap<uint, PlayingSoundData>::iterator PSM_ITER;
|
||||
typedef BS_Hashmap<uint, PlayingSoundData>::const_iterator PSM_CONST_ITER;
|
||||
PSM m_PlayingSoundsMap;
|
||||
|
||||
FMOD_SYSTEM *m_FMOD;
|
||||
float m_Volumes[3];
|
||||
unsigned int m_NextHandle;
|
||||
uint m_NextHandle;
|
||||
|
||||
void RemoveInactiveSounds();
|
||||
PlayingSoundData *GetPlayingSoundDataByHandle(unsigned int Handle);
|
||||
unsigned int PlaySoundInternal(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, unsigned int Layer, unsigned int Handle, unsigned int Position);
|
||||
unsigned int CountPlayingDynamicSounds();
|
||||
PlayingSoundData *GetPlayingSoundDataByHandle(uint Handle);
|
||||
uint PlaySoundInternal(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, uint Layer, uint Handle, uint Position);
|
||||
uint CountPlayingDynamicSounds();
|
||||
|
||||
static FMOD_RESULT F_CALLBACK FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype);
|
||||
static FMOD_RESULT F_CALLBACK FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, unsigned int datalen);
|
||||
static FMOD_RESULT F_CALLBACK DSPReadCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels);
|
||||
static FMOD_RESULT F_CALLBACK FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, uint position, FMOD_TIMEUNIT postype);
|
||||
static FMOD_RESULT F_CALLBACK FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, uint datalen);
|
||||
static FMOD_RESULT F_CALLBACK DSPReadCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, uint length, int inchannels, int outchannels);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
* @param Data Pointer to the data buffer
|
||||
* @param DataLength Length of the data to be written in bytes
|
||||
*/
|
||||
typedef void (*DynamicSoundReadCallback)(void *UserData, void *Data, unsigned int DataLength);
|
||||
typedef void (*DynamicSoundReadCallback)(void *UserData, void *Data, uint DataLength);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constructor / destructor
|
||||
@ -101,7 +101,7 @@ public:
|
||||
* @remark Calls to other methods may take place only if this
|
||||
* method was called successfully.
|
||||
*/
|
||||
virtual bool Init(unsigned int SampleRate, unsigned int Channels = 32) = 0;
|
||||
virtual bool Init(uint SampleRate, uint Channels = 32) = 0;
|
||||
|
||||
/**
|
||||
* Performs a "tick" of the sound engine
|
||||
@ -141,13 +141,13 @@ public:
|
||||
* Pauses all sounds of a given layer.
|
||||
* @param Layer The Sound Layer
|
||||
*/
|
||||
virtual void PauseLayer(unsigned int Layer) = 0;
|
||||
virtual void PauseLayer(uint Layer) = 0;
|
||||
|
||||
/**
|
||||
* Resumes all the sounds in a layer that was previously stopped with PauseLayer()
|
||||
* @param Layer The Sound Layer
|
||||
*/
|
||||
virtual void ResumeLayer(unsigned int Layer) = 0;
|
||||
virtual void ResumeLayer(uint Layer) = 0;
|
||||
|
||||
|
||||
/**
|
||||
@ -166,7 +166,7 @@ public:
|
||||
* @remark If more control is needed over the playing, eg. changing the sound parameters
|
||||
* for Volume and Panning, then PlaySoundEx should be used.
|
||||
*/
|
||||
virtual bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, unsigned int Layer = 0) = 0;
|
||||
virtual bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, uint Layer = 0) = 0;
|
||||
|
||||
/**
|
||||
* Plays a sound
|
||||
@ -183,7 +183,7 @@ public:
|
||||
* @remark If more control is needed over the playing, eg. changing the sound parameters
|
||||
* for Volume and Panning, then PlaySoundEx should be used.
|
||||
*/
|
||||
virtual unsigned int PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, unsigned int Layer = 0) = 0;
|
||||
virtual uint PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, uint Layer = 0) = 0;
|
||||
|
||||
/**
|
||||
* Plays a sound generated at runtime
|
||||
@ -202,69 +202,69 @@ public:
|
||||
* @return Returns a handle to the sound. With this handle, the sound can be manipulated during playback.
|
||||
* @remark Dynamic sounds cannot be persisted.
|
||||
*/
|
||||
virtual unsigned int PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, unsigned int SampleRate, unsigned int BitsPerSample, unsigned int Channels, float Volume = 1.0f, float Pan = 0.0f, unsigned int Layer = 0) = 0;
|
||||
virtual uint PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, uint SampleRate, uint BitsPerSample, uint Channels, float Volume = 1.0f, float Pan = 0.0f, uint Layer = 0) = 0;
|
||||
|
||||
/**
|
||||
* Sets the volume of a playing sound
|
||||
* @param Handle The sound handle
|
||||
* @param Volume The volume of the sound (0 = off, 1 = full volume)
|
||||
*/
|
||||
virtual void SetSoundVolume(unsigned int Handle, float Volume) = 0;
|
||||
virtual void SetSoundVolume(uint Handle, float Volume) = 0;
|
||||
|
||||
/**
|
||||
* Sets the panning of a playing sound
|
||||
* @param Handle The sound handle
|
||||
* @param Pan Panning (-1 = full left, 1 = right)
|
||||
*/
|
||||
virtual void SetSoundPanning(unsigned int Handle, float Pan) = 0;
|
||||
virtual void SetSoundPanning(uint Handle, float Pan) = 0;
|
||||
|
||||
/**
|
||||
* Pauses a playing sound
|
||||
* @param Handle The sound handle
|
||||
*/
|
||||
virtual void PauseSound(unsigned int Handle) = 0;
|
||||
virtual void PauseSound(uint Handle) = 0;
|
||||
|
||||
/**
|
||||
* Resumes a paused sound
|
||||
* @param Handle The sound handle
|
||||
*/
|
||||
virtual void ResumeSound(unsigned int Handle) = 0;
|
||||
virtual void ResumeSound(uint Handle) = 0;
|
||||
|
||||
/**
|
||||
* Stops a playing sound
|
||||
* @param Handle The sound handle
|
||||
* @remark Calling this method invalidates the passed handle; it can no longer be used.
|
||||
*/
|
||||
virtual void StopSound(unsigned int Handle) = 0;
|
||||
virtual void StopSound(uint Handle) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether a sound is paused
|
||||
* @param Handle The sound handle
|
||||
* @return Returns true if the sound is paused, false otherwise.
|
||||
*/
|
||||
virtual bool IsSoundPaused(unsigned int Handle) = 0;
|
||||
virtual bool IsSoundPaused(uint Handle) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether a sound is still playing.
|
||||
* @param Handle The sound handle
|
||||
* @return Returns true if the sound is playing, false otherwise.
|
||||
*/
|
||||
virtual bool IsSoundPlaying(unsigned int Handle) = 0;
|
||||
virtual bool IsSoundPlaying(uint Handle) = 0;
|
||||
|
||||
/**
|
||||
* Returns the volume of a playing sound (0 = off, 1 = full volume)
|
||||
*/
|
||||
virtual float GetSoundVolume(unsigned int Handle) = 0;
|
||||
virtual float GetSoundVolume(uint Handle) = 0;
|
||||
|
||||
/**
|
||||
* Returns the panning of a playing sound (-1 = full left, 1 = right)
|
||||
*/
|
||||
virtual float GetSoundPanning(unsigned int Handle) = 0;
|
||||
virtual float GetSoundPanning(uint Handle) = 0;
|
||||
|
||||
/**
|
||||
* Returns the position within a playing sound in seconds
|
||||
*/
|
||||
virtual float GetSoundTime(unsigned int Handle) = 0;
|
||||
virtual float GetSoundTime(uint Handle) = 0;
|
||||
|
||||
private:
|
||||
bool _RegisterScriptBindings();
|
||||
|
@ -55,9 +55,9 @@ static int Init(lua_State *L) {
|
||||
if (lua_gettop(L) == 0)
|
||||
lua_pushbooleancpp(L, pSfx->Init(44100, 32));
|
||||
else if (lua_gettop(L) == 1)
|
||||
lua_pushbooleancpp(L, pSfx->Init(static_cast<unsigned int>(luaL_checknumber(L, 1)), 32));
|
||||
lua_pushbooleancpp(L, pSfx->Init(static_cast<uint>(luaL_checknumber(L, 1)), 32));
|
||||
else
|
||||
lua_pushbooleancpp(L, pSfx->Init(static_cast<unsigned int>(luaL_checknumber(L, 1)), static_cast<unsigned int>(luaL_checknumber(L, 2))));
|
||||
lua_pushbooleancpp(L, pSfx->Init(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<uint>(luaL_checknumber(L, 2))));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -84,7 +84,7 @@ static int SetVolume(lua_State *L) {
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
pSfx->SetVolume(static_cast<float>(luaL_checknumber(L, 1)),
|
||||
static_cast<SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2))));
|
||||
static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 2))));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -97,7 +97,7 @@ static int GetVolume(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
lua_pushnumber(L, pSfx->GetVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 1)))));
|
||||
lua_pushnumber(L, pSfx->GetVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 1)))));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -156,10 +156,10 @@ static int ResumeLayer(lua_State *L) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) {
|
||||
static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, uint &Layer) {
|
||||
FileName = luaL_checkstring(L, 1);
|
||||
|
||||
Type = static_cast<SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2)));
|
||||
Type = static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 2)));
|
||||
|
||||
if (lua_gettop(L) < 3 || lua_isnil(L, 3)) Volume = 1.0f;
|
||||
else Volume = static_cast<float>(luaL_checknumber(L, 3));
|
||||
@ -177,7 +177,7 @@ static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngin
|
||||
else LoopEnd = static_cast<int>(luaL_checknumber(L, 7));
|
||||
|
||||
if (lua_gettop(L) < 8 || lua_isnil(L, 8)) Layer = 0;
|
||||
else Layer = static_cast<unsigned int>(luaL_checknumber(L, 8));
|
||||
else Layer = static_cast<uint>(luaL_checknumber(L, 8));
|
||||
}
|
||||
|
||||
static int PlaySound(lua_State *L) {
|
||||
@ -193,7 +193,7 @@ static int PlaySound(lua_State *L) {
|
||||
bool Loop;
|
||||
int LoopStart;
|
||||
int LoopEnd;
|
||||
unsigned int Layer;
|
||||
uint Layer;
|
||||
ProcessPlayParams(L, FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer);
|
||||
|
||||
lua_pushbooleancpp(L, pSfx->PlaySound(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer));
|
||||
@ -214,7 +214,7 @@ static int PlaySoundEx(lua_State *L) {
|
||||
bool Loop;
|
||||
int LoopStart;
|
||||
int LoopEnd;
|
||||
unsigned int Layer;
|
||||
uint Layer;
|
||||
ProcessPlayParams(L, FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer);
|
||||
|
||||
lua_pushnumber(L, pSfx->PlaySoundEx(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer));
|
||||
@ -230,7 +230,7 @@ static int SetSoundVolume(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
pSfx->SetSoundVolume(static_cast<unsigned int>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2)));
|
||||
pSfx->SetSoundVolume(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -243,7 +243,7 @@ static int SetSoundPanning(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
pSfx->SetSoundPanning(static_cast<unsigned int>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2)));
|
||||
pSfx->SetSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -256,7 +256,7 @@ static int PauseSound(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
pSfx->PauseSound(static_cast<unsigned int>(luaL_checknumber(L, 1)));
|
||||
pSfx->PauseSound(static_cast<uint>(luaL_checknumber(L, 1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -269,7 +269,7 @@ static int ResumeSound(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
pSfx->ResumeSound(static_cast<unsigned int>(luaL_checknumber(L, 1)));
|
||||
pSfx->ResumeSound(static_cast<uint>(luaL_checknumber(L, 1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -282,7 +282,7 @@ static int StopSound(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
pSfx->StopSound(static_cast<unsigned int>(luaL_checknumber(L, 1)));
|
||||
pSfx->StopSound(static_cast<uint>(luaL_checknumber(L, 1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -295,7 +295,7 @@ static int IsSoundPaused(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
lua_pushbooleancpp(L, pSfx->IsSoundPaused(static_cast<unsigned int>(luaL_checknumber(L, 1))));
|
||||
lua_pushbooleancpp(L, pSfx->IsSoundPaused(static_cast<uint>(luaL_checknumber(L, 1))));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -308,7 +308,7 @@ static int IsSoundPlaying(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
lua_pushbooleancpp(L, pSfx->IsSoundPlaying(static_cast<unsigned int>(luaL_checknumber(L, 1))));
|
||||
lua_pushbooleancpp(L, pSfx->IsSoundPlaying(static_cast<uint>(luaL_checknumber(L, 1))));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -321,7 +321,7 @@ static int GetSoundVolume(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
lua_pushnumber(L, pSfx->GetSoundVolume(static_cast<unsigned int>(luaL_checknumber(L, 1))));
|
||||
lua_pushnumber(L, pSfx->GetSoundVolume(static_cast<uint>(luaL_checknumber(L, 1))));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -334,7 +334,7 @@ static int GetSoundPanning(lua_State *L) {
|
||||
SoundEngine *pSfx = static_cast<SoundEngine *>(Kernel::GetInstance()->GetService("sfx"));
|
||||
BS_ASSERT(pSfx);
|
||||
|
||||
lua_pushnumber(L, pSfx->GetSoundPanning(static_cast<unsigned int>(luaL_checknumber(L, 1))));
|
||||
lua_pushnumber(L, pSfx->GetSoundPanning(static_cast<uint>(luaL_checknumber(L, 1))));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user