Hey,
I am back here now that I finished working on all the levels of my hack. I only have some more playtesting and polishing to do.
I ran into a little issue with this patch due to my own wording probably, here is what's not working as intended :
#1 When ending a level, I want that 2 bonus stars are ALWAYS added to the player's bonus stars count whether they touched the goal tape or not. Currently, if the player avoids touching the goal tape, they will not gain any bonus stars, and it goes completely counter to what I want (the "limited number of attempts"). So, taking into account the code above by LDA/Technius which I used to patch 2 bonus stars being added on tape touch, how do I make it / change it so that if the player does not touch the tape (misses touching it), there will still be 2 bonus stars added? Resolved thanks to Thomas
#2 The second part in the tape touched hack here gives a number of coins depending on the height of the tape. It worked when I tested it before, but now that I applied the 4-5 digits coin counter, it won't work with that anymore. Normal coins add coins to my 5 digit counters, but this particular hack for the bonus tape does not add coins to it for unknown reason to me. Is this because the 5 digits coin counter hack changes the "command" for adding coins?? The patch does work with a default SMW rom, it just won't add coins to the hacked 4 digits coin counter on my hack.
I think it is probably not very hard or time consuming to do, but it's hard for me to figure out and exhausting because I spend so much time working on level design. I want to finish this hack, it's almost done, just gotta change this and do a bit more of polish/testing of levels and then it's ready to release ><! Would really appreciate being helped out by somebody who is more experienced with SMW coding.
Here is the code for the 4-5 digits coin counter hack :
Code
!base1 = $0000
!base2 = $0000
!sa1 = 0
if read1($00FFD5) == $23
sa1rom
!sa1 = 1
!base1 = $3000
!base2 = $6000
endif
!RAM_DecCoins = $7F969E ;
!ShowZeroes = 0 ; 0 - don't show leading zeroes, anything else - show them
org $008CB2
db $3C ; \
db $FC,$38 ; |
db $FC,$38 ; |
db $FC,$20 ; | Tilemap in status bar.
db $FC,$20 ; |
db $FC,$38 ; |
db $FC,$38 ; |
db $FC,$20 ; /
org $008CE7
db $FC,$3C ; \ Change $FC to $2E if you want the coin sign in front.
db $00,$38 ; |
db $00,$38 ; | More tilemap data.
db $00,$38 ; |
db $00,$38 ; |
db $00,$38 ; |
db $00,$38 ; |
db $2E,$3C ; /
org $008EE5
autoclean JSL ZeroCoins
NOP
org $00802A
autoclean JSL ZeroDec
;STZ $0F29|!base2,x ; <--
org $008F1D
autoclean JML RoutineStart
LDA $00
BRA CycleSkip ;\ Skip for reducing cycles
NOP ; |
NOP ; | Useless
NOP ; |
NOP ;/
CycleSkip:
org $008F7E
BRA Skip ; \ Skip to save cycles.
NOP ; |
NOP ; |
NOP ; |
NOP ; / There isn't written to coin total.
Skip:
org $009BCC
autoclean JSL SaveSRAMRoutine ; Save data to SRAM!
NOP
NOP
org $009D14
autoclean JSL LoadSRAMRoutine ; Load data from SRAM!
org $009E4E
NOP ; Remove the first ; if you...
NOP ; want to disable the score being...
NOP ; deleted when getting to the Game Over screen.
org $009E56
NOP ; Remove the first ; if you...
NOP ; want to disable the score being...
NOP ; deleted when getting to the Game Over screen.
org $00D0DD
autoclean JSL STZSRAMWhenGameOver
NOP
org $028766
BRA $01
NOP
org $028770
BRA $01
NOP
org $02AE21
BRA SkipUseless ; \ Skip to save cycles.
NOP ; |
NOP ; |
NOP ; |
NOP ; | Disable score
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; /
NOP
NOP
NOP
NOP ; \ Yeah more semi-colons and comments...
NOP ; / Etc.
NOP
NOP
NOP
SkipUseless:
org $05CEF9
BRA +
NOP ; \
NOP ; |
NOP ; |
NOP ; |
NOP ; | Disable score being added at level end.
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; /
+
freedata ; this one doesn't change the data bank register, so it uses the RAM mirrors from another bank, so I might as well toss it into banks 40+
RoutineStart: ; Don't remove label
LDA !RAM_DecCoins
BEQ EndDec
LDA $0F34|!base2
ORA $0F35|!base2
ORA $0F36|!base2
BEQ EndDec
REP #$20
LDA !RAM_DecCoins
DEC A
STA !RAM_DecCoins
SEP #$20
LDA #$FF
DEC $0F34|!base2
CMP $0F34|!base2
BNE EndDec
DEC $0F35|!base2
CMP $0F35|!base2
BNE EndDec
DEC $0F36|!base2
EndDec:
LDA $13CC|!base2
BEQ NoInc
IncCoins:
DEC $13CC|!base2
LDA $7E0DB3
CMP #$01
BEQ Luigi ;If Luigi active go Luigi routine
LDA #$FF
CMP $0F34|!base2
BNE NotMaxedOut
CMP $0F35|!base2
BNE NotMaxedOut
CMP $0F36|!base2
BNE NotMaxedOut
STZ $13CC|!base2
BRA EndInc
NotMaxedOut:
INC $0F34|!base2 ; $0F34 = Lowest 256 values.
BNE EndInc
INC $0F35|!base2 ; $0F35 = Lowest 65536 values.
BNE EndInc
INC $0F36|!base2 ; $0F36 = All 1000000 values
BRA EndInc
Luigi: ;Here we go, with Luigi addresses
LDA #$FF
CMP $0F37|!base2
BNE NotLaxedOut
CMP $0F38|!base2
BNE NotLaxedOut
CMP $0F39|!base2
BNE NotLaxedOut
STZ $13CC|!base2
BRA EndInc
NotLaxedOut:
INC $0F37|!base2 ; $0F37 = Lowest 256 values.
BNE EndInc
INC $0F38|!base2 ; $0F38 = Lowest 65536 values.
BNE EndInc
INC $0F39|!base2 ; $0F39 = All 1000000 values
EndInc:
LDA $00
JML $008F32
NoInc:
JML $008F3B
ZeroDec:
STA $7F8000
LDA #$0000
STA !RAM_DecCoins
RTL
SaveSRAMRoutine:
JSR GetSaveFile
LoadScoreData:
LDA $0F34|!base2,y ; Transfer coin counter data over...
if !sa1 == 0
STA $70079F,x ; to SRAM data. ($7007FD - $7007FF)
else
STA $41C79F,x ; to SRAM data. ($41C7FD - $41C7FF)
endif
INX
INY
CPY #32
BCC LoadScoreData
LDX $010A|!base2
LDA $009CCB,x
RTL
LoadSRAMRoutine:
PHX
PHY
SEP #$10
JSR GetSaveFile
LoadSRAMData:
if !sa1 == 0
LDA $70079F,x ; Transfer SRAM data...
else
LDA $41C79F,x ; Transfer SRAM data...
endif
STA $0F34|!base2,y ; over to coin counter data.
INX
INY
CPY #32
BCC LoadSRAMData
REP #$10
PLY
PLX
if !sa1 == 0
LDA $700000,x
else
LDA $41C000,x
endif
RTL
STZSRAMWhenGameOver:
JSR GetSaveFile
StoreZeroIntoSRAM:
LDA #$00
STA $0F34|!base2,y ; Set coins to zero.
if !sa1 == 0
STA $70079F,x ; Set coins in SRAM to zero.
else
STA $41C79F,x ; Set coins in SRAM to zero.
endif
INX
INY
CPY #32
BCC StoreZeroIntoSRAM
LDA #$0A
STA $1DFB|!base2
RTL
GetSaveFile:
LDA $010A|!base2
ASL
ASL
ASL
ASL
ASL
TAX
LDY #0
RTS
ZeroCoins:
if !ShowZeroes
STZ $0F29|!base2,x
RTL
else
LDA #$FC ; hijacked routine
STA $0F29|!base2,x
LDA $0F34|!base2
ORA $0F35|!base2
ORA $0F36|!base2 ; if you have 0 coins...
BNE DontStoreZero ; put "0" on the status bar
STZ $0F2E|!base2 ; 0 for the first digit
DontStoreZero:
RTL
endif
Here is a copy of the code of TechnisCoinsGoal which hijacks code on goal tape break to give always 2 bonus stars and a number of coins :
Code
header : lorom
org $01C17A ; \
RTS ; | Disable big bonus star numbers
NOP #3 ; /
org $07F1AA
db $02,$02,$02,$02,$02,$02,$02,$02 ; \
db $02,$02,$02,$02,$02,$02,$02,$02 ; | Bonus star table
db $02,$02,$02,$02,$02,$02,$02,$02 ; |
db $02,$02,$02,$02,$02,$02,$02,$02 ; /
org $07F252
autoclean JML BonusHijack
freecode
BonusHijack:
PHX
LDA $1594,x
LSR
LSR
TAX
LDA $07F1AA,x
STA $1900
LDA.L CoinBonusTable,x
CLC : ADC $0DBF
;JSL $05B329
STA $0DBF
PLX
CMP #$50
BNE ReturnBonus
LDA #$0A
JSL $02ACE5
ReturnBonus:
RTL
CoinBonusTable:
db $01,$01,$01,$01,$02,$02,$02,$02 ; \
db $03,$03,$03,$03,$04,$04,$04,$04 ; | Coin bonus table ~
db $05,$05,$05,$05,$06,$06,$06,$06 ; | three last values originally
db $07,$07,$07,$07,$08,$08,$08,$08 ; / give big increments
I made the hacks
Tsunami Island and
Super Mario Archipelago
Check them out !