Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Using mappy with the latest version of allegro

Credits go to OnlineCop, SiegeLord, StanEd, and Thomas Fjellstrom for helping out!
This thread is locked; no one can reply to it. rss feed Print
Using mappy with the latest version of allegro
hartonfamily
Member #16,049
August 2015

Hi all!

Maybe someone who is way better at this then I am can help me out. Does anyone know if it is possible to use the latest version of allegro with Mappy? I did a little with it a few years ago, and really liked working with Mappy, and I have a new project I think it would be a great tool for. Well, from the looks of it Mappy hasn't been updated in a bit, and Allegro seems wayyyy different then when I used it in version 4 something. So I got a base allegro program running and then just added the mappyal.h / mappyal.c to my main and tried to compile it, and of course the compiler goes batty.

Is there anything else I need in order to get it compile? Or is using it a no-go? I'd like to try out the latest version of allegro, but I liked how in mappy I could add data to arbitrary tiles, to handle collision, encounter rates, etc etc. I might would just reset to an older version. Or is there any newer program that duplicates any of the functionality? Thanks in advance!

SiegeLord
Member #7,827
October 2006
avatar

There's some code in this thread: https://www.allegro.cc/forums/thread/606962

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

hartonfamily
Member #16,049
August 2015

Yeah, I took a look at that when I was researching the problem. Seems like that forum post is actually older then what is on his webpage. The header/cpp file actually has changed to mappyal.h/c since that post was made. I tried compiling it in C just to make sure that wasn't the issue. (since it mentioned it in the forum post) I'm still getting errors like "screen" and "PACKFILE" is undefined. (not to mention a host of others).

OnlineCop
Member #7,919
October 2006
avatar

Do you specifically want Mappy, or would you be happier with something more akin to Tiled, where the TMX format is simply specialized XML and has several Allegro articles and examples?

hartonfamily
Member #16,049
August 2015

The reason I liked mappy for my project is its inbuilt block editor. If it was just a matter of splitting tiles up and using them, I would just take a screen shot and make a tileset by hand and load it manually. The mappy interface of being able to create the tileset, then give each of the individual blocks data I could then check for and manipulate in my program was what I was looking for. I think that would save me quite a bit of time and headache! (assuming I could get it to work :) ) I just checked out http://www.mapeditor.org/ and while it looks like a great tile editor, probably better in that regard, I didn't see a way to edit the individual characteristics of tiles in a way that my program could check. I just looked at it today so if I missed it, please tell me, because it looks like a pretty well done program.

Thomas Fjellstrom
Member #476
June 2000
avatar

I'm still getting errors like "screen" and "PACKFILE" is undefined. (not to mention a host of others).

Those are all Allegro 4 things. You need to find some Allegro 5 code to interface with mappy.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

StanEd
Member #16,038
August 2015

I just checked out http://www.mapeditor.org/ and while it looks like a great tile editor, probably better in that regard, I didn't see a way to edit the individual characteristics of tiles in a way that my program could check. I just looked at it today so if I missed it, please tell me, because it looks like a pretty well done program.

Tiled is great I've not used mappy, so hopefully I've understood what you're wanting but tiled lets you add custom properties for tiles (you may need to turn on the properties and tileset boxes on the view menu), so they may do the job you are looking for (see attached screenshot for button).

This goes into the xml as:

#SelectExpand
1 <tileset firstgid="1" name="TestSheet" tilewidth="50" tileheight="70"> 2 <image source="../tilesheets/farenia.png" width="1000" height="910"/> 3 <tile id="0"> 4 <properties> 5 <property name="trans" value="1"/> 6 </properties> 7 </tile> 8 </tileset>

The level files are quite easy to process, I'm sure there was a loader and rendering library for them somewhere which I found, but now I can't find a link to it (sorry) I didn't use it because it didn't meet my requirements so I just parsed the file in using RapidXML and loaded it into a series of objects in c++.

I hope that helps, if I find the link I'll post it :)

Edit: As soon as I'd posted I managed to find the link: allegro_tiled. Enjoy.

hartonfamily
Member #16,049
August 2015

Yeah, it looks like I can add custom properties to that for an individual tile, which should fit my purposes. Your example looks clear, although I just checked back on the tileset webpage and certainly do see anything that looks like that, but I believe you. I will download and mess around with it tonight. The biggest problem is I guess getting the library you linked to installed, so it can talk to allegro and vice versa. I use windows so I don't do a whole lot of 'making,' and not just that, but msvc as well, which in the instructions seems like it is a little problematic to get work. But it might be worth it, especially if Mappy isn't updated to work with Allegro 5.

SiegeLord
Member #7,827
October 2006
avatar

Seems like that forum post is actually older then what is on his webpage

The age of posts is irrelevant if one of them is written for Allegro 5 and one is written for Allegro 4. Did you download the zip file attached to that post?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

hartonfamily
Member #16,049
August 2015

Hrmm, no I didn't see that zip file, but I got it from your post, thanks! Looks like upon including the header I get different errors, which is an improvement! Looks like the thing the compiler isn't liking now is " 'char' followed by 'bool' is illegal " in the file astdbool.h

That mean anything to anyone?

SiegeLord
Member #7,827
October 2006
avatar

Are you using the correct version of Allegro? Does a simple file like this compile?

#include <allegro5/allegro.h>

int main() { al_init(); return 0;}

Also, some code in that zip is definitely a bit off... I've attached somewhat fixed versions of mappy_A5.h and mappy_A5.c.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

hartonfamily
Member #16,049
August 2015

Thanks siege for the better versions of mappy! So it compiles now. I had posted last night when I was raiding so I hadn't had a chance to google that specific error for myself. Once I did the solution was actually pretty trivial.

Fix is here: https://www.allegro.cc/forums/thread/614655

After that, everything worked liked a charm. I'll make a new topic if I have any more hiccups, but it seems like this is taken care of, thanks guys!

Go to: