Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-12-11 18:54:56

~Red
Member
Registered: 2010-10-16
Post 275/276

Things done in wrong order?

ld hl, wSimulatedJoypadStatesEnd
ld de, RLEMovementMOVEUP3
call DecodeRLEList
dec a
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld c,80
call DelayFrames
ld a, $4
ld [$ff8c], a
call DisplayTextID
ld c,80
call DelayFrames
callba BlowUpMansion

For some reason it displays the text first, then calls "BlowUpMansion" and then moves the character? How do I make it do things in order?

Offline

#2 2016-12-11 19:18:02

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,003/1,022

Re: Things done in wrong order?

I'm not totally sure and I haven't experimented with this code myself, but the first solution I can think of is replace the call to DelayFrames with a loop that loops while the character's coords don't match the final position after the movement. I'm pretty sure simulated movement gets updated in the interrupts so a small loop inside a script that waits for the coordinates to change should work.


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

#3 2016-12-11 19:36:08

~Red
Member
Registered: 2010-10-16
Post 276/276

Re: Things done in wrong order?

Danny-E 33 wrote:

I'm not totally sure and I haven't experimented with this code myself, but the first solution I can think of is replace the call to DelayFrames with a loop that loops while the character's coords don't match the final position after the movement. I'm pretty sure simulated movement gets updated in the interrupts so a small loop inside a script that waits for the coordinates to change should work.


Changed it to this:

ld hl, wSimulatedJoypadStatesEnd
ld de, RLEMovementMOVEUP3
call DecodeRLEList
dec a
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
.isWhereNeeded
ld a,[W_YCOORD]
cp 24
jr nz,.isWhereNeeded
ld a, $4
ld [$ff8c], a
call DisplayTextID
callba BlowUpMansion

And game just freezes.

Offline

#4 2016-12-13 22:16:24

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,004/1,022

Re: Things done in wrong order?

Yeah I guess I'm wrong about how simulated movement is updated.

My next suggestion would be to have that script call StartSimulatingJoypadStates and then change the map's script number to a new script. This new script would check if the player's y coord is 24 and return if not. If it is 24, change the map's script number to a new script then return. This new script displays the text then calls BlowUpMansion.


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

Board footer

Powered by FluxBB