Page 1 of 1

Libraries for common use

Posted: 07 May 2016, 10:53
by worldpeace125
List of libraries
1. Inserting more than 2 messages in a level
2. Using sublevels 1E0-1FF as ordinary levels
3. Level info and powerup filters
4. 121+ Events
5. Movie System
6. Lock System



1. Inserting more than 2 messages in a level

The extra message ASM has been included in the base ROM since ver 0.06, and you are allowed to have more than 2 messages in a single level. I'm giving some instructions to use it.

1) Inserting extra messages
Open PATCH/ExtraMsgData.asm first. Assuming the message box sprite is in sublevel xxx, you'll want to write a messages under the label ".extra_msg_xxx".

Eash sublevel can have more than one extra message. Each message should consist of 8 rows and 18 columns, and each line should be wrapped by " " after the db command. If these conditions are not satisfied, your messages will be misaligned.
Here's an example. There are two extra messages in sublevel 1B.
extra_msg_1b.png
extra_msg_1b.png (7.05 KiB) Viewed 6695 times
To apply your modification, open asar.exe in PATCH folder, and insert "asar_patch.asm" into the ROM (not "ExtraMsgData.asm"). When asar asks patch name, just enter asar_patch.asm.

2) Which message will be shown?
Suppose there are n extra messages in sublevel xxx, and the sublevel is a part of level yyy. Also suppose the horizontal position of a message box in the sublevel xxx is X, and there are n extra messages in sublevel xxx.

If n = 0 (default), the message box will show one of the regular messages of level yyy. (exactly same as vanilla)
If n > 0, X modulo n (i.e. X % n) is the index of the message to be shown. Here's an example table for n=3
Pos = 0/1/2/3/4/5/6/7/...
Msg = 0/1/2/0/1/2/0/1/... (the number starts from zero, so the index of the first extra msg is 0)


So, if your level yyy consists of 3 sublevel (including yyy) and each has 0, 1, 3 extra messages, your level can show at most 2(regular)+1+3=6 different messages.

Re: Libraries for common use

Posted: 26 May 2016, 06:53
by worldpeace125
2. Using sublevels 1E0-1FF as ordinary levels
1.png
1.png (7.32 KiB) Viewed 6613 times
Layer 1 tiles in the second page will allow you to use 1E0-1FF as ordinary levels enterable from overworld.

2.png
2.png (20.83 KiB) Viewed 6613 times
The entrance will be the level number plus 1E0, i.e.
0 -> 1E0
1 -> 1E1
2 -> 1E2
...
1F -> 1FF


To insert messages in these levels, open PATCH/ExtraMsgData.asm and add your messages (see the above post).

Re: Libraries for common use

Posted: 29 May 2016, 09:14
by worldpeace125
3. Level info and powerup filters
JUMP_00000.png
JUMP_00000.png (4.68 KiB) Viewed 6580 times
To modify stuffs in the level info dialogue, edit PATCH/levelinfodata.asm for icons and the number of exit, or PATCH/AuthorData.asm for the author field. Then with asar.exe, apply only asar_patch.asm into the base ROM.

Note that each level can have at most 4 icons and 2 lines of author info. Currently there are 9 icons available, and adding no yoshi/item icons to your level will function as the actual filter, which is activated when you enter the level from the map.
icons.png
icons.png (2.28 KiB) Viewed 6580 times
- No mushroom icon will get rid of all powerups at the entrance of the level. (filter level 1)
- No cape/flower icon will get rid of all capes/flowers at the entrance, respectively. (filter level 1)
- No yoshi icon will
1) get rid of yoshi at the entrance (filter level 1), if there is not "no yoshi intro",
or 2) do nothing if there's "no yoshi intro" already.
Note that this vanilla "no yoshi intro" makes the yoshi status reset in every level transition (filter level 2), while this automatic filter works only when you enter the level from overworld (filter level 1).
- Other five icons themselves don't directly affect the game yet.


In other words, here's a list of possible filters:
1. filter level 1: activated when you enter the level from overworld
- level info icons (yoshi/mushroom/cape/flower)
2. filter level 2: activated in every level transition (door/pipe/etc.)
- no yoshi intro(yoshi only), levelasm
3. filter level 3: always activated in game
- levelasm

Re: Libraries for common use

Posted: 04 Oct 2017, 06:58
by worldpeace125
4. 121+ Events
Currently 32 events are prepared (0x78-0x97, 120-151 in decimal), in addition to regular 120 events (0x0-0x77, 0-119 in decimal).

What are supported for 121+ events:
- Layer 1 tile destruction
- Layer 1 tile reveal
- Layer 2 events (non-silent)

What are NOT supported:
- Layer 1 events
- Layer 2 silent events
supported1.png
supported1.png (13.65 KiB) Viewed 6039 times


1) Layer 1 tile destruction: destruct a castle/switch/etc. at event 0x78+
You are allowed to put any value as usual.

2) Layer 1 tile reveal: reveal a level tile at event 0x78+
Step 1. In the map, obtain the xy position of the level supposed to be revealed. See the bottom left corner of the overworld editor.
coord.png
coord.png (2.03 KiB) Viewed 6039 times

Step 2. With these x and y values, find two values "layer1_reveal_ow_pos" and "layer1_reveal_vram_pos" from this table:
https://docs.google.com/spreadsheets/d/ ... sp=sharing
For the example above(x=D, y=33), the corresponding values are $063C and $D828, respectively.

Step 3. Open "PATCH/ExtraOWEventData.asm" and put the two values at the correct position. Save your changes by applying "PATCH/asar_patch.asm" to the ROM.


3) Layer 2 events
The layer 2 events of the last regular event(0x77) will be actually used by multiple events 0x77-0x97 (including 0x77). The earlier events should be placed in earlier steps in LM. Example:

event 0x77: step 0x0-0x2
event 0x78: step 0x3-0x7
event 0x79: step 0x8-0xA
event 0x7A: step 0xB-0xE
...

Open "PATCH/ExtraOWEventData.asm" and put the value of the beginning step of each event in the table labeled ".layer2_offset". The correct table values for the example above will be:

dw $0000
dw $0003,$0008,$000B, ...
...

Save your changes by applying "PATCH/asar_patch.asm" to the ROM.



Note: the border of dependence
nutshell.png
nutshell.png (32.9 KiB) Viewed 6039 times

Re: Libraries for common use

Posted: 21 Oct 2017, 23:56
by worldpeace125
5. Movie System

1) recording a movie

Step 1. Open level 1FF with LM and set the #00th screen exit to the entrance where your movie is supposed to start.
rec1.png
rec1.png (10.23 KiB) Viewed 5951 times

Step 2. Open the game with ZSNES, enter level 1FF, and go LEFT for the recording room.
JUMPhalf_00000.png
JUMPhalf_00000.png (4.47 KiB) Viewed 5951 times

Step 3. To start recording, enter the purple door. Before recording, you can decide the switch palace/initial powerup status/etc, which will be applied to the movie. (these settings will be effective only when the movie is played.)
JUMPhalf_00001.png
JUMPhalf_00001.png (7.52 KiB) Viewed 5951 times

Step 4. After entering the door, your movements will be recorded in RAM.
JUMPhalf_00002.png
JUMPhalf_00002.png (4.98 KiB) Viewed 5951 times

Savestate the game with ZSNES. Since the savestate file contains all the RAM values, it's possible to extract your motion data from it. The recorded data in the file starts from the latest level transition (via door/pipe/etc.), and ends exactly at when you create the savestate file naturally.


Step 4-2. If you want to include multiple rooms in the movie, savestate the game when the transition is being done (i.e. the screen fades out), so that the motion data in each room can be fully captured.
JUMPhalf_00003.png
JUMPhalf_00003.png (2.67 KiB) Viewed 5951 times

After saving data in the room, you can keep playing in the next room but must create ANOTHER savestate file for it. It's because the record in RAM is rewinded and starts from the beginning, after level transition. In the final room(to record), press the savestate button whenever you want, just like in step 4.
JUMPhalf_00004.png
JUMPhalf_00004.png (6.95 KiB) Viewed 5951 times

* No message box/death/goal allowed in the movie


Step 5. Get zst_to_bin.exe and drag and drop your ZSNES savestate file to it. It will create output.bin. Rename it as you want.
zst_to_bin.zip
(356.79 KiB) Downloaded 154 times


2) inserting the recorded movie

Step 1. Put your bin file(s) into the folder PATCH/replays/

Step 2. Open PATCH/ReplayData.asm and assign a label for each bin file(part 1). Each assignment consists of two lines:

Code: Select all

.[label name here]
	  incbin replays/[file name here].bin

Step 3. Choose one of .set00-.set1F and put the words of label addresses below it. Example:

Code: Select all

.set00
	dw .[label name 1]
	dw .[label name 2]
	dw .[label name 3]
This example means that the #00th movie consists of the 3 corresponding bin files.

* You can insert at most 32 movies(sets of bin files) and 128 bin files.

Step 4. Save your changes by applying "PATCH/asar_patch.asm" to the ROM.


3) playing the movie in game

I prepared 32 custom doors at the bottom of page 1A. Each door will play one of 32 movies. If movie is not inserted at certain slot(e.g. .set07), its door(1AE7) will just make the wrong sfx.

When you design the bowser's cinema, you just need to put those doors without concerning screen exits. (However, when you also put a regular door, it should be in a different screen from those special doors, otherwise contact me.) See the right side of level 1FF for the usage.
JUMPhalf_00005.png
JUMPhalf_00005.png (4.32 KiB) Viewed 5951 times

4) other settings outside of ReplayData.asm

To modify the returning entrances from movies, edit the block's code(GPS/blocks/moviedoor.asm). Set each value below "Dest" to the secondary exit number as the returning point. Insert the block to apply your changes.

Re: Libraries for common use

Posted: 02 Nov 2017, 03:41
by worldpeace125
6. Lock System

There are two kinds of lock blocks for shops; one requiring certain amount of dragon coins, and the other requiring you to visit certain level.
64 dc locks and 32 visit locks are prepared in total.

Lock GFX and palettes:
shopgfx.zip
(1.5 KiB) Downloaded 156 times

1) inserting a lock block
Press "Insert" in object mode. Put "2D" in Command field, and "00xx" in Extension field, where xx is the lock number(00-3F: dc lock, 40-5F:visit lock).
lock1.png
lock1.png (5.48 KiB) Viewed 5894 times

-You have to insert them as objects (not map16 tiles).
-Each lock should not be used more than once. Make sure to assign different locks to different warehouses.


2) setting a specific requirement for each block
Open GPS/blocks/lock_dc.asm or lock_visit.asm.
-lock_dc: CostTable contains the amount of required dcs for each block (00-3F, or 9A0-9DF as map16 number)
-lock_visit: LevelVisitTable contains the translevel number of the level required to be visited for each block (40-5F, or 9E0-9FF as map16 number).

To apply your changes, insert the blocks with GPS.


3) changing the message of lock blocks
See PATCH/ExtraMsgData_lock.asm for details. The messages are set to the ones that I wrote for JUMP years ago but I'd like to see someone rewrite them, since they kinda sucks and I'm not a native english user.

Save your changes by applying "PATCH/asar_patch.asm" to the ROM.