ScummVM API documentation
persistent.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  * Copyright 2020 Google
21  *
22  */
23 
24 #include "common/serializer.h"
25 
26 #include "hadesch/enums.h"
27 
28 #ifndef HADESCH_PERSISTENT_H
29 #define HADESCH_PERSISTENT_H
30 
31 namespace Hadesch {
32 
35 
36  int _slot;
37  Common::U32String _heroName;
38  Common::U32String _slotName;
39  RoomId _room;
40 };
41 
43  bool operator()(const HadeschSaveDescriptor &x, const HadeschSaveDescriptor &y) const {
44  return x._slot < y._slot;
45  }
46 };
47 
48 static const int inventorySize = 6;
49 
50 struct Persistent {
51  // Generic
52  Gender _gender;
53  Common::U32String _heroName;
54  Common::U32String _slotDescription; // valid only in saves
55  Quest _quest;
56  int _powerLevel[3];
57  RoomId _currentRoomId;
58  RoomId _previousRoomId;
59  bool _roomVisited[kNumRooms];
60  bool _statuesTouched[kNumStatues];
61  int _statuePhase[kNumStatues];
62  bool _doQuestIntro;
63  InventoryItem _inventory[inventorySize];
64  bool _hintsAreEnabled;
65 
66  // Argo
67  bool _argoSailedInQuest[kNumRooms][kNumQuests];
68  bool _argoSaidTroyFinally;
69  bool _argoSaidCretePort;
70 
71  // Crete and Minos
72  bool _creteShowMerchant;
73  bool _creteShowAtlantisBoat;
74  bool _creteShowHorned;
75  bool _creteShowHornless1;
76  bool _creteShowHornless2;
77  bool _creteShowHornless3;
78  bool _creteShowHornless4;
79  bool _creteDaedalusRoomAvailable;
80  bool _creteMinosInstructed;
81  bool _creteIntroMerchant;
82  bool _cretePlayedEyeGhostTown;
83  bool _creteTriedHornless[4];
84  bool _creteIntroAtlantisBoat;
85  bool _creteIntroAtlantisWood;
86  bool _creteAlchemistExploded;
87  enum CreteSandalsState {
88  SANDALS_NOT_SOLVED,
89  SANDALS_SOLVED,
90  SANDALS_TAKEN
91  } _creteSandalsState;
92  enum CreteStrongBoxState {
93  BOX_CLOSED, BOX_OPEN,
94  BOX_OPEN_POTION, BOX_OPEN_NO_POTION } _creteStrongBoxState;
95  bool _cretePlayedPhilAlchemist;
96  bool _cretePlayedZeusCheckOutThatBox;
97  bool _creteHadesPusnishesPainAndPanic;
98  bool _creteVisitedAfterAlchemistIntro;
99  bool _creteSaidHelenPermanentResident;
100 
101  // Daedalus
102  bool _daedalusShowedNote;
103  bool _daedalusLabItem[4];
104 
105  // Seriphos
106  bool _seriphosStrawCartTaken;
107  bool _seriphosPlayedMedusa;
108  bool _seriphosPhilWarnedAthena;
109  bool _seriphosPhilCurtainsItems;
110 
111  // Athena
112  bool _athenaPuzzleSolved;
113  bool _athenaSwordTaken;
114  bool _athenaShieldTaken;
115  bool _athenaPlayedPainAndPanic;
116  bool _athenaIntroPlayed;
117 
118  // Medusa Island
119  bool _medisleStoneTaken;
120  bool _medislePlacedItems[5];
121  bool _medislePlayedPerseusIntro;
122  bool _medisleShowFates;
123  bool _medisleShowFatesIntro;
124  bool _medisleEyeballIsActive;
125  FateId _medisleEyePosition;
126  enum MedisleBagPuzzleState {
127  BAG_NOT_STARTED,
128  BAG_STARTED,
129  BAG_SOLVED,
130  BAG_TAKEN
131  } _medisleBagPuzzleState;
132  bool _medislePlayedPhilFatesDesc;
133 
134  // Troy
135  bool _troyPlayAttack;
136  bool _troyWallDamaged;
137  bool _troyShowBricks;
138  bool _troyIsDefeated;
139  bool _troyPlayedOdysseus;
140  bool _troyMessageIsDelivered;
141  enum TroyKeyAndDecreeState {
142  KEY_AND_DECREE_NOT_GIVEN,
143  KEY_AND_DECREE_THROWN,
144  KEY_AND_DECREE_TAKEN
145  } _troyKeyAndDecreeState;
146  int _troyCatacombCounter;
147  bool _troyCatacombsUnlocked;
148  bool _troyPlayedOdysseusCongrats;
149  bool _troyPlayFinish;
150 
151  // Catacombs
152  int _catacombVariants[3][3];
153  CatacombsPath _catacombPaths[3][3];
154  CatacombsLevel _catacombLevel;
155  CatacombsPosition _catacombDecoderSkullPosition;
156  CatacombsLevel _catacombLastLevel;
157  bool _catacombPainAndPanic;
158 
159  // Volcano
160  bool _volcanoPainAndPanicIntroDone;
161  bool _volcanoHeyKid;
162  enum VolcanoPuzzleState {
163  VOLCANO_NO_BOULDERS_THROWN,
164  VOLCANO_SQUASHED_PANIC,
165  VOLCANO_BOULDER_ON_VOLCANO,
166  VOLCANO_HELMET_SHOWN
167  } _volcanoPuzzleState;
168  int _volcanoToStyxCounter;
169 
170  // River Styx
171  bool _styxCharonUsedPotion;
172  bool _styxCharonUsedCoin;
173  bool _styxAlchemistSaidIntro;
174 
175  Persistent();
176 
177  bool isInInventory(InventoryItem item);
178 
179  bool isRoomVisited(RoomId id) const {
180  return _roomVisited[id];
181  }
182 
183  void clearInventory();
184 
185  bool syncGameStream(Common::Serializer &s);
186 };
187 }
188 #endif
Definition: persistent.h:33
Definition: persistent.h:50
Definition: ambient.h:30
Definition: serializer.h:79
Definition: ustr.h:57