ScummVM API documentation
grabinfo.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 * Based on the original sources
22 * Faery Tale II -- The Halls of the Dead
23 * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24 */
25
26#ifndef SAGA2_GRABINFO_H
27#define SAGA2_GRABINFO_H
28
29namespace Saga2 {
30/* ===================================================================== *
31 class GrabInfo
32 this will need to be transferred to grabinfo.h
33 * ===================================================================== */
34
35class GrabInfo {
36
37public:
38
39 enum Intent {
40 kIntNone,
41 kIntWalkTo,
42 kIntPickUp,
43 kIntOpen,
44 kIntDrop,
45 kIntUse,
46 kIntAttack,
47 kIntCast, // for spells
48
49 kIntIntentCounts // dummy to count enum
50 };
51
52private:
53
54 enum {
55 kBufSize = 60
56 };
57
58protected:
59
60 // bitmaps for pointer
61 gPixelMap _pointerMap;
62 Point16 _pointerOffset; // mouse ptr hotspot
63
64 Location _from; // where the item was last
65
66 ObjectID _grabId; // which object picked by mouse
67 GameObject *_grabObj; // object being dragged
68 Intent _intention; // pickup state
69 bool _intentDoable; // is intention doable?
70 // (i.e. display red X cursor)
71 bool _displayGauge; // indicates whether or not to show
72 // the gauge
73 int16 _gaugeNumerator, // values to be displayed on the
74 _gaugeDenominator; // gauge
75
76 int16 _moveCount; // number of items being moved in cursor
77
78 char _textBuf[kBufSize];
79
80 // internal grab commonality
81 void setIcon();
82 void clearIcon();
83
84 // set cursor image based on 'intention' and 'intentDoable'
85 void setCursor();
86
87public:
88 // there will probably be only one GrabInfo, created globally
89 GrabInfo();
90
91 ~GrabInfo();
92
93 void selectImage(uint8 index);
94
95 // set the move count based on val and whether the object is
96 // mergeable or not.
97 void setMoveCount(int16 val);
98 int16 getMoveCount() {
99 return _moveCount;
100 }
101
102 // put object into mouse ptr
103 void grabObject(ObjectID objid, Intent in = kIntDrop, int16 count = 1);
104 void grabObject(GameObject *obj, Intent in = kIntDrop, int16 count = 1);
105
106 void copyObject(ObjectID objid, Intent in = kIntDrop, int16 count = 1);
107 void copyObject(GameObject *obj, Intent in = kIntDrop, int16 count = 1);
108
109 // non-destructive reads of the state
110 uint8 getIntent() {
111 return _intention;
112 }
113 bool getDoable() {
114 return _intentDoable;
115 }
116
117 // changes to GrabInfo state
118 uint8 setIntent(uint8 in);
119 void setDoable(bool doable) {
120 if (doable != _intentDoable) {
121 _intentDoable = doable;
122 setCursor();
123 }
124 }
125
126 GameObject *getObject() {
127 return _grabObj;
128 }
129 ObjectID getObjectId() {
130 return _grabId;
131 }
132
133 // free the cursor
134 void placeObject(const Location &loc);
135 void replaceObject();
136
137 // request a change to the mouse cursor text
138 void setText(const char *txt);
139
140 // request a change to the mouse gauge
141 void setGauge(int16 numerator, int16 denominator);
142
143 // clear the mouse gauge
144 void clearGauge();
145};
146
147} // end of namespace Saga2
148
149#endif
Definition: objects.h:118
Definition: grabinfo.h:35
Definition: objproto.h:105
Definition: rect.h:42
Definition: gdraw.h:56