ScummVM API documentation
executing_script.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGS_ENGINE_SCRIPT_EXECUTING_SCRIPT_H
23 #define AGS_ENGINE_SCRIPT_EXECUTING_SCRIPT_H
24 
25 #include "ags/engine/script/cc_instance.h"
26 
27 namespace AGS3 {
28 
29 enum PostScriptAction {
30  ePSANewRoom,
31  ePSAInvScreen,
32  ePSARestoreGame,
33  ePSARestoreGameDialog,
34  ePSARunAGSGame,
35  ePSARunDialog,
36  ePSARestartGame,
37  ePSASaveGame,
38  ePSASaveGameDialog
39 };
40 
41 #define MAX_QUEUED_SCRIPTS 4
42 #define MAX_QUEUED_ACTIONS 5
43 #define MAX_QUEUED_ACTION_DESC 100
44 #define MAX_FUNCTION_NAME_LEN 60
45 #define MAX_QUEUED_PARAMS 4
46 
47 enum ScriptInstType {
48  kScInstGame,
49  kScInstRoom
50 };
51 
52 struct QueuedScript {
53  Shared::String FnName;
54  ScriptInstType Instance;
55  size_t ParamCount;
56  RuntimeScriptValue Params[MAX_QUEUED_PARAMS];
57 
58  QueuedScript();
59 };
60 
62  ccInstance *inst = nullptr;
63  // owned fork; CHECKME: this seem unused in the current engine
64  std::unique_ptr<ccInstance> forkedInst{};
65  PostScriptAction postScriptActions[MAX_QUEUED_ACTIONS]{};
66  const char *postScriptActionNames[MAX_QUEUED_ACTIONS]{};
67  ScriptPosition postScriptActionPositions[MAX_QUEUED_ACTIONS]{};
68  char postScriptSaveSlotDescription[MAX_QUEUED_ACTIONS][MAX_QUEUED_ACTION_DESC]{};
69  int postScriptActionData[MAX_QUEUED_ACTIONS]{};
70  int numPostScriptActions = 0;
71  QueuedScript ScFnQueue[MAX_QUEUED_SCRIPTS]{};
72  int numanother = 0;
73 
74  ExecutingScript() = default;
75  int queue_action(PostScriptAction act, int data, const char *aname);
76  void run_another(const char *namm, ScriptInstType scinst, size_t param_count, const RuntimeScriptValue *params);
77 };
78 
79 } // namespace AGS3
80 
81 #endif
Definition: runtime_script_value.h:63
Definition: cc_instance.h:98
Definition: ptr.h:572
Definition: executing_script.h:52
Definition: string.h:62
Definition: executing_script.h:61
Definition: cc_instance.h:114
Definition: ags.h:40