Can anim_mode=ce_value only display 2048 out of 9999 possible images?

All about creating levels and level sets, custom elements and custom artwork.

Moderators: Zomis, Flumminator

Post Reply
Vroom
Posts: 4
Joined: Sat May 18, 2019 4:24 pm
Location: Sweden

Can anim_mode=ce_value only display 2048 out of 9999 possible images?

Post by Vroom » Sat May 18, 2019 5:25 pm

Hi, RnD fan since 20 years here, who just recently discovered the wonders of CE:s and GE:s!

A CE value can be 0-9999. By setting anim_mode to ce_value you can specify a custom image for each value. I am setting up a spelling level set for the students at the school where I work, and to make the words a bit smaller I let each element encode two characters. So a double-letter-CE value can be 1-900 (30 different characters, 30*30=900). This works, and this way e.g. 5 CE:s placed side-by-side can form a 10-letter word. When picked, correct words turn into things like emeralds or shields, whereas incorrect words become monsters etc.

But now I want to add letters of different styles (color, font etc), and since I still have a lot of unused values I thought I could just use different number series for different alphabets (1-900 for plain white letters, 901-1800 for red letters etc). This also works to an extent, but the anim_mode feature seems to wrap at 2048, even if I specify more than 2048 frames in graphicsinfo.conf. So 2048 will display the same image as 0, 2049 same as 1, and so on. 0-2047 limits me to just 2 different styles, whereas 0-9999 would allow for 11 styles.

I’m guessing the code for this uses some kind of 11 or 12 bit variable for handling these anim_mode integers, since 11 bits would allow for 0-2047, and 12 bits from -2048 to 2047. Is that the case, or maybe I have just done some mistake in the config?

User avatar
Holger
Site Admin
Posts: 3222
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Can anim_mode=ce_value only display 2048 out of 9999 possible images?

Post by Holger » Mon May 20, 2019 9:31 am

Welcome to the R'n'D forum, Vroom, and sorry for the delay in approving your first post! :)
This also works to an extent, but the anim_mode feature seems to wrap at 2048, even if I specify more than 2048 frames in graphicsinfo.conf. So 2048 will display the same image as 0, 2049 same as 1, and so on.
This should not be the case, but maybe you encountered a bug that causes this (wrong) behaviour.

However, I wasn't able to reproduce this with a quick test, but instead everything worked as expected for me. I created a new, empty level set with a file "graphics/graphicsinfo.conf" in it that contains the following lines:

Code: Select all

custom_1:       	                RocksCE.png
custom_1.xpos:                          0
custom_1.ypos:                          0
custom_1.frames:                        2304
custom_1.delay:				50
custom_1.scale_up_factor:               2
custom_1.anim_mode:			ce_value
This just uses scaled-up parts of the default CE/GE graphics (to get more than 2048 different graphics). One has to have a closer look at the graphics in the game, but due to the different colors it is easy to see if the graphics wrap or not, as the first 2048 frames will use a red colored part, while everything above 2048 will use a yellow colored part.

When starting the game with this level set, you can go to the level editor, select custom element 1 and enter some number into the "CE value" input field -- when pressing the "return" key, you will instantly see the changed graphic frame: The value "2047" still has a red part of a number, while "2048" shows a yellow part (and does not wrap to the first frame). "2303" shows the last (yellowish) frame, while "2304" finally wraps to the first frame again (containing a red part of a number).

Does this work for you, too? Maybe there's just some bug in your "graphicsinfo.conf"?

Feel free to upload your artwork set (or the relevant part of it) here (you can attach it as a zip achive), and I will have a closer look at it! :)

Vroom
Posts: 4
Joined: Sat May 18, 2019 4:24 pm
Location: Sweden

Re: Can anim_mode=ce_value only display 2048 out of 9999 possible images?

Post by Vroom » Sun May 26, 2019 1:35 pm

Checking your example I realised that graphics for a CE may span multiple lines in the png. I just used one (very) long line, so my png was 10000*32=320000 px wide and 32 px high. I guess RnD "only" supports 2048*32=65536 px. :)

Now it works as expected. Many thanks, Holger!

User avatar
Holger
Site Admin
Posts: 3222
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Can anim_mode=ce_value only display 2048 out of 9999 possible images?

Post by Holger » Sun May 26, 2019 5:50 pm

Checking your example I realised that graphics for a CE may span multiple lines in the png.
Yes! You can even specify ".frames_per_line" if the graphics file itself is wider than the area that contains the frames.
I just used one (very) long line, so my png was 10000*32=320000 px wide and 32 px high. I guess RnD "only" supports 2048*32=65536 px. :)
Yep, that sounds reasonably (so the graphics width would be a 16 bit integer -- not sure if this is a limitation of R'n'D, SDL_image or the PNG format though).
Now it works as expected. Many thanks, Holger!
Great to know that it works for you now! :D

Post Reply