1

Hey Guys,

I'm using DATLib 0.3

I am trying to figure out how to make a pointer to a tile map so I can swap tiles in one map out for another.
The classic Hypernoid thread discuses this and even gives a solid example for a "picture"
The problem currently is I cannot figure out how to assign the map data to a pointer.

NeoHomeBrew does it like this....

uint *BGscaleDarkMap; // setup tilemap pointer BGscaleDarkMap=(uint*)background_scale_dark.maps[0]; // assign source image tilemap to pointer //Where "background_scale_dark" is an image compiled as a Picture with BuildChar

It is possible NeoHomeBrew's example was for DATLib 0.2 and the format has changed?

//I am using bank switching so the way I am initializing palettes and images is slightly different not sure if that is factor so I am displaying it here. ushort *BGMap; // setup tilemap pointer picture background_1; pictureInit(&background_1, (pictureInfo*)StageEnd3, 100, 98, 0, 0, FLIP_NONE); // 19 sprites, 2 palettes palJobPut(98, 158, (paletteInfo*)StageEnd3_Palettes+1); BGMap=(ushort*)(pictureInfo*)StageEnd3.maps[0]; //I am trying to assign the damn map data to a pointer here...but this line fails the other lines compile

My compile error is - "request for member `maps' in something not a structure or union"

It looks like "pictureInfo" does have a "maps" member in the documentation not sure what I'm missing here

2

I see that HomeBrew uses uint* and you are using a ushort*. Are tile maps uint or ushort? I see it says ushort in the docs.

Also you may what to look at how HomeBrew uses pictureInit.

Last thing to try is to take out (pictureInfo*) because you are casting to a structure.. actually this might be the answer.

Hope this helps.
Hine62
avatar

3

I appreciate it! Hine62

I have tried with and without (pictureInfo*)
I have tried with uint* but followed the documentation with ushort*

I am showing in my example that the compiled picture from buildChar called "StageEnd3" does compile so I cannot determine why I am unable to point to the map data.

I don't think I need to even have the picture initialized to define the pointer but I wanted to ensure the pictureInfo of "StageEnd3" could compile and wanted to note I am using a slightly different method for initializing "Pictures" due to bank switching.

4

I was able to get the code below to compile I tried accessing the map data differently.
The result is the initialized picture but the replaced tiles don't appear.

void ReplaceTile(void) { pictureInfo *BGMapi; // setup tilemap pointer uint *BGscaleDarkMap; // setup maps pointer picture background_1; initGfx(); clearFixLayer(); clearSprites(1,381); volMEMWORD(0x400004)=0x0000; // fix layer background color volMEMWORD(0x400002)=0xffff; // fix layer font color pictureInit(&background_1, (pictureInfo*)StageEnd3, 100, 98, 0, 0, FLIP_NONE); palJobPut(98, 158, (paletteInfo*)StageEnd3_Palettes+1); palJobPut(16, 1, (paletteInfo*)BG_LEVEL_Palettes+1); BGMapi= (pictureInfo*)BG_LEVEL; BGscaleDarkMap=(uint*)BGMapi->maps[0]; while(1) { pictureSetPos(&background_1, 0, 0); SCClose(); waitVBlank(); //A few unique attempts at swapping the tile data SC1Put(0x0000+6400+(64*7)+36+(2*5),0x01, 26, &BGscaleDarkMap[18+(32*7)+5]); // sprite 107 tile 7 = shadow 49 left SC1Put(0x0000+6400+(64*8)+36+(2*5),0x01, 26, &BGscaleDarkMap[18+(32*8)+5]); // sprite 108 tile 7 = shadow 49 right SC1Put(0x0000+6400+(64*7)+36+(2*6),0x01, 26, (pictureInfo*)BGMapi->maps[18+(32*7)+6]); // sprite 107 tile 8 = shadow 58 left SC1Put(0x0000+6400+(64*8)+36+(2*6),0x01, 26, (pictureInfo*)BGMapi->maps[18+(32*8)+6]); // sprite 108 tile 8 = shadow 58 right SC1Put(0x0000+6400+(64*7)+36+(2*7),0x01, 26, (pictureInfo*)&BGMapi->maps[18+(32*7)+7]); // sprite 107 tile 9 = shadow 67 left SC1Put(0x0000+6400+(64*8)+36+(2*7),0x01, 26, (pictureInfo*)&BGMapi->maps[18+(32*8)+7]); // sprite 108 tile 9 = shadow 67 right SC1Put(0x0000+6400+(64*11)+36+(2*5),0x01, 26, &BGMapi->maps[18+(32*11)+5]); // sprite 111 tile 7 = shadow 51 left SC1Put(0x0000+6400+(64*12)+36+(2*5),0x01, 26, &BGMapi->maps[18+(32*12)+5]); // sprite 112 tile 7 = shadow 51 right SC1Put(0x0000+6400+(64*11)+36+(2*6),0x01, 26, BGMapi->maps[18+(32*11)+6]); // sprite 111 tile 8 = shadow 60 left SC1Put(0x0000+6400+(64*12)+36+(2*6),0x01, 26, BGMapi->maps[18+(32*12)+6]); // sprite 112 tile 8 = shadow 60 right SC1Put(0x0000+6400+(64*11)+36+(2*7),0x01, 26, &BGscaleDarkMap[18+(32*11)+7]); // sprite 111 tile 9 = shadow 69 left SC1Put(0x0000+6400+(64*12)+36+(2*7),0x01, 26, &BGMapi->maps[18+(32*12)+7]); // sprite 112 tile 9 = shadow 69 right SC1Put(0x0000+6400+(64*3)+36+(2*9),0x01, 26, BGMapi->maps[18+(32*3)+9]); // sprite 103 tile 11 = shadow 83 left SC1Put(0x0000+6400+(64*4)+36+(2*9),0x01, 26, BGMapi->maps[18+(32*4)+9]); // sprite 104 tile 11 = shadow 83 right SC1Put(0x0000+6400+(64*5)+36+(2*10),0x01, 26, &BGMapi->maps[18+(32*5)+10]); // sprite 105 tile 12 = shadow 93 left SC1Put(0x0000+6400+(64*6)+36+(2*10),0x01, 26, &BGMapi->maps[18+(32*6)+10]); // sprite 106 tile 12 = shadow 93 right SC1Put(0x0000+6400+(64*7)+36+(2*11),0x01, 26, &BGMapi->maps[18+(32*7)+11]); // sprite 107 tile 13 = shadow 103 left SC1Put(0x0000+6400+(64*8)+36+(2*11),0x01, 26, &BGMapi->maps[18+(32*8)+11]); // sprite 108 tile 13 = shadow 103 right SC1Put(0x0000+6400+(64*9)+36+(2*11),0x01, 26, &BGMapi->maps[18+(32*9)+11]); // sprite 109 tile 13 = shadow 104 left SC1Put(0x0000+6400+(64*10)+36+(2*11),0x01, 26, &BGMapi->maps[18+(32*10)+11]); // sprite 110 tile 13 = shadow 104 right SC1Put(0x0000+6400+(64*11)+36+(2*11),0x01, 26, (pictureInfo*)&BGMapi->maps[18+(32*11)+11]); // sprite 111 tile 13 = shadow 105 left SC1Put(0x0000+6400+(64*12)+36+(2*11),0x01, 26, &BGMapi->maps[18+(32*12)+11]); // sprite 112 tile 13 = shadow 105 right SC1Put(0x0000+6400+(64*13)+36+(2*10),0x01, 26, &BGMapi->maps[18+(32*13)+10]); // sprite 113 tile 12 = shadow 97 left SC1Put(0x0000+6400+(64*14)+36+(2*10),0x01, 26, &BGMapi->maps[18+(32*14)+10]); // sprite 114 tile 12 = shadow 97 right SC1Put(0x0000+6400+(64*15)+36+(2*9),0x01, 26, &BGscaleDarkMap[18+(32*15)+9]); // sprite 115 tile 11 = shadow 89 left SC1Put(0x0000+6400+(64*16)+36+(2*9),0x01, 26, &BGMapi->maps[18+(32*16)+9]); // sprite 116 tile 11 = shadow 89 right } }

5

Are you trying to animate different parts of the background?

Is BG_LEVEL the different tiles assigned from buildChar?
avatar

6

BG_LEVEL is a background I am trying to transition to by replacing the tiles of a foreground image.

Finally have some sort of small progress. I am getting the hang of those brutal numeric monster's for the SC1Put.

My images are smaller than NeoHomeBrew's source files.
His files were 304 x512 mine are 320 x 224 so that threw the math off big time also one of the parameters is a palette entry number that was incorrect on the last example 26 should have been 16.

As soon as I have something working properly I will post so we can see it in action.

Thanks for your help hine62!

7



Here's a start. I really want to make a proper table to get some randomization going on.
A cool little game on PC Engine CD called Pop 'n' Magic inspired me.

The code below will compile. My images are 320 x 224
You might have to modify your calls slightly to be more in line with traditional calls for palettes and pictures.
If someone has a cleaner way of coding this I would love to learn a thing or two.

void ReplaceTile(void) { BYTE waitTime=0; BYTE columns=0; BYTE timer=0; BYTE stripNum=0; short tileNum=-10; short counter=0; short newMapTile=0; pictureInfo *BGMapi; // setup PictureInfo pointer uint *transitionMap; // setup pointer for Picture Info Map data picture background_1; initGfx(); clearFixLayer(); clearSprites(1,381); volMEMWORD(0x401ffe)=0xffff; // set BG color to white volMEMWORD(0x400004)=0x0000; // fix layer background color volMEMWORD(0x400002)=0xffff; // fix layer font color pictureInit(&background_1, (pictureInfo*)StageEnd3, 100, 98, 0, 0, FLIP_NONE); palJobPut(98, 158, (paletteInfo*)StageEnd3_Palettes+1); palJobPut(16, 1, (paletteInfo*)BG_LEVEL_Palettes+1); BGMapi=(pictureInfo*)BG_LEVEL; transitionMap=(uint*)BGMapi->maps[0]; while(1) { //pictureSetPos(&background_1, 0, 0); SCClose(); waitVBlank(); // manipulate tilemap -> SCB1 VRAM $0000-$6FFF // VRAM SC1 start + start_sprite_no + (64*sprite_no_diff) + start_tile_no + (2*tile_no), tile_count, source_img_palette_no, &source_img_map[18+(32*sprite_no_diff) + tile_no] if (waitTime==100) { if (counter <= 13) { if (++timer==2) { timer=0; SC1Put(0x0000+6400+(64*stripNum)+tileNum+(2*5),0x01, 16, &transitionMap[newMapTile]); tileNum+=2; newMapTile++; counter++; } } else if (columns < 19) { counter=0; tileNum=54; if (++columns > 1) { stripNum++; } } } else ++waitTime; } }

8

Does anyone have a problem with rand() working?

fixPrintf2 ( 2,23,0,0,"Random Number: %d", (int)rand());
I can compile no problem but my output is always 0

I have also tried printing a variable with the assigned result of the rand() function but I am constantly getting 0 there too.

Edit - Apologies a quick search showed someone already posted...srand(DAT_frameCounter); needs to be called before rand(); is called.

9



This is the desired effect however it is too slow. I had to fast forward to get the last tile to go away.
I am using the same tile but imagine the tile is transparent revealing a background every time a tile disappears.

Does anyone know if it is possible to output a .txt table from your running rom? (I know probably a dumb question)

Ideally make a table out of the rand() functions return values and just have the transition code iterate through that opposed to using rand().
I could make a few tables to make it seem more random if you see the transition every level etc...

Any feedback would be appreciated here is the codez...

void RamdomlyReplaceTile(void) { BYTE waitTime=0; int tileNum=0; int ROW = 0; int COLUMN = 0; BYTE tilesOnScreen[14][20] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} }; BYTE stripNum[20] = {0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; int columnRows_1[14] = {-10,-8,-6,-4,-2,0,2,4,6,8,10,12,14,16}; BYTE columnRows_2_20[14] = {54,56,58,60,62,64,66,68,70,72,74,76,78,80}; pictureInfo *BGMapi; // setup tilemap pointer // assign source image tilemap to pointer uint *transitionMap; // setup tilemap pointer picture background_1; initGfx(); clearFixLayer(); clearSprites(1,381); volMEMWORD(0x401ffe)=0xffff; // set BG color to white volMEMWORD(0x400004)=0x0000; // fix layer background color volMEMWORD(0x400002)=0xffff; // fix layer font color pictureInit(&background_1, (pictureInfo*)StageEnd3, 100, 98, 0, 0, FLIP_NONE); palJobPut(98, 158, (paletteInfo*)StageEnd3_Palettes+1); palJobPut(16, 1, (paletteInfo*)BG_LEVEL_Palettes+1); BGMapi=(pictureInfo*)BG_LEVEL; transitionMap=(uint*)BGMapi->maps[0]; while(1) { //pictureSetPos(&background_1, 0, 0); SCClose(); waitVBlank(); // manipulate tilemap -> SCB1 VRAM $0000-$6FFF // VRAM SC1 start + start_sprite_no + (64*sprite_no_diff) + start_tile_no + (2*tile_no), tile_count, source_img_palette_no, &source_img_map[18+(32*sprite_no_diff) + tile_no] if (waitTime==100) { srand(DAT_frameCounter); if (tilesOnScreen[(ROW=(rand()%14))][(COLUMN=(rand()%20))] == 0) //0-13 // 0-19 { tilesOnScreen[ROW][COLUMN]=1; if (COLUMN > 0) { tileNum= columnRows_2_20[ROW]; } else { tileNum= columnRows_1[ROW]; } SC1Put(0x0000+6400+(64*stripNum[COLUMN])+tileNum+(2*5),0x01, 16, &transitionMap[0]); } } else ++waitTime; } }

10

in my opinion using a random function for a transition like you want is not a good idea... it just doesn't look smooth enough and is slow. maybe it will take a few extra bytes but several precalculated tables would give you a better result.

{104, 72,197,123, 90, 17,101,200,191,159,232,161,177, 62,190,111, 70,247, 51, 69},
{ 40,112,138,153,117,154, 97, 38,146,129,254,219,265,145,128,199,227, 84, 93,221},
{229,158,220,270, 16, 71, 91,133, 57,121,252,125,258, 32,264, 12,250, 94,172,142},
{127,260,233, 98, 23, 82,266,272,155,251,122,207,149,163, 34,235, 60,144,169,118},
{257,178,204,218,164,136, 20, 21, 63, 81,237,217, 53,246,180,194,253, 86,126, 11},
{113, 39, 68,105,206, 66,143, 78,173,160, 52, 85,148,167, 54,214, 67, 48,184, 14},
{ 18, 36,  3,131,181, 77,114, 79,152,245,193, 29, 30,275, 58,  9,  5,171,255, 19},
{ 89, 31, 15, 43,  7, 28,141,222, 13,130,240,109,203,106,135,198, 35,210,239, 27},
{189,165,102,139,175,268, 64, 42,278,174,150,244,202,147,166,  8,213, 65, 95, 56},
{ 75,208,230, 61,273,107,100,132, 46, 47,269,209,  2,195, 74,236,187,134,271,234},
{ 24, 80,231, 25,162, 96,216, 45,  0,  4, 49,243,157, 22, 88, 92, 33,124,267,120},
{168, 73,224,119,261,263,201,103, 26,156,274,182,137, 41,238,183,242,215,225, 83},
{248, 76, 87, 59, 44,259, 99,  6,277,116,192,279,115,249,179,185, 10,170,186,228},
{  1,212,140, 50,108,211,176, 55,205,151,256,223,110,241, 37,276,262,188,196,226}
{235,137, 34,111, 41, 56,157, 84,110,278,149,  8,102,264,153,180,276,114, 12,107},
{169,123,236,160,142,206,219,210, 23, 50,190,168,237,156, 98,228,147, 85,217,261},
{ 87,191,243,263,221,249,267,265, 83,164,173,129, 51, 95,214,238,189, 97, 38, 10},
{ 33, 88,259, 67,161,257,266,201,134, 25, 35,  7,  3, 81, 92,145,101,239, 68,271},
{ 36,275,124,122,226,279, 93,172,119,109, 39, 14, 89,176, 80,121,203, 57,268, 52},
{ 46,262, 20,116,127,151, 72, 45,148, 21,269,138,195,196,143,144, 60, 63,118, 11},
{ 54,167,252,115,182, 91,194,146,254,199, 58,163,223,155,251, 78,246,229, 59, 79},
{183,159, 47,218,232,105,200,154,162,108,  6,233, 48, 96,212,215, 77, 26,133,  5},
{150,103,140,247,222,270,204,165, 86, 29,272,139,186,152,  2, 28, 44,174,198,274},
{209,253,135,112,  4,256, 73, 17, 15,106,273,202, 71,128, 19, 55,177,  1, 74,187},
{ 66, 49,248,205, 22,211,184,132,207, 37, 13, 62,225, 24,260,158,242,179,113,230},
{227,197, 40,130,234,104, 64, 31,100,224, 90, 82,  9,126,181, 61,231, 69,188,136},
{131,175,244, 27, 53, 16,241, 18,117,171,170,208,141,255, 75,125,193, 94,216, 65},
{185,192,258,245, 99,220,178, 70, 43, 30, 42,277,240, 32,213,166,250,  0, 76,120}
{199,201,180,221,125,118, 74, 25,198,121, 89,178,253, 12,222, 43, 44,117, 64, 81},
{239,236,111,  3, 60,207,203,105,202,110,252,132,262,213,147, 35, 92,191, 57, 79},
{235,184,157,107,158, 36, 16,237, 39,249,268,247,  9, 78, 70, 48, 28,169,116,216},
{104, 90, 94, 42,230, 49, 72,126, 40, 30,231,211,229,264, 53,149,270, 26,166,220},
{ 77,133,223,188,141,  1, 93,266,101, 67,135,232, 45,168, 56, 85,274, 88,103,162},
{138,204,  6, 41,267,113,255,  4,275, 33, 14,164, 18,185,251,109,161, 54,269, 73},
{172,124,154,226,193, 86,176, 10, 61,263, 34, 46,259, 47,170, 24, 97,143, 80, 82},
{114,174,217,165, 38, 63,271, 83,119, 32,227,122,144,200,187, 17,155, 84, 91,153},
{279,233, 96, 66,146,160,194, 37, 55,210,152,142,261, 20,273,115, 65,100,181,108},
{ 68,272,145, 29, 76,177, 51,238,250,244,  7,127,218,130, 11,139, 19,254,219, 15},
{241, 22,140,215,148,120,106,245, 13,159, 69,212,265,186,224,246, 27,123,136,183},
{156,175,276,196,240,195,167,  2, 31,248,234,102,214,256,  5,179, 59, 23, 95,208},
{ 58,163, 98,189,151,  0,242,197, 87,243, 62,277, 52, 99,182,260,190,171,129, 75},
{278,258,228,  8, 71, 21,173,257,137,131,112,225,134,150,205, 50,206,192,128,209}

11

It can be done without tables or using rand():
https://fabiensanglard.net/fizzlefade/index.php
avatar
Zeroblog

« Tout homme porte sur l'épaule gauche un singe et, sur l'épaule droite, un perroquet. » — Jean Cocteau
« Moi je cherche plus de logique non plus. C'est surement pour cela que j'apprécie les Ataris, ils sont aussi logiques que moi ! » — GT Turbo

12



Many thanks to the one they call Blastar! For the look up tables!

Sadly and shamefully the only C compiler I have is for Neo Geo.
I want to get something like the Tiny C compiler so I can make my own look up tables.
I don't know the syntax to output a .txt file that is in the format of an array.
If someone is willing to share how to do this I would be grateful (I know it is sheer lazyness at it's worst on my part happy

The video kinda demonstrates the purpose of why I am messing about with the tile data
The video above has 5 transitions and also utilizes all 3 of Blastars look up tables at different speeds.

1 - Tile per cycle
2 - Tiles per cycle
4 - Tiles per cycle

Side Note: I did make a working example of generating a look up table at runtime.

A) For Loop up a 280 Member Array sequentially with values 0-279
B) Perform Swap function so all 280 values are scrambled as Blastar does in his pre-generated tables...Notice with Blastars tables A and B are not necessary steps at all.
C) The Benefit - You have a random programmatic look up table every time you boot your program or run the B) the swap function.

It worked! but I wasn't a fan of the overhead to generate the sequential table and perform the scramble - rapid testing every little bit of overhead counts!

I included the source code to get the random transition working using a single look up table and 1 tile per cycle below.

ZeroSquare! You are the man son! I really wanted to indulge in the next step of targeting the palette values in a tile!
I want to attempt to emulate SNES pixelate effect on Neo Geo! They take the colour of either the top right or left of a 16x16 tile and flood the rest of the palette entries with that colour.
It looks fresh to death. I would love to figure out how manipulate colours in a tile on per pixel basis. I just saw your post. I really need to read in and see what type of crazy shit can be done.
Anybody have ideas on getting this trick to work?

const short randomMap1[280] = { 104, 72,197,123, 90, 17,101,200,191,159,232,161,177, 62,190,111, 70,247, 51, 69, 40,112,138,153,117,154, 97, 38,146,129,254,219,265,145,128,199,227, 84, 93,221, 229,158,220,270, 16, 71, 91,133, 57,121,252,125,258, 32,264, 12,250, 94,172,142, 127,260,233, 98, 23, 82,266,272,155,251,122,207,149,163, 34,235, 60,144,169,118, 257,178,204,218,164,136, 20, 21, 63, 81,237,217, 53,246,180,194,253, 86,126, 11, 113, 39, 68,105,206, 66,143, 78,173,160, 52, 85,148,167, 54,214, 67, 48,184, 14, 18, 36, 3,131,181, 77,114, 79,152,245,193, 29, 30,275, 58, 9, 5,171,255, 19, 89, 31, 15, 43, 7, 28,141,222, 13,130,240,109,203,106,135,198, 35,210,239, 27, 189,165,102,139,175,268, 64, 42,278,174,150,244,202,147,166, 8,213, 65, 95, 56, 75,208,230, 61,273,107,100,132, 46, 47,269,209, 2,195, 74,236,187,134,271,234, 24, 80,231, 25,162, 96,216, 45, 0, 4, 49,243,157, 22, 88, 92, 33,124,267,120, 168, 73,224,119,261,263,201,103, 26,156,274,182,137, 41,238,183,242,215,225, 83, 248, 76, 87, 59, 44,259, 99, 6,277,116,192,279,115,249,179,185, 10,170,186,228, 1,212,140, 50,108,211,176, 55,205,151,256,223,110,241, 37,276,262,188,196,226 }; void RamdomlyReplaceTile(void) { short index=0; short ROWy; short COLUMNx=0; BYTE stripNum[20] = {0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; short tileNum=64; short columnRows_1[14] = {-10,-8,-6,-4,-2,0,2,4,6,8,10,12,14,16}; BYTE columnRows_2_20[14] = {54,56,58,60,62,64,66,68,70,72,74,76,78,80}; pictureInfo *BGMapi; // assign source image tilemap to pointer uint *transitionMap; // setup tilemap pointer picture background_1; initGfx(); clearFixLayer(); clearSprites(1,381); volMEMWORD(0x401ffe)=0xffff; // set BG color to white volMEMWORD(0x400004)=0x0000; // fix layer background color volMEMWORD(0x400002)=0xffff; // fix layer font color pictureInit(&background_1, (pictureInfo*)StageEnd3, 100, 98, 0, 0, FLIP_NONE); palJobPut(98, 158, (paletteInfo*)StageEnd3_Palettes+1); palJobPut(16, 1, (paletteInfo*)TRANS_STRIP_Palettes+1); BGMapi=(pictureInfo*)TRANS_STRIP; transitionMap=(uint*)BGMapi->maps[0]; while(1) { SCClose(); waitVBlank(); if (index<=279) { //Random Tile 1 COLUMNx = (randomMap1[index] % 20); // SLOW! Method ROWy = (randomMap1[index] / 20); //COLUMNx = (index - (ROWy*20)); // FAST!!!! Method You have to calculate 'Y' first. - The math checks out - but the effect doesn't complete if (COLUMNx > 0) { tileNum = columnRows_2_20[ROWy]; } else { tileNum = columnRows_1[ROWy]; } // manipulate tilemap -> SCB1 VRAM $0000-$6FFF // VRAM SC1 start + start_sprite_no + (64*sprite_no_diff) + start_tile_no + (2*tile_no), tile_count, source_img_palette_no, &source_img_map[18+(32*sprite_no_diff) + tile_no] SC1Put(0x0000+6400+(64*stripNum[COLUMNx])+tileNum+(2*5),0x01, 16, &transitionMap[0]); ++index; } } }

13

Mega Shocked (./12):


Many thanks to the one they call Blastar! For the look up tables!

Sadly and shamefully the only C compiler I have is for Neo Geo.
I want to get something like the Tiny C compiler so I can make my own look up tables.
I don't know the syntax to output a .txt file that is in the format of an array.
If someone is willing to share how to do this I would be grateful (I know it is sheer lazyness at it's worst on my part happy

The video kinda demonstrates the purpose of why I am messing about with the tile data
The video above has 5 transitions and also utilizes all 3 of Blastars look up tables at different speeds.

1 - Tile per cycle
2 - Tiles per cycle
4 - Tiles per cycle

Side Note: I did make a working example of generating a look up table at runtime.

A) For Loop up a 280 Member Array sequentially with values 0-279
B) Perform Swap function so all 280 values are scrambled as Blastar does in his pre-generated tables...Notice with Blastars tables A and B are not necessary steps at all.
C) The Benefit - You have a random programmatic look up table every time you boot your program or run the B) the swap function.

It worked! but I wasn't a fan of the overhead to generate the sequential table and perform the scramble - rapid testing every little bit of overhead counts!

I included the source code to get the random transition working using a single look up table and 1 tile per cycle below.

ZeroSquare! You are the man son! I really wanted to indulge in the next step of targeting the palette values in a tile!
I want to attempt to emulate SNES pixelate effect on Neo Geo! They take the colour of either the top right or left of a 16x16 tile and flood the rest of the palette entries with that colour.
It looks fresh to death. I would love to figure out how manipulate colours in a tile on per pixel basis. I just saw your post. I really need to read in and see what type of crazy shit can be done.
Anybody have ideas on getting this trick to work?

const short randomMap1[280] = { 104, 72,197,123, 90, 17,101,200,191,159,232,161,177, 62,190,111, 70,247, 51, 69, 40,112,138,153,117,154, 97, 38,146,129,254,219,265,145,128,199,227, 84, 93,221, 229,158,220,270, 16, 71, 91,133, 57,121,252,125,258, 32,264, 12,250, 94,172,142, 127,260,233, 98, 23, 82,266,272,155,251,122,207,149,163, 34,235, 60,144,169,118, 257,178,204,218,164,136, 20, 21, 63, 81,237,217, 53,246,180,194,253, 86,126, 11, 113, 39, 68,105,206, 66,143, 78,173,160, 52, 85,148,167, 54,214, 67, 48,184, 14, 18, 36, 3,131,181, 77,114, 79,152,245,193, 29, 30,275, 58, 9, 5,171,255, 19, 89, 31, 15, 43, 7, 28,141,222, 13,130,240,109,203,106,135,198, 35,210,239, 27, 189,165,102,139,175,268, 64, 42,278,174,150,244,202,147,166, 8,213, 65, 95, 56, 75,208,230, 61,273,107,100,132, 46, 47,269,209, 2,195, 74,236,187,134,271,234, 24, 80,231, 25,162, 96,216, 45, 0, 4, 49,243,157, 22, 88, 92, 33,124,267,120, 168, 73,224,119,261,263,201,103, 26,156,274,182,137, 41,238,183,242,215,225, 83, 248, 76, 87, 59, 44,259, 99, 6,277,116,192,279,115,249,179,185, 10,170,186,228, 1,212,140, 50,108,211,176, 55,205,151,256,223,110,241, 37,276,262,188,196,226 }; void RamdomlyReplaceTile(void) { short index=0; short ROWy; short COLUMNx=0; BYTE stripNum[20] = {0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; short tileNum=64; short columnRows_1[14] = {-10,-8,-6,-4,-2,0,2,4,6,8,10,12,14,16}; BYTE columnRows_2_20[14] = {54,56,58,60,62,64,66,68,70,72,74,76,78,80}; pictureInfo *BGMapi; // assign source image tilemap to pointer uint *transitionMap; // setup tilemap pointer picture background_1; initGfx(); clearFixLayer(); clearSprites(1,381); volMEMWORD(0x401ffe)=0xffff; // set BG color to white volMEMWORD(0x400004)=0x0000; // fix layer background color volMEMWORD(0x400002)=0xffff; // fix layer font color pictureInit(&background_1, (pictureInfo*)StageEnd3, 100, 98, 0, 0, FLIP_NONE); palJobPut(98, 158, (paletteInfo*)StageEnd3_Palettes+1); palJobPut(16, 1, (paletteInfo*)TRANS_STRIP_Palettes+1); BGMapi=(pictureInfo*)TRANS_STRIP; transitionMap=(uint*)BGMapi->maps[0]; while(1) { SCClose(); waitVBlank(); if (index<=279) { //Random Tile 1 COLUMNx = (randomMap1[index] % 20); // SLOW! Method ROWy = (randomMap1[index] / 20); //COLUMNx = (index - (ROWy*20)); // FAST!!!! Method You have to calculate 'Y' first. - The math checks out - but the effect doesn't complete if (COLUMNx > 0) { tileNum = columnRows_2_20[ROWy]; } else { tileNum = columnRows_1[ROWy]; } // manipulate tilemap -> SCB1 VRAM $0000-$6FFF // VRAM SC1 start + start_sprite_no + (64*sprite_no_diff) + start_tile_no + (2*tile_no), tile_count, source_img_palette_no, &source_img_map[18+(32*sprite_no_diff) + tile_no] SC1Put(0x0000+6400+(64*stripNum[COLUMNx])+tileNum+(2*5),0x01, 16, &transitionMap[0]); ++index; } } }

Is the demo shown in video a sketch of Mario Bros./Bubble Bobble/Snow Bros. - Nick & Tom/Tumble Pop/R-Buster Heroes/Funky Jet or Metal Savior-like arcade game engine?
avatar

14

Hi VasiliyFamiliya,

Just a demo of what you may use a transition to reveal.

The example was just a mockup of a single screen platformer similar to ones you mention.

I never saw Metal Savior or /R-Buster Heroes/Funky Jet thanks for sharing.
First noticed the random tile transition while playing the excellent Pop 'n Magic!

15

you have implemented the transitions very well but in direct comparison the first ones look better... the random ones are too slow and due to the size of the tiles (16x16) simply too rough.

16

It looks great. There's a question


palJobPut(98, 158, (paletteInfo*)StageEnd3_ Palettes+1);


palJobPut(16, 1, (paletteInfo*)TRANS_ STRIP_ Palettes+1);


If stageend3 has 142 palettes, trans_ Strip has 137 palettes.


So how to write the code?


If trans_ Strip is a scene, not a picture.


How to write code?


Thank you very much.
avatar