08-08-2004, 09:17 PM
As I'm writing this new routine for Useless Sock, I come across this messed up result:
I normally don't ask for help but this is driving me insane. This was effectively translated from the working version in my TinyPTC extension library where it works flawlessly. Anyways, here's the code:
Anyone got any ideas why this is happening? Thanks.
I normally don't ask for help but this is driving me insane. This was effectively translated from the working version in my TinyPTC extension library where it works flawlessly. Anyways, here's the code:
Code:
SUB USputScaledSprite (x AS INTEGER, y AS INTEGER, sourceSegment AS INTEGER, sourceOffset AS INTEGER, destSegment AS INTEGER, destOffset AS INTEGER, sizeX AS INTEGER, sizeY AS INTEGER)
'Puts a transparent sprite to the specified size
DIM xpos AS SINGLE, ypos AS SINGLE
DIM xscale AS SINGLE, yscale AS SINGLE
DIM totalx AS SINGLE, totalY AS SINGLE
DIM transX AS SINGLE, transY AS SINGLE
transX = sizeX: transY = sizeY
DEF SEG = sourceSegment
totalx = PEEK(sourceOffset)
totalY = PEEK(sourceOffset + 2)
xscale = totalx / transX
yscale = totalY / transY
ypos = 0
FOR ay = y TO (y + sizeY)
xpos = 0
FOR ax = x TO (x + sizeX)
dood = INT((INT(ypos) * totalx * 2) + (INT(xpos) * 2) + 4)
DEF SEG = sourceSegment
Colour = PEEK(sourceOffset + dood)
pixel = PEEK(sourceOffset + dood + 1)
IF pixel <> 0 AND pixel <> 32 AND pixel <> 255 THEN USplaceElement ax, ay, pixel, Colour, destSegment, destOffset
xpos = xpos + xscale
NEXT
ypos = ypos + yscale
NEXT
END SUB
I'd knock on wood, but my desk is particle board.