[Moeng-cvs] BBRpg/src/editor editor.cpp, 1.11, 1.12 editor.h, 1.11, 1.12 gui_procs.cpp, 1.11, 1.12
Status: Alpha
Brought to you by:
b_lindeijer
From: Bjørn L. <b_l...@us...> - 2007-02-13 01:49:25
|
Update of /cvsroot/moeng/BBRpg/src/editor In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27860/src/editor Modified Files: editor.cpp editor.h gui_procs.cpp main.cpp Log Message: Added support for loading current Tiled maps to this old engine version. Index: main.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/main.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- main.cpp 23 Oct 2004 11:54:18 -0000 1.10 +++ main.cpp 13 Feb 2007 01:49:22 -0000 1.11 @@ -46,9 +46,25 @@ clean_up(); return 0; } -END_OF_MAIN(); +END_OF_MAIN() + + +void xmlNullLogger(void *ctx, const char *msg, ...) +{ + // Does nothing, that's the whole point of it +} +// Initialize libxml2 and check for potential ABI mismatches between +// compiled version and the shared library actually used. +void initXML() +{ + console.log(CON_LOG, CON_ALWAYS, "Initializing libxml2..."); + xmlInitParser(); + LIBXML_TEST_VERSION; + // Suppress libxml2 error messages + xmlSetGenericErrorFunc(NULL, xmlNullLogger); +} void initialize() { @@ -56,7 +72,7 @@ int i; // Do the libxml binary compatibility check - LIBXML_TEST_VERSION + initXML(); // Initialise Allegro allegro_init(); Index: editor.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/editor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- editor.cpp 23 Oct 2004 11:54:18 -0000 1.11 +++ editor.cpp 13 Feb 2007 01:49:22 -0000 1.12 @@ -31,7 +31,7 @@ int debug_mode = 0; FONT* engine_font = NULL; DATAFILE *engine_data = NULL; -list<Object*> selectedObjects; +std::list<Object*> selectedObjects; int selectedObjectType = 0; bool selecting = false; @@ -45,8 +45,8 @@ int selectedObstacle = 15; int selectedLayer = 0; -vector<char*> tileSets; -vector<TileType*> activeTileset; +std::vector<char*> tileSets; +std::vector<TileType*> activeTileset; char map_filename[1024] = ""; char status_message[1024] = ""; @@ -365,11 +365,12 @@ char path_buf[1024] = ""; if (file_select_ex( - "Load XML map... (*.tmx)", path_buf, "tmx", sizeof path_buf, + "Load map... (*.map)", path_buf, "map", sizeof path_buf, MAX(OLD_FILESEL_WIDTH, SCREEN_W / 2), MAX(OLD_FILESEL_HEIGHT, SCREEN_H / 2) )) { + /* xmlDocPtr doc = xmlParseFile(path_buf); if (doc != NULL) { @@ -389,7 +390,9 @@ set_map_changed(false); update_window_title(); } - else { + else + */ + { alert(NULL, "No XML map, trying PACKFILE format...", NULL, "OK", NULL, 13, 0); @@ -426,9 +429,9 @@ if (writer) { xmlTextWriterSetIndent(writer, 1); xmlTextWriterStartDocument(writer, NULL, NULL, NULL); - + currentMap->saveTo(writer); - + xmlTextWriterEndDocument(writer); xmlFreeTextWriter(writer); set_map_changed(false); @@ -529,7 +532,7 @@ { BITMAP *tile_bitmap; PALETTE pal; - vector<TileType*>::iterator i; + std::vector<TileType*>::iterator i; int x = 0; int y = 0; int tile_w = (activeTileset[0]->getBitmap())->w; @@ -683,7 +686,7 @@ int mapWidth = currentMap->getWidth(); int mapHeight = currentMap->getHeight(); TileType *tt; - + // Create bitmap the size of the map BITMAP* temp_bitmap = create_bitmap(mapWidth, mapHeight); @@ -693,7 +696,7 @@ // Paint current map to temporary bitmap for (x = 0; x < temp_bitmap->w; x++) { for (y = 0; y < temp_bitmap->h; y++) { - tt = currentMap->getLayer(0)->getTile(Point(x, y))->getType(); + tt = currentMap->getLayer((unsigned int)0)->getTile(Point(x, y))->getType(); putpixel(temp_bitmap, x, y, tt->getColor()); } } @@ -727,9 +730,9 @@ } xmlTextWriterSetIndent(writer, 1); xmlTextWriterStartDocument(writer, NULL, NULL, NULL); - + currentMap->saveTo(writer); - + xmlTextWriterEndDocument(writer); xmlFreeTextWriter(writer); ustrcpy(map_filename, path_buf); @@ -901,18 +904,18 @@ selectedObjects.push_front(obj); } -void select_objects(list<Object*> objs) +void select_objects(std::list<Object*> objs) { deselect_objects(); - list<Object*>::iterator i; + std::list<Object*>::iterator i; for (i = objs.begin(); i != objs.end(); i++) { (*i)->selected = true; selectedObjects.push_front((*i)); } } -void delete_objects(list<Object*> objs) +void delete_objects(std::list<Object*> objs) { while (objs.size() > 0) { Object* obj = objs.front(); Index: editor.h =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/editor.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- editor.h 7 Feb 2007 17:50:31 -0000 1.11 +++ editor.h 13 Feb 2007 01:49:22 -0000 1.12 @@ -27,7 +27,7 @@ extern int debug_mode; extern FONT* engine_font; extern Console console; -extern list<Object*> selectedObjects; +extern std::list<Object*> selectedObjects; extern int selectedObjectType; extern bool selecting; extern int selection_start_x, selection_end_x; @@ -39,8 +39,8 @@ extern int selectedObstacle; extern int selectedLayer; -extern vector<char*> tileSets; -extern vector<TileType*> activeTileset; +extern std::vector<char*> tileSets; +extern std::vector<TileType*> activeTileset; extern int map_edit_mode; @@ -145,8 +145,8 @@ void deselect_objects(); void select_object(Object* obj); -void select_objects(list<Object*> objs); -void delete_objects(list<Object*> objs); +void select_objects(std::list<Object*> objs); +void delete_objects(std::list<Object*> objs); void import_tile_bitmap( const char* filename, Index: gui_procs.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/gui_procs.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- gui_procs.cpp 23 Oct 2004 11:54:18 -0000 1.11 +++ gui_procs.cpp 13 Feb 2007 01:49:22 -0000 1.12 @@ -277,7 +277,7 @@ currentMap->drawLayer(buffer, (map_edit_mode == EM_OBSTACLE), currentMap->mapLayers[0]); { - list<Object*>::iterator i; + std::list<Object*>::iterator i; // Iterate through all objects, calling the preRender function for (i = currentMap->objects.begin(); i != currentMap->objects.end(); i++) { callMemberFunction((*i)->tableRef, "preRender"); @@ -452,7 +452,7 @@ { // In obstacle edit mode while (gui_mouse_b() & 1) { - Tile* cursorTile = currentMap->getLayer(0)->getTile(currentMap->screenToTile(Point(gui_mouse_x(), gui_mouse_y()))); + Tile* cursorTile = currentMap->getLayer((unsigned int)0)->getTile(currentMap->screenToTile(Point(gui_mouse_x(), gui_mouse_y()))); if (cursorTile && selectedObstacle != cursorTile->obstacle) { @@ -564,7 +564,7 @@ { // In tile edit mode: clear tile obstacle settings while (gui_mouse_b() & 2) { - Tile* cursorTile = currentMap->getLayer(0)->getTile(currentMap->screenToTile(Point(gui_mouse_x(), gui_mouse_y()))); + Tile* cursorTile = currentMap->getLayer((unsigned int)0)->getTile(currentMap->screenToTile(Point(gui_mouse_x(), gui_mouse_y()))); if (cursorTile && cursorTile->obstacle) { @@ -589,8 +589,8 @@ double new_end_x, new_end_y; selection_end_x = selection_start_x; selection_end_y = selection_start_y; - list<Object*> objects; - list<Object*>::iterator i; + std::list<Object*> objects; + std::list<Object*>::iterator i; select_objects(objects); while (gui_mouse_b() & 2) { |