diff options
author | Einar Johan Trøan Sømåen | 2012-07-03 05:08:59 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-07-03 05:08:59 +0200 |
commit | c27d6585df61efc8b1ff5917de2dc3ae8b5d4248 (patch) | |
tree | bbcf066dcaa050f5e1d2e0561e1f7f1166d4ad5f /engines/wintermute/Base | |
parent | 6c6c0bb0167cbf004cf300a81dda71a952d93626 (diff) | |
download | scummvm-rg350-c27d6585df61efc8b1ff5917de2dc3ae8b5d4248.tar.gz scummvm-rg350-c27d6585df61efc8b1ff5917de2dc3ae8b5d4248.tar.bz2 scummvm-rg350-c27d6585df61efc8b1ff5917de2dc3ae8b5d4248.zip |
WINTERMUTE: Rename FuncName->funcName in ScStack
Diffstat (limited to 'engines/wintermute/Base')
22 files changed, 1082 insertions, 1082 deletions
diff --git a/engines/wintermute/Base/BFrame.cpp b/engines/wintermute/Base/BFrame.cpp index 755321de11..34b5ebbe47 100644 --- a/engines/wintermute/Base/BFrame.cpp +++ b/engines/wintermute/Base/BFrame.cpp @@ -407,10 +407,10 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // GetSound
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "GetSound") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (_sound && _sound->_soundFilename) stack->PushString(_sound->_soundFilename);
- else stack->PushNULL();
+ if (_sound && _sound->_soundFilename) stack->pushString(_sound->_soundFilename);
+ else stack->pushNULL();
return S_OK;
}
@@ -418,19 +418,19 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // SetSound
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetSound") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
delete _sound;
_sound = NULL;
if (!Val->IsNULL()) {
_sound = new CBSound(Game);
if (!_sound || FAILED(_sound->setSound(Val->GetString(), SOUND_SFX, false))) {
- stack->PushBool(false);
+ stack->pushBool(false);
delete _sound;
_sound = NULL;
- } else stack->PushBool(true);
- } else stack->PushBool(true);
+ } else stack->pushBool(true);
+ } else stack->pushBool(true);
return S_OK;
}
@@ -438,12 +438,12 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // GetSubframe
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "GetSubframe") == 0) {
- stack->CorrectParams(1);
- int Index = stack->Pop()->GetInt(-1);
+ stack->correctParams(1);
+ int Index = stack->pop()->GetInt(-1);
if (Index < 0 || Index >= _subframes.GetSize()) {
script->RuntimeError("Frame.GetSubframe: Subframe index %d is out of range.", Index);
- stack->PushNULL();
- } else stack->PushNative(_subframes[Index], true);
+ stack->pushNULL();
+ } else stack->pushNative(_subframes[Index], true);
return S_OK;
}
@@ -452,8 +452,8 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // DeleteSubframe
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DeleteSubframe") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
if (Val->IsInt()) {
int Index = Val->GetInt(-1);
if (Index < 0 || Index >= _subframes.GetSize()) {
@@ -469,7 +469,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this }
}
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -477,8 +477,8 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // AddSubframe
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AddSubframe") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
@@ -489,7 +489,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this }
_subframes.Add(Sub);
- stack->PushNative(Sub, true);
+ stack->pushNative(Sub, true);
return S_OK;
}
@@ -497,11 +497,11 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // InsertSubframe
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "InsertSubframe") == 0) {
- stack->CorrectParams(2);
- int Index = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int Index = stack->pop()->GetInt();
if (Index < 0) Index = 0;
- CScValue *Val = stack->Pop();
+ CScValue *Val = stack->pop();
const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
@@ -513,7 +513,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this if (Index >= _subframes.GetSize()) _subframes.Add(Sub);
else _subframes.InsertAt(Index, Sub);
- stack->PushNative(Sub, true);
+ stack->pushNative(Sub, true);
return S_OK;
}
@@ -521,12 +521,12 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // GetEvent
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSubframe") == 0) {
- stack->CorrectParams(1);
- int Index = stack->Pop()->GetInt(-1);
+ stack->correctParams(1);
+ int Index = stack->pop()->GetInt(-1);
if (Index < 0 || Index >= _applyEvent.GetSize()) {
script->RuntimeError("Frame.GetEvent: Event index %d is out of range.", Index);
- stack->PushNULL();
- } else stack->PushString(_applyEvent[Index]);
+ stack->pushNULL();
+ } else stack->pushString(_applyEvent[Index]);
return S_OK;
}
@@ -534,16 +534,16 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // AddEvent
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AddEvent") == 0) {
- stack->CorrectParams(1);
- const char *Event = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *Event = stack->pop()->GetString();
for (int i = 0; i < _applyEvent.GetSize(); i++) {
if (scumm_stricmp(_applyEvent[i], Event) == 0) {
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
}
_applyEvent.Add(Event);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -551,8 +551,8 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // DeleteEvent
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DeleteEvent") == 0) {
- stack->CorrectParams(1);
- const char *Event = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *Event = stack->pop()->GetString();
for (int i = 0; i < _applyEvent.GetSize(); i++) {
if (scumm_stricmp(_applyEvent[i], Event) == 0) {
delete [] _applyEvent[i];
@@ -560,7 +560,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this break;
}
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp index d7cc2332a5..2c60521e54 100644 --- a/engines/wintermute/Base/BGame.cpp +++ b/engines/wintermute/Base/BGame.cpp @@ -982,9 +982,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // LOG
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "LOG") == 0) {
- stack->CorrectParams(1);
- LOG(0, stack->Pop()->GetString());
- stack->PushNULL();
+ stack->correctParams(1);
+ LOG(0, stack->pop()->GetString());
+ stack->pushNULL();
return S_OK;
}
@@ -1001,9 +1001,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // Msg
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Msg") == 0) {
- stack->CorrectParams(1);
- QuickMessage(stack->Pop()->GetString());
- stack->PushNULL();
+ stack->correctParams(1);
+ QuickMessage(stack->pop()->GetString());
+ stack->pushNULL();
return S_OK;
}
@@ -1012,11 +1012,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RunScript") == 0) {
Game->LOG(0, "**Warning** The 'RunScript' method is now obsolete. Use 'AttachScript' instead (same syntax)");
- stack->CorrectParams(1);
- if (FAILED(addScript(stack->Pop()->GetString())))
- stack->PushBool(false);
+ stack->correctParams(1);
+ if (FAILED(addScript(stack->pop()->GetString())))
+ stack->pushBool(false);
else
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -1025,18 +1025,18 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // LoadStringTable
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LoadStringTable") == 0) {
- stack->CorrectParams(2);
- const char *filename = stack->Pop()->GetString();
- CScValue *Val = stack->Pop();
+ stack->correctParams(2);
+ const char *filename = stack->pop()->GetString();
+ CScValue *Val = stack->pop();
bool ClearOld;
if (Val->IsNULL()) ClearOld = true;
else ClearOld = Val->GetBool();
if (FAILED(_stringTable->loadFile(filename, ClearOld)))
- stack->PushBool(false);
+ stack->pushBool(false);
else
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -1045,10 +1045,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // ValidObject
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ValidObject") == 0) {
- stack->CorrectParams(1);
- CBScriptable *obj = stack->Pop()->GetNative();
- if (ValidObject((CBObject *) obj)) stack->PushBool(true);
- else stack->PushBool(false);
+ stack->correctParams(1);
+ CBScriptable *obj = stack->pop()->GetNative();
+ if (ValidObject((CBObject *) obj)) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -1057,9 +1057,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // Reset
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Reset") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
ResetContent();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1069,13 +1069,13 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // UnloadObject
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "UnloadObject") == 0) {
- stack->CorrectParams(1);
- CScValue *val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *val = stack->pop();
CBObject *obj = (CBObject *)val->GetNative();
UnregisterObject(obj);
if (val->GetType() == VAL_VARIABLE_REF) val->SetNULL();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1083,16 +1083,16 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // LoadWindow
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LoadWindow") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
CUIWindow *win = new CUIWindow(Game);
- if (win && SUCCEEDED(win->loadFile(stack->Pop()->GetString()))) {
+ if (win && SUCCEEDED(win->loadFile(stack->pop()->GetString()))) {
_windows.Add(win);
RegisterObject(win);
- stack->PushNative(win, true);
+ stack->pushNative(win, true);
} else {
delete win;
win = NULL;
- stack->PushNULL();
+ stack->pushNULL();
}
return S_OK;
}
@@ -1101,12 +1101,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // ExpandString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ExpandString") == 0) {
- stack->CorrectParams(1);
- CScValue *val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *val = stack->pop();
char *str = new char[strlen(val->GetString()) + 1];
strcpy(str, val->GetString());
_stringTable->Expand(&str);
- stack->PushString(str);
+ stack->pushString(str);
delete [] str;
return S_OK;
}
@@ -1116,22 +1116,22 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PlayMusic") == 0 || strcmp(name, "PlayMusicChannel") == 0) {
int channel = 0;
- if (strcmp(name, "PlayMusic") == 0) stack->CorrectParams(3);
+ if (strcmp(name, "PlayMusic") == 0) stack->correctParams(3);
else {
- stack->CorrectParams(4);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(4);
+ channel = stack->pop()->GetInt();
}
- const char *filename = stack->Pop()->GetString();
- CScValue *ValLooping = stack->Pop();
+ const char *filename = stack->pop()->GetString();
+ CScValue *ValLooping = stack->pop();
bool Looping = ValLooping->IsNULL() ? true : ValLooping->GetBool();
- CScValue *ValLoopStart = stack->Pop();
+ CScValue *ValLoopStart = stack->pop();
uint32 LoopStart = (uint32)(ValLoopStart->IsNULL() ? 0 : ValLoopStart->GetInt());
- if (FAILED(PlayMusic(channel, filename, Looping, LoopStart))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(PlayMusic(channel, filename, Looping, LoopStart))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -1141,14 +1141,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS else if (strcmp(name, "StopMusic") == 0 || strcmp(name, "StopMusicChannel") == 0) {
int channel = 0;
- if (strcmp(name, "StopMusic") == 0) stack->CorrectParams(0);
+ if (strcmp(name, "StopMusic") == 0) stack->correctParams(0);
else {
- stack->CorrectParams(1);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ channel = stack->pop()->GetInt();
}
- if (FAILED(StopMusic(channel))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(StopMusic(channel))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -1158,14 +1158,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS else if (strcmp(name, "PauseMusic") == 0 || strcmp(name, "PauseMusicChannel") == 0) {
int channel = 0;
- if (strcmp(name, "PauseMusic") == 0) stack->CorrectParams(0);
+ if (strcmp(name, "PauseMusic") == 0) stack->correctParams(0);
else {
- stack->CorrectParams(1);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ channel = stack->pop()->GetInt();
}
- if (FAILED(PauseMusic(channel))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(PauseMusic(channel))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -1174,14 +1174,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ResumeMusic") == 0 || strcmp(name, "ResumeMusicChannel") == 0) {
int channel = 0;
- if (strcmp(name, "ResumeMusic") == 0) stack->CorrectParams(0);
+ if (strcmp(name, "ResumeMusic") == 0) stack->correctParams(0);
else {
- stack->CorrectParams(1);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ channel = stack->pop()->GetInt();
}
- if (FAILED(ResumeMusic(channel))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(ResumeMusic(channel))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -1190,15 +1190,15 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetMusic") == 0 || strcmp(name, "GetMusicChannel") == 0) {
int channel = 0;
- if (strcmp(name, "GetMusic") == 0) stack->CorrectParams(0);
+ if (strcmp(name, "GetMusic") == 0) stack->correctParams(0);
else {
- stack->CorrectParams(1);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ channel = stack->pop()->GetInt();
}
- if (channel < 0 || channel >= NUM_MUSIC_CHANNELS) stack->PushNULL();
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS) stack->pushNULL();
else {
- if (!_music[channel] || !_music[channel]->_soundFilename) stack->PushNULL();
- else stack->PushString(_music[channel]->_soundFilename);
+ if (!_music[channel] || !_music[channel]->_soundFilename) stack->pushNULL();
+ else stack->pushString(_music[channel]->_soundFilename);
}
return S_OK;
}
@@ -1208,16 +1208,16 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetMusicPosition") == 0 || strcmp(name, "SetMusicChannelPosition") == 0 || strcmp(name, "SetMusicPositionChannel") == 0) {
int channel = 0;
- if (strcmp(name, "SetMusicPosition") == 0) stack->CorrectParams(1);
+ if (strcmp(name, "SetMusicPosition") == 0) stack->correctParams(1);
else {
- stack->CorrectParams(2);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ channel = stack->pop()->GetInt();
}
- uint32 Time = stack->Pop()->GetInt();
+ uint32 Time = stack->pop()->GetInt();
- if (FAILED(SetMusicStartTime(channel, Time))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(SetMusicStartTime(channel, Time))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -1227,14 +1227,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetMusicPosition") == 0 || strcmp(name, "GetMusicChannelPosition") == 0) {
int channel = 0;
- if (strcmp(name, "GetMusicPosition") == 0) stack->CorrectParams(0);
+ if (strcmp(name, "GetMusicPosition") == 0) stack->correctParams(0);
else {
- stack->CorrectParams(1);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ channel = stack->pop()->GetInt();
}
- if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->PushInt(0);
- else stack->PushInt(_music[channel]->getPositionTime());
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushInt(0);
+ else stack->pushInt(_music[channel]->getPositionTime());
return S_OK;
}
@@ -1243,14 +1243,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IsMusicPlaying") == 0 || strcmp(name, "IsMusicChannelPlaying") == 0) {
int channel = 0;
- if (strcmp(name, "IsMusicPlaying") == 0) stack->CorrectParams(0);
+ if (strcmp(name, "IsMusicPlaying") == 0) stack->correctParams(0);
else {
- stack->CorrectParams(1);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ channel = stack->pop()->GetInt();
}
- if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->PushBool(false);
- else stack->PushBool(_music[channel]->isPlaying());
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushBool(false);
+ else stack->pushBool(_music[channel]->isPlaying());
return S_OK;
}
@@ -1259,17 +1259,17 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetMusicVolume") == 0 || strcmp(name, "SetMusicChannelVolume") == 0) {
int channel = 0;
- if (strcmp(name, "SetMusicVolume") == 0) stack->CorrectParams(1);
+ if (strcmp(name, "SetMusicVolume") == 0) stack->correctParams(1);
else {
- stack->CorrectParams(2);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ channel = stack->pop()->GetInt();
}
- int Volume = stack->Pop()->GetInt();
- if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->PushBool(false);
+ int Volume = stack->pop()->GetInt();
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushBool(false);
else {
- if (FAILED(_music[channel]->setVolume(Volume))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(_music[channel]->setVolume(Volume))) stack->pushBool(false);
+ else stack->pushBool(true);
}
return S_OK;
}
@@ -1279,14 +1279,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetMusicVolume") == 0 || strcmp(name, "GetMusicChannelVolume") == 0) {
int channel = 0;
- if (strcmp(name, "GetMusicVolume") == 0) stack->CorrectParams(0);
+ if (strcmp(name, "GetMusicVolume") == 0) stack->correctParams(0);
else {
- stack->CorrectParams(1);
- channel = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ channel = stack->pop()->GetInt();
}
- if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->PushInt(0);
- else stack->PushInt(_music[channel]->getVolume());
+ if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushInt(0);
+ else stack->pushInt(_music[channel]->getVolume());
return S_OK;
}
@@ -1295,15 +1295,15 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // MusicCrossfade
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MusicCrossfade") == 0) {
- stack->CorrectParams(4);
- int channel1 = stack->Pop()->GetInt(0);
- int channel2 = stack->Pop()->GetInt(0);
- uint32 FadeLength = (uint32)stack->Pop()->GetInt(0);
- bool Swap = stack->Pop()->GetBool(true);
+ stack->correctParams(4);
+ int channel1 = stack->pop()->GetInt(0);
+ int channel2 = stack->pop()->GetInt(0);
+ uint32 FadeLength = (uint32)stack->pop()->GetInt(0);
+ bool Swap = stack->pop()->GetBool(true);
if (_musicCrossfadeRunning) {
script->RuntimeError("Game.MusicCrossfade: Music crossfade is already in progress.");
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
@@ -1315,7 +1315,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS _musicCrossfadeRunning = true;
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -1323,10 +1323,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetSoundLength
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSoundLength") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
int Length = 0;
- const 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))) {
@@ -1334,7 +1334,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS delete Sound;
Sound = NULL;
}
- stack->PushInt(Length);
+ stack->pushInt(Length);
return S_OK;
}
@@ -1342,9 +1342,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetMousePos
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetMousePos") == 0) {
- stack->CorrectParams(2);
- int x = stack->Pop()->GetInt();
- int y = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int x = stack->pop()->GetInt();
+ int y = stack->pop()->GetInt();
x = MAX(x, 0);
x = MIN(x, _renderer->_width);
y = MAX(y, 0);
@@ -1355,7 +1355,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS CBPlatform::SetCursorPos(p.x, p.y);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1363,18 +1363,18 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // LockMouseRect
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LockMouseRect") == 0) {
- stack->CorrectParams(4);
- int left = stack->Pop()->GetInt();
- int top = stack->Pop()->GetInt();
- int right = stack->Pop()->GetInt();
- int bottom = stack->Pop()->GetInt();
+ stack->correctParams(4);
+ int left = stack->pop()->GetInt();
+ int top = stack->pop()->GetInt();
+ int right = stack->pop()->GetInt();
+ int bottom = stack->pop()->GetInt();
if (right < left) CBUtils::Swap(&left, &right);
if (bottom < top) CBUtils::Swap(&top, &bottom);
CBPlatform::SetRect(&_mouseLockRect, left, top, right, bottom);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1382,8 +1382,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // PlayVideo
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PlayVideo") == 0) {
- /* stack->CorrectParams(0);
- stack->PushBool(false);
+ /* stack->correctParams(0);
+ stack->pushBool(false);
return S_OK;
// TODO: ADDVIDEO
@@ -1391,19 +1391,19 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS Game->LOG(0, "Warning: Game.PlayVideo() is now deprecated. Use Game.PlayTheora() instead.");
- stack->CorrectParams(6);
- const char *filename = stack->Pop()->GetString();
+ stack->correctParams(6);
+ const char *filename = stack->pop()->GetString();
warning("PlayVideo: %s - not implemented yet", filename);
- CScValue *valType = stack->Pop();
+ CScValue *valType = stack->pop();
int Type;
if (valType->IsNULL()) Type = (int)VID_PLAY_STRETCH;
else Type = valType->GetInt();
- int X = stack->Pop()->GetInt();
- int Y = stack->Pop()->GetInt();
- bool FreezeMusic = stack->Pop()->GetBool(true);
+ int X = stack->pop()->GetInt();
+ int Y = stack->pop()->GetInt();
+ bool FreezeMusic = stack->pop()->GetBool(true);
- CScValue *valSub = stack->Pop();
+ CScValue *valSub = stack->pop();
const char *SubtitleFile = valSub->IsNULL() ? NULL : valSub->GetString();
if (Type < (int)VID_PLAY_POS || Type > (int)VID_PLAY_CENTER)
@@ -1411,10 +1411,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS if (SUCCEEDED(Game->_videoPlayer->initialize(filename, SubtitleFile))) {
if (SUCCEEDED(Game->_videoPlayer->play((TVideoPlayback)Type, X, Y, FreezeMusic))) {
- stack->PushBool(true);
+ stack->pushBool(true);
script->Sleep(0);
- } else stack->PushBool(false);
- } else stack->PushBool(false);
+ } else stack->pushBool(false);
+ } else stack->pushBool(false);
return S_OK;
}
@@ -1423,26 +1423,26 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // PlayTheora
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PlayTheora") == 0) {
- /* stack->CorrectParams(0);
- stack->PushBool(false);
+ /* stack->correctParams(0);
+ stack->pushBool(false);
return S_OK;*/
// TODO: ADDVIDEO
- stack->CorrectParams(7);
- const char *filename = stack->Pop()->GetString();
- CScValue *valType = stack->Pop();
+ stack->correctParams(7);
+ const char *filename = stack->pop()->GetString();
+ CScValue *valType = stack->pop();
int Type;
if (valType->IsNULL())
Type = (int)VID_PLAY_STRETCH;
else Type = valType->GetInt();
- int X = stack->Pop()->GetInt();
- int Y = stack->Pop()->GetInt();
- bool FreezeMusic = stack->Pop()->GetBool(true);
- bool DropFrames = stack->Pop()->GetBool(true);
+ int X = stack->pop()->GetInt();
+ int Y = stack->pop()->GetInt();
+ bool FreezeMusic = stack->pop()->GetBool(true);
+ bool DropFrames = stack->pop()->GetBool(true);
- CScValue *valSub = stack->Pop();
+ CScValue *valSub = stack->pop();
const char *SubtitleFile = valSub->IsNULL() ? NULL : valSub->GetString();
if (Type < (int)VID_PLAY_POS || Type > (int)VID_PLAY_CENTER) Type = (int)VID_PLAY_STRETCH;
@@ -1452,11 +1452,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS if (_theoraPlayer && SUCCEEDED(_theoraPlayer->initialize(filename, SubtitleFile))) {
_theoraPlayer->_dontDropFrames = !DropFrames;
if (SUCCEEDED(_theoraPlayer->play((TVideoPlayback)Type, X, Y, true, FreezeMusic))) {
- stack->PushBool(true);
+ stack->pushBool(true);
script->Sleep(0);
- } else stack->PushBool(false);
+ } else stack->pushBool(false);
} else {
- stack->PushBool(false);
+ stack->pushBool(false);
delete _theoraPlayer;
_theoraPlayer = NULL;
}
@@ -1468,8 +1468,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // QuitGame
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "QuitGame") == 0) {
- stack->CorrectParams(0);
- stack->PushNULL();
+ stack->correctParams(0);
+ stack->pushNULL();
_quitting = true;
return S_OK;
}
@@ -1478,11 +1478,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // RegWriteNumber
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RegWriteNumber") == 0) {
- stack->CorrectParams(2);
- const char *Key = stack->Pop()->GetString();
- int Val = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ const char *Key = stack->pop()->GetString();
+ int Val = stack->pop()->GetInt();
_registry->WriteInt("PrivateSettings", Key, Val);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1490,10 +1490,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // RegReadNumber
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RegReadNumber") == 0) {
- stack->CorrectParams(2);
- const char *Key = stack->Pop()->GetString();
- int InitVal = stack->Pop()->GetInt();
- stack->PushInt(_registry->ReadInt("PrivateSettings", Key, InitVal));
+ stack->correctParams(2);
+ const char *Key = stack->pop()->GetString();
+ int InitVal = stack->pop()->GetInt();
+ stack->pushInt(_registry->ReadInt("PrivateSettings", Key, InitVal));
return S_OK;
}
@@ -1501,11 +1501,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // RegWriteString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RegWriteString") == 0) {
- stack->CorrectParams(2);
- const char *Key = stack->Pop()->GetString();
- const char *Val = stack->Pop()->GetString();
+ stack->correctParams(2);
+ const char *Key = stack->pop()->GetString();
+ const char *Val = stack->pop()->GetString();
_registry->WriteString("PrivateSettings", Key, Val);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1513,11 +1513,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // RegReadString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RegReadString") == 0) {
- stack->CorrectParams(2);
- const char *Key = stack->Pop()->GetString();
- const char *InitVal = stack->Pop()->GetString();
+ stack->correctParams(2);
+ const char *Key = stack->pop()->GetString();
+ const char *InitVal = stack->pop()->GetString();
AnsiString val = _registry->ReadString("PrivateSettings", Key, InitVal);
- stack->PushString(val.c_str());
+ stack->pushString(val.c_str());
return S_OK;
}
@@ -1525,17 +1525,17 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SaveGame
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SaveGame") == 0) {
- stack->CorrectParams(3);
- int Slot = stack->Pop()->GetInt();
- const char *xdesc = stack->Pop()->GetString();
- bool quick = stack->Pop()->GetBool(false);
+ stack->correctParams(3);
+ int Slot = stack->pop()->GetInt();
+ const char *xdesc = stack->pop()->GetString();
+ bool quick = stack->pop()->GetBool(false);
char *Desc = new char[strlen(xdesc) + 1];
strcpy(Desc, xdesc);
- stack->PushBool(true);
+ stack->pushBool(true);
if (FAILED(SaveGame(Slot, Desc, quick))) {
- stack->Pop();
- stack->PushBool(false);
+ stack->pop();
+ stack->pushBool(false);
}
delete [] Desc;
return S_OK;
@@ -1545,10 +1545,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // LoadGame
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LoadGame") == 0) {
- stack->CorrectParams(1);
- _scheduledLoadSlot = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ _scheduledLoadSlot = stack->pop()->GetInt();
_loading = true;
- stack->PushBool(false);
+ stack->pushBool(false);
script->Sleep(0);
return S_OK;
}
@@ -1557,9 +1557,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // IsSaveSlotUsed
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IsSaveSlotUsed") == 0) {
- stack->CorrectParams(1);
- int Slot = stack->Pop()->GetInt();
- stack->PushBool(IsSaveSlotUsed(Slot));
+ stack->correctParams(1);
+ int Slot = stack->pop()->GetInt();
+ stack->pushBool(IsSaveSlotUsed(Slot));
return S_OK;
}
@@ -1567,12 +1567,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetSaveSlotDescription
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSaveSlotDescription") == 0) {
- stack->CorrectParams(1);
- int Slot = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int Slot = stack->pop()->GetInt();
char Desc[512];
Desc[0] = '\0';
GetSaveSlotDescription(Slot, Desc);
- stack->PushString(Desc);
+ stack->pushString(Desc);
return S_OK;
}
@@ -1580,10 +1580,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // EmptySaveSlot
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "EmptySaveSlot") == 0) {
- stack->CorrectParams(1);
- int Slot = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int Slot = stack->pop()->GetInt();
EmptySaveSlot(Slot);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1591,9 +1591,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetGlobalSFXVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetGlobalSFXVolume") == 0) {
- stack->CorrectParams(1);
- Game->_soundMgr->setVolumePercent(SOUND_SFX, (byte)stack->Pop()->GetInt());
- stack->PushNULL();
+ stack->correctParams(1);
+ Game->_soundMgr->setVolumePercent(SOUND_SFX, (byte)stack->pop()->GetInt());
+ stack->pushNULL();
return S_OK;
}
@@ -1601,9 +1601,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetGlobalSpeechVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetGlobalSpeechVolume") == 0) {
- stack->CorrectParams(1);
- Game->_soundMgr->setVolumePercent(SOUND_SPEECH, (byte)stack->Pop()->GetInt());
- stack->PushNULL();
+ stack->correctParams(1);
+ Game->_soundMgr->setVolumePercent(SOUND_SPEECH, (byte)stack->pop()->GetInt());
+ stack->pushNULL();
return S_OK;
}
@@ -1611,9 +1611,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetGlobalMusicVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetGlobalMusicVolume") == 0) {
- stack->CorrectParams(1);
- Game->_soundMgr->setVolumePercent(SOUND_MUSIC, (byte)stack->Pop()->GetInt());
- stack->PushNULL();
+ stack->correctParams(1);
+ Game->_soundMgr->setVolumePercent(SOUND_MUSIC, (byte)stack->pop()->GetInt());
+ stack->pushNULL();
return S_OK;
}
@@ -1621,9 +1621,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetGlobalMasterVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetGlobalMasterVolume") == 0) {
- stack->CorrectParams(1);
- Game->_soundMgr->setMasterVolumePercent((byte)stack->Pop()->GetInt());
- stack->PushNULL();
+ stack->correctParams(1);
+ Game->_soundMgr->setMasterVolumePercent((byte)stack->pop()->GetInt());
+ stack->pushNULL();
return S_OK;
}
@@ -1631,8 +1631,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetGlobalSFXVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetGlobalSFXVolume") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_soundMgr->getVolumePercent(SOUND_SFX));
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getVolumePercent(SOUND_SFX));
return S_OK;
}
@@ -1640,8 +1640,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetGlobalSpeechVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetGlobalSpeechVolume") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_soundMgr->getVolumePercent(SOUND_SPEECH));
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getVolumePercent(SOUND_SPEECH));
return S_OK;
}
@@ -1649,8 +1649,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetGlobalMusicVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetGlobalMusicVolume") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_soundMgr->getVolumePercent(SOUND_MUSIC));
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getVolumePercent(SOUND_MUSIC));
return S_OK;
}
@@ -1658,8 +1658,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetGlobalMasterVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetGlobalMasterVolume") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_soundMgr->getMasterVolumePercent());
+ stack->correctParams(0);
+ stack->pushInt(_soundMgr->getMasterVolumePercent());
return S_OK;
}
@@ -1667,9 +1667,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetActiveCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetActiveCursor") == 0) {
- stack->CorrectParams(1);
- if (SUCCEEDED(setActiveCursor(stack->Pop()->GetString()))) stack->PushBool(true);
- else stack->PushBool(false);
+ stack->correctParams(1);
+ if (SUCCEEDED(setActiveCursor(stack->pop()->GetString()))) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -1678,9 +1678,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetActiveCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetActiveCursor") == 0) {
- stack->CorrectParams(0);
- if (!_activeCursor || !_activeCursor->_filename) stack->PushNULL();
- else stack->PushString(_activeCursor->_filename);
+ stack->correctParams(0);
+ if (!_activeCursor || !_activeCursor->_filename) stack->pushNULL();
+ else stack->pushString(_activeCursor->_filename);
return S_OK;
}
@@ -1689,9 +1689,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetActiveCursorObject
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetActiveCursorObject") == 0) {
- stack->CorrectParams(0);
- if (!_activeCursor) stack->PushNULL();
- else stack->PushNative(_activeCursor, true);
+ stack->correctParams(0);
+ if (!_activeCursor) stack->pushNULL();
+ else stack->pushNative(_activeCursor, true);
return S_OK;
}
@@ -1700,10 +1700,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // RemoveActiveCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RemoveActiveCursor") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
delete _activeCursor;
_activeCursor = NULL;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1712,10 +1712,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // HasActiveCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "HasActiveCursor") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (_activeCursor) stack->PushBool(true);
- else stack->PushBool(false);
+ if (_activeCursor) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -1724,14 +1724,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // FileExists
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FileExists") == 0) {
- stack->CorrectParams(1);
- const char *filename = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *filename = stack->pop()->GetString();
Common::SeekableReadStream *File = _fileManager->openFile(filename, false);
- if (!File) stack->PushBool(false);
+ if (!File) stack->pushBool(false);
else {
_fileManager->closeFile(File);
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -1740,19 +1740,19 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // FadeOut / FadeOutAsync / SystemFadeOut / SystemFadeOutAsync
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FadeOut") == 0 || strcmp(name, "FadeOutAsync") == 0 || strcmp(name, "SystemFadeOut") == 0 || strcmp(name, "SystemFadeOutAsync") == 0) {
- stack->CorrectParams(5);
- uint32 Duration = stack->Pop()->GetInt(500);
- byte Red = stack->Pop()->GetInt(0);
- byte Green = stack->Pop()->GetInt(0);
- byte Blue = stack->Pop()->GetInt(0);
- byte Alpha = stack->Pop()->GetInt(0xFF);
+ stack->correctParams(5);
+ uint32 Duration = stack->pop()->GetInt(500);
+ byte Red = stack->pop()->GetInt(0);
+ byte Green = stack->pop()->GetInt(0);
+ byte Blue = stack->pop()->GetInt(0);
+ byte Alpha = stack->pop()->GetInt(0xFF);
bool System = (strcmp(name, "SystemFadeOut") == 0 || strcmp(name, "SystemFadeOutAsync") == 0);
_fader->fadeOut(DRGBA(Red, Green, Blue, Alpha), Duration, System);
if (strcmp(name, "FadeOutAsync") != 0 && strcmp(name, "SystemFadeOutAsync") != 0) script->WaitFor(_fader);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1760,19 +1760,19 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // FadeIn / FadeInAsync / SystemFadeIn / SystemFadeInAsync
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FadeIn") == 0 || strcmp(name, "FadeInAsync") == 0 || strcmp(name, "SystemFadeIn") == 0 || strcmp(name, "SystemFadeInAsync") == 0) {
- stack->CorrectParams(5);
- uint32 Duration = stack->Pop()->GetInt(500);
- byte Red = stack->Pop()->GetInt(0);
- byte Green = stack->Pop()->GetInt(0);
- byte Blue = stack->Pop()->GetInt(0);
- byte Alpha = stack->Pop()->GetInt(0xFF);
+ stack->correctParams(5);
+ uint32 Duration = stack->pop()->GetInt(500);
+ byte Red = stack->pop()->GetInt(0);
+ byte Green = stack->pop()->GetInt(0);
+ byte Blue = stack->pop()->GetInt(0);
+ byte Alpha = stack->pop()->GetInt(0xFF);
bool System = (strcmp(name, "SystemFadeIn") == 0 || strcmp(name, "SystemFadeInAsync") == 0);
_fader->fadeIn(DRGBA(Red, Green, Blue, Alpha), Duration, System);
if (strcmp(name, "FadeInAsync") != 0 && strcmp(name, "SystemFadeInAsync") != 0) script->WaitFor(_fader);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1780,8 +1780,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetFadeColor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFadeColor") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_fader->getCurrentColor());
+ stack->correctParams(0);
+ stack->pushInt(_fader->getCurrentColor());
return S_OK;
}
@@ -1789,10 +1789,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // Screenshot
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Screenshot") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
char filename[MAX_PATH];
- CScValue *Val = stack->Pop();
+ CScValue *Val = stack->pop();
warning("BGame::ScCallMethod - Screenshot not reimplemented"); //TODO
int FileNum = 0;
@@ -1811,7 +1811,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS delete Image;
} else ret = false;
- stack->PushBool(ret);
+ stack->pushBool(ret);
return S_OK;
}
@@ -1819,10 +1819,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // ScreenshotEx
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ScreenshotEx") == 0) {
- stack->CorrectParams(3);
- const char *filename = stack->Pop()->GetString();
- int SizeX = stack->Pop()->GetInt(_renderer->_width);
- int SizeY = stack->Pop()->GetInt(_renderer->_height);
+ stack->correctParams(3);
+ const char *filename = stack->pop()->GetString();
+ int SizeX = stack->pop()->GetInt(_renderer->_width);
+ int SizeY = stack->pop()->GetInt(_renderer->_height);
bool ret = false;
CBImage *Image = Game->_renderer->takeScreenshot();
@@ -1832,7 +1832,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS delete Image;
} else ret = false;
- stack->PushBool(ret);
+ stack->pushBool(ret);
return S_OK;
}
@@ -1840,14 +1840,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // CreateWindow
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CreateWindow") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
CUIWindow *Win = new CUIWindow(Game);
_windows.Add(Win);
RegisterObject(Win);
if (!Val->IsNULL()) Win->setName(Val->GetString());
- stack->PushNative(Win, true);
+ stack->pushNative(Win, true);
return S_OK;
}
@@ -1855,16 +1855,16 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // DeleteWindow
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DeleteWindow") == 0) {
- stack->CorrectParams(1);
- CBObject *Obj = (CBObject *)stack->Pop()->GetNative();
+ stack->correctParams(1);
+ CBObject *Obj = (CBObject *)stack->pop()->GetNative();
for (int i = 0; i < _windows.GetSize(); i++) {
if (_windows[i] == Obj) {
UnregisterObject(_windows[i]);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
}
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
@@ -1872,8 +1872,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // OpenDocument
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "OpenDocument") == 0) {
- stack->CorrectParams(0);
- stack->PushNULL();
+ stack->correctParams(0);
+ stack->pushNULL();
return S_OK;
}
@@ -1881,9 +1881,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // DEBUG_DumpClassRegistry
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DEBUG_DumpClassRegistry") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
DEBUG_DumpClassRegistry();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1891,10 +1891,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetLoadingScreen
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetLoadingScreen") == 0) {
- stack->CorrectParams(3);
- CScValue *Val = stack->Pop();
- _loadImageX = stack->Pop()->GetInt();
- _loadImageY = stack->Pop()->GetInt();
+ stack->correctParams(3);
+ CScValue *Val = stack->pop();
+ _loadImageX = stack->pop()->GetInt();
+ _loadImageY = stack->pop()->GetInt();
if (Val->IsNULL()) {
delete[] _loadImageName;
@@ -1902,7 +1902,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS } else {
CBUtils::SetString(&_loadImageName, Val->GetString());
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1910,10 +1910,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetSavingScreen
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetSavingScreen") == 0) {
- stack->CorrectParams(3);
- CScValue *Val = stack->Pop();
- _saveImageX = stack->Pop()->GetInt();
- _saveImageY = stack->Pop()->GetInt();
+ stack->correctParams(3);
+ CScValue *Val = stack->pop();
+ _saveImageX = stack->pop()->GetInt();
+ _saveImageY = stack->pop()->GetInt();
if (Val->IsNULL()) {
delete[] _saveImageName;
@@ -1921,7 +1921,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS } else {
CBUtils::SetString(&_saveImageName, Val->GetString());
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1929,9 +1929,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // SetWaitCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetWaitCursor") == 0) {
- stack->CorrectParams(1);
- if (SUCCEEDED(SetWaitCursor(stack->Pop()->GetString()))) stack->PushBool(true);
- else stack->PushBool(false);
+ stack->correctParams(1);
+ if (SUCCEEDED(SetWaitCursor(stack->pop()->GetString()))) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -1940,11 +1940,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // RemoveWaitCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RemoveWaitCursor") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
delete _cursorNoninteractive;
_cursorNoninteractive = NULL;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -1953,9 +1953,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetWaitCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetWaitCursor") == 0) {
- stack->CorrectParams(0);
- if (!_cursorNoninteractive || !_cursorNoninteractive->_filename) stack->PushNULL();
- else stack->PushString(_cursorNoninteractive->_filename);
+ stack->correctParams(0);
+ if (!_cursorNoninteractive || !_cursorNoninteractive->_filename) stack->pushNULL();
+ else stack->pushString(_cursorNoninteractive->_filename);
return S_OK;
}
@@ -1964,9 +1964,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetWaitCursorObject
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetWaitCursorObject") == 0) {
- stack->CorrectParams(0);
- if (!_cursorNoninteractive) stack->PushNULL();
- else stack->PushNative(_cursorNoninteractive, true);
+ stack->correctParams(0);
+ if (!_cursorNoninteractive) stack->pushNULL();
+ else stack->pushNative(_cursorNoninteractive, true);
return S_OK;
}
@@ -1975,8 +1975,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // ClearScriptCache
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ClearScriptCache") == 0) {
- stack->CorrectParams(0);
- stack->PushBool(SUCCEEDED(_scEngine->EmptyScriptCache()));
+ stack->correctParams(0);
+ stack->pushBool(SUCCEEDED(_scEngine->EmptyScriptCache()));
return S_OK;
}
@@ -1984,12 +1984,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // DisplayLoadingIcon
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DisplayLoadingIcon") == 0) {
- stack->CorrectParams(4);
+ stack->correctParams(4);
- const char *filename = stack->Pop()->GetString();
- _loadingIconX = stack->Pop()->GetInt();
- _loadingIconY = stack->Pop()->GetInt();
- _loadingIconPersistent = stack->Pop()->GetBool();
+ const char *filename = stack->pop()->GetString();
+ _loadingIconX = stack->pop()->GetInt();
+ _loadingIconY = stack->pop()->GetInt();
+ _loadingIconPersistent = stack->pop()->GetBool();
delete _loadingIcon;
_loadingIcon = new CBSprite(this);
@@ -2001,7 +2001,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS Game->_renderer->flip();
Game->_renderer->initLoop();
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2010,10 +2010,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // HideLoadingIcon
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "HideLoadingIcon") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
delete _loadingIcon;
_loadingIcon = NULL;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2021,12 +2021,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // DumpTextureStats
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DumpTextureStats") == 0) {
- stack->CorrectParams(1);
- const char *filename = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *filename = stack->pop()->GetString();
_renderer->dumpData(filename);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2034,13 +2034,13 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // AccOutputText
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AccOutputText") == 0) {
- stack->CorrectParams(2);
+ stack->correctParams(2);
/* const char *Str = */
- stack->Pop()->GetString();
+ stack->pop()->GetString();
/* int Type = */
- stack->Pop()->GetInt();
+ stack->pop()->GetInt();
// do nothing
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2049,14 +2049,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // StoreSaveThumbnail
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "StoreSaveThumbnail") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
delete _cachedThumbnail;
_cachedThumbnail = new CBSaveThumbHelper(this);
if (FAILED(_cachedThumbnail->StoreThumbnail())) {
delete _cachedThumbnail;
_cachedThumbnail = NULL;
- stack->PushBool(false);
- } else stack->PushBool(true);
+ stack->pushBool(false);
+ } else stack->pushBool(true);
return S_OK;
}
@@ -2065,10 +2065,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // DeleteSaveThumbnail
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DeleteSaveThumbnail") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
delete _cachedThumbnail;
_cachedThumbnail = NULL;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2077,9 +2077,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // GetFileChecksum
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFileChecksum") == 0) {
- stack->CorrectParams(2);
- const char *filename = stack->Pop()->GetString();
- bool AsHex = stack->Pop()->GetBool(false);
+ stack->correctParams(2);
+ const char *filename = stack->pop()->GetString();
+ bool AsHex = stack->pop()->GetBool(false);
Common::SeekableReadStream *File = _fileManager->openFile(filename, false);
if (File) {
@@ -2100,13 +2100,13 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS if (AsHex) {
char Hex[100];
sprintf(Hex, "%x", checksum);
- stack->PushString(Hex);
+ stack->pushString(Hex);
} else
- stack->PushInt(checksum);
+ stack->pushInt(checksum);
_fileManager->closeFile(File);
File = NULL;
- } else stack->PushNULL();
+ } else stack->pushNULL();
return S_OK;
}
@@ -2115,9 +2115,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // EnableScriptProfiling
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "EnableScriptProfiling") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
_scEngine->EnableProfiling();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2126,9 +2126,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // DisableScriptProfiling
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DisableScriptProfiling") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
_scEngine->DisableProfiling();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2137,11 +2137,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // ShowStatusLine
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ShowStatusLine") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
#ifdef __IPHONEOS__
IOS_ShowStatusLine(TRUE);
#endif
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2150,11 +2150,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS // HideStatusLine
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "HideStatusLine") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
#ifdef __IPHONEOS__
IOS_ShowStatusLine(FALSE);
#endif
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -2931,240 +2931,240 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS // LOG
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "LOG") == 0) {
- stack->CorrectParams(1);
- Game->LOG(0, "sc: %s", stack->Pop()->GetString());
- stack->PushNULL();
+ stack->correctParams(1);
+ Game->LOG(0, "sc: %s", stack->pop()->GetString());
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// String
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "String") == 0) {
- this_obj = thisStack->GetTop();
+ this_obj = thisStack->getTop();
this_obj->SetNative(makeSXString(Game, stack));
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// MemBuffer
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MemBuffer") == 0) {
- this_obj = thisStack->GetTop();
+ this_obj = thisStack->getTop();
this_obj->SetNative(makeSXMemBuffer(Game, stack));
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// File
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "File") == 0) {
- this_obj = thisStack->GetTop();
+ this_obj = thisStack->getTop();
this_obj->SetNative(makeSXFile(Game, stack));
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// Date
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Date") == 0) {
- this_obj = thisStack->GetTop();
+ this_obj = thisStack->getTop();
this_obj->SetNative(makeSXDate(Game, stack));
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// Array
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Array") == 0) {
- this_obj = thisStack->GetTop();
+ this_obj = thisStack->getTop();
this_obj->SetNative(makeSXArray(Game, stack));
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// Object
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Object") == 0) {
- this_obj = thisStack->GetTop();
+ this_obj = thisStack->getTop();
this_obj->SetNative(makeSXObject(Game, stack));
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// Sleep
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Sleep") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- script->Sleep((uint32)stack->Pop()->GetInt());
- stack->PushNULL();
+ script->Sleep((uint32)stack->pop()->GetInt());
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// WaitFor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WaitFor") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- CBScriptable *obj = stack->Pop()->GetNative();
+ CBScriptable *obj = stack->pop()->GetNative();
if (ValidObject((CBObject *)obj)) script->WaitForExclusive((CBObject *)obj);
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// Random
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Random") == 0) {
- stack->CorrectParams(2);
+ stack->correctParams(2);
- int from = stack->Pop()->GetInt();
- int to = stack->Pop()->GetInt();
+ int from = stack->pop()->GetInt();
+ int to = stack->pop()->GetInt();
- stack->PushInt(CBUtils::RandomInt(from, to));
+ stack->pushInt(CBUtils::RandomInt(from, to));
}
//////////////////////////////////////////////////////////////////////////
// SetScriptTimeSlice
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetScriptTimeSlice") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- script->_timeSlice = (uint32)stack->Pop()->GetInt();
- stack->PushNULL();
+ script->_timeSlice = (uint32)stack->pop()->GetInt();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// MakeRGBA / MakeRGB / RGB
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MakeRGBA") == 0 || strcmp(name, "MakeRGB") == 0 || strcmp(name, "RGB") == 0) {
- stack->CorrectParams(4);
- int r = stack->Pop()->GetInt();
- int g = stack->Pop()->GetInt();
- int b = stack->Pop()->GetInt();
+ stack->correctParams(4);
+ int r = stack->pop()->GetInt();
+ int g = stack->pop()->GetInt();
+ int b = stack->pop()->GetInt();
int a;
- CScValue *val = stack->Pop();
+ CScValue *val = stack->pop();
if (val->IsNULL()) a = 255;
else a = val->GetInt();
- stack->PushInt(DRGBA(r, g, b, a));
+ stack->pushInt(DRGBA(r, g, b, a));
}
//////////////////////////////////////////////////////////////////////////
// MakeHSL
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MakeHSL") == 0) {
- stack->CorrectParams(3);
- int h = stack->Pop()->GetInt();
- int s = stack->Pop()->GetInt();
- int l = stack->Pop()->GetInt();
+ stack->correctParams(3);
+ int h = stack->pop()->GetInt();
+ int s = stack->pop()->GetInt();
+ int l = stack->pop()->GetInt();
- stack->PushInt(CBUtils::HSLtoRGB(h, s, l));
+ stack->pushInt(CBUtils::HSLtoRGB(h, s, l));
}
//////////////////////////////////////////////////////////////////////////
// GetRValue
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetRValue") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- uint32 rgba = (uint32)stack->Pop()->GetInt();
- stack->PushInt(D3DCOLGetR(rgba));
+ uint32 rgba = (uint32)stack->pop()->GetInt();
+ stack->pushInt(D3DCOLGetR(rgba));
}
//////////////////////////////////////////////////////////////////////////
// GetGValue
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetGValue") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- uint32 rgba = (uint32)stack->Pop()->GetInt();
- stack->PushInt(D3DCOLGetG(rgba));
+ uint32 rgba = (uint32)stack->pop()->GetInt();
+ stack->pushInt(D3DCOLGetG(rgba));
}
//////////////////////////////////////////////////////////////////////////
// GetBValue
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetBValue") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- uint32 rgba = (uint32)stack->Pop()->GetInt();
- stack->PushInt(D3DCOLGetB(rgba));
+ uint32 rgba = (uint32)stack->pop()->GetInt();
+ stack->pushInt(D3DCOLGetB(rgba));
}
//////////////////////////////////////////////////////////////////////////
// GetAValue
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetAValue") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- uint32 rgba = (uint32)stack->Pop()->GetInt();
- stack->PushInt(D3DCOLGetA(rgba));
+ uint32 rgba = (uint32)stack->pop()->GetInt();
+ stack->pushInt(D3DCOLGetA(rgba));
}
//////////////////////////////////////////////////////////////////////////
// GetHValue
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetHValue") == 0) {
- stack->CorrectParams(1);
- uint32 rgb = (uint32)stack->Pop()->GetInt();
+ stack->correctParams(1);
+ uint32 rgb = (uint32)stack->pop()->GetInt();
byte H, S, L;
CBUtils::RGBtoHSL(rgb, &H, &S, &L);
- stack->PushInt(H);
+ stack->pushInt(H);
}
//////////////////////////////////////////////////////////////////////////
// GetSValue
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSValue") == 0) {
- stack->CorrectParams(1);
- uint32 rgb = (uint32)stack->Pop()->GetInt();
+ stack->correctParams(1);
+ uint32 rgb = (uint32)stack->pop()->GetInt();
byte H, S, L;
CBUtils::RGBtoHSL(rgb, &H, &S, &L);
- stack->PushInt(S);
+ stack->pushInt(S);
}
//////////////////////////////////////////////////////////////////////////
// GetLValue
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetLValue") == 0) {
- stack->CorrectParams(1);
- uint32 rgb = (uint32)stack->Pop()->GetInt();
+ stack->correctParams(1);
+ uint32 rgb = (uint32)stack->pop()->GetInt();
byte H, S, L;
CBUtils::RGBtoHSL(rgb, &H, &S, &L);
- stack->PushInt(L);
+ stack->pushInt(L);
}
//////////////////////////////////////////////////////////////////////////
// Debug
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Debug") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (Game->GetDebugMgr()->_enabled) {
Game->GetDebugMgr()->OnScriptHitBreakpoint(script);
script->Sleep(0);
}
- stack->PushNULL();
+ stack->pushNULL();
}
//////////////////////////////////////////////////////////////////////////
// ToString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ToString") == 0) {
- stack->CorrectParams(1);
- const char *Str = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *Str = stack->pop()->GetString();
char *Str2 = new char[strlen(Str) + 1];
strcpy(Str2, Str);
- stack->PushString(Str2);
+ stack->pushString(Str2);
delete [] Str2;
}
@@ -3172,35 +3172,35 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS // ToInt
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ToInt") == 0) {
- stack->CorrectParams(1);
- int Val = stack->Pop()->GetInt();
- stack->PushInt(Val);
+ stack->correctParams(1);
+ int Val = stack->pop()->GetInt();
+ stack->pushInt(Val);
}
//////////////////////////////////////////////////////////////////////////
// ToFloat
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ToFloat") == 0) {
- stack->CorrectParams(1);
- double Val = stack->Pop()->GetFloat();
- stack->PushFloat(Val);
+ stack->correctParams(1);
+ double Val = stack->pop()->GetFloat();
+ stack->pushFloat(Val);
}
//////////////////////////////////////////////////////////////////////////
// ToBool
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ToBool") == 0) {
- stack->CorrectParams(1);
- bool Val = stack->Pop()->GetBool();
- stack->PushBool(Val);
+ stack->correctParams(1);
+ bool Val = stack->pop()->GetBool();
+ stack->pushBool(Val);
}
//////////////////////////////////////////////////////////////////////////
// failure
else {
script->RuntimeError("Call to undefined function '%s'. Ignored.", name);
- stack->CorrectParams(0);
- stack->PushNULL();
+ stack->correctParams(0);
+ stack->pushNULL();
}
return S_OK;
diff --git a/engines/wintermute/Base/BKeyboardState.cpp b/engines/wintermute/Base/BKeyboardState.cpp index ce5f5cf8ce..a3f742fd69 100644 --- a/engines/wintermute/Base/BKeyboardState.cpp +++ b/engines/wintermute/Base/BKeyboardState.cpp @@ -78,8 +78,8 @@ HRESULT CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScSta // IsKeyDown
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "IsKeyDown") == 0) {
- stack->CorrectParams(1);
- CScValue *val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *val = stack->pop();
int vKey;
if (val->_type == VAL_STRING && strlen(val->GetString()) > 0) {
@@ -94,7 +94,7 @@ HRESULT CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScSta // SDL_Scancode scanCode = SDL_GetScancodeFromKey(VKeyToKeyCode(vKey));
bool isDown = _keyStates[VKeyToKeyCode(vKey)];
- stack->PushBool(isDown);
+ stack->pushBool(isDown);
return S_OK;
}
diff --git a/engines/wintermute/Base/BObject.cpp b/engines/wintermute/Base/BObject.cpp index edab7aa0d2..c84b58eecd 100644 --- a/engines/wintermute/Base/BObject.cpp +++ b/engines/wintermute/Base/BObject.cpp @@ -171,11 +171,11 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SkipTo
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SkipTo") == 0) {
- stack->CorrectParams(2);
- _posX = stack->Pop()->GetInt();
- _posY = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ _posX = stack->pop()->GetInt();
+ _posY = stack->pop()->GetInt();
afterMove();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -184,8 +184,8 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // Caption
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Caption") == 0) {
- stack->CorrectParams(1);
- stack->PushString(getCaption(stack->Pop()->GetInt()));
+ stack->correctParams(1);
+ stack->pushString(getCaption(stack->pop()->GetInt()));
return S_OK;
}
@@ -194,9 +194,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SetCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetCursor") == 0) {
- stack->CorrectParams(1);
- if (SUCCEEDED(setCursor(stack->Pop()->GetString()))) stack->PushBool(true);
- else stack->PushBool(false);
+ stack->correctParams(1);
+ if (SUCCEEDED(setCursor(stack->pop()->GetString()))) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -205,7 +205,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // RemoveCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RemoveCursor") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (!_sharedCursors) {
delete _cursor;
_cursor = NULL;
@@ -213,7 +213,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi _cursor = NULL;
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -222,9 +222,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetCursor") == 0) {
- stack->CorrectParams(0);
- if (!_cursor || !_cursor->_filename) stack->PushNULL();
- else stack->PushString(_cursor->_filename);
+ stack->correctParams(0);
+ if (!_cursor || !_cursor->_filename) stack->pushNULL();
+ else stack->pushString(_cursor->_filename);
return S_OK;
}
@@ -233,9 +233,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetCursorObject
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetCursorObject") == 0) {
- stack->CorrectParams(0);
- if (!_cursor) stack->PushNULL();
- else stack->PushNative(_cursor, true);
+ stack->correctParams(0);
+ if (!_cursor) stack->pushNULL();
+ else stack->pushNative(_cursor, true);
return S_OK;
}
@@ -244,10 +244,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // HasCursor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "HasCursor") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (_cursor) stack->PushBool(true);
- else stack->PushBool(false);
+ if (_cursor) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -256,9 +256,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SetCaption
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetCaption") == 0) {
- stack->CorrectParams(2);
- setCaption(stack->Pop()->GetString(), stack->Pop()->GetInt());
- stack->PushNULL();
+ stack->correctParams(2);
+ setCaption(stack->pop()->GetString(), stack->pop()->GetInt());
+ stack->pushNULL();
return S_OK;
}
@@ -267,12 +267,12 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // LoadSound
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LoadSound") == 0) {
- stack->CorrectParams(1);
- const char *Filename = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *Filename = stack->pop()->GetString();
if (SUCCEEDED(playSFX(Filename, false, false)))
- stack->PushBool(true);
+ stack->pushBool(true);
else
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
@@ -281,15 +281,15 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // PlaySound
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PlaySound") == 0) {
- stack->CorrectParams(3);
+ stack->correctParams(3);
const char *Filename;
bool Looping;
uint32 LoopStart;
- CScValue *val1 = stack->Pop();
- CScValue *val2 = stack->Pop();
- CScValue *val3 = stack->Pop();
+ CScValue *val1 = stack->pop();
+ CScValue *val2 = stack->pop();
+ CScValue *val3 = stack->pop();
if (val1->_type == VAL_BOOL) {
Filename = NULL;
@@ -302,8 +302,8 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi LoopStart = val3->GetInt();
}
- if (FAILED(playSFX(Filename, Looping, true, NULL, LoopStart))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(playSFX(Filename, Looping, true, NULL, LoopStart))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -311,13 +311,13 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // PlaySoundEvent
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PlaySoundEvent") == 0) {
- stack->CorrectParams(2);
+ stack->correctParams(2);
const char *Filename;
const char *EventName;
- CScValue *val1 = stack->Pop();
- CScValue *val2 = stack->Pop();
+ CScValue *val1 = stack->pop();
+ CScValue *val2 = stack->pop();
if (val2->IsNULL()) {
Filename = NULL;
@@ -327,8 +327,8 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi EventName = val2->GetString();
}
- if (FAILED(playSFX(Filename, false, true, EventName))) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(playSFX(Filename, false, true, EventName))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -336,10 +336,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // StopSound
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "StopSound") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (FAILED(stopSFX())) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(stopSFX())) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -347,10 +347,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // PauseSound
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PauseSound") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (FAILED(pauseSFX())) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(pauseSFX())) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -358,10 +358,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // ResumeSound
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ResumeSound") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (FAILED(resumeSFX())) stack->PushBool(false);
- else stack->PushBool(true);
+ if (FAILED(resumeSFX())) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -369,10 +369,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // IsSoundPlaying
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IsSoundPlaying") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (_sFX && _sFX->isPlaying()) stack->PushBool(true);
- else stack->PushBool(false);
+ if (_sFX && _sFX->isPlaying()) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -380,11 +380,11 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SetSoundPosition
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetSoundPosition") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- uint32 Time = stack->Pop()->GetInt();
- if (FAILED(setSFXTime(Time))) stack->PushBool(false);
- else stack->PushBool(true);
+ uint32 Time = stack->pop()->GetInt();
+ if (FAILED(setSFXTime(Time))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -392,10 +392,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetSoundPosition
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSoundPosition") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (!_sFX) stack->PushInt(0);
- else stack->PushInt(_sFX->getPositionTime());
+ if (!_sFX) stack->pushInt(0);
+ else stack->pushInt(_sFX->getPositionTime());
return S_OK;
}
@@ -403,11 +403,11 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SetSoundVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetSoundVolume") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
- int Volume = stack->Pop()->GetInt();
- if (FAILED(setSFXVolume(Volume))) stack->PushBool(false);
- else stack->PushBool(true);
+ int Volume = stack->pop()->GetInt();
+ if (FAILED(setSFXVolume(Volume))) stack->pushBool(false);
+ else stack->pushBool(true);
return S_OK;
}
@@ -415,10 +415,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetSoundVolume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSoundVolume") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (!_sFX) stack->PushInt(_sFXVolume);
- else stack->PushInt(_sFX->getVolume());
+ if (!_sFX) stack->pushInt(_sFXVolume);
+ else stack->pushInt(_sFX->getVolume());
return S_OK;
}
@@ -427,13 +427,13 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SoundFXNone
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SoundFXNone") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
_sFXType = SFX_NONE;
_sFXParam1 = 0;
_sFXParam2 = 0;
_sFXParam3 = 0;
_sFXParam4 = 0;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -442,13 +442,13 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SoundFXEcho
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SoundFXEcho") == 0) {
- stack->CorrectParams(4);
+ stack->correctParams(4);
_sFXType = SFX_ECHO;
- _sFXParam1 = (float)stack->Pop()->GetFloat(0); // Wet/Dry Mix [%] (0-100)
- _sFXParam2 = (float)stack->Pop()->GetFloat(0); // Feedback [%] (0-100)
- _sFXParam3 = (float)stack->Pop()->GetFloat(333.0f); // Left Delay [ms] (1-2000)
- _sFXParam4 = (float)stack->Pop()->GetFloat(333.0f); // Right Delay [ms] (1-2000)
- stack->PushNULL();
+ _sFXParam1 = (float)stack->pop()->GetFloat(0); // Wet/Dry Mix [%] (0-100)
+ _sFXParam2 = (float)stack->pop()->GetFloat(0); // Feedback [%] (0-100)
+ _sFXParam3 = (float)stack->pop()->GetFloat(333.0f); // Left Delay [ms] (1-2000)
+ _sFXParam4 = (float)stack->pop()->GetFloat(333.0f); // Right Delay [ms] (1-2000)
+ stack->pushNULL();
return S_OK;
}
@@ -457,13 +457,13 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SoundFXReverb
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SoundFXReverb") == 0) {
- stack->CorrectParams(4);
+ stack->correctParams(4);
_sFXType = SFX_REVERB;
- _sFXParam1 = (float)stack->Pop()->GetFloat(0); // In Gain [dB] (-96 - 0)
- _sFXParam2 = (float)stack->Pop()->GetFloat(0); // Reverb Mix [dB] (-96 - 0)
- _sFXParam3 = (float)stack->Pop()->GetFloat(1000.0f); // Reverb Time [ms] (0.001 - 3000)
- _sFXParam4 = (float)stack->Pop()->GetFloat(0.001f); // HighFreq RT Ratio (0.001 - 0.999)
- stack->PushNULL();
+ _sFXParam1 = (float)stack->pop()->GetFloat(0); // In Gain [dB] (-96 - 0)
+ _sFXParam2 = (float)stack->pop()->GetFloat(0); // Reverb Mix [dB] (-96 - 0)
+ _sFXParam3 = (float)stack->pop()->GetFloat(1000.0f); // Reverb Time [ms] (0.001 - 3000)
+ _sFXParam4 = (float)stack->pop()->GetFloat(0.001f); // HighFreq RT Ratio (0.001 - 0.999)
+ stack->pushNULL();
return S_OK;
}
diff --git a/engines/wintermute/Base/BRegion.cpp b/engines/wintermute/Base/BRegion.cpp index 0a3c9ce9f5..dd0f06334d 100644 --- a/engines/wintermute/Base/BRegion.cpp +++ b/engines/wintermute/Base/BRegion.cpp @@ -216,14 +216,14 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // AddPoint
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "AddPoint") == 0) {
- stack->CorrectParams(2);
- int X = stack->Pop()->GetInt();
- int Y = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int X = stack->pop()->GetInt();
+ int Y = stack->pop()->GetInt();
_points.Add(new CBPoint(X, Y));
CreateRegion();
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -232,17 +232,17 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // InsertPoint
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "InsertPoint") == 0) {
- stack->CorrectParams(3);
- int Index = stack->Pop()->GetInt();
- int X = stack->Pop()->GetInt();
- int Y = stack->Pop()->GetInt();
+ stack->correctParams(3);
+ int Index = stack->pop()->GetInt();
+ int X = stack->pop()->GetInt();
+ int Y = stack->pop()->GetInt();
if (Index >= 0 && Index < _points.GetSize()) {
_points.InsertAt(Index, new CBPoint(X, Y));
CreateRegion();
- stack->PushBool(true);
- } else stack->PushBool(false);
+ stack->pushBool(true);
+ } else stack->pushBool(false);
return S_OK;
}
@@ -251,18 +251,18 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // SetPoint
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetPoint") == 0) {
- stack->CorrectParams(3);
- int Index = stack->Pop()->GetInt();
- int X = stack->Pop()->GetInt();
- int Y = stack->Pop()->GetInt();
+ stack->correctParams(3);
+ int Index = stack->pop()->GetInt();
+ int X = stack->pop()->GetInt();
+ int Y = stack->pop()->GetInt();
if (Index >= 0 && Index < _points.GetSize()) {
_points[Index]->x = X;
_points[Index]->y = Y;
CreateRegion();
- stack->PushBool(true);
- } else stack->PushBool(false);
+ stack->pushBool(true);
+ } else stack->pushBool(false);
return S_OK;
}
@@ -271,8 +271,8 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // RemovePoint
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RemovePoint") == 0) {
- stack->CorrectParams(1);
- int Index = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int Index = stack->pop()->GetInt();
if (Index >= 0 && Index < _points.GetSize()) {
delete _points[Index];
@@ -281,8 +281,8 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi _points.RemoveAt(Index);
CreateRegion();
- stack->PushBool(true);
- } else stack->PushBool(false);
+ stack->pushBool(true);
+ } else stack->pushBool(false);
return S_OK;
}
@@ -291,16 +291,16 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetPoint
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetPoint") == 0) {
- stack->CorrectParams(1);
- int Index = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int Index = stack->pop()->GetInt();
if (Index >= 0 && Index < _points.GetSize()) {
- CScValue *Val = stack->GetPushValue();
+ CScValue *Val = stack->getPushValue();
if (Val) {
Val->SetProperty("X", _points[Index]->x);
Val->SetProperty("Y", _points[Index]->y);
}
- } else stack->PushNULL();
+ } else stack->pushNULL();
return S_OK;
}
diff --git a/engines/wintermute/Base/BScriptHolder.cpp b/engines/wintermute/Base/BScriptHolder.cpp index e68716cbab..4557c8d2b3 100644 --- a/engines/wintermute/Base/BScriptHolder.cpp +++ b/engines/wintermute/Base/BScriptHolder.cpp @@ -114,10 +114,10 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac // DEBUG_CrashMe
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "DEBUG_CrashMe") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
byte *p = 0;
*p = 10;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -126,13 +126,13 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac // ApplyEvent
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ApplyEvent") == 0) {
- stack->CorrectParams(1);
- CScValue *val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *val = stack->pop();
HRESULT ret;
ret = applyEvent(val->GetString());
- if (SUCCEEDED(ret)) stack->PushBool(true);
- else stack->PushBool(false);
+ if (SUCCEEDED(ret)) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -141,8 +141,8 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac // CanHandleEvent
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CanHandleEvent") == 0) {
- stack->CorrectParams(1);
- stack->PushBool(canHandleEvent(stack->Pop()->GetString()));
+ stack->correctParams(1);
+ stack->pushBool(canHandleEvent(stack->pop()->GetString()));
return S_OK;
}
@@ -151,8 +151,8 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac // CanHandleMethod
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CanHandleMethod") == 0) {
- stack->CorrectParams(1);
- stack->PushBool(canHandleMethod(stack->Pop()->GetString()));
+ stack->correctParams(1);
+ stack->pushBool(canHandleMethod(stack->pop()->GetString()));
return S_OK;
}
@@ -161,8 +161,8 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac // AttachScript
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AttachScript") == 0) {
- stack->CorrectParams(1);
- stack->PushBool(SUCCEEDED(addScript(stack->Pop()->GetString())));
+ stack->correctParams(1);
+ stack->pushBool(SUCCEEDED(addScript(stack->pop()->GetString())));
return S_OK;
}
@@ -171,9 +171,9 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac // DetachScript
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DetachScript") == 0) {
- stack->CorrectParams(2);
- const char *Filename = stack->Pop()->GetString();
- bool KillThreads = stack->Pop()->GetBool(false);
+ stack->correctParams(2);
+ const char *Filename = stack->pop()->GetString();
+ bool KillThreads = stack->pop()->GetBool(false);
bool ret = false;
for (int i = 0; i < _scripts.GetSize(); i++) {
if (scumm_stricmp(_scripts[i]->_filename, Filename) == 0) {
@@ -182,7 +182,7 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac break;
}
}
- stack->PushBool(ret);
+ stack->pushBool(ret);
return S_OK;
}
@@ -191,8 +191,8 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac // IsScriptRunning
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IsScriptRunning") == 0) {
- stack->CorrectParams(1);
- const char *Filename = stack->Pop()->GetString();
+ stack->correctParams(1);
+ 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) {
@@ -200,7 +200,7 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac break;
}
}
- stack->PushBool(ret);
+ stack->pushBool(ret);
return S_OK;
} else return CBScriptable::scCallMethod(script, stack, thisStack, name);
diff --git a/engines/wintermute/Base/BScriptable.cpp b/engines/wintermute/Base/BScriptable.cpp index 20f64f7fba..8d8c13df29 100644 --- a/engines/wintermute/Base/BScriptable.cpp +++ b/engines/wintermute/Base/BScriptable.cpp @@ -63,8 +63,8 @@ CBScriptable::~CBScriptable() { //////////////////////////////////////////////////////////////////////////
HRESULT CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
/*
- stack->CorrectParams(0);
- stack->PushNULL();
+ stack->correctParams(0);
+ stack->pushNULL();
script->RuntimeError("Call to undefined method '%s'.", name);
return S_OK;
diff --git a/engines/wintermute/Base/BSprite.cpp b/engines/wintermute/Base/BSprite.cpp index 257a71f255..901d592a02 100644 --- a/engines/wintermute/Base/BSprite.cpp +++ b/engines/wintermute/Base/BSprite.cpp @@ -512,12 +512,12 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetFrame
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "GetFrame") == 0) {
- stack->CorrectParams(1);
- int Index = stack->Pop()->GetInt(-1);
+ stack->correctParams(1);
+ int Index = stack->pop()->GetInt(-1);
if (Index < 0 || Index >= _frames.GetSize()) {
script->RuntimeError("Sprite.GetFrame: Frame index %d is out of range.", Index);
- stack->PushNULL();
- } else stack->PushNative(_frames[Index], true);
+ stack->pushNULL();
+ } else stack->pushNative(_frames[Index], true);
return S_OK;
}
@@ -525,8 +525,8 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // DeleteFrame
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DeleteFrame") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
if (Val->IsInt()) {
int Index = Val->GetInt(-1);
if (Index < 0 || Index >= _frames.GetSize()) {
@@ -543,7 +543,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi }
}
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -551,9 +551,9 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // Reset
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Reset") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
Reset();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -561,8 +561,8 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // AddFrame
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AddFrame") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
@@ -576,7 +576,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi }
_frames.Add(Frame);
- stack->PushNative(Frame, true);
+ stack->pushNative(Frame, true);
return S_OK;
}
@@ -584,11 +584,11 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // InsertFrame
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "InsertFrame") == 0) {
- stack->CorrectParams(2);
- int Index = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int Index = stack->pop()->GetInt();
if (Index < 0) Index = 0;
- CScValue *Val = stack->Pop();
+ CScValue *Val = stack->pop();
const char *Filename = NULL;
if (!Val->IsNULL()) Filename = Val->GetString();
@@ -602,7 +602,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi if (Index >= _frames.GetSize()) _frames.Add(Frame);
else _frames.InsertAt(Index, Frame);
- stack->PushNative(Frame, true);
+ stack->pushNative(Frame, true);
return S_OK;
}
@@ -610,9 +610,9 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // Pause
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Pause") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
_paused = true;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -620,9 +620,9 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // Play
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Play") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
_paused = false;
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
diff --git a/engines/wintermute/Base/BSubFrame.cpp b/engines/wintermute/Base/BSubFrame.cpp index 341dcbbdd5..0c7048b7bd 100644 --- a/engines/wintermute/Base/BSubFrame.cpp +++ b/engines/wintermute/Base/BSubFrame.cpp @@ -348,10 +348,10 @@ HRESULT CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *t // GetImage
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "GetImage") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
- if (!_surfaceFilename) stack->PushNULL();
- else stack->PushString(_surfaceFilename);
+ if (!_surfaceFilename) stack->pushNULL();
+ else stack->pushString(_surfaceFilename);
return S_OK;
}
@@ -359,20 +359,20 @@ HRESULT CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *t // SetImage
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetImage") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
if (Val->IsNULL()) {
if (_surface) Game->_surfaceStorage->removeSurface(_surface);
delete[] _surfaceFilename;
_surfaceFilename = NULL;
- stack->PushBool(true);
+ stack->pushBool(true);
} else {
const char *Filename = Val->GetString();
if (SUCCEEDED(setSurface(Filename))) {
setDefaultRect();
- stack->PushBool(true);
- } else stack->PushBool(false);
+ stack->pushBool(true);
+ } else stack->pushBool(false);
}
return S_OK;
diff --git a/engines/wintermute/Base/PartEmitter.cpp b/engines/wintermute/Base/PartEmitter.cpp index 1c69f0ed3a..e9c597c429 100644 --- a/engines/wintermute/Base/PartEmitter.cpp +++ b/engines/wintermute/Base/PartEmitter.cpp @@ -421,13 +421,13 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetBorder
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetBorder") == 0) {
- stack->CorrectParams(4);
- int BorderX = stack->Pop()->GetInt();
- int BorderY = stack->Pop()->GetInt();
- int BorderWidth = stack->Pop()->GetInt();
- int BorderHeight = stack->Pop()->GetInt();
+ stack->correctParams(4);
+ int BorderX = stack->pop()->GetInt();
+ int BorderY = stack->pop()->GetInt();
+ int BorderWidth = stack->pop()->GetInt();
+ int BorderHeight = stack->pop()->GetInt();
- stack->PushBool(SUCCEEDED(setBorder(BorderX, BorderY, BorderWidth, BorderHeight)));
+ stack->pushBool(SUCCEEDED(setBorder(BorderX, BorderY, BorderWidth, BorderHeight)));
return S_OK;
}
@@ -435,13 +435,13 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetBorderThickness
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetBorderThickness") == 0) {
- stack->CorrectParams(4);
- int Left = stack->Pop()->GetInt();
- int Right = stack->Pop()->GetInt();
- int Top = stack->Pop()->GetInt();
- int Bottom = stack->Pop()->GetInt();
+ stack->correctParams(4);
+ int Left = stack->pop()->GetInt();
+ int Right = stack->pop()->GetInt();
+ int Top = stack->pop()->GetInt();
+ int Bottom = stack->pop()->GetInt();
- stack->PushBool(SUCCEEDED(setBorderThickness(Left, Right, Top, Bottom)));
+ stack->pushBool(SUCCEEDED(setBorderThickness(Left, Right, Top, Bottom)));
return S_OK;
}
@@ -449,9 +449,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // AddSprite
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AddSprite") == 0) {
- stack->CorrectParams(1);
- const char *SpriteFile = stack->Pop()->GetString();
- stack->PushBool(SUCCEEDED(addSprite(SpriteFile)));
+ stack->correctParams(1);
+ const char *SpriteFile = stack->pop()->GetString();
+ stack->pushBool(SUCCEEDED(addSprite(SpriteFile)));
return S_OK;
}
@@ -459,9 +459,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // RemoveSprite
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RemoveSprite") == 0) {
- stack->CorrectParams(1);
- const char *SpriteFile = stack->Pop()->GetString();
- stack->PushBool(SUCCEEDED(removeSprite(SpriteFile)));
+ stack->correctParams(1);
+ const char *SpriteFile = stack->pop()->GetString();
+ stack->pushBool(SUCCEEDED(removeSprite(SpriteFile)));
return S_OK;
}
@@ -470,9 +470,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // Start
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Start") == 0) {
- stack->CorrectParams(1);
- _overheadTime = stack->Pop()->GetInt();
- stack->PushBool(SUCCEEDED(start()));
+ stack->correctParams(1);
+ _overheadTime = stack->pop()->GetInt();
+ stack->pushBool(SUCCEEDED(start()));
return S_OK;
}
@@ -481,7 +481,7 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // Stop
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Stop") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
for (int i = 0; i < _particles.GetSize(); i++) {
delete _particles[i];
@@ -489,7 +489,7 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack _particles.RemoveAll();
_running = false;
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -498,9 +498,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // Pause
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Pause") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
_running = false;
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -509,9 +509,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // Resume
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Resume") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
_running = true;
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -520,12 +520,12 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // AddGlobalForce
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AddGlobalForce") == 0) {
- stack->CorrectParams(3);
- const char *forceName = stack->Pop()->GetString();
- float Angle = stack->Pop()->GetFloat();
- float Strength = stack->Pop()->GetFloat();
+ stack->correctParams(3);
+ const char *forceName = stack->pop()->GetString();
+ float Angle = stack->pop()->GetFloat();
+ float Strength = stack->pop()->GetFloat();
- stack->PushBool(SUCCEEDED(addForce(forceName, CPartForce::FORCE_GLOBAL, 0, 0, Angle, Strength)));
+ stack->pushBool(SUCCEEDED(addForce(forceName, CPartForce::FORCE_GLOBAL, 0, 0, Angle, Strength)));
return S_OK;
}
@@ -534,14 +534,14 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // AddPointForce
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AddPointForce") == 0) {
- stack->CorrectParams(5);
- const char *forceName = stack->Pop()->GetString();
- int PosX = stack->Pop()->GetInt();
- int PosY = stack->Pop()->GetInt();
- float Angle = stack->Pop()->GetFloat();
- float Strength = stack->Pop()->GetFloat();
+ stack->correctParams(5);
+ const char *forceName = stack->pop()->GetString();
+ int PosX = stack->pop()->GetInt();
+ int PosY = stack->pop()->GetInt();
+ float Angle = stack->pop()->GetFloat();
+ float Strength = stack->pop()->GetFloat();
- stack->PushBool(SUCCEEDED(addForce(forceName, CPartForce::FORCE_GLOBAL, PosX, PosY, Angle, Strength)));
+ stack->pushBool(SUCCEEDED(addForce(forceName, CPartForce::FORCE_GLOBAL, PosX, PosY, Angle, Strength)));
return S_OK;
}
@@ -550,10 +550,10 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack // RemoveForce
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RemoveForce") == 0) {
- stack->CorrectParams(1);
- const char *forceName = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *forceName = stack->pop()->GetString();
- stack->PushBool(SUCCEEDED(removeForce(forceName)));
+ stack->pushBool(SUCCEEDED(removeForce(forceName)));
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXArray.cpp b/engines/wintermute/Base/scriptables/SXArray.cpp index 1a8dfdba64..c22dd9e4b5 100644 --- a/engines/wintermute/Base/scriptables/SXArray.cpp +++ b/engines/wintermute/Base/scriptables/SXArray.cpp @@ -45,15 +45,15 @@ CSXArray::CSXArray(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { _length = 0;
_values = new CScValue(Game);
- int NumParams = stack->Pop()->GetInt(0);
+ int NumParams = stack->pop()->GetInt(0);
- if (NumParams == 1) _length = stack->Pop()->GetInt(0);
+ if (NumParams == 1) _length = stack->pop()->GetInt(0);
else if (NumParams > 1) {
_length = NumParams;
char ParamName[20];
for (int i = 0; i < NumParams; i++) {
sprintf(ParamName, "%d", i);
- _values->SetProp(ParamName, stack->Pop());
+ _values->SetProp(ParamName, stack->pop());
}
}
}
@@ -98,15 +98,15 @@ HRESULT CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // Push
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Push") == 0) {
- int NumParams = stack->Pop()->GetInt(0);
+ int NumParams = stack->pop()->GetInt(0);
char ParamName[20];
for (int i = 0; i < NumParams; i++) {
_length++;
sprintf(ParamName, "%d", _length - 1);
- _values->SetProp(ParamName, stack->Pop(), true);
+ _values->SetProp(ParamName, stack->pop(), true);
}
- stack->PushInt(_length);
+ stack->pushInt(_length);
return S_OK;
}
@@ -116,15 +116,15 @@ HRESULT CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi //////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Pop") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_length > 0) {
char ParamName[20];
sprintf(ParamName, "%d", _length - 1);
- stack->Push(_values->GetProp(ParamName));
+ stack->push(_values->GetProp(ParamName));
_values->DeleteProp(ParamName);
_length--;
- } else stack->PushNULL();
+ } else stack->pushNULL();
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXDate.cpp b/engines/wintermute/Base/scriptables/SXDate.cpp index 5026ebdd8e..61a646df43 100644 --- a/engines/wintermute/Base/scriptables/SXDate.cpp +++ b/engines/wintermute/Base/scriptables/SXDate.cpp @@ -40,17 +40,17 @@ CBScriptable *makeSXDate(CBGame *inGame, CScStack *stack) { //////////////////////////////////////////////////////////////////////////
CSXDate::CSXDate(CBGame *inGame, CScStack *stack): CBScriptable(inGame) {
- stack->CorrectParams(6);
+ stack->correctParams(6);
memset(&_tm, 0, sizeof(_tm));
- CScValue *valYear = stack->Pop();
+ CScValue *valYear = stack->pop();
_tm.tm_year = valYear->GetInt() - 1900;
- _tm.tm_mon = stack->Pop()->GetInt() - 1;
- _tm.tm_mday = stack->Pop()->GetInt();
- _tm.tm_hour = stack->Pop()->GetInt();
- _tm.tm_min = stack->Pop()->GetInt();
- _tm.tm_sec = stack->Pop()->GetInt();
+ _tm.tm_mon = stack->pop()->GetInt() - 1;
+ _tm.tm_mday = stack->pop()->GetInt();
+ _tm.tm_hour = stack->pop()->GetInt();
+ _tm.tm_min = stack->pop()->GetInt();
+ _tm.tm_sec = stack->pop()->GetInt();
if (valYear->IsNULL()) {
g_system->getTimeAndDate(_tm);
@@ -80,57 +80,57 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // GetYear
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "GetYear") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_tm.tm_year + 1900);
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_year + 1900);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetMonth
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetMonth") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_tm.tm_mon + 1);
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_mon + 1);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetDate
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetDate") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_tm.tm_mday);
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_mday);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetHours
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetHours") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_tm.tm_hour);
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_hour);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetMinutes
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetMinutes") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_tm.tm_min);
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_min);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetSeconds
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetSeconds") == 0) {
- stack->CorrectParams(0);
- stack->PushInt(_tm.tm_sec);
+ stack->correctParams(0);
+ stack->pushInt(_tm.tm_sec);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetWeekday
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetWeekday") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
warning("GetWeekday returns a wrong value on purpose");
- stack->PushInt(_tm.tm_mday % 7);
+ stack->pushInt(_tm.tm_mday % 7);
return S_OK;
}
@@ -139,54 +139,54 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // SetYear
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetYear") == 0) {
- stack->CorrectParams(1);
- _tm.tm_year = stack->Pop()->GetInt() - 1900;
- stack->PushNULL();
+ stack->correctParams(1);
+ _tm.tm_year = stack->pop()->GetInt() - 1900;
+ stack->pushNULL();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetMonth
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetMonth") == 0) {
- stack->CorrectParams(1);
- _tm.tm_mon = stack->Pop()->GetInt() - 1;
- stack->PushNULL();
+ stack->correctParams(1);
+ _tm.tm_mon = stack->pop()->GetInt() - 1;
+ stack->pushNULL();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetDate
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetDate") == 0) {
- stack->CorrectParams(1);
- _tm.tm_mday = stack->Pop()->GetInt();
- stack->PushNULL();
+ stack->correctParams(1);
+ _tm.tm_mday = stack->pop()->GetInt();
+ stack->pushNULL();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetHours
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetHours") == 0) {
- stack->CorrectParams(1);
- _tm.tm_hour = stack->Pop()->GetInt();
- stack->PushNULL();
+ stack->correctParams(1);
+ _tm.tm_hour = stack->pop()->GetInt();
+ stack->pushNULL();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetMinutes
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetMinutes") == 0) {
- stack->CorrectParams(1);
- _tm.tm_min = stack->Pop()->GetInt();
- stack->PushNULL();
+ stack->correctParams(1);
+ _tm.tm_min = stack->pop()->GetInt();
+ stack->pushNULL();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetSeconds
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetSeconds") == 0) {
- stack->CorrectParams(1);
- _tm.tm_sec = stack->Pop()->GetInt();
- stack->PushNULL();
+ stack->correctParams(1);
+ _tm.tm_sec = stack->pop()->GetInt();
+ stack->pushNULL();
return S_OK;
}
@@ -195,9 +195,9 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // SetCurrentTime
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetCurrentTime") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
g_system->getTimeAndDate(_tm);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXFile.cpp b/engines/wintermute/Base/scriptables/SXFile.cpp index b897ca9701..fc2fca1991 100644 --- a/engines/wintermute/Base/scriptables/SXFile.cpp +++ b/engines/wintermute/Base/scriptables/SXFile.cpp @@ -56,8 +56,8 @@ CBScriptable *makeSXFile(CBGame *inGame, CScStack *stack) { //////////////////////////////////////////////////////////////////////////
CSXFile::CSXFile(CBGame *inGame, CScStack *stack): CBScriptable(inGame) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
_filename = NULL;
if (!Val->IsNULL()) CBUtils::SetString(&_filename, Val->GetString());
@@ -110,11 +110,11 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // SetFilename
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetFilename") == 0) {
- stack->CorrectParams(1);
- const char *Filename = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *Filename = stack->pop()->GetString();
cleanup();
CBUtils::SetString(&_filename, Filename);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -122,9 +122,9 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // OpenAsText / OpenAsBinary
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "OpenAsText") == 0 || strcmp(name, "OpenAsBinary") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
Close();
- _mode = stack->Pop()->GetInt(1);
+ _mode = stack->pop()->GetInt(1);
if (_mode < 1 || _mode > 3) {
script->RuntimeError("File.%s: invalid access mode. Setting read mode.", name);
_mode = 1;
@@ -150,8 +150,8 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this } else _textMode = strcmp(name, "OpenAsText") == 0;
}
- if (_readFile || _writeFile) stack->PushBool(true);
- else stack->PushBool(false);
+ if (_readFile || _writeFile) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -160,9 +160,9 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Close
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Close") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
Close();
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -170,13 +170,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // SetPosition
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetPosition") == 0) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
if (_mode == 0) {
script->RuntimeError("File.%s: File is not open", name);
- stack->PushBool(false);
+ stack->pushBool(false);
} else {
- int Pos = stack->Pop()->GetInt();
- stack->PushBool(SetPos(Pos));
+ int Pos = stack->pop()->GetInt();
+ stack->pushBool(SetPos(Pos));
}
return S_OK;
}
@@ -185,9 +185,9 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Delete
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Delete") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
Close();
- stack->PushBool(CBPlatform::DeleteFile(_filename) != false);
+ stack->pushBool(CBPlatform::DeleteFile(_filename) != false);
return S_OK;
}
@@ -195,12 +195,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Copy
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Copy") == 0) {
- stack->CorrectParams(2);
- const char *Dest = stack->Pop()->GetString();
- bool Overwrite = stack->Pop()->GetBool(true);
+ stack->correctParams(2);
+ const char *Dest = stack->pop()->GetString();
+ bool Overwrite = stack->pop()->GetBool(true);
Close();
- stack->PushBool(CBPlatform::CopyFile(_filename, Dest, !Overwrite) != false);
+ stack->pushBool(CBPlatform::CopyFile(_filename, Dest, !Overwrite) != false);
return S_OK;
}
@@ -208,10 +208,10 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadLine
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadLine") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (!_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open in text mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
uint32 BufSize = FILE_BUFFER_SIZE;
@@ -245,8 +245,8 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this }
Buf[Counter] = '\0';
- if (!FoundNewLine && Counter == 0) stack->PushNULL();
- else stack->PushString((char *)Buf);
+ if (!FoundNewLine && Counter == 0) stack->pushNULL();
+ else stack->pushString((char *)Buf);
free(Buf);
@@ -257,12 +257,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadText
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadText") == 0) {
- stack->CorrectParams(1);
- int TextLen = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int TextLen = stack->pop()->GetInt();
if (!_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open in text mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
uint32 BufSize = FILE_BUFFER_SIZE;
@@ -292,8 +292,8 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this }
Buf[Counter] = '\0';
- if (TextLen > 0 && Counter == 0) stack->PushNULL();
- else stack->PushString((char *)Buf);
+ if (TextLen > 0 && Counter == 0) stack->pushNULL();
+ else stack->pushString((char *)Buf);
free(Buf);
@@ -304,11 +304,11 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteLine / WriteText
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteLine") == 0 || strcmp(name, "WriteText") == 0) {
- stack->CorrectParams(1);
- const char *Line = stack->Pop()->GetString();
+ stack->correctParams(1);
+ 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);
+ stack->pushBool(false);
return S_OK;
}
if (strcmp(name, "WriteLine") == 0)
@@ -316,7 +316,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else
fprintf((FILE *)_writeFile, "%s", Line);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -326,15 +326,15 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadBool
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadBool") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open for reading in binary mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
bool Val;
- if (_readFile->read(&Val, sizeof(bool)) == sizeof(bool)) stack->PushBool(Val);
- else stack->PushNULL();
+ if (_readFile->read(&Val, sizeof(bool)) == sizeof(bool)) stack->pushBool(Val);
+ else stack->pushNULL();
return S_OK;
}
@@ -343,15 +343,15 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadByte
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadByte") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open for reading in binary mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
byte Val;
- if (_readFile->read(&Val, sizeof(byte)) == sizeof(byte)) stack->PushInt(Val);
- else stack->PushNULL();
+ if (_readFile->read(&Val, sizeof(byte)) == sizeof(byte)) stack->pushInt(Val);
+ else stack->pushNULL();
return S_OK;
}
@@ -360,15 +360,15 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadShort
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadShort") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open for reading in binary mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
short Val;
- if (_readFile->read(&Val, sizeof(short)) == sizeof(short)) stack->PushInt(65536 + Val);
- else stack->PushNULL();
+ if (_readFile->read(&Val, sizeof(short)) == sizeof(short)) stack->pushInt(65536 + Val);
+ else stack->pushNULL();
return S_OK;
}
@@ -377,15 +377,15 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadInt / ReadLong
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadInt") == 0 || strcmp(name, "ReadLong") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open for reading in binary mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
int Val;
- if (_readFile->read(&Val, sizeof(int)) == sizeof(int)) stack->PushInt(Val);
- else stack->PushNULL();
+ if (_readFile->read(&Val, sizeof(int)) == sizeof(int)) stack->pushInt(Val);
+ else stack->pushNULL();
return S_OK;
}
@@ -394,15 +394,15 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadFloat
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadFloat") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open for reading in binary mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
float Val;
- if (_readFile->read(&Val, sizeof(float)) == sizeof(float)) stack->PushFloat(Val);
- else stack->PushNULL();
+ if (_readFile->read(&Val, sizeof(float)) == sizeof(float)) stack->pushFloat(Val);
+ else stack->pushNULL();
return S_OK;
}
@@ -411,15 +411,15 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadDouble
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadDouble") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open for reading in binary mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
double Val;
- if (_readFile->read(&Val, sizeof(double)) == sizeof(double)) stack->PushFloat(Val);
- else stack->PushNULL();
+ if (_readFile->read(&Val, sizeof(double)) == sizeof(double)) stack->pushFloat(Val);
+ else stack->pushNULL();
return S_OK;
}
@@ -428,10 +428,10 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // ReadString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ReadString") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_textMode || !_readFile) {
script->RuntimeError("File.%s: File must be open for reading in binary mode.", name);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
uint32 Size;
@@ -440,11 +440,11 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this if (Str) {
if (_readFile->read(Str, Size) == Size) {
Str[Size] = '\0';
- stack->PushString((char *)Str);
+ stack->pushString((char *)Str);
}
delete [] Str;
- } else stack->PushNULL();
- } else stack->PushNULL();
+ } else stack->pushNULL();
+ } else stack->pushNULL();
return S_OK;
}
@@ -453,16 +453,16 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteBool
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteBool") == 0) {
- stack->CorrectParams(1);
- bool Val = stack->Pop()->GetBool();
+ stack->correctParams(1);
+ bool Val = stack->pop()->GetBool();
if (_textMode || !_writeFile) {
script->RuntimeError("File.%s: File must be open for writing in binary mode.", name);
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
fwrite(&Val, sizeof(Val), 1, (FILE *)_writeFile);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -471,16 +471,16 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteByte
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteByte") == 0) {
- stack->CorrectParams(1);
- byte Val = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ byte Val = stack->pop()->GetInt();
if (_textMode || !_writeFile) {
script->RuntimeError("File.%s: File must be open for writing in binary mode.", name);
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
fwrite(&Val, sizeof(Val), 1, (FILE *)_writeFile);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -489,16 +489,16 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteShort
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteShort") == 0) {
- stack->CorrectParams(1);
- short Val = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ short Val = stack->pop()->GetInt();
if (_textMode || !_writeFile) {
script->RuntimeError("File.%s: File must be open for writing in binary mode.", name);
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
fwrite(&Val, sizeof(Val), 1, (FILE *)_writeFile);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -507,16 +507,16 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteInt / WriteLong
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteInt") == 0 || strcmp(name, "WriteLong") == 0) {
- stack->CorrectParams(1);
- int Val = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int Val = stack->pop()->GetInt();
if (_textMode || !_writeFile) {
script->RuntimeError("File.%s: File must be open for writing in binary mode.", name);
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
fwrite(&Val, sizeof(Val), 1, (FILE *)_writeFile);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -525,16 +525,16 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteFloat
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteFloat") == 0) {
- stack->CorrectParams(1);
- float Val = stack->Pop()->GetFloat();
+ stack->correctParams(1);
+ float Val = stack->pop()->GetFloat();
if (_textMode || !_writeFile) {
script->RuntimeError("File.%s: File must be open for writing in binary mode.", name);
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
fwrite(&Val, sizeof(Val), 1, (FILE *)_writeFile);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -543,16 +543,16 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteDouble
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteDouble") == 0) {
- stack->CorrectParams(1);
- double Val = stack->Pop()->GetFloat();
+ stack->correctParams(1);
+ double Val = stack->pop()->GetFloat();
if (_textMode || !_writeFile) {
script->RuntimeError("File.%s: File must be open for writing in binary mode.", name);
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
fwrite(&Val, sizeof(Val), 1, (FILE *)_writeFile);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -561,12 +561,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // WriteString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WriteString") == 0) {
- stack->CorrectParams(1);
- const char *Val = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *Val = stack->pop()->GetString();
if (_textMode || !_writeFile) {
script->RuntimeError("File.%s: File must be open for writing in binary mode.", name);
- stack->PushBool(false);
+ stack->pushBool(false);
return S_OK;
}
@@ -574,7 +574,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this fwrite(&Size, sizeof(Size), 1, (FILE *)_writeFile);
fwrite(Val, Size, 1, (FILE *)_writeFile);
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXMath.cpp b/engines/wintermute/Base/scriptables/SXMath.cpp index a9337af1a8..110330d4ef 100644 --- a/engines/wintermute/Base/scriptables/SXMath.cpp +++ b/engines/wintermute/Base/scriptables/SXMath.cpp @@ -63,8 +63,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Abs
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Abs") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(fabs(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(fabs(stack->pop()->GetFloat()));
return S_OK;
}
@@ -72,8 +72,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Acos
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Acos") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(acos(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(acos(stack->pop()->GetFloat()));
return S_OK;
}
@@ -81,8 +81,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Asin
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Asin") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(asin(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(asin(stack->pop()->GetFloat()));
return S_OK;
}
@@ -90,8 +90,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Atan
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Atan") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(atan(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(atan(stack->pop()->GetFloat()));
return S_OK;
}
@@ -99,10 +99,10 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Atan2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Atan2") == 0) {
- stack->CorrectParams(2);
- double y = stack->Pop()->GetFloat();
- double x = stack->Pop()->GetFloat();
- stack->PushFloat(atan2(y, x));
+ stack->correctParams(2);
+ double y = stack->pop()->GetFloat();
+ double x = stack->pop()->GetFloat();
+ stack->pushFloat(atan2(y, x));
return S_OK;
}
@@ -110,8 +110,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Ceil
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Ceil") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(ceil(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(ceil(stack->pop()->GetFloat()));
return S_OK;
}
@@ -119,8 +119,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Cos
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Cos") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(cos(DegreeToRadian(stack->Pop()->GetFloat())));
+ stack->correctParams(1);
+ stack->pushFloat(cos(DegreeToRadian(stack->pop()->GetFloat())));
return S_OK;
}
@@ -128,8 +128,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Cosh
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Cosh") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(cosh(DegreeToRadian(stack->Pop()->GetFloat())));
+ stack->correctParams(1);
+ stack->pushFloat(cosh(DegreeToRadian(stack->pop()->GetFloat())));
return S_OK;
}
@@ -137,8 +137,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Exp
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Exp") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(exp(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(exp(stack->pop()->GetFloat()));
return S_OK;
}
@@ -146,8 +146,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Floor
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Floor") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(floor(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(floor(stack->pop()->GetFloat()));
return S_OK;
}
@@ -155,8 +155,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Log
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Log") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(log(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(log(stack->pop()->GetFloat()));
return S_OK;
}
@@ -164,8 +164,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Log10
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Log10") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(log10(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(log10(stack->pop()->GetFloat()));
return S_OK;
}
@@ -173,11 +173,11 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Pow
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Pow") == 0) {
- stack->CorrectParams(2);
- double x = stack->Pop()->GetFloat();
- double y = stack->Pop()->GetFloat();
+ stack->correctParams(2);
+ double x = stack->pop()->GetFloat();
+ double y = stack->pop()->GetFloat();
- stack->PushFloat(pow(x, y));
+ stack->pushFloat(pow(x, y));
return S_OK;
}
@@ -185,8 +185,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Sin
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Sin") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(sin(DegreeToRadian(stack->Pop()->GetFloat())));
+ stack->correctParams(1);
+ stack->pushFloat(sin(DegreeToRadian(stack->pop()->GetFloat())));
return S_OK;
}
@@ -194,8 +194,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Sinh
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Sinh") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(sinh(DegreeToRadian(stack->Pop()->GetFloat())));
+ stack->correctParams(1);
+ stack->pushFloat(sinh(DegreeToRadian(stack->pop()->GetFloat())));
return S_OK;
}
@@ -203,8 +203,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Tan
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Tan") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(tan(DegreeToRadian(stack->Pop()->GetFloat())));
+ stack->correctParams(1);
+ stack->pushFloat(tan(DegreeToRadian(stack->pop()->GetFloat())));
return S_OK;
}
@@ -212,8 +212,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Tanh
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Tanh") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(tanh(DegreeToRadian(stack->Pop()->GetFloat())));
+ stack->correctParams(1);
+ stack->pushFloat(tanh(DegreeToRadian(stack->pop()->GetFloat())));
return S_OK;
}
@@ -221,8 +221,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // Sqrt
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Sqrt") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(sqrt(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(sqrt(stack->pop()->GetFloat()));
return S_OK;
}
@@ -230,8 +230,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // DegToRad
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DegToRad") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(DegreeToRadian(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(DegreeToRadian(stack->pop()->GetFloat()));
return S_OK;
}
@@ -239,8 +239,8 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this // RadToDeg
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RadToDeg") == 0) {
- stack->CorrectParams(1);
- stack->PushFloat(RadianToDegree(stack->Pop()->GetFloat()));
+ stack->correctParams(1);
+ stack->pushFloat(RadianToDegree(stack->pop()->GetFloat()));
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp index 82a9a1f5e2..7dcb6ea1a7 100644 --- a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp +++ b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp @@ -43,11 +43,11 @@ CBScriptable *makeSXMemBuffer(CBGame *inGame, CScStack *stack) { //////////////////////////////////////////////////////////////////////////
CSXMemBuffer::CSXMemBuffer(CBGame *inGame, CScStack *stack): CBScriptable(inGame) {
- stack->CorrectParams(1);
+ stack->correctParams(1);
_buffer = NULL;
_size = 0;
- int NewSize = stack->Pop()->GetInt();
+ int NewSize = stack->pop()->GetInt();
Resize(MAX(0, NewSize));
}
@@ -127,11 +127,11 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetSize
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetSize") == 0) {
- stack->CorrectParams(1);
- int NewSize = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int NewSize = stack->pop()->GetInt();
NewSize = MAX(0, NewSize);
- if (SUCCEEDED(Resize(NewSize))) stack->PushBool(true);
- else stack->PushBool(false);
+ if (SUCCEEDED(Resize(NewSize))) stack->pushBool(true);
+ else stack->pushBool(false);
return S_OK;
}
@@ -140,10 +140,10 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetBool
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetBool") == 0) {
- stack->CorrectParams(1);
- int Start = stack->Pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(bool))) stack->PushNULL();
- else stack->PushBool(*(bool *)((byte *)_buffer + Start));
+ stack->correctParams(1);
+ int Start = stack->pop()->GetInt();
+ if (!CheckBounds(script, Start, sizeof(bool))) stack->pushNULL();
+ else stack->pushBool(*(bool *)((byte *)_buffer + Start));
return S_OK;
}
@@ -152,10 +152,10 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetByte
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetByte") == 0) {
- stack->CorrectParams(1);
- int Start = stack->Pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(byte))) stack->PushNULL();
- else stack->PushInt(*(byte *)((byte *)_buffer + Start));
+ stack->correctParams(1);
+ int Start = stack->pop()->GetInt();
+ if (!CheckBounds(script, Start, sizeof(byte))) stack->pushNULL();
+ else stack->pushInt(*(byte *)((byte *)_buffer + Start));
return S_OK;
}
@@ -164,10 +164,10 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetShort
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetShort") == 0) {
- stack->CorrectParams(1);
- int Start = stack->Pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(short))) stack->PushNULL();
- else stack->PushInt(65536 + * (short *)((byte *)_buffer + Start));
+ stack->correctParams(1);
+ int Start = stack->pop()->GetInt();
+ if (!CheckBounds(script, Start, sizeof(short))) stack->pushNULL();
+ else stack->pushInt(65536 + * (short *)((byte *)_buffer + Start));
return S_OK;
}
@@ -176,10 +176,10 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetInt / GetLong
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetInt") == 0 || strcmp(name, "GetLong") == 0) {
- stack->CorrectParams(1);
- int Start = stack->Pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(int))) stack->PushNULL();
- else stack->PushInt(*(int *)((byte *)_buffer + Start));
+ stack->correctParams(1);
+ int Start = stack->pop()->GetInt();
+ if (!CheckBounds(script, Start, sizeof(int))) stack->pushNULL();
+ else stack->pushInt(*(int *)((byte *)_buffer + Start));
return S_OK;
}
@@ -188,10 +188,10 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetFloat
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetFloat") == 0) {
- stack->CorrectParams(1);
- int Start = stack->Pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(float))) stack->PushNULL();
- else stack->PushFloat(*(float *)((byte *)_buffer + Start));
+ stack->correctParams(1);
+ int Start = stack->pop()->GetInt();
+ if (!CheckBounds(script, Start, sizeof(float))) stack->pushNULL();
+ else stack->pushFloat(*(float *)((byte *)_buffer + Start));
return S_OK;
}
@@ -200,10 +200,10 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetDouble
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetDouble") == 0) {
- stack->CorrectParams(1);
- int Start = stack->Pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(double))) stack->PushNULL();
- else stack->PushFloat(*(double *)((byte *)_buffer + Start));
+ stack->correctParams(1);
+ int Start = stack->pop()->GetInt();
+ if (!CheckBounds(script, Start, sizeof(double))) stack->pushNULL();
+ else stack->pushFloat(*(double *)((byte *)_buffer + Start));
return S_OK;
}
@@ -212,9 +212,9 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetString") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- int Length = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ int Length = stack->pop()->GetInt();
// find end of string
if (Length == 0 && Start >= 0 && Start < _size) {
@@ -226,12 +226,12 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack }
}
- if (!CheckBounds(script, Start, Length)) stack->PushNULL();
+ if (!CheckBounds(script, Start, Length)) stack->pushNULL();
else {
char *Str = new char[Length + 1];
strncpy(Str, (const char *)_buffer + Start, Length);
Str[Length] = '\0';
- stack->PushString(Str);
+ stack->pushString(Str);
delete [] Str;
}
return S_OK;
@@ -241,13 +241,13 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // GetPointer
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetPointer") == 0) {
- stack->CorrectParams(1);
- int Start = stack->Pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(void *))) stack->PushNULL();
+ stack->correctParams(1);
+ int Start = stack->pop()->GetInt();
+ if (!CheckBounds(script, Start, sizeof(void *))) stack->pushNULL();
else {
void *Pointer = *(void **)((byte *)_buffer + Start);
CSXMemBuffer *Buf = new CSXMemBuffer(Game, Pointer);
- stack->PushNative(Buf, false);
+ stack->pushNative(Buf, false);
}
return S_OK;
}
@@ -256,14 +256,14 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetBool
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetBool") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- bool Val = stack->Pop()->GetBool();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ bool Val = stack->pop()->GetBool();
- if (!CheckBounds(script, Start, sizeof(bool))) stack->PushBool(false);
+ if (!CheckBounds(script, Start, sizeof(bool))) stack->pushBool(false);
else {
*(bool *)((byte *)_buffer + Start) = Val;
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -272,14 +272,14 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetByte
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetByte") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- byte Val = (byte)stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ byte Val = (byte)stack->pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(byte))) stack->PushBool(false);
+ if (!CheckBounds(script, Start, sizeof(byte))) stack->pushBool(false);
else {
*(byte *)((byte *)_buffer + Start) = Val;
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -288,14 +288,14 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetShort
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetShort") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- short Val = (short)stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ short Val = (short)stack->pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(short))) stack->PushBool(false);
+ if (!CheckBounds(script, Start, sizeof(short))) stack->pushBool(false);
else {
*(short *)((byte *)_buffer + Start) = Val;
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -304,14 +304,14 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetInt / SetLong
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetInt") == 0 || strcmp(name, "SetLong") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- int Val = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ int Val = stack->pop()->GetInt();
- if (!CheckBounds(script, Start, sizeof(int))) stack->PushBool(false);
+ if (!CheckBounds(script, Start, sizeof(int))) stack->pushBool(false);
else {
*(int *)((byte *)_buffer + Start) = Val;
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -320,14 +320,14 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetFloat
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetFloat") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- float Val = (float)stack->Pop()->GetFloat();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ float Val = (float)stack->pop()->GetFloat();
- if (!CheckBounds(script, Start, sizeof(float))) stack->PushBool(false);
+ if (!CheckBounds(script, Start, sizeof(float))) stack->pushBool(false);
else {
*(float *)((byte *)_buffer + Start) = Val;
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -336,14 +336,14 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetDouble
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetDouble") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- double Val = stack->Pop()->GetFloat();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ double Val = stack->pop()->GetFloat();
- if (!CheckBounds(script, Start, sizeof(double))) stack->PushBool(false);
+ if (!CheckBounds(script, Start, sizeof(double))) stack->pushBool(false);
else {
*(double *)((byte *)_buffer + Start) = Val;
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -352,14 +352,14 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetString
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetString") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- const char *Val = stack->Pop()->GetString();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ const char *Val = stack->pop()->GetString();
- if (!CheckBounds(script, Start, strlen(Val) + 1)) stack->PushBool(false);
+ if (!CheckBounds(script, Start, strlen(Val) + 1)) stack->pushBool(false);
else {
memcpy((byte *)_buffer + Start, Val, strlen(Val) + 1);
- stack->PushBool(true);
+ stack->pushBool(true);
}
return S_OK;
}
@@ -368,19 +368,19 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // SetPointer
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetPointer") == 0) {
- stack->CorrectParams(2);
- int Start = stack->Pop()->GetInt();
- /* CScValue *Val = */ stack->Pop();
+ stack->correctParams(2);
+ int Start = stack->pop()->GetInt();
+ /* CScValue *Val = */ stack->pop();
- if (!CheckBounds(script, Start, sizeof(void *))) stack->PushBool(false);
+ if (!CheckBounds(script, Start, sizeof(void *))) stack->pushBool(false);
else {
/*
int Pointer = (int)Val->GetMemBuffer();
memcpy((byte *)_buffer+Start, &Pointer, sizeof(void*));
- stack->PushBool(true);
+ stack->pushBool(true);
*/
// TODO fix
- stack->PushBool(false);
+ stack->pushBool(false);
}
return S_OK;
@@ -390,7 +390,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack // DEBUG_Dump
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DEBUG_Dump") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
if (_buffer && _size) {
warning("SXMemBuffer::ScCallMethod - DEBUG_Dump");
Common::DumpFile f;
@@ -398,7 +398,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack f.write(_buffer, _size);
f.close();
}
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXStore.cpp b/engines/wintermute/Base/scriptables/SXStore.cpp index bfdbd212c7..a1d41c2db6 100644 --- a/engines/wintermute/Base/scriptables/SXStore.cpp +++ b/engines/wintermute/Base/scriptables/SXStore.cpp @@ -89,39 +89,39 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // EnableEvents
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "EnableEvents") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
SetEventsEnabled(script, true);
- stack->PushBool(GetEventsEnabled() == true);
+ stack->pushBool(GetEventsEnabled() == true);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// DisableEvents
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DisableEvents") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
SetEventsEnabled(script, false);
- stack->PushBool(GetEventsEnabled() == false);
+ stack->pushBool(GetEventsEnabled() == false);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// ValidateProducts
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ValidateProducts") == 0) {
- stack->CorrectParams(1);
- const char *prodIdList = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *prodIdList = stack->pop()->GetString();
_lastProductRequestOwner = script->_owner;
ValidateProducts(prodIdList);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetValidProduct
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetValidProduct") == 0) {
- stack->CorrectParams(1);
- int index = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int index = stack->pop()->GetInt();
if (index >= 0 && index < _validProducts.GetSize()) {
- CScValue *prod = stack->GetPushValue();
+ CScValue *prod = stack->getPushValue();
if (prod) {
prod->SetProperty("Id", _validProducts[index]->GetId());
prod->SetProperty("Name", _validProducts[index]->GetName());
@@ -129,7 +129,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi prod->SetProperty("Price", _validProducts[index]->GetPrice());
}
} else
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -137,12 +137,12 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetInvalidProduct
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetInvalidProduct") == 0) {
- stack->CorrectParams(1);
- int index = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int index = stack->pop()->GetInt();
if (index >= 0 && index < _invalidProducts.size())
- stack->PushString(_invalidProducts[index].c_str());
+ stack->pushString(_invalidProducts[index].c_str());
else
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -150,17 +150,17 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // GetTransaction
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetTransaction") == 0) {
- stack->CorrectParams(1);
- int index = stack->Pop()->GetInt();
+ stack->correctParams(1);
+ int index = stack->pop()->GetInt();
if (index >= 0 && index < _transactions.GetSize()) {
- CScValue *trans = stack->GetPushValue();
+ CScValue *trans = stack->getPushValue();
if (trans) {
trans->SetProperty("Id", _transactions[index]->GetId());
trans->SetProperty("ProductId", _transactions[index]->GetProductId());
trans->SetProperty("State", _transactions[index]->GetState());
}
} else
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -168,9 +168,9 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // Purchase
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Purchase") == 0) {
- stack->CorrectParams(1);
- const char *prodId = stack->Pop()->GetString();
- stack->PushBool(Purchase(script, prodId));
+ stack->correctParams(1);
+ const char *prodId = stack->pop()->GetString();
+ stack->pushBool(Purchase(script, prodId));
return S_OK;
}
@@ -178,9 +178,9 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // FinishTransaction
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FinishTransaction") == 0) {
- stack->CorrectParams(1);
- const char *transId = stack->Pop()->GetString();
- stack->PushBool(FinishTransaction(script, transId));
+ stack->correctParams(1);
+ const char *transId = stack->pop()->GetString();
+ stack->pushBool(FinishTransaction(script, transId));
return S_OK;
}
@@ -188,9 +188,9 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // RestoreTransactions
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RestoreTransactions") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
RestoreTransactions(script);
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -199,13 +199,13 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // UnlockProduct
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "UnlockProduct") == 0) {
- stack->CorrectParams(1);
- const char *prodId = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *prodId = stack->pop()->GetString();
Game->_registry->WriteBool("Purchases", prodId, true);
Game->_registry->SaveValues();
- stack->PushBool(true);
+ stack->pushBool(true);
return S_OK;
}
@@ -214,10 +214,10 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // IsProductUnlocked
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IsProductUnlocked") == 0) {
- stack->CorrectParams(1);
- const char *prodId = stack->Pop()->GetString();
+ stack->correctParams(1);
+ const char *prodId = stack->pop()->GetString();
- stack->PushBool(Game->_registry->ReadBool("Purchases", prodId, false));
+ stack->pushBool(Game->_registry->ReadBool("Purchases", prodId, false));
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXString.cpp b/engines/wintermute/Base/scriptables/SXString.cpp index 4a912df5fe..36dc257229 100644 --- a/engines/wintermute/Base/scriptables/SXString.cpp +++ b/engines/wintermute/Base/scriptables/SXString.cpp @@ -48,8 +48,8 @@ CSXString::CSXString(CBGame *inGame, CScStack *stack): CBScriptable(inGame) { _string = NULL;
_capacity = 0;
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
if (Val->IsInt()) {
_capacity = MAX(0, Val->GetInt());
@@ -104,9 +104,9 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th // Substring
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Substring") == 0) {
- stack->CorrectParams(2);
- int start = stack->Pop()->GetInt();
- int end = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int start = stack->pop()->GetInt();
+ int end = stack->pop()->GetInt();
if (end < start) CBUtils::Swap(&start, &end);
@@ -121,11 +121,11 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th WideString subStr(str.c_str() + start, end - start + 1);
if (Game->_textEncoding == TEXT_UTF8)
- stack->PushString(StringUtil::WideToUtf8(subStr).c_str());
+ stack->pushString(StringUtil::WideToUtf8(subStr).c_str());
else
- stack->PushString(StringUtil::WideToAnsi(subStr).c_str());
+ stack->pushString(StringUtil::WideToAnsi(subStr).c_str());
// } catch (std::exception &) {
- // stack->PushNULL();
+ // stack->pushNULL();
// }
return S_OK;
@@ -135,14 +135,14 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th // Substr
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Substr") == 0) {
- stack->CorrectParams(2);
- int start = stack->Pop()->GetInt();
+ stack->correctParams(2);
+ int start = stack->pop()->GetInt();
- CScValue *val = stack->Pop();
+ CScValue *val = stack->pop();
int len = val->GetInt();
if (!val->IsNULL() && len <= 0) {
- stack->PushString("");
+ stack->pushString("");
return S_OK;
}
@@ -159,11 +159,11 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th WideString subStr(str.c_str() + start, len);
if (Game->_textEncoding == TEXT_UTF8)
- stack->PushString(StringUtil::WideToUtf8(subStr).c_str());
+ stack->pushString(StringUtil::WideToUtf8(subStr).c_str());
else
- stack->PushString(StringUtil::WideToAnsi(subStr).c_str());
+ stack->pushString(StringUtil::WideToAnsi(subStr).c_str());
// } catch (std::exception &) {
-// stack->PushNULL();
+// stack->pushNULL();
// }
return S_OK;
@@ -173,7 +173,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th // ToUpperCase
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ToUpperCase") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
@@ -184,9 +184,9 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th StringUtil::ToUpperCase(str);
if (Game->_textEncoding == TEXT_UTF8)
- stack->PushString(StringUtil::WideToUtf8(str).c_str());
+ stack->pushString(StringUtil::WideToUtf8(str).c_str());
else
- stack->PushString(StringUtil::WideToAnsi(str).c_str());
+ stack->pushString(StringUtil::WideToAnsi(str).c_str());
return S_OK;
}
@@ -195,7 +195,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th // ToLowerCase
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ToLowerCase") == 0) {
- stack->CorrectParams(0);
+ stack->correctParams(0);
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
@@ -206,9 +206,9 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th StringUtil::ToLowerCase(str);
if (Game->_textEncoding == TEXT_UTF8)
- stack->PushString(StringUtil::WideToUtf8(str).c_str());
+ stack->pushString(StringUtil::WideToUtf8(str).c_str());
else
- stack->PushString(StringUtil::WideToAnsi(str).c_str());
+ stack->pushString(StringUtil::WideToAnsi(str).c_str());
return S_OK;
}
@@ -217,10 +217,10 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th // IndexOf
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IndexOf") == 0) {
- stack->CorrectParams(2);
+ stack->correctParams(2);
- const char *strToFind = stack->Pop()->GetString();
- int index = stack->Pop()->GetInt();
+ const char *strToFind = stack->pop()->GetString();
+ int index = stack->pop()->GetInt();
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
@@ -235,7 +235,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th toFind = StringUtil::AnsiToWide(strToFind);
int indexOf = StringUtil::IndexOf(str, toFind, index);
- stack->PushInt(indexOf);
+ stack->pushInt(indexOf);
return S_OK;
}
@@ -244,14 +244,14 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th // Split
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Split") == 0) {
- stack->CorrectParams(1);
- CScValue *Val = stack->Pop();
+ stack->correctParams(1);
+ CScValue *Val = stack->pop();
char Separators[MAX_PATH] = ",";
if (!Val->IsNULL()) strcpy(Separators, Val->GetString());
CSXArray *Array = new CSXArray(Game);
if (!Array) {
- stack->PushNULL();
+ stack->pushNULL();
return S_OK;
}
@@ -308,7 +308,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th Val = NULL;
}
- stack->PushNative(Array, false);
+ stack->pushNative(Array, false);
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/ScEngine.cpp b/engines/wintermute/Base/scriptables/ScEngine.cpp index 9c443df509..e840d0cd78 100644 --- a/engines/wintermute/Base/scriptables/ScEngine.cpp +++ b/engines/wintermute/Base/scriptables/ScEngine.cpp @@ -407,13 +407,13 @@ HRESULT CScEngine::Tick() { case SCRIPT_WAITING_SCRIPT: {
if (!IsValidScript(_scripts[i]->_waitScript) || _scripts[i]->_waitScript->_state == SCRIPT_ERROR) {
// fake return value
- _scripts[i]->_stack->PushNULL();
+ _scripts[i]->_stack->pushNULL();
_scripts[i]->_waitScript = NULL;
_scripts[i]->Run();
} else {
if (_scripts[i]->_waitScript->_state == SCRIPT_THREAD_FINISHED) {
// copy return value
- _scripts[i]->_stack->Push(_scripts[i]->_waitScript->_stack->Pop());
+ _scripts[i]->_stack->push(_scripts[i]->_waitScript->_stack->pop());
_scripts[i]->Run();
_scripts[i]->_waitScript->finish();
_scripts[i]->_waitScript = NULL;
diff --git a/engines/wintermute/Base/scriptables/ScScript.cpp b/engines/wintermute/Base/scriptables/ScScript.cpp index 6e43ac6e0d..61e1e91282 100644 --- a/engines/wintermute/Base/scriptables/ScScript.cpp +++ b/engines/wintermute/Base/scriptables/ScScript.cpp @@ -493,9 +493,9 @@ HRESULT CScScript::ExecuteInstruction() { if (Game->GetDebugMgr()->_enabled)
Game->GetDebugMgr()->OnVariableInit(WME_DBGVAR_SCRIPT, this, NULL, _globals->GetProp(_symbols[dw]), _symbols[dw]);
} else {
- _scopeStack->GetTop()->SetProp(_symbols[dw], _operand);
+ _scopeStack->getTop()->SetProp(_symbols[dw], _operand);
if (Game->GetDebugMgr()->_enabled)
- Game->GetDebugMgr()->OnVariableInit(WME_DBGVAR_SCOPE, this, _scopeStack->GetTop(), _scopeStack->GetTop()->GetProp(_symbols[dw]), _symbols[dw]);
+ Game->GetDebugMgr()->OnVariableInit(WME_DBGVAR_SCOPE, this, _scopeStack->getTop(), _scopeStack->getTop()->GetProp(_symbols[dw]), _symbols[dw]);
}
break;
@@ -517,13 +517,13 @@ HRESULT CScScript::ExecuteInstruction() { case II_RET:
if (_scopeStack->_sP >= 0 && _callStack->_sP >= 0) {
- Game->GetDebugMgr()->OnScriptShutdownScope(this, _scopeStack->GetTop());
+ Game->GetDebugMgr()->OnScriptShutdownScope(this, _scopeStack->getTop());
- _scopeStack->Pop();
- _iP = (uint32)_callStack->Pop()->GetInt();
+ _scopeStack->pop();
+ _iP = (uint32)_callStack->pop()->GetInt();
if (_scopeStack->_sP < 0) Game->GetDebugMgr()->OnScriptChangeScope(this, NULL);
- else Game->GetDebugMgr()->OnScriptChangeScope(this, _scopeStack->GetTop());
+ else Game->GetDebugMgr()->OnScriptChangeScope(this, _scopeStack->getTop());
} else {
if (_thread) {
_state = SCRIPT_THREAD_FINISHED;
@@ -544,7 +544,7 @@ HRESULT CScScript::ExecuteInstruction() { dw = GetDWORD();
_operand->SetInt(_iP);
- _callStack->Push(_operand);
+ _callStack->push(_operand);
_iP = dw;
@@ -553,11 +553,11 @@ HRESULT CScScript::ExecuteInstruction() { case II_CALL_BY_EXP: {
// push var
// push string
- str = _stack->Pop()->GetString();
+ str = _stack->pop()->GetString();
char *MethodName = new char[strlen(str) + 1];
strcpy(MethodName, str);
- CScValue *var = _stack->Pop();
+ CScValue *var = _stack->pop();
if (var->_type == VAL_VARIABLE_REF) var = var->_valRef;
HRESULT res = E_FAIL;
@@ -574,18 +574,18 @@ HRESULT CScScript::ExecuteInstruction() { if (!_unbreakable) {
_waitScript = var->GetNative()->invokeMethodThread(MethodName);
if (!_waitScript) {
- _stack->CorrectParams(0);
+ _stack->correctParams(0);
RuntimeError("Error invoking method '%s'.", MethodName);
- _stack->PushNULL();
+ _stack->pushNULL();
} else {
_state = SCRIPT_WAITING_SCRIPT;
_waitScript->CopyParameters(_stack);
}
} else {
// can call methods in unbreakable mode
- _stack->CorrectParams(0);
+ _stack->correctParams(0);
RuntimeError("Cannot call method '%s'. Ignored.", MethodName);
- _stack->PushNULL();
+ _stack->pushNULL();
}
delete [] MethodName;
break;
@@ -616,9 +616,9 @@ HRESULT CScScript::ExecuteInstruction() { if (var->_type == VAL_NATIVE && !TriedNative) res = var->_valNative->scCallMethod(this, _stack, _thisStack, MethodName);
if (FAILED(res)) {
- _stack->CorrectParams(0);
+ _stack->correctParams(0);
RuntimeError("Call to undefined method '%s'. Ignored.", MethodName);
- _stack->PushNULL();
+ _stack->pushNULL();
}
}
}
@@ -638,40 +638,40 @@ HRESULT CScScript::ExecuteInstruction() { }
case II_SCOPE:
_operand->SetNULL();
- _scopeStack->Push(_operand);
+ _scopeStack->push(_operand);
if (_scopeStack->_sP < 0) Game->GetDebugMgr()->OnScriptChangeScope(this, NULL);
- else Game->GetDebugMgr()->OnScriptChangeScope(this, _scopeStack->GetTop());
+ else Game->GetDebugMgr()->OnScriptChangeScope(this, _scopeStack->getTop());
break;
case II_CORRECT_STACK:
dw = GetDWORD(); // params expected
- _stack->CorrectParams(dw);
+ _stack->correctParams(dw);
break;
case II_CREATE_OBJECT:
_operand->SetObject();
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_POP_EMPTY:
- _stack->Pop();
+ _stack->pop();
break;
case II_PUSH_VAR: {
CScValue *var = GetVar(_symbols[GetDWORD()]);
if (false && /*var->_type==VAL_OBJECT ||*/ var->_type == VAL_NATIVE) {
_operand->SetReference(var);
- _stack->Push(_operand);
- } else _stack->Push(var);
+ _stack->push(_operand);
+ } else _stack->push(var);
break;
}
case II_PUSH_VAR_REF: {
CScValue *var = GetVar(_symbols[GetDWORD()]);
_operand->SetReference(var);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
}
@@ -679,7 +679,7 @@ HRESULT CScScript::ExecuteInstruction() { char *VarName = _symbols[GetDWORD()];
CScValue *var = GetVar(VarName);
if (var) {
- CScValue *val = _stack->Pop();
+ CScValue *val = _stack->pop();
if (!val) {
RuntimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
var->SetNULL();
@@ -699,58 +699,58 @@ HRESULT CScScript::ExecuteInstruction() { }
case II_PUSH_VAR_THIS:
- _stack->Push(_thisStack->GetTop());
+ _stack->push(_thisStack->getTop());
break;
case II_PUSH_INT:
- _stack->PushInt((int)GetDWORD());
+ _stack->pushInt((int)GetDWORD());
break;
case II_PUSH_FLOAT:
- _stack->PushFloat(GetFloat());
+ _stack->pushFloat(GetFloat());
break;
case II_PUSH_BOOL:
- _stack->PushBool(GetDWORD() != 0);
+ _stack->pushBool(GetDWORD() != 0);
break;
case II_PUSH_STRING:
- _stack->PushString(GetString());
+ _stack->pushString(GetString());
break;
case II_PUSH_NULL:
- _stack->PushNULL();
+ _stack->pushNULL();
break;
case II_PUSH_THIS_FROM_STACK:
- _operand->SetReference(_stack->GetTop());
- _thisStack->Push(_operand);
+ _operand->SetReference(_stack->getTop());
+ _thisStack->push(_operand);
break;
case II_PUSH_THIS:
_operand->SetReference(GetVar(_symbols[GetDWORD()]));
- _thisStack->Push(_operand);
+ _thisStack->push(_operand);
break;
case II_POP_THIS:
- _thisStack->Pop();
+ _thisStack->pop();
break;
case II_PUSH_BY_EXP: {
- str = _stack->Pop()->GetString();
- CScValue *val = _stack->Pop()->GetProp(str);
- if (val) _stack->Push(val);
- else _stack->PushNULL();
+ str = _stack->pop()->GetString();
+ CScValue *val = _stack->pop()->GetProp(str);
+ if (val) _stack->push(val);
+ else _stack->pushNULL();
break;
}
case II_POP_BY_EXP: {
- str = _stack->Pop()->GetString();
- CScValue *var = _stack->Pop();
- CScValue *val = _stack->Pop();
+ str = _stack->pop()->GetString();
+ CScValue *var = _stack->pop();
+ CScValue *val = _stack->pop();
if (val == NULL) {
RuntimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
@@ -764,11 +764,11 @@ HRESULT CScScript::ExecuteInstruction() { }
case II_PUSH_REG1:
- _stack->Push(_reg1);
+ _stack->push(_reg1);
break;
case II_POP_REG1:
- _reg1->Copy(_stack->Pop());
+ _reg1->Copy(_stack->pop());
break;
case II_JMP:
@@ -777,8 +777,8 @@ HRESULT CScScript::ExecuteInstruction() { case II_JMP_FALSE: {
dw = GetDWORD();
- //if(!_stack->Pop()->GetBool()) _iP = dw;
- CScValue *Val = _stack->Pop();
+ //if(!_stack->pop()->GetBool()) _iP = dw;
+ CScValue *Val = _stack->pop();
if (!Val) {
RuntimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
} else {
@@ -788,8 +788,8 @@ HRESULT CScScript::ExecuteInstruction() { }
case II_ADD:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
if (op1->IsNULL() || op2->IsNULL()) _operand->SetNULL();
else if (op1->GetType() == VAL_STRING || op2->GetType() == VAL_STRING) {
@@ -802,98 +802,98 @@ HRESULT CScScript::ExecuteInstruction() { _operand->SetInt(op1->GetInt() + op2->GetInt());
else _operand->SetFloat(op1->GetFloat() + op2->GetFloat());
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_SUB:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
if (op1->IsNULL() || op2->IsNULL()) _operand->SetNULL();
else if (op1->GetType() == VAL_INT && op2->GetType() == VAL_INT)
_operand->SetInt(op1->GetInt() - op2->GetInt());
else _operand->SetFloat(op1->GetFloat() - op2->GetFloat());
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_MUL:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
if (op1->IsNULL() || op2->IsNULL()) _operand->SetNULL();
else if (op1->GetType() == VAL_INT && op2->GetType() == VAL_INT)
_operand->SetInt(op1->GetInt() * op2->GetInt());
else _operand->SetFloat(op1->GetFloat() * op2->GetFloat());
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_DIV:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
if (op2->GetFloat() == 0.0f) RuntimeError("Division by zero.");
if (op1->IsNULL() || op2->IsNULL() || op2->GetFloat() == 0.0f) _operand->SetNULL();
else _operand->SetFloat(op1->GetFloat() / op2->GetFloat());
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_MODULO:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
if (op2->GetInt() == 0) RuntimeError("Division by zero.");
if (op1->IsNULL() || op2->IsNULL() || op2->GetInt() == 0) _operand->SetNULL();
else _operand->SetInt(op1->GetInt() % op2->GetInt());
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_NOT:
- op1 = _stack->Pop();
+ op1 = _stack->pop();
//if(op1->IsNULL()) _operand->SetNULL();
if (op1->IsNULL()) _operand->SetBool(true);
else _operand->SetBool(!op1->GetBool());
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_AND:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
if (op1 == NULL || op2 == NULL) {
RuntimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
_operand->SetBool(false);
} else {
_operand->SetBool(op1->GetBool() && op2->GetBool());
}
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_OR:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
if (op1 == NULL || op2 == NULL) {
RuntimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
_operand->SetBool(false);
} else {
_operand->SetBool(op1->GetBool() || op2->GetBool());
}
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_EQ:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
/*
if((op1->IsNULL() && !op2->IsNULL()) || (!op1->IsNULL() && op2->IsNULL())) _operand->SetBool(false);
@@ -912,12 +912,12 @@ HRESULT CScScript::ExecuteInstruction() { */
_operand->SetBool(CScValue::Compare(op1, op2) == 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_NE:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
/*
if((op1->IsNULL() && !op2->IsNULL()) || (!op1->IsNULL() && op2->IsNULL())) _operand->SetBool(true);
@@ -936,12 +936,12 @@ HRESULT CScScript::ExecuteInstruction() { */
_operand->SetBool(CScValue::Compare(op1, op2) != 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_L:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
/*
if(op1->GetType()==VAL_FLOAT && op2->GetType()==VAL_FLOAT){
@@ -951,12 +951,12 @@ HRESULT CScScript::ExecuteInstruction() { */
_operand->SetBool(CScValue::Compare(op1, op2) < 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_G:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
/*
if(op1->GetType()==VAL_FLOAT && op2->GetType()==VAL_FLOAT){
@@ -966,12 +966,12 @@ HRESULT CScScript::ExecuteInstruction() { */
_operand->SetBool(CScValue::Compare(op1, op2) > 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_LE:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
/*
if(op1->GetType()==VAL_FLOAT && op2->GetType()==VAL_FLOAT){
@@ -981,12 +981,12 @@ HRESULT CScScript::ExecuteInstruction() { */
_operand->SetBool(CScValue::Compare(op1, op2) <= 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_GE:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
/*
if(op1->GetType()==VAL_FLOAT && op2->GetType()==VAL_FLOAT){
@@ -996,26 +996,26 @@ HRESULT CScScript::ExecuteInstruction() { */
_operand->SetBool(CScValue::Compare(op1, op2) >= 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_STRICT_EQ:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
//_operand->SetBool(op1->GetType()==op2->GetType() && op1->GetFloat()==op2->GetFloat());
_operand->SetBool(CScValue::CompareStrict(op1, op2) == 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_CMP_STRICT_NE:
- op2 = _stack->Pop();
- op1 = _stack->Pop();
+ op2 = _stack->pop();
+ op1 = _stack->pop();
//_operand->SetBool(op1->GetType()!=op2->GetType() || op1->GetFloat()!=op2->GetFloat());
_operand->SetBool(CScValue::CompareStrict(op1, op2) != 0);
- _stack->Push(_operand);
+ _stack->push(_operand);
break;
case II_DBG_LINE: {
@@ -1077,7 +1077,7 @@ CScValue *CScScript::GetVar(char *name) { // scope locals
if (_scopeStack->_sP >= 0) {
- if (_scopeStack->GetTop()->PropExists(name)) ret = _scopeStack->GetTop()->GetProp(name);
+ if (_scopeStack->getTop()->PropExists(name)) ret = _scopeStack->getTop()->GetProp(name);
}
// script globals
@@ -1094,10 +1094,10 @@ CScValue *CScScript::GetVar(char *name) { //RuntimeError("Variable '%s' is inaccessible in the current block. Consider changing the script.", name);
Game->LOG(0, "Warning: variable '%s' is inaccessible in the current block. Consider changing the script (script:%s, line:%d)", name, _filename, _currentLine);
CScValue *Val = new CScValue(Game);
- CScValue *Scope = _scopeStack->GetTop();
+ CScValue *Scope = _scopeStack->getTop();
if (Scope) {
Scope->SetProp(name, Val);
- ret = _scopeStack->GetTop()->GetProp(name);
+ ret = _scopeStack->getTop()->GetProp(name);
} else {
_globals->SetProp(name, Val);
ret = _globals->GetProp(name);
@@ -1331,8 +1331,8 @@ HRESULT CScScript::ExternalCall(CScStack *stack, CScStack *thisStack, CScScript: #ifndef __WIN32__
Game->LOG(0, "External functions are not supported on this platform.");
- stack->CorrectParams(0);
- stack->PushNULL();
+ stack->correctParams(0);
+ stack->pushNULL();
return E_FAIL;
#else
@@ -1345,11 +1345,11 @@ HRESULT CScScript::ExternalCall(CScStack *stack, CScStack *thisStack, CScScript: if (pFunc) {
int i;
Success = true;
- stack->CorrectParams(Function->nu_params);
+ stack->correctParams(Function->nu_params);
CBDynBuffer *Buffer = new CBDynBuffer(Game, 20 * sizeof(uint32));
for (i = 0; i < Function->nu_params; i++) {
- CScValue *Val = stack->Pop();
+ CScValue *Val = stack->pop();
switch (Function->params[i]) {
case TYPE_BOOL:
Buffer->PutDWORD((uint32)Val->GetBool());
@@ -1399,34 +1399,34 @@ HRESULT CScScript::ExternalCall(CScStack *stack, CScStack *thisStack, CScScript: // return
switch (Function->returns) {
case TYPE_BOOL:
- stack->PushBool((byte)ret != 0);
+ stack->pushBool((byte)ret != 0);
break;
case TYPE_LONG:
- stack->PushInt(ret);
+ stack->pushInt(ret);
break;
case TYPE_BYTE:
- stack->PushInt((byte)ret);
+ stack->pushInt((byte)ret);
break;
break;
case TYPE_STRING:
- stack->PushString((char *)ret);
+ stack->pushString((char *)ret);
break;
case TYPE_MEMBUFFER: {
CSXMemBuffer *Buf = new CSXMemBuffer(Game, (void *)ret);
- stack->PushNative(Buf, false);
+ stack->pushNative(Buf, false);
}
break;
case TYPE_FLOAT: {
uint32 dw = GetST0();
- stack->PushFloat(*((float *)&dw));
+ stack->pushFloat(*((float *)&dw));
break;
}
case TYPE_DOUBLE:
- stack->PushFloat(GetST0Double());
+ stack->pushFloat(GetST0Double());
break;
default:
- stack->PushNULL();
+ stack->pushNULL();
}
if (StackCorrupted) RuntimeError("Warning: Stack corrupted after calling '%s' in '%s'\n Check parameters and/or calling convention.", Function->name, Function->dll_name);
@@ -1434,8 +1434,8 @@ HRESULT CScScript::ExternalCall(CScStack *stack, CScStack *thisStack, CScScript: } else RuntimeError("Error loading DLL '%s'", Function->dll_name);
if (!Success) {
- stack->CorrectParams(0);
- stack->PushNULL();
+ stack->correctParams(0);
+ stack->pushNULL();
}
if (hDll) FreeLibrary(hDll);
@@ -1527,13 +1527,13 @@ double CScScript::GetST0Double(void) { //////////////////////////////////////////////////////////////////////////
HRESULT CScScript::CopyParameters(CScStack *stack) {
int i;
- int NumParams = stack->Pop()->GetInt();
+ int NumParams = stack->pop()->GetInt();
for (i = NumParams - 1; i >= 0; i--) {
- _stack->Push(stack->GetAt(i));
+ _stack->push(stack->getAt(i));
}
- _stack->PushInt(NumParams);
+ _stack->pushInt(NumParams);
- for (i = 0; i < NumParams; i++) stack->Pop();
+ for (i = 0; i < NumParams; i++) stack->pop();
return S_OK;
}
diff --git a/engines/wintermute/Base/scriptables/ScStack.cpp b/engines/wintermute/Base/scriptables/ScStack.cpp index f10aa7085b..dc953ed8d0 100644 --- a/engines/wintermute/Base/scriptables/ScStack.cpp +++ b/engines/wintermute/Base/scriptables/ScStack.cpp @@ -55,7 +55,7 @@ CScStack::~CScStack() { //////////////////////////////////////////////////////////////////////////
-CScValue *CScStack::Pop() {
+CScValue *CScStack::pop() {
if (_sP < 0) {
Game->LOG(0, "Fatal: Stack underflow");
return NULL;
@@ -66,7 +66,7 @@ CScValue *CScStack::Pop() { //////////////////////////////////////////////////////////////////////////
-void CScStack::Push(CScValue *val) {
+void CScStack::push(CScValue *val) {
_sP++;
if (_sP < _values.GetSize()) {
@@ -81,7 +81,7 @@ void CScStack::Push(CScValue *val) { //////////////////////////////////////////////////////////////////////////
-CScValue *CScStack::GetPushValue() {
+CScValue *CScStack::getPushValue() {
_sP++;
if (_sP >= _values.GetSize()) {
@@ -95,14 +95,14 @@ CScValue *CScStack::GetPushValue() { //////////////////////////////////////////////////////////////////////////
-CScValue *CScStack::GetTop() {
+CScValue *CScStack::getTop() {
if (_sP < 0 || _sP >= _values.GetSize()) return NULL;
else return _values[_sP];
}
//////////////////////////////////////////////////////////////////////////
-CScValue *CScStack::GetAt(int index) {
+CScValue *CScStack::getAt(int index) {
index = _sP - index;
if (index < 0 || index >= _values.GetSize()) return NULL;
else return _values[index];
@@ -110,8 +110,8 @@ CScValue *CScStack::GetAt(int index) { //////////////////////////////////////////////////////////////////////////
-void CScStack::CorrectParams(uint32 expected_params) {
- int nu_params = Pop()->GetInt();
+void CScStack::correctParams(uint32 expected_params) {
+ int nu_params = pop()->GetInt();
if (expected_params < nu_params) { // too many params
while (expected_params < nu_params) {
@@ -140,67 +140,67 @@ void CScStack::CorrectParams(uint32 expected_params) { //////////////////////////////////////////////////////////////////////////
-void CScStack::PushNULL() {
+void CScStack::pushNULL() {
/*
CScValue* val = new CScValue(Game);
val->SetNULL();
Push(val);
delete val;
*/
- GetPushValue()->SetNULL();
+ getPushValue()->SetNULL();
}
//////////////////////////////////////////////////////////////////////////
-void CScStack::PushInt(int val) {
+void CScStack::pushInt(int val) {
/*
CScValue* val = new CScValue(Game);
val->SetInt(Val);
Push(val);
delete val;
*/
- GetPushValue()->SetInt(val);
+ getPushValue()->SetInt(val);
}
//////////////////////////////////////////////////////////////////////////
-void CScStack::PushFloat(double val) {
+void CScStack::pushFloat(double val) {
/*
CScValue* val = new CScValue(Game);
val->SetFloat(Val);
Push(val);
delete val;
*/
- GetPushValue()->SetFloat(val);
+ getPushValue()->SetFloat(val);
}
//////////////////////////////////////////////////////////////////////////
-void CScStack::PushBool(bool val) {
+void CScStack::pushBool(bool val) {
/*
CScValue* val = new CScValue(Game);
val->SetBool(Val);
Push(val);
delete val;
*/
- GetPushValue()->SetBool(val);
+ getPushValue()->SetBool(val);
}
//////////////////////////////////////////////////////////////////////////
-void CScStack::PushString(const char *val) {
+void CScStack::pushString(const char *val) {
/*
CScValue* val = new CScValue(Game);
val->SetString(Val);
Push(val);
delete val;
*/
- GetPushValue()->SetString(val);
+ getPushValue()->SetString(val);
}
//////////////////////////////////////////////////////////////////////////
-void CScStack::PushNative(CBScriptable *val, bool persistent) {
+void CScStack::pushNative(CBScriptable *val, bool persistent) {
/*
CScValue* val = new CScValue(Game);
val->SetNative(Val, Persistent);
@@ -208,7 +208,7 @@ void CScStack::PushNative(CBScriptable *val, bool persistent) { delete val;
*/
- GetPushValue()->SetNative(val, persistent);
+ getPushValue()->SetNative(val, persistent);
}
diff --git a/engines/wintermute/Base/scriptables/ScStack.h b/engines/wintermute/Base/scriptables/ScStack.h index 3e7f557cdd..b2d5f15c1c 100644 --- a/engines/wintermute/Base/scriptables/ScStack.h +++ b/engines/wintermute/Base/scriptables/ScStack.h @@ -41,19 +41,19 @@ class CBScriptable; class CScStack : public CBBase {
public:
- CScValue *GetAt(int Index);
- CScValue *GetPushValue();
+ CScValue *getAt(int Index);
+ CScValue *getPushValue();
DECLARE_PERSISTENT(CScStack, CBBase)
- void PushNative(CBScriptable *Val, bool Persistent);
- void PushString(const char *Val);
- void PushBool(bool Val);
- void PushInt(int Val);
- void PushFloat(double Val);
- void PushNULL();
- void CorrectParams(uint32 expected_params);
- CScValue *GetTop();
- void Push(CScValue *Val);
- CScValue *Pop();
+ void pushNative(CBScriptable *Val, bool Persistent);
+ void pushString(const char *Val);
+ void pushBool(bool Val);
+ void pushInt(int Val);
+ void pushFloat(double Val);
+ void pushNULL();
+ void correctParams(uint32 expected_params);
+ CScValue *getTop();
+ void push(CScValue *Val);
+ CScValue *pop();
CScStack(CBGame *inGame);
virtual ~CScStack();
CBArray<CScValue *, CScValue *> _values;
diff --git a/engines/wintermute/Base/scriptables/SxObject.cpp b/engines/wintermute/Base/scriptables/SxObject.cpp index ff51134321..b4fd782f76 100644 --- a/engines/wintermute/Base/scriptables/SxObject.cpp +++ b/engines/wintermute/Base/scriptables/SxObject.cpp @@ -44,9 +44,9 @@ CBScriptable *makeSXObject(CBGame *inGame, CScStack *stack) { //////////////////////////////////////////////////////////////////////////
CSXObject::CSXObject(CBGame *inGame, CScStack *stack): CBObject(inGame) {
- int NumParams = stack->Pop()->GetInt(0);
+ int NumParams = stack->pop()->GetInt(0);
for (int i = 0; i < NumParams; i++) {
- addScript(stack->Pop()->GetString());
+ addScript(stack->pop()->GetString());
}
}
|