summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorHal9OOO <miglietta.francesco@gmail.com>2012-10-25 19:15:19 +0200
committerHal9OOO <miglietta.francesco@gmail.com>2012-10-25 19:15:19 +0200
commit3531d0f9abc4c773cab8353a0b70ad3d4a3a255e (patch)
tree7f934b293c04321d6791f40f673b10a2e8ea1a0d /src/resources
parent4358743175ef738cd2943ab1e5fb741c560f1bd4 (diff)
parent1e4aa6a5e7476bea736b89fe5d7094b6a68705e5 (diff)
downloadplus-3531d0f9abc4c773cab8353a0b70ad3d4a3a255e.tar.gz
plus-3531d0f9abc4c773cab8353a0b70ad3d4a3a255e.tar.bz2
plus-3531d0f9abc4c773cab8353a0b70ad3d4a3a255e.tar.xz
plus-3531d0f9abc4c773cab8353a0b70ad3d4a3a255e.zip
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/beinginfo.cpp1
-rw-r--r--src/resources/beinginfo.h12
-rw-r--r--src/resources/cursor.cpp68
-rw-r--r--src/resources/cursor.h60
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.cpp3
-rw-r--r--src/resources/iteminfo.h10
-rw-r--r--src/resources/monsterdb.cpp3
-rw-r--r--src/resources/npcdb.cpp9
-rw-r--r--src/resources/openglimagehelper.cpp3
10 files changed, 165 insertions, 6 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index f55d1f2e3..029e3d40d 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -37,6 +37,7 @@ Attack *BeingInfo::empty = new Attack(SpriteAction::ATTACK,
BeingInfo::BeingInfo() :
mName(_("unnamed")),
mTargetCursorSize(ActorSprite::TC_MEDIUM),
+ mHoverCursor(Cursor::CURSOR_POINTER),
mWalkMask(Map::BLOCKMASK_WALL | Map::BLOCKMASK_CHARACTER
| Map::BLOCKMASK_MONSTER | Map::BLOCKMASK_AIR
| Map::BLOCKMASK_WATER),
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 8f3d09001..ed73f576a 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -25,6 +25,8 @@
#include "actorsprite.h"
+#include "resources/cursor.h"
+
#include <list>
#include <map>
@@ -104,6 +106,15 @@ class BeingInfo final
&targetSize)
{ mTargetCursorSize = targetSize; }
+ void setHoverCursor(const std::string &name)
+ { return setHoverCursor(Cursor::stringToCursor(name)); }
+
+ void setHoverCursor(const Cursor::Cursor &cursor)
+ { mHoverCursor = cursor; }
+
+ Cursor::Cursor getHoverCursor()
+ { return mHoverCursor; }
+
ActorSprite::TargetCursorSize getTargetCursorSize() const
{ return mTargetCursorSize; }
@@ -183,6 +194,7 @@ class BeingInfo final
SpriteDisplay mDisplay;
std::string mName;
ActorSprite::TargetCursorSize mTargetCursorSize;
+ Cursor::Cursor mHoverCursor;
SoundEvents mSounds;
Attacks mAttacks;
unsigned char mWalkMask;
diff --git a/src/resources/cursor.cpp b/src/resources/cursor.cpp
new file mode 100644
index 000000000..48e046180
--- /dev/null
+++ b/src/resources/cursor.cpp
@@ -0,0 +1,68 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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 2 of the License, or
+ * any later version.
+ *
+ * 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/>.
+ */
+
+#include "resources/cursor.h"
+
+namespace Cursor
+{
+ static StrToCursor hoverCursors[] =
+ {
+ {"select", Cursor::CURSOR_POINTER},
+ {"pointer", Cursor::CURSOR_POINTER},
+ {"lr", Cursor::CURSOR_RESIZE_ACROSS},
+ {"rl", Cursor::CURSOR_RESIZE_ACROSS},
+ {"resizeAcross", Cursor::CURSOR_RESIZE_ACROSS},
+ {"ud", Cursor::CURSOR_RESIZE_DOWN},
+ {"du", Cursor::CURSOR_RESIZE_DOWN},
+ {"resizeDown", Cursor::CURSOR_RESIZE_DOWN},
+ {"ldru", Cursor::CURSOR_RESIZE_DOWN_LEFT},
+ {"ruld", Cursor::CURSOR_RESIZE_DOWN_LEFT},
+ {"ld", Cursor::CURSOR_RESIZE_DOWN_LEFT},
+ {"ru", Cursor::CURSOR_RESIZE_DOWN_LEFT},
+ {"resizeDownLeft", Cursor::CURSOR_RESIZE_DOWN_LEFT},
+ {"lurd", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
+ {"rdlu", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
+ {"rd", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
+ {"lu", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
+ {"resizeDownRight", Cursor::CURSOR_RESIZE_DOWN_RIGHT},
+ {"attack", Cursor::CURSOR_FIGHT},
+ {"fight", Cursor::CURSOR_FIGHT},
+ {"take", Cursor::CURSOR_PICKUP},
+ {"pickup", Cursor::CURSOR_PICKUP},
+ {"talk", Cursor::CURSOR_TALK},
+ {"action", Cursor::CURSOR_ACTION},
+ {"left", Cursor::CURSOR_LEFT},
+ {"up", Cursor::CURSOR_UP},
+ {"right", Cursor::CURSOR_RIGHT},
+ {"down", Cursor::CURSOR_DOWN}
+ };
+
+ Cursor stringToCursor(const std::string &name)
+ {
+ for (size_t f = 0; f < sizeof(hoverCursors) / sizeof(StrToCursor);
+ f ++)
+ {
+ if (hoverCursors[f].str == name)
+ return hoverCursors[f].cursor;
+ }
+ return Cursor::CURSOR_POINTER;
+ }
+
+}
diff --git a/src/resources/cursor.h b/src/resources/cursor.h
new file mode 100644
index 000000000..4ecbb82de
--- /dev/null
+++ b/src/resources/cursor.h
@@ -0,0 +1,60 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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 2 of the License, or
+ * any later version.
+ *
+ * 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/>.
+ */
+
+#ifndef CURSOR_H
+#define CURSOR_H
+
+#include <string>
+
+namespace Cursor
+{
+ /**
+ * Cursors are in graphic order from left to right.
+ * CURSOR_POINTER should be left untouched.
+ * CURSOR_TOTAL should always be last.
+ */
+ enum Cursor
+ {
+ CURSOR_POINTER = 0,
+ CURSOR_RESIZE_ACROSS,
+ CURSOR_RESIZE_DOWN,
+ CURSOR_RESIZE_DOWN_LEFT,
+ CURSOR_RESIZE_DOWN_RIGHT,
+ CURSOR_FIGHT,
+ CURSOR_PICKUP,
+ CURSOR_TALK,
+ CURSOR_ACTION,
+ CURSOR_LEFT,
+ CURSOR_UP,
+ CURSOR_RIGHT,
+ CURSOR_DOWN,
+ CURSOR_TOTAL
+ };
+
+ struct StrToCursor
+ {
+ std::string str;
+ Cursor cursor;
+ };
+
+ Cursor stringToCursor(const std::string &name);
+}
+
+#endif
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index f2e07ce48..c6a854c33 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -313,6 +313,8 @@ void ItemDB::load()
itemInfo->setDrawPriority(-1, drawPriority);
itemInfo->setColorsList(colors);
itemInfo->setMaxFloorOffset(maxFloorOffset);
+ itemInfo->setPickupCursor(XML::getProperty(
+ node, "pickupCursor", "pickup"));
std::string effect;
for (size_t i = 0; i < sizeof(fields) / sizeof(fields[0]); ++ i)
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index c0fb962c7..e7c20aa6f 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -53,7 +53,8 @@ ItemInfo::ItemInfo() :
mHitEffectId(-1),
mCriticalHitEffectId(-1),
mMissEffectId(-1),
- maxFloorOffset(32)
+ maxFloorOffset(32),
+ mPickupCursor(Cursor::CURSOR_POINTER)
{
for (int f = 0; f < 10; f ++)
{
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 4e4e9f424..cd832bd9d 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -271,6 +271,15 @@ class ItemInfo final
const std::string replaceColors(std::string str,
const unsigned char color) const;
+ void setPickupCursor(const std::string &cursor)
+ { return setPickupCursor(Cursor::stringToCursor(cursor)); }
+
+ void setPickupCursor(const Cursor::Cursor &cursor)
+ { mPickupCursor = cursor; }
+
+ Cursor::Cursor getPickupCursor() const
+ { return mPickupCursor; }
+
int mDrawBefore[10];
int mDrawAfter[10];
int mDrawPriority[10];
@@ -314,6 +323,7 @@ class ItemInfo final
int mCriticalHitEffectId;
int mMissEffectId;
int maxFloorOffset;
+ Cursor::Cursor mPickupCursor;
};
#endif
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index ae0d6c3ba..48c14b06a 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -87,6 +87,9 @@ void MonsterDB::load()
currentInfo->setTargetCursorSize(XML::getProperty(monsterNode,
"targetCursor", "medium"));
+ currentInfo->setHoverCursor(XML::getProperty(monsterNode,
+ "hoverCursor", "attack"));
+
currentInfo->setTargetOffsetX(XML::getProperty(monsterNode,
"targetOffsetX", 0));
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 81a89b611..350695bef 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -78,13 +78,16 @@ void NPCDB::load()
}
currentInfo->setTargetCursorSize(XML::getProperty(npcNode,
- "targetCursor", "medium"));
+ "targetCursor", "medium"));
+
+ currentInfo->setHoverCursor(XML::getProperty(npcNode,
+ "hoverCursor", "talk"));
currentInfo->setTargetOffsetX(XML::getProperty(npcNode,
- "targetOffsetX", 0));
+ "targetOffsetX", 0));
currentInfo->setTargetOffsetY(XML::getProperty(npcNode,
- "targetOffsetY", 0));
+ "targetOffsetY", 0));
currentInfo->setSortOffsetY(XML::getProperty(npcNode,
"sortOffsetY", 0));
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 3b93460ad..a162ccf59 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -236,8 +236,8 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage)
glTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
- glTexParameteri(mTextureType, GL_TEXTURE_MAX_LEVEL, 0);
}
+ glTexParameteri(mTextureType, GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(mTextureType, 0, mInternalTextureType,
tmpImage->w, tmpImage->h,
@@ -297,6 +297,5 @@ void OpenGLImageHelper::initTextureSampler(GLint id)
mglSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
mglSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
- mglSamplerParameteri(id, GL_TEXTURE_MAX_LEVEL, 0);
}
#endif