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 /* 24 * This code is based on original Soltys source code 25 * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon 26 */ 27 28 #ifndef CGE_COMMANDHANDLER_H 29 #define CGE_COMMANDHANDLER_H 30 31 #include "cge/cge.h" 32 33 namespace CGE { 34 35 #define kCommandFrameRate 80 36 #define kCommandFrameDelay (1000 / kCommandFrameRate) 37 #define kDressed 3 38 39 enum CommandType { 40 kCmdLabel, kCmdPause, kCmdWait, kCmdLevel, kCmdHide, 41 kCmdSay, kCmdInf, kCmdTime, kCmdCave, kCmdKill, 42 kCmdRSeq, kCmdSeq, kCmdSend, kCmdSwap, kCmdKeep, 43 kCmdGive, kCmdIf, kCmdGame, kCmdSetX0, kCmdSetY0, 44 kCmdSlave, kCmdSetXY, kCmdRelX, kCmdRelY, kCmdRelZ, 45 kCmdSetX, kCmdSetY, kCmdSetZ, kCmdTrans, kCmdPort, 46 kCmdNext, kCmdNNext, kCmdTNext, kCmdRNNext, kCmdRTNext, 47 kCmdRMNear, kCmdRmTake, kCmdFlag, kCmdSetRef, kCmdBackPt, 48 kCmdFlash, kCmdLight, kCmdSetVBarrier, kCmdSetHBarrier, kCmdWalk, 49 kCmdReach, kCmdCover, kCmdUncover, kCmdClear, kCmdTalk, 50 kCmdMouse, kCmdSound, kCmdCount, kCmdExec, kCmdStep, 51 kCmdZTrim, kCmdGhost 52 }; 53 54 class CommandHandler { 55 public: 56 struct Command { 57 CommandType _commandType; 58 int _ref; 59 int _val; 60 void *_spritePtr; 61 CallbackType _cbType; 62 } *_commandList; 63 static const char *_commandText[]; 64 bool _talkEnable; 65 66 CommandHandler(CGEEngine *vm, bool turbo); 67 ~CommandHandler(); 68 void runCommand(); 69 void addCommand(CommandType com, int ref, int val, void *ptr); 70 void addCallback(CommandType com, int ref, int val, CallbackType cbType); 71 void insertCommand(CommandType com, int ref, int val, void *ptr); 72 bool idle(); 73 void reset(); 74 private: 75 CGEEngine *_vm; 76 bool _turbo; 77 uint8 _head; 78 uint8 _tail; 79 bool _busy; 80 bool _textDelay; 81 uint32 _timerExpiry; 82 }; 83 84 } // End of namespace CGE 85 86 #endif 87