From decb141cc131cfd5f7e44e1ac4ca9e1e6525e686 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 10 Oct 2005 02:24:56 +0000 Subject: Always compile with debug window and hide it on startup. Also added fading out effect on damage font (only works in OpenGL). --- ChangeLog | 10 ++++++++-- src/being.cpp | 31 +++++++++++++++---------------- src/being.h | 14 +++++++++----- src/game.cpp | 23 ++++++----------------- 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4c46c95..6040e2a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ +2005-10-10 Bjørn Lindeijer + + * src/being.cpp, src/being.h, src/game.cpp: Always compile with debug + window and hide it on startup. Also added fading out effect on damage + font (only works in OpenGL). + 2005-10-09 Yohann Ferreira - * ChangeLog, src/gui/browserbox.cpp, src/gui/ministatus.cpp, + * src/gui/browserbox.cpp, src/gui/ministatus.cpp, src/gui/debugwindow.h, src/gui/debugwindow.cpp, src/game.cpp, src/engine.cpp, src/Makefile.am: Corrected the white browser font bug and the black hp/mp bug which were linked. Added a debug window @@ -441,7 +447,7 @@ 2005-09-12 Björn Steinbrink - * M src/Makefile.am, src/gui/browserbox.cpp, src/gui/gui.cpp, + * src/Makefile.am, src/gui/browserbox.cpp, src/gui/gui.cpp, src/resources/resourcemanager.cpp, src/resources/resourcemanager.h, src/resources/sdlimageloader.cpp, src/resources/sdlimageloader.h: Added SDLImageLoader to make guichan support physfs. Removed diff --git a/src/being.cpp b/src/being.cpp index 72ccd2ad..785eae40 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -243,24 +243,16 @@ void Being::setHairStyle(Uint16 style) } } -Uint16 Being::getHairColor() -{ - return hairColor; -} - -Uint16 Being::getHairStyle() -{ - return hairStyle; -} - -void Being::setSpeech(const std::string &text, Uint32 time) +void +Being::setSpeech(const std::string &text, Uint32 time) { speech = text; speech_time = tick_time; showSpeech = true; } -void Being::setDamage(Sint16 amount, Uint32 time) +void +Being::setDamage(Sint16 amount, Uint32 time) { if (!amount) { damage = "miss"; @@ -273,7 +265,8 @@ void Being::setDamage(Sint16 amount, Uint32 time) showDamage = true; } -void Being::setMap(Map *map) +void +Being::setMap(Map *map) { // Remove sprite from potential previous map if (mMap != NULL) @@ -290,7 +283,8 @@ void Being::setMap(Map *map) } } -void Being::nextStep() +void +Being::nextStep() { mFrame = 0; @@ -324,7 +318,8 @@ void Being::nextStep() walk_time += mWalkSpeed / 10; } -void Being::logic() +void +Being::logic() { // Determine whether speech should still be displayed if (get_elapsed_time(speech_time) > 5000) @@ -392,7 +387,8 @@ void Being::logic() } } -void Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) +void +Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) { int px = mPx + offsetX; int py = mPy + offsetY; @@ -422,7 +418,10 @@ void Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) } int textY = (getType() == PLAYER) ? 70 : 32; + int dt = get_elapsed_time(damage_time); + float a = (dt > 1500) ? 1.0 - (dt - 1500) / 1500.0 : 1.0; + graphics->setColor(gcn::Color(255, 255, 255, (int)(255 * a))); graphics->drawText(damage, px + 16, py - textY - get_elapsed_time(damage_time) / 100, diff --git a/src/being.h b/src/being.h index 67c8c6b6..59ee7ca2 100644 --- a/src/being.h +++ b/src/being.h @@ -135,7 +135,7 @@ class Being : public Sprite * Returns the name of the being. */ const std::string& - getName() { return mName; } + getName() const { return mName; } /** * Sets the name for the being. @@ -148,22 +148,26 @@ class Being : public Sprite /** * Sets the hair color for this being. */ - void setHairColor(Uint16 color); + void + setHairColor(Uint16 color); /** * Gets the hair color for this being. */ - Uint16 getHairColor(); + Uint16 + getHairColor() const { return hairColor; } /** * Sets the hair style for this being. */ - void setHairStyle(Uint16 style); + void + setHairStyle(Uint16 style); /** * Gets the hair style for this being. */ - Uint16 getHairStyle(); + Uint16 + getHairStyle() const { return hairStyle; } /** * Makes this being take the next step of his path. diff --git a/src/game.cpp b/src/game.cpp index 8b952ebd..8d5d0cf8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -67,10 +67,7 @@ #include "gui/status.h" #include "gui/ministatus.h" #include "gui/trade.h" - -#ifdef DEBUG #include "gui/debugwindow.h" -#endif #include "net/messagein.h" #include "net/messageout.h" @@ -120,9 +117,7 @@ TradeWindow *tradeWindow; //BuddyWindow *buddyWindow; HelpWindow *helpWindow; PopupMenu *popupMenu; -#ifdef DEBUG DebugWindow *debugWindow; -#endif Inventory *inventory = NULL; @@ -223,9 +218,8 @@ void createGuiWindows() //buddyWindow = new BuddyWindow(); helpWindow = new HelpWindow(); popupMenu = new PopupMenu(); -#ifdef DEBUG debugWindow = new DebugWindow(); -#endif + // Initialize window positions int screenW = graphics->getWidth(); int screenH = graphics->getHeight(); @@ -259,9 +253,8 @@ void createGuiWindows() //buddyWindow->setVisible(false); helpWindow->setVisible(false); popupMenu->setVisible(false); -#ifdef DEBUG - debugWindow->setVisible(true); -#endif + debugWindow->setVisible(false); + // Do not focus any text field gui->focusNone(); } @@ -291,9 +284,7 @@ void destroyGuiWindows() //delete buddyWindow; delete helpWindow; delete popupMenu; -#ifdef DEBUG delete debugWindow; -#endif } void do_init() @@ -649,14 +640,12 @@ void do_input() setupWindow->requestMoveToTop(); used = true; break; -#ifdef DEBUG + // Debug window case SDLK_d: - debugWindow->setVisible(!debugWindow->isVisible()); - if (debugWindow->isVisible()) debugWindow->requestMoveToTop(); - used = true; + requestedWindow = debugWindow; break; -#endif + // screenshot (picture, hence the p) case SDLK_p: { -- cgit v1.2.3-70-g09d2