-
Notifications
You must be signed in to change notification settings - Fork 8
8. Advanced topics
This entire section requires a little bit of ASM knowledge and UberASMTool usage.
- Custom player palettes
- Adding separate Luigi graphics
- Mario ExGFX
- Custom hitboxes
- Custom ground interaction
This feature works exactly like the Manual Player Palette Uploader from imamelia, to have custom palettes in your level you could use the following code:
main:
lda #$01
sta !pal_bypass
lda.b #.palette
sta !pal_pointer
lda.b #.palette/$100
sta !pal_pointer+1
lda.b #.palette/$10000
sta !pal_pointer+2
rtl
.palette
dw $4F3F,$581D,$1140,$3FE0,$3C07,$7CAE,$7DB3,$2F00,$165F,$03FF
The code as it is, will force the player's palette to use the colors below the .palette
sublabel, which are SMW's Luigi colors.
With enough tinkering, you can get different palettes per powerup and a handy macro to allow usage of mw3 files instead of raw palette data. Example:
macro insert_player_palette(filename)
<filename>:
incbin <filename>.mw3:10C-120
endmacro
main:
lda $19
sta $00
asl
clc
adc $00
tax
lda #$01
sta !pal_bypass
lda .palettes,x
sta !pal_pointer
lda .palettes+1,x
sta !pal_pointer+1
lda .palettes+2,x
sta !pal_pointer+2
rtl
.palettes
dl small_luigi
dl big_luigi
dl cape_luigi
dl fire_flower_luigi
dl hammer_suit_luigi
dl boomerang_suit_luigi
dl super_leaf_luigi
dl tanooki_suit_luigi
dl superball_flower_luigi
dl frog_suit_luigi
dl rocket_boots_luigi
dl mini_mushroom_luigi
dl ice_flower_luigi
dl penguin_suit_luigi
dl propeller_suit_luigi
dl shell_suit_luigi
dl bubble_flower_luigi
dl cat_suit_luigi
..data
%insert_player_palette(small_luigi)
%insert_player_palette(big_luigi)
%insert_player_palette(cape_luigi)
%insert_player_palette(fire_flower_luigi)
%insert_player_palette(hammer_suit_luigi)
%insert_player_palette(boomerang_suit_luigi)
%insert_player_palette(super_leaf_luigi)
%insert_player_palette(tanooki_suit_luigi)
%insert_player_palette(superball_flower_luigi)
%insert_player_palette(frog_suit_luigi)
%insert_player_palette(rocket_boots_luigi)
%insert_player_palette(mini_mushroom_luigi)
%insert_player_palette(ice_flower_luigi)
%insert_player_palette(penguin_suit_luigi)
%insert_player_palette(propeller_suit_luigi)
%insert_player_palette(shell_suit_luigi)
%insert_player_palette(bubble_flower_luigi)
%insert_player_palette(cat_suit_luigi)
The code above requires each of these mw3 files to exist in the same folder as your uberasm code. It will load them depending on the player's powerup status.
Adding graphics is matter of dragging and droping a file and adding a line in a file.
Firstly, you need a Player GFX ready to be used with the powerups patch, you can use as a reference the graphics included in the powerups_files/graphics folder. Then you need to add the new graphics to the powerup_gfx.asm file. Adding a new entry for graphics can be done with the following line:
%insert_gfx(small_mario,0)
The first argument, small_mario
, is the name of the GFX file you're using.
The second argument, 0
, is the slot number, it should be unique among your GFX list.
Repeat the same thing for any Extra Graphics you want to insert, except this time you have to use %insert_extra_gfx(cape_tiles,0)
instead of %insert_gfx(small_mario,0)
. Extra Graphics have their own slots and they aren't shared with the Player GFX slots.
Then proceed to powerups_files/powerup_misc_data folder, open gfx_index.asm and change the values below the comment that says ;luigi gfx
under GFXData:
and ExtraGFXData:
(if applicable).
Once you're done adding GFX, insert everything again to your ROM and test your changes.
Player's graphics can be changed midlevel whenever you want, just like the original Mario ExGFX patch. It really doesn't need a lot of code, but it will greatly benefit from using the custom palette code from the previous section, especially if your custom player doesn't use the same colors that are currently uploaded in CGRAM.
Firstly, you need a Player GFX ready to be used with the powerups patch, you can use as a reference the graphics included in the powerups_files/graphics folder. Then you need to add the new graphics to the powerup_gfx.asm file. Adding a new entry for graphics can be done with the following line:
%insert_gfx(small_mario,0)
The first argument, small_mario
, is the name of the GFX file you're using.
The second argument, 0
, is the slot number, it should be unique among your GFX list.
Repeat the same thing for any Extra Graphics you want to insert, except this time you have to use %insert_extra_gfx(cape_tiles,0)
instead of %insert_gfx(small_mario,0)
. Extra Graphics have their own slots and they aren't shared with the Player GFX slots.
The code to change player's GFX is quite simple, it's matter of:
main:
lda #$01
sta !gfx_bypass_flag
lda #$05
sta !gfx_bypass_num
rtl
The code above will force the player to use the GFX in slot 5, which is the Tanooki Suit GFX. What about the extra GFX used by some powerups (5th tile)? Well, that's handled by a different RAM address, but it's a very similar code.
main:
lda #$01
sta !gfx_bypass_flag
lda #$05
sta !gfx_bypass_num
lda #$01
sta !extra_gfx_bypass_num
rtl
Note that this will load the extra gfx in slot 1, in this case it's the super leaf's and tanooki suit's tail gfx and such GFX will be forced on any powerup if said powerup is meant to display a 5th tile (like the cape tile).
To avoid such problems, we can use a similar code as the one used for the palettes, except this one is way simpler.
main:
lda #$01
sta !gfx_bypass_flag
ldx $19
lda .gfx,x
sta !gfx_bypass_num
lda .extra_gfx,x
sta !extra_gfx_bypass_num
rtl
.gfx
db $00 ; small
db $01 ; big
db $01 ; cape
db $01 ; fire flower
db $02 ; hammer suit
db $03 ; boomerang suit
db $04 ; super leaf
db $05 ; tanooki suit
db $06 ; frog suit
db $01 ; superball flower
db $01 ; rocket boots
db $07 ; mini mushroom
db $01 ; ice flower
db $08 ; penguin suit
db $09 ; propeller suit
db $0A ; shell suit
db $01 ; bubble flower
db $01 ; cloud flower
db $0B ; cat suit
.extra_gfx
db $FF ; small
db $FF ; big
db $00 ; cape
db $FF ; fire flower
db $FF ; hammer suit
db $FF ; boomerang suit
db $01 ; super leaf
db $01 ; tanooki suit
db $FF ; frog suit
db $FF ; superball flower
db $FF ; rocket boots
db $FF ; mini mushroom
db $FF ; ice flower
db $FF ; penguin suit
db $02 ; propeller suit
db $FF ; shell suit
db $FF ; bubble flower
db $03 ; cloud flower
db $04 ; cat suit
Everything above uses the default GFX for Mario, as I don't have extra things to test the code with. It should work with anything though, you would need to edit the values in both tables to use the graphics you want.
Once you're done adding GFX and the code above, insert everything again to your ROM and test your changes.
WIP
WIP