File Name: | 16x48 Question Mark Block v1.1 |
Submitted: | by EternityLarva |
Authors: | EternityLarva |
Act As: | 130 |
Includes GFX: | Yes |
Description: | This block is a larger question mark block. There are two coins and item in it. Graphic has smw style and smb3 style. update 2019/03/30 v1.1 Fixed corner of block. File weight reduction. |
Screenshots: |
Tested with: GPS v1.4.1, PIXI v1.2.9, SA-1 Pack v1.31, Snes9x v1.55
First off these blocks should be named 48x16, not 16x48. 48x16 are the correct dimensions, but I can see how easy it is to get it mixed up.
You did a good job with these for the most part, however there are some pretty significant optimizations that can be made to the main code, mostly how the items are set up:
Code
!BoundSprite = $0E ;bound custom sprite !InvisibleSolidBlock = $1919 ;Map16 looks for 0025 and act as 0130
These two defines can be moved into QuestionMarkBlockMain. There's not really any reason to have them in their own separate .asm file.
Code
if !small_item == 0
JSR gen_coin
endif
if !small_item == 1
JSR gen_mushroom
endif
if !small_item == 2
JSR gen_flower
endif
if !small_item == 3
JSR gen_cape
endif
if !small_item == 4
JSR gen_star
endif
++
JSR kill_enemy
RTL
Return2:
RTL ;Return2
The RTL here is redundant as there is another that comes right after it.
Code
LDA $1490 ;if mario has invisible BEQ + if !star_item == 0 JSR gen_coin endif if !star_item == 1 JSR gen_mushroom endif if !star_item == 2 JSR gen_flower endif if !star_item == 3 JSR gen_cape endif if !star_item == 4 JSR gen_star endif BRA ++ + LDA $19 ;if not small BEQ + if !big_item == 0 JSR gen_coin endif if !big_item == 1 JSR gen_mushroom endif if !big_item == 2 JSR gen_flower endif if !big_item == 3 JSR gen_cape endif if !big_item == 4 JSR gen_star endif BRA ++ + ;if small if !small_item == 0 JSR gen_coin endif if !small_item == 1 JSR gen_mushroom endif if !small_item == 2 JSR gen_flower endif if !small_item == 3 JSR gen_cape endif if !small_item == 4 JSR gen_star endif ++ JSR kill_enemy RTL
Code
gen_mushroom:
CLC
LDA #$74
%spawn_sprite()
JSR move_spawn
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gen_flower:
CLC
LDA #$75
%spawn_sprite()
JSR move_spawn
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gen_cape:
CLC
LDA #$77
%spawn_sprite()
JSR move_spawn
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gen_star:
CLC
LDA #$76
%spawn_sprite()
JSR move_spawn
RTS
These two sections of the code can be made much simpler. You can just have them pass the sprite numbers in straight from the individual blocks using !star_item, !big_item, and !small_item like so:
Code
LDA $1490 ;if mario has invisible BEQ + if !star_item == $0 JSR gen_coin elseif !star_item != $0 LDA #!star_item JSR gen_item endif BRA ++ + LDA $19 ;if not small BEQ + if !big_item == $0 JSR gen_coin elseif !big_item != $0 LDA #!big_item JSR gen_item endif BRA ++ + ;if small if !small_item == $0 JSR gen_coin elseif !small_item != $0 LDA #!small_item JSR gen_item endif ++ JSR kill_enemy
Code
gen_item: %spawn_sprite() JSR move_spawn RTS
The items in the individual blocks would then be handled something like this:
Code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; spawn item config ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; $0:coin ; $74:mushroom ; $75:flower ; $77:cape ; $76:star ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !small_item = $74 ;\priority !big_item = $75 ;|star > big > small !star_item = $75 ;/