Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CrazyS

NEED Help with Sprite Scaling

This topic is 5593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone ... im still stuck in the world of qbasic .. and ive just developed a simple sprite scaling routine ... my problem is that i need to transfer it into an assembly routine ... the problem is that my routine uses numbers with decimals (not just integers) ... can anyone offer commands in assembly that support decimals .. if not does anyone know any better ways for simple sprite scaling. Ive enclosed the simple routine''s code: ******************************************** OrigSizeX = 35 ''\ OrigSizeY = 90 '' \ NewSizeX = 18 '' / These numbers are just for example NewSizeY = 45 ''/ DO SkipX = OrigSizeX / NewSizeX SkipY = OrigSizeY / NewSizeY X = 1 Y = 1 FOR B = 0 TO (OrigSizeY- 1) STEP SkipY FOR A = 0 TO (OrigSizeX - 1) STEP SkipX Q = INT(B) * OrigSizeX + INT(A) PSET (X, Y), Sprite(Q) X = X + 1 NEXT X = 1 Y = Y + 1 NEXT ********************************************* i just want to have this very same routine ... except done in assembly (for speed purposes). Thank you Come check out our game projects and products including TWIGZ, our new graphical point&click adventure, at Shattered Realm Productions

Share this post


Link to post
Share on other sites
Advertisement
You can use floating point numbers in ASM, that''s the f* commands (fadd, fmul, fdiv, etc). But you shouldn''t use them in the inner loop of a routine such as yours. Performance will be less than optimal.

You should use fixed point numbers instead. They are basically standard integers, but with a part of the bitfield reserved for the fractional part. Just run a search on Google on ''fixed point arithmetic'', there are tons of resources lying around. First, convert your qbasic code to use fixed point numbers. Once it works, the translation into ASM will be straightforward.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!