I'm just looking for something to do. In the right type of hack, this would be a good thing to implement. In a standard Sonic 1, it's not that big of a deal. But I'm looking at practicing and learning more about how to hack, so I'm trying my hand at implementing different things just for the hell of it, and for experience. And since I didn't recall seeing these implemented, I thought... why not share my thoughts.
SPEAKING OF WHICH... I have bumped into a coding problem, and perhaps we have started to reach the point where this COULD be moved to ERE, but I'm posting the question here as it is in direct relation to the current topic.
I have attempted to edit the Level Select selection code, to make it reset these certain variables when selecting from level select...
If one plays through a game, and either finishes or get Game Over, and then comes back via Level Select, Not everything is cleared correctly. I have added the move codes necessary... take a look
LevSel_Level_SS: ; XREF: LevelSelect
add.w d0,d0
move.w LevSel_Ptrs(pc,d0.w),d0 ; load level number ; ERROR VALUE <--------------------------------
bmi.w LevelSelect
cmpi.w #id_SS*$100,d0 ; check if level is 0700 (Special Stage)
bne.s LevSel_Level ; if not, branch
move.b #id_Special,(v_gamemode).w ; set screen mode to $10 (Special Stage)
clr.w (v_zone).w ; clear level
move.b #3,(v_lives).w ; set lives to 3
moveq #0,d0
move.w d0,(v_rings).w ; clear rings
move.l d0,(v_time).w ; clear time
move.l d0,(v_score).w ; clear score
; KingofHarts Level Select Mod
;move.l d0,(v_startscore).w ; clear start score
;move.b d0,(v_lastspecial).w ; clear special stage number
;move.b d0,(v_emeralds).w ; clear emeralds
;move.l d0,(v_emldlist).w ; clear emeralds
;move.l d0,(v_emldlist+4).w ; clear emeralds
;move.b d0,(v_continues).w ; clear continues
; end of mod
move.l #5000,(v_scorelife).w ; extra life is awarded at 50000 points
rts
and for the other part, selecting a normal level, it has more of the clears...
LevSel_Level: ; XREF: LevSel_Level_SS
andi.w #$3FFF,d0
move.w d0,(v_zone).w ; set level number
PlayLevel:
move.b #id_Level,(v_gamemode).w ; set screen mode to $0C (level)
move.b #3,(v_lives).w ; set lives to 3
moveq #0,d0
move.w d0,(v_rings).w ; clear rings
move.l d0,(v_time).w ; clear time
move.l d0,(v_score).w ; clear score
; KingofHarts Level Select Mod
;move.l d0,(v_startscore).w ; clear start score
move.b d0,(v_lastspecial).w ; clear special stage number
move.b d0,(v_emeralds).w ; clear emeralds
move.l d0,(v_emldlist).w ; clear emeralds
move.l d0,(v_emldlist+4).w ; clear emeralds
move.b d0,(v_continues).w ; clear continues
move.l #5000,(v_scorelife).w ; extra life is awarded at 50000 points
move.b #$E0,d0
bsr.w PlaySound_Special ; fade out music
rts
I have commented out my Level Select mods for a reason. Implementing them in the code causes a build error, stating "Illegal Value"
Now with all of these implemented, that value comes out to 152. Using less lines of mine, results in a smaller value, the smallest being 128.
The line in question is the one I marked ERROR VALUE.
Any reason why this could be?
EDIT: Disregard this, I simply moved the level select table closer to the instruction calling it. I think it did the trick.
This post has been edited by KingofHarts: 05 September 2012 - 06:45 PM