[Scummvm-cvs-logs] CVS: residual costume.cpp,1.1,1.2 costume.h,1.1,1.2 lua.cpp,1.7,1.8

James Brown ender at users.sourceforge.net
Tue Aug 19 05:28:05 CEST 2003


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv18966

Modified Files:
	costume.cpp costume.h lua.cpp 
Log Message:
Various bits of started code


Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- costume.cpp	15 Aug 2003 19:41:26 -0000	1.1
+++ costume.cpp	19 Aug 2003 12:27:17 -0000	1.2
@@ -29,6 +29,21 @@
 #include <cstdio>
 #include <map>
 
+class BitmapComponent : public Costume::Component {
+public:
+  BitmapComponent(Costume::Component *parent, int parentID,
+		 const char *filename);
+  BitmapComponent *copy(Costume::Component *newParent);
+  void update();
+  void draw();
+
+private:
+  std::string filename_;
+  std::string zbuf_filename_;
+  Bitmap *bitmap_;
+  Bitmap *zbuffer_;
+};
+
 class ModelComponent : public Costume::Component {
 public:
   ModelComponent(Costume::Component *parent, int parentID,
@@ -83,6 +98,29 @@
   Model::HierNode *node_;
 };
 
+BitmapComponent::BitmapComponent(Costume::Component *parent, int parentID,
+			       const char *filename) :
+  Costume::Component(parent, parentID), filename_(filename), bitmap_(NULL),
+  zbuffer_(NULL) {
+
+  bitmap_ = ResourceLoader::instance()->loadBitmap(filename);
+  warning("Instanced BitmapComponenet from Costume renderer: NOT IMPLEMENTED YET");
+}
+
+BitmapComponent *BitmapComponent::copy(Costume::Component *newParent) {
+  BitmapComponent *result = new BitmapComponent(*this);
+  result->setParent(newParent);
+  return result;
+}
+
+void BitmapComponent::draw() {
+ ;
+}
+
+void BitmapComponent::update() {
+ ;
+}
+
 ModelComponent::ModelComponent(Costume::Component *parent, int parentID,
 			       const char *filename) :
   Costume::Component(parent, parentID), filename_(filename), obj_(NULL),
@@ -211,6 +249,7 @@
   Costume::Component(parent, parentID)
 {
   cmap_ = ResourceLoader::instance()->loadColormap(filename);
+
   ModelComponent *mc = dynamic_cast<ModelComponent *>(parent);
   if (mc != NULL)
     mc->setColormap(cmap_);
@@ -473,6 +512,7 @@
     chores_[id].length_ = length;
     chores_[id].numTracks_ = tracks;
     std::memcpy(chores_[id].name_, name, 32);
+    printf("Loaded chore: %s\n", name);
   }
 
   ts.expectString("section keys");
@@ -603,6 +643,9 @@
     return new LuaVarComponent(parent, parentID, name);
   else if (std::memcmp(tag, "imls", 4) == 0)
     return new SoundComponent(parent, parentID, name);
+  else if (std::memcmp(tag, "bknd", 4) == 0)
+    return new BitmapComponent(parent, parentID, name);
+  
   warning("Unknown tag '%.4s', name '%s'\n", tag, name);
   return NULL;
 }
@@ -661,6 +704,13 @@
       return i;
   }
   return -1;
+}
+
+void Costume::setTalkChore(int index, int chore) {
+ if (index > MAX_TALK_CHORES)
+  return;
+
+ talkChores_[index-1] = chore;
 }
 
 void Costume::draw() {

Index: costume.h
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- costume.h	15 Aug 2003 19:41:26 -0000	1.1
+++ costume.h	19 Aug 2003 12:27:17 -0000	1.2
@@ -20,6 +20,7 @@
 
 #include "resource.h"
 
+#define MAX_TALK_CHORES 6	// Ender: Pulled this number from thin air. Check.
 class TextSplitter;
 class Actor;
 
@@ -41,6 +42,7 @@
   int isChoring(int num, bool excludeLooping);
   int isChoring(bool excludeLooping);
 
+  void setTalkChore(int index, int chore);
   void update();
   void draw();
 
@@ -110,6 +112,7 @@
 
   int numChores_;
   Chore *chores_;
+  int talkChores_[MAX_TALK_CHORES];
 };
 
 #endif

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- lua.cpp	19 Aug 2003 07:20:03 -0000	1.7
+++ lua.cpp	19 Aug 2003 12:27:17 -0000	1.8
@@ -234,6 +234,24 @@
   lua_pushusertag(c, color_tag);
 }
 
+static void SetActorTalkChore() {
+  Actor *act = check_actor(1);
+  int index = check_int(2);
+  int chore = check_int(3);
+  Costume *costume;
+
+  if (lua_isnil(lua_getparam(4))) {
+    costume = act->currentCostume();
+    if (costume == NULL)
+      error("Actor %s has no costume\n", act->name());
+  } else {
+    costume = act->findCostume(luaL_check_string(4));
+    if (costume == NULL)
+      error("Actor %s has no costume %s\n", act->name(), lua_getstring(lua_getparam(4)));
+  }
+
+  costume->setTalkChore(index, chore);
+}
 static void SetActorVisibility() {
   Actor *act = check_actor(1);
   bool val = getbool(2);
@@ -785,7 +803,6 @@
   "GetActorYawToPoint",
   "GetActorPuckVector",
   "GetActorRect",
-  "SetActorTalkChore",
   "SetActorMumblechore",
   "SetActorRestChore",
   "SetActorTurnChores",
@@ -1012,6 +1029,7 @@
   { "WalkActorTo", WalkActorTo },
   { "TurnActor", TurnActor },
   { "PushActorCostume", PushActorCostume },
+  { "SetActorTalkChore", SetActorTalkChore },
   { "SetActorCostume", SetActorCostume },
   { "GetActorCostume", GetActorCostume },
   { "PopActorCostume", PopActorCostume },





More information about the Scummvm-git-logs mailing list