From: Daniel Karbach Date: Wed, 8 Aug 2012 11:44:46 +0000 (+0200) Subject: changed gauge level interpretation X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=cf20874f973521e84fc2aaa6cd47c56a278d9de7;p=l2e.git changed gauge level interpretation also added an original monster sprite --- diff --git a/src/battle/HeroTag.cpp b/src/battle/HeroTag.cpp index 851e88e..4c34402 100644 --- a/src/battle/HeroTag.cpp +++ b/src/battle/HeroTag.cpp @@ -39,13 +39,13 @@ void HeroTag::Render(SDL_Surface *screen, int width, int height, Point posi int gaugeWidth(width - gaugeX - (align == LEFT ? 1 : 5) * frameOffset.X()); // health gauge, second line Vector 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 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 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 heroOffset( diff --git a/src/graphics/Gauge.cpp b/src/graphics/Gauge.cpp index 042dc27..65535f5 100644 --- a/src/graphics/Gauge.cpp +++ b/src/graphics/Gauge.cpp @@ -12,8 +12,7 @@ using geometry::Point; namespace graphics { // TODO: add start and end "ignore" offsets -void Gauge::Draw(SDL_Surface *dest, Point position, int width, Uint8 level) const { - int fullWidth(width * level / 255); +void Gauge::Draw(SDL_Surface *dest, Point position, int width, int fullWidth) const { SDL_Rect srcRect, destRect; // start diff --git a/src/graphics/Gauge.h b/src/graphics/Gauge.h index dde1db0..95b4b5b 100644 --- a/src/graphics/Gauge.h +++ b/src/graphics/Gauge.h @@ -23,7 +23,7 @@ public: public: int MinWidth() const { return startWidth + endWidth; } int Height() const { return height; } - void Draw(SDL_Surface *dest, geometry::Point position, int width, Uint8 level) const; + void Draw(SDL_Surface *dest, geometry::Point position, int width, int filled) const; private: SDL_Surface *surface; diff --git a/src/main.cpp b/src/main.cpp index e230433..ab02016 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(50, 100)); - monstersLayout.AddPosition(Point(100, 108)); - monstersLayout.AddPosition(Point(150, 100)); - monstersLayout.AddPosition(Point(200, 108)); + monstersLayout.AddPosition(Point(104, 109)); + monstersLayout.AddPosition(Point(140, 118)); + monstersLayout.AddPosition(Point(176, 109)); + monstersLayout.AddPosition(Point(212, 118)); PartyLayout heroesLayout; heroesLayout.AddPosition(Point(27, 219)); heroesLayout.AddPosition(Point(104, 227)); @@ -66,7 +66,7 @@ int main(int argc, char **argv) { heroesLayout.AddPosition(Point(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")); diff --git a/test-data/monster.png b/test-data/monster.png index 2a76e9a..9439102 100644 Binary files a/test-data/monster.png and b/test-data/monster.png differ