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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef SCUMM_SCRIPT_V2_H 24 #define SCUMM_SCRIPT_V2_H 25 26 #include "scumm/scumm_v3.h" 27 28 namespace Scumm { 29 30 /** 31 * Engine for version 2 SCUMM games. 32 */ 33 class ScummEngine_v2 : public ScummEngine_v3old { 34 protected: 35 struct V2MouseoverBox { 36 Common::Rect rect; 37 byte color; 38 byte hicolor; 39 }; 40 41 V2MouseoverBox _mouseOverBoxesV2[7]; 42 int8 _mouseOverBoxV2; 43 44 Common::String _sentenceBuf; 45 uint16 _inventoryOffset; 46 47 public: 48 ScummEngine_v2(OSystem *syst, const DetectorResult &dr); 49 50 virtual void resetScumm(); 51 52 void checkV2MouseOver(Common::Point pos); 53 int checkV2Inventory(int x, int y); 54 void redrawV2Inventory(); 55 56 protected: 57 virtual void setupOpcodes(); 58 59 virtual void setupScummVars(); 60 virtual void resetScummVars(); 61 virtual void decodeParseString(); 62 63 virtual void saveLoadWithSerializer(Common::Serializer &s); 64 65 virtual void processKeyboard(Common::KeyState lastKeyHit); 66 67 virtual void readIndexFile(); 68 void readClassicIndexFile(); // V1 69 void readEnhancedIndexFile(); // V2 70 virtual void readGlobalObjects(); 71 virtual void loadCharset(int no); 72 73 virtual void runInputScript(int clickArea, int val, int mode); 74 virtual void runInventoryScript(int i); 75 76 virtual int getVar(); 77 78 void getResultPosIndirect(); 79 virtual void getResultPos(); 80 81 virtual int readVar(uint var); 82 virtual void writeVar(uint var, int value); 83 84 protected: 85 virtual int getActiveObject(); 86 void ifStateCommon(byte type); 87 void ifNotStateCommon(byte type); 88 void setStateCommon(byte type); 89 void clearStateCommon(byte type); 90 void stopScriptCommon(int script); 91 92 void resetSentence(); 93 void setUserState(byte state); 94 95 virtual void handleMouseOver(bool updateInventory); 96 virtual void checkExecVerbs(); 97 void initV2MouseOver(); 98 void initNESMouseOver(); 99 100 virtual void setBuiltinCursor(int index); 101 102 void drawPreposition(int index); 103 104 void walkActorToObject(int actor, int obj); 105 106 /* Version 2 script opcodes */ 107 void o2_actorFromPos(); 108 void o2_actorOps(); 109 void o2_add(); 110 void o2_addIndirect(); 111 void o2_assignVarByte(); 112 void o2_assignVarWordIndirect(); 113 void o2_beginOverride(); 114 void o2_chainScript(); 115 void o2_clearState01(); 116 void o2_clearState02(); 117 void o2_clearState04(); 118 void o2_clearState08(); 119 void o2_cursorCommand(); 120 void o2_cutscene(); 121 void o2_delay(); 122 void o2_doSentence(); 123 void o2_drawObject(); 124 void o2_drawSentence(); 125 void o2_dummy(); 126 void o2_endCutscene(); 127 void o2_findObject(); 128 void o2_getActorWalkBox(); 129 void o2_getActorX(); 130 void o2_getActorY(); 131 void o2_getBitVar(); 132 void o2_getObjPreposition(); 133 void o2_ifClassOfIs(); 134 void o2_ifNotState01(); 135 void o2_ifNotState02(); 136 void o2_ifNotState04(); 137 void o2_ifNotState08(); 138 void o2_ifState01(); 139 void o2_ifState02(); 140 void o2_ifState04(); 141 void o2_ifState08(); 142 void o2_isGreater(); 143 void o2_isGreaterEqual(); 144 void o2_isLess(); 145 void o2_isLessEqual(); 146 void o2_lights(); 147 void o2_loadRoomWithEgo(); 148 void o2_panCameraTo(); 149 void o2_pickupObject(); 150 void o2_putActor(); 151 void o2_putActorAtObject(); 152 void o2_putActorInRoom(); 153 void o2_resourceRoutines(); 154 void o2_restart(); 155 void o2_roomOps(); 156 void o2_getActorElevation(); 157 void o2_setActorElevation(); 158 void o2_setBitVar(); 159 void o2_setCameraAt(); 160 void o2_setObjPreposition(); 161 void o2_setOwnerOf(); 162 void o2_setState01(); 163 void o2_setState02(); 164 void o2_setState04(); 165 void o2_setState08(); 166 void o2_startScript(); 167 void o2_stopScript(); 168 void o2_subtract(); 169 void o2_subIndirect(); 170 void o2_switchCostumeSet(); 171 void o2_verbOps(); 172 void o2_waitForActor(); 173 void o2_waitForMessage(); 174 void o2_waitForSentence(); 175 void o2_walkActorTo(); 176 void o2_walkActorToObject(); 177 178 byte VAR_SENTENCE_VERB; 179 byte VAR_SENTENCE_OBJECT1; 180 byte VAR_SENTENCE_OBJECT2; 181 byte VAR_SENTENCE_PREPOSITION; 182 byte VAR_BACKUP_VERB; 183 184 byte VAR_CLICK_AREA; 185 byte VAR_CLICK_VERB; 186 byte VAR_CLICK_OBJECT; 187 }; 188 189 190 } // End of namespace Scumm 191 192 #endif 193