diff options
Diffstat (limited to 'engines/wintermute')
118 files changed, 318 insertions, 314 deletions
diff --git a/engines/wintermute/AdActor.cpp b/engines/wintermute/AdActor.cpp index 2c945573ec..f7203e7d3b 100644 --- a/engines/wintermute/AdActor.cpp +++ b/engines/wintermute/AdActor.cpp @@ -145,7 +145,7 @@ CAdActor::~CAdActor() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::LoadFile(char *Filename) {
+HRESULT CAdActor::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdActor::LoadFile failed for file '%s'", Filename);
@@ -957,7 +957,7 @@ HRESULT CAdActor::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "UnloadAnim") == 0) {
Stack->CorrectParams(1);
- char *AnimName = Stack->Pop()->GetString();
+ const char *AnimName = Stack->Pop()->GetString();
bool Found = false;
for (int i = 0; i < _anims.GetSize(); i++) {
@@ -983,7 +983,7 @@ HRESULT CAdActor::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "HasAnim") == 0) {
Stack->CorrectParams(1);
- char *AnimName = Stack->Pop()->GetString();
+ const char *AnimName = Stack->Pop()->GetString();
Stack->PushBool(GetAnimByName(AnimName) != NULL);
return S_OK;
}
@@ -1273,7 +1273,7 @@ int CAdActor::GetHeight() { //////////////////////////////////////////////////////////////////////////
-CAdSpriteSet *CAdActor::GetAnimByName(char *AnimName) {
+CAdSpriteSet *CAdActor::GetAnimByName(const char *AnimName) {
if (!AnimName) return NULL;
for (int i = 0; i < _anims.GetSize(); i++) {
@@ -1283,7 +1283,7 @@ CAdSpriteSet *CAdActor::GetAnimByName(char *AnimName) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::MergeAnims(char *AnimsFilename) {
+HRESULT CAdActor::MergeAnims(const char *AnimsFilename) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ANIMATION)
TOKEN_TABLE_END
@@ -1319,7 +1319,7 @@ HRESULT CAdActor::MergeAnims(char *AnimsFilename) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::PlayAnim(char *Filename) {
+HRESULT CAdActor::PlayAnim(const char *Filename) {
// if we have an anim with this name, use it
CAdSpriteSet *Anim = GetAnimByName(Filename);
if (Anim) {
diff --git a/engines/wintermute/AdActor.h b/engines/wintermute/AdActor.h index 1e6b21884d..85b54060c9 100644 --- a/engines/wintermute/AdActor.h +++ b/engines/wintermute/AdActor.h @@ -67,7 +67,7 @@ public: TDirection _dir;
CAdActor(CBGame *inGame/*=NULL*/);
virtual ~CAdActor();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
// new anim system
@@ -77,8 +77,8 @@ public: char *_turnLeftAnimName;
char *_turnRightAnimName;
CBArray<CAdSpriteSet *, CAdSpriteSet *> _anims;
- virtual HRESULT PlayAnim(char *Filename);
- CAdSpriteSet *GetAnimByName(char *AnimName);
+ virtual HRESULT PlayAnim(const char *Filename);
+ CAdSpriteSet *GetAnimByName(const char *AnimName);
// scripting interface
virtual CScValue *ScGetProperty(char *Name);
@@ -89,7 +89,7 @@ public: private:
HRESULT SetDefaultAnimNames();
CBSprite *GetTalkStanceOld(char *Stance);
- HRESULT MergeAnims(char *AnimsFilename);
+ HRESULT MergeAnims(const char *AnimsFilename);
CBSprite *_animSprite2;
void InitLine(CBPoint StartPt, CBPoint EndPt);
diff --git a/engines/wintermute/AdEntity.cpp b/engines/wintermute/AdEntity.cpp index a67cc2109a..1566ad8bbd 100644 --- a/engines/wintermute/AdEntity.cpp +++ b/engines/wintermute/AdEntity.cpp @@ -78,7 +78,7 @@ CAdEntity::~CAdEntity() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::LoadFile(char *Filename) {
+HRESULT CAdEntity::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdEntity::LoadFile failed for file '%s'", Filename);
@@ -934,12 +934,12 @@ HRESULT CAdEntity::Persist(CBPersistMgr *PersistMgr) { //////////////////////////////////////////////////////////////////////////
-void CAdEntity::SetItem(char *ItemName) {
+void CAdEntity::SetItem(const char *ItemName) {
CBUtils::SetString(&_item, ItemName);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::SetSprite(char *Filename) {
+HRESULT CAdEntity::SetSprite(const char *Filename) {
bool SetCurrent = false;
if (_currentSprite == _sprite) {
_currentSprite = NULL;
diff --git a/engines/wintermute/AdEntity.h b/engines/wintermute/AdEntity.h index 1677d3e097..1ee0e75fe4 100644 --- a/engines/wintermute/AdEntity.h +++ b/engines/wintermute/AdEntity.h @@ -35,11 +35,11 @@ namespace WinterMute { class CAdEntity : public CAdTalkHolder {
public:
- HRESULT SetSprite(char *Filename);
+ HRESULT SetSprite(const char *Filename);
int _walkToX;
int _walkToY;
TDirection _walkToDir;
- void SetItem(char *ItemName);
+ void SetItem(const char *ItemName);
char *_item;
DECLARE_PERSISTENT(CAdEntity, CAdTalkHolder)
void UpdatePosition();
@@ -50,7 +50,7 @@ public: virtual HRESULT Display();
CAdEntity(CBGame *inGame);
virtual ~CAdEntity();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
TEntityType _subtype;
diff --git a/engines/wintermute/AdGame.cpp b/engines/wintermute/AdGame.cpp index e736ddc0e0..cce3d5950b 100644 --- a/engines/wintermute/AdGame.cpp +++ b/engines/wintermute/AdGame.cpp @@ -240,7 +240,7 @@ HRESULT CAdGame::RemoveObject(CAdObject *Object) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::ChangeScene(char *Filename, bool FadeIn) {
+HRESULT CAdGame::ChangeScene(const char *Filename, bool FadeIn) {
if (_scene == NULL) {
_scene = new CAdScene(Game);
RegisterObject(_scene);
@@ -319,7 +319,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
if (strcmp(Name, "ChangeScene") == 0) {
Stack->CorrectParams(3);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
CScValue *valFadeOut = Stack->Pop();
CScValue *valFadeIn = Stack->Pop();
@@ -461,7 +461,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This else if (strcmp(Name, "AddResponse") == 0 || strcmp(Name, "AddResponseOnce") == 0 || strcmp(Name, "AddResponseOnceGame") == 0) {
Stack->CorrectParams(6);
int id = Stack->Pop()->GetInt();
- char *text = Stack->Pop()->GetString();
+ const char *text = Stack->Pop()->GetString();
CScValue *val1 = Stack->Pop();
CScValue *val2 = Stack->Pop();
CScValue *val3 = Stack->Pop();
@@ -571,17 +571,13 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This else if (strcmp(Name, "StartDlgBranch") == 0) {
Stack->CorrectParams(1);
CScValue *Val = Stack->Pop();
- char *BranchName = NULL;
- bool DeleteName = false;
+ Common::String BranchName;
if (Val->IsNULL()) {
- BranchName = new char[20];
- sprintf(BranchName, "line%d", Script->_currentLine);
- DeleteName = true;
+ BranchName.format("line%d", Script->_currentLine);
} else BranchName = Val->GetString();
- StartDlgBranch(BranchName, Script->_filename == NULL ? "" : Script->_filename, Script->_threadEvent == NULL ? "" : Script->_threadEvent);
+ StartDlgBranch(BranchName.c_str(), Script->_filename == NULL ? "" : Script->_filename, Script->_threadEvent == NULL ? "" : Script->_threadEvent);
Stack->PushNULL();
- if (DeleteName) delete[] BranchName;
return S_OK;
}
@@ -592,7 +588,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This else if (strcmp(Name, "EndDlgBranch") == 0) {
Stack->CorrectParams(1);
- char *BranchName = NULL;
+ const char *BranchName = NULL;
CScValue *Val = Stack->Pop();
if (!Val->IsNULL()) BranchName = Val->GetString();
EndDlgBranch(BranchName, Script->_filename == NULL ? "" : Script->_filename, Script->_threadEvent == NULL ? "" : Script->_threadEvent);
@@ -701,7 +697,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "LoadResponseBox") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
Game->UnregisterObject(_responseBox);
_responseBox = new CAdResponseBox(Game);
@@ -720,7 +716,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "LoadInventoryBox") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
Game->UnregisterObject(_inventoryBox);
_inventoryBox = new CAdInventoryBox(Game);
@@ -740,7 +736,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "LoadItems") == 0) {
Stack->CorrectParams(2);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool Merge = Stack->Pop()->GetBool(false);
HRESULT Ret = LoadItemsFile(Filename, Merge);
@@ -754,7 +750,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "AddSpeechDir") == 0) {
Stack->CorrectParams(1);
- char *Dir = Stack->Pop()->GetString();
+ const char *Dir = Stack->Pop()->GetString();
Stack->PushBool(SUCCEEDED(AddSpeechDir(Dir)));
return S_OK;
@@ -765,7 +761,7 @@ HRESULT CAdGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "RemoveSpeechDir") == 0) {
Stack->CorrectParams(1);
- char *Dir = Stack->Pop()->GetString();
+ const char *Dir = Stack->Pop()->GetString();
Stack->PushBool(SUCCEEDED(RemoveSpeechDir(Dir)));
return S_OK;
@@ -1314,7 +1310,7 @@ HRESULT CAdGame::Persist(CBPersistMgr *PersistMgr) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::LoadGame(char *Filename) {
+HRESULT CAdGame::LoadGame(const char *Filename) {
HRESULT ret = CBGame::LoadGame(Filename);
if (SUCCEEDED(ret)) CSysClassRegistry::GetInstance()->EnumInstances(AfterLoadRegion, "CAdRegion", NULL);
return ret;
@@ -1356,7 +1352,7 @@ void CAdGame::SetPrevSceneFilename(char *Name) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::ScheduleChangeScene(char *Filename, bool FadeIn) {
+HRESULT CAdGame::ScheduleChangeScene(const char *Filename, bool FadeIn) {
delete[] _scheduledScene;
_scheduledScene = NULL;
@@ -1384,7 +1380,7 @@ HRESULT CAdGame::GetVersion(byte *VerMajor, byte *VerMinor, byte *ExtMajor, byt //////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::LoadItemsFile(char *Filename, bool Merge) {
+HRESULT CAdGame::LoadItemsFile(const char *Filename, bool Merge) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdGame::LoadItemsFile failed for file '%s'", Filename);
@@ -1776,7 +1772,7 @@ bool CAdGame::IsItemTaken(char *ItemName) { }
//////////////////////////////////////////////////////////////////////////
-CAdItem *CAdGame::GetItemByName(char *Name) {
+CAdItem *CAdGame::GetItemByName(const char *Name) {
for (int i = 0; i < _items.GetSize(); i++) {
if (scumm_stricmp(_items[i]->_name, Name) == 0) return _items[i];
}
@@ -1875,7 +1871,7 @@ HRESULT CAdGame::AddSpeechDir(const char *Dir) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::RemoveSpeechDir(char *Dir) {
+HRESULT CAdGame::RemoveSpeechDir(const char *Dir) {
if (!Dir || Dir[0] == '\0') return E_FAIL;
char *Temp = new char[strlen(Dir) + 2];
diff --git a/engines/wintermute/AdGame.h b/engines/wintermute/AdGame.h index fd943f6fcf..1558a2ad0e 100644 --- a/engines/wintermute/AdGame.h +++ b/engines/wintermute/AdGame.h @@ -62,7 +62,7 @@ public: CBArray<char *, char *> _speechDirs;
HRESULT AddSpeechDir(const char *Dir);
- HRESULT RemoveSpeechDir(char *Dir);
+ HRESULT RemoveSpeechDir(const char *Dir);
char *FindSpeechFile(char *StringID);
HRESULT DeleteItem(CAdItem *Item);
@@ -70,7 +70,7 @@ public: bool _tempDisableSaveState;
virtual HRESULT ResetContent();
HRESULT AddItem(CAdItem *Item);
- CAdItem *GetItemByName(char *Name);
+ CAdItem *GetItemByName(const char *Name);
CBArray<CAdItem *, CAdItem *> _items;
CAdObject *_inventoryOwner;
bool IsItemTaken(char *ItemName);
@@ -105,14 +105,14 @@ public: TTalkSkipButton _talkSkipButton;
virtual HRESULT GetVersion(byte *VerMajor, byte *VerMinor, byte *ExtMajor, byte *ExtMinor);
- HRESULT ScheduleChangeScene(char *Filename, bool FadeIn);
+ HRESULT ScheduleChangeScene(const char *Filename, bool FadeIn);
char *_scheduledScene;
bool _scheduledFadeIn;
void SetPrevSceneName(char *Name);
void SetPrevSceneFilename(char *Name);
char *_prevSceneName;
char *_prevSceneFilename;
- virtual HRESULT LoadGame(char *Filename);
+ virtual HRESULT LoadGame(const char *Filename);
CAdItem *_selectedItem;
HRESULT Cleanup();
DECLARE_PERSISTENT(CAdGame, CBGame)
@@ -124,7 +124,7 @@ public: CAdInventoryBox *_inventoryBox;
HRESULT DisplaySentences(bool Frozen);
void AddSentence(CAdSentence *Sentence);
- HRESULT ChangeScene(char *Filename, bool FadeIn);
+ HRESULT ChangeScene(const char *Filename, bool FadeIn);
HRESULT RemoveObject(CAdObject *Object);
HRESULT AddObject(CAdObject *Object);
CAdScene *_scene;
@@ -143,7 +143,7 @@ public: virtual HRESULT LoadFile(const char *Filename);
virtual HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
- HRESULT LoadItemsFile(char *Filename, bool Merge = false);
+ HRESULT LoadItemsFile(const char *Filename, bool Merge = false);
HRESULT LoadItemsBuffer(byte *Buffer, bool Merge = false);
diff --git a/engines/wintermute/AdInventory.cpp b/engines/wintermute/AdInventory.cpp index a7024523a8..735b9a542e 100644 --- a/engines/wintermute/AdInventory.cpp +++ b/engines/wintermute/AdInventory.cpp @@ -49,7 +49,7 @@ CAdInventory::~CAdInventory() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventory::InsertItem(char *Name, char *InsertAfter) {
+HRESULT CAdInventory::InsertItem(const char *Name, const char *InsertAfter) {
if (Name == NULL) return E_FAIL;
CAdItem *item = ((CAdGame *)Game)->GetItemByName(Name);
@@ -74,7 +74,7 @@ HRESULT CAdInventory::InsertItem(char *Name, char *InsertAfter) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventory::RemoveItem(char *Name) {
+HRESULT CAdInventory::RemoveItem(const char *Name) {
if (Name == NULL) return E_FAIL;
for (int i = 0; i < _takenItems.GetSize(); i++) {
diff --git a/engines/wintermute/AdInventory.h b/engines/wintermute/AdInventory.h index 159886aa2f..2012054217 100644 --- a/engines/wintermute/AdInventory.h +++ b/engines/wintermute/AdInventory.h @@ -38,9 +38,9 @@ class CAdItem; class CAdInventory : public CBObject {
public:
DECLARE_PERSISTENT(CAdInventory, CBObject)
- HRESULT RemoveItem(char *Name);
+ HRESULT RemoveItem(const char *Name);
HRESULT RemoveItem(CAdItem *Item);
- HRESULT InsertItem(char *Name, char *InsertAfter = NULL);
+ HRESULT InsertItem(const char *Name, const char *InsertAfter = NULL);
CAdInventory(CBGame *inGame);
virtual ~CAdInventory();
CBArray<CAdItem *, CAdItem *> _takenItems;
diff --git a/engines/wintermute/AdInventoryBox.cpp b/engines/wintermute/AdInventoryBox.cpp index 5ab011c5dc..6c093941bf 100644 --- a/engines/wintermute/AdInventoryBox.cpp +++ b/engines/wintermute/AdInventoryBox.cpp @@ -152,7 +152,7 @@ HRESULT CAdInventoryBox::Display() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventoryBox::LoadFile(char *Filename) {
+HRESULT CAdInventoryBox::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdInventoryBox::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdInventoryBox.h b/engines/wintermute/AdInventoryBox.h index 724a6298f4..3606e96123 100644 --- a/engines/wintermute/AdInventoryBox.h +++ b/engines/wintermute/AdInventoryBox.h @@ -53,7 +53,7 @@ public: CUIWindow *_window;
CAdInventoryBox(CBGame *inGame);
virtual ~CAdInventoryBox();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
};
diff --git a/engines/wintermute/AdItem.cpp b/engines/wintermute/AdItem.cpp index d4746015d8..82cdb5e349 100644 --- a/engines/wintermute/AdItem.cpp +++ b/engines/wintermute/AdItem.cpp @@ -84,7 +84,7 @@ CAdItem::~CAdItem() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::LoadFile(char *Filename) {
+HRESULT CAdItem::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdItem::LoadFile failed for file '%s'", Filename);
@@ -438,7 +438,7 @@ HRESULT CAdItem::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This bool SetCurrent = false;
if (_currentSprite && _currentSprite == _spriteHover) SetCurrent = true;
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
delete _spriteHover;
_spriteHover = NULL;
@@ -481,7 +481,7 @@ HRESULT CAdItem::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This if (strcmp(Name, "SetNormalCursor") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
delete _cursorNormal;
_cursorNormal = NULL;
@@ -524,7 +524,7 @@ HRESULT CAdItem::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This if (strcmp(Name, "SetHoverCursor") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
delete _cursorHover;
_cursorHover = NULL;
diff --git a/engines/wintermute/AdItem.h b/engines/wintermute/AdItem.h index c5144eff12..46993d935f 100644 --- a/engines/wintermute/AdItem.h +++ b/engines/wintermute/AdItem.h @@ -55,7 +55,7 @@ public: CBSprite *_cursorHover;
CAdItem(CBGame *inGame);
virtual ~CAdItem();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
// scripting interface
diff --git a/engines/wintermute/AdLayer.cpp b/engines/wintermute/AdLayer.cpp index ea87cd3727..744e278115 100644 --- a/engines/wintermute/AdLayer.cpp +++ b/engines/wintermute/AdLayer.cpp @@ -61,7 +61,7 @@ CAdLayer::~CAdLayer() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdLayer::LoadFile(char *Filename) {
+HRESULT CAdLayer::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdLayer::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdLayer.h b/engines/wintermute/AdLayer.h index ad24759fa9..48b9cfdc27 100644 --- a/engines/wintermute/AdLayer.h +++ b/engines/wintermute/AdLayer.h @@ -42,7 +42,7 @@ public: CAdLayer(CBGame *inGame);
virtual ~CAdLayer();
CBArray<CAdSceneNode *, CAdSceneNode *> _nodes;
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
diff --git a/engines/wintermute/AdNodeState.cpp b/engines/wintermute/AdNodeState.cpp index 5df3aa8b17..f3cdb6cc4d 100644 --- a/engines/wintermute/AdNodeState.cpp +++ b/engines/wintermute/AdNodeState.cpp @@ -76,7 +76,7 @@ void CAdNodeState::SetName(char *Name) { //////////////////////////////////////////////////////////////////////////
-void CAdNodeState::SetFilename(char *Filename) {
+void CAdNodeState::SetFilename(const char *Filename) {
delete[] _filename;
_filename = NULL;
CBUtils::SetString(&_filename, Filename);
@@ -84,7 +84,7 @@ void CAdNodeState::SetFilename(char *Filename) { //////////////////////////////////////////////////////////////////////////
-void CAdNodeState::SetCursor(char *Filename) {
+void CAdNodeState::SetCursor(const char *Filename) {
delete[] _cursor;
_cursor = NULL;
CBUtils::SetString(&_cursor, Filename);
diff --git a/engines/wintermute/AdNodeState.h b/engines/wintermute/AdNodeState.h index 4c5b87fb89..7c959e3168 100644 --- a/engines/wintermute/AdNodeState.h +++ b/engines/wintermute/AdNodeState.h @@ -37,8 +37,8 @@ class CAdNodeState : public CBBase { public:
HRESULT TransferEntity(CAdEntity *Entity, bool IncludingSprites, bool Saving);
void SetName(char *Name);
- void SetFilename(char *Filename);
- void SetCursor(char *Filename);
+ void SetFilename(const char *Filename);
+ void SetCursor(const char *Filename);
DECLARE_PERSISTENT(CAdNodeState, CBBase)
CAdNodeState(CBGame *inGame);
virtual ~CAdNodeState();
diff --git a/engines/wintermute/AdObject.cpp b/engines/wintermute/AdObject.cpp index 95b48b8401..38c3336eae 100644 --- a/engines/wintermute/AdObject.cpp +++ b/engines/wintermute/AdObject.cpp @@ -145,7 +145,7 @@ CAdObject::~CAdObject() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::PlayAnim(char *Filename) {
+HRESULT CAdObject::PlayAnim(const char *Filename) {
SAFE_DELETE(_animSprite);
_animSprite = new CBSprite(Game, this);
if (!_animSprite) {
@@ -232,7 +232,7 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "ForceTalkAnim") == 0) {
Stack->CorrectParams(1);
- char *AnimName = Stack->Pop()->GetString();
+ const char *AnimName = Stack->Pop()->GetString();
SAFE_DELETE_ARRAY(_forcedTalkAnimName);
_forcedTalkAnimName = new char[strlen(AnimName) + 1];
strcpy(_forcedTalkAnimName, AnimName);
@@ -248,12 +248,12 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th else if (strcmp(Name, "Talk") == 0 || strcmp(Name, "TalkAsync") == 0) {
Stack->CorrectParams(5);
- char *Text = Stack->Pop()->GetString();
+ const char *Text = Stack->Pop()->GetString();
CScValue *SoundVal = Stack->Pop();
int Duration = Stack->Pop()->GetInt();
CScValue *ValStances = Stack->Pop();
- char *Stances = ValStances->IsNULL() ? NULL : ValStances->GetString();
+ const char *Stances = ValStances->IsNULL() ? NULL : ValStances->GetString();
int Align;
CScValue *val = Stack->Pop();
@@ -262,7 +262,7 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th Align = MIN(MAX(0, Align), NUM_TEXT_ALIGN - 1);
- char *Sound = SoundVal->IsNULL() ? NULL : SoundVal->GetString();
+ const char *Sound = SoundVal->IsNULL() ? NULL : SoundVal->GetString();
Talk(Text, Sound, Duration, Stances, (TTextAlign)Align);
if (strcmp(Name, "TalkAsync") != 0) Script->WaitForExclusive(this);
@@ -286,7 +286,7 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th _stickRegion = NULL;
RegFound = true;
} else if (Val->IsString()) {
- char *RegionName = Val->GetString();
+ const char *RegionName = Val->GetString();
for (i = 0; i < Main->_nodes.GetSize(); i++) {
if (Main->_nodes[i]->_type == OBJECT_REGION && Main->_nodes[i]->_region->_name && scumm_stricmp(Main->_nodes[i]->_region->_name, RegionName) == 0) {
_stickRegion = Main->_nodes[i]->_region;
@@ -349,9 +349,9 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th CScValue *val = Stack->Pop();
if (!val->IsNULL()) {
- char *ItemName = val->GetString();
+ const char *ItemName = val->GetString();
val = Stack->Pop();
- char *InsertAfter = val->IsNULL() ? NULL : val->GetString();
+ const char *InsertAfter = val->IsNULL() ? NULL : val->GetString();
if (FAILED(_inventory->InsertItem(ItemName, InsertAfter))) Script->RuntimeError("Cannot add item '%s' to inventory", ItemName);
else {
// hide associated entities
@@ -475,7 +475,7 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "AddAttachment") == 0) {
Stack->CorrectParams(4);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool PreDisplay = Stack->Pop()->GetBool(true);
int OffsetX = Stack->Pop()->GetInt();
int OffsetY = Stack->Pop()->GetInt();
@@ -528,7 +528,7 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th }
}
} else {
- char *Name = Val->GetString();
+ const char *Name = Val->GetString();
for (int i = 0; i < _attachmentsPre.GetSize(); i++) {
if (_attachmentsPre[i]->_name && scumm_stricmp(_attachmentsPre[i]->_name, Name) == 0) {
Found = true;
@@ -571,7 +571,7 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th CurrIndex++;
}
} else {
- char *Name = Val->GetString();
+ const char *Name = Val->GetString();
for (int i = 0; i < _attachmentsPre.GetSize(); i++) {
if (_attachmentsPre[i]->_name && scumm_stricmp(_attachmentsPre[i]->_name, Name) == 0) {
Ret = _attachmentsPre[i];
@@ -783,7 +783,7 @@ char *CAdObject::ScToString() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::SetFont(char *Filename) {
+HRESULT CAdObject::SetFont(const char *Filename) {
if (_font) Game->_fontStorage->RemoveFont(_font);
if (Filename) {
_font = Game->_fontStorage->AddFont(Filename);
@@ -815,7 +815,7 @@ int CAdObject::GetHeight() { //////////////////////////////////////////////////////////////////////////
-void CAdObject::Talk(char *Text, char *Sound, uint32 Duration, char *Stances, TTextAlign Align) {
+void CAdObject::Talk(const char *Text, const char *Sound, uint32 Duration, const char *Stances, TTextAlign Align) {
if (!_sentence) _sentence = new CAdSentence(Game);
if (!_sentence) return;
diff --git a/engines/wintermute/AdObject.h b/engines/wintermute/AdObject.h index 7e0e277edb..f229fb7653 100644 --- a/engines/wintermute/AdObject.h +++ b/engines/wintermute/AdObject.h @@ -69,15 +69,15 @@ public: virtual HRESULT UpdateSounds();
HRESULT Reset();
DECLARE_PERSISTENT(CAdObject, CBObject)
- virtual void Talk(char *Text, char *Sound = NULL, uint32 Duration = 0, char *Stances = NULL, TTextAlign Align = TAL_CENTER);
+ virtual void Talk(const char *Text, const char *Sound = NULL, uint32 Duration = 0, const char *Stances = NULL, TTextAlign Align = TAL_CENTER);
virtual int GetHeight();
CAdSentence *_sentence;
- HRESULT SetFont(char *Filename);
+ HRESULT SetFont(const char *Filename);
virtual HRESULT Update();
virtual HRESULT Display();
bool _drawn;
bool _active;
- virtual HRESULT PlayAnim(char *Filename);
+ virtual HRESULT PlayAnim(const char *Filename);
CBSprite *_animSprite;
CBSprite *_currentSprite;
TObjectState _state;
diff --git a/engines/wintermute/AdRegion.cpp b/engines/wintermute/AdRegion.cpp index cd8ab049f9..81cb8fc72e 100644 --- a/engines/wintermute/AdRegion.cpp +++ b/engines/wintermute/AdRegion.cpp @@ -54,7 +54,7 @@ CAdRegion::~CAdRegion() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdRegion::LoadFile(char *Filename) {
+HRESULT CAdRegion::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdRegion::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdRegion.h b/engines/wintermute/AdRegion.h index b1e977155b..896db1f772 100644 --- a/engines/wintermute/AdRegion.h +++ b/engines/wintermute/AdRegion.h @@ -42,7 +42,7 @@ public: bool _decoration;
CAdRegion(CBGame *inGame);
virtual ~CAdRegion();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
diff --git a/engines/wintermute/AdResponse.cpp b/engines/wintermute/AdResponse.cpp index c02b2832b5..2e5ddc54b7 100644 --- a/engines/wintermute/AdResponse.cpp +++ b/engines/wintermute/AdResponse.cpp @@ -65,14 +65,14 @@ CAdResponse::~CAdResponse() { //////////////////////////////////////////////////////////////////////////
-void CAdResponse::SetText(char *Text) {
+void CAdResponse::SetText(const char *Text) {
CBUtils::SetString(&_text, Text);
CBUtils::SetString(&_textOrig, Text);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::SetIcon(char *Filename) {
+HRESULT CAdResponse::SetIcon(const char *Filename) {
delete _icon;
_icon = new CBSprite(Game);
if (!_icon || FAILED(_icon->LoadFile(Filename))) {
@@ -85,7 +85,7 @@ HRESULT CAdResponse::SetIcon(char *Filename) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::SetFont(char *Filename) {
+HRESULT CAdResponse::SetFont(const char *Filename) {
if (_font) Game->_fontStorage->RemoveFont(_font);
_font = Game->_fontStorage->AddFont(Filename);
if (!_font) {
@@ -96,7 +96,7 @@ HRESULT CAdResponse::SetFont(char *Filename) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::SetIconHover(char *Filename) {
+HRESULT CAdResponse::SetIconHover(const char *Filename) {
delete _iconHover;
_iconHover = new CBSprite(Game);
if (!_iconHover || FAILED(_iconHover->LoadFile(Filename))) {
@@ -110,7 +110,7 @@ HRESULT CAdResponse::SetIconHover(char *Filename) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::SetIconPressed(char *Filename) {
+HRESULT CAdResponse::SetIconPressed(const char *Filename) {
delete _iconPressed;
_iconPressed = new CBSprite(Game);
if (!_iconPressed || FAILED(_iconPressed->LoadFile(Filename))) {
diff --git a/engines/wintermute/AdResponse.h b/engines/wintermute/AdResponse.h index 97fe5bccb0..f42926e476 100644 --- a/engines/wintermute/AdResponse.h +++ b/engines/wintermute/AdResponse.h @@ -38,11 +38,11 @@ class CBFont; class CAdResponse : public CBObject {
public:
DECLARE_PERSISTENT(CAdResponse, CBObject)
- HRESULT SetIcon(char *Filename);
- HRESULT SetFont(char *Filename);
- HRESULT SetIconHover(char *Filename);
- HRESULT SetIconPressed(char *Filename);
- void SetText(char *Text);
+ HRESULT SetIcon(const char *Filename);
+ HRESULT SetFont(const char *Filename);
+ HRESULT SetIconHover(const char *Filename);
+ HRESULT SetIconPressed(const char *Filename);
+ void SetText(const char *Text);
int _iD;
CBSprite *_icon;
CBSprite *_iconHover;
diff --git a/engines/wintermute/AdResponseBox.cpp b/engines/wintermute/AdResponseBox.cpp index 45b73ae148..d64230ceb7 100644 --- a/engines/wintermute/AdResponseBox.cpp +++ b/engines/wintermute/AdResponseBox.cpp @@ -183,7 +183,7 @@ HRESULT CAdResponseBox::CreateButtons() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::LoadFile(char *Filename) {
+HRESULT CAdResponseBox::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdResponseBox::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdResponseBox.h b/engines/wintermute/AdResponseBox.h index be14a6f248..de22874e72 100644 --- a/engines/wintermute/AdResponseBox.h +++ b/engines/wintermute/AdResponseBox.h @@ -75,7 +75,7 @@ public: RECT _responseArea;
int _verticalAlign;
TTextAlign _align;
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
};
diff --git a/engines/wintermute/AdRotLevel.cpp b/engines/wintermute/AdRotLevel.cpp index 1c2ba3ed65..b5256f2050 100644 --- a/engines/wintermute/AdRotLevel.cpp +++ b/engines/wintermute/AdRotLevel.cpp @@ -53,7 +53,7 @@ CAdRotLevel::~CAdRotLevel() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdRotLevel::LoadFile(char *Filename) {
+HRESULT CAdRotLevel::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdRotLevel::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdRotLevel.h b/engines/wintermute/AdRotLevel.h index 6033935349..bd78cedb65 100644 --- a/engines/wintermute/AdRotLevel.h +++ b/engines/wintermute/AdRotLevel.h @@ -40,7 +40,7 @@ public: virtual ~CAdRotLevel();
float _rotation;
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
};
diff --git a/engines/wintermute/AdScaleLevel.cpp b/engines/wintermute/AdScaleLevel.cpp index 4edb24eca1..546e0f7f8e 100644 --- a/engines/wintermute/AdScaleLevel.cpp +++ b/engines/wintermute/AdScaleLevel.cpp @@ -51,7 +51,7 @@ CAdScaleLevel::~CAdScaleLevel() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdScaleLevel::LoadFile(char *Filename) {
+HRESULT CAdScaleLevel::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdScaleLevel::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdScaleLevel.h b/engines/wintermute/AdScaleLevel.h index fb0cd38264..efaa5f5e57 100644 --- a/engines/wintermute/AdScaleLevel.h +++ b/engines/wintermute/AdScaleLevel.h @@ -41,7 +41,7 @@ public: CAdScaleLevel(CBGame *inGame);
virtual ~CAdScaleLevel();
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
};
diff --git a/engines/wintermute/AdScene.cpp b/engines/wintermute/AdScene.cpp index a35f2550a1..b8ee74eb71 100644 --- a/engines/wintermute/AdScene.cpp +++ b/engines/wintermute/AdScene.cpp @@ -504,7 +504,7 @@ HRESULT CAdScene::InitLoop() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::LoadFile(char *Filename) {
+HRESULT CAdScene::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdScene::LoadFile failed for file '%s'", Filename);
@@ -1353,7 +1353,7 @@ HRESULT CAdScene::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi if (layer < 0 || layer >= _layers.GetSize()) Stack->PushNULL();
else Stack->PushNative(_layers[layer], true);
} else {
- char *LayerName = val->GetString();
+ const char *LayerName = val->GetString();
bool LayerFound = false;
for (int i = 0; i < _layers.GetSize(); i++) {
if (scumm_stricmp(LayerName, _layers[i]->_name) == 0) {
@@ -1383,7 +1383,7 @@ HRESULT CAdScene::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "GetNode") == 0) {
Stack->CorrectParams(1);
- char *Name = Stack->Pop()->GetString();
+ const char *Name = Stack->Pop()->GetString();
CBObject *node = GetNodeByName(Name);
if (node) Stack->PushNative((CBScriptable *)node, true);
@@ -1404,7 +1404,7 @@ HRESULT CAdScene::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi int Index = Val->GetInt();
if (Index >= 0 && Index < _objects.GetSize()) Ret = _objects[Index];
} else {
- char *Name = Val->GetString();
+ const char *Name = Val->GetString();
for (int i = 0; i < _objects.GetSize(); i++) {
if (_objects[i] && _objects[i]->_name && scumm_stricmp(_objects[i]->_name, Name) == 0) {
Ret = _objects[i];
@@ -2426,7 +2426,7 @@ void CAdScene::SetOffset(int OffsetLeft, int OffsetTop) { //////////////////////////////////////////////////////////////////////////
-CBObject *CAdScene::GetNodeByName(char *Name) {
+CBObject *CAdScene::GetNodeByName(const char *Name) {
int i;
CBObject *ret = NULL;
@@ -2574,7 +2574,7 @@ float CAdScene::GetRotationAt(int X, int Y) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::HandleItemAssociations(char *ItemName, bool Show) {
+HRESULT CAdScene::HandleItemAssociations(const char *ItemName, bool Show) {
int i;
for (i = 0; i < _layers.GetSize(); i++) {
diff --git a/engines/wintermute/AdScene.h b/engines/wintermute/AdScene.h index 874e05ac61..cfedc8a911 100644 --- a/engines/wintermute/AdScene.h +++ b/engines/wintermute/AdScene.h @@ -55,14 +55,14 @@ public: HRESULT AfterLoad();
HRESULT GetRegionsAt(int X, int Y, CAdRegion **RegionList, int NumRegions);
- HRESULT HandleItemAssociations(char *ItemName, bool Show);
+ HRESULT HandleItemAssociations(const char *ItemName, bool Show);
CUIWindow *_shieldWindow;
float GetRotationAt(int X, int Y);
HRESULT LoadState();
HRESULT SaveState();
bool _persistentState;
bool _persistentStateSprites;
- CBObject *GetNodeByName(char *Name);
+ CBObject *GetNodeByName(const char *Name);
void SetOffset(int OffsetLeft, int OffsetTop);
bool PointInViewport(int X, int Y);
int GetOffsetTop();
@@ -123,7 +123,7 @@ public: CBArray<CAdLayer *, CAdLayer *> _layers;
CBArray<CAdObject *, CAdObject *> _objects;
CBArray<CAdWaypointGroup *, CAdWaypointGroup *> _waypointGroups;
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
int _width;
int _height;
diff --git a/engines/wintermute/AdSceneState.cpp b/engines/wintermute/AdSceneState.cpp index 2fd2648448..a7acbe78d1 100644 --- a/engines/wintermute/AdSceneState.cpp +++ b/engines/wintermute/AdSceneState.cpp @@ -62,7 +62,7 @@ HRESULT CAdSceneState::Persist(CBPersistMgr *PersistMgr) { //////////////////////////////////////////////////////////////////////////
-void CAdSceneState::SetFilename(char *Filename) {
+void CAdSceneState::SetFilename(const char *Filename) {
SAFE_DELETE_ARRAY(_filename);
_filename = new char [strlen(Filename) + 1];
if (_filename) strcpy(_filename, Filename);
diff --git a/engines/wintermute/AdSceneState.h b/engines/wintermute/AdSceneState.h index a49f0ba5f7..81d84529b8 100644 --- a/engines/wintermute/AdSceneState.h +++ b/engines/wintermute/AdSceneState.h @@ -38,7 +38,7 @@ class CAdNodeState; class CAdSceneState : public CBBase {
public:
CAdNodeState *GetNodeState(char *Name, bool Saving);
- void SetFilename(char *Filename);
+ void SetFilename(const char *Filename);
DECLARE_PERSISTENT(CAdSceneState, CBBase)
CAdSceneState(CBGame *inGame);
virtual ~CAdSceneState();
diff --git a/engines/wintermute/AdSentence.cpp b/engines/wintermute/AdSentence.cpp index 81bcfcf366..b5ba7915cf 100644 --- a/engines/wintermute/AdSentence.cpp +++ b/engines/wintermute/AdSentence.cpp @@ -91,7 +91,7 @@ CAdSentence::~CAdSentence() { //////////////////////////////////////////////////////////////////////////
-void CAdSentence::SetText(char *Text) {
+void CAdSentence::SetText(const char *Text) {
if (_text) delete [] _text;
_text = new char[strlen(Text) + 1];
if (_text) strcpy(_text, Text);
@@ -99,7 +99,7 @@ void CAdSentence::SetText(char *Text) { //////////////////////////////////////////////////////////////////////////
-void CAdSentence::SetStances(char *Stances) {
+void CAdSentence::SetStances(const char *Stances) {
if (_stances) delete [] _stances;
if (Stances) {
_stances = new char[strlen(Stances) + 1];
@@ -238,7 +238,7 @@ HRESULT CAdSentence::Persist(CBPersistMgr *PersistMgr) { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdSentence::SetupTalkFile(char *SoundFilename) {
+HRESULT CAdSentence::SetupTalkFile(const char *SoundFilename) {
delete _talkDef;
_talkDef = NULL;
_currentSprite = NULL;
diff --git a/engines/wintermute/AdSentence.h b/engines/wintermute/AdSentence.h index ded17c83a7..7552a72944 100644 --- a/engines/wintermute/AdSentence.h +++ b/engines/wintermute/AdSentence.h @@ -46,7 +46,7 @@ public: CBSprite *_currentSprite;
char *_currentSkelAnim;
HRESULT Update(TDirection Dir = DI_DOWN);
- HRESULT SetupTalkFile(char *SoundFilename);
+ HRESULT SetupTalkFile(const char *SoundFilename);
DECLARE_PERSISTENT(CAdSentence, CBBase)
HRESULT Finish();
void SetSound(CBSound *Sound);
@@ -59,8 +59,8 @@ public: CBFont *_font;
char *GetNextStance();
char *GetCurrentStance();
- void SetStances(char *Stances);
- void SetText(char *Text);
+ void SetStances(const char *Stances);
+ void SetText(const char *Text);
int _currentStance;
uint32 _startTime;
char *_stances;
diff --git a/engines/wintermute/AdSpriteSet.cpp b/engines/wintermute/AdSpriteSet.cpp index e65e701a85..8fe079e780 100644 --- a/engines/wintermute/AdSpriteSet.cpp +++ b/engines/wintermute/AdSpriteSet.cpp @@ -58,7 +58,7 @@ CAdSpriteSet::~CAdSpriteSet() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdSpriteSet::LoadFile(char *Filename, int LifeTime, TSpriteCacheType CacheType) {
+HRESULT CAdSpriteSet::LoadFile(const char *Filename, int LifeTime, TSpriteCacheType CacheType) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdSpriteSet::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdSpriteSet.h b/engines/wintermute/AdSpriteSet.h index 629978bff3..7a68ed9d0a 100644 --- a/engines/wintermute/AdSpriteSet.h +++ b/engines/wintermute/AdSpriteSet.h @@ -44,7 +44,7 @@ public: CBObject *_owner;
CAdSpriteSet(CBGame *inGame, CBObject *Owner = NULL);
virtual ~CAdSpriteSet();
- HRESULT LoadFile(char *Filename, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
+ HRESULT LoadFile(const char *Filename, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
CBSprite *_sprites[NUM_DIRECTIONS];
};
diff --git a/engines/wintermute/AdTalkHolder.cpp b/engines/wintermute/AdTalkHolder.cpp index 44ef2eddb7..5cd8432292 100644 --- a/engines/wintermute/AdTalkHolder.cpp +++ b/engines/wintermute/AdTalkHolder.cpp @@ -137,7 +137,7 @@ HRESULT CAdTalkHolder::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack if (SetCurrent) _currentSprite = NULL;
Stack->PushBool(true);
} else {
- char *Filename = Val->GetString();
+ const char *Filename = Val->GetString();
CBSprite *spr = new CBSprite(Game, this);
if (!spr || FAILED(spr->LoadFile(Filename))) {
Script->RuntimeError("SetSprite method failed for file '%s'", Filename);
@@ -179,7 +179,7 @@ HRESULT CAdTalkHolder::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack else if (strcmp(Name, "AddTalkSprite") == 0) {
Stack->CorrectParams(2);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool Ex = Stack->Pop()->GetBool();
CBSprite *spr = new CBSprite(Game, this);
@@ -200,7 +200,7 @@ HRESULT CAdTalkHolder::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack else if (strcmp(Name, "RemoveTalkSprite") == 0) {
Stack->CorrectParams(2);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool Ex = Stack->Pop()->GetBool();
int i;
@@ -243,7 +243,7 @@ HRESULT CAdTalkHolder::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack else if (strcmp(Name, "SetTalkSprite") == 0) {
Stack->CorrectParams(2);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool Ex = Stack->Pop()->GetBool();
bool SetCurrent = false;
bool SetTemp2 = false;
diff --git a/engines/wintermute/AdWaypointGroup.cpp b/engines/wintermute/AdWaypointGroup.cpp index 97a8056713..a4f630c572 100644 --- a/engines/wintermute/AdWaypointGroup.cpp +++ b/engines/wintermute/AdWaypointGroup.cpp @@ -62,7 +62,7 @@ void CAdWaypointGroup::Cleanup() { //////////////////////////////////////////////////////////////////////////
-HRESULT CAdWaypointGroup::LoadFile(char *Filename) {
+HRESULT CAdWaypointGroup::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CAdWaypointGroup::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/AdWaypointGroup.h b/engines/wintermute/AdWaypointGroup.h index e997e89663..de28f3fbf4 100644 --- a/engines/wintermute/AdWaypointGroup.h +++ b/engines/wintermute/AdWaypointGroup.h @@ -44,7 +44,7 @@ public: virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
bool _active;
CAdWaypointGroup(CBGame *inGame);
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual ~CAdWaypointGroup();
CBArray<CBPoint *, CBPoint *> _points;
diff --git a/engines/wintermute/BEvent.cpp b/engines/wintermute/BEvent.cpp index 977b965561..68cc581abf 100644 --- a/engines/wintermute/BEvent.cpp +++ b/engines/wintermute/BEvent.cpp @@ -119,7 +119,7 @@ void CBEvent::SetName(char *Name) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBEvent::LoadFile(char *Filename) {
+HRESULT CBEvent::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CBEvent::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/BEvent.h b/engines/wintermute/BEvent.h index 87d3de0e96..a1e071fe94 100644 --- a/engines/wintermute/BEvent.h +++ b/engines/wintermute/BEvent.h @@ -47,7 +47,7 @@ public: CBEvent(CBGame *inGame);
CBEvent(CBGame *inGame, TEventType Type, char *Script);
virtual ~CBEvent();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
};
diff --git a/engines/wintermute/BFileManager.cpp b/engines/wintermute/BFileManager.cpp index 427c817fb4..a3b756eb87 100644 --- a/engines/wintermute/BFileManager.cpp +++ b/engines/wintermute/BFileManager.cpp @@ -182,7 +182,7 @@ byte *CBFileManager::ReadWholeFile(const char *Filename, uint32 *Size, bool Must //////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::SaveFile(char *Filename, byte *Buffer, uint32 BufferSize, bool Compressed, byte *PrefixBuffer, uint32 PrefixSize) {
+HRESULT CBFileManager::SaveFile(const char *Filename, byte *Buffer, uint32 BufferSize, bool Compressed, byte *PrefixBuffer, uint32 PrefixSize) {
// TODO
warning("Implement SaveFile");
#if 0
diff --git a/engines/wintermute/BFileManager.h b/engines/wintermute/BFileManager.h index 81b22ffef9..7a9593915a 100644 --- a/engines/wintermute/BFileManager.h +++ b/engines/wintermute/BFileManager.h @@ -63,7 +63,7 @@ public: } TPathType;
HRESULT AddPath(TPathType Type, const char *Path);
HRESULT RequestCD(int CD, char *PackageFile, char *Filename);
- HRESULT SaveFile(char *Filename, byte *Buffer, uint32 BufferSize, bool Compressed = false, byte *PrefixBuffer = NULL, uint32 PrefixSize = 0);
+ HRESULT SaveFile(const char *Filename, byte *Buffer, uint32 BufferSize, bool Compressed = false, byte *PrefixBuffer = NULL, uint32 PrefixSize = 0);
byte *ReadWholeFile(const char *Filename, uint32 *Size = NULL, bool MustExist = true);
CBFileManager(CBGame *inGame = NULL);
virtual ~CBFileManager();
diff --git a/engines/wintermute/BFont.cpp b/engines/wintermute/BFont.cpp index 92ce8595ae..4bae2841ab 100644 --- a/engines/wintermute/BFont.cpp +++ b/engines/wintermute/BFont.cpp @@ -71,7 +71,7 @@ int CBFont::GetTextWidth(byte *text, int MaxLenght) { /*
//////////////////////////////////////////////////////////////////////
-HRESULT CBFont::LoadFile(char * Filename)
+HRESULT CBFont::LoadFile(const char * Filename)
{
BYTE* Buffer = Game->_fileManager->ReadWholeFile(Filename);
if(Buffer==NULL){
@@ -152,7 +152,7 @@ HRESULT CBFont::Persist(CBPersistMgr *PersistMgr) { //////////////////////////////////////////////////////////////////////////
-CBFont *CBFont::CreateFromFile(CBGame *Game, char *Filename) {
+CBFont *CBFont::CreateFromFile(CBGame *Game, const char *Filename) {
if (IsTrueType(Game, Filename)) {
CBFontTT *Font = new CBFontTT(Game);
if (Font) {
@@ -180,7 +180,7 @@ TOKEN_DEF(FONT) TOKEN_DEF(TTFONT)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-bool CBFont::IsTrueType(CBGame *Game, char *Filename) {
+bool CBFont::IsTrueType(CBGame *Game, const char *Filename) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(FONT)
TOKEN_TABLE(TTFONT)
diff --git a/engines/wintermute/BFont.h b/engines/wintermute/BFont.h index 5ffba7ace4..a02b6cd0ca 100644 --- a/engines/wintermute/BFont.h +++ b/engines/wintermute/BFont.h @@ -48,12 +48,12 @@ public: CBFont(CBGame *inGame);
virtual ~CBFont();
- static CBFont *CreateFromFile(CBGame *Game, char *Filename);
+ static CBFont *CreateFromFile(CBGame *Game, const char *Filename);
private:
//HRESULT LoadBuffer(byte * Buffer);
- //HRESULT LoadFile(char* Filename);
- static bool IsTrueType(CBGame *Game, char *Filename);
+ //HRESULT LoadFile(const char* Filename);
+ static bool IsTrueType(CBGame *Game, const char *Filename);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/BFontBitmap.cpp b/engines/wintermute/BFontBitmap.cpp index 71bbf95801..f2f7fcfc60 100644 --- a/engines/wintermute/BFontBitmap.cpp +++ b/engines/wintermute/BFontBitmap.cpp @@ -242,7 +242,7 @@ void CBFontBitmap::DrawChar(byte c, int x, int y) { //////////////////////////////////////////////////////////////////////
-HRESULT CBFontBitmap::LoadFile(char *Filename) {
+HRESULT CBFontBitmap::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CBFontBitmap::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/BFontBitmap.h b/engines/wintermute/BFontBitmap.h index b194674b7c..23ebdaabe2 100644 --- a/engines/wintermute/BFontBitmap.h +++ b/engines/wintermute/BFontBitmap.h @@ -38,7 +38,7 @@ class CBFontBitmap : public CBFont { public:
DECLARE_PERSISTENT(CBFontBitmap, CBFont)
HRESULT LoadBuffer(byte *Buffer);
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
virtual int GetTextWidth(byte *text, int MaxLength = -1);
virtual int GetTextHeight(byte *text, int width);
virtual void DrawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int MaxLenght = -1);
diff --git a/engines/wintermute/BFontStorage.cpp b/engines/wintermute/BFontStorage.cpp index 61b5e58805..f73f018ab7 100644 --- a/engines/wintermute/BFontStorage.cpp +++ b/engines/wintermute/BFontStorage.cpp @@ -90,7 +90,7 @@ HRESULT CBFontStorage::InitLoop() { }
//////////////////////////////////////////////////////////////////////////
-CBFont *CBFontStorage::AddFont(char *Filename) {
+CBFont *CBFontStorage::AddFont(const char *Filename) {
if (!Filename) return NULL;
for (int i = 0; i < _fonts.GetSize(); i++) {
diff --git a/engines/wintermute/BFontStorage.h b/engines/wintermute/BFontStorage.h index 25e1b345d2..8bf9c556c3 100644 --- a/engines/wintermute/BFontStorage.h +++ b/engines/wintermute/BFontStorage.h @@ -46,7 +46,7 @@ public: DECLARE_PERSISTENT(CBFontStorage, CBBase)
HRESULT Cleanup(bool Warn = false);
HRESULT RemoveFont(CBFont *Font);
- CBFont *AddFont(char *Filename);
+ CBFont *AddFont(const char *Filename);
CBFontStorage(CBGame *inGame);
virtual ~CBFontStorage();
CBArray<CBFont *, CBFont *> _fonts;
diff --git a/engines/wintermute/BFontTT.cpp b/engines/wintermute/BFontTT.cpp index 458325e3d1..24454c7529 100644 --- a/engines/wintermute/BFontTT.cpp +++ b/engines/wintermute/BFontTT.cpp @@ -376,7 +376,7 @@ int CBFontTT::GetLetterHeight() { //////////////////////////////////////////////////////////////////////
-HRESULT CBFontTT::LoadFile(char *Filename) {
+HRESULT CBFontTT::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CBFontTT::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/BFontTT.h b/engines/wintermute/BFontTT.h index 6994ea3c8f..ec552fc9fa 100644 --- a/engines/wintermute/BFontTT.h +++ b/engines/wintermute/BFontTT.h @@ -126,7 +126,7 @@ public: virtual int GetLetterHeight();
HRESULT LoadBuffer(byte *Buffer);
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
/* static unsigned long FTReadSeekProc(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count);
static void FTCloseProc(FT_Stream stream);*/
diff --git a/engines/wintermute/BFrame.cpp b/engines/wintermute/BFrame.cpp index f04b35bfe2..c18d6a55a7 100644 --- a/engines/wintermute/BFrame.cpp +++ b/engines/wintermute/BFrame.cpp @@ -479,7 +479,7 @@ HRESULT CBFrame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This else if (strcmp(Name, "AddSubframe") == 0) {
Stack->CorrectParams(1);
CScValue *Val = Stack->Pop();
- char *Filename = NULL;
+ const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
CBSubFrame *Sub = new CBSubFrame(Game);
@@ -502,7 +502,7 @@ HRESULT CBFrame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This if (Index < 0) Index = 0;
CScValue *Val = Stack->Pop();
- char *Filename = NULL;
+ const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
CBSubFrame *Sub = new CBSubFrame(Game);
@@ -535,7 +535,7 @@ HRESULT CBFrame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "AddEvent") == 0) {
Stack->CorrectParams(1);
- char *Event = Stack->Pop()->GetString();
+ const char *Event = Stack->Pop()->GetString();
for (int i = 0; i < _applyEvent.GetSize(); i++) {
if (scumm_stricmp(_applyEvent[i], Event) == 0) {
Stack->PushNULL();
@@ -552,7 +552,7 @@ HRESULT CBFrame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "DeleteEvent") == 0) {
Stack->CorrectParams(1);
- char *Event = Stack->Pop()->GetString();
+ const char *Event = Stack->Pop()->GetString();
for (int i = 0; i < _applyEvent.GetSize(); i++) {
if (scumm_stricmp(_applyEvent[i], Event) == 0) {
delete [] _applyEvent[i];
diff --git a/engines/wintermute/BFrame.h b/engines/wintermute/BFrame.h index 90a7c1b192..279dcd2289 100644 --- a/engines/wintermute/BFrame.h +++ b/engines/wintermute/BFrame.h @@ -58,7 +58,7 @@ public: CBFrame(CBGame *inGame);
virtual ~CBFrame();
- CBArray<char *, char *> _applyEvent;
+ CBArray<const char *, const char *> _applyEvent;
// scripting interface
virtual CScValue *ScGetProperty(char *Name);
diff --git a/engines/wintermute/BGame.cpp b/engines/wintermute/BGame.cpp index 08d78e1745..eee7d5299a 100644 --- a/engines/wintermute/BGame.cpp +++ b/engines/wintermute/BGame.cpp @@ -949,7 +949,7 @@ HRESULT CBGame::LoadBuffer(byte *Buffer, bool Complete) { }
}
- if (!_systemFont) _systemFont = Game->_fontStorage->AddFont("syste_font.fnt");
+ if (!_systemFont) _systemFont = Game->_fontStorage->AddFont("system_font.fnt");
if (cmd == PARSERR_TOKENNOTFOUND) {
@@ -1017,7 +1017,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "LoadStringTable") == 0) {
Stack->CorrectParams(2);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
CScValue *Val = Stack->Pop();
bool ClearOld;
@@ -1113,7 +1113,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS Channel = Stack->Pop()->GetInt();
}
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
CScValue *ValLooping = Stack->Pop();
bool Looping = ValLooping->IsNULL() ? true : ValLooping->GetBool();
@@ -1317,7 +1317,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS Stack->CorrectParams(1);
int Length = 0;
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
CBSound *Sound = new CBSound(Game);
if (Sound && SUCCEEDED(Sound->SetSound(Filename, SOUND_MUSIC, true))) {
@@ -1404,7 +1404,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "RegWriteNumber") == 0) {
Stack->CorrectParams(2);
- char *Key = Stack->Pop()->GetString();
+ const char *Key = Stack->Pop()->GetString();
int Val = Stack->Pop()->GetInt();
_registry->WriteInt("PrivateSettings", Key, Val);
Stack->PushNULL();
@@ -1416,7 +1416,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "RegReadNumber") == 0) {
Stack->CorrectParams(2);
- char *Key = Stack->Pop()->GetString();
+ const char *Key = Stack->Pop()->GetString();
int InitVal = Stack->Pop()->GetInt();
Stack->PushInt(_registry->ReadInt("PrivateSettings", Key, InitVal));
return S_OK;
@@ -1427,8 +1427,8 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "RegWriteString") == 0) {
Stack->CorrectParams(2);
- char *Key = Stack->Pop()->GetString();
- char *Val = Stack->Pop()->GetString();
+ const char *Key = Stack->Pop()->GetString();
+ const char *Val = Stack->Pop()->GetString();
_registry->WriteString("PrivateSettings", Key, Val);
Stack->PushNULL();
return S_OK;
@@ -1439,8 +1439,8 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "RegReadString") == 0) {
Stack->CorrectParams(2);
- char *Key = Stack->Pop()->GetString();
- char *InitVal = Stack->Pop()->GetString();
+ const char *Key = Stack->Pop()->GetString();
+ const char *InitVal = Stack->Pop()->GetString();
AnsiString val = _registry->ReadString("PrivateSettings", Key, InitVal);
Stack->PushString((char *)val.c_str());
return S_OK;
@@ -1452,7 +1452,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS else if (strcmp(Name, "SaveGame") == 0) {
Stack->CorrectParams(3);
int Slot = Stack->Pop()->GetInt();
- char *xdesc = Stack->Pop()->GetString();
+ const char *xdesc = Stack->Pop()->GetString();
bool quick = Stack->Pop()->GetBool(false);
char *Desc = new char[strlen(xdesc) + 1];
@@ -1650,7 +1650,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "FileExists") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
CBFile *File = _fileManager->OpenFile(Filename, false);
if (!File) Stack->PushBool(false);
@@ -1744,7 +1744,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "ScreenshotEx") == 0) {
Stack->CorrectParams(3);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
int SizeX = Stack->Pop()->GetInt(_renderer->_width);
int SizeY = Stack->Pop()->GetInt(_renderer->_height);
@@ -1917,7 +1917,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS else if (strcmp(Name, "DisplayLoadingIcon") == 0) {
Stack->CorrectParams(4);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
_loadingIconX = Stack->Pop()->GetInt();
_loadingIconY = Stack->Pop()->GetInt();
_loadingIconPersistent = Stack->Pop()->GetBool();
@@ -1953,7 +1953,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "DumpTextureStats") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
_renderer->DumpData(Filename);
@@ -1966,7 +1966,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "AccOutputText") == 0) {
Stack->CorrectParams(2);
- char *Str = Stack->Pop()->GetString();
+ const char *Str = Stack->Pop()->GetString();
int Type = Stack->Pop()->GetInt();
// do nothing
Stack->PushNULL();
@@ -2007,7 +2007,7 @@ HRESULT CBGame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "GetFileChecksum") == 0) {
Stack->CorrectParams(2);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool AsHex = Stack->Pop()->GetBool(false);
CBFile *File = _fileManager->OpenFile(Filename, false);
@@ -2715,7 +2715,7 @@ HRESULT CBGame::DisplayQuickMsg() { #define MAX_QUICK_MSG 5
//////////////////////////////////////////////////////////////////////////
-void CBGame::QuickMessage(char *Text) {
+void CBGame::QuickMessage(const char *Text) {
if (_quickMessages.GetSize() >= MAX_QUICK_MSG) {
delete _quickMessages[0];
_quickMessages.RemoveAt(0);
@@ -3091,7 +3091,7 @@ HRESULT CBGame::ExternalCall(CScScript *Script, CScStack *Stack, CScStack *ThisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "ToString") == 0) {
Stack->CorrectParams(1);
- char *Str = Stack->Pop()->GetString();
+ const char *Str = Stack->Pop()->GetString();
char *Str2 = new char[strlen(Str) + 1];
strcpy(Str2, Str);
Stack->PushString(Str2);
@@ -3215,7 +3215,7 @@ HRESULT CBGame::LoadGame(int Slot) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::LoadGame(char *Filename) {
+HRESULT CBGame::LoadGame(const char *Filename) {
LOG(0, "Loading game '%s'...", Filename);
GetDebugMgr()->OnGameShutdown();
@@ -3343,7 +3343,7 @@ HRESULT CBGame::DisplayWindows(bool InGame) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::PlayMusic(int Channel, char *Filename, bool Looping, uint32 LoopStart) {
+HRESULT CBGame::PlayMusic(int Channel, const char *Filename, bool Looping, uint32 LoopStart) {
if (Channel >= NUM_MUSIC_CHANNELS) {
Game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", Channel, NUM_MUSIC_CHANNELS);
return E_FAIL;
@@ -3423,7 +3423,7 @@ HRESULT CBGame::SetMusicStartTime(int Channel, uint32 Time) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::LoadSettings(char *Filename) {
+HRESULT CBGame::LoadSettings(const char *Filename) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SETTINGS)
TOKEN_TABLE(GAME)
@@ -4121,7 +4121,7 @@ HRESULT CBGame::RestoreDeviceObjects() { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::SetWaitCursor(char *Filename) {
+HRESULT CBGame::SetWaitCursor(const char *Filename) {
delete _cursorNoninteractive;
_cursorNoninteractive = NULL;
diff --git a/engines/wintermute/BGame.h b/engines/wintermute/BGame.h index 9f8ef5241b..cdc937afb9 100644 --- a/engines/wintermute/BGame.h +++ b/engines/wintermute/BGame.h @@ -114,7 +114,7 @@ public: virtual HRESULT ResetContent();
void DEBUG_DumpClassRegistry();
- HRESULT SetWaitCursor(char *Filename);
+ HRESULT SetWaitCursor(const char *Filename);
char *_localSaveDir;
bool _saveDirChecked;
@@ -274,12 +274,12 @@ public: static void AfterLoadScript(void *script, void *data);
static void InvalidateValues(void *Value, void *Data);
- HRESULT LoadSettings(char *Filename);
+ HRESULT LoadSettings(const char *Filename);
HRESULT ResumeMusic(int Channel);
HRESULT SetMusicStartTime(int Channel, uint32 Time);
HRESULT PauseMusic(int Channel);
HRESULT StopMusic(int Channel);
- HRESULT PlayMusic(int Channel, char *Filename, bool Looping = true, uint32 LoopStart = 0);
+ HRESULT PlayMusic(int Channel, const char *Filename, bool Looping = true, uint32 LoopStart = 0);
CBSound *_music[NUM_MUSIC_CHANNELS];
bool _musicCrossfadeRunning;
bool _musicCrossfadeSwap;
@@ -292,7 +292,7 @@ public: bool _useD3D;
virtual HRESULT Cleanup();
virtual HRESULT LoadGame(int Slot);
- virtual HRESULT LoadGame(char *Filename);
+ virtual HRESULT LoadGame(const char *Filename);
virtual HRESULT SaveGame(int slot, char *desc, bool quickSave = false);
virtual HRESULT ShowCursor();
@@ -316,7 +316,7 @@ public: bool ValidObject(CBObject *Object);
HRESULT UnregisterObject(CBObject *Object);
HRESULT RegisterObject(CBObject *Object);
- void QuickMessage(char *Text);
+ void QuickMessage(const char *Text);
void QuickMessageForm(LPSTR fmt, ...);
HRESULT DisplayQuickMsg();
uint32 _fps;
diff --git a/engines/wintermute/BImage.cpp b/engines/wintermute/BImage.cpp index a773bc00c9..f9f481f2d1 100644 --- a/engines/wintermute/BImage.cpp +++ b/engines/wintermute/BImage.cpp @@ -47,7 +47,7 @@ CBImage::~CBImage() { //////////////////////////////////////////////////////////////////////////
-HRESULT CBImage::SaveBMPFile(char *Filename) {
+HRESULT CBImage::SaveBMPFile(const char *Filename) {
#if 0
if (!_bitmap) return E_FAIL;
diff --git a/engines/wintermute/BImage.h b/engines/wintermute/BImage.h index 98b6dfaac6..b9e3ca880c 100644 --- a/engines/wintermute/BImage.h +++ b/engines/wintermute/BImage.h @@ -47,7 +47,7 @@ public: byte *CreateBMPBuffer(uint32 *BufferSize = NULL);
HRESULT Resize(int NewWidth, int NewHeight);
- HRESULT SaveBMPFile(char *Filename);
+ HRESULT SaveBMPFile(const char *Filename);
HRESULT CopyFrom(CBImage *OrigImage, int NewWidth = 0, int NewHeight = 0);
FIBITMAP *GetBitmap() const {
diff --git a/engines/wintermute/BKeyboardState.cpp b/engines/wintermute/BKeyboardState.cpp index 892c8a837b..7499ca70df 100644 --- a/engines/wintermute/BKeyboardState.cpp +++ b/engines/wintermute/BKeyboardState.cpp @@ -68,9 +68,10 @@ HRESULT CBKeyboardState::ScCallMethod(CScScript *Script, CScStack *Stack, CScSta int vKey;
if (val->_type == VAL_STRING && strlen(val->GetString()) > 0) {
- char *str = val->GetString();
- if (str[0] >= 'A' && str[0] <= 'Z') str[0] += ('a' - 'A');
- vKey = (int)str[0];
+ const char *str = val->GetString();
+ char temp = str[0];
+ if (temp >= 'A' && temp <= 'Z') temp += ('a' - 'A');
+ vKey = (int)temp;
} else vKey = val->GetInt();
warning("BKeyboardState doesnt yet have state-support"); //TODO;
diff --git a/engines/wintermute/BNamedObject.cpp b/engines/wintermute/BNamedObject.cpp index fb8526ddad..7f33aaa42d 100644 --- a/engines/wintermute/BNamedObject.cpp +++ b/engines/wintermute/BNamedObject.cpp @@ -55,7 +55,7 @@ CBNamedObject::~CBNamedObject(void) { //////////////////////////////////////////////////////////////////////
-void CBNamedObject::SetName(char *Name) {
+void CBNamedObject::SetName(const char *Name) {
delete[] _name;
_name = new char [strlen(Name) + 1];
diff --git a/engines/wintermute/BNamedObject.h b/engines/wintermute/BNamedObject.h index c3b9abb7bc..aecd45517b 100644 --- a/engines/wintermute/BNamedObject.h +++ b/engines/wintermute/BNamedObject.h @@ -42,7 +42,7 @@ public: CBNamedObject(TDynamicConstructor, TDynamicConstructor);
char *_name;
- void SetName(char *Name);
+ void SetName(const char *Name);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/BObject.cpp b/engines/wintermute/BObject.cpp index beadaf1ec2..4c63672bc6 100644 --- a/engines/wintermute/BObject.cpp +++ b/engines/wintermute/BObject.cpp @@ -135,7 +135,7 @@ HRESULT CBObject::Cleanup() { //////////////////////////////////////////////////////////////////////////
-void CBObject::SetCaption(char *Caption, int Case) {
+void CBObject::SetCaption(const char *Caption, int Case) {
if (Case == 0) Case = 1;
if (Case < 1 || Case > 7) return;
@@ -268,7 +268,7 @@ HRESULT CBObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "LoadSound") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
if (SUCCEEDED(PlaySFX(Filename, false, false)))
Stack->PushBool(true);
else
@@ -283,7 +283,7 @@ HRESULT CBObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi else if (strcmp(Name, "PlaySound") == 0) {
Stack->CorrectParams(3);
- char *Filename;
+ const char *Filename;
bool Looping;
uint32 LoopStart;
@@ -313,8 +313,8 @@ HRESULT CBObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi else if (strcmp(Name, "PlaySoundEvent") == 0) {
Stack->CorrectParams(2);
- char *Filename;
- char *EventName;
+ const char *Filename;
+ const char *EventName;
CScValue *val1 = Stack->Pop();
CScValue *val2 = Stack->Pop();
@@ -919,7 +919,7 @@ HRESULT CBObject::Persist(CBPersistMgr *PersistMgr) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::SetCursor(char *Filename) {
+HRESULT CBObject::SetCursor(const char *Filename) {
if (!_sharedCursors) {
delete _cursor;
_cursor = NULL;
@@ -936,7 +936,7 @@ HRESULT CBObject::SetCursor(char *Filename) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::SetActiveCursor(char *Filename) {
+HRESULT CBObject::SetActiveCursor(const char *Filename) {
delete _activeCursor;
_activeCursor = new CBSprite(Game);
if (!_activeCursor || FAILED(_activeCursor->LoadFile(Filename))) {
@@ -972,7 +972,7 @@ bool CBObject::HandleMouseWheel(int Delta) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::PlaySFX(char *Filename, bool Looping, bool PlayNow, char *EventName, uint32 LoopStart) {
+HRESULT CBObject::PlaySFX(const char *Filename, bool Looping, bool PlayNow, const char *EventName, uint32 LoopStart) {
// just play loaded sound
if (Filename == NULL && _sFX) {
if (Game->_editorMode || _sFXStart) {
@@ -1105,7 +1105,7 @@ bool CBObject::IsReady() { //////////////////////////////////////////////////////////////////////////
-void CBObject::SetSoundEvent(char *EventName) {
+void CBObject::SetSoundEvent(const char *EventName) {
delete[] _soundEvent;
_soundEvent = NULL;
if (EventName) {
diff --git a/engines/wintermute/BObject.h b/engines/wintermute/BObject.h index 835d5fe34a..f896428417 100644 --- a/engines/wintermute/BObject.h +++ b/engines/wintermute/BObject.h @@ -51,7 +51,7 @@ public: float _relativeRotate;
bool _rotateValid;
float _rotate;
- void SetSoundEvent(char *EventName);
+ void SetSoundEvent(const char *EventName);
bool _rotatable;
uint32 _alphaColor;
float _scale;
@@ -71,7 +71,7 @@ public: HRESULT ResumeSFX();
HRESULT PauseSFX();
HRESULT StopSFX(bool DeleteSound = true);
- HRESULT PlaySFX(char *Filename, bool Looping = false, bool PlayNow = true, char *EventName = NULL, uint32 LoopStart = 0);
+ HRESULT PlaySFX(const char *Filename, bool Looping = false, bool PlayNow = true, const char *EventName = NULL, uint32 LoopStart = 0);
CBSound *_sFX;
TSFXType _sFXType;
@@ -84,11 +84,11 @@ public: virtual HRESULT HandleMouse(TMouseEvent Event, TMouseButton Button);
virtual bool HandleKeypress(SDL_Event *event);
virtual int GetHeight();
- HRESULT SetCursor(char *Filename);
- HRESULT SetActiveCursor(char *Filename);
+ HRESULT SetCursor(const char *Filename);
+ HRESULT SetActiveCursor(const char *Filename);
HRESULT Cleanup();
char *GetCaption(int Case = 1);
- void SetCaption(char *Caption, int Case = 1);
+ void SetCaption(const char *Caption, int Case = 1);
bool _editorSelected;
bool _editorAlwaysRegister;
bool _editorOnly;
diff --git a/engines/wintermute/BPersistMgr.cpp b/engines/wintermute/BPersistMgr.cpp index e8b47441fc..297efeec81 100644 --- a/engines/wintermute/BPersistMgr.cpp +++ b/engines/wintermute/BPersistMgr.cpp @@ -209,7 +209,7 @@ uint16 getHighWord(uint32 dword) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::InitLoad(char *Filename) {
+HRESULT CBPersistMgr::InitLoad(const char *Filename) {
Cleanup();
_saving = false;
@@ -293,7 +293,7 @@ init_fail: //////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::SaveFile(char *Filename) {
+HRESULT CBPersistMgr::SaveFile(const char *Filename) {
return Game->_fileManager->SaveFile(Filename, _buffer, _offset, Game->_compressedSavegames, _richBuffer, _richBufferSize);
}
diff --git a/engines/wintermute/BPersistMgr.h b/engines/wintermute/BPersistMgr.h index 381308bcac..3f55146ce8 100644 --- a/engines/wintermute/BPersistMgr.h +++ b/engines/wintermute/BPersistMgr.h @@ -45,13 +45,13 @@ public: byte _savedVerBuild;
byte _savedExtMajor;
byte _savedExtMinor;
- HRESULT SaveFile(char *Filename);
+ HRESULT SaveFile(const char *Filename);
uint32 GetDWORD();
void PutDWORD(uint32 Val);
char *GetString();
void PutString(const char *Val);
void Cleanup();
- HRESULT InitLoad(char *Filename);
+ HRESULT InitLoad(const char *Filename);
HRESULT InitSave(char *Desc);
HRESULT GetBytes(byte *Buffer, uint32 Size);
HRESULT PutBytes(byte *Buffer, uint32 Size);
diff --git a/engines/wintermute/BQuickMsg.cpp b/engines/wintermute/BQuickMsg.cpp index 1e406af1e8..6fa14ac5c0 100644 --- a/engines/wintermute/BQuickMsg.cpp +++ b/engines/wintermute/BQuickMsg.cpp @@ -33,7 +33,7 @@ namespace WinterMute {
//////////////////////////////////////////////////////////////////////////
-CBQuickMsg::CBQuickMsg(CBGame *inGame, char *Text): CBBase(inGame) {
+CBQuickMsg::CBQuickMsg(CBGame *inGame, const char *Text): CBBase(inGame) {
_text = new char [strlen(Text) + 1];
if (_text) strcpy(_text, Text);
_startTime = Game->_currentTime;
diff --git a/engines/wintermute/BQuickMsg.h b/engines/wintermute/BQuickMsg.h index 6349a6ae35..a760a9ee21 100644 --- a/engines/wintermute/BQuickMsg.h +++ b/engines/wintermute/BQuickMsg.h @@ -38,7 +38,7 @@ public: char *GetText();
uint32 _startTime;
char *_text;
- CBQuickMsg(CBGame *inGame, char *Text);
+ CBQuickMsg(CBGame *inGame, const char *Text);
virtual ~CBQuickMsg();
};
diff --git a/engines/wintermute/BRegion.cpp b/engines/wintermute/BRegion.cpp index 44df8dce44..9190955321 100644 --- a/engines/wintermute/BRegion.cpp +++ b/engines/wintermute/BRegion.cpp @@ -94,7 +94,7 @@ bool CBRegion::PointInRegion(int X, int Y) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::LoadFile(char *Filename) {
+HRESULT CBRegion::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CBRegion::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/BRegion.h b/engines/wintermute/BRegion.h index 914f77f7ae..783cb22965 100644 --- a/engines/wintermute/BRegion.h +++ b/engines/wintermute/BRegion.h @@ -50,7 +50,7 @@ public: virtual ~CBRegion();
bool PointInRegion(int X, int Y);
bool CreateRegion();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
RECT _rect;
CBArray<CBPoint *, CBPoint *> _points;
diff --git a/engines/wintermute/BRenderSDL.cpp b/engines/wintermute/BRenderSDL.cpp index 613995124f..a5a3547cb3 100644 --- a/engines/wintermute/BRenderSDL.cpp +++ b/engines/wintermute/BRenderSDL.cpp @@ -417,7 +417,7 @@ void CBRenderSDL::PointToScreen(POINT *point) { }
//////////////////////////////////////////////////////////////////////////
-void CBRenderSDL::DumpData(char *Filename) {
+void CBRenderSDL::DumpData(const char *Filename) {
FILE *f = fopen(Filename, "wt");
if (!f) return;
diff --git a/engines/wintermute/BRenderSDL.h b/engines/wintermute/BRenderSDL.h index 573c4368c4..5842492743 100644 --- a/engines/wintermute/BRenderSDL.h +++ b/engines/wintermute/BRenderSDL.h @@ -67,7 +67,7 @@ public: void PointFromScreen(POINT *point);
void PointToScreen(POINT *point);
- void DumpData(char *Filename);
+ void DumpData(const char *Filename);
float GetScaleRatioX() const {
return _ratioX;
diff --git a/engines/wintermute/BRenderer.h b/engines/wintermute/BRenderer.h index de7731a3ad..26ea699e6d 100644 --- a/engines/wintermute/BRenderer.h +++ b/engines/wintermute/BRenderer.h @@ -46,7 +46,7 @@ public: int _drawOffsetX;
int _drawOffsetY;
- virtual void DumpData(char *Filename) {};
+ virtual void DumpData(const char *Filename) {};
virtual CBImage *TakeScreenshot();
virtual HRESULT SetViewport(int left, int top, int right, int bottom);
virtual HRESULT SetViewport(RECT *Rect);
diff --git a/engines/wintermute/BScriptHolder.cpp b/engines/wintermute/BScriptHolder.cpp index ed7db2507b..a13ef750e8 100644 --- a/engines/wintermute/BScriptHolder.cpp +++ b/engines/wintermute/BScriptHolder.cpp @@ -68,7 +68,7 @@ HRESULT CBScriptHolder::Cleanup() { }
//////////////////////////////////////////////////////////////////////
-void CBScriptHolder::SetFilename(char *Filename) {
+void CBScriptHolder::SetFilename(const char *Filename) {
if (_filename != NULL) delete [] _filename;
_filename = new char [strlen(Filename) + 1];
@@ -169,7 +169,7 @@ HRESULT CBScriptHolder::ScCallMethod(CScScript *Script, CScStack *Stack, CScStac //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "DetachScript") == 0) {
Stack->CorrectParams(2);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool KillThreads = Stack->Pop()->GetBool(false);
bool ret = false;
for (int i = 0; i < _scripts.GetSize(); i++) {
@@ -189,7 +189,7 @@ HRESULT CBScriptHolder::ScCallMethod(CScScript *Script, CScStack *Stack, CScStac //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "IsScriptRunning") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
bool ret = false;
for (int i = 0; i < _scripts.GetSize(); i++) {
if (scumm_stricmp(_scripts[i]->_filename, Filename) == 0 && _scripts[i]->_state != SCRIPT_FINISHED && _scripts[i]->_state != SCRIPT_ERROR) {
@@ -273,7 +273,7 @@ HRESULT CBScriptHolder::Persist(CBPersistMgr *PersistMgr) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::AddScript(char *Filename) {
+HRESULT CBScriptHolder::AddScript(const char *Filename) {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (scumm_stricmp(_scripts[i]->_filename, Filename) == 0) {
if (_scripts[i]->_state != SCRIPT_FINISHED) {
@@ -319,7 +319,7 @@ HRESULT CBScriptHolder::RemoveScript(CScScript *Script) { }
//////////////////////////////////////////////////////////////////////////
-bool CBScriptHolder::CanHandleEvent(char *EventName) {
+bool CBScriptHolder::CanHandleEvent(const char *EventName) {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (!_scripts[i]->_thread && _scripts[i]->CanHandleEvent(EventName)) return true;
}
@@ -328,7 +328,7 @@ bool CBScriptHolder::CanHandleEvent(char *EventName) { //////////////////////////////////////////////////////////////////////////
-bool CBScriptHolder::CanHandleMethod(char *MethodName) {
+bool CBScriptHolder::CanHandleMethod(const char *MethodName) {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (!_scripts[i]->_thread && _scripts[i]->CanHandleMethod(MethodName)) return true;
}
diff --git a/engines/wintermute/BScriptHolder.h b/engines/wintermute/BScriptHolder.h index cc54a983c2..2a96817541 100644 --- a/engines/wintermute/BScriptHolder.h +++ b/engines/wintermute/BScriptHolder.h @@ -43,15 +43,15 @@ public: virtual ~CBScriptHolder();
virtual CScScript *InvokeMethodThread(char *MethodName);
virtual void MakeFreezable(bool Freezable);
- bool CanHandleEvent(char *EventName);
- virtual bool CanHandleMethod(char *EventMethod);
+ bool CanHandleEvent(const char *EventName);
+ virtual bool CanHandleMethod(const char *EventMethod);
HRESULT Cleanup();
HRESULT RemoveScript(CScScript *Script);
- HRESULT AddScript(char *Filename);
+ HRESULT AddScript(const char *Filename);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
virtual HRESULT Listen(CBScriptHolder *param1, uint32 param2);
HRESULT ApplyEvent(const char *EventName, bool Unbreakable = false);
- void SetFilename(char *Filename);
+ void SetFilename(const char *Filename);
HRESULT ParseProperty(byte *Buffer, bool Complete = true);
char *_filename;
bool _freezable;
diff --git a/engines/wintermute/BScriptable.cpp b/engines/wintermute/BScriptable.cpp index e38ee061d8..2f898078c6 100644 --- a/engines/wintermute/BScriptable.cpp +++ b/engines/wintermute/BScriptable.cpp @@ -74,7 +74,7 @@ HRESULT CBScriptable::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack //////////////////////////////////////////////////////////////////////////
-CScValue *CBScriptable::ScGetProperty(char *Name) {
+CScValue *CBScriptable::ScGetProperty(const char *Name) {
if (!_scProp) _scProp = new CScValue(Game);
if (_scProp) return _scProp->GetProp(Name);
else return NULL;
@@ -82,7 +82,7 @@ CScValue *CBScriptable::ScGetProperty(char *Name) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptable::ScSetProperty(char *Name, CScValue *Value) {
+HRESULT CBScriptable::ScSetProperty(const char *Name, CScValue *Value) {
if (!_scProp) _scProp = new CScValue(Game);
if (_scProp) return _scProp->SetProp(Name, Value);
else return E_FAIL;
diff --git a/engines/wintermute/BScriptable.h b/engines/wintermute/BScriptable.h index 71ce682a4b..b841d1578d 100644 --- a/engines/wintermute/BScriptable.h +++ b/engines/wintermute/BScriptable.h @@ -50,8 +50,8 @@ public: // high level scripting interface
virtual bool CanHandleMethod(char *EventMethod);
- virtual HRESULT ScSetProperty(char *Name, CScValue *Value);
- virtual CScValue *ScGetProperty(char *Name);
+ virtual HRESULT ScSetProperty(const char *Name, CScValue *Value);
+ virtual CScValue *ScGetProperty(const char *Name);
virtual HRESULT ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisStack, char *Name);
virtual char *ScToString();
virtual void *ScToMemBuffer();
diff --git a/engines/wintermute/BSound.cpp b/engines/wintermute/BSound.cpp index e7c047a40f..088235fb75 100644 --- a/engines/wintermute/BSound.cpp +++ b/engines/wintermute/BSound.cpp @@ -65,7 +65,7 @@ CBSound::~CBSound() { //////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::SetSound(char *Filename, TSoundType Type, bool Streamed) {
+HRESULT CBSound::SetSound(const char *Filename, TSoundType Type, bool Streamed) {
if (_sound) {
Game->_soundMgr->removeSound(_sound);
_sound = NULL;
diff --git a/engines/wintermute/BSound.h b/engines/wintermute/BSound.h index 922992de7f..d8da355239 100644 --- a/engines/wintermute/BSound.h +++ b/engines/wintermute/BSound.h @@ -64,7 +64,7 @@ public: TSoundType _soundType;
char *_soundFilename;
HRESULT SetSoundSimple();
- HRESULT SetSound(char *Filename, TSoundType Type = SOUND_SFX, bool Streamed = false);
+ HRESULT SetSound(const char *Filename, TSoundType Type = SOUND_SFX, bool Streamed = false);
CBSound(CBGame *inGame);
virtual ~CBSound();
diff --git a/engines/wintermute/BSprite.cpp b/engines/wintermute/BSprite.cpp index 1fc5ba296a..f84f2f945a 100644 --- a/engines/wintermute/BSprite.cpp +++ b/engines/wintermute/BSprite.cpp @@ -121,7 +121,7 @@ HRESULT CBSprite::Draw(int X, int Y, CBObject *Register, float ZoomX, float Zoom //////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::LoadFile(char *Filename, int LifeTime, TSpriteCacheType CacheType) {
+HRESULT CBSprite::LoadFile(const char *Filename, int LifeTime, TSpriteCacheType CacheType) {
CBFile *File = Game->_fileManager->OpenFile(Filename);
if (!File) {
Game->LOG(0, "CBSprite::LoadFile failed for file '%s'", Filename);
@@ -562,7 +562,7 @@ HRESULT CBSprite::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi else if (strcmp(Name, "AddFrame") == 0) {
Stack->CorrectParams(1);
CScValue *Val = Stack->Pop();
- char *Filename = NULL;
+ const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
CBFrame *Frame = new CBFrame(Game);
@@ -588,7 +588,7 @@ HRESULT CBSprite::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Thi if (Index < 0) Index = 0;
CScValue *Val = Stack->Pop();
- char *Filename = NULL;
+ const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
CBFrame *Frame = new CBFrame(Game);
diff --git a/engines/wintermute/BSprite.h b/engines/wintermute/BSprite.h index 973c263e8f..983b7bb62f 100644 --- a/engines/wintermute/BSprite.h +++ b/engines/wintermute/BSprite.h @@ -67,7 +67,7 @@ public: bool _paused;
bool _finished;
HRESULT LoadBuffer(byte *Buffer, bool Compete = true, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
- HRESULT LoadFile(char *Filename, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
+ HRESULT LoadFile(const char *Filename, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
uint32 _lastFrameTime;
HRESULT Draw(int X, int Y, CBObject *Register = NULL, float ZoomX = 100, float ZoomY = 100, uint32 Alpha = 0xFFFFFFFF);
bool _looping;
diff --git a/engines/wintermute/BStringTable.cpp b/engines/wintermute/BStringTable.cpp index bebed9a38f..e53403c6f0 100644 --- a/engines/wintermute/BStringTable.cpp +++ b/engines/wintermute/BStringTable.cpp @@ -169,7 +169,7 @@ const char *CBStringTable::ExpandStatic(const char *String, bool ForceExpand) { //////////////////////////////////////////////////////////////////////////
-HRESULT CBStringTable::LoadFile(char *Filename, bool ClearOld) {
+HRESULT CBStringTable::LoadFile(const char *Filename, bool ClearOld) {
Game->LOG(0, "Loading string table...");
if (ClearOld) _strings.clear();
diff --git a/engines/wintermute/BStringTable.h b/engines/wintermute/BStringTable.h index abb455e3f5..f4d1bc254e 100644 --- a/engines/wintermute/BStringTable.h +++ b/engines/wintermute/BStringTable.h @@ -38,7 +38,7 @@ namespace WinterMute { class CBStringTable : public CBBase {
public:
const char *ExpandStatic(const char *String, bool ForceExpand = false);
- HRESULT LoadFile(char *Filename, bool DeleteAll = true);
+ HRESULT LoadFile(const char *Filename, bool DeleteAll = true);
void Expand(char **Str, bool ForceExpand = false);
HRESULT AddString(const char *Key, const char *Val, bool ReportDuplicities = true);
CBStringTable(CBGame *inGame);
diff --git a/engines/wintermute/BSubFrame.cpp b/engines/wintermute/BSubFrame.cpp index d95fb824bd..e8abd11927 100644 --- a/engines/wintermute/BSubFrame.cpp +++ b/engines/wintermute/BSubFrame.cpp @@ -368,7 +368,7 @@ HRESULT CBSubFrame::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *T _surfaceFilename = NULL;
Stack->PushBool(true);
} else {
- char *Filename = Val->GetString();
+ const char *Filename = Val->GetString();
if (SUCCEEDED(SetSurface(Filename))) {
SetDefaultRect();
Stack->PushBool(true);
@@ -549,7 +549,7 @@ char *CBSubFrame::ScToString() { //////////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::SetSurface(char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
+HRESULT CBSubFrame::SetSurface(const char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
if (_surface) {
Game->_surfaceStorage->RemoveSurface(_surface);
_surface = NULL;
diff --git a/engines/wintermute/BSubFrame.h b/engines/wintermute/BSubFrame.h index 9a8961df1b..3c0a91344d 100644 --- a/engines/wintermute/BSubFrame.h +++ b/engines/wintermute/BSubFrame.h @@ -41,7 +41,7 @@ public: bool _mirrorX;
bool _mirrorY;
bool _decoration;
- HRESULT SetSurface(char *Filename, bool default_ck = true, byte ck_red = 0, byte ck_green = 0, byte ck_blue = 0, int LifeTime = -1, bool KeepLoaded = false);
+ HRESULT SetSurface(const char *Filename, bool default_ck = true, byte ck_red = 0, byte ck_green = 0, byte ck_blue = 0, int LifeTime = -1, bool KeepLoaded = false);
HRESULT SetSurfaceSimple();
DECLARE_PERSISTENT(CBSubFrame, CBScriptable)
void SetDefaultRect();
diff --git a/engines/wintermute/BSurface.cpp b/engines/wintermute/BSurface.cpp index c51652e503..4fe97bcdeb 100644 --- a/engines/wintermute/BSurface.cpp +++ b/engines/wintermute/BSurface.cpp @@ -60,7 +60,7 @@ CBSurface::~CBSurface() { //////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::Create(char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
+HRESULT CBSurface::Create(const char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
return E_FAIL;
}
diff --git a/engines/wintermute/BSurface.h b/engines/wintermute/BSurface.h index 53b9afa541..88fe58d17b 100644 --- a/engines/wintermute/BSurface.h +++ b/engines/wintermute/BSurface.h @@ -60,7 +60,7 @@ public: virtual HRESULT DisplayZoom(int X, int Y, RECT rect, float ZoomX, float ZoomY, uint32 Alpha = 0xFFFFFFFF, bool Transparent = false, TSpriteBlendMode BlendMode = BLEND_NORMAL, bool MirrorX = false, bool MirrorY = false);
virtual HRESULT DisplayTransform(int X, int Y, int HotX, int HotY, RECT Rect, float ZoomX, float ZoomY, uint32 Alpha, float Rotate, TSpriteBlendMode BlendMode = BLEND_NORMAL, bool MirrorX = false, bool MirrorY = false);
virtual HRESULT Restore();
- virtual HRESULT Create(char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime = -1, bool KeepLoaded = false);
+ virtual HRESULT Create(const char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime = -1, bool KeepLoaded = false);
virtual HRESULT Create(int Width, int Height);
virtual HRESULT PutPixel(int X, int Y, byte R, byte G, byte B, int A = -1);
virtual HRESULT GetPixel(int X, int Y, byte *R, byte *G, byte *B, byte *A = NULL);
diff --git a/engines/wintermute/BSurfaceSDL.cpp b/engines/wintermute/BSurfaceSDL.cpp index 0f30101780..9c1e1dc4dc 100644 --- a/engines/wintermute/BSurfaceSDL.cpp +++ b/engines/wintermute/BSurfaceSDL.cpp @@ -65,7 +65,7 @@ CBSurfaceSDL::~CBSurfaceSDL() { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::Create(char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
+HRESULT CBSurfaceSDL::Create(const char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
Common::String strFileName(Filename);
diff --git a/engines/wintermute/BSurfaceSDL.h b/engines/wintermute/BSurfaceSDL.h index 792dd01e6d..71a74beb2d 100644 --- a/engines/wintermute/BSurfaceSDL.h +++ b/engines/wintermute/BSurfaceSDL.h @@ -40,7 +40,7 @@ public: CBSurfaceSDL(CBGame *inGame);
~CBSurfaceSDL();
- HRESULT Create(char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime = -1, bool KeepLoaded = false);
+ HRESULT Create(const char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime = -1, bool KeepLoaded = false);
HRESULT Create(int Width, int Height);
HRESULT CreateFromSDLSurface(Graphics::Surface *surface); //TODO: Rename function
diff --git a/engines/wintermute/BSurfaceStorage.cpp b/engines/wintermute/BSurfaceStorage.cpp index a460ac83a6..0e22ae64fb 100644 --- a/engines/wintermute/BSurfaceStorage.cpp +++ b/engines/wintermute/BSurfaceStorage.cpp @@ -97,7 +97,7 @@ HRESULT CBSurfaceStorage::RemoveSurface(CBSurface *surface) { //////////////////////////////////////////////////////////////////////
-CBSurface *CBSurfaceStorage::AddSurface(char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
+CBSurface *CBSurfaceStorage::AddSurface(const char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime, bool KeepLoaded) {
for (int i = 0; i < _surfaces.GetSize(); i++) {
if (scumm_stricmp(_surfaces[i]->_filename, Filename) == 0) {
_surfaces[i]->_referenceCount++;
diff --git a/engines/wintermute/BSurfaceStorage.h b/engines/wintermute/BSurfaceStorage.h index 275c36b4a9..e91b2a3e84 100644 --- a/engines/wintermute/BSurfaceStorage.h +++ b/engines/wintermute/BSurfaceStorage.h @@ -45,7 +45,7 @@ public: //DECLARE_PERSISTENT(CBSurfaceStorage, CBBase);
HRESULT RestoreAll();
- CBSurface *AddSurface(char *Filename, bool default_ck = true, byte ck_red = 0, byte ck_green = 0, byte ck_blue = 0, int LifeTime = -1, bool KeepLoaded = false);
+ CBSurface *AddSurface(const char *Filename, bool default_ck = true, byte ck_red = 0, byte ck_green = 0, byte ck_blue = 0, int LifeTime = -1, bool KeepLoaded = false);
HRESULT RemoveSurface(CBSurface *surface);
CBSurfaceStorage(CBGame *inGame);
virtual ~CBSurfaceStorage();
diff --git a/engines/wintermute/PartEmitter.cpp b/engines/wintermute/PartEmitter.cpp index 6adfd4bbec..49bfe67666 100644 --- a/engines/wintermute/PartEmitter.cpp +++ b/engines/wintermute/PartEmitter.cpp @@ -111,7 +111,7 @@ CPartEmitter::~CPartEmitter(void) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::AddSprite(char *Filename) {
+HRESULT CPartEmitter::AddSprite(const char *Filename) {
if (!Filename) return E_FAIL;
// do we already have the file?
@@ -134,7 +134,7 @@ HRESULT CPartEmitter::AddSprite(char *Filename) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::RemoveSprite(char *Filename) {
+HRESULT CPartEmitter::RemoveSprite(const char *Filename) {
for (int i = 0; i < _sprites.GetSize(); i++) {
if (scumm_stricmp(Filename, _sprites[i]) == 0) {
delete [] _sprites[i];
@@ -359,7 +359,7 @@ HRESULT CPartEmitter::SetBorderThickness(int ThicknessLeft, int ThicknessRight, }
//////////////////////////////////////////////////////////////////////////
-CPartForce *CPartEmitter::AddForceByName(char *Name) {
+CPartForce *CPartEmitter::AddForceByName(const char *Name) {
CPartForce *Force = NULL;
for (int i = 0; i < _forces.GetSize(); i++) {
@@ -380,7 +380,7 @@ CPartForce *CPartEmitter::AddForceByName(char *Name) { //////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::AddForce(char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength) {
+HRESULT CPartEmitter::AddForce(const char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength) {
CPartForce *Force = AddForceByName(Name);
if (!Force) return E_FAIL;
@@ -396,7 +396,7 @@ HRESULT CPartEmitter::AddForce(char *Name, CPartForce::TForceType Type, int PosX }
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::RemoveForce(char *Name) {
+HRESULT CPartEmitter::RemoveForce(const char *Name) {
for (int i = 0; i < _forces.GetSize(); i++) {
if (scumm_stricmp(Name, _forces[i]->_name) == 0) {
delete _forces[i];
@@ -445,7 +445,7 @@ HRESULT CPartEmitter::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "AddSprite") == 0) {
Stack->CorrectParams(1);
- char *SpriteFile = Stack->Pop()->GetString();
+ const char *SpriteFile = Stack->Pop()->GetString();
Stack->PushBool(SUCCEEDED(AddSprite(SpriteFile)));
return S_OK;
@@ -455,7 +455,7 @@ HRESULT CPartEmitter::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "RemoveSprite") == 0) {
Stack->CorrectParams(1);
- char *SpriteFile = Stack->Pop()->GetString();
+ const char *SpriteFile = Stack->Pop()->GetString();
Stack->PushBool(SUCCEEDED(RemoveSprite(SpriteFile)));
return S_OK;
@@ -516,7 +516,7 @@ HRESULT CPartEmitter::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "AddGlobalForce") == 0) {
Stack->CorrectParams(3);
- char *Name = Stack->Pop()->GetString();
+ const char *Name = Stack->Pop()->GetString();
float Angle = Stack->Pop()->GetFloat();
float Strength = Stack->Pop()->GetFloat();
@@ -530,7 +530,7 @@ HRESULT CPartEmitter::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "AddPointForce") == 0) {
Stack->CorrectParams(5);
- char *Name = Stack->Pop()->GetString();
+ const char *Name = Stack->Pop()->GetString();
int PosX = Stack->Pop()->GetInt();
int PosY = Stack->Pop()->GetInt();
float Angle = Stack->Pop()->GetFloat();
@@ -546,7 +546,7 @@ HRESULT CPartEmitter::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "RemoveForce") == 0) {
Stack->CorrectParams(1);
- char *Name = Stack->Pop()->GetString();
+ const char *Name = Stack->Pop()->GetString();
Stack->PushBool(SUCCEEDED(RemoveForce(Name)));
diff --git a/engines/wintermute/PartEmitter.h b/engines/wintermute/PartEmitter.h index 16257153bc..92f6a608bf 100644 --- a/engines/wintermute/PartEmitter.h +++ b/engines/wintermute/PartEmitter.h @@ -104,13 +104,13 @@ public: HRESULT Display(CBRegion *Region = NULL);
HRESULT SortParticlesByZ();
- HRESULT AddSprite(char *Filename);
- HRESULT RemoveSprite(char *Filename);
+ HRESULT AddSprite(const char *Filename);
+ HRESULT RemoveSprite(const char *Filename);
HRESULT SetBorder(int X, int Y, int Width, int Height);
HRESULT SetBorderThickness(int ThicknessLeft, int ThicknessRight, int ThicknessTop, int ThicknessBottom);
- HRESULT AddForce(char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength);
- HRESULT RemoveForce(char *Name);
+ HRESULT AddForce(const char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength);
+ HRESULT RemoveForce(const char *Name);
CBArray<CPartForce *, CPartForce *> _forces;
@@ -122,7 +122,7 @@ public: private:
- CPartForce *AddForceByName(char *Name);
+ CPartForce *AddForceByName(const char *Name);
int static CompareZ(const void *Obj1, const void *Obj2);
HRESULT InitParticle(CPartParticle *Particle, uint32 CurrentTime, uint32 TimerDelta);
HRESULT UpdateInternal(uint32 CurrentTime, uint32 TimerDelta);
diff --git a/engines/wintermute/PartParticle.cpp b/engines/wintermute/PartParticle.cpp index cc59e20c17..68f1c62c5a 100644 --- a/engines/wintermute/PartParticle.cpp +++ b/engines/wintermute/PartParticle.cpp @@ -69,7 +69,7 @@ CPartParticle::~CPartParticle(void) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartParticle::SetSprite(char *Filename) {
+HRESULT CPartParticle::SetSprite(const char *Filename) {
if (_sprite && _sprite->_filename && scumm_stricmp(Filename, _sprite->_filename) == 0) {
_sprite->Reset();
return S_OK;
diff --git a/engines/wintermute/PartParticle.h b/engines/wintermute/PartParticle.h index 9de4248d6d..288c462b1d 100644 --- a/engines/wintermute/PartParticle.h +++ b/engines/wintermute/PartParticle.h @@ -68,7 +68,7 @@ public: HRESULT Update(CPartEmitter *Emitter, uint32 CurrentTime, uint32 TimerDelta);
HRESULT Display(CPartEmitter *Emitter);
- HRESULT SetSprite(char *Filename);
+ HRESULT SetSprite(const char *Filename);
HRESULT FadeIn(uint32 CurrentTime, int FadeTime);
HRESULT FadeOut(uint32 CurrentTime, int FadeTime);
diff --git a/engines/wintermute/UIButton.cpp b/engines/wintermute/UIButton.cpp index ebb72cbe97..4b5dde50fe 100644 --- a/engines/wintermute/UIButton.cpp +++ b/engines/wintermute/UIButton.cpp @@ -95,7 +95,7 @@ CUIButton::~CUIButton() { //////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::LoadFile(char *Filename) {
+HRESULT CUIButton::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CUIButton::LoadFile failed for file '%s'", Filename);
@@ -744,7 +744,7 @@ HRESULT CUIButton::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th delete _imageDisable;
_imageDisable = new CBSprite(Game);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
if (!_imageDisable || FAILED(_imageDisable->LoadFile(Filename))) {
delete _imageDisable;
_imageDisable = NULL;
@@ -785,7 +785,7 @@ HRESULT CUIButton::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th delete _imageHover;
_imageHover = new CBSprite(Game);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
if (!_imageHover || FAILED(_imageHover->LoadFile(Filename))) {
delete _imageHover;
_imageHover = NULL;
@@ -825,7 +825,7 @@ HRESULT CUIButton::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th delete _imagePress;
_imagePress = new CBSprite(Game);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
if (!_imagePress || FAILED(_imagePress->LoadFile(Filename))) {
delete _imagePress;
_imagePress = NULL;
@@ -865,7 +865,7 @@ HRESULT CUIButton::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th delete _imageFocus;
_imageFocus = new CBSprite(Game);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
if (!_imageFocus || FAILED(_imageFocus->LoadFile(Filename))) {
delete _imageFocus;
_imageFocus = NULL;
diff --git a/engines/wintermute/UIButton.h b/engines/wintermute/UIButton.h index aa2ac4d66d..9d1134fdf9 100644 --- a/engines/wintermute/UIButton.h +++ b/engines/wintermute/UIButton.h @@ -63,7 +63,7 @@ public: CUITiledImage *_backFocus;
CUIButton(CBGame *inGame = NULL);
virtual ~CUIButton();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
diff --git a/engines/wintermute/UIEdit.cpp b/engines/wintermute/UIEdit.cpp index 65d61d2641..3f81b16395 100644 --- a/engines/wintermute/UIEdit.cpp +++ b/engines/wintermute/UIEdit.cpp @@ -94,7 +94,7 @@ CUIEdit::~CUIEdit() { //////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::LoadFile(char *Filename) {
+HRESULT CUIEdit::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CUIEdit::LoadFile failed for file '%s'", Filename);
@@ -534,7 +534,7 @@ char *CUIEdit::ScToString() { //////////////////////////////////////////////////////////////////////////
-void CUIEdit::SetCursorChar(char *Char) {
+void CUIEdit::SetCursorChar(const char *Char) {
if (!Char) return;
delete[] _cursorChar;
_cursorChar = new char [strlen(Char) + 1];
diff --git a/engines/wintermute/UIEdit.h b/engines/wintermute/UIEdit.h index ccc332fd63..4d000d5954 100644 --- a/engines/wintermute/UIEdit.h +++ b/engines/wintermute/UIEdit.h @@ -48,7 +48,7 @@ public: int _scrollOffset;
int _frameWidth;
uint32 _cursorBlinkRate;
- void SetCursorChar(char *Char);
+ void SetCursorChar(const char *Char);
char *_cursorChar;
int _selEnd;
int _selStart;
@@ -56,7 +56,7 @@ public: CUIEdit(CBGame *inGame);
virtual ~CUIEdit();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
diff --git a/engines/wintermute/UIEntity.cpp b/engines/wintermute/UIEntity.cpp index b91e226a3e..15d36c3d3d 100644 --- a/engines/wintermute/UIEntity.cpp +++ b/engines/wintermute/UIEntity.cpp @@ -55,7 +55,7 @@ CUIEntity::~CUIEntity() { //////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::LoadFile(char *Filename) {
+HRESULT CUIEntity::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CUIEntity::LoadFile failed for file '%s'", Filename);
@@ -208,7 +208,7 @@ HRESULT CUIEntity::SaveAsText(CBDynBuffer *Buffer, int Indent) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::SetEntity(char *Filename) {
+HRESULT CUIEntity::SetEntity(const char *Filename) {
if (_entity) Game->UnregisterObject(_entity);
_entity = new CAdEntity(Game);
if (!_entity || FAILED(_entity->LoadFile(Filename))) {
@@ -270,7 +270,7 @@ HRESULT CUIEntity::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th else if (strcmp(Name, "SetEntity") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
if (SUCCEEDED(SetEntity(Filename)))
Stack->PushBool(true);
diff --git a/engines/wintermute/UIEntity.h b/engines/wintermute/UIEntity.h index 3f4b8c9ee2..ab3e74f9e6 100644 --- a/engines/wintermute/UIEntity.h +++ b/engines/wintermute/UIEntity.h @@ -38,13 +38,13 @@ public: DECLARE_PERSISTENT(CUIEntity, CUIObject)
CUIEntity(CBGame *inGame);
virtual ~CUIEntity();
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
virtual HRESULT Display(int OffsetX = 0, int OffsetY = 0);
CAdEntity *_entity;
- HRESULT SetEntity(char *Filename);
+ HRESULT SetEntity(const char *Filename);
// scripting interface
virtual CScValue *ScGetProperty(char *Name);
diff --git a/engines/wintermute/UIObject.cpp b/engines/wintermute/UIObject.cpp index bf0cad25b9..75939c5bf6 100644 --- a/engines/wintermute/UIObject.cpp +++ b/engines/wintermute/UIObject.cpp @@ -163,7 +163,7 @@ HRESULT CUIObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th Stack->CorrectParams(1);
CScValue *Val = Stack->Pop();
- char *Filename = Val->GetString();
+ const char *Filename = Val->GetString();
delete _image;
_image = NULL;
@@ -238,7 +238,7 @@ HRESULT CUIObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th }
// find by name
else {
- char *name = val->GetString();
+ const char *name = val->GetString();
for (i = 0; i < win->_widgets.GetSize(); i++) {
if (scumm_stricmp(win->_widgets[i]->_name, name) == 0) {
found = true;
diff --git a/engines/wintermute/UIText.cpp b/engines/wintermute/UIText.cpp index c0ecc60eac..b00e652b0a 100644 --- a/engines/wintermute/UIText.cpp +++ b/engines/wintermute/UIText.cpp @@ -95,7 +95,7 @@ HRESULT CUIText::Display(int OffsetX, int OffsetY) { //////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::LoadFile(char *Filename) {
+HRESULT CUIText::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CUIText::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/UIText.h b/engines/wintermute/UIText.h index cdd0acbc48..7f89fb6b30 100644 --- a/engines/wintermute/UIText.h +++ b/engines/wintermute/UIText.h @@ -43,7 +43,7 @@ public: virtual ~CUIText();
TTextAlign _textAlign;
TVerticalAlign _verticalAlign;
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
diff --git a/engines/wintermute/UITiledImage.cpp b/engines/wintermute/UITiledImage.cpp index 44d78845a3..4cdf9370fc 100644 --- a/engines/wintermute/UITiledImage.cpp +++ b/engines/wintermute/UITiledImage.cpp @@ -119,7 +119,7 @@ HRESULT CUITiledImage::Display(int X, int Y, int Width, int Height) { //////////////////////////////////////////////////////////////////////////
-HRESULT CUITiledImage::LoadFile(char *Filename) {
+HRESULT CUITiledImage::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CUITiledImage::LoadFile failed for file '%s'", Filename);
diff --git a/engines/wintermute/UITiledImage.h b/engines/wintermute/UITiledImage.h index 6cee8ae6cc..6e4b4d31d3 100644 --- a/engines/wintermute/UITiledImage.h +++ b/engines/wintermute/UITiledImage.h @@ -38,7 +38,7 @@ class CUITiledImage : public CBObject { public:
DECLARE_PERSISTENT(CUITiledImage, CBObject)
void CorrectSize(int *Width, int *Height);
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
virtual HRESULT SaveAsText(CBDynBuffer *Buffer, int Indent);
diff --git a/engines/wintermute/UIWindow.cpp b/engines/wintermute/UIWindow.cpp index a6ab142238..e450ae7c0d 100644 --- a/engines/wintermute/UIWindow.cpp +++ b/engines/wintermute/UIWindow.cpp @@ -200,7 +200,7 @@ HRESULT CUIWindow::Display(int OffsetX, int OffsetY) { //////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::LoadFile(char *Filename) {
+HRESULT CUIWindow::LoadFile(const char *Filename) {
byte *Buffer = Game->_fileManager->ReadWholeFile(Filename);
if (Buffer == NULL) {
Game->LOG(0, "CUIWindow::LoadFile failed for file '%s'", Filename);
@@ -733,7 +733,7 @@ HRESULT CUIWindow::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th delete _imageInactive;
_imageInactive = new CBSprite(Game);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
if (!_imageInactive || FAILED(_imageInactive->LoadFile(Filename))) {
delete _imageInactive;
_imageInactive = NULL;
diff --git a/engines/wintermute/UIWindow.h b/engines/wintermute/UIWindow.h index dc4c83ee1f..46649dda18 100644 --- a/engines/wintermute/UIWindow.h +++ b/engines/wintermute/UIWindow.h @@ -72,7 +72,7 @@ public: virtual bool HandleKeypress(SDL_Event *event);
CBArray<CUIObject *, CUIObject *> _widgets;
TTextAlign _titleAlign;
- HRESULT LoadFile(char *Filename);
+ HRESULT LoadFile(const char *Filename);
HRESULT LoadBuffer(byte *Buffer, bool Complete = true);
CUITiledImage *_backInactive;
CBFont *_fontInactive;
diff --git a/engines/wintermute/scriptables/SXFile.cpp b/engines/wintermute/scriptables/SXFile.cpp index 19b60043da..a24615e01d 100644 --- a/engines/wintermute/scriptables/SXFile.cpp +++ b/engines/wintermute/scriptables/SXFile.cpp @@ -96,7 +96,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
if (strcmp(Name, "SetFilename") == 0) {
Stack->CorrectParams(1);
- char *Filename = Stack->Pop()->GetString();
+ const char *Filename = Stack->Pop()->GetString();
Cleanup();
CBUtils::SetString(&_filename, Filename);
Stack->PushNULL();
@@ -181,7 +181,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "Copy") == 0) {
Stack->CorrectParams(2);
- char *Dest = Stack->Pop()->GetString();
+ const char *Dest = Stack->Pop()->GetString();
bool Overwrite = Stack->Pop()->GetBool(true);
Close();
@@ -290,7 +290,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "WriteLine") == 0 || strcmp(Name, "WriteText") == 0) {
Stack->CorrectParams(1);
- char *Line = Stack->Pop()->GetString();
+ const char *Line = Stack->Pop()->GetString();
if (!_textMode || !_writeFile) {
Script->RuntimeError("File.%s: File must be open for writing in text mode.", Name);
Stack->PushBool(false);
@@ -547,7 +547,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This //////////////////////////////////////////////////////////////////////////
else if (strcmp(Name, "WriteString") == 0) {
Stack->CorrectParams(1);
- char *Val = Stack->Pop()->GetString();
+ const char *Val = Stack->Pop()->GetString();
if (_textMode || !_writeFile) {
Script->RuntimeError("File.%s: File must be open for writing in binary mode.", Name);
diff --git a/engines/wintermute/scriptables/SXMemBuffer.cpp b/engines/wintermute/scriptables/SXMemBuffer.cpp index 6215d9c4e3..d1c4242ae8 100644 --- a/engines/wintermute/scriptables/SXMemBuffer.cpp +++ b/engines/wintermute/scriptables/SXMemBuffer.cpp @@ -349,7 +349,7 @@ HRESULT CSXMemBuffer::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack else if (strcmp(Name, "SetString") == 0) {
Stack->CorrectParams(2);
int Start = Stack->Pop()->GetInt();
- char *Val = Stack->Pop()->GetString();
+ const char *Val = Stack->Pop()->GetString();
if (!CheckBounds(Script, Start, strlen(Val) + 1)) Stack->PushBool(false);
else {
diff --git a/engines/wintermute/scriptables/SXStore.cpp b/engines/wintermute/scriptables/SXStore.cpp index 74217b9907..f24896f611 100644 --- a/engines/wintermute/scriptables/SXStore.cpp +++ b/engines/wintermute/scriptables/SXStore.cpp @@ -101,7 +101,7 @@ HRESULT CSXStore::ScCallMethod(CScScript *script, CScStack *stack, CScStack *thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ValidateProducts") == 0) {
stack->CorrectParams(1);
- char *prodIdList = stack->Pop()->GetString();
+ const char *prodIdList = stack->Pop()->GetString();
_lastProductRequestOwner = script->_owner;
ValidateProducts(prodIdList);
stack->PushNULL();
@@ -162,7 +162,7 @@ HRESULT CSXStore::ScCallMethod(CScScript *script, CScStack *stack, CScStack *thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Purchase") == 0) {
stack->CorrectParams(1);
- char *prodId = stack->Pop()->GetString();
+ const char *prodId = stack->Pop()->GetString();
stack->PushBool(Purchase(script, prodId));
return S_OK;
@@ -172,7 +172,7 @@ HRESULT CSXStore::ScCallMethod(CScScript *script, CScStack *stack, CScStack *thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FinishTransaction") == 0) {
stack->CorrectParams(1);
- char *transId = stack->Pop()->GetString();
+ const char *transId = stack->Pop()->GetString();
stack->PushBool(FinishTransaction(script, transId));
return S_OK;
@@ -193,7 +193,7 @@ HRESULT CSXStore::ScCallMethod(CScScript *script, CScStack *stack, CScStack *thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "UnlockProduct") == 0) {
stack->CorrectParams(1);
- char *prodId = stack->Pop()->GetString();
+ const char *prodId = stack->Pop()->GetString();
Game->_registry->WriteBool("Purchases", prodId, true);
Game->_registry->SaveValues();
@@ -208,7 +208,7 @@ HRESULT CSXStore::ScCallMethod(CScScript *script, CScStack *stack, CScStack *thi //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IsProductUnlocked") == 0) {
stack->CorrectParams(1);
- char *prodId = stack->Pop()->GetString();
+ const char *prodId = stack->Pop()->GetString();
stack->PushBool(Game->_registry->ReadBool("Purchases", prodId, false));
diff --git a/engines/wintermute/scriptables/SXString.cpp b/engines/wintermute/scriptables/SXString.cpp index 4c9f4db146..b2e5faf1db 100644 --- a/engines/wintermute/scriptables/SXString.cpp +++ b/engines/wintermute/scriptables/SXString.cpp @@ -211,7 +211,7 @@ HRESULT CSXString::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th else if (strcmp(Name, "IndexOf") == 0) {
Stack->CorrectParams(2);
- char *strToFind = Stack->Pop()->GetString();
+ const char *strToFind = Stack->Pop()->GetString();
int index = Stack->Pop()->GetInt();
WideString str;
diff --git a/engines/wintermute/scriptables/ScEngine.cpp b/engines/wintermute/scriptables/ScEngine.cpp index 0b19542beb..b5f66bbb14 100644 --- a/engines/wintermute/scriptables/ScEngine.cpp +++ b/engines/wintermute/scriptables/ScEngine.cpp @@ -232,7 +232,7 @@ void WINAPI CScEngine::ParseElement(void *Data, int Line, int Type, void *Elemen //////////////////////////////////////////////////////////////////////////
-CScScript *CScEngine::RunScript(char *Filename, CBScriptHolder *Owner) {
+CScScript *CScEngine::RunScript(const char *Filename, CBScriptHolder *Owner) {
byte *CompBuffer;
uint32 CompSize;
@@ -265,7 +265,7 @@ CScScript *CScEngine::RunScript(char *Filename, CBScriptHolder *Owner) { //////////////////////////////////////////////////////////////////////////
-byte *CScEngine::GetCompiledScript(char *Filename, uint32 *OutSize, bool IgnoreCache) {
+byte *CScEngine::GetCompiledScript(const char *Filename, uint32 *OutSize, bool IgnoreCache) {
int i;
// is script in cache?
@@ -316,8 +316,13 @@ byte *CScEngine::GetCompiledScript(char *Filename, uint32 *OutSize, bool IgnoreC // publish native interfaces
Game->PublishNatives();
+ // We have const char* everywhere but in the DLL-interfaces...
+ char *tempFileName = new char[strlen(Filename) + 1];
+ memcpy(tempFileName, Filename, strlen(Filename) + 1);
+
SetFileToCompile(Filename);
- CompBuffer = ExtCompileFile(Filename, &CompSize);
+ CompBuffer = ExtCompileFile(tempFileName, &CompSize);
+ delete[] tempFileName;
if (!CompBuffer) {
Game->QuickMessage("Script compiler error. View log for details.");
delete [] Buffer;
@@ -604,7 +609,7 @@ HRESULT CScEngine::ResumeAll() { //////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::SetFileToCompile(char *Filename) {
+HRESULT CScEngine::SetFileToCompile(const char *Filename) {
delete[] _fileToCompile;
_fileToCompile = new char[strlen(Filename) + 1];
if (_fileToCompile) {
diff --git a/engines/wintermute/scriptables/ScEngine.h b/engines/wintermute/scriptables/ScEngine.h index 7ca9ec0771..6a258688c4 100644 --- a/engines/wintermute/scriptables/ScEngine.h +++ b/engines/wintermute/scriptables/ScEngine.h @@ -57,7 +57,7 @@ class CScEngine : public CBBase { public:
class CScCachedScript {
public:
- CScCachedScript(char *Filename, byte *Buffer, uint32 Size) {
+ CScCachedScript(const char *Filename, byte *Buffer, uint32 Size) {
_timestamp = CBPlatform::GetTime();
_buffer = new byte[Size];
if (_buffer) memcpy(_buffer, Buffer, Size);
@@ -116,7 +116,7 @@ public: PARSE_ELEMENT_CALLBACK _parseElementCallback;
void *_parseElementCallbackData;
- HRESULT SetFileToCompile(char *Filename);
+ HRESULT SetFileToCompile(const char *Filename);
char *_fileToCompile;
CScScript *_currentScript;
HRESULT ResumeAll();
@@ -125,13 +125,13 @@ public: HRESULT ResetObject(CBObject *Object);
HRESULT ResetScript(CScScript *Script);
HRESULT EmptyScriptCache();
- byte *GetCompiledScript(char *Filename, uint32 *OutSize, bool IgnoreCache = false);
+ byte *GetCompiledScript(const char *Filename, uint32 *OutSize, bool IgnoreCache = false);
DECLARE_PERSISTENT(CScEngine, CBBase)
HRESULT Cleanup();
int GetNumScripts(int *Running = NULL, int *Waiting = NULL, int *Persistent = NULL);
HRESULT Tick();
CScValue *_globals;
- CScScript *RunScript(char *Filename, CBScriptHolder *Owner = NULL);
+ CScScript *RunScript(const char *Filename, CBScriptHolder *Owner = NULL);
bool _compilerAvailable;
HINSTANCE _compilerDLL;
CScEngine(CBGame *inGame);
diff --git a/engines/wintermute/scriptables/ScScript.cpp b/engines/wintermute/scriptables/ScScript.cpp index 4d9edf9db4..3678701cf4 100644 --- a/engines/wintermute/scriptables/ScScript.cpp +++ b/engines/wintermute/scriptables/ScScript.cpp @@ -223,7 +223,7 @@ HRESULT CScScript::InitTables() { //////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::Create(char *Filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner) {
+HRESULT CScScript::Create(const char *Filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner) {
Cleanup();
_thread = false;
@@ -442,7 +442,7 @@ HRESULT CScScript::ExecuteInstruction() { HRESULT ret = S_OK;
uint32 dw;
- char *str;
+ const char *str;
//CScValue* op = new CScValue(Game);
_operand->Cleanup();
@@ -761,11 +761,11 @@ HRESULT CScScript::ExecuteInstruction() { if (op1->IsNULL() || op2->IsNULL()) _operand->SetNULL();
else if (op1->GetType() == VAL_STRING || op2->GetType() == VAL_STRING) {
- str = new char [strlen(op1->GetString()) + strlen(op2->GetString()) + 1];
- strcpy(str, op1->GetString());
- strcat(str, op2->GetString());
+ char *tempStr = new char [strlen(op1->GetString()) + strlen(op2->GetString()) + 1];
+ strcpy(tempStr, op1->GetString());
+ strcat(tempStr, op2->GetString());
_operand->SetString(str);
- delete [] str;
+ delete [] tempStr;
} else if (op1->GetType() == VAL_INT && op2->GetType() == VAL_INT)
_operand->SetInt(op1->GetInt() + op2->GetInt());
else _operand->SetFloat(op1->GetFloat() + op2->GetFloat());
@@ -1244,13 +1244,13 @@ uint32 CScScript::GetEventPos(const char *Name) { //////////////////////////////////////////////////////////////////////////
-bool CScScript::CanHandleEvent(char *EventName) {
+bool CScScript::CanHandleEvent(const char *EventName) {
return GetEventPos(EventName) != 0;
}
//////////////////////////////////////////////////////////////////////////
-bool CScScript::CanHandleMethod(char *MethodName) {
+bool CScScript::CanHandleMethod(const char *MethodName) {
return GetMethodPos(MethodName) != 0;
}
diff --git a/engines/wintermute/scriptables/ScScript.h b/engines/wintermute/scriptables/ScScript.h index 57baf8d92a..588f57512e 100644 --- a/engines/wintermute/scriptables/ScScript.h +++ b/engines/wintermute/scriptables/ScScript.h @@ -68,8 +68,8 @@ public: bool _freezable;
HRESULT Resume();
HRESULT Pause();
- bool CanHandleEvent(char *EventName);
- bool CanHandleMethod(char *MethodName);
+ bool CanHandleEvent(const char *EventName);
+ bool CanHandleMethod(const char *MethodName);
HRESULT CreateThread(CScScript *Original, uint32 InitIP, const char *EventName);
HRESULT CreateMethodThread(CScScript *Original, const char *MethodName);
CScScript *InvokeEventHandler(const char *EventName, bool Unbreakable = false);
@@ -140,7 +140,7 @@ public: uint32 GetDWORD();
double GetFloat();
void Cleanup();
- HRESULT Create(char *Filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner);
+ HRESULT Create(const char *Filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner);
uint32 _iP;
uint32 _bufferSize;
byte *_buffer;
diff --git a/engines/wintermute/scriptables/ScValue.cpp b/engines/wintermute/scriptables/ScValue.cpp index 055f9830ad..250a61ad67 100644 --- a/engines/wintermute/scriptables/ScValue.cpp +++ b/engines/wintermute/scriptables/ScValue.cpp @@ -156,7 +156,7 @@ CScValue::~CScValue() { //////////////////////////////////////////////////////////////////////////
-CScValue *CScValue::GetProp(char *Name) {
+CScValue *CScValue::GetProp(const char *Name) {
if (_type == VAL_VARIABLE_REF) return _valRef->GetProp(Name);
if (_type == VAL_STRING && strcmp(Name, "Length") == 0) {
@@ -203,7 +203,7 @@ HRESULT CScValue::DeleteProp(char *Name) { //////////////////////////////////////////////////////////////////////////
-HRESULT CScValue::SetProp(char *Name, CScValue *Val, bool CopyWhole, bool SetAsConst) {
+HRESULT CScValue::SetProp(const char *Name, CScValue *Val, bool CopyWhole, bool SetAsConst) {
if (_type == VAL_VARIABLE_REF) return _valRef->SetProp(Name, Val);
HRESULT ret = E_FAIL;
@@ -410,7 +410,10 @@ void CScValue::SetString(const char *Val) { //////////////////////////////////////////////////////////////////////////
void CScValue::SetStringVal(const char *Val) {
- if (_valString) delete [] _valString;
+ if (_valString) {
+ delete [] _valString;
+ _valString = NULL;
+ }
if (Val == NULL) {
_valString = NULL;
@@ -575,7 +578,7 @@ void *CScValue::GetMemBuffer() { //////////////////////////////////////////////////////////////////////////
-char *CScValue::GetString() {
+const char *CScValue::GetString() {
if (_type == VAL_VARIABLE_REF) return _valRef->GetString();
switch (_type) {
diff --git a/engines/wintermute/scriptables/ScValue.h b/engines/wintermute/scriptables/ScValue.h index 992a220622..8696808ad4 100644 --- a/engines/wintermute/scriptables/ScValue.h +++ b/engines/wintermute/scriptables/ScValue.h @@ -64,7 +64,7 @@ public: bool GetBool(bool Default = false);
int GetInt(int Default = 0);
double GetFloat(double Default = 0.0f);
- char *GetString();
+ const char *GetString();
void *GetMemBuffer();
CBScriptable *GetNative();
HRESULT DeleteProp(char *Name);
@@ -85,8 +85,8 @@ public: bool IsFloat();
bool IsInt();
bool IsObject();
- HRESULT SetProp(char *Name, CScValue *Val, bool CopyWhole = false, bool SetAsConst = false);
- CScValue *GetProp(char *Name);
+ HRESULT SetProp(const char *Name, CScValue *Val, bool CopyWhole = false, bool SetAsConst = false);
+ CScValue *GetProp(const char *Name);
CBScriptable *_valNative;
CScValue *_valRef;
bool _valBool;
diff --git a/engines/wintermute/utils.cpp b/engines/wintermute/utils.cpp index 5a7588e765..de5d00e677 100644 --- a/engines/wintermute/utils.cpp +++ b/engines/wintermute/utils.cpp @@ -233,11 +233,10 @@ bool CBUtils::MatchesPattern(const char *Pattern, const char *String) { }
//////////////////////////////////////////////////////////////////////////
-char *CBUtils::GetPath(char *Filename) {
+char *CBUtils::GetPath(const char *Filename) {
AnsiString path = PathUtil::GetDirectoryName(Filename);
//path = boost::filesystem::syste_complete(path).string();
warning("CBUtils::GetPath: (%s), not implemented", Filename);
- return Filename;
char *ret = new char[path.size() + 1];
strcpy(ret, path.c_str());
@@ -245,7 +244,7 @@ char *CBUtils::GetPath(char *Filename) { }
//////////////////////////////////////////////////////////////////////////
-char *CBUtils::GetFilename(char *Filename) {
+char *CBUtils::GetFilename(const char *Filename) {
AnsiString path = PathUtil::GetFileName(Filename);
char *ret = new char[path.size() + 1];
strcpy(ret, path.c_str());
diff --git a/engines/wintermute/utils.h b/engines/wintermute/utils.h index 6fdac018ce..fb61ae6571 100644 --- a/engines/wintermute/utils.h +++ b/engines/wintermute/utils.h @@ -56,8 +56,8 @@ public: static bool MatchesPattern(const char *pattern, const char *string);
- static char *GetPath(char *Filename);
- static char *GetFilename(char *Filename);
+ static char *GetPath(const char *Filename);
+ static char *GetFilename(const char *Filename);
static void RGBtoHSL(uint32 RGBColor, byte *OutH, byte *OutS, byte *OutL);
static uint32 HSLtoRGB(byte H, byte S, byte L);
|