#13096 - bomberman - Fri Dec 05, 2003 11:01 am
Hi there,
I'm working on a game which uses zoom feature (ratio < 1) and scrolling at the same time.
There is a problem with the zoom. Let's say I display with ratio 2/3, the scaling register will get value 384 ( = 256 *( 1/ (2 / 3)).
This means that the GBA will display only 2 pixels out of three consecutive pixels. In other words, if my bitmap sequence for a line is ABCABCABC, after scaling, it will be ABABAB. This is if scrolling register is 0. Now if I scroll one pixel to the right (scrolling register becomes 256), it will start removing a row not from point (0, 0) of the map, but from (1, 0) which is the first point displayed on the screen. So the display becomes BCBCBC. And if I scroll 2 pixels to the right (scrolling register value is 512), it will display CACACA. Result is when you scroll, everything flashes because at each new position, the removed row is not the same. Hope I was clear on this explanation !!!
I doubt that the fractional part of the scrolling register represents a fraction of pixel, it has no meaning.
What I noticed, however, is if fractional part is 0, then in case of 2/3 ratio, it removes the 3rd row in a sequence. If fractional part is 128, it removes the second row in a sequence, and if I put 256 (which in fact is a plain pixel), then I scroll one more pixel. Result is:
scroll register at 0: ABABAB
scroll register at (256 + 128): BABABA
scroll register at (512 + 256): ABABAB
My scrolling is now fine !!! I can reproduce it with a ratio like 4/5 with using fractional part of 64, 128, 192, 256 depending on my (scrolling register % 5), i.e for a bitmap sequence like ABCDE, I'll have:
scroll register at 0: ABCDABCD
scroll register at (256 + 64): BCDABCDA
scroll register at (512 + 128): CDABCDAB
scroll register at (768 + 192): DABCDABC
scroll register at (1024 + 256): ABCDABCD
In short, it seems that rather than being a fraction of pixel, the fractional part of the register controls which rows are to be removed. With simple cases like that it works fine. My intuition tells me that I am on the right path, but I can not figure out what is the exact schema in a generic case like a "non standard" ratio of 4/7 for example.
Anyone has a clue or already experimented this ???
Thanks
I'm working on a game which uses zoom feature (ratio < 1) and scrolling at the same time.
There is a problem with the zoom. Let's say I display with ratio 2/3, the scaling register will get value 384 ( = 256 *( 1/ (2 / 3)).
This means that the GBA will display only 2 pixels out of three consecutive pixels. In other words, if my bitmap sequence for a line is ABCABCABC, after scaling, it will be ABABAB. This is if scrolling register is 0. Now if I scroll one pixel to the right (scrolling register becomes 256), it will start removing a row not from point (0, 0) of the map, but from (1, 0) which is the first point displayed on the screen. So the display becomes BCBCBC. And if I scroll 2 pixels to the right (scrolling register value is 512), it will display CACACA. Result is when you scroll, everything flashes because at each new position, the removed row is not the same. Hope I was clear on this explanation !!!
I doubt that the fractional part of the scrolling register represents a fraction of pixel, it has no meaning.
What I noticed, however, is if fractional part is 0, then in case of 2/3 ratio, it removes the 3rd row in a sequence. If fractional part is 128, it removes the second row in a sequence, and if I put 256 (which in fact is a plain pixel), then I scroll one more pixel. Result is:
scroll register at 0: ABABAB
scroll register at (256 + 128): BABABA
scroll register at (512 + 256): ABABAB
My scrolling is now fine !!! I can reproduce it with a ratio like 4/5 with using fractional part of 64, 128, 192, 256 depending on my (scrolling register % 5), i.e for a bitmap sequence like ABCDE, I'll have:
scroll register at 0: ABCDABCD
scroll register at (256 + 64): BCDABCDA
scroll register at (512 + 128): CDABCDAB
scroll register at (768 + 192): DABCDABC
scroll register at (1024 + 256): ABCDABCD
In short, it seems that rather than being a fraction of pixel, the fractional part of the register controls which rows are to be removed. With simple cases like that it works fine. My intuition tells me that I am on the right path, but I can not figure out what is the exact schema in a generic case like a "non standard" ratio of 4/7 for example.
Anyone has a clue or already experimented this ???
Thanks