ScummVM API documentation
weasel_gump.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 ULTIMA8_GUMPS_REMORSEMENUGUMP_H
23 #define ULTIMA8_GUMPS_REMORSEMENUGUMP_H
24 
25 #include "ultima/shared/std/string.h"
26 #include "ultima/ultima8/gumps/modal_gump.h"
27 #include "ultima/ultima8/misc/classtype.h"
28 
29 namespace Ultima {
30 namespace Ultima8 {
31 
32 class WeaselDat;
33 
37 class WeaselGump : public ModalGump {
38 public:
39  ENABLE_RUNTIME_CLASSTYPE()
40 
41  enum WeaselGumpState {
42  kWeaselStart,
43  kWeaselConfirmPurchaseMovie,
44  kWeaselConfirmPurchaseText,
45  kWeaselCancelledPurchaseMovie,
46  kWeaselCancelledPurchaseText,
47  kWeaselCompletedPurchase,
48  kWeaselInsufficientFunds,
49  kWeaselBrowsing,
50  kWeaselClosing,
51  kWeaselCheckBuyMoreMovie,
52  kWeaselCheckBuyMoreText,
53  kWeaselShowIntro
54  };
55 
56  WeaselGump(uint16 level);
57  ~WeaselGump() override;
58 
59  // Init the gump, call after construction
60  void InitGump(Gump *newparent, bool take_focus = true) override;
61  void Close(bool no_del = false) override;
62 
63  void run() override;
64 
65  // Paint the Gump
66  void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
67 
68  bool OnKeyDown(int key, int mod) override;
69  bool OnTextInput(int unicode) override;
70  void ChildNotify(Gump *child, uint32 message) override;
71 
72  static uint32 I_showWeaselGump(const uint8 *args, unsigned int /*argsize*/);
73 
74 private:
75 
76  void onButtonClick(int entry);
77 
78  void prevItem();
79  void nextItem();
80  void buyItem();
81  void updateForAmmoMode();
82  void checkClose();
83  void completePurchase();
84  void abortPurchase();
85  void checkBuyMore();
86  void confirmPurchase();
87  void setYesNoQuestion(const Std::string &msg);
88  void browsingMode(bool browsing);
89  int purchasedCount(uint16 shape) const;
90 
91  void updateItemDisplay();
92  Gump *playMovie(const Std::string &filename);
93 
95  Gump *_ui;
96 
98  Gump *_movie;
99 
101  uint16 _level;
102 
104  WeaselGumpState _state;
105 
106  const WeaselDat *_weaselDat;
107 
109  int32 _credits;
110 
112  Std::vector<uint16> _purchases;
113 
115  int _curItem;
116 
118  bool _ammoMode;
119 
121  int32 _curItemCost;
122 
124  uint16 _curItemShape;
125 
135  static bool _playedIntroMovie;
136 };
137 
138 } // End of namespace Ultima8
139 } // End of namespace Ultima
140 
141 #endif
void Close(bool no_del=false) override
void InitGump(Gump *newparent, bool take_focus=true) override
Definition: modal_gump.h:34
Definition: render_surface.h:40
void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override
Overloadable method to Paint just this Gump (RenderSurface is relative to this)
Definition: gump.h:47
void ChildNotify(Gump *child, uint32 message) override
Definition: detection.h:27
Definition: string.h:30
Definition: weasel_gump.h:37
void run() override
Run the gump.
Definition: weasel_dat.h:34