Sprite ID oddities and the use of ID# 4096

Previous topic - Next topic

Synthetic

Well, I thought that there was around a 4k limit to the amount of sprites that you could load. I was wrong. =D Playing around a bit, I was able to load more but found out some strange things. First, a sprite with ID number 4096 causes the compiled program to not run. I figured it was just the max that it supported but was able to narrow it down to 4096 being the culprit. I tried several different bitmap images to see if it made a difference but no luck. This is the code here:

LOADSPRITE "1.bmp",4096
WHILE TRUE
SPRITE 4096,0,0
SHOWSCREEN
WEND

It will just freeze at "Loading..."

Next I tried to load more sprites thinking that just #4096 was a bad apple. This is what I came up with after experimenting.

It would correctly load and display sprites that had IDs in these number ranges with no problems:
0 - 4079
9000 - 12271
16400 - 20000

Now these number ranges for sprite IDs gave me all sorts of weird problems such as displaying half sized images of the loaded sprites in non specified locations on screen, messing up the built in font, showing the whole built in font on screen, hang on "Loading.." or just causing all sprites and the "Loading..." to not even show at all:
4080 - 8999
12272 - 16399

I didn't bother going any higher than 20k. Loading a sprite with an ID of just one of the numbers from the bad sets depending on which one it was, would work but not alot of them. It would take a long time :P just to test each and every number so those bad ranges are approximate. I used a for/next loop until I got working ranges with no problems.
Using an ID number of 4080 for a sprite causes any text to show as parts of that loaded sprite instead of the built in font. I tested this with several versions of GLBasic including 3.011 all with same results and on my other system just to make sure my RAM or anything else didn't decide to go section 8 on me.
"Impossible is a word people use to make themselves feel better when they quit."

My AMXMODX plugins for Day of Defeat 1.3 can be found here.

BumbleBee

You are right.

ID_Num=4096
LOADSPRITE "1.bmp",ID_Num
WHILE TRUE
  SPRITE ID_Num,0,0
  SHOWSCREEN
WEND

That doesn't work. Just like ID_Num=4097 and 4098.

But ID_Num = 4099 and ID_Num = 4095 works without any problems.


Very strange


Cheers
The day will come...

CPU Intel(R) Core(TM) i5-3570k, 3.4GHz, AMD Radeon 7800 , 8 GB RAM, Windows 10 Home 64Bit

Kitty Hello

everything above 4096 will overwrite memory and result in unpredictable results. I'll add more if you need them. Say 32768?

Synthetic

Thanks for the reply Gernot! That would be great. I've used other BASICs out there and own a popular one but I love GL the best plus you have always helped out with any questions I had. I really appreciate it.  You have an excellent product with unmatched support.
"Impossible is a word people use to make themselves feel better when they quit."

My AMXMODX plugins for Day of Defeat 1.3 can be found here.