summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/graphics/gui/CMakeLists.txt6
-rw-r--r--data/graphics/gui/Makefile.am6
-rw-r--r--data/graphics/gui/target-cursor-in-range-l.pngbin23803 -> 44634 bytes
-rw-r--r--data/graphics/gui/target-cursor-in-range-l.xml15
-rw-r--r--data/graphics/gui/target-cursor-in-range-m.pngbin18439 -> 17289 bytes
-rw-r--r--data/graphics/gui/target-cursor-in-range-m.xml15
-rw-r--r--data/graphics/gui/target-cursor-in-range-s.pngbin8353 -> 8146 bytes
-rw-r--r--data/graphics/gui/target-cursor-in-range-s.xml15
-rw-r--r--data/graphics/gui/target-cursor-normal-l.pngbin25586 -> 45741 bytes
-rw-r--r--data/graphics/gui/target-cursor-normal-l.xml15
-rw-r--r--data/graphics/gui/target-cursor-normal-m.pngbin17950 -> 17268 bytes
-rw-r--r--data/graphics/gui/target-cursor-normal-m.xml15
-rw-r--r--data/graphics/gui/target-cursor-normal-s.pngbin8361 -> 8129 bytes
-rw-r--r--data/graphics/gui/target-cursor-normal-s.xml15
-rw-r--r--src/actorsprite.cpp83
-rw-r--r--src/actorsprite.h19
16 files changed, 133 insertions, 71 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt
index 5694f9a8d..439542f66 100644
--- a/data/graphics/gui/CMakeLists.txt
+++ b/data/graphics/gui/CMakeLists.txt
@@ -67,11 +67,17 @@ SET (FILES
tab_selected.xml
tab_unused.xml
target-cursor-in-range-l.png
+ target-cursor-in-range-l.xml
target-cursor-in-range-m.png
+ target-cursor-in-range-m.xml
target-cursor-in-range-s.png
+ target-cursor-in-range-s.xml
target-cursor-normal-l.png
+ target-cursor-normal-l.xml
target-cursor-normal-m.png
+ target-cursor-normal-m.xml
target-cursor-normal-s.png
+ target-cursor-normal-s.xml
textfield.xml
textpreview.xml
unknown-item.png
diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am
index 9e3f83129..710cf0688 100644
--- a/data/graphics/gui/Makefile.am
+++ b/data/graphics/gui/Makefile.am
@@ -70,11 +70,17 @@ gui_DATA = \
tab_selected.xml \
tab_unused.xml \
target-cursor-in-range-l.png \
+ target-cursor-in-range-l.xml \
target-cursor-in-range-m.png \
+ target-cursor-in-range-m.xml \
target-cursor-in-range-s.png \
+ target-cursor-in-range-s.xml \
target-cursor-normal-l.png \
+ target-cursor-normal-l.xml \
target-cursor-normal-m.png \
+ target-cursor-normal-m.xml \
target-cursor-normal-s.png \
+ target-cursor-normal-s.xml \
textfield.xml \
textpreview.xml \
unknown-item.png \
diff --git a/data/graphics/gui/target-cursor-in-range-l.png b/data/graphics/gui/target-cursor-in-range-l.png
index 77cdf4b6d..dcf09d024 100644
--- a/data/graphics/gui/target-cursor-in-range-l.png
+++ b/data/graphics/gui/target-cursor-in-range-l.png
Binary files differ
diff --git a/data/graphics/gui/target-cursor-in-range-l.xml b/data/graphics/gui/target-cursor-in-range-l.xml
new file mode 100644
index 000000000..ee7285b37
--- /dev/null
+++ b/data/graphics/gui/target-cursor-in-range-l.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: Alige
+Copyright (C) 2013 Evol Online -->
+<sprite>
+ <imageset name="target-large"
+ src="graphics/gui/target-cursor-in-range-l.png"
+ width="96"
+ height="96"/>
+
+ <action name="default" imageset="target-large">
+ <animation direction="default">
+ <sequence start="0" end="13" delay="50"/>
+ </animation>
+ </action>
+</sprite>
diff --git a/data/graphics/gui/target-cursor-in-range-m.png b/data/graphics/gui/target-cursor-in-range-m.png
index c0107357a..8429fd79a 100644
--- a/data/graphics/gui/target-cursor-in-range-m.png
+++ b/data/graphics/gui/target-cursor-in-range-m.png
Binary files differ
diff --git a/data/graphics/gui/target-cursor-in-range-m.xml b/data/graphics/gui/target-cursor-in-range-m.xml
new file mode 100644
index 000000000..ab6080f92
--- /dev/null
+++ b/data/graphics/gui/target-cursor-in-range-m.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: Alige
+Copyright (C) 2013 Evol Online -->
+<sprite>
+ <imageset name="target-medium"
+ src="graphics/gui/target-cursor-in-range-m.png"
+ width="64"
+ height="64"/>
+
+ <action name="default" imageset="target-medium">
+ <animation direction="default">
+ <sequence start="0" end="6" delay="100"/>
+ </animation>
+ </action>
+</sprite>
diff --git a/data/graphics/gui/target-cursor-in-range-s.png b/data/graphics/gui/target-cursor-in-range-s.png
index 3e81c75de..0c50430ee 100644
--- a/data/graphics/gui/target-cursor-in-range-s.png
+++ b/data/graphics/gui/target-cursor-in-range-s.png
Binary files differ
diff --git a/data/graphics/gui/target-cursor-in-range-s.xml b/data/graphics/gui/target-cursor-in-range-s.xml
new file mode 100644
index 000000000..206131bda
--- /dev/null
+++ b/data/graphics/gui/target-cursor-in-range-s.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: Alige
+Copyright (C) 2013 Evol Online -->
+<sprite>
+ <imageset name="target-small"
+ src="graphics/gui/target-cursor-in-range-s.png"
+ width="32"
+ height="32"/>
+
+ <action name="default" imageset="target-small">
+ <animation direction="default">
+ <sequence start="0" end="6" delay="100"/>
+ </animation>
+ </action>
+</sprite>
diff --git a/data/graphics/gui/target-cursor-normal-l.png b/data/graphics/gui/target-cursor-normal-l.png
index 76d2101b1..5670380f8 100644
--- a/data/graphics/gui/target-cursor-normal-l.png
+++ b/data/graphics/gui/target-cursor-normal-l.png
Binary files differ
diff --git a/data/graphics/gui/target-cursor-normal-l.xml b/data/graphics/gui/target-cursor-normal-l.xml
new file mode 100644
index 000000000..1058d5906
--- /dev/null
+++ b/data/graphics/gui/target-cursor-normal-l.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: Alige
+Copyright (C) 2013 Evol Online -->
+<sprite>
+ <imageset name="target-large"
+ src="graphics/gui/target-cursor-normal-l.png"
+ width="96"
+ height="96"/>
+
+ <action name="default" imageset="target-large">
+ <animation direction="default">
+ <sequence start="0" end="13" delay="50"/>
+ </animation>
+ </action>
+</sprite>
diff --git a/data/graphics/gui/target-cursor-normal-m.png b/data/graphics/gui/target-cursor-normal-m.png
index e2ab79c29..597eb4195 100644
--- a/data/graphics/gui/target-cursor-normal-m.png
+++ b/data/graphics/gui/target-cursor-normal-m.png
Binary files differ
diff --git a/data/graphics/gui/target-cursor-normal-m.xml b/data/graphics/gui/target-cursor-normal-m.xml
new file mode 100644
index 000000000..8091474b3
--- /dev/null
+++ b/data/graphics/gui/target-cursor-normal-m.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: Alige
+Copyright (C) 2013 Evol Online -->
+<sprite>
+ <imageset name="target-medium"
+ src="graphics/gui/target-cursor-normal-m.png"
+ width="64"
+ height="64"/>
+
+ <action name="default" imageset="target-medium">
+ <animation direction="default">
+ <sequence start="0" end="6" delay="100"/>
+ </animation>
+ </action>
+</sprite>
diff --git a/data/graphics/gui/target-cursor-normal-s.png b/data/graphics/gui/target-cursor-normal-s.png
index 09195f440..abfb5e787 100644
--- a/data/graphics/gui/target-cursor-normal-s.png
+++ b/data/graphics/gui/target-cursor-normal-s.png
Binary files differ
diff --git a/data/graphics/gui/target-cursor-normal-s.xml b/data/graphics/gui/target-cursor-normal-s.xml
new file mode 100644
index 000000000..dea706a1e
--- /dev/null
+++ b/data/graphics/gui/target-cursor-normal-s.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: Alige
+Copyright (C) 2013 Evol Online -->
+<sprite>
+ <imageset name="target-small"
+ src="graphics/gui/target-cursor-normal-s.png"
+ width="32"
+ height="32"/>
+
+ <action name="default" imageset="target-small">
+ <animation direction="default">
+ <sequence start="0" end="6" delay="100"/>
+ </animation>
+ </action>
+</sprite>
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 1e3f0ba07..7b9cb796c 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -42,8 +42,7 @@
#include "debug.h"
-ImageSet *ActorSprite::targetCursorImages[2][NUM_TC];
-SimpleAnimation *ActorSprite::targetCursor[2][NUM_TC];
+AnimatedSprite *ActorSprite::targetCursor[2][NUM_TC];
bool ActorSprite::loaded = false;
ActorSprite::ActorSprite(const int id) :
@@ -57,6 +56,8 @@ ActorSprite::ActorSprite(const int id) :
mStunMode(0),
mUsedTargetCursor(nullptr),
mActorSpriteListeners(),
+ mCursorPaddingX(0),
+ mCursorPaddingY(0),
mMustResetParticles(false)
{
}
@@ -93,10 +94,10 @@ bool ActorSprite::draw(Graphics *const graphics,
if (mUsedTargetCursor)
{
- mUsedTargetCursor->reset();
mUsedTargetCursor->update(tick_time * MILLISECONDS_IN_A_TICK);
- mUsedTargetCursor->draw(graphics, px + getTargetOffsetX(),
- py + getTargetOffsetY());
+ mUsedTargetCursor->draw(graphics,
+ px + getTargetOffsetX() - mCursorPaddingX,
+ py + getTargetOffsetY() - mCursorPaddingY);
}
return drawSpriteAt(graphics, px, py);
@@ -152,10 +153,23 @@ void ActorSprite::controlParticle(Particle *const particle)
void ActorSprite::setTargetType(const TargetCursorType type)
{
+ static const int targetWidths[ActorSprite::NUM_TC] = {0, 0, 0};
+ static const int targetHeights[ActorSprite::NUM_TC] = {0, -16, -32};
+
if (type == TCT_NONE)
+ {
untarget();
+ }
else
- mUsedTargetCursor = targetCursor[type][getTargetCursorSize()];
+ {
+ const TargetCursorSize sz = getTargetCursorSize();
+ mUsedTargetCursor = targetCursor[type][sz];
+ if (mUsedTargetCursor)
+ {
+ mCursorPaddingX = targetWidths[sz];
+ mCursorPaddingY = targetHeights[sz];
+ }
+ }
}
struct EffectDescription final
@@ -351,18 +365,17 @@ static const char *cursorSize(const int size)
void ActorSprite::initTargetCursor()
{
- static const std::string targetCursorFile = "target-cursor-%s-%s.png";
- static const int targetWidths[NUM_TC] = {44, 62, 82};
- static const int targetHeights[NUM_TC] = {35, 44, 60};
+ static const std::string targetCursorFile = "%s/target-cursor-%s-%s.xml";
+ const char *path = branding.getStringValue("guiPath").c_str();
// Load target cursors
for (int size = TC_SMALL; size < NUM_TC; size++)
{
for (int type = TCT_NORMAL; type < NUM_TCT; type++)
{
- loadTargetCursor(strprintf(targetCursorFile.c_str(),
- cursorType(type), cursorSize(size)), targetWidths[size],
- targetHeights[size], type, size);
+ targetCursor[type][size] = AnimatedSprite::load(strprintf(
+ targetCursorFile.c_str(), path, cursorType(type),
+ cursorSize(size)));
}
}
}
@@ -378,52 +391,6 @@ void ActorSprite::cleanupTargetCursors()
delete targetCursor[type][size];
targetCursor[type][size] = nullptr;
}
- if (targetCursorImages[type][size])
- {
- targetCursorImages[type][size]->decRef();
- targetCursorImages[type][size] = nullptr;
- }
}
}
}
-
-void ActorSprite::loadTargetCursor(const std::string &filename,
- const int width, const int height,
- const int type, const int size)
-{
- if (reportTrue(size < TC_SMALL || size >= NUM_TC))
- return;
-
- ImageSet *const currentImageSet = Theme::getImageSetFromTheme(
- filename, width, height);
-
- if (!currentImageSet)
- {
- logger->log("Error loading target cursor: %s", filename.c_str());
- return;
- }
-
- Animation *const anim = new Animation;
-
- const size_t sz = currentImageSet->size();
- for (size_t i = 0; i < sz; ++i)
- {
- anim->addFrame(currentImageSet->get(i), 75,
- (16 - (currentImageSet->getWidth() / 2)),
- (16 - (currentImageSet->getHeight() / 2)),
- 100);
- }
-
- SimpleAnimation *const currentCursor = new SimpleAnimation(anim);
-
- if (targetCursor[type][size])
- {
- delete targetCursor[type][size];
- targetCursor[type][size] = nullptr;
- if (targetCursorImages[type][size])
- targetCursorImages[type][size]->decRef();
- }
-
- targetCursorImages[type][size] = currentImageSet;
- targetCursor[type][size] = currentCursor;
-}
diff --git a/src/actorsprite.h b/src/actorsprite.h
index 345f4a31f..4b2b07c52 100644
--- a/src/actorsprite.h
+++ b/src/actorsprite.h
@@ -35,7 +35,7 @@
#include "localconsts.h"
-class SimpleAnimation;
+class AnimatedSprite;
class StatusEffect;
class ActorSpriteListener;
@@ -223,28 +223,21 @@ private:
/** Remove the target cursors from memory */
static void cleanupTargetCursors();
- /**
- * Helper function for loading target cursors
- */
- static void loadTargetCursor(const std::string &filename,
- const int width, const int height,
- const int type, const int size);
-
- /** Images of the target cursor. */
- static ImageSet *targetCursorImages[NUM_TCT][NUM_TC];
-
/** Animated target cursors. */
- static SimpleAnimation *targetCursor[NUM_TCT][NUM_TC];
+ static AnimatedSprite *targetCursor[NUM_TCT][NUM_TC];
static bool loaded;
/** Target cursor being used */
- SimpleAnimation *mUsedTargetCursor;
+ AnimatedSprite *mUsedTargetCursor;
typedef std::list<ActorSpriteListener*> ActorSpriteListeners;
typedef ActorSpriteListeners::iterator ActorSpriteListenerIterator;
ActorSpriteListeners mActorSpriteListeners;
+ int mCursorPaddingX;
+ int mCursorPaddingY;
+
/** Reset particle status effects on next redraw? */
bool mMustResetParticles;
};