Banner
Views: 705,370,008
Time:
12 users online: Classfan, CosmicTiff, Darolac, Major Flare, o Mirann, nintendofreck, PokerFace, Sariel, o Shiny Ninetales, SkeptisTrader, WhiteYoshiEgg, xHF01x - Guests: 42 - Bots: 107Users: 36,853 (1,455 active)
Latest: Minigamemaster50
Tip: Remember to remove the original SMW events, both layer 2 and layer 1, when making a new overworld.Not logged in.
Wonder why a block behaves 130, but behaves 25 by gps still pushes sprites?
Forum Index - SMW Hacking - Resource & Tool Releases - SMW Data Repository - Wonder why a block behaves 130, but behaves 25 by gps still pushes sprites?
Pages: « 1 »
When making custom blocks, you do make blocks acts as 25 by doing this:

Code
LDY #$00
LDA #$25
STA $1693


Simple, right? But what happens when you make a block act as $130 in lunar magic and use this code for both sprite H and sprite V?

Well something strange happens: the sprite STILL gets pushed as if the block act as $130 if you kick a sprite (like a shell) upwards into it, even when the code tells the game to act $25.

This also works the other way around, if you make a wall of blocks that behave $025 in lunar magic and make the blocks behave $130 in GPS, placing a sprite in the wall (crouching, then let go of the sprite) won't push the sprite outwards.

Let me explain why:

Here is the code that LM inserts that check to determine if the offset is spriteV or spriteH (highlighted in red):

Code
06f608 ldy $0d9b            ;\If level mode activator isn't boss rooms branch
06f60b bpl $f619            ;/behavor number routine
06f60d ply                  ;\Pull out Y for someting?
06f60e ply                  ;/
06f60f bra $f603            ;>Go to restore and go back to smw's code

[...]

06f619 xba                  ;>Swap bytes in A (handle high byte)
06f61a lda $1693            ;>Block behavor
06f61d phx                  ;>Preserve X (used by sprite index)
06f61e rep #$30             ;>16-bit AXY
06f620 tay                  ;>Transfer block behavor
06f621 asl a                ;>Left shift (pointer table is 2 bytes each)
06f622 tax                  ;>Transfer to index
06f623 lda $118000,x        ;>Load behavor acts like table from the ROM (this is altered by changing the behavor in LM).
06f627 cmp #$0200           ;\If map16 page 2 and beyond, branch to loop back to $06F620
06f62a bcs $f620            ;/(FuSoYa mentions you shouldn't "chain" your block behavor (block #$0200 acts like #$2001, which that acts like #$0130))
06f62c sty $03              ;>$03 = current map16 number
06f62e sep #$30             ;>8-bit AXY
06f630 plx                  ;>Restore X
06f631 sta $1693            ;>Set block behavor by LM (allows for example: block $0200 to act like $0130)
06f634 xba                  ;>Swap bytes in A again
06f635 tay                  ;>Transfer high byte behavor number again
06f636 lda $08,s            ;>Load the 8th last item in stack (determines what offsets), 
06f638 rts                  ;>And done.

[...]

;A hijack in the sprite-block interaction routine at $019533 JMLs to here.
06f700 jsr $f608            ;>Boss room check and loading custom behavor
06f703 cmp #$71             ;\$019272-1 SpriteV
06f705 beq $f720            ;/
06f707 cmp #$57             ;\$019158-1 SpriteH
06f709 beq $f730            ;/
06f70b cmp #$d2             ;\$0192d3-1 SpriteV (slope?)
06f70d beq $f720            ;/
06f70f cmp #$93             ;\$019294-1 SpriteH (slope?)
06f711 beq $f730            ;/
06f713 cmp #$7f             ;\Another spriteH (unused?)
06f715 beq $f730            ;/
06f717 jmp $f602            ;>Go to restore and go back to smw's code


So, depending on where the call subroutine in the block-interaction is located determines which branch is taken. However, when testing why there is a bug with the behavior, I've discovered something intresting, I debug the interaction and found this:

Code
019533 jsl $06f700   [06f700] A:0105 X:0007 Y:0000 S:01eb D:0000 DB:01 nvMXdizc V: 53 H:272 F:31    ;\It did got a map16 number that is a custom block
06f700 jsr $f608     [06f608] A:0105 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizc V: 53 H:287 F:31
06f608 ldy $0d9b     [010d9b] A:0105 X:0007 Y:0000 S:01e6 D:0000 DB:01 nvMXdizc V: 53 H:299 F:31
06f60b bpl $f619     [06f619] A:0105 X:0007 Y:0000 S:01e6 D:0000 DB:01 nvMXdiZc V: 53 H:307 F:31
06f619 xba                    A:0105 X:0007 Y:0000 S:01e6 D:0000 DB:01 nvMXdiZc V: 53 H:312 F:31
06f61a lda $1693     [011693] A:0501 X:0007 Y:0000 S:01e6 D:0000 DB:01 nvMXdizc V: 53 H:317 F:31
06f61d phx                    A:0501 X:0007 Y:0000 S:01e6 D:0000 DB:01 nvMXdizc V: 53 H:325 F:31
06f61e rep #$30               A:0501 X:0007 Y:0000 S:01e5 D:0000 DB:01 nvMXdizc V: 53 H:330 F:31
06f620 tay                    A:0501 X:0007 Y:0000 S:01e5 D:0000 DB:01 nvmxdizc V: 53 H:335 F:31
06f621 asl a                  A:0501 X:0007 Y:0501 S:01e5 D:0000 DB:01 nvmxdizc V: 53 H:339 F:31
06f622 tax                    A:0a02 X:0007 Y:0501 S:01e5 D:0000 DB:01 nvmxdizc V: 54 H:  2 F:31
06f623 lda $118000,x [118a02] A:0a02 X:0a02 Y:0501 S:01e5 D:0000 DB:01 nvmxdizc V: 54 H:  6 F:31
06f627 cmp #$0200             A:0025 X:0a02 Y:0501 S:01e5 D:0000 DB:01 nvmxdizc V: 54 H: 18 F:31
06f62a bcs $f620     [06f620] A:0025 X:0a02 Y:0501 S:01e5 D:0000 DB:01 Nvmxdizc V: 54 H: 24 F:31
06f62c sty $03       [000003] A:0025 X:0a02 Y:0501 S:01e5 D:0000 DB:01 Nvmxdizc V: 54 H: 28 F:31
06f62e sep #$30               A:0025 X:0a02 Y:0501 S:01e5 D:0000 DB:01 Nvmxdizc V: 54 H: 36 F:31
06f630 plx                    A:0025 X:0002 Y:0001 S:01e5 D:0000 DB:01 NvMXdizc V: 54 H: 41 F:31
06f631 sta $1693     [011693] A:0025 X:0007 Y:0001 S:01e6 D:0000 DB:01 nvMXdizc V: 54 H: 48 F:31
06f634 xba                    A:0025 X:0007 Y:0001 S:01e6 D:0000 DB:01 nvMXdizc V: 54 H: 56 F:31
06f635 tay                    A:2500 X:0007 Y:0001 S:01e6 D:0000 DB:01 nvMXdiZc V: 54 H: 61 F:31
06f636 lda $08,s     [0001ee] A:2500 X:0007 Y:0000 S:01e6 D:0000 DB:01 nvMXdiZc V: 54 H: 65 F:31
06f638 rts                    A:2582 X:0007 Y:0000 S:01e6 D:0000 DB:01 NvMXdizc V: 54 H: 72 F:31
06f703 cmp #$71               A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 NvMXdizc V: 54 H: 83 F:31    ;\But does not run custom block code!!
06f705 beq $f720     [06f720] A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizC V: 54 H: 87 F:31
06f707 cmp #$57               A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizC V: 54 H: 91 F:31
06f709 beq $f730     [06f730] A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizC V: 54 H: 95 F:31
06f70b cmp #$d2               A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizC V: 54 H: 99 F:31
06f70d beq $f720     [06f720] A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 NvMXdizc V: 54 H:103 F:31
06f70f cmp #$93               A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 NvMXdizc V: 54 H:107 F:31
06f711 beq $f730     [06f730] A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 NvMXdizc V: 54 H:111 F:31
06f713 cmp #$7f               A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 NvMXdizc V: 54 H:115 F:31
06f715 beq $f730     [06f730] A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizC V: 54 H:119 F:31
06f717 jmp $f602     [06f602] A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizC V: 54 H:123 F:31
06f602 tya                    A:2582 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdizC V: 54 H:129 F:31
06f603 jml $00f545   [00f545] A:2500 X:0007 Y:0000 S:01e8 D:0000 DB:01 nvMXdiZC V: 54 H:132 F:31


Something is up with the stack that determines the offset of the sprite, since FuSoYa didn't include #$82 in the "offset list", this causes the collision code to not execute custom block code AT ALL. Which means that $1693 is left the way it is since you set the map16 behaviors in Lunar magic.

Give a big thanks to the developers of bsnes plus, the debugger has WAY more functions that snes9x.

--------------------
Give thanks to RPG hacker for working on Asar.
It's common knowledge that there's a handful of cases that LM doesn't bother adding handlers for. #$82 in particular (shell within block) has been known about since LM first added custom block code.

In fact, I remember releasing an IPS file on Acmlm's board back in 2003 or so to enable several extra ones for anyone that wanted to play around with them.

Edit: Also that "chain" bit you mention is a misquote. I said you should avoid making *long* chains, not avoid chains entirely.
Pages: « 1 »
Forum Index - SMW Hacking - Resource & Tool Releases - SMW Data Repository - Wonder why a block behaves 130, but behaves 25 by gps still pushes sprites?

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2018 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 22

Menu

Follow Us On

  • Facebook
  • Twitter
  • YouTube

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented