|
Post by elmer on May 13, 2022 18:11:00 GMT
So I just wanted to know is writing to the 0x220c/0x2210 a good solution for scrolling in HuC ? HuC always copies bg_x1 and bg_y1 to the VDC registers during VBLANK (just like the System Card does by default), so "yes", as long as no scroll() regions are set up, then AFAIK it's absolutely safe-and-supported for you to use them in that way. Just as long as you're aware that you need to use the scroll() library calls instead if the are any scroll() regions set up.
|
|
|
Post by hyperfighting on May 13, 2022 19:04:40 GMT
First Progress of the day!
Whenever you see the Zuks moving at Turbo speed (pun intended) it's because I am disabling map updating
if (map.render==1) { /* update BAT with tiles */ mpd_update_screen(); scroll( 0, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); }
I am going to get started on the attract sequence. The video shows an example of "put_tile(tileNum, X, Y);"
|
|
|
Post by 0x8bitdev on May 13, 2022 19:11:44 GMT
HuC always copies bg_x1 and bg_y1 to the VDC registers during VBLANK (just like the System Card does by default), so "yes", as long as no scroll() regions are set up, then AFAIK it's absolutely safe-and-supported for you to use them in that way. Just as long as you're aware that you need to use the scroll() library calls instead if the are any scroll() regions set up. Thanks! It's simple and useful. Now I need to fix the lib description and the samples.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 13, 2022 19:34:49 GMT
LIMITATIONS: 1. A Bi-directional and a multi-directional map MUST use only ONE CHR bank! Using screens from a multiple data banks in one map are not allowed! The only exception to the rule is a bi-directional map with static screens switching (without scrolling!). Such bi-directional maps can use screens from any CHR banks. You can only use one bank at the same time? I wanted to add letters to my title screen, but I am nearly out of memory in bank 0. My plan was to recreate the Bonk's adventure title screen. I've reassembled the letters, but my idea was to have Bonk ride it, now dead and fossilized. I thought it would be amusing if the Chikkuns were now archaeologists who were trying to dig him up. I would have some skit where the Chikkuns would dig at the edges of the map and then he would fall down.
|
|
|
Post by hyperfighting on May 13, 2022 19:38:53 GMT
@shmglsky Yup one BANK at a time. At least that's how I understand it.
So your tools are 256 tiles + whatever sprites. You have to be strategic and reuse the odd tile from time to time. Anything that moves needs to be a sprite not a background.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 13, 2022 19:48:55 GMT
Okay, that makes sense.
Thanks!
|
|
|
Post by hyperfighting on May 13, 2022 21:24:42 GMT
Progress Report Number 2 - Attract Mode Shouts out to lunoka for investigating Split screen stuff. Split screen methods on HuCelmer turboxray - For providing the means to expand the multi scroll! I'm having an issue when I jump to BANK 0 for the first time. There is a garbage frame...I tried cls(); vsync(); etc but no dice. BANK 0: Attract Tiles BANK 1: Title Tiles Layout 1: Big Star Attract Layout 2: Star Field Attract Layout 3: Title Screen Attract These are the two functions I'm using to jump to Bank 0 - wondering if there are any red flags? void LAYOUT_ATTRACT_STAR()
{
disp_off();
vsync();
mpd_init( map_ind=0, 1 ); mpd_draw_screen();
scroll( 0, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 1, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 2, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 3, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 4, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 5, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 6, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
disp_on();
}
void LAYOUT_ATTRACT_STAR_FIELD()
{
disp_off();
vsync();
mpd_init( map_ind=1, 1 ); mpd_draw_screen_by_ind_offs( map_ind=1, 23, FALSE ); mpd_draw_screen();
scroll(0, mpd_scroll_x(), mpd_scroll_y(), 0, 31, 0xC0); scroll(1, mpd_scroll_x(), mpd_scroll_y(), 32, 63, 0xC0); scroll(2, mpd_scroll_x(), mpd_scroll_y(), 64, 95, 0xC0); scroll(3, mpd_scroll_x(), mpd_scroll_y(), 96, 127, 0xC0); scroll(4, mpd_scroll_x(), mpd_scroll_y(), 128, 159, 0xC0); scroll(5, mpd_scroll_x(), mpd_scroll_y(), 160, 190, 0xC0); scroll(6, mpd_scroll_x(), mpd_scroll_y(), 191, 223, 0xC0);
disp_on();
}
|
|
|
Post by 0x8bitdev on May 14, 2022 10:35:14 GMT
How to avoid glitches when updating screen data. Try to understand the logic:
disp_off(); // disable background and sprites; so from the top to bottom of a new frame you will see a background color ONLY! vsync(); // waiting for a new frame, after the 'vsync' a new frame will be drawn from the top to bottom with a background color
... screen data updating...
disp_on(); // enable background and sprites, so a new frame will be drawn with background and sprites from the top to bottom vsync(); // now the screen has been updated with a new data and we are waiting for a new frame, to draw the entire updated screen from the top to bottom
I'm not an expert in using HuC's 'scroll()' function, but the scroll layers initialization in the 'LAYOUT_ATTRACT_STAR()' looks useless. Try to remove this...
scroll( 0, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 1, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 2, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 3, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 4, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 5, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); scroll( 6, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 ); ...and test your project.
Then try to remove the scroll layers initialization from the 'LAYOUT_ATTRACT_STAR_FIELD()' function...
scroll(0, mpd_scroll_x(), mpd_scroll_y(), 0, 31, 0xC0); scroll(1, mpd_scroll_x(), mpd_scroll_y(), 32, 63, 0xC0); scroll(2, mpd_scroll_x(), mpd_scroll_y(), 64, 95, 0xC0); scroll(3, mpd_scroll_x(), mpd_scroll_y(), 96, 127, 0xC0); scroll(4, mpd_scroll_x(), mpd_scroll_y(), 128, 159, 0xC0); scroll(5, mpd_scroll_x(), mpd_scroll_y(), 160, 190, 0xC0); scroll(6, mpd_scroll_x(), mpd_scroll_y(), 191, 223, 0xC0); ...and test your project.
Let me know how it works.
|
|
|
Post by hyperfighting on May 14, 2022 11:20:59 GMT
The new function calls look like this... void LAYOUT_ATTRACT_STAR() { disp_off(); vsync(); mpd_init( map_ind=0, 1 ); mpd_draw_screen(); disp_on(); vsync();
}
void LAYOUT_ATTRACT_STAR_FIELD() { disp_off(); vsync(); mpd_init( map_ind=1, 1 ); mpd_draw_screen_by_ind(1); mpd_draw_screen_by_ind_offs( map_ind=1, 23, FALSE ); mpd_draw_screen(); disp_on(); vsync();
}
This is the result - You can see why I added the scroll functions to the LAYOUT_ATTRACT_STAR You can see in the BANK 1 - Data there is 3 garbage tiles that were generate on import...I wonder why they exist? They look like the tiles appearing in the frame. I did not Optimize my BANK 1 tiles because I have no screen for "push run" I will manually try to delete these tiles but I can't seem to get rid of them. [upd] It's strange drawing on the block draws on all three at once? [upd] Blacking out the three blocks was achieved by blacking out one. When I coloured the 3 blocks black and reexported the garbage frame transition is gone. The blocks were a bi-product of an import. This is the file I imported.
Map_TITLE_320.bmp (420.21 KB)Attachments:Zuks320_Attract.mapedpce (272.81 KB)
|
|
|
Post by 0x8bitdev on May 14, 2022 11:39:12 GMT
Ok, I've understood. In the LAYOUT_ATTRACT_STAR() you are clearing scroll layers state.
Looks like something is missing and something is unnecessary here:
void LAYOUT_ATTRACT_STAR_FIELD() { disp_off(); vsync(); mpd_init( map_ind=1, 1 ); mpd_draw_screen_by_ind(1); mpd_draw_screen_by_ind_offs( map_ind=1, 23, FALSE ); <-- map_ind=1 ??? mpd_draw_screen(); <--- ???????????? ????????????????????? vsync(); ????????????????????? }
|
|
|
Post by hyperfighting on May 14, 2022 11:45:02 GMT
When I draw with black on one of these blocks.... All three are updated? Then the first 8x8 tile disappears as if it references one or all of the blocks I drew black on. [upd] - Import settings I use
Thanks for looking into the functions they work great as far as I can tell.
void LAYOUT_ATTRACT_STAR()
{
disp_off();
vsync();
mpd_init( map_ind=0, 1 );
mpd_draw_screen_by_ind(0);
scroll( 0, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
scroll( 1, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
scroll( 2, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
scroll( 3, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
scroll( 4, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
scroll( 5, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
scroll( 6, mpd_scroll_x(), mpd_scroll_y(), 0, ScrPixelsHeight, 0xC0 );
disp_on();
vsync();
}
void LAYOUT_ATTRACT_STAR_FIELD()
{
disp_off();
vsync();
mpd_init( map_ind=1, 1 );
mpd_draw_screen_by_ind(0);
mpd_draw_screen_by_ind_offs( map_ind=1, 23, FALSE );
disp_on();
vsync();
}
|
|
|
Post by 0x8bitdev on May 14, 2022 12:07:13 GMT
When I draw with black on one of these blocks.... All three are updated. It's ok! Then the first 8x8 tile disappears as if it references one or all of the blocks I drew black on. What did you do before? Looks like you assigned a new CHR to the block.
|
|
|
Post by hyperfighting on May 14, 2022 12:15:28 GMT
I see a bug.
1. Open v0.07.b Dev
2. adjust block H to 224 (320x224)
3. create Bank +
4. import the .bmp image attached above with the settings shown above.
5. draw on the first "ugly" block at the bottom of the tileset.
RESULT the first block in the tileset will have a modified 8x8 tile in the upper left corner.
Can you repeat these steps and let me know?
|
|
|
Post by 0x8bitdev on May 14, 2022 12:38:59 GMT
That's not a bug.
The first "ugly" block at the bottom of the tileset filled with the first CHR of the platform's block, but with #00 palette. Just assign to that ugly block palette #04 and you'll see a part of the platforms block.
[upd]: Use the 'Skip zero CHR/Block'!
[upd]: Try to reproduce in a test project that garbage screen when you jump to BANK 0 for the first time.
|
|
|
Post by hyperfighting on May 14, 2022 12:53:00 GMT
The reason I'm not using this feature on import is because the background "Blue" is ruined on import.
|
|