Banner
Views: 1,002,749,219
Time:
10 users online: BearAndBoarFan, h.carrell, HamOfJustice, imamelia, Irondill, KaidenThelens, Koopenstein, mae_86, UTF, will___ - Guests: 59 - Bots: 156 Users: 54,811 (2,032 active)
Tip: Stay up-to-date with new tool and resource releases on the SMW hacking scene by viewing this forum.
Not logged in.
[WIP] Memory-based conditional map16 blocks
Forum Index - Sunken Ghost Ship - C3 Museum - Winter 2020 - [WIP] Memory-based conditional map16 blocks
Tags:
Pages: « 1 » Link
https://imgur.com/a/cqwV4m1

Github.

Unlike how memory locked gates work on Blind Devil's Mushroom Kingdom - Under Crimson Skies or that one video I couldn't remember that demonstrated these locked gates (also had SFX from ALTTP) that was a livestream, this one does not need duplicate map16 blocks to determine what flag it uses to tell itself to not respawn, instead:
  • It now uses freeram to overcome the 128-flag limit (now its per-level of that 128-bit limit).
  • The blocks to determine what flag they are associated with uses a subroutine that searches a list of level numbers, what layer they are on, and location within the level (XY coords to $C800 index), to find what flag to set/clear.
  • How does this overcome of the 128-bit limit works? Well, I make it so that each level using this mechanic are assigned to what groups of 16 bytes of freeram to use. When the level loads, the asm file MBCM16WriteGroup128To7FC060.asm will transfer that 16 bytes to LM's $7FC060. Therefore $7FC060 is treated as a “switch” to toggle the block's existence, while the freeram is the “global memory” that is the destination that $7FC060 have migrated to.


This ASM resource (works in progress) is highly useful if you have more than 128 bit flags throughout your entire hack, espically if your hack is exploration-based.

--------------------
Give thanks to RPG hacker for working on Asar.
Originally posted by HammerBrother
espically if your hack is exploration-based.

Hoo boy, will this be a nifty toy to play with.
I don't suppose it's simple for the opened doors be made to stay open forever, even between play sessions?

--------------------

Currently working on Æther: The Infinite Library!

Other Submissions of mine!
Originally posted by Deeke
Originally posted by HammerBrother
espically if your hack is exploration-based.

Hoo boy, will this be a nifty toy to play with.
I don't suppose it's simple for the opened doors be made to stay open forever, even between play sessions?


It uses RAM that doesn't clear on level load, (sram/bwram plus also required) and this is the hardest part, finding untouched RAM, which can be alleviated using a debugger.

To make the blocks stay at a state forever, first, assign them to what flag number on Freeram_MemoryFlag, to do that, you would open these ASM files:
  • UberasmTool/Library/MBCM16WriteGroup128To7FC060.asm

  • Blocks/routines/SearchBlockFlagIndex.asm

  • Blocks/routines/GetWhatKeyCounter


In them, they have a HUGE list, in this case if you place a block in level $105 at position ($0006, $0016) on layer 1 using flag 0, you do this:

This is the list of level numbers for each flag to be assigned to:
Code
?GetFlagNumberLevelIndexStart:
	dw $0105		;>Flag $0 -> LM's CM16 $0
	dw $FFFF		;>Flag $1 -> LM's CM16 $1
	dw $FFFF		;>Flag $2 -> LM's CM16 $2
	dw $FFFF		;>Flag $3 -> LM's CM16 $3


This is what layer the block is on, $00 = layer 1, $01 = layer 2 (when using layer 2 level):
Code
?GetFlagNumberLayerProcessingStart:
	db $00		;>Flag $0 -> LM's CM16 $0
	db $00		;>Flag $1 -> LM's CM16 $1
	db $00		;>Flag $2 -> LM's CM16 $2
	db $00		;>Flag $3 -> LM's CM16 $3


This is the block location, simply instead of storing the block data as XY coordinates (each value is 16-bit), it is in their $C800 index (one 16-bit value), which is 1/2 the amount of space they take up. With the features of asar, I made the XYCoords -> $C800 index much easier using a function:

Code
function GetC800IndexHorizLvl(RAM13D7, XPos, YPos) = (RAM13D7*(XPos/16))+(YPos*16)+(XPos%16)
function GetC800IndexVertiLvl(XPos, YPos) = (512*(YPos/16))+(256*(XPos/16))+((YPos%16)*16)+(XPos%16)

And the table should be like this for a position ($0006, $0016):
Code
	dw GetC800IndexHorizLvl($01B0, $0006, $0016)		;>Flag $0 -> LM's CM16 $0
	dw GetC800IndexHorizLvl($01B0, $0000, $0000)		;>Flag $1 -> LM's CM16 $1
	dw GetC800IndexHorizLvl($01B0, $0000, $0000)		;>Flag $2 -> LM's CM16 $2
	dw GetC800IndexHorizLvl($01B0, $0000, $0000)		;>Flag $3 -> LM's CM16 $3


Of course, the readme links to a javascript file that generates not only various information such as the memory range and number of bits, it also generates ASM tables WITH comments to make this a lot easier.

I tried to make this as user-friendly as possible, since a lot of the effort of inserting this is outside of LM, and more likely that you have to come back and edit the tables as you create levels.

You can have up to 2048 bits in your entire hack, which is 256 bytes of !Freeram_MemoryFlagRAM. Meaning 2048 non-respawning keys and doors in your hack.

--------------------
Give thanks to RPG hacker for working on Asar.
Pages: « 1 » Link
Forum Index - Sunken Ghost Ship - C3 Museum - Winter 2020 - [WIP] Memory-based conditional map16 blocks

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

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


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy
  • sm64romhacks