Spellbook_gump.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2000 The Exult Team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef _SPELLBOOK_GUMP_H_
00020 #define _SPELLBOOK_GUMP_H_
00021 
00022 #include "Gump.h"
00023 
00024 class Spellbook_object;
00025 class Bookmark_button;
00026 
00027 /*
00028  *  Abstract base class for spellbook, spell-scrolls:
00029  */
00030 class Spelltype_gump : public Gump
00031   {
00032 public:
00033   Spelltype_gump(int shnum) : Gump(0, shnum) {  }
00034   virtual ~Spelltype_gump() {  }
00035           // Perform spell.
00036   virtual void do_spell(int spell) = 0;
00037           // Set bookmark.
00038   virtual void select_spell(int spell) = 0;
00039   };
00040 
00041 /*
00042  *  Open spellbook.  The spells are drawn in the object area.
00043  */
00044 class Spellbook_gump : public Spelltype_gump
00045   {
00046   int page;     // Starting with 0 (= circle #).
00047   int turning_page;   // 1 if turning forward, -1 backward,
00048           //   0 if not turning.
00049   int turning_frame;    // Next frame to show.
00050   short avail[9*8];   // For each spell, # which the
00051           //   available reagents make possible.
00052   Spellbook_object *book;   // Book this shows.
00053   Game_object *book_owner;  // Top-owner of book.
00054           // Page turners:
00055   Gump_button *leftpage, *rightpage;
00056   Bookmark_button *bookmark;
00057   Gump_button *spells[9*8]; // ->spell 'buttons'.
00058   int spwidth, spheight;    // Dimensions of a spell shape.
00059   void set_avail();   // Set up counts.
00060 public:
00061   friend class Bookmark_button;
00062   Spellbook_gump(Spellbook_object *b);
00063   ~Spellbook_gump();
00064   virtual void do_spell(int spell); // Perform spell.
00065   void change_page(int delta);  // Page forward/backward.
00066   virtual void select_spell(int spell); // Set bookmark.
00067   virtual Game_object *get_owner();// Get object this belongs to.
00068           // Is a given point on a button?
00069   virtual Gump_button *on_button(int mx, int my);
00070           // Paint button.
00071   virtual void paint_button(Gump_button *btn);
00072           // Paint it and its contents.
00073   virtual void paint();
00074   };
00075 
00076 /*
00077  *  Open spell-scroll in Serpent Isle.
00078  */
00079 class Spellscroll_gump : public Spelltype_gump
00080   {
00081   Game_object *scroll;    // Scroll clicked on.
00082   Gump_button *spell;
00083   int spwidth, spheight;    // Dimensions of a spell shape.
00084 public:
00085   Spellscroll_gump(Game_object *s);
00086   ~Spellscroll_gump();
00087   virtual void do_spell(int spell); // Perform spell.
00088   virtual void select_spell(int)
00089     {  }
00090   virtual Game_object *get_owner();// Get object this belongs to.
00091           // Is a given point on a button?
00092   virtual Gump_button *on_button(int mx, int my);
00093           // Paint button.
00094   virtual void paint_button(Gump_button *btn);
00095           // Paint it and its contents.
00096   virtual void paint();
00097   };
00098 
00099 #endif

Generated on Mon Jul 9 14:42:47 2007 for ExultEngine by  doxygen 1.5.1