def SizeScalePlatform(sprite): # 178
info1 = ord(sprite.spritedata[4])
info2 = ord(sprite.spritedata[5])
sprite.platformWidth = (info1 & 0xF0) >> 4
if sprite.platformWidth > 12: sprite.platformWidth = -1
sprite.ropeLengthLeft = info1 & 0xF
sprite.ropeLengthRight = (info2 & 0xF0) >> 4
sprite.ropeWidth = info2 & 0xF
ropeWidth = sprite.ropeWidth * 16
platformWidth = (sprite.platformWidth + 3) * 16
sprite.xsize = ropeWidth + platformWidth
maxRopeHeight = max(sprite.ropeLengthLeft, sprite.ropeLengthRight)
sprite.ysize = maxRopeHeight * 16 + 19
if maxRopeHeight == 0: sprite.ysize += 8
sprite.xoffset = -((sprite.platformWidth + 3) * 16 / 2)
def PaintScalePlatform(sprite, painter):
# this is FUN!! (not)
ropeLeft = sprite.ropeLengthLeft * 24 + 4
if sprite.ropeLengthLeft == 0: ropeLeft += 12
ropeRight = sprite.ropeLengthRight * 24 + 4
if sprite.ropeLengthRight == 0: ropeRight += 12
ropeWidth = sprite.ropeWidth * 24 + 8
platformWidth = (sprite.platformWidth + 3) * 24
ropeX = platformWidth / 2 - 4
painter.drawTiledPixmap(ropeX + 8, 0, ropeWidth - 16, 8, ImageCache['ScaleRopeH'])
ropeVertImage = ImageCache['ScaleRopeV']
painter.drawTiledPixmap(ropeX, 8, 8, ropeLeft - 8, ropeVertImage)
painter.drawTiledPixmap(ropeX + ropeWidth - 8, 8, 8, ropeRight - 8, ropeVertImage)
pulleyImage = ImageCache['ScalePulley']
painter.drawPixmap(ropeX, 0, pulleyImage)
painter.drawPixmap(ropeX + ropeWidth - 20, 0, pulleyImage)
platforms = [(0, ropeLeft), (ropeX+ropeWidth-(platformWidth/2)-4, ropeRight)]
for x,y in platforms:
painter.drawPixmap(x, y, ImageCache['WoodenPlatformL'])
painter.drawTiledPixmap(x + 27, y, (platformWidth - 51), 24, ImageCache['WoodenPlatformM'])
painter.drawPixmap(x + platformWidth - 24, y, ImageCache['WoodenPlatformR'])