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

MainFrame.hh

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

Generated on Wed Aug 3 20:38:52 2005 for hack4u by  doxygen 1.4.4