Page 1 of 1

This is why bitmaps aren't working the same

Posted: 8 Jul 2019, 1:52
by Lx Xzit
To clarify, this is not necessarily a bug and doesn't mean it must be "fixed" (reverted back), but I do think I should report it because it's breaking many old scripts.

Now let's start:

Look at this code:

Code: Select all

call bmpcreate(1, 1, 1, 1, 0, 0, 32, 32, 400, 300, 1, 1, 16, 16, 0, -1)
do
    v(time) = v(time) + 1
   with bitmap(1)
      select case v(time)
         case 1 to 65
            .scry = 0
         case 66 to 65*2
            .scry = 1*32
         case else
            v(time) = 1
      end select
   end with
    call sleep(1)
loop


(You can run this code without needing to download anything)
If you run this code in SMBX 1.4.5, you will see a goomba in the center of the screen switching between two frames every second. It works as expected. However, if you run this code at SMBX 1.4.4 you will see a goomba that blinks.

Why does this happen? in SMBX 1.4.4, every time you switched to a new x or y position on the image (say, the bitmap), you were forced to set the bitmap's size again, otherwise it wouldn't work. In SMBX 1.4.5 however, this is no longer needed (presumably because it was due a bug that was fixed)

This is the same code as before, but I added the lines that resized the bitmap (it's size it's always 32x32 since it's a goomba):

Code: Select all

call bmpcreate(1, 1, 1, 1, 0, 0, 32, 32, 400, 300, 1, 1, 16, 16, 0, -1)
do
    v(time) = v(time) + 1
   with bitmap(1)
      select case v(time)
         case 1 to 65
            .scry = 0
            .scrheight = 32     'Added this
         case 66 to 65*2
            .scry = 1*32
            .scrheight = 32     'And this line
         case else
            v(time) = 1
      end select
   end with
    call sleep(1)
loop


So if you run this, this should work fine in SMBX 1.4.4.

If this don't get changed, to fix this you have fix this you have delete any redundant lines that resizes the bitmap.
Should 38a revert this back? I don't know. It is better working without this odd problem, but it means a lot of old scripts needs to be updated.