ejona86 / taus

Tetris - Actually Useful Statistics and other mods

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

please include hard drop for two player :)

komawoyo opened this issue · comments

Reopening because I can't figure out how to apply two ips patches together (2 player + hard drop) :/

To use two IPS patches together you simply apply one IPS and then apply the other IPS to the previous output. However, they need to be "compatible." It tends to be hit-or-miss whether two IPS files are compatible. All of the TAUS patches are compatible with each other, but the taus and twoplayer hacks were particularly hard to make compatible. Twoplayer in general is quite invasive so is the least likely of my hacks to be compatible with other hacks.

Just looking at the animation for the hard drop hack I wouldn't expect it to draw properly with twoplayer. I'd expect that it would try to draw in the center of the screen instead of each separate player's playfield. There's the separate no-ghost ips, but having a ghost seems important.

I ran both of the hard drop IPSs through a script of mine to check collisions (to see if they both change the same ROM locations) and a substantial portion of it collides. It looks like it is using what I call unreferenced_data1 to store the hard drop code, which is also where twoplayer stores its code. This isn't surprising, as there's only a few large blocks of unused space in the original ROM.

In #19 I side-stepped the area used by ControllerInputDisplay. I'm not sure how much more I can side-step, as I'm running extremely low on memory between twoplayer and taus. Maybe I'll start releasing my variation of ControllerInputDisplay to free up some space.

I ported stevebob's hard-drop to my framework (https://github.com/ejona86/taus/tree/hard-drop) and then it only needed a few changes/fixes to work with twoplayer. @komawoyo, you can use this IPS with the twoplayer mod: hard-drop-1.5.0-dev-twoplayer.zip

I might contribute some of the fixes back. But the biggest issue is that the move to unreferenced_data4 will just collide with other mods. I might poke to see if the mod can fit in one of the smaller unused regions to be less likely to collide.

My local changes:

diff --git a/hard-drop.s b/hard-drop.s
index 1ad7317..0a49a1c 100644
--- a/hard-drop.s
+++ b/hard-drop.s
@@ -36,8 +36,14 @@ CONTROLLER_BIT_UP = $08
 ; replaces "jsr shift_tetrimino"
         jsr     controls
 
+.segment "playState_player2ControlsActiveTetrimino"
+        ips_segment     "playState_player2ControlsActiveTetrimino",playState_player2ControlsActiveTetrimino
+
+; replaces "jsr shift_tetrimino"
+        jsr     controls
+
 .segment "CODE"
-        ips_segment     "CODE",unreferenced_data1+$17,$0637-$17
+        ips_segment     "CODE",unreferenced_data4,$0515
 
 compute_hard_drop_distance:
         lda     currentPiece
@@ -76,7 +82,7 @@ compute_hard_drop_distance:
         adc     $28
         adc     $20+(I*2)
         tay
-        lda     playfield,y
+        lda     (playfieldAddr),y
         cmp     #EMPTY_TILE
         bne     @end_hint_depth_loop
         .endrepeat
@@ -110,13 +116,13 @@ render_hint:
         beq     @render_hint_1
         lda     generalCounter3
         sec
-        sbc     #$40
+        sbc     $8A1D ; #$40 same addr on PAL
         sta     generalCounter3
         lda     activePlayer
         cmp     #$01
         beq     @render_hint_1
         lda     generalCounter3
-        adc     #$6F
+        adc     $8A29 ; #$6F
         sta     generalCounter3
 @render_hint_1:
         clc
@@ -220,5 +226,3 @@ controls:
         sta     holdDownPoints
 @controller_end:
         rts
-
-.res $80

I've merged my modified hard-drop mod to master.