(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-03-24 11:08 AM
0 users currently in SMW Hacking.
Acmlm's Board - I3 Archive - SMW Hacking - Quick LevelASM question from newbie New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
SnifflySquirrel

Shyguy








Since: 03-03-06
From: Vermont

Last post: 6384 days
Last view: 6284 days
Posted on 04-02-06 06:27 PM Link | Quote
I need a portion of a LevelASM routine I'm writing to execute only on the very first frame of the level (to initialize some values). Is there any sure way to do this besides putting the initialization routine in a separate level?
1169

Red Goomba


 





Since: 03-27-06
From: Gold Coast, Australia

Last post: 6598 days
Last view: 6598 days
Posted on 04-02-06 08:17 PM Link | Quote
It really depends on the nature of the value. The logical way to do it would be to set a flag and use a branch based on the flag in your routine so the guts of your routine doesn't fire if the flag is set.

The problem with this is that as far as I know LevelASM doesn't allow you to put code in the 'exiting' code of a level which means you have no way of reseting the flag via LevelASM . . . you could always find the code that executes when you leave a level an manually insert it.
BMF54123
WARNING: MOOD LEVEL CRITICAL








Since: 11-18-05
From: MOOGLES

Last post: 6283 days
Last view: 6283 days
Posted on 04-03-06 05:07 AM Link | Quote
All RAM between $7EC800-$7EFFFF and $7FC800-$7FFFFF is cleared between levels, though the vast majority of that holds the current level layout. You should be safe storing a flag between $7FFF00-$7FFFFF (even the largest possible Layer 2 level never touches it), though a few people have already used the space for their own ASM hacks, so beware.

The safest thing to do (which I've implemented in my own hack) would be to hack the RAM-clearing routine to also clear another small area of memory, and use that instead. There are 1792 bytes of uninitialized RAM between $7EC100-$7EC7FF.
Glyphodon



 





Since: 11-18-05

Last post: 6324 days
Last view: 6305 days
Posted on 04-03-06 07:20 AM Link | Quote
LevelASM is not the right tool for the job. The whole point of LevelASM is so you have an easy way to run code every frame in a specific level. If that's not what you're aiming for, you shouldn't be using it.

At x213B8 there should be a snippet of code that is focused on initializing variables. If you put your own jump statement in to relocate this code somewhere where you have more room, you can put whatever you want there and it will only run once and only at the very beginning of the level.

If you wanted it to run only in a certain level, you'd have to put in your own compare and branch statements so it doesn't initialize the variable in every level. But, if most levels don't use that spot in RAM at all, you might not even need a branch statement.


(edited by Glyph Phoenix on 04-03-06 06:21 AM)
SnifflySquirrel

Shyguy








Since: 03-03-06
From: Vermont

Last post: 6384 days
Last view: 6284 days
Posted on 04-03-06 01:53 PM Link | Quote
Originally posted by Glyph Phoenix
At x213B8 there should be a snippet of code that is focused on initializing variables. If you put your own jump statement in to relocate this code somewhere where you have more room, you can put whatever you want there and it will only run once and only at the very beginning of the level.


Unfortunately, if I do that, my code only runs if I enter the level from the overworld. If I go through a pipe (for example) and warp to the level, it doesn't run, and I need it to.

Fortunately, I think I've devised a workaround (which I'll post, in case anyone cares ).

Being new to this as I am, the only code I know of that's guaranteed to run every time a level is loaded is the routine that makes LevelASM possible in the first place--the one installed by levelnum.ips. I relocated the routine (adding a JSL to it at the old location) and tacked my own initialization code onto the end of it. I tested it out, and it works just as I'd hoped. Hurray for me.
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6284 days
Last view: 6284 days
Posted on 04-03-06 10:00 PM Link | Quote
Originally posted by BMF54123
All RAM between $7EC800-$7EFFFF and $7FC800-$7FFFFF is cleared between levels, though the vast majority of that holds the current level layout. You should be safe storing a flag between $7FFF00-$7FFFFF (even the largest possible Layer 2 level never touches it)

Hm, so does that mean $7EFF00-$7EFFFF is safe too?
BMF54123
WARNING: MOOD LEVEL CRITICAL








Since: 11-18-05
From: MOOGLES

Last post: 6283 days
Last view: 6283 days
Posted on 04-04-06 05:10 AM Link | Quote
Originally posted by HyperMackerel
Hm, so does that mean $7EFF00-$7EFFFF is safe too?
I suppose, though it's filled with #$25, which isn't good if your code expects flags not to be set when you enter a level.
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - SMW Hacking - Quick LevelASM question from newbie |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.015 seconds; used 375.71 kB (max 462.39 kB)