Skip to content

Commit

Permalink
continue: loser in center
Browse files Browse the repository at this point in the history
  • Loading branch information
city41 committed Apr 28, 2024
1 parent b76613d commit efa4750
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"restore": "cp kof94.zip $MAME_ROM_DIR",
"type-check": "yarn tsc --noemit",
"to-neosd": "bash scripts/toneosd.sh",
"mame": "mame -w -nofilter -nomouse kof94",
"mame": "mame -w -nofilter -nomouse -sound none kof94",
"run-srom-crom": "NODE_OPTIONS='--loader ts-node/esm' yarn sromcrom -i resources/resources.json"
},
"dependencies": {
Expand Down
55 changes: 28 additions & 27 deletions src/patches/continueScreenInit.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
btst #0, $PLAY_MODE ; is p1 playing?
beq setForPlayerTwo
lea $P1_CHOSEN_CHAR0, A2 ; set it up to use p1 characters
move.b $108171, D0 ; load the p1 character who lost
bra doneChoosingPlayer
setForPlayerTwo:
;; CHAR2 since p2 characters are mapped in memory backwards
lea $P2_CHOSEN_CHAR2, A2 ; set it up to use p2 characters
move.b $108371, D0 ; load the p2 character who lost
doneChoosingPlayer:


Expand All @@ -22,44 +24,43 @@ move.b $4(A2), $5554(A5)

lea $AFTER_SCREEN_POSITION_TABLE, A0 ; get our position table set up
lea $ROM_CONTINUE_POSITION_TABLE, A1 ; get our position table set up
move.b #0, $AFTER_SCREEN_ALREADY_SET_LEFT

;; first character, move to center
clr.w D6
move.b (A2), D6 ; get char0's character id
add.w D6, D6 ; setting a long in memory, need to quadruple the offset
add.w D6, D6 ; setting a long in memory, need to quadruple the offset
move.l (A1, D6.w), D7 ; get the canned position which is an x word followed by a y word
andi.l #$0000ffff, D7 ; wipe out the x word
move.l #160, D5 ; get our X ready
lsl.l #8, D5 ; shift X into the upper word, 8 bits at a time
lsl.l #8, D5 ; shift X into the upper word, 8 bits at a time
or.l D5, D7 ; replace the x word with our new one and leave the y word alone
move.l D7, (A0, D6.w) ; and stick it in place so the game can read it
;; loop all three characters in
move.w #2, D4 ; our loop counter

;; second character, move to left
loadCharactersLoop:
clr.w D6
move.b $2(A2), D6 ; get char1's character id
add.w D6, D6 ; setting a long in memory, need to quadruple the offset
add.w D6, D6 ; setting a long in memory, need to quadruple the offset
move.l (A1, D6.w), D7 ; get the canned position which is an x word followed by a y word
andi.l #$0000ffff, D7 ; wipe out the x word
move.l #90, D5 ; get our X ready
lsl.l #8, D5 ; shift X into the upper word, 8 bits at a time
lsl.l #8, D5 ; shift X into the upper word, 8 bits at a time
or.l D5, D7 ; replace the x word with our new one and leave the y word alone
move.l D7, (A0, D6.w) ; and stick it in place so the game can read it
move.b (A2), D6 ; get the character id into d6
;; the loser of the match is in D0
cmp.b D0, D6 ; did this character lose the match?
beq setLoser
cmpi.b #1, $AFTER_SCREEN_ALREADY_SET_LEFT
beq setRight

;; third character, move to right
clr.w D6
move.b $4(A2), D6 ; get char2's character id
;;; ok this will be the left character
move.b #1, $AFTER_SCREEN_ALREADY_SET_LEFT
move.l #90, D5 ; get our X ready, left side
bra finishSettingUpChar

setRight:
move.l #230, D5 ; get our X ready, right side
bra finishSettingUpChar

setLoser:
move.l #160, D5 ; get our X ready, center
bra finishSettingUpChar

finishSettingUpChar:
add.w D6, D6 ; setting a long in memory, need to quadruple the offset
add.w D6, D6 ; setting a long in memory, need to quadruple the offset
move.l (A1, D6.w), D7 ; get the canned position which is an x word followed by a y word
andi.l #$0000ffff, D7 ; wipe out the x word
move.l #230, D5 ; get our X ready
lsl.l #8, D5 ; shift X into the upper word, 8 bits at a time
lsl.l #8, D5 ; shift X into the upper word, 8 bits at a time
or.l D5, D7 ; replace the x word with our new one and leave the y word alone
move.l D7, (A0, D6.w) ; and stick it in place so the game can read it
adda.w #2, A2 ; move to next character on team
dbra D4, loadCharactersLoop

rts
2 changes: 1 addition & 1 deletion src/patches/kof94te.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"READY_TO_EMPTY_TEAM_SELECT_TIMER": "10f8e1",
"IN_CHAR_SELECT_FLAG": "10f8e4",
"STORE_A0A1A2": "10f8e6",
"WIN_SCREEN_ALREADY_SET_LEFT": "10f910",
"AFTER_SCREEN_ALREADY_SET_LEFT": "10f910",
"CHAR_SELECT_COUNTER": "10f911",
"AFTER_SCREEN_POSITION_TABLE": "10f912",
"MOVEM_STORAGE": "10fa10",
Expand Down
6 changes: 3 additions & 3 deletions src/patches/winScreenInit.asm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ lea $P2_CHOSEN_CHAR2, A6 ; player 2 won, get their characters ready

setupChars:

move.b #0, $WIN_SCREEN_ALREADY_SET_LEFT
move.b #0, $AFTER_SCREEN_ALREADY_SET_LEFT

;;; there are three win screen init routines, each put characters in different locations
;;; depending on who won the match, D2 will be 0, 1 or 2
Expand All @@ -116,11 +116,11 @@ move.b (A6), D6 ; get the character id into d6
;; the winner of the match is in D0, a gift to us from the game
cmp.b D0, D6 ; did this character win the match?
beq setWinner
cmpi.b #1, $WIN_SCREEN_ALREADY_SET_LEFT
cmpi.b #1, $AFTER_SCREEN_ALREADY_SET_LEFT
beq setRight

;;; ok this will be the left character
move.b #1, $WIN_SCREEN_ALREADY_SET_LEFT
move.b #1, $AFTER_SCREEN_ALREADY_SET_LEFT
adda.w #96, A2 ; move forward to the left table
move.b D6, $1(A4) ; stick it second in the winning list
bra finishSettingUpChar
Expand Down

0 comments on commit efa4750

Please sign in to comment.