scummvm/engines/saga2/grabinfo.h

150 lines
3.8 KiB
C
Raw Normal View History

2021-05-17 20:47:39 +02:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
2021-05-17 20:47:39 +02:00
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2021-05-17 20:47:39 +02:00
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_GRABINFO_H
#define SAGA2_GRABINFO_H
namespace Saga2 {
/* ===================================================================== *
class GrabInfo
this will need to be transfered to grabinfo.h
* ===================================================================== */
class GrabInfo {
public:
enum Intent {
2022-10-28 23:52:24 +02:00
kIntNone,
kIntWalkTo,
kIntPickUp,
kIntOpen,
kIntDrop,
kIntUse,
kIntAttack,
kIntCast, // for spells
kIntIntentCounts // dummy to count enum
2021-05-17 20:47:39 +02:00
};
private:
enum {
2022-10-28 23:52:24 +02:00
kBufSize = 60
2021-05-17 20:47:39 +02:00
};
protected:
// bitmaps for pointer
gPixelMap _pointerMap;
Point16 _pointerOffset; // mouse ptr hotspot
2021-05-17 20:47:39 +02:00
Location _from; // where the item was last
2021-05-17 20:47:39 +02:00
ObjectID _grabId; // which object picked by mouse
GameObject *_grabObj; // object being dragged
Intent _intention; // pickup state
bool _intentDoable; // is intention doable?
2021-05-17 20:47:39 +02:00
// (i.e. display red X cursor)
bool _displayGauge; // indicates whether or not to show
2021-05-17 20:47:39 +02:00
// the gauge
int16 _gaugeNumerator, // values to be displayed on the
_gaugeDenominator; // gauge
2021-05-17 20:47:39 +02:00
int16 _moveCount; // number of items being moved in cursor
2021-05-17 20:47:39 +02:00
2022-10-28 23:52:24 +02:00
char _textBuf[kBufSize];
2021-05-17 20:47:39 +02:00
// internal grab commonality
2021-09-11 12:13:35 +03:00
void setIcon();
void clearIcon();
2021-05-17 20:47:39 +02:00
// set cursor image based on 'intention' and 'intentDoable'
2021-09-11 12:13:35 +03:00
void setCursor();
2021-05-17 20:47:39 +02:00
public:
// there will probably be only one GrabInfo, created globally
2021-09-11 12:13:35 +03:00
GrabInfo();
2021-05-17 20:47:39 +02:00
2021-09-11 12:13:35 +03:00
~GrabInfo();
2021-05-17 20:47:39 +02:00
void selectImage(uint8 index);
// set the move count based on val and whether the object is
// mergeable or not.
void setMoveCount(int16 val);
2021-09-11 12:13:35 +03:00
int16 getMoveCount() {
return _moveCount;
2021-05-17 20:47:39 +02:00
}
// put object into mouse ptr
2022-10-28 23:52:24 +02:00
void grabObject(ObjectID objid, Intent in = kIntDrop, int16 count = 1);
void grabObject(GameObject *obj, Intent in = kIntDrop, int16 count = 1);
2021-05-17 20:47:39 +02:00
2022-10-28 23:52:24 +02:00
void copyObject(ObjectID objid, Intent in = kIntDrop, int16 count = 1);
void copyObject(GameObject *obj, Intent in = kIntDrop, int16 count = 1);
2021-05-17 20:47:39 +02:00
// non-destructive reads of the state
2021-09-11 12:13:35 +03:00
uint8 getIntent() {
return _intention;
2021-05-17 20:47:39 +02:00
}
2021-09-11 12:13:35 +03:00
bool getDoable() {
return _intentDoable;
2021-05-17 20:47:39 +02:00
}
// changes to GrabInfo state
uint8 setIntent(uint8 in);
void setDoable(bool doable) {
if (doable != _intentDoable) {
_intentDoable = doable;
2021-05-17 20:47:39 +02:00
setCursor();
}
}
2021-09-11 12:13:35 +03:00
GameObject *getObject() {
return _grabObj;
2021-05-17 20:47:39 +02:00
}
2021-09-11 12:13:35 +03:00
ObjectID getObjectId() {
return _grabId;
2021-05-17 20:47:39 +02:00
}
// free the cursor
void placeObject(const Location &loc);
2021-09-11 12:13:35 +03:00
void replaceObject();
2021-05-17 20:47:39 +02:00
// request a change to the mouse cursor text
2021-05-27 19:02:59 +02:00
void setText(const char *txt);
2021-05-17 20:47:39 +02:00
// request a change to the mouse gauge
void setGauge(int16 numerator, int16 denominator);
// clear the mouse gauge
2021-09-11 12:13:35 +03:00
void clearGauge();
2021-05-17 20:47:39 +02:00
};
} // end of namespace Saga2
#endif