ScummVM API documentation
scheduler.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 TRECISION_SCHEDULER_H
23 #define TRECISION_SCHEDULER_H
24 
25 #include "common/scummsys.h"
26 #include "common/list.h"
27 
28 #define MAXMESSAGE 128
29 
30 namespace Trecision {
31 
32 class TrecisionEngine;
33 
34 struct Message {
35  uint8 _class; // message class
36  uint8 _event; // message name
37  uint8 _priority; // message priority
38 
39  uint8 _u8Param;
40  uint16 _u16Param1; // byte parameter 1
41  uint16 _u16Param2; // byte parameter 2
42  uint32 _u32Param; // int parameter
43 
44  void set(Message *src) {
45  _class = src->_class;
46  _event = src->_event;
47  _priority = src->_priority;
48  _u8Param = src->_u8Param;
49  _u16Param1 = src->_u16Param1;
50  _u16Param2 = src->_u16Param2;
51  _u32Param = src->_u32Param;
52  }
53 };
54 
55 class Scheduler {
56  TrecisionEngine *_vm;
57  uint8 _token;
58  uint8 _counter;
59 
60  // Message system
61  Message _idleMsg;
62  Message _msg;
63  Common::List<Message> _gameQueue;
64  Common::List<Message> _characterQueue;
65 
66 public:
68  ~Scheduler();
69 
70  void process();
71  void doEvent(uint8 cls, uint8 event, uint8 priority, uint16 u16Param1, uint16 u16Param2, uint8 u8Param, uint32 u32Param);
72  void leftClick(uint16 x, uint16 y);
73  void rightClick(uint16 x, uint16 y);
74  void mouseExamine(uint16 object);
75  void mouseOperate(uint16 object);
76 
77  void init();
78  void resetQueues();
79  void initCharacterQueue();
80  bool testEmptyQueues();
81 };
82 
83 } // End of namespace Trecision
84 #endif
85 
Definition: scheduler.h:34
Definition: trecision.h:112
Definition: list.h:44
Definition: actor.h:29
Definition: scheduler.h:55