Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

source/view/MainFrame.hh

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 emuWorks
00003  * http://games.technoplaza.net/
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 // $Id: MainFrame.hh,v 1.19 2004/12/05 02:59:28 technoplaza Exp $
00021 
00022 #ifndef _MAIN_FRAME_HH_
00023 #define _MAIN_FRAME_HH_
00024 
00025 #include <wx/xrc/xmlres.h>
00026 #include <wx/frame.h>
00027 #include <wx/notebook.h>
00028 #include <wx/spinctrl.h>
00029 
00030 #include "../model/SaveSlot.hh"
00031 #include "FileDropTarget.hh"
00032 
00033 /// Starting offset within the SRAM of the save games
00034 #define SRAM_OFFSET 0x1A00
00035 
00036 /// The size of SRAM
00037 #define SRAM_SIZE 0x2000
00038 
00039 /// The size of a particular save game
00040 #define SAVE_SIZE 0x200
00041 
00042 /// The starting offset within the SRAM of the sanity values
00043 #define SANITY_OFFSET 0x1900
00044 
00045 /// The first sanity check XOR
00046 #define SANITY_XOR1 0xAA
00047 
00048 /// The second sanity check XOR
00049 #define SANITY_XOR2 0x55
00050 
00051 namespace hack4u {
00052     class SaveSlot;
00053     class FileDropTarget;
00054     
00055     /**
00056      * The main frame of the application.
00057      */
00058     class MainFrame : public wxFrame
00059     {
00060     public:
00061         /**
00062          * Constructor for the MainFrame.
00063          */
00064         MainFrame();
00065         
00066         /**
00067          * Sets up the controls for this Frame.
00068          */
00069         void CreateControls();
00070         
00071         friend class FileDropTarget;
00072     private:
00073         DECLARE_DYNAMIC_CLASS(MainFrame)
00074         DECLARE_EVENT_TABLE()
00075         
00076         /**
00077          * Changes the options for the Felucca moon control depending upon the
00078          * phase of Trammel.
00079          *
00080          * @param trammel The phase of trammel.
00081          */
00082         void setFeluccaOptions(int trammel);
00083         
00084         /**
00085          * Loads the stats of a particular character into the character tab.
00086          *
00087          * @param slot The current save slot.
00088          * @param character The character. Valid values are in the Characters
00089          *                  enumeration.
00090          */
00091         void loadStats(SaveSlot &slot, int character);
00092         
00093         /**
00094          * Loads the game values into the frame controls.
00095          *
00096          * @param game The game number to load (0, 1, or 2).
00097          */
00098         void loadGame(int game);
00099 
00100         /**
00101          * Loads an SRAM file.
00102          *
00103          * @param filename The SRAM file.
00104          */
00105         void load(wxString &filename);
00106         
00107         /**
00108          * Callback when open is selected from the file menu.
00109          *
00110          * @param event The associated command event.
00111          */
00112         void fileOpen(wxCommandEvent &event);
00113         
00114         /**
00115          * Checks if the current party formation is valid.
00116          *
00117          * @return true if valid; false otherwise.
00118          */
00119         bool isValidParty() const;
00120         
00121         /**
00122          * Checks if a character has valid equipment.
00123          *
00124          * @param character The character. Valid values are in the Characters
00125          *                  enumeration.
00126          * 
00127          * @return true if valid; false otherwise.
00128          */
00129         bool hasValidEquipment(int character) const;
00130         
00131         /**
00132          * Saves the SRAM to disk.
00133          *
00134          * @param filename The filename to save the SRAM to.
00135          *
00136          * @return true if saved; false otherwise.
00137          */
00138         bool save(wxString &filename);
00139         
00140         /**
00141          * Callback when save is selected from the file menu.
00142          *
00143          * @param event The associated command event.
00144          */
00145         void fileSave(wxCommandEvent &event);
00146         
00147         /**
00148          * Callback when save as is selected from the file menu.
00149          * 
00150          * @param event The associated command event.
00151          */
00152         void fileSaveAs(wxCommandEvent &event);
00153         
00154         /**
00155          * Checks if an SRAM file is currently open.
00156          *
00157          * @return true if open; false otherwise.
00158          */
00159         bool isOpen() { return open; }
00160         
00161         /**
00162          * Sets whether an SRAM file is open or not.
00163          *
00164          * @param open true if open; false otherwise.
00165          */
00166         void setOpen(bool open);
00167         
00168         /**
00169          * Closes the current SRAM file.
00170          *
00171          * @return true if closed; false otherwise.
00172          */
00173         bool close();
00174         
00175         /**
00176          * Callback when close is selected from the file menu.
00177          * 
00178          * @param event The associated command event.
00179          */
00180         void fileClose(wxCommandEvent &event);
00181         
00182         /**
00183          * Callback when exit is selected from the file menu.
00184          * 
00185          * @param event The associated command event.
00186          */
00187         void fileExit(wxCommandEvent &event);
00188         
00189         /**
00190          * Callback when the window is closing.
00191          * 
00192          * @param event The associated close event.
00193          */
00194         void windowClosing(wxCloseEvent &event);
00195         
00196         /**
00197          * Callback when one of the game menu items are selected.
00198          * 
00199          * @param event The associated command event.
00200          */
00201         void gameChange(wxCommandEvent &event);
00202         
00203         /**
00204          * Callback when about is selected from the help menu.
00205          * 
00206          * @param event The associated command event.
00207          */
00208         void helpAbout(wxCommandEvent &event);
00209         
00210         /**
00211          * Callback when the hero's name is changed.
00212          * 
00213          * @param event The associated command event.
00214          */
00215         void herosNameChange(wxCommandEvent &event);
00216         
00217         /**
00218          * Callback when one of the member's classes is changed.
00219          * 
00220          * @param event The associated command event.
00221          */
00222         void memberClassChange(wxCommandEvent &event);
00223         
00224         /**
00225          * Callback when one of the virtue values is changed.
00226          * 
00227          * @param event The associated scroll event.
00228          */
00229         void virtueChange(wxScrollEvent &event);
00230         
00231         /**
00232          * Callback when one of the magics is changed.
00233          * 
00234          * @param event The associated command event.
00235          */
00236         void magicChange(wxCommandEvent &event);
00237         
00238         /**
00239          * Callback when one of the moon phases is changed.
00240          * 
00241          * @param event The associated command event.
00242          */
00243         void phaseChange(wxCommandEvent &event);
00244         
00245         /**
00246          * Callback when the gold amount is changed.
00247          * 
00248          * @param event The associated command event.
00249          */
00250         void goldChange(wxCommandEvent &event);
00251         
00252         /**
00253          * Callback when one of the herbs is changed.
00254          * 
00255          * @param event The associated scroll event.
00256          */
00257         void herbChange(wxScrollEvent &event);
00258         
00259         /**
00260          * Callback when one of the runes is changed.
00261          * 
00262          * @param event The associated command event.
00263          */
00264         void runeChange(wxCommandEvent &event);
00265         
00266         /**
00267          * Callback when one of the stones is changed.
00268          * 
00269          * @param event The associated command event.
00270          */
00271         void stoneChange(wxCommandEvent &event);
00272         
00273         /**
00274          * Callback when one of the quantity tools is changed.
00275          * 
00276          * @param event The associated scroll event.
00277          */
00278         void toolQuantityChange(wxScrollEvent &event);
00279         
00280         /**
00281          * Callback when one of the have/have not tools is changed.
00282          * 
00283          * @param event The associated command event.
00284          */
00285         void toolHaveChange(wxCommandEvent &event);
00286         
00287         /**
00288          * Callback when one of the characters is selected.
00289          * 
00290          * @param event The associated command event.
00291          */
00292         void characterChange(wxCommandEvent &event);
00293         
00294         /**
00295          * Callback when one of the character stats is changed.
00296          * 
00297          * @param event The associated command event.
00298          */
00299         void statChange(wxCommandEvent &event);
00300         
00301         /**
00302          * Sets the equipment value for a particular slot.
00303          *
00304          * @param slot The slot to set (0-5).
00305          */
00306         void setEquipment(int slot);
00307         
00308         /**
00309          * Callback when a characters equipment is changed.
00310          * 
00311          * @param event The associated command event.
00312          */
00313         void equipmentChange(wxCommandEvent &event);
00314         
00315         /**
00316          * Callback when a characters equipped equipment is changed.
00317          * 
00318          * @param event The associated command event.
00319          */
00320         void equippedChange(wxCommandEvent &event);
00321 
00322         SaveSlot *saveslot[3];
00323         int currentSlot;
00324         bool open;
00325         
00326         char *sram;
00327         wxString sramFile;
00328 
00329         wxNotebook *notebook;
00330         
00331         wxMenuItem *games[3];
00332         wxMenuItem *fileSaveItem;
00333         wxMenuItem *fileSaveAsItem;
00334         wxMenuItem *fileCloseItem;
00335 
00336         wxTextCtrl *herosNameText;
00337         wxChoice *memberClass[4];
00338 
00339         wxSlider *honestySlider;
00340         wxSlider *compassionSlider;
00341         wxSlider *valorSlider;
00342         wxSlider *justiceSlider;
00343         wxSlider *sacrificeSlider;
00344         wxSlider *honorSlider;
00345         wxSlider *spiritualitySlider;
00346         wxSlider *humilitySlider;
00347 
00348         wxCheckBox *lightSpellCheck;
00349         wxCheckBox *missileSpellCheck;
00350         wxCheckBox *awakenSpellCheck;
00351         wxCheckBox *cureSpellCheck;
00352         wxCheckBox *windSpellCheck;
00353         wxCheckBox *healSpellCheck;
00354         wxCheckBox *fireSpellCheck;
00355         wxCheckBox *exitSpellCheck;
00356         wxCheckBox *dispelSpellCheck;
00357         wxCheckBox *viewSpellCheck;
00358         wxCheckBox *protectSpellCheck;
00359         wxCheckBox *iceSpellCheck;
00360         wxCheckBox *blinkSpellCheck;
00361         wxCheckBox *energySpellCheck;
00362         wxCheckBox *quickSpellCheck;
00363         wxCheckBox *sleepSpellCheck;
00364         wxCheckBox *reflectSpellCheck;
00365         wxCheckBox *negateSpellCheck;
00366         wxCheckBox *destroySpellCheck;
00367         wxCheckBox *jinxSpellCheck;
00368         wxCheckBox *squishSpellCheck;
00369         wxCheckBox *gateSpellCheck;
00370         wxCheckBox *tremorSpellCheck;
00371         wxCheckBox *lifeSpellCheck;
00372         wxCheckBox *defeatSpellCheck;
00373 
00374         wxChoice *trammelChoice;
00375         wxChoice *feluccaChoice;
00376 
00377         wxTextCtrl *goldText;
00378 
00379         wxSlider *ashSlider;
00380         wxSlider *ginsengSlider;
00381         wxSlider *garlicSlider;
00382         wxSlider *silkwebSlider;
00383         wxSlider *mossSlider;
00384         wxSlider *pearlSlider;
00385         wxSlider *fungusSlider;
00386         wxSlider *manrootSlider;
00387 
00388         wxCheckBox *honestyRuneCheck;
00389         wxCheckBox *compassionRuneCheck;
00390         wxCheckBox *valorRuneCheck;
00391         wxCheckBox *justiceRuneCheck;
00392         wxCheckBox *sacrificeRuneCheck;
00393         wxCheckBox *honorRuneCheck;
00394         wxCheckBox *spiritualityRuneCheck;
00395         wxCheckBox *humilityRuneCheck;
00396 
00397         wxCheckBox *blueStoneCheck;
00398         wxCheckBox *yellowStoneCheck;
00399         wxCheckBox *redStoneCheck;
00400         wxCheckBox *greenStoneCheck;
00401         wxCheckBox *orangeStoneCheck;
00402         wxCheckBox *purpleStoneCheck;
00403         wxCheckBox *whiteStoneCheck;
00404         wxCheckBox *blackStoneCheck;
00405 
00406         wxSlider *torchSlider;
00407         wxSlider *gemSlider;
00408         wxSlider *oilSlider;
00409 
00410         wxCheckBox *keyCheck;
00411         wxCheckBox *sextantCheck;
00412         wxCheckBox *scaleCheck;
00413         wxCheckBox *fluteCheck;
00414         wxCheckBox *candleCheck;
00415         wxCheckBox *bookCheck;
00416         wxCheckBox *bellCheck;
00417         wxCheckBox *hornCheck;
00418         wxCheckBox *skullCheck;
00419         wxCheckBox *truthKeyCheck;
00420         wxCheckBox *courageKeyCheck;
00421         wxCheckBox *loveKeyCheck;
00422         wxCheckBox *wheelCheck;
00423 
00424         wxChoice *characterChoice;
00425 
00426         wxTextCtrl *levelText;
00427         wxTextCtrl *experienceText;
00428         wxTextCtrl *currentHPText;
00429         wxTextCtrl *currentMPText;
00430         wxTextCtrl *maxHPText;
00431         wxTextCtrl *maxMPText;
00432         wxTextCtrl *strengthText;
00433         wxTextCtrl *intelligenceText;
00434         wxTextCtrl *dexterityText;
00435 
00436         wxChoice *itemChoice[6];
00437         wxCheckBox *itemEquippedCheck[6];
00438         
00439         /**
00440          * Array of the names of the eight cities of virtue.
00441          */
00442         static const wxString CITY_NAMES[];
00443         
00444         /**
00445          * Array of the character class names.
00446          */
00447         static const wxString CHARACTER_NAMES[];
00448         
00449         /**
00450          * XPM icon used for the Frame icon.
00451          */
00452         static const char *ICON[];
00453     };
00454 }
00455 
00456 #endif
00457 

Generated on Sat Dec 4 23:06:36 2004 for hack4u by  doxygen 1.3.9.1