mapedit.c File Reference

#include "mapedit.h"

Go to the source code of this file.

Functions

int init_main_window (MainWin *mclass)
int init_tile_window ()
int init_size_window ()
int init_prop_window ()
int init_help_window ()
int init_minimap_window ()
void mapdrawing_click (Control *c, int buttons, Point p)
void mapdrawing_mouseup (Control *c, int buttons, Point p)
void mapdrawing_drag (Control *c, int buttons, Point p)
void mapdrawing_coor (Control *c, int buttons, Point p)
void mapdrawing_move (Window *w, unsigned long key)
void mapdrawing_undo (Window *c, unsigned long key)
void choose_map_level (Control *b)
void minimap_coor (Control *c, int i, Point p)
void minimap_click (Control *c, int i, Point p)
void redraw_map (Control *c, Graphics *g)
void redraw_minimap (Control *c, Graphics *g)
void choose_start_pt (Control *b)
void show_sizewin (MenuItem *m)
void show_propwin ()
void show_mmapwin (MenuItem *m)
void open_mapfile (MenuItem *m)
void save_mapfile (MenuItem *m)
void exit_prog (MenuItem *m)
void exit_mainwin (Window *w)
void show_tilewin (MenuItem *m)
void show_helpwin (MenuItem *m)
void load_tiles (MenuItem *m)
 Ask user to select a tile property file.
void which_tile_props (int index, tprops *t)
 Given an index value, the walkable, hitpoints & damage properties for a tile will be looked up and saved in the tprops pointer.
void show_grid (MenuItem *m)
 Basically toggles the grid menu_item and calls the function to redraw the map.
void timer_callback (Timer *t)
 If the clicktime timer is valid, delete it.
void view_tiles (Control *c)
 Display a set of 64 tiles in twin.
void choose_tile (Control *c)
void set_currentimg_props (int index)
void get_prop_strings (int index, int win, prop_strings *s)
void ok_sizewin (Control *c)
void ok_propwin (Control *c)
void get_tile_prop_minmax (int index, minmax *mm)
void cancel_sizewin (Control *c)
void cancel_propwin (Control *c)
void cancel_helpwin (Control *c)
void exit_mmapwin (Window *w)
void exit_tilewin (Window *w)
void exit_sizewin (Window *w)
void exit_propwin (Window *w)
void exit_helpwin (Window *w)
int app_main (int argc, char *argv[])
void copy_rect_image (Image *dest, Point dp, Image *src, Rect sr)

Variables

App * app
Window * win
MainWinmwin
TileWintile_win
NewMapWinnewmap_win
PropWinprop_win
HelpWinhelp_win
MMapWinminimap_win
Timer * clicktime
tiletile_array
mapmap_array
mapprev_map_array
FILE * tilefile
FILE * openmapfile
FILE * savemapfile
FILE * ofile
static char tilenames [256][40]
Control * debug
Control * debug2
char dstring [200]


Function Documentation

int app_main ( int  argc,
char *  argv[] 
)

void cancel_helpwin ( Control *  c  ) 

Definition at line 1837 of file mapedit.c.

References exit_helpwin(), and HelpWinClass::win.

Referenced by init_help_window().

void cancel_propwin ( Control *  c  ) 

Definition at line 1834 of file mapedit.c.

References exit_propwin(), and TilePropClass::win.

Referenced by init_prop_window().

void cancel_sizewin ( Control *  c  ) 

Definition at line 1831 of file mapedit.c.

References exit_sizewin(), and NewMapWinClass::win.

Referenced by init_size_window().

void choose_map_level ( Control *  b  ) 

void choose_start_pt ( Control *  b  ) 

void choose_tile ( Control *  c  ) 

void copy_rect_image ( Image *  dest,
Point  dp,
Image *  src,
Rect  sr 
)

Definition at line 1937 of file mapedit.c.

Referenced by mapdrawing_click(), mapdrawing_mouseup(), mapdrawing_undo(), and open_mapfile().

void exit_helpwin ( Window *  w  ) 

Definition at line 1870 of file mapedit.c.

References MapEditorMainClass::mapdrawing, redraw_map(), and HelpWinClass::win.

Referenced by cancel_helpwin(), and init_help_window().

void exit_mainwin ( Window *  w  ) 

void exit_mmapwin ( Window *  w  ) 

void exit_prog ( MenuItem *  m  ) 

Definition at line 1246 of file mapedit.c.

References exit_mainwin(), and MapEditorMainClass::win.

Referenced by init_main_window(), and mapdrawing_undo().

void exit_propwin ( Window *  w  ) 

Definition at line 1864 of file mapedit.c.

References MapEditorMainClass::mapdrawing, redraw_map(), and TilePropClass::win.

Referenced by cancel_propwin(), and init_prop_window().

void exit_sizewin ( Window *  w  ) 

void exit_tilewin ( Window *  w  ) 

void get_prop_strings ( int  index,
int  win,
prop_strings s 
)

void get_tile_prop_minmax ( int  index,
minmax mm 
)

int init_help_window (  ) 

int init_main_window ( MainWin mclass  ) 

Definition at line 45 of file mapedit.c.

References app, MapEditorMainClass::bit, MapEditorMainClass::char_start_pt, choose_map_level(), choose_start_pt(), MapEditorMainClass::choose_startpt_flag, MapEditorMainClass::ctile, MapEditorMainClass::ctile_edit, MapEditorMainClass::ctile_prop_edit, MapEditorMainClass::ctile_topleft, MapEditorMainClass::currentimgpic, MapEditorMainClass::currentmaplevel, map::damage, tile::damage, MapEditorMainClass::damagefield, debug, debug2, MapEditorMainClass::double_click_flag, MapEditorMainClass::drag_flag, MapEditorMainClass::drag_start_pt, exit_mainwin(), exit_prog(), MapEditorMainClass::file_menu, MapEditorMainClass::filename, MapEditorMainClass::grid, MapEditorMainClass::gridgraphics, MapEditorMainClass::help_item, MapEditorMainClass::help_menu, map::hitpoints, tile::hitpoints, MapEditorMainClass::hitpointsfield, MapEditorMainClass::htilenum, map::index, tile::index, MapEditorMainClass::lcoor, MapEditorMainClass::lcurrentimg, MapEditorMainClass::lcurrentimgindex, MapEditorMainClass::lcurrentprop, MapEditorMainClass::ldamage, MapEditorMainClass::lev1, MapEditorMainClass::lev1graphics, MapEditorMainClass::lhitpoints, MapEditorMainClass::line1_item, MapEditorMainClass::lmapsize, MapEditorMainClass::lmove, load_tiles(), MapEditorMainClass::loadtiles_item, MapEditorMainClass::lproperties, MapEditorMainClass::ltcoor, MapEditorMainClass::main_menubar, MAINWINHEIGHT, MAINWINWIDTH, MapEditorMainClass::mapdrawheight, MapEditorMainClass::mapdrawing, mapdrawing_click(), mapdrawing_coor(), mapdrawing_drag(), mapdrawing_mouseup(), mapdrawing_move(), mapdrawing_undo(), MapEditorMainClass::mapdrawtheight, MapEditorMainClass::mapdrawtwidth, MapEditorMainClass::mapdrawwidth, MapEditorMainClass::mapgraphics, MapEditorMainClass::mapheight, MapEditorMainClass::mapwidth, MAXMAPHEIGHT, MAXMAPWIDTH, MapEditorMainClass::mmap_item, tile::name, MapEditorMainClass::new_item, MapEditorMainClass::open_item, open_mapfile(), MapEditorMainClass::options_menu, MapEditorMainClass::quit_item, redraw_map(), MapEditorMainClass::save_flag, MapEditorMainClass::save_item, save_mapfile(), show_grid(), show_helpwin(), show_mmapwin(), show_sizewin(), show_tilewin(), MapEditorMainClass::showgrid_item, MapEditorMainClass::showlev0btn, MapEditorMainClass::showlev1btn, MapEditorMainClass::showmergedbtn, MapEditorMainClass::startpointbtn, MapEditorMainClass::startptxfield, MapEditorMainClass::startptyfield, TILESIZE, MapEditorMainClass::tilewin_item, MapEditorMainClass::vtilenum, map::walkable, tile::walkable, MapEditorMainClass::walkablebox, and MapEditorMainClass::win.

Referenced by app_main().

int init_minimap_window (  ) 

int init_prop_window (  ) 

int init_size_window (  ) 

int init_tile_window (  ) 

void load_tiles ( MenuItem *  m  ) 

Ask user to select a tile property file.

Open the file and parse each line. For a valid tile line, store tile filename and properties in tilearray at index corresponding to tile index. Loop through tilearray, read each tile image file into tilearray[index].img. Scale as necessary. Convert image to bitmap and store in tilearray[index].bit Display up to first 64 tiles in tilewin as image buttons.

Definition at line 1282 of file mapedit.c.

References tile::bit, tile::damage, TileWinClass::first_btn, TileWinClass::fourth_btn, tile::hitpoints, tprops::hitpoints, tile::img, tile::name, TileWinClass::second_btn, TileWinClass::third_btn, TileWinClass::tile_btn, tilefile, tilenames, TILESIZE, MapEditorMainClass::tilewin_item, tile::walkable, tprops::walkable, which_tile_props(), and TileWinClass::win.

Referenced by init_main_window(), mapdrawing_undo(), and open_mapfile().

void mapdrawing_click ( Control *  c,
int  buttons,
Point  p 
)

void mapdrawing_coor ( Control *  c,
int  buttons,
Point  p 
)

void mapdrawing_drag ( Control *  c,
int  buttons,
Point  p 
)

Definition at line 595 of file mapedit.c.

References debug, MapEditorMainClass::drag_flag, MapEditorMainClass::drag_start_pt, and TILESIZE.

Referenced by init_main_window().

void mapdrawing_mouseup ( Control *  c,
int  buttons,
Point  p 
)

void mapdrawing_move ( Window *  w,
unsigned long  key 
)

void mapdrawing_undo ( Window *  c,
unsigned long  key 
)

void minimap_click ( Control *  c,
int  i,
Point  p 
)

void minimap_coor ( Control *  c,
int  i,
Point  p 
)

void ok_propwin ( Control *  c  ) 

void ok_sizewin ( Control *  c  ) 

void open_mapfile ( MenuItem *  m  ) 

void redraw_map ( Control *  c,
Graphics *  g 
)

void redraw_minimap ( Control *  c,
Graphics *  g 
)

void save_mapfile ( MenuItem *  m  ) 

void set_currentimg_props ( int  index  ) 

void show_grid ( MenuItem *  m  ) 

Basically toggles the grid menu_item and calls the function to redraw the map.

Definition at line 1426 of file mapedit.c.

References MapEditorMainClass::mapdrawing, and redraw_map().

Referenced by init_main_window(), and mapdrawing_undo().

void show_helpwin ( MenuItem *  m  ) 

Definition at line 1270 of file mapedit.c.

References HelpWinClass::win.

Referenced by init_main_window(), and mapdrawing_undo().

void show_mmapwin ( MenuItem *  m  ) 

Definition at line 1000 of file mapedit.c.

References MiniMapWinClass::win.

Referenced by init_main_window(), and mapdrawing_undo().

void show_propwin (  ) 

void show_sizewin ( MenuItem *  m  ) 

void show_tilewin ( MenuItem *  m  ) 

Definition at line 1259 of file mapedit.c.

References TileWinClass::win.

Referenced by init_main_window().

void timer_callback ( Timer *  t  ) 

If the clicktime timer is valid, delete it.

Disable the double click flag. This timer is used as a hack to find out when the mouse was double-clicked. We set the double-click flag on first mouse click and set the timer for 250ms. If the mouse clicks again before the timer expires (and calls this function), we consider it a double click.

Definition at line 1443 of file mapedit.c.

References clicktime, and MapEditorMainClass::double_click_flag.

Referenced by mapdrawing_click().

void view_tiles ( Control *  c  ) 

Display a set of 64 tiles in twin.

Called when one of the four 'display' buttons in the tilewin is pressed. We can have up to 256 different tiles, but only display them 64 at a time in tilewin. These display buttons indicate which 64 will be displayed. It will load the 64 image buttons with the correct images and index data from tilearray[index]

Definition at line 1460 of file mapedit.c.

References TileWinClass::first_btn, TileWinClass::fourth_btn, tile::img, TileWinClass::offset, TileWinClass::second_btn, TileWinClass::third_btn, TileWinClass::tile_btn, TileWinClass::tile_columns, TileWinClass::tile_label, and TileWinClass::tile_rows.

Referenced by init_tile_window().

void which_tile_props ( int  index,
tprops t 
)


Variable Documentation

App* app

Timer* clicktime

Definition at line 35 of file mapedit.c.

Referenced by mapdrawing_click(), and timer_callback().

Control* debug

Control * debug2

char dstring[200]

Definition at line 33 of file mapedit.c.

Definition at line 37 of file mapedit.c.

Definition at line 34 of file mapedit.c.

Definition at line 29 of file mapedit.c.

Definition at line 31 of file mapedit.c.

FILE* ofile

Definition at line 39 of file mapedit.c.

Referenced by app_main().

FILE * openmapfile

Definition at line 38 of file mapedit.c.

Referenced by open_mapfile().

Definition at line 37 of file mapedit.c.

Definition at line 32 of file mapedit.c.

FILE * savemapfile

Definition at line 38 of file mapedit.c.

Referenced by save_mapfile().

Definition at line 36 of file mapedit.c.

Definition at line 30 of file mapedit.c.

FILE* tilefile

Definition at line 38 of file mapedit.c.

Referenced by load_tiles().

char tilenames[256][40] [static]

Definition at line 40 of file mapedit.c.

Referenced by load_tiles().

Window* win

Definition at line 28 of file mapedit.c.


Generated on Thu Mar 6 08:58:28 2008 for mapedit by  doxygen 1.5.5