ScummVM API documentation
EventSequence.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 /*
23  * This code is based on the CRAB engine
24  *
25  * Copyright (c) Arvind Raja Yadav
26  *
27  * Licensed under MIT
28  *
29  */
30 
31 #ifndef CRAB_EVENTSEQUENCE_H
32 #define CRAB_EVENTSEQUENCE_H
33 
34 #include "crab/event/gameevent.h"
35 
36 namespace Crab {
37 
38 namespace pyrodactyl {
39 namespace event {
42  bool _eventInProgress;
43 
44  // The event currently in execution - updated only when all trigger conditions are met in InternalEvents
45  uint _cur;
46 
47  // The events that can happen next - these are updated when the cur event is over
48  // This means cur and next operate in an alternating way
49  // scan next until find event, make it cur, end cur and update next, repeat
50  Common::Array<uint> _next;
51 
52 public:
53  EventSequence() {
54  _eventInProgress = false;
55  _next.push_back(0);
56  _cur = 0;
57  }
58 
59  ~EventSequence() {}
60 
61  GameEvent *currentEvent() {
62  return &_events[_cur];
63  }
64 
65  // See if we should trigger any event
66  void internalEvents(pyrodactyl::event::Info &info);
67  void nextEvent(Info &info, const Common::String &playerId, Common::Array<EventResult> &result,
68  Common::Array<EventSeqInfo> &endSeq, int nextEventChoice = -1);
69 
70  bool eventInProgress() {
71  return _eventInProgress;
72  }
73 
74  void eventInProgress(bool val) {
75  _eventInProgress = val;
76  }
77 
78  // Load and save
79  void load(const Common::Path &filename);
80 
81  void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
82  void loadState(rapidxml::xml_node<char> *node);
83 };
84 } // End of namespace event
85 } // End of namespace pyrodactyl
86 
87 } // End of namespace Crab
88 
89 #endif // CRAB_EVENTSEQUENCE_H
Definition: str.h:59
Definition: array.h:52
Definition: gameevent.h:58
Definition: path.h:52
Definition: GameEventInfo.h:44
void push_back(const T &element)
Definition: array.h:180
Definition: EventSequence.h:40
Definition: moveeffect.h:37