gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > mapEd Flags : HOW TO

#18634 - RaBBi - Tue Mar 30, 2004 3:33 pm

Hi ^^

Back from holidays, I'm returning on my GBA project.

First step was to test alphablending on flame tiles.
After good results, I started to try to animate tiles, using 3 or 4 animation steps.

When thinking about the way to do it, I thought about using flags array, and remembered that mapEd had this sort of features.

But after reading the customizable .txt file, I don't understand how to add my own flags

So I ask Nessie if he could post an easy way, alternatively to the list of rules that I don't understand entirely.

Thanks ^^

EDIT: seems to understand a little bit more by myself, but an explanation from the author should be really welcome :)
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^

#18635 - Nessie - Tue Mar 30, 2004 4:56 pm

I apologize, some mapEd features are admittedly poorly implemented and even more poorly documented. :)

Anyway, Flags are an extension of the collision layer, as in, you need a collision layer in your map in order to 'draw' in custom flags. I'm guessing this is the part that maybe wasn't overly obvious?

As per this other mapEd topic, http://forum.gbadev.org/viewtopic.php?t=3148, which roughly describes how the collision tile end of collision layers work.....you might be able to do exactly what you want using custom collision tiles that represent various things. (I would recommend using the collision tile way if at all possible.)

It is up to your engine to correctly interpret these 'various' things, heh.

But, if you are positive that you will need to encode various pieces of information into a single array position in the collision array, just post back here and I can try to explain how flags work a bit more.

#18636 - RaBBi - Tue Mar 30, 2004 6:01 pm

Yes I want to store multiple information (flags) for a tile.

So I search how to use the .txt and bits fields but my editings are sometimes "illogicals" regarding the way I think it works.

I thought about doing this for instance :

Code:

CollisionTileIndex {
   bits   4         // allocate 4 bits for the collision tile index
}

NULL {
   bits   4         // pad out 4 empty bits
}


So I'd have 8 bits for 8 flags (if I understood).

But in collision array, I got this kind of results :

Code:

const unsigned int CollisionMap[2048] = {
0x0110,0x0220,0x2440,0x4880,0x9000,0x0000,...}


Which means that the 4 higher bits of the lower byte are used but I pad them with 4 null bits...

So, I must be wrong.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^

#18637 - Nessie - Tue Mar 30, 2004 7:16 pm

Ok, in the example you've shown, you've reserved 4 bits for the collision tile index and spaced out an extra 4 unused bits.

The collision tile index is only filled in if you are using collision tiles as described in the other post. If you haven't drawn any collision tiles into the collision layer, the space is still reserved but will be unused.

Regarding the NULL bits, you might add some extra 'padding' if you wanted to reserve some free space for some other tool to write into. And if you don't need/want any extra space added, you can discard the NULL entry in the external file

Actual flags (you can only have single bit flags for now) that can be created for use in the editor follow this format:

descriptive_name
{
icon $visual_representation
color 0 255 255 128
}

// Visual representation can be any one of the following.
$death, $trigger, $solid, $upArrow, $sideArrow, $doNotEnter,$upLeftDot, $upRightDot, $lowRightDot, $lowLeftDot$, $centerDot,$upLeftBox, $upRightBox, $lowRightBox, $lowLeftBox$, $fullBox

// Specifying a color is optional and is in the format of: red green blue alpha
// each color component is in the range of 0-255

Edit: Actually, I just re-read your post and I'm not entirely sure that I understand your problem? If this post has nothing to do with your problem, I guess re-state the question and maybe I'll catch on. :)

#18641 - RaBBi - Tue Mar 30, 2004 8:54 pm

Ok.

I just don't understand why the 4 higher bits of the lower Byte are filled/used.
Cause I used 4 bits as NULL as you can see.

In fact, I don't understand the values in the array....

I respectively use these flags :

solid,jump through, killer, testeur (my own test), trigger.

So I intended to have these values instead (in my understanding, which is certainly wrong) :

Code:

0x0100, 0x0200, 0x0300, 0x0400....

Can you explain me the resulted values with my configuration? (4bits-4bits-8bits).

Thanks ^^

_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^