BlueAmulet / picolove

Pico-8 Reimplementation in Love2D
zlib License
101 stars 12 forks source link

score incorrectly displayed in Invader Overload #9

Closed gingerbeardman closed 8 years ago

gingerbeardman commented 8 years ago

Invader Overload http://www.lexaloffle.com/bbs/?tid=4004 http://www.lexaloffle.com/bbs/cposts/2/26413.p8.png

screen shot 2016-08-08 at 12 28 47

problem is with this code: http://www.lexaloffle.com/bbs/?tid=3577

-- print out score text from large number
function score_text(val)
   local s = ""
   local v = abs(val)
   while (v!=0) do
     s = shl(v % 0x0.000a, 16)..s
     v /= 10
   end
   if (val<=0)  s = "0"..s
   return s
end
gamax92 commented 8 years ago

Yeah I've noticed this too, I'll look into it, thanks for reporting!

gamax92 commented 8 years ago

So, I'm not sure how fixable this is. The issue is because with fixed point, dividing by 10 will quickly drop a number down to zero. With a double however, it takes much longer to constantly divide out, going all the way to e-323 before hitting zero.

gingerbeardman commented 8 years ago

Hmm. I guess if a game uses functionality like this, it's probably better to remove it from the game as picolove doesn't suffer from the lower number accuracy it's trying to workaround?

gamax92 commented 8 years ago

I'm not quite sure what you meant by that?

gingerbeardman commented 8 years ago

I mean that if I wanted to port a game to picolove thst used this large number workaround, I'd just replace it as it's not needed.

For Invader Overload I only had to change a few lines to bypass this function and get scoring working.

gamax92 commented 8 years ago

Understandable. For now I guess I'll close this as not fixable.