From e5f99ba473f018fa9185385d96ebff0efcb2c925 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Ho=C5=A1ek?= Date: Sun, 28 Jan 2007 17:58:50 +0000 Subject: [PATCH] B118: visual indication of Yeti's hitpoints. The scaled down image of the Yeti's head is pretty ugly; please replace. SVN-Revision: 4710 --- data/images/creatures/yeti/hudlife.png | Bin 0 -> 2646 bytes src/badguy/yeti.cpp | 23 +++++++++++++++++++++++ src/badguy/yeti.hpp | 7 ++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 data/images/creatures/yeti/hudlife.png diff --git a/data/images/creatures/yeti/hudlife.png b/data/images/creatures/yeti/hudlife.png new file mode 100644 index 0000000000000000000000000000000000000000..517da36dc56e6a529688ea42bcea4d228fbc2e09 GIT binary patch literal 2646 zcmV-c3aRypP)WFU8GbZ8({Xk{QrNlj4iWF>9@013KDL_t(Y$BmYIjGR>& z#-DS(`+RfT*`1l)o$hwq?QZGz3WXL6Rj?FAjTaOIO$cg&Bwj)cLW0J>P>BIAA<>X% z(5Q)_1kri{sR9KG*e>m|rMGSO(%sI^%T56eB$DYbHtN+$>s!;E?HzF(r%{@pd)jl|HUJRvwgU(NDJ9+|6#zbS+gG(SC*Qi2v1qqx z#tOOKg04_%GA^=<#UhO&zUaE0!=`C=F5kBEc1nmjefq>vJCV3=?##(#PcHY+*v74E z^Myg{nZ0|aq99nJlsvzBbS#lbr1FZYMb)KJ_3X@PR|pnn5(uU<(MRYA30N2}ciZ?SWL$41Y)KM z$L-*<4O{xVbA9=Gqjqf~k%nzqNX6q|oaJZdW;UIfI^L~m#y% zPu~3X9oKv$mrkXqq9{nl!zP?*t~U9#F%Cn z1}LRCHgg7xl?s;YH7qVy(01D>Emv^##eu2#|ZI?xpL;=KzY;D;gn zFoX~SUKo*;!=t@1JHD&DxKQ*0e>%~f2^1@4_g?$q-4EHx^w6m@CmU_gqqSB`cRFnZ zVE{>hAn*|c9t0$2i;H;W#TPI!Ie}v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_gna.wav"); sound_manager->preload("sounds/yeti_roar.wav"); + hud_head.reset(new Surface("images/creatures/yeti/hudlife.png")); draw_dead_script_hint = false; } @@ -80,10 +81,32 @@ Yeti::draw(DrawingContext& context) if(safe_timer.started() && size_t(game_time*40)%2) return; + draw_hit_points(context); + BadGuy::draw(context); } void +Yeti::draw_hit_points(DrawingContext& context) +{ + int i; + + Surface *hh = hud_head.get(); + if (!hh) + return; + + context.push_transform(); + context.set_translation(Vector(0, 0)); + + for (i = 0; i < hit_points; ++i) + { + context.draw_surface(hh, Vector(BORDER_X + (i * hh->get_width()), BORDER_Y + 1), LAYER_FOREGROUND1); + } + + context.pop_transform(); +} + +void Yeti::active_update(float elapsed_time) { switch(state) { diff --git a/src/badguy/yeti.hpp b/src/badguy/yeti.hpp index f1b750482..cfc6d055d 100644 --- a/src/badguy/yeti.hpp +++ b/src/badguy/yeti.hpp @@ -21,6 +21,8 @@ #ifndef __YETI_H__ #define __YETI_H__ +#include + #include "badguy.hpp" class Yeti : public BadGuy @@ -38,7 +40,7 @@ public: void kill_squished(GameObject& object); void kill_fall(); - virtual Yeti* clone() const { return new Yeti(*this); } + virtual Yeti* clone() const { return new Yeti((Yeti&)*this); } private: void run(); @@ -48,6 +50,8 @@ private: void summon_snowball(); void jump_down(); + void draw_hit_points(DrawingContext& context); + void take_hit(Player& player); enum YetiState { @@ -62,6 +66,7 @@ private: Timer safe_timer; int stomp_count; int hit_points; + std::auto_ptr hud_head; }; #endif -- 2.11.0