#include "constants.h" typedef struct { int x; int y; } xy_t; struct { int x; int y; int width; int height; int pos; int gridsize; int gridrowlen; SDL_Color gridcol; SDL_Color gridbgcol; SDL_Color bgcol; } obox; struct { int x; int y; int width; int height; int gridsize; int gridrowlen; SDL_Color gridcol; SDL_Color bgcol; } toolbox; struct { int x; int y; int width; int height; } mapbox; typedef struct { char text[BUFLEN]; int x; int y; int w; int h; SDL_Color c; int anchor; } text_t; typedef struct { int srcobj; int srcxoff; int srcyoff; int dstobj; int dstxoff; int dstyoff; int npoints; xy_t point[MAXPOINTS]; SDL_Color col; int style; } link_t; typedef struct { int type; /* line, square */ int x1,y1; int x2,y2; SDL_Color c; } vector_t; typedef struct { int w; int h; vector_t vector[MAXVECTORSPERIMAGE]; int vnum; } vectorimg_t; typedef struct { char name[BUFLEN]; int canscale; int defw; int defh; vectorimg_t vimg; } object_t; struct { vectorimg_t vect; char name; } letter[MAXLETTERVECTS]; typedef struct { int id; int type; } thing_t; object_t objtype[MAXOBJTYPES]; typedef struct { int type; /* index into objtype[] */ int x; int y; int w; int h; int child; } mapobject_t; typedef struct { char name[BUFLEN]; SDL_Surface *img; } button_t; button_t button[MAXBUTTONS]; typedef struct { int width; int height; int bpp; SDL_Color bgcol; SDL_Color boxcol; int numthings; int numobjects; int numlinks; int numtext; int selecteditem; int selecteditemtype; int selectedlinkpoint; int selectedtype; int curobj; /* object being moved/dragged/etc */ int curlink; /* link being moved/dragged/etc */ int curlinkpoint; /* link point being moved/dragged/etc */ int curtext; /* text being moved/dragged/etc */ int startx,starty; int textanchor; char text[BUFLEN]; char name[BUFLEN]; /* actual data */ text_t textob[MAXTEXT]; mapobject_t obj[MAXOBJECTS]; thing_t thing[MAXOBJECTS + MAXLINKS]; link_t olink[MAXLINKS]; } map_t; map_t map[MAXMAPS]; void addlinkpoint(int linkid, int x, int y); void addvector(vectorimg_t *vimg, int type, int x1, int y1, int x2, int y2, SDL_Color *c); void changestate(int newstate); void cleanup(void); int createobject(int type, int x, int y); void copyline(SDL_Surface *screen,int x1, int y1, int x2, int y2, int *lbuf); void deletething(int id, int type); void deletelink(int linkid); void deleteobject(int oid ); void deletetext(int textid); void drawbox(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c); void drawcolorchart(SDL_Surface *dest); void drawmaplist(SDL_Surface *dest); int drawletter(SDL_Surface *dest,int x, int y, int w, int h, char let, SDL_Color col); void drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c); void drawlinebehind(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c); void drawlink(SDL_Surface *dest, link_t *l); void drawpixel(SDL_Surface *screen, int x, int y, SDL_Color c); void drawmap(void); void drawmapbox(void); void drawobox(void); void drawscreen(void); void drawstatusbar(void); void drawtext(SDL_Surface *dest, text_t *t); void drawtoolbox(void); void drawtoolboxselector(int buttonid); void drawvector(SDL_Surface *dest, vectorimg_t *vimg, int x, int y, int w, int h,SDL_Color *overridefg ); void drillto(int mapnum); int endobjmove(int x, int y); int endresize(int x, int y); int endtextresize(int x, int y); int endlink(int x, int y); int endlinkmove(int x, int y); int endlinkdstmove(int x, int y); int endlinkpointmove(int x, int y); int endlinksrcmove(int x, int y); int endtext(void); int endtextmove(int x, int y); int findpointpos(link_t *l, int px, int py); void floodfill(SDL_Surface *dest, int x, int y, SDL_Color fillcol); void floodfill2(SDL_Surface *dest, int x, int y, SDL_Color fillcol, SDL_Color bgcol); void floodfill3(SDL_Surface *dest, int x1, int x2, int y, SDL_Color fillcol, SDL_Color bgcol); void floodfill4(SDL_Surface *dest, int x, int y, SDL_Color fillcol, SDL_Color bgcol); int getcolor(SDL_Surface *dest, int x, int y, SDL_Color *col); void drawyn(char *prompt); int getyn(int x, int y); void goback(void); int linelen(int x1,int y1,int x2,int y2); int linkat(int x, int y); int loadmap(void); void lowerselected(void); int objat(int x, int y); void pasteline(SDL_Surface *screen, int *lbuf); void pop(int *x, int *y); void push(int x, int y); int initgraphics(void); void initmap(int mapnum); int initobject(int onum); int isonline (int fx, int fy, int x1, int y1, int x2, int y2); int isonlink(int linkid, int mx, int my); int isonlinkdst(int lineid, int mx, int my); int isonlinkpoint(int lineid, int mx, int my); int isonlinksrc(int lineid, int mx, int my); int isonmap (int x, int y); int isonobox (int x, int y); int isontoolbox (int x, int y); int isonmapbox (int x, int y); int isonmapboxchildren (int x, int y); int isonmapname (int x, int y); int isongoback (int x, int y); void initvars(void); void raiseselected(void); int savemap(void); int showfiledialog(void); int startlink (int x, int y); int startlinkdstmove(int x, int y); int startlinkpointmove(int x, int y); int startlinksrcmove(int x, int y); int startlinkmove(int x, int y); int startobjmove(int x, int y); int startresize (int x, int y); int startresizetext (int x, int y); int starttextmove(int x, int y); int textat(int x, int y); int thingat(int x, int y); int updatefilename(void); int updatelinkshadow(int x, int y); int updatelinkpointshadow(int x, int y); int updatemoveshadow(int x, int y); int updateresizeshadow(int x, int y); int updateresizetextshadow(int x, int y); int updatetextcursor(void); int updatetextshadow(int x, int y);