22
33.segment "PRG4"
44
5- ProjectileYPosition = $30
6- ProjectileXVelocity = $77
7- ProjectileType = $87
8- EnemyType = $a1
9- LinkXPosition = $4d
10- EnemyXPositionLo = $4e
11- EnemyXPositionHi = $3c
12- RNG = $051b
135ProjectileEnemyData = $07c0
14-
15- EnemyYVelocity = $057e
166; SinWaveVelocityIncrement = $ba1c
177
188; Hook into carrock's update code to add the new position calculation
@@ -29,29 +19,29 @@ ChooseNewCarrockXPosition:
2919 lda RNG,x
3020 ; By shifting links opposite side bit twice, we can force Carrock to be closer to the wall
3121 asl
32- sta EnemyXPositionLo ,x
22+ sta Enemy0XPositionLo ,x
3323
3424 ; Since Link's position can be from roughly $00fb - 01ef
3525 ; We can offset this by flipping the high bit, and then checking if its greater than
3626 ; $80 - $10 (which would be like starting the range from F0 - 70)
37- lda LinkXPosition
27+ lda LinkXPositionLo
3828 eor #$80
3929 cmp #$70
4030
4131 ; At this point, the carry contains the bit for the opposite side of the screen for link
4232 ; So shift it back into bosses position
43- ror EnemyXPositionLo ,x
33+ ror Enemy0XPositionLo ,x
4434
4535 ; Vanilla checks to see if carrock is too close to the right edge, and prevents going
4636 ; offscreen by dividing the position by two if it would
4737 lda #$e0
48- cmp EnemyXPositionLo ,x
38+ cmp Enemy0XPositionLo ,x
4939 bcs @SetXHighPos
5040 sbc #$10 - 1
51- sta EnemyXPositionLo ,x
41+ sta Enemy0XPositionLo ,x
5242@SetXHighPos:
5343 lda #1
54- sta EnemyXPositionHi ,x
44+ sta Enemy0XPositionHi ,x
5545 rts
5646
5747; Inside a funciton that updates motion for (maybe?) all projectiles
@@ -72,10 +62,10 @@ MoveSinWaveWifiShot:
7262 lda ProjectileEnemyData,x
7363 and #$01
7464 tay
75- lda EnemyYVelocity ,x
65+ lda Enemy0YVelocity ,x
7666 clc
7767 adc SinWaveVelocityIncrement,y
78- sta EnemyYVelocity ,x
68+ sta Enemy0YVelocity ,x
7969 cmp SinWaveMaxVelocityExtant,y
8070 bne @NotAtMaxVelocity
8171 inc ProjectileEnemyData,x
@@ -88,8 +78,8 @@ MoveSinWaveWifiShot:
8878 bcc @PositiveVelocity
8979 ora #$f0
9080@PositiveVelocity:
91- adc ProjectileYPosition ,x
92- sta ProjectileYPosition ,x
81+ adc Projectile0YPosition ,x
82+ sta Projectile0YPosition ,x
9383 ldy #$12
9484@NotAWifiShot:
9585 ; Perform the original patched call
@@ -102,12 +92,12 @@ MoveSinWaveWifiShot:
10292.reloc
10393RandomizeWifiShotType:
10494 ldx $10
105- lda EnemyType ,x
95+ lda Enemy0Type ,x
10696 cmp #$22 ; check if its spawned by carock and skip it. carock code id is 0x22
10797 beq @CarockShot
10898 ; Do the original code since its not our new buffed carock
10999 lda #$c0
110- sta ProjectileYPosition ,y
100+ sta Projectile0YPosition ,y
111101 rts
112102@CarockShot:
113103 ; Fetch a random number and 50/50 chance its a straight shot
@@ -120,7 +110,7 @@ RandomizeWifiShotType:
120110 @HiPositionShot:
121111 sta ProjectileEnemyData,y
122112 lda #0
123- sta EnemyYVelocity ,y
113+ sta Enemy0YVelocity ,y
124114 lda ProjectileEnemyData,y
125115 ora #$b0
126116 ; Firing a sin wave shot, so set the flag for sin wave and then follow through setting up the position
@@ -136,12 +126,12 @@ RandomizeWifiShotType:
136126 clc
137127 adc #$10
138128@WriteShotYCoord:
139- sta ProjectileYPosition ,y
129+ sta Projectile0YPosition ,y
140130 ; roll a random number to see if we shoot a fast beam
141131 lda RNG+1
142132 and #1
143133 beq @Exit
144- lda ProjectileXVelocity ,y
134+ lda Projectile0XVelocity ,y
145135 bmi @NegativeVelocity
146136 clc
147137 adc #$10
@@ -150,7 +140,7 @@ RandomizeWifiShotType:
150140 sec
151141 sbc #$10
152142@DoneVelocityUpdate:
153- sta ProjectileXVelocity ,y
143+ sta Projectile0XVelocity ,y
154144@Exit:
155145 rts
156146
0 commit comments