mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-19 02:38:32 +00:00
AGS: Move script.cpp globals into Globals
This commit is contained in:
parent
c3d96c399c
commit
b6dd902163
@ -395,12 +395,12 @@ void AGSEngine::setGraphicsMode(size_t w, size_t h) {
|
||||
|
||||
bool AGSEngine::canLoadGameStateCurrently() {
|
||||
return !_GP(thisroom).Options.SaveLoadDisabled &&
|
||||
!::AGS3::inside_script && !_GP(play).fast_forward;
|
||||
!_G(inside_script) && !_GP(play).fast_forward;
|
||||
}
|
||||
|
||||
bool AGSEngine::canSaveGameStateCurrently() {
|
||||
return !_GP(thisroom).Options.SaveLoadDisabled &&
|
||||
!::AGS3::inside_script && !_GP(play).fast_forward;
|
||||
!_G(inside_script) && !_GP(play).fast_forward;
|
||||
}
|
||||
|
||||
Common::Error AGSEngine::loadGameState(int slot) {
|
||||
|
@ -70,12 +70,8 @@ namespace AGS3 {
|
||||
|
||||
using namespace AGS::Shared;
|
||||
|
||||
|
||||
|
||||
extern ccInstance *dialogScriptsInst;
|
||||
extern int in_new_room;
|
||||
extern CharacterInfo *playerchar;
|
||||
|
||||
extern AGSPlatformDriver *platform;
|
||||
extern int cur_mode, cur_cursor;
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
@ -193,11 +189,11 @@ int run_dialog_script(DialogTopic *dtpp, int dialogID, int offse, int optionInde
|
||||
said_speech_line = 0;
|
||||
int result = RUN_DIALOG_STAY;
|
||||
|
||||
if (dialogScriptsInst) {
|
||||
if (_G(dialogScriptsInst)) {
|
||||
char funcName[100];
|
||||
sprintf(funcName, "_run_dialog%d", dialogID);
|
||||
RunTextScriptIParam(dialogScriptsInst, funcName, RuntimeScriptValue().SetInt32(optionIndex));
|
||||
result = dialogScriptsInst->returnValue;
|
||||
RunTextScriptIParam(_G(dialogScriptsInst), funcName, RuntimeScriptValue().SetInt32(optionIndex));
|
||||
result = _G(dialogScriptsInst)->returnValue;
|
||||
} else {
|
||||
// old dialog format
|
||||
if (offse == -1)
|
||||
@ -402,8 +398,8 @@ bool get_custom_dialog_options_dimensions(int dlgnum) {
|
||||
ccDialogOptionsRendering.Reset();
|
||||
ccDialogOptionsRendering.dialogID = dlgnum;
|
||||
|
||||
getDialogOptionsDimensionsFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&getDialogOptionsDimensionsFunc);
|
||||
_GP(getDialogOptionsDimensionsFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&_GP(getDialogOptionsDimensionsFunc));
|
||||
|
||||
if ((ccDialogOptionsRendering.width > 0) &&
|
||||
(ccDialogOptionsRendering.height > 0)) {
|
||||
@ -646,8 +642,8 @@ void DialogOptions::Redraw() {
|
||||
dialogOptionsRenderingSurface->hasAlphaChannel = ccDialogOptionsRendering.hasAlphaChannel;
|
||||
options_surface_has_alpha = dialogOptionsRenderingSurface->hasAlphaChannel != 0;
|
||||
|
||||
renderDialogOptionsFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&renderDialogOptionsFunc);
|
||||
_GP(renderDialogOptionsFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&_GP(renderDialogOptionsFunc));
|
||||
|
||||
if (!ccDialogOptionsRendering.surfaceAccessed)
|
||||
debug_script_warn("dialog_options_get_dimensions was implemented, but no dialog_options_render function drew anything to the surface");
|
||||
@ -830,8 +826,8 @@ bool DialogOptions::Run() {
|
||||
}
|
||||
|
||||
if (new_custom_render) {
|
||||
runDialogOptionRepExecFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&runDialogOptionRepExecFunc);
|
||||
_GP(runDialogOptionRepExecFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&_GP(runDialogOptionRepExecFunc));
|
||||
}
|
||||
|
||||
int gkey;
|
||||
@ -856,9 +852,9 @@ bool DialogOptions::Run() {
|
||||
}
|
||||
}
|
||||
} else if (new_custom_render) {
|
||||
runDialogOptionKeyPressHandlerFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
runDialogOptionKeyPressHandlerFunc.params[1].SetInt32(GetKeyForKeyPressCb(gkey));
|
||||
run_function_on_non_blocking_thread(&runDialogOptionKeyPressHandlerFunc);
|
||||
_GP(runDialogOptionKeyPressHandlerFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
_GP(runDialogOptionKeyPressHandlerFunc).params[1].SetInt32(GetKeyForKeyPressCb(gkey));
|
||||
run_function_on_non_blocking_thread(&_GP(runDialogOptionKeyPressHandlerFunc));
|
||||
}
|
||||
// Allow selection of options by keyboard shortcuts
|
||||
else if (_GP(game).options[OPT_DIALOGNUMBERED] >= kDlgOptKeysOnly &&
|
||||
@ -877,10 +873,10 @@ bool DialogOptions::Run() {
|
||||
if ((_G(mousex) >= dirtyx) && (_G(mousey) >= dirtyy) &&
|
||||
(_G(mousex) < dirtyx + tempScrn->GetWidth()) &&
|
||||
(_G(mousey) < dirtyy + tempScrn->GetHeight())) {
|
||||
getDialogOptionUnderCursorFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&getDialogOptionUnderCursorFunc);
|
||||
_GP(getDialogOptionUnderCursorFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
run_function_on_non_blocking_thread(&_GP(getDialogOptionUnderCursorFunc));
|
||||
|
||||
if (!getDialogOptionUnderCursorFunc.atLeastOneImplementationExists)
|
||||
if (!_GP(getDialogOptionUnderCursorFunc).atLeastOneImplementationExists)
|
||||
quit("!The script function dialog_options_get_active is not implemented. It must be present to use a custom dialogue system.");
|
||||
|
||||
mouseison = ccDialogOptionsRendering.activeOptionID;
|
||||
@ -918,11 +914,11 @@ bool DialogOptions::Run() {
|
||||
!_GP(play).IsIgnoringInput()) {
|
||||
if (mouseison < 0 && !new_custom_render) {
|
||||
if (usingCustomRendering) {
|
||||
runDialogOptionMouseClickHandlerFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
runDialogOptionMouseClickHandlerFunc.params[1].SetInt32(mouseButtonPressed + 1);
|
||||
run_function_on_non_blocking_thread(&runDialogOptionMouseClickHandlerFunc);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).params[1].SetInt32(mouseButtonPressed + 1);
|
||||
run_function_on_non_blocking_thread(&_GP(runDialogOptionMouseClickHandlerFunc));
|
||||
|
||||
if (runDialogOptionMouseClickHandlerFunc.atLeastOneImplementationExists) {
|
||||
if (_GP(runDialogOptionMouseClickHandlerFunc).atLeastOneImplementationExists) {
|
||||
Redraw();
|
||||
return true; // continue running loop
|
||||
}
|
||||
@ -933,9 +929,9 @@ bool DialogOptions::Run() {
|
||||
// they clicked the text box
|
||||
parserActivated = 1;
|
||||
} else if (new_custom_render) {
|
||||
runDialogOptionMouseClickHandlerFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
runDialogOptionMouseClickHandlerFunc.params[1].SetInt32(mouseButtonPressed + 1);
|
||||
run_function_on_non_blocking_thread(&runDialogOptionMouseClickHandlerFunc);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).params[1].SetInt32(mouseButtonPressed + 1);
|
||||
run_function_on_non_blocking_thread(&_GP(runDialogOptionMouseClickHandlerFunc));
|
||||
} else if (usingCustomRendering) {
|
||||
chose = mouseison;
|
||||
return false; // end dialog options running loop
|
||||
@ -947,12 +943,12 @@ bool DialogOptions::Run() {
|
||||
|
||||
if (usingCustomRendering) {
|
||||
if (mouseWheelTurn != 0) {
|
||||
runDialogOptionMouseClickHandlerFunc.params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
runDialogOptionMouseClickHandlerFunc.params[1].SetInt32((mouseWheelTurn < 0) ? 9 : 8);
|
||||
run_function_on_non_blocking_thread(&runDialogOptionMouseClickHandlerFunc);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).params[0].SetDynamicObject(&ccDialogOptionsRendering, &ccDialogOptionsRendering);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).params[1].SetInt32((mouseWheelTurn < 0) ? 9 : 8);
|
||||
run_function_on_non_blocking_thread(&_GP(runDialogOptionMouseClickHandlerFunc));
|
||||
|
||||
if (!new_custom_render) {
|
||||
if (runDialogOptionMouseClickHandlerFunc.atLeastOneImplementationExists)
|
||||
if (_GP(runDialogOptionMouseClickHandlerFunc).atLeastOneImplementationExists)
|
||||
Redraw();
|
||||
return true; // continue running loop
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ extern GameSetup usetup;
|
||||
|
||||
|
||||
extern int convert_16bit_bgr;
|
||||
extern ScriptSystem scsystem;
|
||||
|
||||
extern AGSPlatformDriver *platform;
|
||||
|
||||
extern char noWalkBehindsAtAll;
|
||||
@ -697,7 +697,7 @@ void render_to_screen() {
|
||||
construct_engine_overlay();
|
||||
|
||||
// only vsync in full screen mode, it makes things worse in a window
|
||||
gfxDriver->EnableVsyncBeforeRender((scsystem.vsync > 0) && (!scsystem.windowed));
|
||||
gfxDriver->EnableVsyncBeforeRender((_GP(scsystem).vsync > 0) && (!_GP(scsystem).windowed));
|
||||
|
||||
bool succeeded = false;
|
||||
while (!succeeded) {
|
||||
|
@ -83,8 +83,8 @@ int run_claimable_event(const char *tsname, bool includeRoom, int numParams, con
|
||||
eventClaimed = EVENT_INPROGRESS;
|
||||
int toret;
|
||||
|
||||
if (includeRoom && roominst) {
|
||||
toret = RunScriptFunctionIfExists(roominst, tsname, numParams, params);
|
||||
if (includeRoom && _G(roominst)) {
|
||||
toret = RunScriptFunctionIfExists(_G(roominst), tsname, numParams, params);
|
||||
|
||||
if (eventClaimed == EVENT_CLAIMED) {
|
||||
eventClaimed = eventClaimedOldValue;
|
||||
@ -93,8 +93,8 @@ int run_claimable_event(const char *tsname, bool includeRoom, int numParams, con
|
||||
}
|
||||
|
||||
// run script modules
|
||||
for (int kk = 0; kk < numScriptModules; kk++) {
|
||||
toret = RunScriptFunctionIfExists(moduleInst[kk], tsname, numParams, params);
|
||||
for (int kk = 0; kk < _G(numScriptModules); kk++) {
|
||||
toret = RunScriptFunctionIfExists(_GP(moduleInst)[kk], tsname, numParams, params);
|
||||
|
||||
if (eventClaimed == EVENT_CLAIMED) {
|
||||
eventClaimed = eventClaimedOldValue;
|
||||
|
@ -455,8 +455,8 @@ void restore_game_dialog() {
|
||||
DisplayMessage(983);
|
||||
return;
|
||||
}
|
||||
if (inside_script) {
|
||||
curscript->queue_action(ePSARestoreGameDialog, 0, "RestoreGameDialog");
|
||||
if (_G(inside_script)) {
|
||||
_G(curscript)->queue_action(ePSARestoreGameDialog, 0, "RestoreGameDialog");
|
||||
return;
|
||||
}
|
||||
setup_for_dialog();
|
||||
@ -472,8 +472,8 @@ void save_game_dialog() {
|
||||
DisplayMessage(983);
|
||||
return;
|
||||
}
|
||||
if (inside_script) {
|
||||
curscript->queue_action(ePSASaveGameDialog, 0, "SaveGameDialog");
|
||||
if (_G(inside_script)) {
|
||||
_G(curscript)->queue_action(ePSASaveGameDialog, 0, "SaveGameDialog");
|
||||
return;
|
||||
}
|
||||
setup_for_dialog();
|
||||
@ -495,7 +495,7 @@ void unload_game_file() {
|
||||
|
||||
_GP(play).FreeViewportsAndCameras();
|
||||
|
||||
characterScriptObjNames.clear();
|
||||
_GP(characterScriptObjNames).clear();
|
||||
free(charextra);
|
||||
free(_G(mls));
|
||||
free(actsps);
|
||||
@ -504,43 +504,43 @@ void unload_game_file() {
|
||||
free(actspswbbmp);
|
||||
free(actspswbcache);
|
||||
|
||||
if ((gameinst != nullptr) && (gameinst->pc != 0)) {
|
||||
if ((_G(gameinst) != nullptr) && (_G(gameinst)->pc != 0)) {
|
||||
quit("Error: unload_game called while script still running");
|
||||
} else {
|
||||
delete gameinstFork;
|
||||
delete gameinst;
|
||||
gameinstFork = nullptr;
|
||||
gameinst = nullptr;
|
||||
delete _G(gameinstFork);
|
||||
delete _G(gameinst);
|
||||
_G(gameinstFork) = nullptr;
|
||||
_G(gameinst) = nullptr;
|
||||
}
|
||||
|
||||
gamescript.reset();
|
||||
_GP(gamescript).reset();
|
||||
|
||||
if ((dialogScriptsInst != nullptr) && (dialogScriptsInst->pc != 0)) {
|
||||
if ((_G(dialogScriptsInst) != nullptr) && (_G(dialogScriptsInst)->pc != 0)) {
|
||||
quit("Error: unload_game called while dialog script still running");
|
||||
} else if (dialogScriptsInst != nullptr) {
|
||||
delete dialogScriptsInst;
|
||||
dialogScriptsInst = nullptr;
|
||||
} else if (_G(dialogScriptsInst) != nullptr) {
|
||||
delete _G(dialogScriptsInst);
|
||||
_G(dialogScriptsInst) = nullptr;
|
||||
}
|
||||
|
||||
dialogScriptsScript.reset();
|
||||
_GP(dialogScriptsScript).reset();
|
||||
|
||||
for (int i = 0; i < numScriptModules; ++i) {
|
||||
delete moduleInstFork[i];
|
||||
delete moduleInst[i];
|
||||
scriptModules[i].reset();
|
||||
for (int i = 0; i < _G(numScriptModules); ++i) {
|
||||
delete _GP(moduleInstFork)[i];
|
||||
delete _GP(moduleInst)[i];
|
||||
_GP(scriptModules)[i].reset();
|
||||
}
|
||||
moduleInstFork.resize(0);
|
||||
moduleInst.resize(0);
|
||||
scriptModules.resize(0);
|
||||
repExecAlways.moduleHasFunction.resize(0);
|
||||
lateRepExecAlways.moduleHasFunction.resize(0);
|
||||
getDialogOptionsDimensionsFunc.moduleHasFunction.resize(0);
|
||||
renderDialogOptionsFunc.moduleHasFunction.resize(0);
|
||||
getDialogOptionUnderCursorFunc.moduleHasFunction.resize(0);
|
||||
runDialogOptionMouseClickHandlerFunc.moduleHasFunction.resize(0);
|
||||
runDialogOptionKeyPressHandlerFunc.moduleHasFunction.resize(0);
|
||||
runDialogOptionRepExecFunc.moduleHasFunction.resize(0);
|
||||
numScriptModules = 0;
|
||||
_GP(moduleInstFork).resize(0);
|
||||
_GP(moduleInst).resize(0);
|
||||
_GP(scriptModules).resize(0);
|
||||
_GP(repExecAlways).moduleHasFunction.resize(0);
|
||||
_GP(lateRepExecAlways).moduleHasFunction.resize(0);
|
||||
_GP(getDialogOptionsDimensionsFunc).moduleHasFunction.resize(0);
|
||||
_GP(renderDialogOptionsFunc).moduleHasFunction.resize(0);
|
||||
_GP(getDialogOptionUnderCursorFunc).moduleHasFunction.resize(0);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).moduleHasFunction.resize(0);
|
||||
_GP(runDialogOptionKeyPressHandlerFunc).moduleHasFunction.resize(0);
|
||||
_GP(runDialogOptionRepExecFunc).moduleHasFunction.resize(0);
|
||||
_G(numScriptModules) = 0;
|
||||
|
||||
free(_G(views));
|
||||
_G(views) = nullptr;
|
||||
@ -574,7 +574,7 @@ void unload_game_file() {
|
||||
guibg[i] = nullptr;
|
||||
}
|
||||
|
||||
guiScriptObjNames.clear();
|
||||
_GP(guiScriptObjNames).clear();
|
||||
free(guibg);
|
||||
_GP(guis).clear();
|
||||
free(_G(scrGui));
|
||||
@ -1007,8 +1007,8 @@ void save_game(int slotn, const char *descript) {
|
||||
// the state of blocked scripts
|
||||
can_run_delayed_command();
|
||||
|
||||
if (inside_script) {
|
||||
strcpy(curscript->postScriptSaveSlotDescription[curscript->queue_action(ePSASaveGame, slotn, "SaveGameSlot")], descript);
|
||||
if (_G(inside_script)) {
|
||||
strcpy(_G(curscript)->postScriptSaveSlotDescription[_G(curscript)->queue_action(ePSASaveGame, slotn, "SaveGameSlot")], descript);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1083,11 +1083,11 @@ HSaveError restore_game_scripts(Stream *in, const PreservedParams &pp, RestoredD
|
||||
r_data.GlobalScript.Data.reset(new char[gdatasize]);
|
||||
in->Read(r_data.GlobalScript.Data.get(), gdatasize);
|
||||
|
||||
if (in->ReadInt32() != numScriptModules) {
|
||||
if (in->ReadInt32() != _G(numScriptModules)) {
|
||||
return new SavegameError(kSvgErr_GameContentAssertion, "Mismatching number of script modules.");
|
||||
}
|
||||
r_data.ScriptModules.resize(numScriptModules);
|
||||
for (int i = 0; i < numScriptModules; ++i) {
|
||||
r_data.ScriptModules.resize(_G(numScriptModules));
|
||||
for (int i = 0; i < _G(numScriptModules); ++i) {
|
||||
size_t module_size = in->ReadInt32();
|
||||
if (pp.ScMdDataSize[i] != (int)module_size) {
|
||||
return new SavegameError(kSvgErr_GameContentAssertion, String::FromFormat("Mismatching size of script module data, module %d.", i));
|
||||
@ -1787,7 +1787,7 @@ void display_switch_in() {
|
||||
platform->DisplaySwitchIn();
|
||||
ags_clear_input_buffer();
|
||||
// If auto lock option is set, lock mouse to the game window
|
||||
if (usetup.mouse_auto_lock && scsystem.windowed)
|
||||
if (usetup.mouse_auto_lock && _GP(scsystem).windowed)
|
||||
Mouse::TryLockToWindow();
|
||||
}
|
||||
|
||||
@ -2278,7 +2278,7 @@ void RegisterStaticObjects() {
|
||||
ccAddExternalStaticObject("gs_globals", &_GP(play).globalvars[0], &GlobalStaticManager);
|
||||
ccAddExternalStaticObject("mouse", &scmouse, &GlobalStaticManager);
|
||||
ccAddExternalStaticObject("palette", &palette[0], &GlobalStaticManager);
|
||||
ccAddExternalStaticObject("system", &scsystem, &GlobalStaticManager);
|
||||
ccAddExternalStaticObject("system", &_GP(scsystem), &GlobalStaticManager);
|
||||
ccAddExternalStaticObject("savegameindex", &_GP(play).filenumbers[0], &GlobalStaticManager);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ using namespace AGS::Engine;
|
||||
|
||||
|
||||
extern CharacterInfo *playerchar;
|
||||
extern ScriptSystem scsystem;
|
||||
|
||||
|
||||
GameState::GameState() {
|
||||
Common::fill(&globalvars[0], &globalvars[MAXGLOBALVARS], 0);
|
||||
@ -84,8 +84,8 @@ void GameState::SetAutoRoomViewport(bool on) {
|
||||
void GameState::SetMainViewport(const Rect &viewport) {
|
||||
_mainViewport.SetRect(viewport);
|
||||
Mouse::SetGraphicArea();
|
||||
scsystem.viewport_width = game_to_data_coord(_mainViewport.GetRect().GetWidth());
|
||||
scsystem.viewport_height = game_to_data_coord(_mainViewport.GetRect().GetHeight());
|
||||
_GP(scsystem).viewport_width = game_to_data_coord(_mainViewport.GetRect().GetWidth());
|
||||
_GP(scsystem).viewport_height = game_to_data_coord(_mainViewport.GetRect().GetHeight());
|
||||
_mainViewportHasChanged = true;
|
||||
}
|
||||
|
||||
|
@ -57,8 +57,8 @@ void RunDialog(int tum) {
|
||||
|
||||
get_script_position(last_in_dialog_request_script_pos);
|
||||
|
||||
if (inside_script)
|
||||
curscript->queue_action(ePSARunDialog, tum, "RunDialog");
|
||||
if (_G(inside_script))
|
||||
_G(curscript)->queue_action(ePSARunDialog, tum, "RunDialog");
|
||||
else
|
||||
do_conversation(tum);
|
||||
}
|
||||
|
@ -77,20 +77,14 @@ using namespace AGS::Shared;
|
||||
|
||||
#define ALLEGRO_KEYBOARD_HANDLER
|
||||
|
||||
|
||||
extern ExecutingScript *curscript;
|
||||
extern int displayed_room;
|
||||
extern int game_paused;
|
||||
|
||||
extern char gamefilenamebuf[200];
|
||||
extern GameSetup usetup;
|
||||
extern unsigned int load_new_game;
|
||||
extern int load_new_game_restore;
|
||||
|
||||
|
||||
extern RoomStatus *croom;
|
||||
extern int gui_disabled_style;
|
||||
|
||||
extern int getloctype_index;
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
extern color palette[256];
|
||||
@ -111,8 +105,8 @@ void GiveScore(int amnt) {
|
||||
|
||||
void restart_game() {
|
||||
can_run_delayed_command();
|
||||
if (inside_script) {
|
||||
curscript->queue_action(ePSARestartGame, 0, "RestartGame");
|
||||
if (_G(inside_script)) {
|
||||
_G(curscript)->queue_action(ePSARestartGame, 0, "RestartGame");
|
||||
return;
|
||||
}
|
||||
try_restore_save(RESTART_POINT_SAVE_GAME_NUMBER);
|
||||
@ -123,8 +117,8 @@ void RestoreGameSlot(int slnum) {
|
||||
quit("!RestoreGameSlot: a game cannot be restored from within game_start");
|
||||
|
||||
can_run_delayed_command();
|
||||
if (inside_script) {
|
||||
curscript->queue_action(ePSARestoreGame, slnum, "RestoreGameSlot");
|
||||
if (_G(inside_script)) {
|
||||
_G(curscript)->queue_action(ePSARestoreGame, slnum, "RestoreGameSlot");
|
||||
return;
|
||||
}
|
||||
try_restore_save(slnum);
|
||||
@ -258,8 +252,8 @@ int RunAGSGame(const char *newgame, unsigned int mode, int data) {
|
||||
_GP(play).takeover_data = data;
|
||||
load_new_game_restore = -1;
|
||||
|
||||
if (inside_script) {
|
||||
curscript->queue_action(ePSARunAGSGame, mode | RAGMODE_LOADNOW, "RunAGSGame");
|
||||
if (_G(inside_script)) {
|
||||
_G(curscript)->queue_action(ePSARunAGSGame, mode | RAGMODE_LOADNOW, "RunAGSGame");
|
||||
ccInstance::GetCurrentInstance()->Abort();
|
||||
} else
|
||||
load_new_game = mode | RAGMODE_LOADNOW;
|
||||
@ -869,7 +863,7 @@ void SetMultitasking(int mode) {
|
||||
}
|
||||
|
||||
// Don't allow background running if full screen
|
||||
if ((mode == 1) && (!scsystem.windowed))
|
||||
if ((mode == 1) && (!_GP(scsystem).windowed))
|
||||
mode = 0;
|
||||
|
||||
if (mode == 0) {
|
||||
|
@ -30,11 +30,8 @@
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
extern ExecutingScript *curscript;
|
||||
|
||||
|
||||
void sc_invscreen() {
|
||||
curscript->queue_action(ePSAInvScreen, 0, "InventoryScreen");
|
||||
_G(curscript)->queue_action(ePSAInvScreen, 0, "InventoryScreen");
|
||||
}
|
||||
|
||||
void SetInvDimensions(int ww, int hh) {
|
||||
|
@ -120,11 +120,11 @@ void NewRoom(int nrnum) {
|
||||
} else if (in_inv_screen) {
|
||||
inv_screen_newroom = nrnum;
|
||||
return;
|
||||
} else if ((inside_script == 0) & (in_graph_script == 0)) {
|
||||
} else if ((_G(inside_script) == 0) & (_G(in_graph_script) == 0)) {
|
||||
new_room(nrnum, playerchar);
|
||||
return;
|
||||
} else if (inside_script) {
|
||||
curscript->queue_action(ePSANewRoom, nrnum, "NewRoom");
|
||||
} else if (_G(inside_script)) {
|
||||
_G(curscript)->queue_action(ePSANewRoom, nrnum, "NewRoom");
|
||||
// we might be within a MoveCharacterBlocking -- the room
|
||||
// change should abort it
|
||||
if ((playerchar->walking > 0) && (playerchar->walking < TURNING_AROUND)) {
|
||||
@ -133,7 +133,7 @@ void NewRoom(int nrnum) {
|
||||
_G(mls)[playerchar->walking].direct = 1;
|
||||
StopMoving(_GP(game).playercharacter);
|
||||
}
|
||||
} else if (in_graph_script)
|
||||
} else if (_G(in_graph_script))
|
||||
gs_to_newroom = nrnum;
|
||||
}
|
||||
|
||||
@ -179,12 +179,12 @@ int HasPlayerBeenInRoom(int roomnum) {
|
||||
void CallRoomScript(int value) {
|
||||
can_run_delayed_command();
|
||||
|
||||
if (!inside_script)
|
||||
if (!_G(inside_script))
|
||||
quit("!CallRoomScript: not inside a script???");
|
||||
|
||||
_GP(play).roomscript_finished = 0;
|
||||
RuntimeScriptValue rval_null;
|
||||
curscript->run_another("on_call", kScInstRoom, 1, RuntimeScriptValue().SetInt32(value), rval_null);
|
||||
_G(curscript)->run_another("on_call", kScInstRoom, 1, RuntimeScriptValue().SetInt32(value), rval_null);
|
||||
}
|
||||
|
||||
int HasBeenToRoom(int roomnum) {
|
||||
|
@ -64,22 +64,12 @@ namespace AGS3 {
|
||||
using namespace AGS::Shared;
|
||||
using namespace AGS::Engine;
|
||||
|
||||
|
||||
extern GameSetup usetup;
|
||||
|
||||
extern int cur_mode, cur_cursor;
|
||||
extern ccInstance *gameinst;
|
||||
|
||||
|
||||
|
||||
extern Bitmap **guibg;
|
||||
extern IDriverDependantBitmap **guibgbmp;
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ifacepopped = -1; // currently displayed pop-up GUI (-1 if none)
|
||||
int mouse_on_iface = -1; // mouse cursor is over this interface
|
||||
int mouse_ifacebut_xoffs = -1, mouse_ifacebut_yoffs = -1;
|
||||
@ -363,7 +353,7 @@ void process_interface_click(int ifce, int btn, int mbut) {
|
||||
// otherwise, run interface_click
|
||||
if ((theObj->GetEventCount() > 0) &&
|
||||
(!theObj->EventHandlers[0].IsEmpty()) &&
|
||||
(!gameinst->GetSymbolAddress(theObj->EventHandlers[0]).IsNull())) {
|
||||
(!_G(gameinst)->GetSymbolAddress(theObj->EventHandlers[0]).IsNull())) {
|
||||
// control-specific event handler
|
||||
if (strchr(theObj->GetEventArgs(0), ',') != nullptr)
|
||||
QueueScriptFunction(kScInstGame, theObj->EventHandlers[0], 2,
|
||||
|
@ -54,7 +54,7 @@ using namespace AGS::Engine;
|
||||
|
||||
|
||||
|
||||
extern ScriptSystem scsystem;
|
||||
|
||||
|
||||
extern CharacterInfo *playerchar;
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
@ -328,7 +328,7 @@ int IsModeEnabled(int which) {
|
||||
void Mouse_EnableControl(bool on) {
|
||||
usetup.mouse_ctrl_enabled = on; // remember setting in config
|
||||
|
||||
bool is_windowed = scsystem.windowed != 0;
|
||||
bool is_windowed = _GP(scsystem).windowed != 0;
|
||||
// Whether mouse movement should be controlled by the engine - this is
|
||||
// determined based on related config option.
|
||||
bool should_control_mouse = usetup.mouse_ctrl_when == kMouseCtrl_Always ||
|
||||
|
@ -74,7 +74,6 @@
|
||||
#include "ags/engine/gfx/gfxfilter.h"
|
||||
#include "ags/shared/util/math.h"
|
||||
#include "ags/engine/media/audio/audio_system.h"
|
||||
|
||||
#include "ags/shared/debugging/out.h"
|
||||
#include "ags/engine/script/script_api.h"
|
||||
#include "ags/engine/script/script_runtime.h"
|
||||
@ -92,17 +91,13 @@ extern GameSetup usetup;
|
||||
extern RoomStatus *croom;
|
||||
extern int displayed_room;
|
||||
extern RoomObject *objs;
|
||||
extern ccInstance *roominst;
|
||||
extern AGSPlatformDriver *platform;
|
||||
extern int numevents;
|
||||
|
||||
|
||||
extern CharacterExtras *charextra;
|
||||
extern int done_es_error;
|
||||
extern int our_eip;
|
||||
extern Bitmap *walkareabackup, *walkable_areas_temp;
|
||||
|
||||
|
||||
extern int in_new_room, new_room_was; // 1 in new room, 2 first time in new room, 3 loading saved game
|
||||
|
||||
extern int in_leaves_screen;
|
||||
@ -243,10 +238,10 @@ void convert_room_background_to_game_res() {
|
||||
void save_room_data_segment() {
|
||||
croom->FreeScriptData();
|
||||
|
||||
croom->tsdatasize = roominst->globaldatasize;
|
||||
croom->tsdatasize = _G(roominst)->globaldatasize;
|
||||
if (croom->tsdatasize > 0) {
|
||||
croom->tsdata = (char *)malloc(croom->tsdatasize + 10);
|
||||
memcpy(croom->tsdata, &roominst->globaldata[0], croom->tsdatasize);
|
||||
memcpy(croom->tsdata, &_G(roominst)->globaldata[0], croom->tsdatasize);
|
||||
}
|
||||
|
||||
}
|
||||
@ -281,12 +276,12 @@ void unload_old_room() {
|
||||
}
|
||||
|
||||
if (croom == nullptr) ;
|
||||
else if (roominst != nullptr) {
|
||||
else if (_G(roominst) != nullptr) {
|
||||
save_room_data_segment();
|
||||
delete roominstFork;
|
||||
delete roominst;
|
||||
roominstFork = nullptr;
|
||||
roominst = nullptr;
|
||||
delete _G(roominstFork);
|
||||
delete _G(roominst);
|
||||
_G(roominstFork) = nullptr;
|
||||
_G(roominst) = nullptr;
|
||||
} else croom->tsdatasize = 0;
|
||||
memset(&_GP(play).walkable_areas_on[0], 1, MAX_WALK_AREAS + 1);
|
||||
_GP(play).bg_frame = 0;
|
||||
@ -315,10 +310,10 @@ void unload_old_room() {
|
||||
|
||||
for (ff = 0; ff < croom->numobj; ff++) {
|
||||
// un-export the object's script object
|
||||
if (objectScriptObjNames[ff].IsEmpty())
|
||||
if (_G(objectScriptObjNames)[ff].IsEmpty())
|
||||
continue;
|
||||
|
||||
ccRemoveExternalSymbol(objectScriptObjNames[ff]);
|
||||
ccRemoveExternalSymbol(_G(objectScriptObjNames)[ff]);
|
||||
}
|
||||
|
||||
for (ff = 0; ff < MAX_ROOM_HOTSPOTS; ff++) {
|
||||
@ -643,15 +638,15 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
|
||||
for (cc = 0; cc < MAX_ROOM_OBJECTS; cc++) {
|
||||
// 64 bit: Using the id instead
|
||||
// _G(scrObj)[cc].obj = &croom->obj[cc];
|
||||
objectScriptObjNames[cc].Free();
|
||||
_G(objectScriptObjNames)[cc].Free();
|
||||
}
|
||||
|
||||
for (cc = 0; cc < croom->numobj; cc++) {
|
||||
// export the object's script object
|
||||
if (_GP(thisroom).Objects[cc].ScriptName.IsEmpty())
|
||||
continue;
|
||||
objectScriptObjNames[cc] = _GP(thisroom).Objects[cc].ScriptName;
|
||||
ccAddExternalDynamicObject(objectScriptObjNames[cc], &_G(scrObj)[cc], &_GP(ccDynamicObject));
|
||||
_G(objectScriptObjNames)[cc] = _GP(thisroom).Objects[cc].ScriptName;
|
||||
ccAddExternalDynamicObject(_G(objectScriptObjNames)[cc], &_G(scrObj)[cc], &_GP(ccDynamicObject));
|
||||
}
|
||||
|
||||
for (cc = 0; cc < MAX_ROOM_HOTSPOTS; cc++) {
|
||||
@ -720,14 +715,14 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
|
||||
|
||||
update_polled_stuff_if_runtime();
|
||||
|
||||
roominst = nullptr;
|
||||
_G(roominst) = nullptr;
|
||||
if (debug_flags & DBG_NOSCRIPT) ;
|
||||
else if (_GP(thisroom).CompiledScript != nullptr) {
|
||||
compile_room_script();
|
||||
if (croom->tsdatasize > 0) {
|
||||
if (croom->tsdatasize != roominst->globaldatasize)
|
||||
if (croom->tsdatasize != _G(roominst)->globaldatasize)
|
||||
quit("room script data segment size has changed");
|
||||
memcpy(&roominst->globaldata[0], croom->tsdata, croom->tsdatasize);
|
||||
memcpy(&_G(roominst)->globaldata[0], croom->tsdata, croom->tsdatasize);
|
||||
}
|
||||
}
|
||||
our_eip = 207;
|
||||
@ -1003,19 +998,19 @@ void check_new_room() {
|
||||
void compile_room_script() {
|
||||
ccError = 0;
|
||||
|
||||
roominst = ccInstance::CreateFromScript(_GP(thisroom).CompiledScript);
|
||||
_G(roominst) = ccInstance::CreateFromScript(_GP(thisroom).CompiledScript);
|
||||
|
||||
if ((ccError != 0) || (roominst == nullptr)) {
|
||||
if ((ccError != 0) || (_G(roominst) == nullptr)) {
|
||||
quitprintf("Unable to create local script: %s", ccErrorString.GetCStr());
|
||||
}
|
||||
|
||||
roominstFork = roominst->Fork();
|
||||
if (roominstFork == nullptr)
|
||||
_G(roominstFork) = _G(roominst)->Fork();
|
||||
if (_G(roominstFork) == nullptr)
|
||||
quitprintf("Unable to create forked room instance: %s", ccErrorString.GetCStr());
|
||||
|
||||
repExecAlways.roomHasFunction = true;
|
||||
lateRepExecAlways.roomHasFunction = true;
|
||||
getDialogOptionsDimensionsFunc.roomHasFunction = true;
|
||||
_GP(repExecAlways).roomHasFunction = true;
|
||||
_GP(lateRepExecAlways).roomHasFunction = true;
|
||||
_GP(getDialogOptionsDimensionsFunc).roomHasFunction = true;
|
||||
}
|
||||
|
||||
int bg_just_changed = 0;
|
||||
|
@ -54,7 +54,7 @@ using namespace AGS::Engine;
|
||||
|
||||
extern GameSetup usetup;
|
||||
extern ScriptAudioChannel scrAudioChannel[MAX_SOUND_CHANNELS + 1];
|
||||
extern ScriptSystem scsystem;
|
||||
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
|
||||
extern volatile bool switched_away;
|
||||
@ -64,11 +64,11 @@ bool System_HasInputFocus() {
|
||||
}
|
||||
|
||||
int System_GetColorDepth() {
|
||||
return scsystem.coldepth;
|
||||
return _GP(scsystem).coldepth;
|
||||
}
|
||||
|
||||
int System_GetOS() {
|
||||
return scsystem.os;
|
||||
return _GP(scsystem).os;
|
||||
}
|
||||
|
||||
// [IKM] 2014-09-21
|
||||
@ -133,20 +133,20 @@ void System_SetNumLock(int newValue) {
|
||||
}
|
||||
|
||||
int System_GetVsync() {
|
||||
return scsystem.vsync;
|
||||
return _GP(scsystem).vsync;
|
||||
}
|
||||
|
||||
void System_SetVsync(int newValue) {
|
||||
if (ags_stricmp(gfxDriver->GetDriverID(), "D3D9") != 0)
|
||||
scsystem.vsync = newValue;
|
||||
_GP(scsystem).vsync = newValue;
|
||||
}
|
||||
|
||||
int System_GetWindowed() {
|
||||
return scsystem.windowed;
|
||||
return _GP(scsystem).windowed;
|
||||
}
|
||||
|
||||
void System_SetWindowed(int windowed) {
|
||||
if (windowed != scsystem.windowed)
|
||||
if (windowed != _GP(scsystem).windowed)
|
||||
engine_try_switch_windowed_gfxmode();
|
||||
}
|
||||
|
||||
|
@ -291,11 +291,11 @@ void debug_script_print(const String &msg, MessageType mt) {
|
||||
ccInstance *curinst = ccInstance::GetCurrentInstance();
|
||||
if (curinst != nullptr) {
|
||||
String scriptname;
|
||||
if (curinst->instanceof == gamescript)
|
||||
if (curinst->instanceof == _GP(gamescript))
|
||||
scriptname = "G ";
|
||||
else if (curinst->instanceof == _GP(thisroom).CompiledScript)
|
||||
scriptname = "R ";
|
||||
else if (curinst->instanceof == dialogScriptsScript)
|
||||
else if (curinst->instanceof == _GP(dialogScriptsScript))
|
||||
scriptname = "D ";
|
||||
else
|
||||
scriptname = "? ";
|
||||
|
@ -79,10 +79,6 @@ extern StaticArray StaticRegionArray;
|
||||
extern StaticArray StaticInventoryArray;
|
||||
extern StaticArray StaticDialogArray;
|
||||
|
||||
extern std::vector<ccInstance *> moduleInst;
|
||||
extern std::vector<ccInstance *> moduleInstFork;
|
||||
extern std::vector<RuntimeScriptValue> moduleRepExecAddr;
|
||||
|
||||
// Old dialog support (defined in ac/dialog)
|
||||
extern std::vector< std::shared_ptr<unsigned char> > old_dialog_scripts;
|
||||
extern std::vector<String> old_speech_lines;
|
||||
@ -138,7 +134,7 @@ void InitAndRegisterAudioObjects() {
|
||||
|
||||
// Initializes characters and registers them in the script system
|
||||
void InitAndRegisterCharacters() {
|
||||
characterScriptObjNames.resize(_GP(game).numcharacters);
|
||||
_GP(characterScriptObjNames).resize(_GP(game).numcharacters);
|
||||
for (int i = 0; i < _GP(game).numcharacters; ++i) {
|
||||
_GP(game).chars[i].walking = 0;
|
||||
_GP(game).chars[i].animating = 0;
|
||||
@ -156,8 +152,8 @@ void InitAndRegisterCharacters() {
|
||||
ccRegisterManagedObject(&_GP(game).chars[i], &_GP(ccDynamicCharacter));
|
||||
|
||||
// export the character's script object
|
||||
characterScriptObjNames[i] = _GP(game).chars[i].scrname;
|
||||
ccAddExternalDynamicObject(characterScriptObjNames[i], &_GP(game).chars[i], &_GP(ccDynamicCharacter));
|
||||
_GP(characterScriptObjNames)[i] = _GP(game).chars[i].scrname;
|
||||
ccAddExternalDynamicObject(_GP(characterScriptObjNames)[i], &_GP(game).chars[i], &_GP(ccDynamicCharacter));
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +187,7 @@ HError InitAndRegisterGUI() {
|
||||
_G(scrGui)[i].id = -1;
|
||||
}
|
||||
|
||||
guiScriptObjNames.resize(_GP(game).numgui);
|
||||
_GP(guiScriptObjNames).resize(_GP(game).numgui);
|
||||
for (int i = 0; i < _GP(game).numgui; ++i) {
|
||||
// link controls to their parent guis
|
||||
HError err = _GP(guis)[i].RebuildArray();
|
||||
@ -201,9 +197,9 @@ HError InitAndRegisterGUI() {
|
||||
export_gui_controls(i);
|
||||
// copy the script name to its own memory location
|
||||
// because ccAddExtSymbol only keeps a reference
|
||||
guiScriptObjNames[i] = _GP(guis)[i].Name;
|
||||
_GP(guiScriptObjNames)[i] = _GP(guis)[i].Name;
|
||||
_G(scrGui)[i].id = i;
|
||||
ccAddExternalDynamicObject(guiScriptObjNames[i], &_G(scrGui)[i], &_GP(ccDynamicGUI));
|
||||
ccAddExternalDynamicObject(_GP(guiScriptObjNames)[i], &_G(scrGui)[i], &_GP(ccDynamicGUI));
|
||||
ccRegisterManagedObject(&_G(scrGui)[i], &_GP(ccDynamicGUI));
|
||||
}
|
||||
return HError::None();
|
||||
@ -297,19 +293,19 @@ void LoadFonts(GameDataVersion data_ver) {
|
||||
}
|
||||
|
||||
void AllocScriptModules() {
|
||||
moduleInst.resize(numScriptModules, nullptr);
|
||||
moduleInstFork.resize(numScriptModules, nullptr);
|
||||
moduleRepExecAddr.resize(numScriptModules);
|
||||
repExecAlways.moduleHasFunction.resize(numScriptModules, true);
|
||||
lateRepExecAlways.moduleHasFunction.resize(numScriptModules, true);
|
||||
getDialogOptionsDimensionsFunc.moduleHasFunction.resize(numScriptModules, true);
|
||||
renderDialogOptionsFunc.moduleHasFunction.resize(numScriptModules, true);
|
||||
getDialogOptionUnderCursorFunc.moduleHasFunction.resize(numScriptModules, true);
|
||||
runDialogOptionMouseClickHandlerFunc.moduleHasFunction.resize(numScriptModules, true);
|
||||
runDialogOptionKeyPressHandlerFunc.moduleHasFunction.resize(numScriptModules, true);
|
||||
runDialogOptionRepExecFunc.moduleHasFunction.resize(numScriptModules, true);
|
||||
for (int i = 0; i < numScriptModules; ++i) {
|
||||
moduleRepExecAddr[i].Invalidate();
|
||||
_GP(moduleInst).resize(_G(numScriptModules), nullptr);
|
||||
_GP(moduleInstFork).resize(_G(numScriptModules), nullptr);
|
||||
_GP(moduleRepExecAddr).resize(_G(numScriptModules));
|
||||
_GP(repExecAlways).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
_GP(lateRepExecAlways).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
_GP(getDialogOptionsDimensionsFunc).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
_GP(renderDialogOptionsFunc).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
_GP(getDialogOptionUnderCursorFunc).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
_GP(runDialogOptionMouseClickHandlerFunc).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
_GP(runDialogOptionKeyPressHandlerFunc).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
_GP(runDialogOptionRepExecFunc).moduleHasFunction.resize(_G(numScriptModules), true);
|
||||
for (int i = 0; i < _G(numScriptModules); ++i) {
|
||||
_GP(moduleRepExecAddr)[i].Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,10 +418,10 @@ HGameInitError InitGameState(const LoadedGameEntities &ents, GameDataVersion dat
|
||||
// NOTE: we must do this after plugins, because some plugins may export
|
||||
// script symbols too.
|
||||
//
|
||||
gamescript = ents.GlobalScript;
|
||||
dialogScriptsScript = ents.DialogScript;
|
||||
numScriptModules = ents.ScriptModules.size();
|
||||
scriptModules = ents.ScriptModules;
|
||||
_GP(gamescript) = ents.GlobalScript;
|
||||
_GP(dialogScriptsScript) = ents.DialogScript;
|
||||
_G(numScriptModules) = ents.ScriptModules.size();
|
||||
_GP(scriptModules) = ents.ScriptModules;
|
||||
AllocScriptModules();
|
||||
if (create_global_script())
|
||||
return new GameInitError(kGameInitErr_ScriptLinkFailed, ccErrorString);
|
||||
|
@ -356,29 +356,29 @@ void DoBeforeRestore(PreservedParams &pp) {
|
||||
}
|
||||
|
||||
// preserve script data sizes and cleanup scripts
|
||||
pp.GlScDataSize = gameinst->globaldatasize;
|
||||
delete gameinstFork;
|
||||
delete gameinst;
|
||||
gameinstFork = nullptr;
|
||||
gameinst = nullptr;
|
||||
pp.ScMdDataSize.resize(numScriptModules);
|
||||
for (int i = 0; i < numScriptModules; ++i) {
|
||||
pp.ScMdDataSize[i] = moduleInst[i]->globaldatasize;
|
||||
delete moduleInstFork[i];
|
||||
delete moduleInst[i];
|
||||
moduleInst[i] = nullptr;
|
||||
pp.GlScDataSize = _G(gameinst)->globaldatasize;
|
||||
delete _G(gameinstFork);
|
||||
delete _G(gameinst);
|
||||
_G(gameinstFork) = nullptr;
|
||||
_G(gameinst) = nullptr;
|
||||
pp.ScMdDataSize.resize(_G(numScriptModules));
|
||||
for (int i = 0; i < _G(numScriptModules); ++i) {
|
||||
pp.ScMdDataSize[i] = _GP(moduleInst)[i]->globaldatasize;
|
||||
delete _GP(moduleInstFork)[i];
|
||||
delete _GP(moduleInst)[i];
|
||||
_GP(moduleInst)[i] = nullptr;
|
||||
}
|
||||
|
||||
_GP(play).FreeProperties();
|
||||
_GP(play).FreeViewportsAndCameras();
|
||||
|
||||
delete roominstFork;
|
||||
delete roominst;
|
||||
roominstFork = nullptr;
|
||||
roominst = nullptr;
|
||||
delete _G(roominstFork);
|
||||
delete _G(roominst);
|
||||
_G(roominstFork) = nullptr;
|
||||
_G(roominst) = nullptr;
|
||||
|
||||
delete dialogScriptsInst;
|
||||
dialogScriptsInst = nullptr;
|
||||
delete _G(dialogScriptsInst);
|
||||
_G(dialogScriptsInst) = nullptr;
|
||||
|
||||
resetRoomStatuses();
|
||||
_GP(troom).FreeScriptData();
|
||||
@ -468,14 +468,14 @@ HSaveError DoAfterRestore(const PreservedParams &pp, const RestoredData &r_data)
|
||||
|
||||
// read the global data into the newly created script
|
||||
if (r_data.GlobalScript.Data.get())
|
||||
memcpy(gameinst->globaldata, r_data.GlobalScript.Data.get(),
|
||||
Math::Min((size_t)gameinst->globaldatasize, r_data.GlobalScript.Len));
|
||||
memcpy(_G(gameinst)->globaldata, r_data.GlobalScript.Data.get(),
|
||||
Math::Min((size_t)_G(gameinst)->globaldatasize, r_data.GlobalScript.Len));
|
||||
|
||||
// restore the script module data
|
||||
for (int i = 0; i < numScriptModules; ++i) {
|
||||
for (int i = 0; i < _G(numScriptModules); ++i) {
|
||||
if (r_data.ScriptModules[i].Data.get())
|
||||
memcpy(moduleInst[i]->globaldata, r_data.ScriptModules[i].Data.get(),
|
||||
Math::Min((size_t)moduleInst[i]->globaldatasize, r_data.ScriptModules[i].Len));
|
||||
memcpy(_GP(moduleInst)[i]->globaldata, r_data.ScriptModules[i].Data.get(),
|
||||
Math::Min((size_t)_GP(moduleInst)[i]->globaldatasize, r_data.ScriptModules[i].Len));
|
||||
}
|
||||
|
||||
setup_player_character(_GP(game).playercharacter);
|
||||
@ -731,7 +731,7 @@ void DoBeforeSave() {
|
||||
|
||||
if (displayed_room >= 0) {
|
||||
// update the current room script's data segment copy
|
||||
if (roominst)
|
||||
if (_G(roominst))
|
||||
save_room_data_segment();
|
||||
|
||||
// Update the saved interaction variable values
|
||||
|
@ -808,17 +808,17 @@ HSaveError ReadDynamicSurfaces(PStream in, int32_t cmp_ver, const PreservedParam
|
||||
|
||||
HSaveError WriteScriptModules(PStream out) {
|
||||
// write the data segment of the global script
|
||||
int data_len = gameinst->globaldatasize;
|
||||
int data_len = _G(gameinst)->globaldatasize;
|
||||
out->WriteInt32(data_len);
|
||||
if (data_len > 0)
|
||||
out->Write(gameinst->globaldata, data_len);
|
||||
out->Write(_G(gameinst)->globaldata, data_len);
|
||||
// write the script modules data segments
|
||||
out->WriteInt32(numScriptModules);
|
||||
for (int i = 0; i < numScriptModules; ++i) {
|
||||
data_len = moduleInst[i]->globaldatasize;
|
||||
out->WriteInt32(_G(numScriptModules));
|
||||
for (int i = 0; i < _G(numScriptModules); ++i) {
|
||||
data_len = _GP(moduleInst)[i]->globaldatasize;
|
||||
out->WriteInt32(data_len);
|
||||
if (data_len > 0)
|
||||
out->Write(moduleInst[i]->globaldata, data_len);
|
||||
out->Write(_GP(moduleInst)[i]->globaldata, data_len);
|
||||
}
|
||||
return HSaveError::None();
|
||||
}
|
||||
@ -833,10 +833,10 @@ HSaveError ReadScriptModules(PStream in, int32_t cmp_ver, const PreservedParams
|
||||
r_data.GlobalScript.Data.reset(new char[data_len]);
|
||||
in->Read(r_data.GlobalScript.Data.get(), data_len);
|
||||
|
||||
if (!AssertGameContent(err, in->ReadInt32(), numScriptModules, "Script Modules"))
|
||||
if (!AssertGameContent(err, in->ReadInt32(), _G(numScriptModules), "Script Modules"))
|
||||
return err;
|
||||
r_data.ScriptModules.resize(numScriptModules);
|
||||
for (int i = 0; i < numScriptModules; ++i) {
|
||||
r_data.ScriptModules.resize(_G(numScriptModules));
|
||||
for (int i = 0; i < _G(numScriptModules); ++i) {
|
||||
data_len = in->ReadInt32();
|
||||
if (!AssertGameObjectContent(err, data_len, pp.ScMdDataSize[i], "script module data", "module", i))
|
||||
return err;
|
||||
|
@ -96,7 +96,7 @@ extern int eip_guinum;
|
||||
extern int eip_guiobj;
|
||||
extern SpeechLipSyncLine *splipsync;
|
||||
extern int numLipLines, curLipLine, curLipLinePhoneme;
|
||||
extern ScriptSystem scsystem;
|
||||
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
extern Bitmap **actsps;
|
||||
extern color palette[256];
|
||||
@ -901,11 +901,11 @@ void engine_init_game_settings() {
|
||||
|
||||
void engine_setup_scsystem_auxiliary() {
|
||||
// ScriptSystem::aci_version is only 10 chars long
|
||||
strncpy(scsystem.aci_version, _G(EngineVersion).LongString, 10);
|
||||
strncpy(_GP(scsystem).aci_version, _G(EngineVersion).LongString, 10);
|
||||
if (usetup.override_script_os >= 0) {
|
||||
scsystem.os = usetup.override_script_os;
|
||||
_GP(scsystem).os = usetup.override_script_os;
|
||||
} else {
|
||||
scsystem.os = platform->GetSystemOSID();
|
||||
_GP(scsystem).os = platform->GetSystemOSID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ using namespace AGS::Shared;
|
||||
using namespace AGS::Engine;
|
||||
|
||||
|
||||
extern ScriptSystem scsystem;
|
||||
|
||||
extern int _places_r, _places_g, _places_b;
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
|
||||
@ -123,10 +123,10 @@ void convert_objects_to_data_resolution(GameDataVersion filever) {
|
||||
}
|
||||
|
||||
void engine_setup_system_gamesize() {
|
||||
scsystem.width = _GP(game).GetGameRes().Width;
|
||||
scsystem.height = _GP(game).GetGameRes().Height;
|
||||
scsystem.viewport_width = game_to_data_coord(_GP(play).GetMainViewport().GetWidth());
|
||||
scsystem.viewport_height = game_to_data_coord(_GP(play).GetMainViewport().GetHeight());
|
||||
_GP(scsystem).width = _GP(game).GetGameRes().Width;
|
||||
_GP(scsystem).height = _GP(game).GetGameRes().Height;
|
||||
_GP(scsystem).viewport_width = game_to_data_coord(_GP(play).GetMainViewport().GetWidth());
|
||||
_GP(scsystem).viewport_height = game_to_data_coord(_GP(play).GetMainViewport().GetHeight());
|
||||
}
|
||||
|
||||
void engine_init_resolution_settings(const Size game_size) {
|
||||
@ -281,7 +281,7 @@ void engine_post_gfxmode_mouse_setup(const DisplayMode &dm, const Size &init_des
|
||||
on_coordinates_scaling_changed();
|
||||
|
||||
// If auto lock option is set, lock mouse to the game window
|
||||
if (usetup.mouse_auto_lock && scsystem.windowed != 0)
|
||||
if (usetup.mouse_auto_lock && _GP(scsystem).windowed != 0)
|
||||
Mouse::TryLockToWindow();
|
||||
}
|
||||
|
||||
@ -294,16 +294,16 @@ void engine_pre_gfxmode_mouse_cleanup() {
|
||||
|
||||
// Fill in scsystem struct with display mode parameters
|
||||
void engine_setup_scsystem_screen(const DisplayMode &dm) {
|
||||
scsystem.coldepth = dm.ColorDepth;
|
||||
scsystem.windowed = dm.Windowed;
|
||||
scsystem.vsync = dm.Vsync;
|
||||
_GP(scsystem).coldepth = dm.ColorDepth;
|
||||
_GP(scsystem).windowed = dm.Windowed;
|
||||
_GP(scsystem).vsync = dm.Vsync;
|
||||
}
|
||||
|
||||
void engine_post_gfxmode_setup(const Size &init_desktop) {
|
||||
DisplayMode dm = gfxDriver->GetDisplayMode();
|
||||
// If color depth has changed (or graphics mode was inited for the
|
||||
// very first time), we also need to recreate bitmaps
|
||||
bool has_driver_changed = scsystem.coldepth != dm.ColorDepth;
|
||||
bool has_driver_changed = _GP(scsystem).coldepth != dm.ColorDepth;
|
||||
|
||||
engine_setup_scsystem_screen(dm);
|
||||
engine_post_gfxmode_driver_setup();
|
||||
@ -316,7 +316,7 @@ void engine_post_gfxmode_setup(const Size &init_desktop) {
|
||||
// "windowed" flag to be specified. Find out whether this function
|
||||
// has anything to do with graphics mode at all. It is quite possible
|
||||
// that we may split it into two functions, or remove parameter.
|
||||
platform->PostAllegroInit(scsystem.windowed != 0);
|
||||
platform->PostAllegroInit(_GP(scsystem).windowed != 0);
|
||||
|
||||
video_on_gfxmode_changed();
|
||||
invalidate_screen();
|
||||
|
@ -60,14 +60,8 @@ using namespace AGS::Shared;
|
||||
using namespace AGS::Engine;
|
||||
|
||||
extern int ifacepopped;
|
||||
|
||||
|
||||
|
||||
extern DialogTopic *dialog;
|
||||
|
||||
extern AGSPlatformDriver *platform;
|
||||
extern int numScriptModules;
|
||||
|
||||
|
||||
// Test if engine supports extended capabilities required to run the game
|
||||
bool test_game_caps(const std::set<String> &caps, std::set<String> &failed_caps) {
|
||||
|
@ -86,8 +86,6 @@ extern int game_paused;
|
||||
extern int getloctype_index;
|
||||
extern int in_enters_screen, done_es_error;
|
||||
extern int in_leaves_screen;
|
||||
extern int inside_script, in_graph_script;
|
||||
extern int no_blocking_functions;
|
||||
extern CharacterInfo *playerchar;
|
||||
extern int mouse_ifacebut_xoffs, mouse_ifacebut_yoffs;
|
||||
extern int cur_mode;
|
||||
@ -136,14 +134,14 @@ static void game_loop_check_problems_at_start() {
|
||||
debug_script_warn("Wait() was used in Player Enters Screen - use Enters Screen After Fadein instead");
|
||||
done_es_error = 1;
|
||||
}
|
||||
if (no_blocking_functions)
|
||||
if (_G(no_blocking_functions))
|
||||
quit("!A blocking function was called from within a non-blocking event such as " REP_EXEC_ALWAYS_NAME);
|
||||
}
|
||||
|
||||
static void game_loop_check_new_room() {
|
||||
if (in_new_room == 0) {
|
||||
// Run the room and game script repeatedly_execute
|
||||
run_function_on_non_blocking_thread(&repExecAlways);
|
||||
run_function_on_non_blocking_thread(&_GP(repExecAlways));
|
||||
setevent(EV_TEXTSCRIPT, TS_REPEAT);
|
||||
setevent(EV_RUNEVBLOCK, EVB_ROOM, 0, 6);
|
||||
}
|
||||
@ -155,7 +153,7 @@ static void game_loop_check_new_room() {
|
||||
static void game_loop_do_late_update() {
|
||||
if (in_new_room == 0) {
|
||||
// Run the room and game script late_repeatedly_execute
|
||||
run_function_on_non_blocking_thread(&lateRepExecAlways);
|
||||
run_function_on_non_blocking_thread(&_GP(lateRepExecAlways));
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,12 +204,12 @@ static int game_loop_check_ground_level_interactions() {
|
||||
}
|
||||
|
||||
static void lock_mouse_on_click() {
|
||||
if (usetup.mouse_auto_lock && scsystem.windowed)
|
||||
if (usetup.mouse_auto_lock && _GP(scsystem).windowed)
|
||||
Mouse::TryLockToWindow();
|
||||
}
|
||||
|
||||
static void toggle_mouse_lock() {
|
||||
if (scsystem.windowed) {
|
||||
if (_GP(scsystem).windowed) {
|
||||
if (Mouse::IsLockedToWindow())
|
||||
Mouse::UnlockFromWindow();
|
||||
else
|
||||
@ -265,7 +263,7 @@ static void check_mouse_controls() {
|
||||
wasongui = mongu;
|
||||
wasbutdown = mbut + 1;
|
||||
} else setevent(EV_TEXTSCRIPT, TS_MCLICK, mbut + 1);
|
||||
// else RunTextScriptIParam(gameinst,"on_mouse_click",aa+1);
|
||||
// else RunTextScriptIParam(_G(gameinst),"on_mouse_click",aa+1);
|
||||
}
|
||||
|
||||
if (mwheelz < 0)
|
||||
@ -483,7 +481,7 @@ static void check_keyboard_controls() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inside_script) {
|
||||
if (_G(inside_script)) {
|
||||
// Don't queue up another keypress if it can't be run instantly
|
||||
debug_script_log("Keypress %d ignored (game blocked)", kgn);
|
||||
return;
|
||||
@ -539,7 +537,7 @@ static void check_keyboard_controls() {
|
||||
setevent(EV_TEXTSCRIPT, TS_KEYPRESS, kgn);
|
||||
}
|
||||
|
||||
// RunTextScriptIParam(gameinst,"on_key_press",kgn);
|
||||
// RunTextScriptIParam(_G(gameinst),"on_key_press",kgn);
|
||||
}
|
||||
|
||||
// check_controls: checks mouse & keyboard interface
|
||||
|
@ -53,9 +53,6 @@ using namespace AGS::Shared;
|
||||
using namespace AGS::Engine;
|
||||
|
||||
extern int our_eip, displayed_room;
|
||||
|
||||
extern std::vector<ccInstance *> moduleInst;
|
||||
extern int numScriptModules;
|
||||
extern CharacterInfo *playerchar;
|
||||
extern int convert_16bit_bgr;
|
||||
|
||||
@ -91,10 +88,10 @@ void start_game() {
|
||||
// skip ticks to account for initialisation or a restored _GP(game).
|
||||
skipMissedTicks();
|
||||
|
||||
for (int kk = 0; kk < numScriptModules; kk++)
|
||||
RunTextScript(moduleInst[kk], "game_start");
|
||||
for (int kk = 0; kk < _G(numScriptModules); kk++)
|
||||
RunTextScript(_GP(moduleInst)[kk], "game_start");
|
||||
|
||||
RunTextScript(gameinst, "game_start");
|
||||
RunTextScript(_G(gameinst), "game_start");
|
||||
|
||||
our_eip = -43;
|
||||
|
||||
|
@ -52,7 +52,7 @@ using namespace AGS::Shared::Memory;
|
||||
|
||||
extern ccInstance *loadedInstances[MAX_LOADED_INSTANCES]; // in script/script_runtime
|
||||
extern int gameHasBeenRestored; // in ac/game
|
||||
extern ExecutingScript *curscript; // in script/script
|
||||
// in script/script
|
||||
extern int maxWhileLoops;
|
||||
extern new_line_hook_type new_line_hook;
|
||||
|
||||
|
@ -60,46 +60,9 @@ extern RoomObject *objs;
|
||||
extern int our_eip;
|
||||
extern CharacterInfo *playerchar;
|
||||
|
||||
ExecutingScript scripts[MAX_SCRIPT_AT_ONCE];
|
||||
ExecutingScript *curscript = nullptr;
|
||||
|
||||
PScript gamescript;
|
||||
PScript dialogScriptsScript;
|
||||
ccInstance *gameinst = nullptr, *roominst = nullptr;
|
||||
ccInstance *dialogScriptsInst = nullptr;
|
||||
ccInstance *gameinstFork = nullptr, *roominstFork = nullptr;
|
||||
|
||||
int num_scripts = 0;
|
||||
int post_script_cleanup_stack = 0;
|
||||
|
||||
int inside_script = 0, in_graph_script = 0;
|
||||
int no_blocking_functions = 0; // set to 1 while in rep_Exec_always
|
||||
|
||||
NonBlockingScriptFunction repExecAlways(REP_EXEC_ALWAYS_NAME, 0);
|
||||
NonBlockingScriptFunction lateRepExecAlways(LATE_REP_EXEC_ALWAYS_NAME, 0);
|
||||
NonBlockingScriptFunction getDialogOptionsDimensionsFunc("dialog_options_get_dimensions", 1);
|
||||
NonBlockingScriptFunction renderDialogOptionsFunc("dialog_options_render", 1);
|
||||
NonBlockingScriptFunction getDialogOptionUnderCursorFunc("dialog_options_get_active", 1);
|
||||
NonBlockingScriptFunction runDialogOptionMouseClickHandlerFunc("dialog_options_mouse_click", 2);
|
||||
NonBlockingScriptFunction runDialogOptionKeyPressHandlerFunc("dialog_options_key_press", 2);
|
||||
NonBlockingScriptFunction runDialogOptionRepExecFunc("dialog_options_repexec", 1);
|
||||
|
||||
ScriptSystem scsystem;
|
||||
|
||||
std::vector<PScript> scriptModules;
|
||||
std::vector<ccInstance *> moduleInst;
|
||||
std::vector<ccInstance *> moduleInstFork;
|
||||
std::vector<RuntimeScriptValue> moduleRepExecAddr;
|
||||
int numScriptModules = 0;
|
||||
|
||||
std::vector<String> characterScriptObjNames;
|
||||
String objectScriptObjNames[MAX_ROOM_OBJECTS];
|
||||
std::vector<String> guiScriptObjNames;
|
||||
|
||||
|
||||
int run_dialog_request(int parmtr) {
|
||||
_GP(play).stop_dialog_at_end = DIALOG_RUNNING;
|
||||
RunTextScriptIParam(gameinst, "dialog_request", RuntimeScriptValue().SetInt32(parmtr));
|
||||
RunTextScriptIParam(_G(gameinst), "dialog_request", RuntimeScriptValue().SetInt32(parmtr));
|
||||
|
||||
if (_GP(play).stop_dialog_at_end == DIALOG_STOP) {
|
||||
_GP(play).stop_dialog_at_end = DIALOG_NONE;
|
||||
@ -129,19 +92,19 @@ void run_function_on_non_blocking_thread(NonBlockingScriptFunction *funcToRun) {
|
||||
|
||||
// run modules
|
||||
// modules need a forkedinst for this to work
|
||||
for (int kk = 0; kk < numScriptModules; kk++) {
|
||||
funcToRun->moduleHasFunction[kk] = DoRunScriptFuncCantBlock(moduleInstFork[kk], funcToRun, funcToRun->moduleHasFunction[kk]);
|
||||
for (int kk = 0; kk < _G(numScriptModules); kk++) {
|
||||
funcToRun->moduleHasFunction[kk] = DoRunScriptFuncCantBlock(_GP(moduleInstFork)[kk], funcToRun, funcToRun->moduleHasFunction[kk]);
|
||||
|
||||
if (room_changes_was != _GP(play).room_changes)
|
||||
return;
|
||||
}
|
||||
|
||||
funcToRun->globalScriptHasFunction = DoRunScriptFuncCantBlock(gameinstFork, funcToRun, funcToRun->globalScriptHasFunction);
|
||||
funcToRun->globalScriptHasFunction = DoRunScriptFuncCantBlock(_G(gameinstFork), funcToRun, funcToRun->globalScriptHasFunction);
|
||||
|
||||
if (room_changes_was != _GP(play).room_changes)
|
||||
return;
|
||||
|
||||
funcToRun->roomHasFunction = DoRunScriptFuncCantBlock(roominstFork, funcToRun, funcToRun->roomHasFunction);
|
||||
funcToRun->roomHasFunction = DoRunScriptFuncCantBlock(_G(roominstFork), funcToRun, funcToRun->roomHasFunction);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
@ -237,28 +200,28 @@ int run_interaction_script(InteractionScripts *nint, int evnt, int chkAny, int i
|
||||
|
||||
int create_global_script() {
|
||||
ccSetOption(SCOPT_AUTOIMPORT, 1);
|
||||
for (int kk = 0; kk < numScriptModules; kk++) {
|
||||
moduleInst[kk] = ccInstance::CreateFromScript(scriptModules[kk]);
|
||||
if (moduleInst[kk] == nullptr)
|
||||
for (int kk = 0; kk < _G(numScriptModules); kk++) {
|
||||
_GP(moduleInst)[kk] = ccInstance::CreateFromScript(_GP(scriptModules)[kk]);
|
||||
if (_GP(moduleInst)[kk] == nullptr)
|
||||
return -3;
|
||||
// create a forked instance for rep_exec_always
|
||||
moduleInstFork[kk] = moduleInst[kk]->Fork();
|
||||
if (moduleInstFork[kk] == nullptr)
|
||||
_GP(moduleInstFork)[kk] = _GP(moduleInst)[kk]->Fork();
|
||||
if (_GP(moduleInstFork)[kk] == nullptr)
|
||||
return -3;
|
||||
|
||||
moduleRepExecAddr[kk] = moduleInst[kk]->GetSymbolAddress(REP_EXEC_NAME);
|
||||
_GP(moduleRepExecAddr)[kk] = _GP(moduleInst)[kk]->GetSymbolAddress(REP_EXEC_NAME);
|
||||
}
|
||||
gameinst = ccInstance::CreateFromScript(gamescript);
|
||||
if (gameinst == nullptr)
|
||||
_G(gameinst) = ccInstance::CreateFromScript(_GP(gamescript));
|
||||
if (_G(gameinst) == nullptr)
|
||||
return -3;
|
||||
// create a forked instance for rep_exec_always
|
||||
gameinstFork = gameinst->Fork();
|
||||
if (gameinstFork == nullptr)
|
||||
_G(gameinstFork) = _G(gameinst)->Fork();
|
||||
if (_G(gameinstFork) == nullptr)
|
||||
return -3;
|
||||
|
||||
if (dialogScriptsScript != nullptr) {
|
||||
dialogScriptsInst = ccInstance::CreateFromScript(dialogScriptsScript);
|
||||
if (dialogScriptsInst == nullptr)
|
||||
if (_GP(dialogScriptsScript) != nullptr) {
|
||||
_G(dialogScriptsInst) = ccInstance::CreateFromScript(_GP(dialogScriptsScript));
|
||||
if (_G(dialogScriptsInst) == nullptr)
|
||||
return -3;
|
||||
}
|
||||
|
||||
@ -269,30 +232,30 @@ int create_global_script() {
|
||||
void cancel_all_scripts() {
|
||||
int aa;
|
||||
|
||||
for (aa = 0; aa < num_scripts; aa++) {
|
||||
if (scripts[aa].forked)
|
||||
scripts[aa].inst->AbortAndDestroy();
|
||||
for (aa = 0; aa < _G(num_scripts); aa++) {
|
||||
if (_G(scripts)[aa].forked)
|
||||
_G(scripts)[aa].inst->AbortAndDestroy();
|
||||
else
|
||||
scripts[aa].inst->Abort();
|
||||
scripts[aa].numanother = 0;
|
||||
_G(scripts)[aa].inst->Abort();
|
||||
_G(scripts)[aa].numanother = 0;
|
||||
}
|
||||
num_scripts = 0;
|
||||
/* if (gameinst!=NULL) ->Abort(gameinst);
|
||||
if (roominst!=NULL) ->Abort(roominst);*/
|
||||
_G(num_scripts) = 0;
|
||||
/* if (_G(gameinst)!=NULL) ->Abort(_G(gameinst));
|
||||
if (_G(roominst)!=NULL) ->Abort(_G(roominst));*/
|
||||
}
|
||||
|
||||
ccInstance *GetScriptInstanceByType(ScriptInstType sc_inst) {
|
||||
if (sc_inst == kScInstGame)
|
||||
return gameinst;
|
||||
return _G(gameinst);
|
||||
else if (sc_inst == kScInstRoom)
|
||||
return roominst;
|
||||
return _G(roominst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QueueScriptFunction(ScriptInstType sc_inst, const char *fn_name, size_t param_count, const RuntimeScriptValue &p1, const RuntimeScriptValue &p2) {
|
||||
if (inside_script)
|
||||
if (_G(inside_script))
|
||||
// queue the script for the run after current script is finished
|
||||
curscript->run_another(fn_name, sc_inst, param_count, p1, p2);
|
||||
_G(curscript)->run_another(fn_name, sc_inst, param_count, p1, p2);
|
||||
else
|
||||
// if no script is currently running, run the requested script right away
|
||||
RunScriptFunction(sc_inst, fn_name, param_count, p1, p2);
|
||||
@ -314,7 +277,7 @@ bool DoRunScriptFuncCantBlock(ccInstance *sci, NonBlockingScriptFunction *funcTo
|
||||
if (!hasTheFunc)
|
||||
return (false);
|
||||
|
||||
no_blocking_functions++;
|
||||
_G(no_blocking_functions)++;
|
||||
int result = 0;
|
||||
|
||||
if (funcToRun->numParameters < 3) {
|
||||
@ -333,7 +296,7 @@ bool DoRunScriptFuncCantBlock(ccInstance *sci, NonBlockingScriptFunction *funcTo
|
||||
// this might be nested, so don't disrupt blocked scripts
|
||||
ccErrorString = "";
|
||||
ccError = 0;
|
||||
no_blocking_functions--;
|
||||
_G(no_blocking_functions)--;
|
||||
return (hasTheFunc);
|
||||
}
|
||||
|
||||
@ -350,25 +313,25 @@ int PrepareTextScript(ccInstance *sci, const char **tsname) {
|
||||
ccErrorString = "script is already in execution";
|
||||
return -3;
|
||||
}
|
||||
scripts[num_scripts].init();
|
||||
scripts[num_scripts].inst = sci;
|
||||
_G(scripts)[_G(num_scripts)].init();
|
||||
_G(scripts)[_G(num_scripts)].inst = sci;
|
||||
// CHECKME: this conditional block will never run, because
|
||||
// function would have quit earlier (deprecated functionality?)
|
||||
if (sci->IsBeingRun()) {
|
||||
scripts[num_scripts].inst = sci->Fork();
|
||||
if (scripts[num_scripts].inst == nullptr)
|
||||
_G(scripts)[_G(num_scripts)].inst = sci->Fork();
|
||||
if (_G(scripts)[_G(num_scripts)].inst == nullptr)
|
||||
quit("unable to fork instance for secondary script");
|
||||
scripts[num_scripts].forked = 1;
|
||||
_G(scripts)[_G(num_scripts)].forked = 1;
|
||||
}
|
||||
curscript = &scripts[num_scripts];
|
||||
num_scripts++;
|
||||
if (num_scripts >= MAX_SCRIPT_AT_ONCE)
|
||||
_G(curscript) = &_G(scripts)[_G(num_scripts)];
|
||||
_G(num_scripts)++;
|
||||
if (_G(num_scripts) >= MAX_SCRIPT_AT_ONCE)
|
||||
quit("too many nested text script instances created");
|
||||
// in case script_run_another is the function name, take a backup
|
||||
strncpy(scfunctionname, tsname[0], MAX_FUNCTION_NAME_LEN);
|
||||
tsname[0] = &scfunctionname[0];
|
||||
update_script_mouse_coords();
|
||||
inside_script++;
|
||||
_G(inside_script)++;
|
||||
// aborted_ip=0;
|
||||
// abort_executor=0;
|
||||
return 0;
|
||||
@ -395,7 +358,7 @@ int RunScriptFunctionIfExists(ccInstance *sci, const char *tsname, int numParam,
|
||||
ccErrorString = "";
|
||||
|
||||
if (numParam < 3) {
|
||||
toret = curscript->inst->CallScriptFunction(tsname, numParam, params);
|
||||
toret = _G(curscript)->inst->CallScriptFunction(tsname, numParam, params);
|
||||
} else
|
||||
quit("Too many parameters to RunScriptFunctionIfExists");
|
||||
|
||||
@ -404,14 +367,14 @@ int RunScriptFunctionIfExists(ccInstance *sci, const char *tsname, int numParam,
|
||||
quit_with_script_error(tsname);
|
||||
}
|
||||
|
||||
post_script_cleanup_stack++;
|
||||
_G(post_script_cleanup_stack)++;
|
||||
|
||||
if (post_script_cleanup_stack > 50)
|
||||
if (_G(post_script_cleanup_stack) > 50)
|
||||
quitprintf("!post_script_cleanup call stack exceeded: possible recursive function call? running %s", tsname);
|
||||
|
||||
post_script_cleanup();
|
||||
|
||||
post_script_cleanup_stack--;
|
||||
_G(post_script_cleanup_stack)--;
|
||||
|
||||
// restore cached error state
|
||||
ccError = cachedCcError;
|
||||
@ -426,14 +389,14 @@ int RunScriptFunctionIfExists(ccInstance *sci, const char *tsname, int numParam,
|
||||
int RunTextScript(ccInstance *sci, const char *tsname) {
|
||||
if (strcmp(tsname, REP_EXEC_NAME) == 0) {
|
||||
// run module rep_execs
|
||||
// FIXME: in theory the function may be already called for moduleInst[i],
|
||||
// FIXME: in theory the function may be already called for _GP(moduleInst)[i],
|
||||
// in which case this should not be executed; need to rearrange the code somehow
|
||||
int room_changes_was = _GP(play).room_changes;
|
||||
int restore_game_count_was = gameHasBeenRestored;
|
||||
|
||||
for (int kk = 0; kk < numScriptModules; kk++) {
|
||||
if (!moduleRepExecAddr[kk].IsNull())
|
||||
RunScriptFunctionIfExists(moduleInst[kk], tsname, 0, nullptr);
|
||||
for (int kk = 0; kk < _G(numScriptModules); kk++) {
|
||||
if (!_GP(moduleRepExecAddr)[kk].IsNull())
|
||||
RunScriptFunctionIfExists(_GP(moduleInst)[kk], tsname, 0, nullptr);
|
||||
|
||||
if ((room_changes_was != _GP(play).room_changes) ||
|
||||
(restore_game_count_was != gameHasBeenRestored))
|
||||
@ -442,7 +405,7 @@ int RunTextScript(ccInstance *sci, const char *tsname) {
|
||||
}
|
||||
|
||||
int toret = RunScriptFunctionIfExists(sci, tsname, 0, nullptr);
|
||||
if ((toret == -18) && (sci == roominst)) {
|
||||
if ((toret == -18) && (sci == _G(roominst))) {
|
||||
// functions in room script must exist
|
||||
quitprintf("prepare_script: error %d (%s) trying to run '%s' (Room %d)", toret, ccErrorString.GetCStr(), tsname, displayed_room);
|
||||
}
|
||||
@ -486,7 +449,7 @@ String GetScriptName(ccInstance *sci) {
|
||||
// TODO: check script modules too?
|
||||
if (!sci)
|
||||
return "Not in a script";
|
||||
else if (sci->instanceof == gamescript)
|
||||
else if (sci->instanceof == _GP(gamescript))
|
||||
return "Global script";
|
||||
else if (sci->instanceof == _GP(thisroom).CompiledScript)
|
||||
return String::FromFormat("Room %d script", displayed_room);
|
||||
@ -510,16 +473,16 @@ char *make_ts_func_name(const char *base, int iii, int subd) {
|
||||
void post_script_cleanup() {
|
||||
// should do any post-script stuff here, like go to new room
|
||||
if (ccError) quit(ccErrorString);
|
||||
ExecutingScript copyof = scripts[num_scripts - 1];
|
||||
if (scripts[num_scripts - 1].forked)
|
||||
delete scripts[num_scripts - 1].inst;
|
||||
num_scripts--;
|
||||
inside_script--;
|
||||
ExecutingScript copyof = _G(scripts)[_G(num_scripts) - 1];
|
||||
if (_G(scripts)[_G(num_scripts) - 1].forked)
|
||||
delete _G(scripts)[_G(num_scripts) - 1].inst;
|
||||
_G(num_scripts)--;
|
||||
_G(inside_script)--;
|
||||
|
||||
if (num_scripts > 0)
|
||||
curscript = &scripts[num_scripts - 1];
|
||||
if (_G(num_scripts) > 0)
|
||||
_G(curscript) = &_G(scripts)[_G(num_scripts) - 1];
|
||||
else {
|
||||
curscript = nullptr;
|
||||
_G(curscript) = nullptr;
|
||||
}
|
||||
// if (abort_executor) user_disabled_data2=aborted_ip;
|
||||
|
||||
@ -532,13 +495,13 @@ void post_script_cleanup() {
|
||||
switch (copyof.postScriptActions[ii]) {
|
||||
case ePSANewRoom:
|
||||
// only change rooms when all scripts are done
|
||||
if (num_scripts == 0) {
|
||||
if (_G(num_scripts) == 0) {
|
||||
new_room(thisData, playerchar);
|
||||
// don't allow any pending room scripts from the old room
|
||||
// in run_another to be executed
|
||||
return;
|
||||
} else
|
||||
curscript->queue_action(ePSANewRoom, thisData, "NewRoom");
|
||||
_G(curscript)->queue_action(ePSANewRoom, thisData, "NewRoom");
|
||||
break;
|
||||
case ePSAInvScreen:
|
||||
invscreen();
|
||||
@ -881,7 +844,7 @@ int run_interaction_commandlist(InteractionCommandList *nicl, int *timesrun, int
|
||||
// check and abort game if the script is currently
|
||||
// inside the rep_exec_always function
|
||||
void can_run_delayed_command() {
|
||||
if (no_blocking_functions)
|
||||
if (_G(no_blocking_functions))
|
||||
quit("!This command cannot be used within non-blocking events such as " REP_EXEC_ALWAYS_NAME);
|
||||
}
|
||||
|
||||
|
@ -84,45 +84,6 @@ InteractionVariable *FindGraphicalVariable(const char *varName);
|
||||
void run_unhandled_event(int evnt);
|
||||
void can_run_delayed_command();
|
||||
|
||||
|
||||
extern ExecutingScript scripts[MAX_SCRIPT_AT_ONCE];
|
||||
extern ExecutingScript *curscript;
|
||||
|
||||
extern PScript gamescript;
|
||||
extern PScript dialogScriptsScript;
|
||||
extern ccInstance *gameinst, *roominst;
|
||||
extern ccInstance *dialogScriptsInst;
|
||||
extern ccInstance *gameinstFork, *roominstFork;
|
||||
|
||||
extern int num_scripts;
|
||||
extern int post_script_cleanup_stack;
|
||||
|
||||
extern int inside_script, in_graph_script;
|
||||
extern int no_blocking_functions; // set to 1 while in rep_Exec_always
|
||||
|
||||
extern NonBlockingScriptFunction repExecAlways;
|
||||
extern NonBlockingScriptFunction lateRepExecAlways;
|
||||
extern NonBlockingScriptFunction getDialogOptionsDimensionsFunc;
|
||||
extern NonBlockingScriptFunction renderDialogOptionsFunc;
|
||||
extern NonBlockingScriptFunction getDialogOptionUnderCursorFunc;
|
||||
extern NonBlockingScriptFunction runDialogOptionMouseClickHandlerFunc;
|
||||
extern NonBlockingScriptFunction runDialogOptionKeyPressHandlerFunc;
|
||||
extern NonBlockingScriptFunction runDialogOptionRepExecFunc;
|
||||
|
||||
extern ScriptSystem scsystem;
|
||||
|
||||
extern std::vector<PScript> scriptModules;
|
||||
extern std::vector<ccInstance *> moduleInst;
|
||||
extern std::vector<ccInstance *> moduleInstFork;
|
||||
extern std::vector<RuntimeScriptValue> moduleRepExecAddr;
|
||||
extern int numScriptModules;
|
||||
|
||||
// TODO: find out if these extra arrays are really necessary. This may be remains from the
|
||||
// time when the symbol import table was holding raw pointers to char array.
|
||||
extern std::vector<AGS::Shared::String> characterScriptObjNames;
|
||||
extern AGS::Shared::String objectScriptObjNames[MAX_ROOM_OBJECTS];
|
||||
extern std::vector<AGS::Shared::String> guiScriptObjNames;
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
||||
|
@ -37,12 +37,16 @@
|
||||
#include "ags/engine/ac/dynobj/cc_object.h"
|
||||
#include "ags/engine/ac/dynobj/cc_audiochannel.h"
|
||||
#include "ags/engine/ac/dynobj/cc_audioclip.h"
|
||||
#include "ags/engine/ac/dynobj/scriptsystem.h"
|
||||
#include "ags/engine/ac/objectcache.h"
|
||||
#include "ags/engine/ac/dynobj/scripthotspot.h"
|
||||
#include "ags/engine/ac/dynobj/scriptinvitem.h"
|
||||
#include "ags/engine/ac/dynobj/scriptobject.h"
|
||||
#include "ags/engine/ac/dynobj/scriptregion.h"
|
||||
#include "ags/engine/ac/dynobj/scriptstring.h"
|
||||
#include "ags/engine/script/executingscript.h"
|
||||
#include "ags/engine/script/nonblockingscriptfunction.h"
|
||||
#include "ags/engine/script/script.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
@ -79,13 +83,36 @@ Globals::Globals() {
|
||||
_scrRegion = new ScriptRegion[MAX_ROOM_REGIONS];
|
||||
_scrInv = new ScriptInvItem[MAX_INV];
|
||||
_objcache = new ObjectCache[MAX_ROOM_OBJECTS];
|
||||
|
||||
// script.cpp
|
||||
_scripts = new ExecutingScript[MAX_SCRIPT_AT_ONCE];
|
||||
_gamescript = new PScript();
|
||||
_dialogScriptsScript = new PScript();
|
||||
_repExecAlways = new NonBlockingScriptFunction(REP_EXEC_ALWAYS_NAME, 0);
|
||||
_lateRepExecAlways = new NonBlockingScriptFunction(LATE_REP_EXEC_ALWAYS_NAME, 0);
|
||||
_getDialogOptionsDimensionsFunc = new NonBlockingScriptFunction("dialog_options_get_dimensions", 1);
|
||||
_renderDialogOptionsFunc = new NonBlockingScriptFunction("dialog_options_render", 1);
|
||||
_getDialogOptionUnderCursorFunc = new NonBlockingScriptFunction("dialog_options_get_active", 1);
|
||||
_runDialogOptionMouseClickHandlerFunc = new NonBlockingScriptFunction("dialog_options_mouse_click", 2);
|
||||
_runDialogOptionKeyPressHandlerFunc = new NonBlockingScriptFunction("dialog_options_key_press", 2);
|
||||
_runDialogOptionRepExecFunc = new NonBlockingScriptFunction("dialog_options_repexec", 1);
|
||||
_scsystem = new ScriptSystem();
|
||||
_scriptModules = new std::vector<PScript>();
|
||||
_moduleInst = new std::vector<ccInstance *>();
|
||||
_moduleInstFork = new std::vector<ccInstance *>();
|
||||
_moduleRepExecAddr = new std::vector<RuntimeScriptValue>();
|
||||
_characterScriptObjNames = new std::vector<String>();
|
||||
_objectScriptObjNames = new String[MAX_ROOM_OBJECTS];
|
||||
_guiScriptObjNames = new std::vector<String>();
|
||||
}
|
||||
|
||||
Globals::~Globals() {
|
||||
g_globals = nullptr;
|
||||
|
||||
// debug.cpp
|
||||
delete _DbgMgr;
|
||||
|
||||
// game.cpp
|
||||
delete _ccDynamicGUIObject;
|
||||
delete _ccDynamicCharacter;
|
||||
delete _ccDynamicHotspot;
|
||||
@ -108,6 +135,27 @@ Globals::~Globals() {
|
||||
delete[] _scrRegion;
|
||||
delete[] _scrInv;
|
||||
delete[] _objcache;
|
||||
|
||||
// script.cpp
|
||||
delete[] _scripts;
|
||||
delete _gamescript;
|
||||
delete _dialogScriptsScript;
|
||||
delete _repExecAlways;
|
||||
delete _lateRepExecAlways;
|
||||
delete _getDialogOptionsDimensionsFunc;
|
||||
delete _renderDialogOptionsFunc;
|
||||
delete _getDialogOptionUnderCursorFunc;
|
||||
delete _runDialogOptionMouseClickHandlerFunc;
|
||||
delete _runDialogOptionKeyPressHandlerFunc;
|
||||
delete _runDialogOptionRepExecFunc;
|
||||
delete _scsystem;
|
||||
delete _scriptModules;
|
||||
delete _moduleInst;
|
||||
delete _moduleInstFork;
|
||||
delete _moduleRepExecAddr;
|
||||
delete _characterScriptObjNames;
|
||||
delete[] _objectScriptObjNames;
|
||||
delete _guiScriptObjNames;
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "ags/shared/util/string.h"
|
||||
#include "ags/shared/util/version.h"
|
||||
#include "ags/shared/gui/guimain.h"
|
||||
#include "ags/shared/script/cc_script.h"
|
||||
#include "ags/lib/std/set.h"
|
||||
|
||||
namespace AGS3 {
|
||||
@ -50,20 +51,25 @@ struct CCDialog;
|
||||
struct CCGUI;
|
||||
struct CCGUIObject;
|
||||
struct CCHotspot;
|
||||
struct ccInstance;
|
||||
struct CCInventory;
|
||||
struct CCObject;
|
||||
struct CCRegion;
|
||||
struct IAGSEditorDebugger;
|
||||
struct ExecutingScript;
|
||||
struct GameSetupStruct;
|
||||
struct GameState;
|
||||
struct IAGSEditorDebugger;
|
||||
struct NonBlockingScriptFunction;
|
||||
struct RoomStatus;
|
||||
struct ScriptString;
|
||||
struct ScriptObject;
|
||||
struct RuntimeScriptValue;
|
||||
struct ScriptDialog;
|
||||
struct ScriptGUI;
|
||||
struct ScriptHotspot;
|
||||
struct ScriptRegion;
|
||||
struct ScriptInvItem;
|
||||
struct ScriptDialog;
|
||||
struct ScriptObject;
|
||||
struct ScriptRegion;
|
||||
struct ScriptString;
|
||||
struct ScriptSystem;
|
||||
struct ViewStruct;
|
||||
struct CharacterCache;
|
||||
struct ObjectCache;
|
||||
@ -106,7 +112,6 @@ public:
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup debug globals
|
||||
* @{
|
||||
@ -236,6 +241,51 @@ public:
|
||||
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* \defgroup script globals
|
||||
* @{
|
||||
*/
|
||||
|
||||
ExecutingScript *_scripts;
|
||||
ExecutingScript *_curscript = nullptr;
|
||||
|
||||
PScript *_gamescript;
|
||||
PScript *_dialogScriptsScript;
|
||||
ccInstance *_gameinst = nullptr, *_roominst = nullptr;
|
||||
ccInstance *_dialogScriptsInst = nullptr;
|
||||
ccInstance *_gameinstFork = nullptr, *_roominstFork = nullptr;
|
||||
|
||||
int _num_scripts = 0;
|
||||
int _post_script_cleanup_stack = 0;
|
||||
|
||||
int _inside_script = 0, _in_graph_script = 0;
|
||||
int _no_blocking_functions = 0; // set to 1 while in rep_Exec_always
|
||||
|
||||
NonBlockingScriptFunction *_repExecAlways;
|
||||
NonBlockingScriptFunction *_lateRepExecAlways;
|
||||
NonBlockingScriptFunction *_getDialogOptionsDimensionsFunc;
|
||||
NonBlockingScriptFunction *_renderDialogOptionsFunc;
|
||||
NonBlockingScriptFunction *_getDialogOptionUnderCursorFunc;
|
||||
NonBlockingScriptFunction *_runDialogOptionMouseClickHandlerFunc;
|
||||
NonBlockingScriptFunction *_runDialogOptionKeyPressHandlerFunc;
|
||||
NonBlockingScriptFunction *_runDialogOptionRepExecFunc;
|
||||
|
||||
ScriptSystem *_scsystem;
|
||||
|
||||
std::vector<PScript> *_scriptModules;
|
||||
std::vector<ccInstance *> *_moduleInst;
|
||||
std::vector<ccInstance *> *_moduleInstFork;
|
||||
std::vector<RuntimeScriptValue> *_moduleRepExecAddr;
|
||||
int _numScriptModules = 0;
|
||||
|
||||
// TODO: find out if these extra arrays are really necessary. This may be remains from the
|
||||
// time when the symbol import table was holding raw pointers to char array.
|
||||
std::vector<String> *_characterScriptObjNames;
|
||||
String *_objectScriptObjNames;
|
||||
std::vector<String> *_guiScriptObjNames;
|
||||
|
||||
/**@}*/
|
||||
|
||||
public:
|
||||
Globals();
|
||||
~Globals();
|
||||
|
@ -88,18 +88,10 @@ using namespace AGS::Engine;
|
||||
|
||||
extern IGraphicsDriver *gfxDriver;
|
||||
extern int displayed_room;
|
||||
|
||||
|
||||
extern RoomStatus *croom;
|
||||
|
||||
|
||||
extern int game_paused;
|
||||
extern GameSetup usetup;
|
||||
extern int inside_script;
|
||||
extern ccInstance *gameinst, *roominst;
|
||||
|
||||
|
||||
|
||||
extern color palette[256];
|
||||
extern PluginObjectReader pluginReaders[MAX_PLUGIN_OBJECT_READERS];
|
||||
extern int numPluginReaders;
|
||||
@ -255,7 +247,7 @@ void IAGSEngine::GetScreenDimensions(int32 *width, int32 *height, int32 *coldept
|
||||
if (height != nullptr)
|
||||
height[0] = _GP(play).GetMainViewport().GetHeight();
|
||||
if (coldepth != nullptr)
|
||||
coldepth[0] = scsystem.coldepth;
|
||||
coldepth[0] = _GP(scsystem).coldepth;
|
||||
}
|
||||
|
||||
unsigned char **IAGSEngine::GetRawBitmapSurface(BITMAP *bmp) {
|
||||
@ -671,12 +663,12 @@ void IAGSEngine::DisableSound() {
|
||||
usetup.audio_backend = 0;
|
||||
}
|
||||
int IAGSEngine::CanRunScriptFunctionNow() {
|
||||
if (inside_script)
|
||||
if (_G(inside_script))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
int IAGSEngine::CallGameScriptFunction(const char *name, int32 globalScript, int32 numArgs, long arg1, long arg2, long arg3) {
|
||||
if (inside_script)
|
||||
if (_G(inside_script))
|
||||
return -300;
|
||||
|
||||
ccInstance *toRun = GetScriptInstanceByType(globalScript ? kScInstGame : kScInstRoom);
|
||||
@ -718,7 +710,7 @@ void IAGSEngine::SetSpriteAlphaBlended(int32 slot, int32 isAlphaBlended) {
|
||||
}
|
||||
|
||||
void IAGSEngine::QueueGameScriptFunction(const char *name, int32 globalScript, int32 numArgs, long arg1, long arg2) {
|
||||
if (!inside_script) {
|
||||
if (!_G(inside_script)) {
|
||||
this->CallGameScriptFunction(name, globalScript, numArgs, arg1, arg2, 0);
|
||||
return;
|
||||
}
|
||||
@ -726,7 +718,7 @@ void IAGSEngine::QueueGameScriptFunction(const char *name, int32 globalScript, i
|
||||
if (numArgs < 0 || numArgs > 2)
|
||||
quit("IAGSEngine::QueueGameScriptFunction: invalid number of arguments");
|
||||
|
||||
curscript->run_another(name, globalScript ? kScInstGame : kScInstRoom, numArgs,
|
||||
_G(curscript)->run_another(name, globalScript ? kScInstGame : kScInstRoom, numArgs,
|
||||
RuntimeScriptValue().SetPluginArgument(arg1), RuntimeScriptValue().SetPluginArgument(arg2));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user