mapedit.h File Reference

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <graphapp.h>

Go to the source code of this file.

Data Structures

struct  tile
struct  map
struct  prop_strings
struct  minmax
struct  tprops
struct  MapEditorMainClass
struct  TileWinClass
struct  NewMapWinClass
struct  TilePropClass
struct  HelpWinClass
struct  MiniMapWinClass

Defines

#define TILESIZE   32
#define TILEDEPTH   8
#define TWINWIDTH   250
#define MAXMAPHEIGHT   150
#define MAXMAPWIDTH   180
#define MAINWINWIDTH   750
#define MAINWINHEIGHT   550
#define MAXHITPOINTS   50
#define MAXDAMAGE   50
#define BACKGROUND_BEGIN   0
#define BACKGROUND_END   176
#define ENEMY_BEGIN   177
#define ENEMY_END   192
#define KEY_BEGIN   193
#define KEY_END   193
#define TELEPORTER_BEGIN   194
#define TELEPORTER_END   194
#define EXIT_BEGIN   195
#define EXIT_END   195
#define SCROLL_BEGIN   196
#define SCROLL_END   196
#define DOOR_BEGIN   197
#define DOOR_END   200
#define POWERUP_BEGIN   201
#define POWERUP_END   207
#define GOLD_BEGIN   208
#define GOLD_END   215
#define GENERATOR_BEGIN   216
#define GENERATOR_END   216
#define TRAPS_BEGIN   217
#define TRAPS_END   220
#define EMPTY_BEGIN   221
#define EMPTY_END   255
#define BG_MIN_DAMAGE   0
#define BG_MAX_DAMAGE   10000
#define ENMY_MIN_HTPTS   -1
#define ENMY_MAX_HTPTS   1000
#define ENMY_MIN_DAMAGE   0
#define ENMY_MAX_DAMAGE   100
#define EXIT_MAX   20
#define POWERUP_MIN   -255
#define POWERUP_MAX   255
#define GOLD_MIN   5
#define GOLD_MAX   500
#define GEN_MIDX_MIN   177
#define GEN_MIDX_MAX   192
#define GEN_MIN_HTPTS   -1
#define GEN_MAX_HTPTS   500
#define TRAP_MIN_DAMAGE   0
#define TRAP_MAX_DAMAGE   100

Typedefs

typedef struct MapEditorMainClass MainWin
typedef struct TileWinClass TileWin
typedef struct NewMapWinClass NewMapWin
typedef struct TilePropClass PropWin
typedef struct HelpWinClass HelpWin
typedef struct MiniMapWinClass MMapWin

Functions

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


Define Documentation

#define BACKGROUND_BEGIN   0

Definition at line 29 of file mapedit.h.

Referenced by which_tile_props().

#define BACKGROUND_END   176

Definition at line 30 of file mapedit.h.

Referenced by which_tile_props().

#define BG_MAX_DAMAGE   10000

Definition at line 55 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define BG_MIN_DAMAGE   0

Definition at line 54 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define DOOR_BEGIN   197

Definition at line 41 of file mapedit.h.

Referenced by which_tile_props().

#define DOOR_END   200

Definition at line 42 of file mapedit.h.

Referenced by which_tile_props().

#define EMPTY_BEGIN   221

Definition at line 51 of file mapedit.h.

Referenced by which_tile_props().

#define EMPTY_END   255

Definition at line 52 of file mapedit.h.

Referenced by which_tile_props().

#define ENEMY_BEGIN   177

Definition at line 31 of file mapedit.h.

Referenced by which_tile_props().

#define ENEMY_END   192

Definition at line 32 of file mapedit.h.

Referenced by which_tile_props().

#define ENMY_MAX_DAMAGE   100

Definition at line 59 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define ENMY_MAX_HTPTS   1000

Definition at line 57 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define ENMY_MIN_DAMAGE   0

Definition at line 58 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define ENMY_MIN_HTPTS   -1

Definition at line 56 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define EXIT_BEGIN   195

Definition at line 37 of file mapedit.h.

Referenced by which_tile_props().

#define EXIT_END   195

Definition at line 38 of file mapedit.h.

Referenced by which_tile_props().

#define EXIT_MAX   20

Definition at line 60 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define GEN_MAX_HTPTS   500

Definition at line 68 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define GEN_MIDX_MAX   192

Definition at line 66 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define GEN_MIDX_MIN   177

Definition at line 65 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define GEN_MIN_HTPTS   -1

Definition at line 67 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define GENERATOR_BEGIN   216

Definition at line 47 of file mapedit.h.

Referenced by which_tile_props().

#define GENERATOR_END   216

Definition at line 48 of file mapedit.h.

Referenced by which_tile_props().

#define GOLD_BEGIN   208

Definition at line 45 of file mapedit.h.

Referenced by which_tile_props().

#define GOLD_END   215

Definition at line 46 of file mapedit.h.

Referenced by which_tile_props().

#define GOLD_MAX   500

Definition at line 64 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define GOLD_MIN   5

Definition at line 63 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define KEY_BEGIN   193

Definition at line 33 of file mapedit.h.

Referenced by which_tile_props().

#define KEY_END   193

Definition at line 34 of file mapedit.h.

Referenced by which_tile_props().

#define MAINWINHEIGHT   550

Definition at line 25 of file mapedit.h.

Referenced by init_main_window().

#define MAINWINWIDTH   750

Definition at line 24 of file mapedit.h.

Referenced by init_main_window().

#define MAXDAMAGE   50

Definition at line 27 of file mapedit.h.

#define MAXHITPOINTS   50

Definition at line 26 of file mapedit.h.

#define MAXMAPHEIGHT   150

Definition at line 22 of file mapedit.h.

Referenced by init_main_window(), ok_sizewin(), open_mapfile(), and show_sizewin().

#define MAXMAPWIDTH   180

Definition at line 23 of file mapedit.h.

Referenced by init_main_window(), ok_sizewin(), open_mapfile(), and show_sizewin().

#define POWERUP_BEGIN   201

Definition at line 43 of file mapedit.h.

Referenced by which_tile_props().

#define POWERUP_END   207

Definition at line 44 of file mapedit.h.

Referenced by which_tile_props().

#define POWERUP_MAX   255

Definition at line 62 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define POWERUP_MIN   -255

Definition at line 61 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define SCROLL_BEGIN   196

Definition at line 39 of file mapedit.h.

Referenced by which_tile_props().

#define SCROLL_END   196

Definition at line 40 of file mapedit.h.

Referenced by which_tile_props().

#define TELEPORTER_BEGIN   194

Definition at line 35 of file mapedit.h.

Referenced by which_tile_props().

#define TELEPORTER_END   194

Definition at line 36 of file mapedit.h.

Referenced by which_tile_props().

#define TILEDEPTH   8

Definition at line 20 of file mapedit.h.

Referenced by init_tile_window().

#define TILESIZE   32

#define TRAP_MAX_DAMAGE   100

Definition at line 70 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define TRAP_MIN_DAMAGE   0

Definition at line 69 of file mapedit.h.

Referenced by get_tile_prop_minmax().

#define TRAPS_BEGIN   217

Definition at line 49 of file mapedit.h.

Referenced by which_tile_props().

#define TRAPS_END   220

Definition at line 50 of file mapedit.h.

Referenced by which_tile_props().

#define TWINWIDTH   250

Definition at line 21 of file mapedit.h.

Referenced by init_tile_window().


Typedef Documentation

typedef struct HelpWinClass HelpWin

Definition at line 248 of file mapedit.h.

typedef struct MapEditorMainClass MainWin

Definition at line 244 of file mapedit.h.

typedef struct MiniMapWinClass MMapWin

Definition at line 249 of file mapedit.h.

typedef struct NewMapWinClass NewMapWin

Definition at line 246 of file mapedit.h.

typedef struct TilePropClass PropWin

Definition at line 247 of file mapedit.h.

typedef struct TileWinClass TileWin

Definition at line 245 of file mapedit.h.


Function Documentation

void cancel_helpwin ( Control *   ) 

Definition at line 1837 of file mapedit.c.

References exit_helpwin(), and HelpWinClass::win.

Referenced by init_help_window().

void cancel_propwin ( Control *   ) 

Definition at line 1834 of file mapedit.c.

References exit_propwin(), and TilePropClass::win.

Referenced by init_prop_window().

void cancel_sizewin ( Control *   ) 

Definition at line 1831 of file mapedit.c.

References exit_sizewin(), and NewMapWinClass::win.

Referenced by init_size_window().

void choose_map_level ( Control *   ) 

void choose_start_pt ( Control *   ) 

void choose_tile ( Control *   ) 

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 *   ) 

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 *   ) 

void exit_mmapwin ( Window *   ) 

void exit_prog ( MenuItem *   ) 

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 *   ) 

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 *   ) 

void exit_tilewin ( Window *   ) 

void get_prop_strings ( int  ,
int  ,
prop_strings  
)

void get_tile_prop_minmax ( int  ,
minmax  
)

int init_help_window (  ) 

int init_main_window ( MainWin  ) 

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 *  ,
int  ,
Point   
)

void mapdrawing_coor ( Control *  ,
int  ,
Point   
)

void mapdrawing_drag ( Control *  ,
int  ,
Point   
)

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 *  ,
int  ,
Point   
)

void mapdrawing_move ( Window *  ,
unsigned  long 
)

void mapdrawing_undo ( Window *  ,
unsigned  long 
)

void minimap_click ( Control *  ,
int  ,
Point   
)

void minimap_coor ( Control *  ,
int  ,
Point   
)

void ok_propwin ( Control *   ) 

void ok_sizewin ( Control *   ) 

void open_mapfile ( MenuItem *   ) 

void redraw_map ( Control *  ,
Graphics *   
)

void redraw_minimap ( Control *  ,
Graphics *   
)

void save_mapfile ( MenuItem *   ) 

void set_currentimg_props ( int   ) 

void show_grid ( MenuItem *   ) 

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 *   ) 

Definition at line 1270 of file mapedit.c.

References HelpWinClass::win.

Referenced by init_main_window(), and mapdrawing_undo().

void show_mmapwin ( MenuItem *   ) 

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 *   ) 

void show_tilewin ( MenuItem *   ) 

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  ,
tprops  
)


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