SAGA2: Fix a global constructor warning in tilemode.cpp

This commit is contained in:
a/ 2021-07-18 12:57:12 +09:00
parent 17bcde4f6f
commit 703ff18cb3
5 changed files with 12 additions and 7 deletions

View File

@ -808,7 +808,7 @@ void DisplayNode::drawObject(void) {
//-----------------------------------------------------------------------
// Do mouse hit-test on objects
ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos) {
ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos) {
DisplayNode *dn;
ObjectID result = Nothing;
int32 dist = maxint32;
@ -822,7 +822,7 @@ ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos) {
if (dn->type == nodeTypeObject) {
GameObject *obj = dn->object;
if (obj->parent() == currentWorld && dn->hitBox.ptInside(mouse)) {
if (obj->parent() == currentWorld && dn->hitBox.ptInside(mouse.x, mouse.y)) {
TilePoint loc = obj->getLocation();
int32 newDist = loc.u + loc.v;

View File

@ -48,7 +48,7 @@ class DisplayNode {
friend class DisplayNodeList;
friend class SpellDisplayList;
friend class GameObject;
friend ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos);
friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
private:
DisplayNode *nextDisplayed; // pointer to next in display list
@ -85,7 +85,7 @@ public:
const int maxDisplayed = 100;
class DisplayNodeList {
friend ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos);
friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
public:
uint16 count; // number of entries in list

View File

@ -1346,7 +1346,7 @@ bool lineOfSight(
bool objObscured(GameObject *testObj);
// Determine which object mouse pointer is picking
ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos);
ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
// Create enchantment attach it to object
ObjectID EnchantObject(

View File

@ -141,6 +141,11 @@ typedef Point16 Extent16; // contains width and height
struct StaticPoint32 {
int32 x, y;
void set(int16 nx, int16 ny) {
x = nx;
y = ny;
}
friend StaticPoint32 operator+ (StaticPoint32 a, StaticPoint32 b) {
StaticPoint32 p;
p.x = a.x + b.x;

View File

@ -185,7 +185,7 @@ Alarm updateAlarm, // max coord update rate
bool tileLockFlag; // true if tile mode is locked
GameObject *mouseObject = NULL; // object being dragged
Point32 lastMousePos; // Last mouse position over map
StaticPoint32 lastMousePos = {0, 0}; // Last mouse position over map
static bool mousePressed, // State of mouse button
clickActionDone = true; // Flag indication wether current
// mouse click action is done
@ -1066,7 +1066,7 @@ static APPFUNC(cmdClickTileMap) {
g_vm->_mouseInfo->setText(NULL);
g_vm->_mouseInfo->clearGauge();
}
lastMousePos = ev.mouse;
lastMousePos.set(ev.mouse.x, ev.mouse.y);
break;
case gEventMouseDown: