ScummVM API documentation
sequenceopcodes.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 DRAGONS_SEQUENCEOPCODES_H
23 #define DRAGONS_SEQUENCEOPCODES_H
24 
25 #include "common/func.h"
26 #include "common/str.h"
27 
28 
29 namespace Dragons {
30 
31 #define DRAGONS_NUM_SEQ_OPCODES 22
32 class DragonsEngine;
33 class Actor;
34 
35 struct OpCall {
36  byte _op;
37  byte _opSize;
38  int32 _deltaOfs;
39  byte *_code;
40  int _result;
41 
42  void skip(uint size);
43  byte readByte();
44  int16 readSint16();
45  uint32 readUint32();
46 };
47 
48 // Convenience macros
49 #define ARG_SKIP(x) opCall.skip(x);
50 #define ARG_BYTE(name) byte name = opCall.readByte(); debug(5, "ARG_BYTE(" #name " = %d)", name);
51 #define ARG_INT8(name) int8 name = opCall.readByte(); debug(5, "ARG_INT8(" #name " = %d)", name);
52 #define ARG_INT16(name) int16 name = opCall.readSint16(); debug(5, "ARG_INT16(" #name " = %d)", name);
53 #define ARG_UINT32(name) uint32 name = opCall.readUint32(); debug(5, "ARG_UINT32(" #name " = %08X)", name);
54 
56 
58 public:
60  ~SequenceOpcodes();
61  void execOpcode(Actor *actor, OpCall &opCall);
62 
63 protected:
64  DragonsEngine *_vm;
65  SequenceOpcode *_opcodes[DRAGONS_NUM_SEQ_OPCODES];
66  Common::String _opcodeNames[DRAGONS_NUM_SEQ_OPCODES];
67  void initOpcodes();
68  void freeOpcodes();
69  void updateReturn(OpCall &opCall, uint16 size);
70 
71  // Opcodes
72  void opSetFramePointer(Actor *actor, OpCall &opCall);
73  void opSetFramePointerAndStop(Actor *actor, OpCall &opCall);
74  void opJmp(Actor *actor, OpCall &opCall);
75  void opSetSequenceTimerStartValue(Actor *actor, OpCall &opCall);
76  void opSetSequenceTimer(Actor *actor, OpCall &opCall);
77  void opUpdateXYResetSeqTimer(Actor *actor, OpCall &opCall);
78  void opUpdateXYResetSeqTimerAndStop(Actor *actor, OpCall &opCall);
79 
80  void opSetActorFlag4AndStop(Actor *actor, OpCall &opCall);
81  void opSetActorFlags404(Actor *actor, OpCall &opCall);
82  void opClearActorFlag400(Actor *actor, OpCall &opCall);
83  void opChangeSequence(Actor *actor, OpCall &opCall);
84 
85  void opSetField7a(Actor *actor, OpCall &opCall);
86  void opUpdateFlags(Actor *actor, OpCall &opCall);
87  void opPlaySound(Actor *actor, OpCall &opCall);
88  void opSetXY(Actor *actor, OpCall &opCall);
89  void opSetXYAndStop(Actor *actor, OpCall &opCall);
90 
91 };
92 
93 } // End of namespace Dragons
94 
95 #endif // DRAGONS_SEQUENCEOPCODES_H
Definition: str.h:59
Definition: sequenceopcodes.h:35
Definition: actor.h:85
Definition: sequenceopcodes.h:57
Definition: actor.h:26
Definition: func.h:473
Definition: dragons.h:167