adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src dialog.cc,1.25,1.26 dialog.h,1.48


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src dialog.cc,1.25,1.26 dialog.h,1.48,1.49 dialog_screen.cc,1.6,1.7 dialog_screen.h,1.1,1.2
Date: Thu, 25 Apr 2002 17:44:46 -0400

Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv23674/src

Modified Files:
        dialog.cc dialog.h dialog_screen.cc dialog_screen.h 
Log Message:
FIXED displaying of proper portrait in multi-NPC dialogues

Index: dialog.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.cc,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** dialog.cc   13 Apr 2002 14:51:19 -0000      1.25
--- dialog.cc   25 Apr 2002 21:44:44 -0000      1.26
***************
*** 35,38 ****
--- 35,39 ----
  {
      strings = NULL;
+     npc_portrait_= "Default";
  }
  
***************
*** 189,193 ****
              {
                  if (strcmp ("Narrator", npc) == 0) npc_color_ = 0;
!                 else npc_color_ = data::characters[npc]->get_color ();
              }
              
--- 190,201 ----
              {
                  if (strcmp ("Narrator", npc) == 0) npc_color_ = 0;
!                 else
!                 {
!                     // set color and portrait of the NPC
!                     character_base *mychar = data::characters[npc];
! 
!                     npc_color_ = mychar->get_color ();
!                     npc_portrait_ = mychar->get_portrait ();
!                 }
              }
              

Index: dialog.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -r1.48 -r1.49
*** dialog.h    12 Apr 2002 15:35:40 -0000      1.48
--- dialog.h    25 Apr 2002 21:44:44 -0000      1.49
***************
*** 117,120 ****
--- 117,128 ----
      u_int32 npc_color () { return npc_color_; }
  
+     /**
+      * Returns the image to be displayed next to the NPC's speech.
+      *
+      *
+      * @return name of the image.
+      */
+     string npc_portrait () { return npc_portrait_; }
+ 
      /** 
       * Returns the number of %text lines available at this point of 
***************
*** 148,151 ****
--- 156,160 ----
      vector<string>::iterator i_text;// Iterator for the text_ vector
      u_int32 npc_color_;             // The color of the NPC's text
+     string npc_portrait_;           // Portrait of the NPC currently speaking
  
      vector<s_int32> answers;        // The indices with which to call 
instance.run () 

Index: dialog_screen.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog_screen.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** dialog_screen.cc    25 Apr 2002 15:34:11 -0000      1.6
--- dialog_screen.cc    25 Apr 2002 21:44:44 -0000      1.7
***************
*** 117,123 ****
  
      // set the NPC's portrait
      set_portrait (mynpc->get_portrait ());
      // ... and name
!     set_name (mynpc->get_name());
  
      // add everything to our container
--- 117,124 ----
  
      // set the NPC's portrait
+     portrait = "none";
      set_portrait (mynpc->get_portrait ());
      // ... and name
!     set_name (mynpc->get_name ());
  
      // add everything to our container
***************
*** 186,189 ****
--- 187,193 ----
      }
  
+     // update the NPC's portrait
+     set_portrait (dlg->npc_portrait ());
+ 
      // Add NPC text and all player reactions to container
      for (string txt = dlg->text (); txt != ""; txt = dlg->text (), i++)
***************
*** 247,254 ****
  void dialog_screen::set_portrait (const string & new_portrait)
  {
      if (new_portrait == "")
      {
          face->image::resize (64, 64);
!         face->fillrect (0, 0, 64, 64, 0);
          return;
      }
--- 251,261 ----
  void dialog_screen::set_portrait (const string & new_portrait)
  {
+     if (new_portrait == portrait) return;
+     else portrait = new_portrait;
+ 
      if (new_portrait == "")
      {
          face->image::resize (64, 64);
!         face->fillrect (0, 0, 64, 64, 0xff00ff);
          return;
      }

Index: dialog_screen.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog_screen.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** dialog_screen.h     10 Sep 2001 14:28:54 -0000      1.1
--- dialog_screen.h     25 Apr 2002 21:44:44 -0000      1.2
***************
*** 181,184 ****
--- 181,190 ----
       */
      bool is_running;
+ 
+     /**
+      * Image to display next to the NPC text
+      *
+      */
+     string portrait;
  #endif // SWIG
  };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]