Sporadic Posted August 20, 2015 Share Posted August 20, 2015 (edited) Hi, In the tutorial it states; If you want to pass a fractional part, remember it is always a positive value, whereas the whole part can obviously be negative. So if you need to describe say a negative drift of half a pixel, you have to first set the fractional part to a half, (65535/2= 32768), then set the whole part to -1, (-1<<16), with the net effect of -1 + 1/2 giving -1/2. Once you get this into your head it becomes second nature, it can just seem a little awkward at first. So how would I specify the fractional part first and then the whole part? For example, I tried calling RSETOBJ in succession but I think "last one wins" here so the fractional part isn't set. RSETOBJ(startline+i,R_sprite_xadd,FRACPART) RSETOBJ(startline+i,R_sprite_xadd,INTPART<<16) Where FRACPART is the fractional part ranging from 0-65535 and INTPART is the integer portion. The other thought was that it should be passed as a fixed point binary value, which isn't so bad if i'm just setting when coding, but i'm not sure how to work that out at runtime on the fly. Sorry if i've completely misunderstood what's intended and thank you in advance for any feedback. Edited August 20, 2015 by Sporadic Quote Link to comment Share on other sites More sharing options...
+CyranoJ Posted August 20, 2015 Share Posted August 20, 2015 RSETOBJ(startline+i,R_sprite_xadd,INTPART<<16+FRACPART) 2 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted August 20, 2015 Author Share Posted August 20, 2015 RSETOBJ(startline+i,R_sprite_xadd,INTPART<<16+FRACPART) lol no way. Is that for real? That's probably the only thing I haven't tried. Thank you Quote Link to comment Share on other sites More sharing options...
Sporadic Posted August 20, 2015 Author Share Posted August 20, 2015 Ok that looks like it works, thank you. However, for completeness in case anyone else wants to know, I had to add some brackets. So this is the working version; RSETOBJ(startline+i,R_sprite_xadd,(INTPART<<16)+FRACPART) Otherwise it added the FRACPART to the 16 and did a comedy bit shift. cheers. 1 Quote Link to comment Share on other sites More sharing options...
sh3-rg Posted August 20, 2015 Share Posted August 20, 2015 If anything in the docs seems odd or worded weirdly, it probably is! Just let me know and I'll do my best to rework the offending jumble of letters and numbers into something more useful. Quote Link to comment Share on other sites More sharing options...
Sporadic Posted August 20, 2015 Author Share Posted August 20, 2015 If anything in the docs seems odd or worded weirdly, it probably is! Just let me know and I'll do my best to rework the offending jumble of letters and numbers into something more useful. No, it's worded well, though perhaps an example of the above code to show how to apply a fractional value to the RSETOBJ. I feel slightly more empowered now that I know how to do it 1 Quote Link to comment Share on other sites More sharing options...
sh3-rg Posted August 20, 2015 Share Posted August 20, 2015 OK, I tried, hope that's better and saves someone else cursing my jumbled half-understood ramblings :0) 1 Quote Link to comment Share on other sites More sharing options...
omf Posted September 30, 2015 Share Posted September 30, 2015 (edited) If anything in the docs seems odd or worded weirdly, it probably is! Just let me know and I'll do my best to rework the offending jumble of letters and numbers into something more useful. the doger object list comments are messed up they are duplicated where you didn't renumber them when you pasted another object Edited September 30, 2015 by omf Quote Link to comment Share on other sites More sharing options...
sh3-rg Posted September 30, 2015 Share Posted September 30, 2015 the doger object list comments are messed up they are duplicated where you didn't renumber them when you pasted another object Oh nice, I'll, err, get right on that... umm... straight away!* *fib ps seriously, thanks. I will fix it at some point, cheers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.