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