@@ -5176,7 +5176,7 @@ gfx_RotateScaleSprite:
5176
5176
; sinf = _SineTable[angle] * 128 / scale;
5177
5177
ld a , (ix + 12 ) ; angle
5178
5178
call calcSinCosSMC
5179
- push hl ; ld (ix - 3), _smc_dsrs_sinf_1_plus_offset_ix
5179
+ push hl ; ld (ix - 3), _smc_dsrs_sinf_1_plus_offset_ix
5180
5180
; ld (_smc_dsrs_sinf_1_plus_offset_ix),hl ; write smc
5181
5181
5182
5182
; The previous code does ~HL instead of -HL. Unsure if intentional.
@@ -5214,12 +5214,12 @@ gfx_RotateScaleSprite:
5214
5214
5215
5215
; carry is cleared here
5216
5216
ld de , (ix - 6 ) ; dsrs_dys_0
5217
- sbc.s hl , de ; make sure UHL is zero
5218
- ld (iy + (_smc_dsrs_size128_1_minus_dys_0 - _smc_dsrs_base_address)) , hl ; write smc
5217
+ sbc hl , de
5218
+ push hl ; ld (ix - 12), _smc_dsrs_size128_1_minus_dys_0
5219
5219
add hl , de ; restore HL
5220
5220
ld de , (ix - 9 ) ; dsrs_dyc_0
5221
5221
add hl , de
5222
- ld (iy + (_smc_dsrs_size128_0_plus_dyc_0 - _smc_dsrs_base_address)) , hl ; write smc
5222
+ push hl ; ld (ix - 15), _smc_dsrs_size128_0_plus_dyc_0
5223
5223
; carry might be set, but that shouldn't matter for rl c
5224
5224
5225
5225
ld a , b
@@ -5244,7 +5244,7 @@ gfx_RotateScaleSprite:
5244
5244
ld a , d
5245
5245
add a , l
5246
5246
ld d , a
5247
- ld hl , (ix - 3 )
5247
+ ld hl , (ix - 3 ) ; _smc_dsrs_sinf_1_plus_offset_ix
5248
5248
or a , a
5249
5249
sbc.s hl , de ; make sure UHL is zero
5250
5250
ld (iy + (_smc_dsrs_sinf_1_plus_offset_ix - _smc_dsrs_base_address)) , hl
@@ -5272,29 +5272,34 @@ gfx_RotateScaleSprite:
5272
5272
ld iy , (ix + 9 ) ; sprite storing to
5273
5273
ld b , c
5274
5274
ld (iy + 0 ) , bc
5275
- lea de , iy + 2
5276
5275
5276
+ ; by popping these off the stack in a werid way, we can reduce SMC useage
5277
+
5278
+ pop ix ; _smc_dsrs_size128_0_plus_dyc_0
5279
+ pop de ; _smc_dsrs_size128_1_minus_dys_0
5277
5280
pop hl ; smc = dxc start
5278
- pop ix ; smc = dxs start
5279
5281
5280
- ex ( sp ) , iy ; pop reg24 \ push iy
5282
+ ; ys = (dxc - dys) + (size * 128)
5283
+ add hl , de ; HL = (dxc - dys) + (size * 128)
5281
5284
5282
- ld iyh , c ; size * scale / 64
5285
+ pop de ; smc = dxs start
5283
5286
5284
- ld bc , $ 000000 ; xs = (dxs + dyc) + (size * 128)
5285
- _smc_dsrs_size128_0_plus_dyc_0 := $ - 3
5286
- _smc_dsrs_base_address := _smc_dsrs_size128_0_plus_dyc_0
5287
- add ix , bc ; de = (dxs + dyc) + (size * 128)
5287
+ ; xs = (dxs + dyc) + (size * 128)
5288
+ add ix , de ; IX = (dxs + dyc) + (size * 128)
5288
5289
5289
- ld bc , $ 000000 ; ys = (dxc - dys) + (size * 128)
5290
- _smc_dsrs_size128_1_minus_dys_0 := $ - 3
5291
- add hl , bc ; hl = (dxc - dys) + (size * 128)
5290
+ lea de , iy + 2
5291
+
5292
+ ex ( sp ) , iy ; pop reg24 \ push iy
5293
+
5294
+ ld iyh , c ; size * scale / 64
5292
5295
5296
+ ; UBC was set to zero from mlt bc awhile back
5293
5297
jr drawSpriteRotateScale_Begin
5294
5298
;-------------------------------------------------------------------------------
5295
5299
_yloop:
5296
5300
ld bc , $ 000000 ; smc = cosf
5297
5301
_smc_dsrs_cosf_1_plus_offset_hl := $ - 3
5302
+ _smc_dsrs_base_address := _smc_dsrs_cosf_1_plus_offset_hl
5298
5303
add hl , bc ; dxc += cosf
5299
5304
5300
5305
ld bc , $ 000000 ; smc = sinf
0 commit comments