conversation.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2001  The Exult Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (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 _CONVERSATION_H
00020 #define _CONVERSATION_H
00021 
00022 #include "rect.h"
00023 #include "singles.h"
00024 #include "shapeid.h"
00025 #include <deque>
00026 #include <vector>
00027 #include <string>
00028 
00029 class Npc_face_info;
00030 class Usecode_value;
00031 class Game_window;
00032 
00033 class Conversation : public Game_singletons, public Paintable{
00034  public:
00035   Conversation();
00036   ~Conversation();
00037 
00038  private:
00039 
00040   Npc_face_info *face_info[2];  // NPC's on-screen faces in convers.
00041   int num_faces;
00042   int last_face_shown;    // Index of last npc face shown.
00043   Rectangle avatar_face;    // Area take by Avatar in conversation.
00044   Rectangle *conv_choices;  // Choices during a conversation.
00045 
00046   std::vector<std::string> answers;
00047   std::deque< std::vector<std::string> > answer_stack;
00048 
00049  public:
00050   inline int get_num_answers() const { return answers.size(); }
00051   inline int get_num_faces_on_screen() const { return num_faces; }
00052   void init_faces();
00053   void show_face(int shape, int frame, int slot = -1);
00054   void remove_face(int shape);
00055   void remove_slot_face(int slot); // SI.
00056   void remove_last_face();  // SI.
00057   void show_npc_message(const char *msg);
00058   bool is_npc_text_pending();
00059   void clear_text_pending();
00060   void show_avatar_choices();
00061   void clear_avatar_choices();
00062   int conversation_choice(int x, int y);
00063   void set_slot(int i) { last_face_shown = i; } // SI.
00064   virtual void paint();     // Paint entire conversation.
00065   void paint_faces(bool text = false);
00066 
00067   void add_answer(Usecode_value& val);
00068   void remove_answer(Usecode_value& val);
00069   void clear_answers(void);
00070   int locate_answer(const char* str);
00071   const char* get_answer(int num) { return answers[num].c_str(); }
00072 
00073   void push_answers();
00074   void pop_answers();
00075   bool stack_empty() const { return !answer_stack.size(); }
00076 
00077  private:
00078   void show_avatar_choices(int num_choices, char **choices);
00079   void add_answer(const char *str);
00080   void remove_answer(const char *str);
00081 };
00082 
00083 #endif

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