ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

script.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_RESOURCES_SCRIPT_H
00024 #define STARK_RESOURCES_SCRIPT_H
00025 
00026 #include "common/str.h"
00027 
00028 #include "engines/stark/resources/object.h"
00029 
00030 namespace Stark {
00031 
00032 namespace Formats {
00033 class XRCReadStream;
00034 }
00035 
00036 namespace Resources {
00037 
00038 class Command;
00039 
00046 class Script : public Object {
00047 public:
00048     static const Type::ResourceType TYPE = Type::kScript;
00049 
00050     enum SubType {
00051         kSubTypeGameEvent = 4,
00052         kSubTypePlayerAction = 5,
00053         kSubTypeDialog = 6
00054     };
00055 
00056     enum ScriptType {
00057         kScriptTypeOnGameEvent = 0,
00058         kScriptTypePassiveDialog = 1,
00059         kScriptTypeOnPlayerAction = 2,
00060         kScriptType3 = 3,
00061         kScriptType4 = 4
00062     };
00063 
00064     enum GameEvent {
00065         kGameEventOnGameLoop = 0,
00066         kGameEventOnEnterLocation = 1,
00067         kGameEventOnExitLocation = 2
00068     };
00069 
00077     enum CallMode {
00078         kCallModeGameLoop = 1,
00079         kCallModeExitLocation = 2,
00080         kCallModeEnterLocation = 3,
00081         kCallModePlayerAction = 4,
00082         kCallModeDialogCreateSelections = 5,
00083         kCallModeDialogAnswer = 6
00084     };
00085 
00086     enum ResumeStatus {
00087         kResumeComplete,
00088         kResumeAbort,
00089         kResumeSuspend
00090     };
00091 
00092     Script(Object *parent, byte subType, uint16 index, const Common::String &name);
00093     virtual ~Script();
00094 
00095     // Resource API
00096     void readData(Formats::XRCReadStream *stream) override;
00097     void saveLoad(ResourceSerializer *serializer) override;
00098     void saveLoadCurrent(ResourceSerializer *serializer) override;
00099     void onAllLoaded() override;
00100     void onGameLoop() override;
00101 
00103     void reset();
00104 
00106     bool isEnabled();
00107 
00109     void enable(bool value);
00110 
00112     void stop();
00113 
00115     bool isOnBegin();
00116 
00118     bool isOnEnd();
00119 
00121     Command *getBeginCommand();
00122 
00124     void execute(uint32 callMode);
00125 
00127     void pause(int32 msecs);
00128 
00130     void suspend(Object *cause);
00131 
00133     bool isSuspended();
00134 
00136     Object *getSuspendingResource() const;
00137 
00139     bool shouldExecute(uint32 callMode);
00140 
00142     void goToNextCommand();
00143 
00149     void addReturnObject(Object *object);
00150 
00152     void setResumeStatus(ResumeStatus status);
00153 
00154 protected:
00155     void print(uint depth) override;
00156     void printData() override;
00157 
00158     void updateSuspended();
00159 
00160     void resumeCallerExecution(Object *callerObject);
00161 
00162     uint32 _scriptType;
00163     uint32 _runEvent;
00164     uint32 _minChapter;
00165     uint32 _maxChapter;
00166     bool _shouldResetGameSpeed;
00167 
00168     bool _enabled;
00169     Command *_nextCommand;
00170 
00171     int32 _pauseTimeLeft;
00172     Object *_suspendingResource;
00173     ResumeStatus _resumeStatus;
00174 
00175     Common::Array<Object *> _returnObjects;
00176 };
00177 
00178 } // End of namespace Resources
00179 } // End of namespace Stark
00180 
00181 #endif // STARK_RESOURCES_SCRIPT_H


Generated on Sat Aug 24 2019 05:00:56 for ResidualVM by doxygen 1.7.1
curved edge   curved edge