Author Topic: [SOLVED] Yo-yoing between two rooms  (Read 3954 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

[SOLVED] Yo-yoing between two rooms
« on: May 15, 2019, 07:49:35 PM »
What the heck is going on? There's nothing wrong (at first glance) with my room code as it's exactly the same as another game's rooms I have, but what's happening is I walk to the edge of the room and change to the next room, but then immediately I switch back to the last room, and then immediately switch back to the second room again, and back and forth forever. I even changed the gEgo's X position to be 310 instead of the standard 319. And then to 300. And then to 200. But it seems like the gEgo posn code is being ignored. I threw in a DebugPrint to confirm that the ego's X position was what I set it to and it is being set. It's just being ignored. Any ideas?

EDIT: I decided to repeat the DebugPrint command further down after the previous room number states with the rest of the inits and it does seem to be resetting the Ego's position to 316 and not 200. Why is this happening?

Code: [Select]
(switch gPreviousRoomNumber
(west
(gRoom style: dpOPEN_SCROLL_LEFT)
(gEgo posn: 10 (gEgo y?) loop: 0)
)
(east
;(gRoom style: dpOPEN_SCROLL_RIGHT)
(gEgo posn: 200 (gEgo y?) loop: 1)
(DebugPrint {X = %d} (gEgo x?)) ;Says gEgo x is 200, good.
)
(else
(self style: (| dpOPEN_PIXELATION dpANIMATION_BLACKOUT))
; Set up ego view and loop (direction)
;(SetUpEgo -1 0)
(gEgo
setScale: Scaler 100 55 75 40 ; theFrontSize theBackSize theFrontY theBackY
posn: 167 63
loop: 2
get: 0
)
(Portcullis
posn: 160 7
setStep: 2 3
ignoreControl: ctlWHITE
setScript: gateScript
)
(gateScript changeState: 1)
)
)
(super init:)
(gEgo init:)
(Portcullis init:)
(DebugPrint {X = %d} (gEgo x?)) ;Says gEgo x is 316????
)
« Last Edit: May 16, 2019, 10:28:33 AM by MusicallyInspired »


Brass Lantern Prop Competition

Offline troflip

Re: Yo-yoing between two rooms
« Reply #1 on: May 15, 2019, 09:39:34 PM »
Maybe the positions you're trying are places the ego can't be, so it resets it to something else?
Or maybe the Portcullis is a Door, so it sets the ego's position explicitly?

What happens if you put a DebugPrint in the posn method? If if this is SCI0, then you have access to a debugger (or use ScummVM) and you can put a breakpoint on the posn method.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Yo-yoing between two rooms
« Reply #2 on: May 15, 2019, 09:48:33 PM »
The Portucllis is just an actor that moves up and down. It's an SCI1.1 game.

When you say put it in the posn method do you mean inside along with "gEgo posn:"? Or in the actual method in Actor.sc?

EDIT: I did both. Something is definitely changing the poisiton but I haven't the foggiest what it could be.

As far as placing the ego somewhere it can't be, it's inside the contained polygons on both screens. I just don't get it.
« Last Edit: May 15, 2019, 10:25:13 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: Yo-yoing between two rooms
« Reply #3 on: May 16, 2019, 01:28:15 AM »
The Portucllis is just an actor that moves up and down. It's an SCI1.1 game.

When you say put it in the posn method do you mean inside along with "gEgo posn:"? Or in the actual method in Actor.sc?

EDIT: I did both. Something is definitely changing the poisiton but I haven't the foggiest what it could be.

As far as placing the ego somewhere it can't be, it's inside the contained polygons on both screens. I just don't get it.

With a debugger, you could put a breakpoint on Actor:posn and see the exact send stack and immediately tell who's calling it. Unfortunately no debugger in the publicly available SCI1.1 interpreter, but ScummVM has one, and I think there is pretty good documentation on how to use it.

Otherwise, you'll just be left guessing... although you could narrow it down a bit by putting DebugPrint's between every line in your room's init, to see roughly when it's changing.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Yo-yoing between two rooms
« Reply #4 on: May 16, 2019, 08:07:46 AM »
Oh yes you did mention ScummVM. Sorry I forgot. I was so tired last night. Never used thebScummVM debugger before but if it's as easy as you say it won't be a problem at all. How would I go about adding a breakpoint exactly where I need it? Is it a command you add in the script? I can't seem to find any more information about that.

EDIT: Never mind, I figured it out. However, the wiki doesn't seem to be that comprehensive. I barely know what I'm doing. I can set breakpoints but I can't seem to get it to do anything else. I set a breakpoint for Write Actor::posn and an action to show the object but nothing happens.
« Last Edit: May 16, 2019, 10:10:45 AM by MusicallyInspired »
Brass Lantern Prop Competition

Offline MusicallyInspired

Re: Yo-yoing between two rooms
« Reply #5 on: May 16, 2019, 10:25:38 AM »
Ok, I wasn't getting anywhere with the ScummVM Debugger so I placed DebugPrints all over the first room script. Turns out gEgo's X is being set after (super init:) which I've put after all the gPreviousRoomNumber cases. The reason I did this is because the screen transitions wouldn't animate otherwise. I ran into this before in my previous iteration of this game and someone suggested to move the (super init:) after which solved it. However, this yo-yoing never happened in that game. Turns out that I didn't move the (super init:) in the original game I just copied it. So not having a (super init:) at the beginning of the room's doit method is the culprit.

So, solved.
« Last Edit: May 16, 2019, 10:28:21 AM by MusicallyInspired »
Brass Lantern Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.256 seconds with 23 queries.