Many thanks for your suggestions. I started from scratch with the svn code, replaced all occurrences of "hero" with "VAR_EGO", and now the inventory glitches disappeared. :-)

And Santa was indeed not constrained by the boxes, because this was set explicitely for him by setActorIgnoreBoxes(). He also disappeared sometimes when reentering the room, but I fixed that by moving the init code to common.scc.

The only problem that remains is that Santa still has to be positioned expicitely in the room setup. He disappears if I remove that code. This means that he's back to his original position when Beasty reenters the room, even if he moved around previously. Beasty, however, stays at his position, even if Santa reenters the room, so I feel that there might be a way to have the engine take care of them both. Any ideas why it works with Beasty and not with Santa?

I made a diff, but I've never done diffs before, so you might wanna double-check before applying it. Couldn't find a unidiff option, so I hope it's unidiff by default. Alternatively, I can send you the files.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Index: scummc/trunk/examples/road/road.scc
===================================================================
--- scummc/trunk/examples/road/road.scc	(.../https://dotsec.net/repos/scummc)	(Revision 264)
+++ scummc/trunk/examples/road/road.scc	(.../scummc)	(Arbeitskopie)
@@ -22,8 +22,8 @@
 #include "common.sch"
 
 bit welcomed,lost,santaHello,santaPlace,santaReal;
-actor santa;
-#define SANTA_COLOR 14
+//actor santa;
+//#define SANTA_COLOR 14
 
 // our room
 room Road {
@@ -37,7 +37,7 @@
     trans = 0;
 
     //cycle testCycl = { 60, 0, 103, 111 };
-    cost santaCost = "santa.cost";
+    //cost santaCost = "santa.cost";
 
     voice letsgothere = { "letsgothere.voc", 500 };
     voice welcome = { "welcome.voc" };
@@ -299,14 +299,26 @@
             ResRoom::dialogEnd();
             return;
 
+        //case Use:
+            //if(objB == axe)
+                //egoSay("Killing him won't help us.");
+            //else
+                //egoSay("I can't just *use* someone.");
+        //}
         case Use:
-            if(objB == axe)
-                egoSay("Killing him won't help us.");
-            else
-                egoSay("I can't just *use* someone.");
+           if(objB == axe)
+               egoSay("Killing him won't help us.");
+           else {
+               // switch actors
+               egoSay("I will use Santa as my alter ego.");
+               VAR_EGO = santa;
+               cameraFollowActor(VAR_EGO);
+
+           }
         }
-    }
 
+   }
+
     local script walkOut(int eff) {
         screenEffect(eff);
         startRoom(Road);
@@ -377,19 +389,17 @@
         setRoomColor(0,0,0,0);
 
         // Setup the santa
-        setCurrentActor(santa);
-        initActor();
-        setActorCostume(santaCost);
-        setActorTalkPos(-60,-60);
-        setActorName("Santa");
-        setActorTalkColor(SANTA_COLOR);
-        setActorAnimSpeed(2);
+        if(VAR_EGO!=santa) {
+        
         actorObject[santa] = santaObj;
-        // allow it to be outside of the walk boxes
-        setActorIgnoreBoxes();
-        putActorAt(santa,20,90,Road);
+        
+        // DON'T allow it to be outside of the walk boxes
+        //setActorIgnoreBoxes();
+        putActorAt(santa,250,90,Road);
         // run the "standing" anim
         setActorStanding();
+        
+        }
         setCurrentActor(VAR_EGO);
 
         // init the print slot
@@ -405,8 +415,10 @@
                 panCameraTo(440);
                 waitForCamera();
                 cameraFollowActor(VAR_EGO);
-                walkActorTo(hero,430,80);
-                waitForActor(hero);
+                //walkActorTo(hero,430,80);
+                //waitForActor(hero);
+                walkActorTo(VAR_EGO,430,80);
+                waitForActor(VAR_EGO);
                 
                 egoSay("Hello mortal.");
                 waitForMessage();
@@ -429,24 +441,28 @@
                 setCurrentActor(VAR_EGO);
                 setActorDirection(WEST);
                 cameraFollowActor(VAR_EGO);
-                walkActorTo(hero,420,90);
+                //walkActorTo(hero,420,90);
+                walkActorTo(VAR_EGO,420,90);
                 break;
             case 1:
                 putActorAt(VAR_EGO,460,0,Road);
                 cameraFollowActor(VAR_EGO);
-                walkActorTo(hero,450,40);
+                //walkActorTo(hero,450,40);
+                walkActorTo(VAR_EGO,450,40);
                 break;
             case 2:
                 putActorAt(VAR_EGO,60,144,Road);
                 setCurrentActor(VAR_EGO);
                 setActorDirection(NORTH);
                 cameraFollowActor(VAR_EGO);
-                walkActorTo(hero,80,120);
+                //walkActorTo(hero,80,120);
+                walkActorTo(VAR_EGO,80,120);
                 break;
             }
 
             unless(lost) {
-                waitForActor(hero);
+                //waitForActor(hero);
+                waitForActor(VAR_EGO);
                 egoSay("I think I'm lost.");
                 lost = 1;
             }
Index: scummc/trunk/examples/road/common.scc
===================================================================
--- scummc/trunk/examples/road/common.scc	(.../https://dotsec.net/repos/scummc)	(Revision 264)
+++ scummc/trunk/examples/road/common.scc	(.../scummc)	(Arbeitskopie)
@@ -42,7 +42,10 @@
     chset dialogCharset = "vera-small.char";
     // and the costume for our actor
     cost egoCost = "devil.cost";
+    
+    cost santaCost = "santa.cost";
 
+
     // an object for the cursor image
     object cursor {
         x = 0;
@@ -87,6 +90,16 @@
         setActorAnimSpeed(2);
         // set VAR_EGO so we can use the *Ego* functions
         VAR_EGO = hero;
+        
+        // put santa stuff here
+        setCurrentActor(santa);
+        initActor();
+        setActorCostume(santaCost);
+        setActorTalkPos(-60,-60);
+        setActorName("Santa");
+        setActorTalkColor(SANTA_COLOR);
+        setActorAnimSpeed(2);
+
     }
 
     // setup all the verbs
@@ -417,16 +430,42 @@
                 egoSay("I can't pick that up.");
             break;
             
-        case Use:
-            if(objA <= 0xF) {
-                if(objB)
-                    egoSay("I can't use that on someone!");
-                else
-                    egoSay("I can't just *use* someone!");
-            } else
-                egoSay("I can't use that !");
-            break;
+        //case Use:
+            //if(objA <= 0xF) {
+                //if(objB)
+                    //egoSay("I can't use that on someone!");
+                //else
+                    //egoSay("I can't just *use* someone!");
+            //} else
+                //egoSay("I can't use that !");
+            //break;
             
+       case Use:
+           if(objA <= 0xF) {
+               if(objB)
+                   egoSay("I can't use that on someone!");
+               else {
+                   // switch actors
+                   if( objA == santa )
+                     VAR_EGO = santa;
+                   else if( objA == hero )
+                     VAR_EGO = hero;
+                   cameraFollowActor(VAR_EGO);
+               }
+           } else
+               egoSay("I can't use that !");
+           break;
+
+       case Give:
+           if(objB && objA <= 0xF) {
+               egoSay("I'll give it to him.");
+               setObjectOwner(objB,objA);
+               break;
+           }
+           else
+               egoSay("Can't give things to non-persons.");
+           break;
+
         case LookAt:
             if(objA <= 0xF)
                 egoSay("There is nothing special about him.");
@@ -671,14 +710,16 @@
         int i, count;
         //unless(obj) return;
 
-        count = getInventoryCount(hero);
+        //count = getInventoryCount(hero);
+        count = getInventoryCount(VAR_EGO);
 
         dbgPrint("%i{count} obj in inv");
 
 
         for(i = 0 ; i < 8 ; i++) {
             if(i < count) {
-                obj = findInventory(hero,i+1);
+                //obj = findInventory(hero,i+1);
+                obj = findInventory(VAR_EGO,i+1);
                 startObject2(obj,Icon, [ setInventoryIcon, invSlot0+i ]);
             } else {
                 setCurrentVerb(invSlot0+i);
Index: scummc/trunk/examples/road/common.sch
===================================================================
--- scummc/trunk/examples/road/common.sch	(.../https://dotsec.net/repos/scummc)	(Revision 264)
+++ scummc/trunk/examples/road/common.sch	(.../scummc)	(Arbeitskopie)
@@ -63,6 +63,9 @@
 actor hero;
 #define BEASTY_COLOR      7
 #define BEASTY_DIM_COLOR 26
+// move santa into commons
+actor santa;
+#define SANTA_COLOR 14
 
 room ResRoom {
     script showVerbs(int show);

_______________________________________________
ScummC-general mailing list
[email protected]
https://mail.gna.org/listinfo/scummc-general

Reply via email to