[Moeng-cvs] BBRpg/src/editor aphoton.cpp,1.2,1.3 editor.cpp,1.8,1.9 editor.h,1.8,1.9 gui_procs.cpp,1
Status: Alpha
Brought to you by:
b_lindeijer
From: Bj?rn L. <b_l...@us...> - 2004-04-13 12:40:10
|
Update of /cvsroot/moeng/BBRpg/src/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15068/src/editor Modified Files: aphoton.cpp editor.cpp editor.h gui_procs.cpp main.cpp script.cpp script.h Log Message: Commiting engine changes to our beloved BBRpg on SourceForge. Index: main.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/main.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** main.cpp 27 Dec 2003 13:49:37 -0000 1.7 --- main.cpp 13 Apr 2004 12:26:08 -0000 1.8 *************** *** 11,14 **** --- 11,15 ---- #include <allegro.h> + #include <libxml/xmlversion.h> #include "agup.h" #include "aphoton.h" *************** *** 18,21 **** --- 19,23 ---- #include "../common.h" #include "../shared/engine.h" + #include "../shared/module.h" *************** *** 24,49 **** - int main(int argc, char *argv[]) { ! initialize(); ! // Handle a map file passed as argument ! if (argc == 2 && exists(argv[1])) ! { ! PACKFILE *file = pack_fopen(argv[1], F_READ_PACKED); ! if (file) { ! currentMap->loadFrom(file, tileRepository); ! pack_fclose(file); ! ustrcpy(map_filename, argv[1]); ! update_window_title(); ! } else { ! alert("Invalid map file:", argv[1], NULL, "OK", NULL, 13, 0); ! } ! } ! do_dialog(main_dlg, -1); ! clean_up(); ! return 0; } END_OF_MAIN(); --- 26,50 ---- int main(int argc, char *argv[]) { ! initialize(); ! // Handle a map file passed as argument ! if (argc == 2 && exists(argv[1])) ! { ! PACKFILE *file = pack_fopen(argv[1], F_READ_PACKED); ! if (file) { ! currentMap->loadFrom(file, tileRepository); ! pack_fclose(file); ! ustrcpy(map_filename, argv[1]); ! update_window_title(); ! } else { ! alert("Invalid map file:", argv[1], NULL, "OK", NULL, 13, 0); ! } ! } ! do_dialog(main_dlg, -1); ! clean_up(); ! return 0; } END_OF_MAIN(); *************** *** 53,102 **** void initialize() { ! char buf[1024]; ! int i; ! // Initialise Allegro ! allegro_init(); ! install_keyboard(); ! install_mouse(); ! install_timer(); ! set_config_file("rpgedit.cfg"); ! int grph_drv = (get_config_int("video", "fullscreen", 1)) ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED; ! int screen_w = get_config_int("video", "width", 800); ! int screen_h = get_config_int("video", "height", 600); ! if (get_config_int("tile_zoom", "grid", 1)) { ! showTileGrid = true; ! } ! set_color_conversion( ! (COLORCONV_TOTAL & ~( ! COLORCONV_32A_TO_8 | ! COLORCONV_32A_TO_15 | ! COLORCONV_32A_TO_16 | ! COLORCONV_32A_TO_24 ! )) ! ); ! int colordepth = 0; ! if (grph_drv == GFX_AUTODETECT_WINDOWED) {colordepth = desktop_color_depth();} ! if (colordepth == 0) {colordepth = 16;} ! set_color_depth(colordepth); ! if (set_gfx_mode(grph_drv, screen_w, screen_h, 0, 0) != 0) { ! set_color_depth(15); ! if (set_gfx_mode(grph_drv, screen_w, screen_h, 0, 0) != 0) { ! set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); ! allegro_message("Unable to set any graphic mode\n%s\n", allegro_error); ! exit(1); ! } ! } ! buffer = create_bitmap(SCREEN_W, SCREEN_H); ! // Initialize GUI look and feel stuff ! agup_init(aphoton_theme); gui_fg_color = agup_fg_color; gui_bg_color = agup_bg_color; --- 54,112 ---- void initialize() { ! char buf[1024]; ! int i; ! // Do the libxml binary compatibility check ! LIBXML_TEST_VERSION ! // Initialise Allegro ! allegro_init(); ! install_keyboard(); ! install_mouse(); ! install_timer(); ! set_config_file("rpgedit.cfg"); ! int grph_drv = (get_config_int("video", "fullscreen", 1)) ? ! GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED; ! int screen_w = get_config_int("video", "width", 800); ! int screen_h = get_config_int("video", "height", 600); ! if (get_config_int("tile_zoom", "grid", 1)) { ! showTileGrid = true; ! } ! set_color_conversion( ! (COLORCONV_TOTAL & ! ~( ! COLORCONV_32A_TO_8 | ! COLORCONV_32A_TO_15 | ! COLORCONV_32A_TO_16 | ! COLORCONV_32A_TO_24 ! )) ! ); ! int colordepth = 0; ! if (grph_drv == GFX_AUTODETECT_WINDOWED) { ! colordepth = desktop_color_depth(); ! } ! if (colordepth == 0) { ! colordepth = 16; ! } ! set_color_depth(colordepth); ! if (set_gfx_mode(grph_drv, screen_w, screen_h, 0, 0) != 0) { ! set_color_depth(15); ! if (set_gfx_mode(grph_drv, screen_w, screen_h, 0, 0) != 0) { ! set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); ! allegro_message("Unable to set graphic mode\n%s\n", allegro_error); ! exit(1); ! } ! } + buffer = create_bitmap(SCREEN_W, SCREEN_H); ! ! // Initialize GUI look and feel stuff ! agup_init(aphoton_theme); gui_fg_color = agup_fg_color; gui_bg_color = agup_bg_color; *************** *** 106,273 **** gui_text_list_proc = d_agup_text_list_proc; ! DATAFILE* font_data = load_datafile_object("gui.dat", "SmallFont"); ! if (font_data) font = (FONT*)font_data->dat; ! engine_font = font; ! DATAFILE* mouse_pointer = load_datafile_object("gui.dat", "_MS_STD_BMP"); ! if (mouse_pointer) set_mouse_sprite((BITMAP*)mouse_pointer->dat); ! DATAFILE* logo = load_datafile_object("gui.dat", "MoonlightLogo"); ! about_dlg[1].dp = (BITMAP*)logo->dat; ! console.log(CON_LOG, CON_ALWAYS, "Loading data.dat..."); ! data = load_datafile("data.dat"); ! if (!data) { ! console.log(CON_QUIT, CON_ALWAYS, "Error while loading: data.dat"); ! } ! // Lua initialisation ! console.log(CON_LOG, CON_ALWAYS, "Initialising Lua scripting environment..."); ! initScripting(); ! D_AUTOTEXT_STATUS.dp2 = status_message; ! D_AUTOTEXT_MAPINFO.dp2 = status_mapinfo; ! set_dialog_color(main_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(newmap_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(import_tileset_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(export_tileset_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(resizemap_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(about_dlg, agup_fg_color, agup_bg_color); ! - // Position the dialogs on the screen - int margin = 6; - int zoom_w = get_config_int("tile_zoom", "zoom_width", 120) - 1; - int zoom_h = get_config_int("tile_zoom", "zoom_height", 120) - 1; - int x, y, w, h; - - // Main (back + menu) - set_dialog_size(&main_dlg[0], -2, -2, SCREEN_W + 4, SCREEN_H + 4); - set_dialog_size(&main_dlg[1], 0, 0, SCREEN_W, 15); ! // Status bars ! set_dialog_size(&main_dlg[6], 0, SCREEN_H - 17, SCREEN_W - 256, 17); ! set_dialog_size(&main_dlg[7], SCREEN_W - 256, SCREEN_H - 17, 256, 17); ! set_dialog_size(&main_dlg[8], 3, SCREEN_H - 14, SCREEN_W - 262, 11); ! set_dialog_size(&main_dlg[9], SCREEN_W - 253, SCREEN_H - 14, 250, 11); ! // Edit tile area ! w = zoom_w + 4; ! h = zoom_h + 4; ! x = margin; ! y = main_dlg[6].y - margin - h; ! set_dialog_size(&edit_tile_layer[0], x, y, w, h); ! set_dialog_size(&edit_tile_layer[1], x + 2, y + 2, w - 4, h - 4); ! set_dialog_size(&edit_tile_layer[2], x + margin + w, y + h - 14, 50, 14); ! // Color sliders ! x += w + margin; ! w = 128; ! set_dialog_size(&edit_tile_layer[8], x, y, 16, 8); ! set_dialog_size(&edit_tile_layer[9], x, y + 16, 16, 8); ! set_dialog_size(&edit_tile_layer[10], x, y + 32, 16, 8); ! set_dialog_size(&edit_tile_layer[11], x, y + 48 + 8, 16, 8); ! set_dialog_size(&edit_tile_layer[12], x, y + 64 + 8, 16, 8); ! set_dialog_size(&edit_tile_layer[3], x + 16, y, w, 8); ! set_dialog_size(&edit_tile_layer[4], x + 16, y + 16, w, 8); ! set_dialog_size(&edit_tile_layer[5], x + 16, y + 32, w, 8); ! set_dialog_size(&edit_tile_layer[6], x + 16, y + 48 + 8, w, 8); ! set_dialog_size(&edit_tile_layer[7], x + 16, y + 64 + 8, w, 8); ! set_dialog_size(&edit_tile_layer[13], x + 16 + w + 4, y - 1, 11, 10); ! set_dialog_size(&edit_tile_layer[14], x + 16 + w + 4, y + 16 - 1, 11, 10); ! set_dialog_size(&edit_tile_layer[15], x + 16 + w + 4, y + 32 - 1, 11, 10); ! set_dialog_size(&edit_tile_layer[20], x + 16 + w + 18, y + 4, 18, 32); ! // Select tile area ! x = edit_tile_layer[20].x + edit_tile_layer[20].w + margin; ! w = SCREEN_W - x - margin; ! set_dialog_size(&edit_tile_layer[16], x, y, 104, h); ! set_dialog_size(&edit_tile_layer[17], x + 104, y, w - 104, h); ! set_dialog_size(&edit_tile_layer[18], x + 104 + 2, y + 2, w - 104 - 4 - 11, h - 4); ! set_dialog_size(&edit_tile_layer[19], x + w - 14, y, 14, h); ! // Obstacle edit stuff ! w = 24; ! h = 24; ! x = margin; ! y = main_dlg[6].y - margin - h; ! for (i = 0; i < 5; i++) { ! set_dialog_size(&edit_obstacle_layer[i], x + i*(w+margin), y, w, h); ! set_dialog_size(&edit_obstacle_layer[i+5], x + i*(w+margin) + 2, y + 2, w - 4, h - 4); ! } ! // Edit map area ! x = margin; ! y = 16 + margin; ! w = SCREEN_W - 2 * margin; ! h = edit_obstacle_layer[0].y - margin - y; ! set_dialog_size(&main_dlg[2], x, y, w, h); ! set_dialog_size(&main_dlg[3], x + 2, y + 2, w - 15, h - 15); ! set_dialog_size(&main_dlg[4], x + w - 14, y, 14, h - 11); ! set_dialog_size(&main_dlg[5], x, y + h - 14, w - 11, 14); ! set_dialog_size(&main_dlg[10], x + w - 12, y + h - 12, 10, 10); ! // Edit objects area ! w = 123; ! h = 120; ! x = margin; ! y = main_dlg[6].y - margin - h; ! set_dialog_size(&edit_objects_layer[0], x, y, w, h); ! set_dialog_size(&edit_objects_layer[1], 136, main_dlg[6].y - margin - 14, 97, 14); ! ! // Initialize map and tile stuff ! tileRepository = new TileRepository(); ! // Import tilesets specified in rpgedit.cfg ! i = 1; ! while (i > 0) ! { ! uszprintf(buf, sizeof buf, "tileset%d", i); - const char* filename = get_config_string(buf, "filename", NULL); - int tile_w = get_config_int(buf, "tile_w", 16); - int tile_h = get_config_int(buf, "tile_h", 16); - int tile_spacing = get_config_int(buf, "tile_spacing", 0); ! if (filename) { ! if (tile_w > 0 && tile_h > 0 && tile_spacing >= 0) { ! import_tile_bitmap(filename, tile_w, tile_h, tile_spacing); ! } else { ! allegro_message("Error, incorrect parameters for automatic tile import (%s)!", filename); ! // Print warning in log file ! } ! i++; ! } else { ! i = -1; ! } ! } ! currentMap = new SquareMap(TILES_W, TILES_H); ! ustrcpy(map_filename, "untitled.map"); ! // Load map specified in rpgedit.cfg ! const char* filename = get_config_string("startup", "load_map", NULL); ! if (filename) { ! PACKFILE *file = pack_fopen(filename, F_READ_PACKED); ! if (file) { ! currentMap->loadFrom(file, tileRepository); ! pack_fclose(file); ! ustrcpy(map_filename, filename); ! object_message(&D_MAP, MSG_NEW_MAP, 0); ! set_map_changed(false); ! } else { ! allegro_message("Error while loading default map (%s)!\n", filename); ! // Print warning in log file ! } ! } ! update_window_title(); ! map_edit_mode = EM_TILE; ! menu_item_edit_objects(); ! //activate_mode(edit_objects_layer); } --- 116,282 ---- gui_text_list_proc = d_agup_text_list_proc; ! DATAFILE* font_data = load_datafile_object("gui.dat", "SmallFont"); ! if (font_data) font = (FONT*)font_data->dat; ! engine_font = font; ! DATAFILE* mouse_pointer = load_datafile_object("gui.dat", "_MS_STD_BMP"); ! if (mouse_pointer) set_mouse_sprite((BITMAP*)mouse_pointer->dat); ! DATAFILE* logo = load_datafile_object("gui.dat", "MoonlightLogo"); ! if (logo) about_dlg[1].dp = (BITMAP*)logo->dat; ! else console.log(CON_QUIT, CON_ALWAYS, "Error loading MoonlightLogo"); ! console.log(CON_LOG, CON_ALWAYS, "Loading module \"data\"..."); ! module = new Module("data"); ! //data = load_datafile("data.dat"); ! //if (!data) { ! // console.log(CON_QUIT, CON_ALWAYS, "Error while loading: data.dat"); ! //} ! // Lua initialisation ! console.log(CON_LOG, CON_ALWAYS, "Initialising scripting environment..."); ! initScripting(); ! D_AUTOTEXT_STATUS.dp2 = status_message; ! D_AUTOTEXT_MAPINFO.dp2 = status_mapinfo; ! set_dialog_color(main_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(newmap_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(import_tileset_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(export_tileset_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(resizemap_dlg, agup_fg_color, agup_bg_color); ! set_dialog_color(about_dlg, agup_fg_color, agup_bg_color); ! // Position the dialogs on the screen ! int margin = 6; ! int zoom_w = get_config_int("tile_zoom", "zoom_width", 120) - 1; ! int zoom_h = get_config_int("tile_zoom", "zoom_height", 120) - 1; ! int x, y, w, h; ! // Main (back + menu) ! set_dialog_size(&main_dlg[0], -2, -2, SCREEN_W + 4, SCREEN_H + 4); ! set_dialog_size(&main_dlg[1], 0, 0, SCREEN_W, 15); ! // Status bars ! set_dialog_size(&main_dlg[6], 0, SCREEN_H - 17, SCREEN_W - 256, 17); ! set_dialog_size(&main_dlg[7], SCREEN_W - 256, SCREEN_H - 17, 256, 17); ! set_dialog_size(&main_dlg[8], 3, SCREEN_H - 14, SCREEN_W - 262, 11); ! set_dialog_size(&main_dlg[9], SCREEN_W - 253, SCREEN_H - 14, 250, 11); ! // Edit tile area ! w = zoom_w + 4; ! h = zoom_h + 4; ! x = margin; ! y = main_dlg[6].y - margin - h; ! set_dialog_size(&edit_tile_layer[0], x, y, w, h); ! set_dialog_size(&edit_tile_layer[1], x + 2, y + 2, w - 4, h - 4); ! set_dialog_size(&edit_tile_layer[2], x + margin + w, y + h - 14, 50, 14); ! // Color sliders ! x += w + margin; ! w = 128; ! set_dialog_size(&edit_tile_layer[8], x, y, 16, 8); ! set_dialog_size(&edit_tile_layer[9], x, y + 16, 16, 8); ! set_dialog_size(&edit_tile_layer[10], x, y + 32, 16, 8); ! set_dialog_size(&edit_tile_layer[11], x, y + 48 + 8, 16, 8); ! set_dialog_size(&edit_tile_layer[12], x, y + 64 + 8, 16, 8); ! set_dialog_size(&edit_tile_layer[3], x + 16, y, w, 8); ! set_dialog_size(&edit_tile_layer[4], x + 16, y + 16, w, 8); ! set_dialog_size(&edit_tile_layer[5], x + 16, y + 32, w, 8); ! set_dialog_size(&edit_tile_layer[6], x + 16, y + 48 + 8, w, 8); ! set_dialog_size(&edit_tile_layer[7], x + 16, y + 64 + 8, w, 8); ! set_dialog_size(&edit_tile_layer[13], x + 16 + w + 4, y - 1, 11, 10); ! set_dialog_size(&edit_tile_layer[14], x + 16 + w + 4, y + 16 - 1, 11, 10); ! set_dialog_size(&edit_tile_layer[15], x + 16 + w + 4, y + 32 - 1, 11, 10); ! set_dialog_size(&edit_tile_layer[20], x + 16 + w + 18, y + 4, 18, 32); ! // Select tile area ! x = edit_tile_layer[20].x + edit_tile_layer[20].w + margin; ! w = SCREEN_W - x - margin; ! set_dialog_size(&edit_tile_layer[16], x, y, 104, h); ! set_dialog_size(&edit_tile_layer[17], x + 104, y, w - 104, h); ! set_dialog_size(&edit_tile_layer[18], x + 104 + 2, y + 2, w - 104 - 4 - 11, h - 4); ! set_dialog_size(&edit_tile_layer[19], x + w - 14, y, 14, h); ! // Obstacle edit stuff ! w = 24; ! h = 24; ! x = margin; ! y = main_dlg[6].y - margin - h; ! for (i = 0; i < 5; i++) { ! set_dialog_size(&edit_obstacle_layer[i], x + i*(w+margin), y, w, h); ! set_dialog_size(&edit_obstacle_layer[i+5], x + i*(w+margin) + 2, y + 2, w - 4, h - 4); ! } ! // Edit map area ! x = margin; ! y = 16 + margin; ! w = SCREEN_W - 2 * margin; ! h = edit_obstacle_layer[0].y - margin - y; ! set_dialog_size(&main_dlg[2], x, y, w, h); ! set_dialog_size(&main_dlg[3], x + 2, y + 2, w - 15, h - 15); ! set_dialog_size(&main_dlg[4], x + w - 14, y, 14, h - 11); ! set_dialog_size(&main_dlg[5], x, y + h - 14, w - 11, 14); ! set_dialog_size(&main_dlg[10], x + w - 12, y + h - 12, 10, 10); ! // Edit objects area ! w = 123; ! h = 120; ! x = margin; ! y = main_dlg[6].y - margin - h; ! set_dialog_size(&edit_objects_layer[0], x, y, w, h); ! set_dialog_size(&edit_objects_layer[1], 136, main_dlg[6].y - margin - 14, 97, 14); ! // Initialize map and tile stuff ! tileRepository = new TileRepository(); ! // Import tilesets specified in rpgedit.cfg ! i = 1; ! while (i > 0) ! { ! uszprintf(buf, sizeof buf, "tileset%d", i); ! const char* filename = get_config_string(buf, "filename", NULL); ! int tile_w = get_config_int(buf, "tile_w", 16); ! int tile_h = get_config_int(buf, "tile_h", 16); ! int tile_spacing = get_config_int(buf, "tile_spacing", 0); ! if (filename) { ! if (tile_w > 0 && tile_h > 0 && tile_spacing >= 0) { ! import_tile_bitmap(filename, tile_w, tile_h, tile_spacing); ! } else { ! allegro_message("Error, incorrect parameters for automatic tile import (%s)!", filename); ! // Print warning in log file ! } ! i++; ! } else { ! i = -1; ! } ! } ! currentMap = new SquareMap(TILES_W, TILES_H); ! ustrcpy(map_filename, "untitled.map"); ! ! // Load map specified in rpgedit.cfg ! const char* filename = get_config_string("startup", "load_map", NULL); ! if (filename) { ! if (!currentMap->loadMap(filename)) { ! ustrcpy(map_filename, filename); ! object_message(&D_MAP, MSG_NEW_MAP, 0); ! set_map_changed(false); ! } else { ! console.log(CON_LOG, CON_ALWAYS, ! "Error while loading default map (%s)!\n", filename); ! } ! } ! ! update_window_title(); ! ! map_edit_mode = EM_TILE; ! menu_item_edit_objects(); ! //activate_mode(edit_objects_layer); } *************** *** 275,283 **** void clean_up() { ! delete currentMap; ! delete tileRepository; ! destroy_bitmap(buffer); ! agup_shutdown(); } --- 284,292 ---- void clean_up() { ! delete currentMap; ! delete tileRepository; ! destroy_bitmap(buffer); ! agup_shutdown(); } Index: editor.h =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/editor.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** editor.h 1 Jan 2004 16:04:36 -0000 1.8 --- editor.h 13 Apr 2004 12:26:08 -0000 1.9 *************** *** 17,28 **** #include "../shared/console.h" #include "../shared/object.h" ! #define PROGRAM_VERSION_STRING "RPG Edit III 0.9.0" // Global variables ! extern DATAFILE *data; extern int debug_mode; extern FONT* engine_font; --- 17,29 ---- #include "../shared/console.h" #include "../shared/object.h" + #include "../shared/module.h" ! #define PROGRAM_VERSION_STRING "RPG Edit III 0.9.2" // Global variables ! extern Module *module; extern int debug_mode; extern FONT* engine_font; *************** *** 73,123 **** // Slider types (R, G, B, and H, S, V) ! #define S_R 0 ! #define S_G 1 ! #define S_B 2 ! #define S_H 3 ! #define S_S 4 ! #define S_V 5 ! #define S_C 6 // Map edit modes ! #define EM_TILE 0 ! #define EM_OBSTACLE 1 ! #define EM_OBJECTS 2 // Dialogs ! #define MAIN_START_OF_NULL 12 ! #define NEWMAP_OK 9 ! #define IMPORT_TILESET_OK 7 ! #define EXPORT_TILESET_OK 5 ! #define RESIZEMAP_OK 13 ! #define D_MAP main_dlg[3] ! #define D_SCROLL_VER main_dlg[4] ! #define D_SCROLL_HOR main_dlg[5] ! #define D_AUTOTEXT_STATUS main_dlg[8] ! #define D_AUTOTEXT_MAPINFO main_dlg[9] ! #define D_TILE main_dlg[ 1 + MAIN_START_OF_NULL] ! #define D_CHECK_GRID main_dlg[ 2 + MAIN_START_OF_NULL] ! #define D_CHECK_SNAP main_dlg[ 2 + MAIN_START_OF_NULL] ! #define D_TILESET_LIST main_dlg[16 + MAIN_START_OF_NULL] ! #define D_TILESET main_dlg[18 + MAIN_START_OF_NULL] ! #define D_TILESET_SCROLL main_dlg[19 + MAIN_START_OF_NULL] // Messages ! #define MSG_NEW_MAP MSG_USER ! #define MSG_NEW_TILESET MSG_USER // Flags ! #define SCROLL_VER D_USER --- 74,124 ---- // Slider types (R, G, B, and H, S, V) ! #define S_R 0 ! #define S_G 1 ! #define S_B 2 ! #define S_H 3 ! #define S_S 4 ! #define S_V 5 ! #define S_C 6 // Map edit modes ! #define EM_TILE 0 ! #define EM_OBSTACLE 1 ! #define EM_OBJECTS 2 // Dialogs ! #define MAIN_START_OF_NULL 12 ! #define NEWMAP_OK 9 ! #define IMPORT_TILESET_OK 7 ! #define EXPORT_TILESET_OK 5 ! #define RESIZEMAP_OK 13 ! #define D_MAP main_dlg[3] ! #define D_SCROLL_VER main_dlg[4] ! #define D_SCROLL_HOR main_dlg[5] ! #define D_AUTOTEXT_STATUS main_dlg[8] ! #define D_AUTOTEXT_MAPINFO main_dlg[9] ! #define D_TILE main_dlg[ 1 + MAIN_START_OF_NULL] ! #define D_CHECK_GRID main_dlg[ 2 + MAIN_START_OF_NULL] ! #define D_CHECK_SNAP main_dlg[ 2 + MAIN_START_OF_NULL] ! #define D_TILESET_LIST main_dlg[16 + MAIN_START_OF_NULL] ! #define D_TILESET main_dlg[18 + MAIN_START_OF_NULL] ! #define D_TILESET_SCROLL main_dlg[19 + MAIN_START_OF_NULL] // Messages ! #define MSG_NEW_MAP MSG_USER ! #define MSG_NEW_TILESET MSG_USER // Flags ! #define SCROLL_VER D_USER *************** *** 126,130 **** int menu_item_new_map(); int menu_item_load_map(); - int menu_item_load_old_map(); int menu_item_save_map(); int menu_item_save_map_as(); --- 127,130 ---- *************** *** 140,143 **** --- 140,144 ---- int menu_item_toggle_debug(); int menu_item_save_map_image(); + int menu_item_save_map_as_xml(); *************** *** 149,154 **** void delete_objects(list<Object*> objs); ! void import_tile_bitmap(const char* filename, int tile_w, int tile_h, int spacing); ! //char* get_tileset_name(const char* name); void set_map_changed(bool value); --- 150,156 ---- void delete_objects(list<Object*> objs); ! void import_tile_bitmap( ! const char* filename, ! int tile_w, int tile_h, int spacing); void set_map_changed(bool value); Index: script.h =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/script.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** script.h 9 Dec 2003 00:45:59 -0000 1.2 --- script.h 13 Apr 2004 12:26:08 -0000 1.3 *************** *** 29,33 **** ! //=================== The engine to script interface ============================/ void initScripting(); --- 29,33 ---- ! //============ The engine to script interface ============================/ void initScripting(); *************** *** 43,47 **** ! //=================== The script to engine interface ============================/ int l_alert(lua_State *L); --- 43,47 ---- ! //============ The script to engine interface ============================/ int l_alert(lua_State *L); *************** *** 61,65 **** ! //=================== Tag methods ====================================================/ int object_gettable(lua_State *L); --- 61,65 ---- ! //============ Tag methods ===============================================/ int object_gettable(lua_State *L); Index: aphoton.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/aphoton.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** aphoton.cpp 8 Dec 2003 19:55:13 -0000 1.2 --- aphoton.cpp 13 Apr 2004 12:26:08 -0000 1.3 *************** *** 148,159 **** int flags, int centre) { ! int rtm, height, len; ! ! rtm = text_mode(-1); if (flags & D_DISABLED) ! gui_textout(bmp, text, x+1, y+1, white, centre); ! gui_textout(bmp, text, x, y, (flags & D_DISABLED? shadow : black), centre); if (flags & D_GOTFOCUS) { --- 148,158 ---- int flags, int centre) { ! int height, len; if (flags & D_DISABLED) ! gui_textout_ex(bmp, text, x+1, y+1, white, -1, centre); ! gui_textout_ex( ! bmp, text, x, y, (flags & D_DISABLED? shadow : black), -1, centre); if (flags & D_GOTFOCUS) { *************** *** 166,171 **** hline(bmp, x, y+height, x+len-1, highlight); } - - text_mode(rtm); } --- 165,168 ---- *************** *** 428,432 **** { if (msg == MSG_DRAW) { ! int l, x, b, f, p, w, rtm; int fg = (d->flags & D_DISABLED) ? shadow : black; char *s = (char *)d->dp; --- 425,429 ---- { if (msg == MSG_DRAW) { ! int l, x, b, f, p, w; int fg = (d->flags & D_DISABLED) ? shadow : black; char *s = (char *)d->dp; *************** *** 476,482 **** w = text_length(font, buf); f = ((p == d->d2) && (d->flags & D_GOTFOCUS)); ! rtm = text_mode(edit_white); ! textout(screen, font, buf, d->x+x, d->y+4, fg); ! text_mode(rtm); if (f) vline(screen, d->x+x-1, d->y+3, d->y+fonth+5, black); --- 473,477 ---- w = text_length(font, buf); f = ((p == d->d2) && (d->flags & D_GOTFOCUS)); ! textout_ex(screen, font, buf, d->x+x, d->y+4, fg, edit_white); if (f) vline(screen, d->x+x-1, d->y+3, d->y+fonth+5, black); *************** *** 529,533 **** char *sel = (char *)d->dp2; char s[1024]; - int rtm; (*(getfuncptr)d->dp)(-1, &listsize); --- 524,527 ---- *************** *** 558,562 **** y = d->y + 2 + i*char_height; - rtm = text_mode(bg); rectfill(screen, x, y, x+7, y+char_height-1, bg); x += 8; --- 552,555 ---- *************** *** 568,573 **** } ! textout(screen, font, s, x, y, fg); ! text_mode(rtm); x += text_length(font, s); --- 561,565 ---- } ! textout_ex(screen, font, s, x, y, fg, bg); x += text_length(font, s); *************** *** 775,779 **** int i, j, height; char buf[256], *tok; - int rtm; if (!menu_done) { --- 767,770 ---- *************** *** 808,813 **** } - rtm = text_mode(-1); - i = 0; j = ugetc(m->text); --- 799,802 ---- *************** *** 830,835 **** } - text_mode(rtm); - if ((m->child) && (!bar)) draw_sprite(screen, menu_arrow_bmp, x+w-12, y+(h-menu_arrow_bmp->h-1)/2); --- 819,822 ---- *************** *** 863,867 **** int d_aphoton_window_proc(int msg, DIALOG *d, int c) { ! int rtm, cl, ct, cr, cb; (void)c; --- 850,854 ---- int d_aphoton_window_proc(int msg, DIALOG *d, int c) { ! int cl, ct, cr, cb; (void)c; *************** *** 899,903 **** if (d->dp) { - rtm = text_mode(-1); cl = screen->cl; ct = screen->ct; --- 886,889 ---- *************** *** 905,914 **** cb = screen->cb; ! set_clip(screen, d->x, d->y, d->x+d->w-1, d->y+d->h-1); ! textout_centre(screen, font, (char *)d->dp, d->x+d->w/2, d->y+8, black); ! set_clip(screen, cl, ct, cr, cb); ! text_mode(rtm); } } --- 891,901 ---- cb = screen->cb; ! set_clip_rect(screen, d->x, d->y, d->x+d->w-1, d->y+d->h-1); ! textout_centre_ex( ! screen, font, (char *)d->dp, ! d->x+d->w/2, d->y+8, black, -1); ! set_clip_rect(screen, cl, ct, cr, cb); } } Index: script.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/script.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** script.cpp 27 Dec 2003 14:43:15 -0000 1.5 --- script.cpp 13 Apr 2004 12:26:08 -0000 1.6 *************** *** 17,29 **** #include "../shared/console.h" #include "script.h" - #include <set> #include <vector> - using std::set; using std::vector; lua_State* L = NULL; [...1247 lines suppressed...] ! else if (strcmp(index, "offset_z" ) == 0) {obj->offset_z = (int)lua_tonumber(L, -1);} ! else if (strcmp(index, "draw_mode") == 0) {obj->drawMode = (int)lua_tonumber(L, -1);} ! else if (strcmp(index, "alpha" ) == 0) {obj->alpha = (int)lua_tonumber(L, -1);} ! else if (strcmp(index, "dir" ) == 0) {obj->dir = (int)lua_tonumber(L, -1);} ! else if (strcmp(index, "tick_time") == 0) {obj->tick = (int)lua_tonumber(L, -1);} ! else if (strcmp(index, "obstacle" ) == 0) {obj->obstacle = (int)lua_tonumber(L, -1);} ! else if (strcmp(index, "bitmap" ) == 0) {obj->bitmap = (BITMAP*)lua_touserdata(L, -1);} ! else if (strcmp(index, "map" ) == 0) { ! TiledMap* newMap = (TiledMap*)lua_touserdata(L, -1); ! if (newMap != obj->getMap()) obj->setMap(newMap); ! } ! else { ! // Deal with the assigned value normally ! lua_rawset(L, -3); ! } ! } ! lua_settop(L, 0); ! return 0; } Index: gui_procs.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/gui_procs.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gui_procs.cpp 28 Dec 2003 15:53:37 -0000 1.9 --- gui_procs.cpp 13 Apr 2004 12:26:08 -0000 1.10 *************** *** 310,314 **** if (debug_mode) { ! textprintf(buffer, font, d->x+10, d->y+30, makecol(255,255,255), "%d selected entities", selectedObjects.size()); } --- 310,316 ---- if (debug_mode) { ! textprintf_ex( ! buffer, font, d->x+10, d->y+30, makecol(255,255,255), -1, ! "%d selected entities", selectedObjects.size()); } *************** *** 1211,1217 **** rectfill(buffer, d->x, d->y, d->x + d->w - 1, d->y + d->h - 1, d->bg); if (d->dp) { ! int ptm = text_mode(-1); ! textout(buffer, font, (char*)d->dp, d->x, d->y, d->fg); ! text_mode(ptm); } update_screen(d->x, d->y, d->w, d->h); --- 1213,1217 ---- rectfill(buffer, d->x, d->y, d->x + d->w - 1, d->y + d->h - 1, d->bg); if (d->dp) { ! textout_ex(buffer, font, (char*)d->dp, d->x, d->y, d->fg, -1); } update_screen(d->x, d->y, d->w, d->h); Index: editor.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/editor/editor.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** editor.cpp 1 Jan 2004 16:04:36 -0000 1.8 --- editor.cpp 13 Apr 2004 12:26:08 -0000 1.9 *************** *** 12,15 **** --- 12,18 ---- #include <allegro.h> #include <vector> + #include <libxml/xmlwriter.h> + #include <libxml/parser.h> + #include <libxml/tree.h> #include "agup.h" #include "aphoton.h" *************** *** 19,22 **** [...1715 lines suppressed...] ! deselect_objects(); ! 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) { ! while (objs.size() > 0) { ! Object* obj = objs.front(); ! if (obj->selected) selectedObjects.remove(obj); ! //callMemberFunction(obj->tableRef, "destroy", ""); ! objs.remove(obj); ! currentMap->removeReference(obj); ! delete obj; ! } } |