ScummVM API documentation
herobelt.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 #ifndef HADESCH_HEROBELT_H
24 #define HADESCH_HEROBELT_H
25 
26 #include "common/array.h"
27 #include "audio/audiostream.h"
28 #include "audio/mixer.h"
29 #include "common/rect.h"
30 #include "common/ptr.h"
31 #include "hadesch/pod_file.h"
32 #include "hadesch/pod_image.h"
33 #include "common/hashmap.h"
34 #include "common/str.h"
35 #include "hadesch/enums.h"
36 #include "hadesch/event.h"
37 
38 namespace Hadesch {
39 class HeroBelt {
40 public:
41  HeroBelt();
42 
43  enum HeroBeltColour {
44  kWarm,
45  kCold,
46  kCool,
47  kNumColours
48  };
49 
50  void render(Common::SharedPtr<GfxContext> context, int time, Common::Point viewPoint);
51  void computeHotZone(int time, Common::Point mousePos, bool mouseEnabled);
52  void placeToInventory(InventoryItem item, EventHandlerWrapper callbackEvent = EventHandlerWrapper());
53  void removeFromInventory(InventoryItem item);
54  bool isOverHeroBelt() const {
55  return _overHeroBelt;
56  }
57  bool isPositionOverHeroBelt(Common::Point mousePos) const;
58  void handleClick(Common::Point mousePos);
59  int getCursor(int time);
60  bool isHoldingItem() const;
61  InventoryItem getHoldingItem() const {
62  return _holdingItem;
63  }
64  const Graphics::Cursor *getHoldingItemCursor(int cursorAnimationFrame) const;
65  void clearHold();
66  void setColour(HeroBeltColour colour) {
67  _colour = colour;
68  }
69  void reset() {
70  _colour = HeroBelt::kWarm;
71  _selectedPower = kPowerNone;
72  _branchOfLifeFrame = 0;
73  _thunderboltFrame = kLightning1;
74  }
75  void setBranchOfLifeFrame(int frame) {
76  _branchOfLifeFrame = frame;
77  }
78  void setThunderboltFrame(HeroBeltFrame frame) {
79  _thunderboltFrame = frame;
80  }
81  HeroPower getSelectedStrength() {
82  return _selectedPower;
83  }
84 
85 private:
86  Common::Point computeSlotPoint(int slot, bool fullyExtended);
87  Common::String inventoryName(int slot);
88  void computeHighlight();
89  void clickPower(HeroPower pwr);
90 
91  PodImage _background[kNumColours];
92  Common::Array<PodImage> _iconNames[kNumColours];
93  Common::Array<PodImage> _icons[kNumColours];
94  Common::Array<PodImage> _iconCursors[kNumColours];
95  Common::Array<PodImage> _iconCursorsBright[kNumColours];
96  PodImage _scrollBg[kNumColours];
97  PodImage _scrollBgHades[kNumColours];
98  PodImage _scrollTextCrete[kNumColours];
99  PodImage _scrollTextTroyMale[kNumColours];
100  PodImage _scrollTextTroyFemale[kNumColours];
101  PodImage _scrollTextMedusa[kNumColours];
102  PodImage _scrollTextHades[kNumColours];
103  Common::Array<PodImage> _powerImages[3][kNumColours];
104  Common::Array<PodImage> _branchOfLife;
105 
106  Common::Point _mousePos;
107  EventHandlerWrapper _animItemCallbackEvent;
108  HotZoneArray _hotZones;
109  HeroBeltColour _colour;
110  int _heroBeltY;
111  int _heroBeltSpeed;
112  bool _overHeroBelt;
113  bool _bottomEdge;
114  int _edgeStartTime;
115  InventoryItem _animateItem;
116  Common::Point _animateItemStartPoint;
117  int _animateItemTargetSlot;
118  int _animateItemStartTime;
119  int _currentTime;
120  int _animItemTime;
121  int _hotZone;
122  int _startHotTime;
123  int _branchOfLifeFrame;
124  InventoryItem _holdingItem;
125  int _holdingSlot;
126  int _highlightTextIdx;
127  bool _showScroll;
128  HeroPower _selectedPower;
129  HeroBeltFrame _thunderboltFrame;
130 };
131 }
132 #endif
Definition: str.h:59
Definition: event.h:34
Definition: ambient.h:30
Definition: array.h:52
Definition: herobelt.h:39
Definition: pod_image.h:35
Definition: hotzone.h:54
Definition: cursor.h:42
Definition: rect.h:45
Definition: ptr.h:159