@@ -4904,13 +4904,18 @@ _RotatedScaledSprite_NoClip:
4904
4904
push ix
4905
4905
; aligning ix with gfx_RotateScaleSprite allows for code sharing
4906
4906
ld ix , 3
4907
+ lea bc , ix - 3 ; ld bc, 0
4907
4908
add ix , sp
4908
4909
ld hl , (ix + 3 ) ; sprite pointer
4909
- ld a , (hl)
4910
- ld (ix + 16 ) , a ; store sprite size
4910
+ ld b , (hl)
4911
+ ld (ix + 16 ) , b ; store sprite size
4911
4912
inc hl
4912
4913
inc hl
4913
4914
4915
+ ; or a, a ; carry already cleared
4916
+ dec b
4917
+ sbc hl , bc ; offset the sprite pointer by (size - 1) * 256
4918
+
4914
4919
ld (iy + (.dsrs_sprptr_0A - .dsrs_base_address)) , hl ; write smc
4915
4920
ld (iy + (.dsrs_sprptr_0B - .dsrs_base_address)) , hl ; write smc
4916
4921
@@ -5060,7 +5065,7 @@ _RotatedScaledSprite_NoClip:
5060
5065
ld l , a
5061
5066
inc l
5062
5067
mlt hl
5063
- ld b , 0
5068
+ ld b , a ; A is a known constant that we can compensate for
5064
5069
; result is at most 255 * 255 + 255 or 65279. Make sure UBC is zero
5065
5070
add hl , bc ; y * size + x
5066
5071
@@ -5117,7 +5122,7 @@ _RotatedScaledSprite_NoClip:
5117
5122
.dsrs_jump_2 := $ - 1
5118
5123
inc l
5119
5124
mlt hl
5120
- ld b , 0
5125
+ ld b , a ; A is a known constant that we can compensate for
5121
5126
; result is at most 255 * 255 + 255 or 65279. Make sure UBC is zero
5122
5127
add hl , bc ; y * size + x
5123
5128
@@ -5166,14 +5171,21 @@ gfx_RotateScaleSprite:
5166
5171
; arg1 : Pointer to sprite struct output
5167
5172
push ix
5168
5173
ld ix , 0
5174
+ lea bc , ix + 0 ; ld bc, 0
5169
5175
add ix , sp
5170
5176
ld iy , _smc_dsrs_base_address
5171
5177
ld hl , (ix + 6 ) ; sprite pointer
5172
- ld a , (hl)
5173
- ld (ix + 16 ) , a ; store sprite size
5178
+ ld b , (hl)
5179
+ ld (ix + 16 ) , b ; store sprite size
5174
5180
inc hl
5175
5181
inc hl
5182
+
5183
+ ; or a, a ; carry already cleared
5184
+ dec b
5185
+ sbc hl , bc ; offset the sprite pointer by (size - 1) * 256
5186
+
5176
5187
ld (iy + (_smc_dsrs_sprptr_0 - _smc_dsrs_base_address)) , hl ; write smc
5188
+
5177
5189
; sinf = _SineTable[angle] * 128 / scale;
5178
5190
ld a , (ix + 12 ) ; angle
5179
5191
call calcSinCosSMC
@@ -5297,6 +5309,7 @@ gfx_RotateScaleSprite:
5297
5309
5298
5310
; UBC was set to zero from mlt bc awhile back
5299
5311
jr drawSpriteRotateScale_Begin
5312
+
5300
5313
;-------------------------------------------------------------------------------
5301
5314
_yloop:
5302
5315
ld bc , $ 000000 ; smc = cosf
@@ -5322,7 +5335,7 @@ _xloop:
5322
5335
ld l , a
5323
5336
inc l
5324
5337
mlt hl
5325
- ld b , 0
5338
+ ld b , a ; A is a known constant that we can compensate for
5326
5339
; result is at most 255 * 255 + 255 or 65279. Make sure UBC is zero
5327
5340
add hl , bc ; y * size + x
5328
5341
0 commit comments