]> git.localhorst.tv Git - l2e.git/commitdiff
changed gauge level interpretation
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 8 Aug 2012 11:44:46 +0000 (13:44 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 8 Aug 2012 11:44:46 +0000 (13:44 +0200)
also added an original monster sprite

src/battle/HeroTag.cpp
src/graphics/Gauge.cpp
src/graphics/Gauge.h
src/main.cpp
test-data/monster.png

index 851e88ed07f10d32e4da792364efc0ede7426cd4..4c344028735e14928e0fc2cd2d7921c9b559d87e 100644 (file)
@@ -39,13 +39,13 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point<int> posi
        int gaugeWidth(width - gaugeX - (align == LEFT ? 1 : 5) * frameOffset.X());
        // health gauge, second line
        Vector<int> healthGaugeOffset(gaugeX, 2 * frameOffset.Y());
-       healthGauge->Draw(screen, position + healthGaugeOffset, gaugeWidth, hero->RelativeHealth(256));
+       healthGauge->Draw(screen, position + healthGaugeOffset, gaugeWidth, hero->RelativeHealth(gaugeWidth));
        // mana gauge, third line
        Vector<int> manaGaugeOffset(gaugeX, 3 * frameOffset.Y());
-       manaGauge->Draw(screen, position + manaGaugeOffset, gaugeWidth, hero->RelativeMana(256));
+       manaGauge->Draw(screen, position + manaGaugeOffset, gaugeWidth, hero->RelativeMana(gaugeWidth));
        // ikari gauge, fourth line
        Vector<int> ikariGaugeOffset(gaugeX, 4 * frameOffset.Y());
-       ikariGauge->Draw(screen, position + ikariGaugeOffset, gaugeWidth, hero->RelativeIP(256));
+       ikariGauge->Draw(screen, position + ikariGaugeOffset, gaugeWidth, hero->RelativeIP(gaugeWidth));
 
        // hero
        Vector<int> heroOffset(
index 042dc2704b4705e7c152926582ce85924f3ce0ee..65535f5d2436f4b0664c430370a2e4bb5f032093 100644 (file)
@@ -12,8 +12,7 @@ using geometry::Point;
 namespace graphics {
 
 // TODO: add start and end "ignore" offsets
-void Gauge::Draw(SDL_Surface *dest, Point<int> position, int width, Uint8 level) const {
-       int fullWidth(width * level / 255);
+void Gauge::Draw(SDL_Surface *dest, Point<int> position, int width, int fullWidth) const {
        SDL_Rect srcRect, destRect;
 
        // start
index dde1db0b7355db05ec8eafda6cf36c57a730dcca..95b4b5b580cf738cd2a22c7296a5819fac2561fa 100644 (file)
@@ -23,7 +23,7 @@ public:
 public:
        int MinWidth() const { return startWidth + endWidth; }
        int Height() const { return height; }
-       void Draw(SDL_Surface *dest, geometry::Point<int> position, int width, Uint8 level) const;
+       void Draw(SDL_Surface *dest, geometry::Point<int> position, int width, int filled) const;
 
 private:
        SDL_Surface *surface;
index e2304337f11b3147340eed50338c0d71a718f892..ab02016cff4d67511af6f986f595067c58dfd875 100644 (file)
@@ -55,10 +55,10 @@ int main(int argc, char **argv) {
                // temporary test data
                SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
                PartyLayout monstersLayout;
-               monstersLayout.AddPosition(Point<Uint8>(50, 100));
-               monstersLayout.AddPosition(Point<Uint8>(100, 108));
-               monstersLayout.AddPosition(Point<Uint8>(150, 100));
-               monstersLayout.AddPosition(Point<Uint8>(200, 108));
+               monstersLayout.AddPosition(Point<Uint8>(104, 109));
+               monstersLayout.AddPosition(Point<Uint8>(140, 118));
+               monstersLayout.AddPosition(Point<Uint8>(176, 109));
+               monstersLayout.AddPosition(Point<Uint8>(212, 118));
                PartyLayout heroesLayout;
                heroesLayout.AddPosition(Point<Uint8>(27, 219));
                heroesLayout.AddPosition(Point<Uint8>(104, 227));
@@ -66,7 +66,7 @@ int main(int argc, char **argv) {
                heroesLayout.AddPosition(Point<Uint8>(143, 246));
 
                SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
-               Sprite dummySprite(monsterImg, 96, 96);
+               Sprite dummySprite(monsterImg, 64, 64);
                Monster monster;
                monster.SetSprite(&dummySprite);
 
@@ -79,7 +79,7 @@ int main(int argc, char **argv) {
                hero.SetMaxHealth(100);
                hero.SetHealth(50);
                hero.SetMaxMana(100);
-               hero.SetMana(0);
+               hero.SetMana(100);
                hero.SetIP(255);
 
                SDL_Surface *attackIcons(IMG_Load("test-data/attack-type-icons.png"));
index 2a76e9aae73f47adb4dba85b1f617f9f0971b320..94391020a60216841857d4717f52f5d9a430c643 100644 (file)
Binary files a/test-data/monster.png and b/test-data/monster.png differ