case.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Mike Polan                                      *
00003  *   kanadakid@gmail.com                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (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                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 // case.h: various Case related classes
00021 
00022 #ifndef CASE_H
00023 #define CASE_H
00024 
00025 #include <map>
00026 #include <vector>
00027 #include "SDL.h"
00028 #include "SDL_mixer.h"
00029 
00030 #include "character.h"
00031 #include "common.h"
00032 
00034 namespace Case {
00035 
00037 enum LawSystem { TWO_DAY=0, THREE_DAY };
00038 
00040 enum BackgroundType { BG_SINGLE_SCREEN=0, BG_DOUBLE_SCREEN };
00041 
00043 struct _Overview {
00045         ustring name;
00046         
00048         ustring author;
00049         
00051         LawSystem lawSys;
00052 };
00053 typedef struct _Overview Overview;
00054 
00056 struct _Overrides {
00058         int textboxAlpha;
00059         
00061         ustring titleScreen;
00062 };
00063 typedef struct _Overrides Overrides;
00064 
00066 struct _Background {
00068         ustring id;
00069         
00071         BackgroundType type;
00072         
00074         SDL_Surface *texture;
00075 };
00076 typedef struct _Background Background;
00077 
00079 struct _Evidence {
00081         ustring id;
00082         
00084         ustring name;
00085         
00087         ustring caption;
00088         
00090         ustring description;
00091         
00093         ustring checkID;
00094         
00096         SDL_Surface *texture;
00097         
00099         SDL_Surface *thumb;
00100 };
00101 typedef struct _Evidence Evidence;
00102 
00104 struct _Hotspot {
00106         Rect rect;
00107         
00109         ustring block;
00110 };
00111 typedef struct _Hotspot Hotspot;
00112 
00114 struct _Location {
00116         ustring id;
00117         
00119         ustring name;
00120         
00122         ustring triggerBlock;
00123         
00125         ustring character;
00126         
00128         ustring music;
00129         
00131         ustring bg;
00132         
00134         SDL_Surface *bgScaled;
00135         
00137         std::vector<Hotspot> hotspots;
00138         
00140         std::vector<ustring> moveLocations; 
00141 };
00142 typedef struct _Location Location;
00143 
00145 struct _Image {
00147         ustring id;
00148         
00150         SDL_Surface *texture;
00151 };
00152 typedef struct _Image Image;
00153 
00155 struct _TestimonyPiece {
00157         ustring text;
00158         
00160         ustring presentId;
00161         
00163         ustring presentBlock;
00164         
00166         ustring pressBlock;
00167         
00169         bool hidden;
00170 };
00171 typedef struct _TestimonyPiece TestimonyPiece;
00172 
00174 struct _Testimony {
00176         Glib::ustring id;
00177         
00179         Glib::ustring title;
00180         
00182         Glib::ustring speaker;
00183         
00185         Glib::ustring nextBlock;
00186         
00188         Glib::ustring followLocation;
00189         
00191         Glib::ustring xExamineEndBlock;
00192         
00194         std::vector<TestimonyPiece> pieces;
00195 };
00196 typedef struct _Testimony Testimony;
00197 
00198 }; // namespace Case
00199 
00200 // typedefs for cleaner code
00201 typedef std::map<ustring, Character> CharacterMap;
00202 typedef std::map<ustring, Case::Background> BackgroundMap;
00203 typedef std::map<ustring, Case::Evidence> EvidenceMap;
00204 typedef std::map<ustring, Case::Image> ImageMap;
00205 typedef std::map<ustring, Case::Location> LocationMap;
00206 typedef std::map<ustring, Case::Testimony> TestimonyMap;
00207 typedef std::map<ustring, ustring> BufferMap;
00208 
00209 typedef std::vector<ustring> StringVector;
00210 
00211 namespace Case {
00212 
00217 class Case {
00218         public:
00220                 Case();
00221                 
00223                 ~Case();
00224                 
00228                 void setOverview(const Overview &overview);
00229                 
00233                 Overview getOverview() const { return m_Overview; }
00234                 
00238                 void setOverrides(const Overrides &ov) { m_Overrides=ov; }
00239                 
00243                 Overrides getOverrides() const { return m_Overrides; }
00244                 
00248                 void setInitialBlockId(const ustring &id) { m_InitialBlockId=id; }
00249                 
00253                 ustring getInitialBlockId() const { return m_InitialBlockId; }
00254                 
00258                 void addCharacter(const Character &character);
00259                 
00263                 void addBackground(const Background &bg);
00264                 
00268                 void addEvidence(const Evidence &evidence);
00269                 
00273                 void addImage(const Image &image);
00274                 
00278                 void addLocation(const Location &loc);
00279                 
00283                 void addTestimony(const Testimony &testimony);
00284                 
00289                 void addBuffer(const ustring &id, const ustring &contents);
00290                 
00295                 Character* getCharacter(const ustring &id);
00296                 
00301                 Background* getBackground(const ustring &id);
00302                 
00307                 Evidence* getEvidence(const ustring &id);
00308                 
00313                 Image* getImage(const ustring &id);
00314                 
00319                 Location* getLocation(const ustring &id);
00320                 
00325                 Testimony* getTestimony(const ustring &id);
00326                 
00331                 std::vector<Evidence*> getEvidenceFromIds(const StringVector &vec);
00332                 
00337                 std::vector<Character*> getCharactersFromIds(const StringVector &vec);
00338                 
00340                 void clear();
00341                 
00345                 CharacterMap getCharacters() const { return m_Characters; }
00346                 
00350                 BackgroundMap getBackgrounds() const { return m_Backgrounds; }
00351                 
00355                 EvidenceMap getEvidence() const { return m_Evidence; }
00356                 
00360                 ImageMap getImages() const { return m_Images; }
00361                 
00365                 LocationMap getLocations() const { return m_Locations; }
00366                 
00370                 TestimonyMap getTestimonies() const { return m_Testimonies; }
00371                 
00375                 BufferMap getBuffers() const { return m_Buffers; }
00376         
00377         private:
00379                 Overrides m_Overrides;
00380                 
00382                 Overview m_Overview;
00383                 
00385                 ustring m_InitialBlockId;
00386                 
00388                 CharacterMap m_Characters;
00389                 
00391                 BackgroundMap m_Backgrounds;
00392                 
00394                 EvidenceMap m_Evidence;
00395                 
00397                 ImageMap m_Images;
00398                 
00400                 LocationMap m_Locations;
00401                 
00403                 TestimonyMap m_Testimonies;
00404                 
00406                 BufferMap m_Buffers;
00407 };
00408 
00409 }; // namespace Case
00410 
00411 #endif

Generated on Fri Feb 22 22:29:23 2008 for Phoenix Wright Case Player API by  doxygen 1.5.3