- Added ability to control width of links
- Added ability to control style of links - Added ability to control arrows on ends of links - Created new example diagram and screenshots
This commit is contained in:
parent
edf273982a
commit
0c71838cb6
5
INSTALL
5
INSTALL
|
@ -2,9 +2,8 @@ UNIX:
|
|||
|
||||
1. cp Makefile.whatever Makefile
|
||||
2. make
|
||||
3. Copy *.dat to a daa directory (for example, /usr/local/share/netmapr)
|
||||
3. make install
|
||||
4. Add the following to your profile:
|
||||
NETMAPRDIR=/usr/local/share/netmapr (or whatever)
|
||||
NETMAPRDIR=/usr/local/share/netmapr
|
||||
export NETMAPRDIR
|
||||
5. copy the binary to /usr/local/sbin
|
||||
|
||||
|
|
14
buttons.dat
14
buttons.dat
|
@ -52,17 +52,11 @@ line 90 80 90 110 190 190 190
|
|||
line 90 110 110 110 190 190 190
|
||||
end
|
||||
button linestyle 120 120
|
||||
# line
|
||||
line 20 30 20 100 190 190 190
|
||||
# thickness
|
||||
line 4 40 110 40 190 190 190
|
||||
# arrow
|
||||
line 60 30 60 100 190 190 190
|
||||
line 60 30 50 40 190 190 190
|
||||
line 60 30 70 40 190 190 190
|
||||
# dotted line
|
||||
line 100 30 100 40 190 190 190
|
||||
line 100 50 100 60 190 190 190
|
||||
line 100 70 100 80 190 190 190
|
||||
line 100 90 100 100 190 190 190
|
||||
line 4 80 110 80 190 190 190
|
||||
# style
|
||||
end
|
||||
button matchsize 120 120
|
||||
# small box
|
||||
|
|
36
constants.h
36
constants.h
|
@ -1,4 +1,4 @@
|
|||
#define VERSION "0.99d"
|
||||
#define VERSION "0.99e"
|
||||
|
||||
#define BUFLEN 512
|
||||
|
||||
|
@ -47,6 +47,10 @@
|
|||
#define LINESELHANDLESIZE (5)
|
||||
#define OBJSELHANDLEPCT (15)
|
||||
|
||||
/* arrow positions */
|
||||
#define AP_START (1)
|
||||
#define AP_END (2)
|
||||
|
||||
/* used as a NULL value for colours */
|
||||
#define NOCOLOUR (99)
|
||||
#define USECOLOUR (100)
|
||||
|
@ -117,16 +121,30 @@
|
|||
|
||||
#define SIDEBARW 100
|
||||
|
||||
#define LS_NORMAL (0)
|
||||
#define LS_BOLD1 (1)
|
||||
#define LS_BOLD2 (2)
|
||||
#define LS_BOLD3 (3)
|
||||
#define LS_BOLD4 (4)
|
||||
#define LS_BOLD5 (5)
|
||||
#define LS_DOTTED (6)
|
||||
|
||||
#define NUMSTYLES (7)
|
||||
|
||||
#define YES (1)
|
||||
#define NO (0)
|
||||
#define MAYBE (-1)
|
||||
|
||||
/* line styles etc */
|
||||
/*
|
||||
* Unused Arrow Style Thickness (max 5?)
|
||||
* 00000000 00000000 00000000 00000000
|
||||
*/
|
||||
|
||||
#define LS_SOLID (0)
|
||||
#define LS_DOTTED (1)
|
||||
#define LS_BIGDASH (2)
|
||||
#define LS_DASHDOT (3)
|
||||
|
||||
#define MAXLINESTYLE (4)
|
||||
#define LINESTYLESIZE (10)
|
||||
|
||||
#define LA_NONE (0)
|
||||
#define LA_SOURCE (1)
|
||||
#define LA_DEST (2)
|
||||
#define LA_BOTH (3)
|
||||
|
||||
#define LM_ARROW ()
|
||||
#define THICKNESS
|
||||
|
|
BIN
example.map
BIN
example.map
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 16 KiB |
574
netmapr.c
574
netmapr.c
|
@ -7,6 +7,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_ttf.h>
|
||||
#include <SDL/SDL_keysym.h>
|
||||
|
@ -38,12 +40,16 @@ SDL_Cursor *normalmouse;
|
|||
SDL_Cursor *objmouse;
|
||||
SDL_Cursor *textmouse;
|
||||
|
||||
int linemask[MAXLINESTYLE][LINESTYLESIZE];
|
||||
|
||||
xy_t fillstack[MAXFILLSTACK];
|
||||
int fillstackptr = 0;
|
||||
|
||||
SDL_Color fgcol;
|
||||
SDL_Color objfillcol;
|
||||
Uint8 defthickness = 1;
|
||||
Uint8 defstyle = LS_SOLID;
|
||||
Uint8 defarrow = 0;
|
||||
|
||||
int modified = FALSE;
|
||||
|
||||
|
@ -551,10 +557,13 @@ int main (int argc, char **argv) {
|
|||
break;
|
||||
} else if (isontoolbox(event.button.x, event.button.y)) {
|
||||
int tempx,tempy, selection;
|
||||
int boxy;
|
||||
|
||||
tempx = (event.button.x - toolbox.x) / (toolbox.gridsize+3);
|
||||
tempy = (event.button.y - toolbox.y) / (toolbox.gridsize+3);
|
||||
|
||||
boxy = toolbox.y + (tempy*(toolbox.gridsize+3));
|
||||
|
||||
/* are we in a colour selection state? */
|
||||
if (state == S_FGCOL) {
|
||||
changestate(S_NONE);
|
||||
|
@ -601,6 +610,38 @@ int main (int argc, char **argv) {
|
|||
changestate(S_NONE);
|
||||
drawmap();
|
||||
break;
|
||||
case TB_LINESTYLE:
|
||||
if (map[curmap].selecteditemtype == T_LINK) {
|
||||
if (map[curmap].selecteditem != -1) {
|
||||
int si = map[curmap].selecteditem;
|
||||
/* TODO: add arrow */
|
||||
/* where are we? */
|
||||
if (event.button.y <= (boxy + 9)) {
|
||||
/* clear thickness */
|
||||
map[curmap].olink[si].style &= 0xFFFF00;
|
||||
/* set to default */
|
||||
map[curmap].olink[si].style |= defthickness;
|
||||
} else if (event.button.y <= (boxy + 19)) {
|
||||
/* clear style */
|
||||
map[curmap].olink[si].style &= 0xFF00FF;
|
||||
/* set to default */
|
||||
map[curmap].olink[si].style |= (defstyle << 8);
|
||||
} else {
|
||||
/* clear arrow */
|
||||
map[curmap].olink[si].style &= 0x00FFFF;
|
||||
/* set to default */
|
||||
map[curmap].olink[si].style |= (defarrow << 16);
|
||||
}
|
||||
modified = TRUE;
|
||||
drawmap();
|
||||
} else {
|
||||
sprintf(statustext, "No link selected!");
|
||||
}
|
||||
} else {
|
||||
sprintf(statustext, "No link selected!");
|
||||
}
|
||||
drawstatusbar();
|
||||
break;
|
||||
case TB_MATCHSIZE:
|
||||
if (map[curmap].selecteditem != -1) {
|
||||
if (map[curmap].selecteditemtype == T_OBJECT) {
|
||||
|
@ -630,9 +671,11 @@ int main (int argc, char **argv) {
|
|||
if (map[curmap].selecteditem != -1) {
|
||||
if (map[curmap].selecteditemtype == T_LINK) {
|
||||
map[curmap].olink[map[curmap].selecteditem].col = fgcol;
|
||||
modified = TRUE;
|
||||
sprintf(statustext, "Colour of link #%d changed to R=%d,G=%d,B=%d",map[curmap].selecteditem, fgcol.r,fgcol.g,fgcol.b);
|
||||
} else if (map[curmap].selecteditemtype == T_TEXT) {
|
||||
map[curmap].textob[map[curmap].selecteditem].c = fgcol;
|
||||
modified = TRUE;
|
||||
sprintf(statustext, "Colour of text item #%d changed to R=%d,G=%d,B=%d",map[curmap].selecteditem, fgcol.r,fgcol.g,fgcol.b);
|
||||
} else {
|
||||
sprintf(statustext, "No object selected! (use RMB to select new foreground colour)");
|
||||
|
@ -647,6 +690,7 @@ int main (int argc, char **argv) {
|
|||
if (map[curmap].selecteditemtype == T_OBJECT) {
|
||||
map[curmap].obj[map[curmap].selecteditem].fillcol = objfillcol;
|
||||
map[curmap].obj[map[curmap].selecteditem].fillcol.unused = objfillcol.unused;
|
||||
modified = TRUE;
|
||||
if (objfillcol.unused == USECOLOUR) {
|
||||
sprintf(statustext, "Fill colour of object #%d changed to R=%d,G=%d,B=%d",map[curmap].selecteditem, objfillcol.r,objfillcol.g,objfillcol.b);
|
||||
} else {
|
||||
|
@ -660,10 +704,6 @@ int main (int argc, char **argv) {
|
|||
}
|
||||
drawmap();
|
||||
break;
|
||||
case TB_LINESTYLE:
|
||||
sprintf(statustext, "Select Line Style feature not yet implemented.");
|
||||
drawstatusbar();
|
||||
break;
|
||||
case TB_DELETEMAP:
|
||||
sprintf(statustext, "Delete Current Map feature not yet implemented.");
|
||||
drawstatusbar();
|
||||
|
@ -748,10 +788,11 @@ int main (int argc, char **argv) {
|
|||
}
|
||||
/* check for right click on toolbox */
|
||||
if (isontoolbox(event.button.x, event.button.y)) {
|
||||
int tempx,tempy, selection;
|
||||
int tempx,tempy, selection,boxy;
|
||||
|
||||
tempx = (event.button.x - toolbox.x) / (toolbox.gridsize+3);
|
||||
tempy = (event.button.y - toolbox.y) / (toolbox.gridsize+3);
|
||||
boxy = toolbox.y + (tempy*(toolbox.gridsize+3));
|
||||
selection = tempy*toolbox.gridrowlen + tempx;
|
||||
switch (selection) {
|
||||
case TB_FGCOL:
|
||||
|
@ -762,6 +803,17 @@ int main (int argc, char **argv) {
|
|||
changestate(S_FILLCOL);
|
||||
drawmap();
|
||||
break;
|
||||
case TB_LINESTYLE:
|
||||
/* figure out where in the box we are */
|
||||
if (event.button.y <= (boxy + 9)) {
|
||||
changelinethickness(1);
|
||||
} else if (event.button.y <= (boxy + 19)) {
|
||||
changelinestyle(1);
|
||||
} else {
|
||||
changelinearrow(1);
|
||||
}
|
||||
drawstatusbar();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1069,6 +1121,74 @@ int addvector(vectorimg_t *vimg, int type, int x1, int y1, int x2, int y2, SDL_C
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void changelinearrow(int changeby) {
|
||||
|
||||
if ((changeby < 0) && (defarrow == 0)) {
|
||||
defarrow = AP_END;
|
||||
} else {
|
||||
defarrow += changeby;
|
||||
}
|
||||
|
||||
/* wrap around */
|
||||
if (defarrow > AP_END) defarrow = 0;
|
||||
|
||||
/* change arrow style on currently selected line */
|
||||
if (map[curmap].selecteditemtype == T_LINK) {
|
||||
if (map[curmap].selecteditem != -1) {
|
||||
map[curmap].olink[map[curmap].selecteditem].style &= 0x00ffff;
|
||||
map[curmap].olink[map[curmap].selecteditem].style |= (defarrow << 16);
|
||||
modified = TRUE;
|
||||
drawmap();
|
||||
}
|
||||
}
|
||||
|
||||
/* redraw toolbox */
|
||||
drawtoolbox();
|
||||
}
|
||||
|
||||
void changelinestyle(int changeby) {
|
||||
if ((changeby < 0) && (defstyle == 0)) {
|
||||
defstyle = MAXLINESTYLE - 1;
|
||||
} else {
|
||||
defstyle += changeby;
|
||||
}
|
||||
/* wrap around */
|
||||
if (defstyle >= MAXLINESTYLE) defstyle = 0;
|
||||
|
||||
/* change line style of currently selected line */
|
||||
if (map[curmap].selecteditemtype == T_LINK) {
|
||||
if (map[curmap].selecteditem != -1) {
|
||||
map[curmap].olink[map[curmap].selecteditem].style &= 0xff00ff;
|
||||
map[curmap].olink[map[curmap].selecteditem].style |= (defstyle << 8);
|
||||
modified = TRUE;
|
||||
drawmap();
|
||||
}
|
||||
}
|
||||
|
||||
/* redraw toolbox */
|
||||
drawtoolbox();
|
||||
}
|
||||
|
||||
void changelinethickness(int changeby) {
|
||||
defthickness += changeby;
|
||||
/* wrap around */
|
||||
if (defthickness <= 0) defthickness = 5;
|
||||
if (defthickness > 5) defthickness = 1;
|
||||
|
||||
/* change thickness of currently selected line */
|
||||
if (map[curmap].selecteditemtype == T_LINK) {
|
||||
if (map[curmap].selecteditem != -1) {
|
||||
map[curmap].olink[map[curmap].selecteditem].style &= 0xffff00;
|
||||
map[curmap].olink[map[curmap].selecteditem].style |= defthickness;
|
||||
modified = TRUE;
|
||||
drawmap();
|
||||
}
|
||||
}
|
||||
|
||||
/* redraw toolbox */
|
||||
drawtoolbox();
|
||||
}
|
||||
|
||||
void changestate(int newstate) {
|
||||
/* can't do most things in readonly mode */
|
||||
if (readonly) {
|
||||
|
@ -1440,11 +1560,217 @@ void deletetext(int textid) {
|
|||
|
||||
}
|
||||
|
||||
void drawarrowhead(SDL_Surface *screen, double x1, double y1, double x2, double y2, SDL_Color c, int arrowstyle, int arrowpos) {
|
||||
double angle;
|
||||
int arrowpointx,arrowpointy;
|
||||
int arrowend1x,arrowend1y;
|
||||
int arrowend2x,arrowend2y;
|
||||
int middlex, middley;
|
||||
int deltax, deltay;
|
||||
int numpixels;
|
||||
int d;
|
||||
int dinc1,dinc2,xinc1,xinc2,yinc1,yinc2;
|
||||
int i;
|
||||
int x;
|
||||
int y;
|
||||
int tempx,tempy;
|
||||
int arrowlength = 5;
|
||||
int o,oldo;
|
||||
SDL_Surface *temps;
|
||||
int arrowthickness;
|
||||
|
||||
arrowthickness = (arrowstyle & 0x0000ff);
|
||||
|
||||
|
||||
/* calculate where the arrowpoint should go - follow the line until
|
||||
we're not on an object */
|
||||
|
||||
if (arrowpos == AP_END) {
|
||||
/* temporarily reverse endpoints */
|
||||
tempx = x1;
|
||||
tempy = y1;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
x2 = tempx;
|
||||
y2 = tempy;
|
||||
}
|
||||
|
||||
deltax = (x2 - x1);
|
||||
if (deltax < 0) deltax = -deltax;
|
||||
deltay = (y2 - y1);
|
||||
if (deltay < 0) deltay = -deltay;
|
||||
|
||||
if (deltax >= deltay) {
|
||||
numpixels = deltax + 1;
|
||||
d = (deltay*2) - deltax;
|
||||
dinc1 = deltay << 1;
|
||||
dinc2 = (deltay-deltax) << 1;
|
||||
xinc1 = 1;
|
||||
xinc2 = 1;
|
||||
yinc1 = 0;
|
||||
yinc2 = 1;
|
||||
} else {
|
||||
numpixels = deltay + 1;
|
||||
d = (deltax*2) - deltay;
|
||||
dinc1 = deltax << 1;
|
||||
dinc2 = (deltax - deltay) << 1;
|
||||
xinc1 = 0;
|
||||
xinc2 = 1;
|
||||
yinc1 = 1;
|
||||
yinc2 = 1;
|
||||
}
|
||||
|
||||
if (x1 > x2) {
|
||||
xinc1 = - xinc1;
|
||||
xinc2 = - xinc2;
|
||||
}
|
||||
if (y1 > y2) {
|
||||
yinc1 = - yinc1;
|
||||
yinc2 = - yinc2;
|
||||
}
|
||||
|
||||
x = x1; y = y1;
|
||||
|
||||
/* calculate arrow length based on line length
|
||||
line length > 40 means arrow length is 5,
|
||||
otherwise it's 3 */
|
||||
if (numpixels > 40) {
|
||||
arrowlength = 5;
|
||||
} else {
|
||||
arrowlength = 3;
|
||||
}
|
||||
/* adjust for line thickness */
|
||||
arrowlength = arrowlength + arrowthickness - 1;
|
||||
|
||||
|
||||
middlex = -1;
|
||||
middley = -1;
|
||||
|
||||
|
||||
temps = SDL_CreateRGBSurface(SDL_SWSURFACE,10,10,
|
||||
screen->format->BitsPerPixel, screen->format->Rmask,
|
||||
screen->format->Gmask,screen->format->Bmask,
|
||||
screen->format->Amask);
|
||||
|
||||
o = -1;
|
||||
oldo = -99;
|
||||
|
||||
for (i = 0; i < numpixels; i++) {
|
||||
o = objat(x,y);
|
||||
if (o == -1) {
|
||||
middlex = x;
|
||||
middley = y;
|
||||
break;
|
||||
} else {
|
||||
int ox,oy;
|
||||
SDL_Color tempc;
|
||||
|
||||
if (o != oldo) {
|
||||
/* free temporary surface */
|
||||
SDL_FreeSurface(temps);
|
||||
/* create temp surface */
|
||||
temps = SDL_CreateRGBSurface(SDL_SWSURFACE,map[curmap].obj[o].w+3, map[curmap].obj[o].h+3,
|
||||
screen->format->BitsPerPixel, screen->format->Rmask,
|
||||
screen->format->Gmask,screen->format->Bmask,
|
||||
screen->format->Amask);
|
||||
/* draw into temporary surface */
|
||||
drawobject(temps, &map[curmap].obj[o], FALSE);
|
||||
|
||||
oldo = o;
|
||||
}
|
||||
/* we can start drawing if we're on the object but on a transparent bit */
|
||||
ox = x - map[curmap].obj[o].x;
|
||||
oy = y - map[curmap].obj[o].y;
|
||||
|
||||
getcolor(temps, ox + arrowthickness - 1, oy + arrowthickness -1, &tempc);
|
||||
if ( (tempc.r == map[curmap].bgcol.r) &&
|
||||
(tempc.g == map[curmap].bgcol.g) &&
|
||||
(tempc.b == map[curmap].bgcol.b)) {
|
||||
/* free temporary surface */
|
||||
SDL_FreeSurface(temps);
|
||||
|
||||
middlex = x;
|
||||
middley = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (d < 0) {
|
||||
d += dinc1;
|
||||
x += xinc1;
|
||||
y += yinc1;
|
||||
} else {
|
||||
d += dinc2;
|
||||
x += xinc2;
|
||||
y += yinc2;
|
||||
}
|
||||
}
|
||||
|
||||
if ((middlex == -1) || (middley == -1)) {
|
||||
printf("no place for arrowhead, quitting\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (arrowpos == AP_END) {
|
||||
/* put endpoints back */
|
||||
tempx = x1;
|
||||
tempy = y1;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
x2 = tempx;
|
||||
y2 = tempy;
|
||||
}
|
||||
|
||||
|
||||
/* calculate angle of line */
|
||||
angle = atan2(y2-y1,x2-x1);
|
||||
|
||||
if (arrowpos == AP_END) {
|
||||
angle += M_PI;
|
||||
//if (angle > 360) angle -= 360;
|
||||
}
|
||||
angle = -angle;
|
||||
|
||||
/* original arrowhead is:
|
||||
*
|
||||
* / (5,-5)
|
||||
* /
|
||||
* (0,0) <
|
||||
* \
|
||||
* \ (5,5)
|
||||
*/
|
||||
|
||||
/* rotate arrowhead */
|
||||
arrowpointx = 0;
|
||||
arrowpointy = 0;
|
||||
arrowend1x = (arrowlength * cos(angle)) + (-arrowlength * sin(angle));
|
||||
arrowend1y = (-arrowlength * sin(angle)) + (-arrowlength * cos(angle));
|
||||
arrowend2x = (arrowlength * cos(angle)) + (arrowlength * sin(angle));
|
||||
arrowend2y = (-arrowlength * sin(angle)) + (arrowlength * cos(angle));
|
||||
|
||||
|
||||
/* translate arrowhead into position */
|
||||
arrowpointx = middlex;
|
||||
arrowpointy = middley;
|
||||
arrowend1x += middlex;
|
||||
arrowend1y += middley;
|
||||
arrowend2x += middlex;
|
||||
arrowend2y += middley;
|
||||
|
||||
/* get rid of the 'linestyle' and 'arrow' parts of arrowstyle to
|
||||
* (respectively) make sure the arrow looks okay and
|
||||
* avoid an infinite loop! */
|
||||
arrowstyle &= 0x0000ff;
|
||||
|
||||
drawline(screen, arrowpointx, arrowpointy, arrowend1x, arrowend1y, c, arrowstyle);
|
||||
drawline(screen, arrowpointx, arrowpointy, arrowend2x, arrowend2y, c, arrowstyle);
|
||||
}
|
||||
|
||||
void drawbox(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c) {
|
||||
drawline(screen,x1,y1,x2,y1,c);
|
||||
drawline(screen,x1,y1,x1,y2,c);
|
||||
drawline(screen,x1,y2,x2,y2,c);
|
||||
drawline(screen,x2,y1,x2,y2,c);
|
||||
drawline(screen,x1,y1,x2,y1,c,1);
|
||||
drawline(screen,x1,y1,x1,y2,c,1);
|
||||
drawline(screen,x1,y2,x2,y2,c,1);
|
||||
drawline(screen,x2,y1,x2,y2,c,1);
|
||||
}
|
||||
|
||||
void drawcolorchart(SDL_Surface *dest) {
|
||||
|
@ -1467,7 +1793,7 @@ void drawcolorchart(SDL_Surface *dest) {
|
|||
drawbox(dest,x,y,x+(size-1),y+(size-1),black);
|
||||
/* fill box */
|
||||
for (i = 1; i <= (size-2); i++) {
|
||||
drawline(dest, x+1, y+i, x+(size-2), y+i, c);
|
||||
drawline(dest, x+1, y+i, x+(size-2), y+i, c,1);
|
||||
}
|
||||
/* change color */
|
||||
|
||||
|
@ -1528,7 +1854,7 @@ int findpointpos(link_t *l, int px, int py) {
|
|||
}
|
||||
|
||||
|
||||
void drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c) {
|
||||
void drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c, int linestyle) {
|
||||
int deltax, deltay;
|
||||
int numpixels;
|
||||
int d;
|
||||
|
@ -1536,6 +1862,15 @@ void drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c)
|
|||
int i;
|
||||
int x;
|
||||
int y;
|
||||
int xx,yy;
|
||||
int maskcount = 0;
|
||||
int maskindex = 0;
|
||||
Uint8 arrow,style, thickness;
|
||||
|
||||
arrow = (linestyle & (0x00ff0000)) >> 16;
|
||||
style = (linestyle & (0x0000ff00)) >> 8;
|
||||
thickness = (linestyle & (0x000000ff));
|
||||
|
||||
|
||||
deltax = (x2 - x1);
|
||||
if (deltax < 0) deltax = -deltax;
|
||||
|
@ -1573,8 +1908,31 @@ void drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c)
|
|||
|
||||
x = x1; y = y1;
|
||||
|
||||
maskcount = 0;
|
||||
maskindex = 0;
|
||||
for (i = 0; i < numpixels; i++) {
|
||||
drawpixel(screen,x,y,c);
|
||||
|
||||
if (linemask[style][maskindex] == 1) {
|
||||
/* plot point */
|
||||
for (yy = 0; yy < thickness ; yy++) {
|
||||
for (xx = 0; xx < thickness ; xx++) {
|
||||
drawpixel(screen,x+xx,y+yy,c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* increment mask count */
|
||||
if (++maskcount >= thickness) {
|
||||
maskcount = 0;
|
||||
/* increment mask index */
|
||||
maskindex++;
|
||||
if (maskindex >= LINESTYLESIZE) {
|
||||
maskindex = 0;
|
||||
}
|
||||
if (linemask[style][maskindex] == -1) maskindex = 0;
|
||||
}
|
||||
|
||||
|
||||
if (d < 0) {
|
||||
d += dinc1;
|
||||
x += xinc1;
|
||||
|
@ -1585,6 +1943,11 @@ void drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c)
|
|||
y += yinc2;
|
||||
}
|
||||
}
|
||||
|
||||
/* draw arrowheads if required */
|
||||
if (arrow) {
|
||||
drawarrowhead(screen, x1, y1, x2, y2, c, linestyle, arrow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1599,7 +1962,7 @@ void drawlink(SDL_Surface *dest, link_t *l) {
|
|||
x2 = l->point[i].x;
|
||||
y2 = l->point[i].y;
|
||||
|
||||
drawline(dest, x,y,x2,y2, l->col);
|
||||
drawline(dest, x,y,x2,y2, l->col,l->style);
|
||||
|
||||
x = x2;
|
||||
y = y2;
|
||||
|
@ -1609,11 +1972,11 @@ void drawlink(SDL_Surface *dest, link_t *l) {
|
|||
x2 = map[curmap].obj[l->dstobj].x + l->dstxoff;
|
||||
y2 = map[curmap].obj[l->dstobj].y + l->dstyoff;
|
||||
|
||||
drawline(dest, x,y,x2,y2, l->col);
|
||||
drawline(dest, x,y,x2,y2, l->col,l->style);
|
||||
}
|
||||
|
||||
|
||||
void drawobject(SDL_Surface *dest, mapobject_t *o) {
|
||||
void drawobject(SDL_Surface *dest, mapobject_t *o, int doublebuffer) {
|
||||
SDL_Surface *temps;
|
||||
SDL_Rect area;
|
||||
Uint32 bgcol;
|
||||
|
@ -1624,10 +1987,14 @@ void drawobject(SDL_Surface *dest, mapobject_t *o) {
|
|||
printf("About to create surface...");
|
||||
fflush(stdout);
|
||||
}
|
||||
if (doublebuffer) {
|
||||
temps = SDL_CreateRGBSurface(SDL_SWSURFACE,o->w+3, o->h+3,
|
||||
screen->format->BitsPerPixel, screen->format->Rmask,
|
||||
screen->format->Gmask,screen->format->Bmask,
|
||||
screen->format->Amask);
|
||||
} else {
|
||||
temps = dest;
|
||||
}
|
||||
|
||||
bgcol = SDL_MapRGB(temps->format, map[curmap].bgcol.r,map[curmap].bgcol.g,map[curmap].bgcol.b);
|
||||
SDL_FillRect(temps, NULL, bgcol);
|
||||
|
@ -1651,6 +2018,7 @@ void drawobject(SDL_Surface *dest, mapobject_t *o) {
|
|||
SDL_SetColorKey(temps, SDL_SRCCOLORKEY|SDL_RLEACCEL, bgcol);
|
||||
|
||||
/* blit to screen */
|
||||
if (doublebuffer) {
|
||||
area.x = o->x;
|
||||
area.y = o->y;
|
||||
area.w = o->w;
|
||||
|
@ -1660,6 +2028,9 @@ void drawobject(SDL_Surface *dest, mapobject_t *o) {
|
|||
fflush(stdout);
|
||||
}
|
||||
SDL_BlitSurface(temps, 0, dest, &area);
|
||||
} else {
|
||||
SDL_UpdateRect(temps, 0, 0, o->w, o->h);
|
||||
}
|
||||
|
||||
if (testing) {
|
||||
printf("About to return ...");
|
||||
|
@ -1770,7 +2141,7 @@ void drawmap(void) {
|
|||
for (i = 0; i < map[curmap].numthings; i++) {
|
||||
if (map[curmap].thing[i].type == T_OBJECT) {
|
||||
if (testing) { printf("Drawing thing #%d (%d, %s)\n",i,map[curmap].thing[i].id,objtype[map[curmap].obj[map[curmap].thing[i].id].type].name); fflush(stdout); }
|
||||
drawobject(buffer, &map[curmap].obj[map[curmap].thing[i].id]);
|
||||
drawobject(buffer, &map[curmap].obj[map[curmap].thing[i].id], TRUE);
|
||||
} else if (map[curmap].thing[i].type == T_LINK) {
|
||||
if (testing) { printf ("Drawing thing #%d (%d, link)\n",i,map[curmap].thing[i].id); fflush(stdout); }
|
||||
drawlink(buffer, &map[curmap].olink[map[curmap].thing[i].id]);
|
||||
|
@ -2003,7 +2374,7 @@ void drawstatusbar(void) {
|
|||
area.h = map[curmap].height + DEFTEXTH + 3;
|
||||
|
||||
SDL_FillRect(screen, &area, col);
|
||||
drawline(screen, 0, map[curmap].height, map[curmap].width, map[curmap].height, blue);
|
||||
drawline(screen, 0, map[curmap].height, map[curmap].width, map[curmap].height, blue,1);
|
||||
|
||||
/* strip newlines from text */
|
||||
if (statustext[strlen(statustext)-1] == '\n')
|
||||
|
@ -2101,15 +2472,15 @@ void drawmapbox(void) {
|
|||
y += th;
|
||||
|
||||
/* seperator line */
|
||||
drawline(screen, x, y, x+mapbox.width-2, y, white);
|
||||
drawline(screen, x, y, x+mapbox.width-2, y, white,1);
|
||||
y++;
|
||||
|
||||
/* show .. */
|
||||
if (numhistory >= 1) {
|
||||
/* draw arrow */
|
||||
drawline(screen, x+5,y+(lh/2),x+mapbox.width-15,y+(lh/2),white);
|
||||
drawline(screen, x+5,y+(lh/2),x+15,y+1,white);
|
||||
drawline(screen, x+5,y+(lh/2),x+15,y+(lh-1),white);
|
||||
drawline(screen, x+5,y+(lh/2),x+mapbox.width-15,y+(lh/2),white,1);
|
||||
drawline(screen, x+5,y+(lh/2),x+15,y+1,white,1);
|
||||
drawline(screen, x+5,y+(lh/2),x+15,y+(lh-1),white,1);
|
||||
|
||||
}
|
||||
y += th;
|
||||
|
@ -2250,10 +2621,10 @@ void drawobox(void) {
|
|||
}
|
||||
/* draw box */
|
||||
outlinecol = obox.gridcol;
|
||||
drawline(screen, x, y,x+obox.gridsize,y,outlinecol); /* top */
|
||||
drawline(screen, x, y+obox.gridsize,x+obox.gridsize,y+obox.gridsize,outlinecol); /* bottom */
|
||||
drawline(screen, x, y,x,y+obox.gridsize,outlinecol); /* left */
|
||||
drawline(screen, x+obox.gridsize, y,x+obox.gridsize,y+obox.gridsize,outlinecol); /* right */
|
||||
drawline(screen, x, y,x+obox.gridsize,y,outlinecol,1); /* top */
|
||||
drawline(screen, x, y+obox.gridsize,x+obox.gridsize,y+obox.gridsize,outlinecol,1); /* bottom */
|
||||
drawline(screen, x, y,x,y+obox.gridsize,outlinecol,1); /* left */
|
||||
drawline(screen, x+obox.gridsize, y,x+obox.gridsize,y+obox.gridsize,outlinecol,1); /* right */
|
||||
/* fill it */
|
||||
fillcol = SDL_MapRGB(screen->format, obox.gridbgcol.r,obox.gridbgcol.g,obox.gridbgcol.b);
|
||||
area.x = x+1;
|
||||
|
@ -2268,7 +2639,7 @@ void drawobox(void) {
|
|||
temp.y = y+1;
|
||||
temp.w = obox.gridsize-2;
|
||||
temp.h = obox.gridsize-2;
|
||||
drawobject(screen, &temp);
|
||||
drawobject(screen, &temp, TRUE);
|
||||
|
||||
//SDL_UpdateRect(screen, x, y, obox.gridsize+1,obox.gridsize+1);
|
||||
|
||||
|
@ -2284,10 +2655,10 @@ void drawobox(void) {
|
|||
y = ((map[curmap].selectedtype - (obox.pos*3)) / obox.gridrowlen) * obox.gridsize + obox.y;
|
||||
x = ((map[curmap].selectedtype - (obox.pos*3)) % obox.gridrowlen) * obox.gridsize + obox.x;
|
||||
|
||||
drawline(screen, x, y,x+obox.gridsize,y,outlinecol); /* top */
|
||||
drawline(screen, x, y+obox.gridsize,x+obox.gridsize,y+obox.gridsize,outlinecol); /* bottom */
|
||||
drawline(screen, x, y,x,y+obox.gridsize,outlinecol); /* left */
|
||||
drawline(screen, x+obox.gridsize, y,x+obox.gridsize,y+obox.gridsize,outlinecol); /* right */
|
||||
drawline(screen, x, y,x+obox.gridsize,y,outlinecol,1); /* top */
|
||||
drawline(screen, x, y+obox.gridsize,x+obox.gridsize,y+obox.gridsize,outlinecol,1); /* bottom */
|
||||
drawline(screen, x, y,x,y+obox.gridsize,outlinecol,1); /* left */
|
||||
drawline(screen, x+obox.gridsize, y,x+obox.gridsize,y+obox.gridsize,outlinecol,1); /* right */
|
||||
}
|
||||
|
||||
//SDL_UpdateRect(screen, x, y, obox.gridsize+1,obox.gridsize+1);
|
||||
|
@ -2388,20 +2759,20 @@ void drawtoolbox(void) {
|
|||
}
|
||||
}
|
||||
/* draw box */
|
||||
drawline(screen, x, y,x+toolbox.gridsize,y,gridhigh); /* top */
|
||||
drawline(screen, x, y+1,x+toolbox.gridsize,y+1,gridhigh); /* top */
|
||||
drawline(screen, x, y,x+toolbox.gridsize,y,gridhigh,1); /* top */
|
||||
drawline(screen, x, y+1,x+toolbox.gridsize,y+1,gridhigh,1); /* top */
|
||||
|
||||
drawline(screen, x, y+toolbox.gridsize-1,x+toolbox.gridsize,y+toolbox.gridsize-1,gridlow); /* bottom */
|
||||
drawline(screen, x, y+toolbox.gridsize,x+toolbox.gridsize,y+toolbox.gridsize,gridlow); /* bottom */
|
||||
drawline(screen, x, y+toolbox.gridsize-1,x+toolbox.gridsize,y+toolbox.gridsize-1,gridlow,1); /* bottom */
|
||||
drawline(screen, x, y+toolbox.gridsize,x+toolbox.gridsize,y+toolbox.gridsize,gridlow,1); /* bottom */
|
||||
|
||||
drawline(screen, x, y,x,y+toolbox.gridsize,gridhigh); /* left */
|
||||
drawline(screen, x+1, y,x+1,y+toolbox.gridsize-1,gridhigh); /* left */
|
||||
drawline(screen, x, y,x,y+toolbox.gridsize,gridhigh,1); /* left */
|
||||
drawline(screen, x+1, y,x+1,y+toolbox.gridsize-1,gridhigh,1); /* left */
|
||||
|
||||
drawline(screen, x+toolbox.gridsize, y+1,x+toolbox.gridsize,y+toolbox.gridsize,gridlow); /* right */
|
||||
drawline(screen, x+toolbox.gridsize-1, y+1,x+toolbox.gridsize-1,y+toolbox.gridsize,gridlow); /* right */
|
||||
drawline(screen, x+toolbox.gridsize, y+1,x+toolbox.gridsize,y+toolbox.gridsize,gridlow,1); /* right */
|
||||
drawline(screen, x+toolbox.gridsize-1, y+1,x+toolbox.gridsize-1,y+toolbox.gridsize,gridlow,1); /* right */
|
||||
|
||||
for (z = y+2; z < y+toolbox.gridsize;z++) {
|
||||
drawline(screen,x+2,z,x+toolbox.gridsize-2,z,gridmiddle);
|
||||
drawline(screen,x+2,z,x+toolbox.gridsize-2,z,gridmiddle,1);
|
||||
}
|
||||
|
||||
area.x = x+2;
|
||||
|
@ -2425,10 +2796,25 @@ void drawtoolbox(void) {
|
|||
floodfill(screen, area.x + 5, area.y + 5, objfillcol);
|
||||
} else {
|
||||
floodfill(screen, area.x + 5, area.y + 5, black);
|
||||
drawline(screen, area.x+(area.w/2)-3, area.y+(area.h/2)-3-4, area.x+(area.w/2)+3, area.y+(area.h/2)+3-4,white);
|
||||
drawline(screen, area.x+(area.w/2)+3, area.y+(area.h/2)-3-4, area.x+(area.w/2)-3, area.y+(area.h/2)+3-4,white);
|
||||
drawline(screen, area.x+(area.w/2)-3, area.y+(area.h/2)-3-4, area.x+(area.w/2)+3, area.y+(area.h/2)+3-4,white,1);
|
||||
drawline(screen, area.x+(area.w/2)+3, area.y+(area.h/2)-3-4, area.x+(area.w/2)-3, area.y+(area.h/2)+3-4,white,1);
|
||||
}
|
||||
}
|
||||
if (i == TB_LINESTYLE) {
|
||||
int style;
|
||||
/* show line thickness */
|
||||
style = defthickness;
|
||||
drawline(screen, area.x + 5,area.y+5-(defthickness/2),area.x + area.w - 5-defthickness, area.y+5-(defthickness/2)
|
||||
,white,style);
|
||||
/* show line style (dotted, dashed, etc)*/
|
||||
style = (defstyle << 8) | 1;
|
||||
//drawline(screen, area.x + 5,area.y+15,area.x + area.w - 5-defthickness, area.y+15 ,white,style);
|
||||
drawline(screen, area.x + 5,area.y+15,area.x + area.w - 5, area.y+15 ,white,style);
|
||||
|
||||
/* show arrow style (start, end, none) */
|
||||
style = (defarrow << 16) | 1;
|
||||
drawline(screen, area.x + 5,area.y+24,area.x + area.w - 5, area.y+24 ,white,style);
|
||||
}
|
||||
|
||||
SDL_UpdateRect(screen, x, y, toolbox.gridsize+3,toolbox.gridsize+3);
|
||||
|
||||
|
@ -2459,14 +2845,14 @@ void drawtoolboxselector(int buttonid) {
|
|||
y = (buttonid / toolbox.gridrowlen) * (toolbox.gridsize+3) + toolbox.y;
|
||||
x = (buttonid % toolbox.gridrowlen) * (toolbox.gridsize+3) + toolbox.x;
|
||||
|
||||
drawline(screen, x, y,x+toolbox.gridsize,y,outlinecol); /* top */
|
||||
drawline(screen, x, y+1,x+toolbox.gridsize,y+1,outlinecol); /* top */
|
||||
drawline(screen, x, y+toolbox.gridsize,x+toolbox.gridsize,y+toolbox.gridsize,outlinecol); /* bottom */
|
||||
drawline(screen, x, y+toolbox.gridsize-1,x+toolbox.gridsize,y+toolbox.gridsize-1,outlinecol); /* bottom */
|
||||
drawline(screen, x, y,x,y+toolbox.gridsize,outlinecol); /* left */
|
||||
drawline(screen, x+1, y,x+1,y+toolbox.gridsize,outlinecol); /* left */
|
||||
drawline(screen, x+toolbox.gridsize, y,x+toolbox.gridsize,y+toolbox.gridsize,outlinecol); /* right */
|
||||
drawline(screen, x+toolbox.gridsize-1, y,x+toolbox.gridsize-1,y+toolbox.gridsize,outlinecol); /* right */
|
||||
drawline(screen, x, y,x+toolbox.gridsize,y,outlinecol,1); /* top */
|
||||
drawline(screen, x, y+1,x+toolbox.gridsize,y+1,outlinecol,1); /* top */
|
||||
drawline(screen, x, y+toolbox.gridsize,x+toolbox.gridsize,y+toolbox.gridsize,outlinecol,1); /* bottom */
|
||||
drawline(screen, x, y+toolbox.gridsize-1,x+toolbox.gridsize,y+toolbox.gridsize-1,outlinecol,1); /* bottom */
|
||||
drawline(screen, x, y,x,y+toolbox.gridsize,outlinecol,1); /* left */
|
||||
drawline(screen, x+1, y,x+1,y+toolbox.gridsize,outlinecol,1); /* left */
|
||||
drawline(screen, x+toolbox.gridsize, y,x+toolbox.gridsize,y+toolbox.gridsize,outlinecol,1); /* right */
|
||||
drawline(screen, x+toolbox.gridsize-1, y,x+toolbox.gridsize-1,y+toolbox.gridsize,outlinecol,1); /* right */
|
||||
|
||||
SDL_UpdateRect(screen, x, y, toolbox.gridsize+3,toolbox.gridsize+3);
|
||||
}
|
||||
|
@ -2516,7 +2902,7 @@ void drawvector(SDL_Surface *dest, vectorimg_t *vimg, int x, int y, int w, int h
|
|||
// draw this vector
|
||||
switch (vimg->vector[i].type) {
|
||||
case VT_LINE:
|
||||
drawline(dest,realx1,realy1, realx2,realy2,linecol);
|
||||
drawline(dest,realx1,realy1, realx2,realy2,linecol,1);
|
||||
break;
|
||||
case VT_BOX:
|
||||
drawbox(dest,realx1,realy1, realx2,realy2,linecol);
|
||||
|
@ -3015,6 +3401,16 @@ int loadmap(void) {
|
|||
|
||||
fclose(f);
|
||||
|
||||
/* do some fixes for common issues (whether due to old map versions or not) */
|
||||
for (i = 0; i < nummaps; i++) {
|
||||
for (n = 0; n < map[i].numlinks; n++) {
|
||||
/* old maps have line thickness = 0, change this to 1 */
|
||||
if (map[i].olink[n].style == 0) {
|
||||
map[i].olink[n].style = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
curmap = 0;
|
||||
|
||||
modified = FALSE;
|
||||
|
@ -3245,6 +3641,33 @@ int initgraphics(void) {
|
|||
printf("Font load complete - %d sizes read.\n",MAXLETTERHEIGHT);
|
||||
|
||||
|
||||
/* initialise line styles */
|
||||
linemask[LS_SOLID][0] = 1;
|
||||
linemask[LS_SOLID][1] = -1;
|
||||
|
||||
linemask[LS_DOTTED][0] = 1;
|
||||
linemask[LS_DOTTED][1] = 0;
|
||||
linemask[LS_DOTTED][2] = -1;
|
||||
|
||||
linemask[LS_BIGDASH][0] = 1;
|
||||
linemask[LS_BIGDASH][1] = 1;
|
||||
linemask[LS_BIGDASH][2] = 1;
|
||||
linemask[LS_BIGDASH][3] = 0;
|
||||
linemask[LS_BIGDASH][4] = 0;
|
||||
linemask[LS_BIGDASH][5] = 0;
|
||||
linemask[LS_BIGDASH][6] = -1;
|
||||
|
||||
linemask[LS_DASHDOT][0] = 1;
|
||||
linemask[LS_DASHDOT][1] = 1;
|
||||
linemask[LS_DASHDOT][2] = 0;
|
||||
linemask[LS_DASHDOT][3] = 0;
|
||||
linemask[LS_DASHDOT][4] = 0;
|
||||
linemask[LS_DASHDOT][5] = 1;
|
||||
linemask[LS_DASHDOT][6] = 0;
|
||||
linemask[LS_DASHDOT][7] = 0;
|
||||
linemask[LS_DASHDOT][8] = 0;
|
||||
linemask[LS_DASHDOT][9] = -1;
|
||||
|
||||
/* initialise mouse cursors */
|
||||
|
||||
/* regular cursor */
|
||||
|
@ -4318,7 +4741,7 @@ int showfiledialog(void) {
|
|||
/* draw cursor (a solid block) */
|
||||
ccol = blue;
|
||||
for (y = starty ; y < (starty + th); y++ ) {
|
||||
drawline(buffer, startx + tw, y, startx + tw + CURSORWIDTH,y,ccol);
|
||||
drawline(buffer, startx + tw, y, startx + tw + CURSORWIDTH,y,ccol,1);
|
||||
}
|
||||
|
||||
/* blit to screen */
|
||||
|
@ -4751,7 +5174,7 @@ int updatefilename(void) {
|
|||
|
||||
/* draw cursor (a solid block) */
|
||||
for (y = starty ; y < (starty + (DEFTEXTH*2)); y++ ) {
|
||||
drawline(screen, startx + temp.w, y, startx + temp.w + DEFTEXTW*2,y,ccol);
|
||||
drawline(screen, startx + temp.w, y, startx + temp.w + DEFTEXTW*2,y,ccol,1);
|
||||
}
|
||||
|
||||
SDL_UpdateRect(screen, startx, starty, temp.w + DEFTEXTW*2, DEFTEXTH*2);
|
||||
|
@ -4781,7 +5204,7 @@ int updatelinkshadow(int x, int y) {
|
|||
copyline(screen, linex1,liney1,linex2,liney2, linebg);
|
||||
|
||||
/* draw line */
|
||||
drawline(screen,startx,starty,x,y, map[curmap].boxcol);
|
||||
drawline(screen,startx,starty,x,y, map[curmap].boxcol,1);
|
||||
|
||||
|
||||
if (x < startx) {
|
||||
|
@ -4853,7 +5276,7 @@ int updatelinkpointshadow(int x, int y) {
|
|||
|
||||
/* draw link point */
|
||||
for (ty = liney1; ty < (liney1+LINESELHANDLESIZE-1); ty++) {
|
||||
drawline(screen, linex1, ty, linex1+LINESELHANDLESIZE-1, ty, black);
|
||||
drawline(screen, linex1, ty, linex1+LINESELHANDLESIZE-1, ty, black,1);
|
||||
}
|
||||
//SDL_UpdateRect(screen, linex1, liney1, linex2, liney2);
|
||||
SDL_Flip(screen);
|
||||
|
@ -4891,10 +5314,10 @@ int updatemoveshadow(int x, int y) {
|
|||
bgh = area.h;
|
||||
/* draw box */
|
||||
if ((x > 0) && (y > 0) && (x+map[curmap].obj[map[curmap].curobj].w-1 < map[curmap].width) && (y+map[curmap].obj[map[curmap].curobj].h-1 < map[curmap].height)) {
|
||||
drawline(screen,x,y,x+map[curmap].obj[map[curmap].curobj].w-1,y, map[curmap].boxcol);
|
||||
drawline(screen,x,y,x,y+map[curmap].obj[map[curmap].curobj].h-1, map[curmap].boxcol);
|
||||
drawline(screen,x,y+map[curmap].obj[map[curmap].curobj].h-1,x+map[curmap].obj[map[curmap].curobj].w-1,y+map[curmap].obj[map[curmap].curobj].h-1, map[curmap].boxcol);
|
||||
drawline(screen,x+map[curmap].obj[map[curmap].curobj].w-1,y,x+map[curmap].obj[map[curmap].curobj].w-1,y+map[curmap].obj[map[curmap].curobj].h-1, map[curmap].boxcol);
|
||||
drawline(screen,x,y,x+map[curmap].obj[map[curmap].curobj].w-1,y, map[curmap].boxcol,1);
|
||||
drawline(screen,x,y,x,y+map[curmap].obj[map[curmap].curobj].h-1, map[curmap].boxcol,1);
|
||||
drawline(screen,x,y+map[curmap].obj[map[curmap].curobj].h-1,x+map[curmap].obj[map[curmap].curobj].w-1,y+map[curmap].obj[map[curmap].curobj].h-1, map[curmap].boxcol,1);
|
||||
drawline(screen,x+map[curmap].obj[map[curmap].curobj].w-1,y,x+map[curmap].obj[map[curmap].curobj].w-1,y+map[curmap].obj[map[curmap].curobj].h-1, map[curmap].boxcol,1);
|
||||
}
|
||||
SDL_UpdateRect(screen, area.x, area.y, area.w, area.h);
|
||||
return 0;
|
||||
|
@ -4951,13 +5374,13 @@ int updateresizeshadow(int x, int y) {
|
|||
bgh = area.h;
|
||||
/* draw box */
|
||||
drawline(screen,map[curmap].obj[map[curmap].curobj].x, map[curmap].obj[map[curmap].curobj].y,
|
||||
map[curmap].obj[map[curmap].curobj].x+map[curmap].obj[map[curmap].curobj].w+xdiff, map[curmap].obj[map[curmap].curobj].y , map[curmap].boxcol);
|
||||
map[curmap].obj[map[curmap].curobj].x+map[curmap].obj[map[curmap].curobj].w+xdiff, map[curmap].obj[map[curmap].curobj].y , map[curmap].boxcol,1);
|
||||
drawline(screen,map[curmap].obj[map[curmap].curobj].x, map[curmap].obj[map[curmap].curobj].y,
|
||||
map[curmap].obj[map[curmap].curobj].x, map[curmap].obj[map[curmap].curobj].y+map[curmap].obj[map[curmap].curobj].h+ydiff , map[curmap].boxcol);
|
||||
map[curmap].obj[map[curmap].curobj].x, map[curmap].obj[map[curmap].curobj].y+map[curmap].obj[map[curmap].curobj].h+ydiff , map[curmap].boxcol,1);
|
||||
drawline(screen,map[curmap].obj[map[curmap].curobj].x+map[curmap].obj[map[curmap].curobj].w+xdiff, map[curmap].obj[map[curmap].curobj].y,
|
||||
map[curmap].obj[map[curmap].curobj].x+map[curmap].obj[map[curmap].curobj].w+xdiff, map[curmap].obj[map[curmap].curobj].y+map[curmap].obj[map[curmap].curobj].h+ydiff , map[curmap].boxcol);
|
||||
map[curmap].obj[map[curmap].curobj].x+map[curmap].obj[map[curmap].curobj].w+xdiff, map[curmap].obj[map[curmap].curobj].y+map[curmap].obj[map[curmap].curobj].h+ydiff , map[curmap].boxcol,1);
|
||||
drawline(screen,map[curmap].obj[map[curmap].curobj].x, map[curmap].obj[map[curmap].curobj].y+map[curmap].obj[map[curmap].curobj].h+ydiff,
|
||||
map[curmap].obj[map[curmap].curobj].x+map[curmap].obj[map[curmap].curobj].w+xdiff, map[curmap].obj[map[curmap].curobj].y+map[curmap].obj[map[curmap].curobj].h+ydiff , map[curmap].boxcol);
|
||||
map[curmap].obj[map[curmap].curobj].x+map[curmap].obj[map[curmap].curobj].w+xdiff, map[curmap].obj[map[curmap].curobj].y+map[curmap].obj[map[curmap].curobj].h+ydiff , map[curmap].boxcol,1);
|
||||
|
||||
SDL_UpdateRect(screen, area.x, area.y, area.w, area.h);
|
||||
return 0;
|
||||
|
@ -5034,13 +5457,13 @@ int updateresizetextshadow(int x, int y) {
|
|||
bgh = area.h;
|
||||
/* draw box */
|
||||
drawline(screen,map[curmap].textob[map[curmap].curtext].x+txoff, map[curmap].textob[map[curmap].curtext].y+tyoff,
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff+map[curmap].textob[map[curmap].curtext].w+xdiff, map[curmap].textob[map[curmap].curtext].y+tyoff , map[curmap].boxcol);
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff+map[curmap].textob[map[curmap].curtext].w+xdiff, map[curmap].textob[map[curmap].curtext].y+tyoff , map[curmap].boxcol,1);
|
||||
drawline(screen,map[curmap].textob[map[curmap].curtext].x+txoff, map[curmap].textob[map[curmap].curtext].y+tyoff,
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff, map[curmap].textob[map[curmap].curtext].y+tyoff+map[curmap].textob[map[curmap].curtext].h+ydiff , map[curmap].boxcol);
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff, map[curmap].textob[map[curmap].curtext].y+tyoff+map[curmap].textob[map[curmap].curtext].h+ydiff , map[curmap].boxcol,1);
|
||||
drawline(screen,map[curmap].textob[map[curmap].curtext].x+txoff+map[curmap].textob[map[curmap].curtext].w+xdiff, map[curmap].textob[map[curmap].curtext].y+tyoff,
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff+map[curmap].textob[map[curmap].curtext].w+xdiff, map[curmap].textob[map[curmap].curtext].y+tyoff+map[curmap].textob[map[curmap].curtext].h+ydiff , map[curmap].boxcol);
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff+map[curmap].textob[map[curmap].curtext].w+xdiff, map[curmap].textob[map[curmap].curtext].y+tyoff+map[curmap].textob[map[curmap].curtext].h+ydiff , map[curmap].boxcol,1);
|
||||
drawline(screen,map[curmap].textob[map[curmap].curtext].x+txoff, map[curmap].textob[map[curmap].curtext].y+tyoff+map[curmap].textob[map[curmap].curtext].h+ydiff,
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff+map[curmap].textob[map[curmap].curtext].w+xdiff, map[curmap].textob[map[curmap].curtext].y+tyoff+map[curmap].textob[map[curmap].curtext].h+ydiff , map[curmap].boxcol);
|
||||
map[curmap].textob[map[curmap].curtext].x+txoff+map[curmap].textob[map[curmap].curtext].w+xdiff, map[curmap].textob[map[curmap].curtext].y+tyoff+map[curmap].textob[map[curmap].curtext].h+ydiff , map[curmap].boxcol,1);
|
||||
|
||||
SDL_UpdateRect(screen, area.x, area.y, area.w, area.h);
|
||||
return 0;
|
||||
|
@ -5100,7 +5523,7 @@ int updatetextcursor(void) {
|
|||
|
||||
/* draw cursor (a solid block) */
|
||||
for (y = starty ; y < (starty + th); y++ ) {
|
||||
drawline(screen, startx + tw+1, y, startx + tw + CURSORWIDTH,y,ccol);
|
||||
drawline(screen, startx + tw+1, y, startx + tw + CURSORWIDTH,y,ccol,1);
|
||||
}
|
||||
|
||||
SDL_UpdateRect(screen, startx, starty, tw + CURSORWIDTH + 3 , th);
|
||||
|
@ -5112,6 +5535,7 @@ int updatetextcursor(void) {
|
|||
int endlink(int x, int y) {
|
||||
int endxoff,endyoff;
|
||||
int i;
|
||||
Uint8 style, arrow, thickness;
|
||||
|
||||
/* replace old bg */
|
||||
pasteline(screen,linebg);
|
||||
|
@ -5143,10 +5567,14 @@ int endlink(int x, int y) {
|
|||
|
||||
map[curmap].olink[map[curmap].numlinks].col = fgcol;
|
||||
|
||||
map[curmap].olink[map[curmap].numlinks].style = LS_NORMAL;
|
||||
|
||||
map[curmap].olink[map[curmap].numlinks].npoints = 0;
|
||||
|
||||
arrow = defarrow;
|
||||
style = defstyle;
|
||||
thickness = defthickness;
|
||||
|
||||
map[curmap].olink[map[curmap].numlinks].style = (arrow << 16) | (style << 8) | (thickness);
|
||||
|
||||
/* add to 'thing' list */
|
||||
/* links start at the bottom of the thing list */
|
||||
/* shuffle all things up */
|
||||
|
@ -5477,10 +5905,10 @@ int updatetextshadow(int x, int y) {
|
|||
bgh = area.h;
|
||||
/* draw box */
|
||||
if ((x > 0) && (y > 0) && (x+map[curmap].textob[map[curmap].curtext].w-1 < map[curmap].width) && (y+map[curmap].textob[map[curmap].curtext].h-1 < map[curmap].height)) {
|
||||
drawline(screen,x,y,x+map[curmap].textob[map[curmap].curtext].w-1,y, map[curmap].boxcol);
|
||||
drawline(screen,x,y,x,y+map[curmap].textob[map[curmap].curtext].h-1, map[curmap].boxcol);
|
||||
drawline(screen,x,y+map[curmap].textob[map[curmap].curtext].h-1,x+map[curmap].textob[map[curmap].curtext].w-1,y+map[curmap].textob[map[curmap].curtext].h-1, map[curmap].boxcol);
|
||||
drawline(screen,x+map[curmap].textob[map[curmap].curtext].w-1,y,x+map[curmap].textob[map[curmap].curtext].w-1,y+map[curmap].textob[map[curmap].curtext].h-1, map[curmap].boxcol);
|
||||
drawline(screen,x,y,x+map[curmap].textob[map[curmap].curtext].w-1,y, map[curmap].boxcol,1);
|
||||
drawline(screen,x,y,x,y+map[curmap].textob[map[curmap].curtext].h-1, map[curmap].boxcol,1);
|
||||
drawline(screen,x,y+map[curmap].textob[map[curmap].curtext].h-1,x+map[curmap].textob[map[curmap].curtext].w-1,y+map[curmap].textob[map[curmap].curtext].h-1, map[curmap].boxcol,1);
|
||||
drawline(screen,x+map[curmap].textob[map[curmap].curtext].w-1,y,x+map[curmap].textob[map[curmap].curtext].w-1,y+map[curmap].textob[map[curmap].curtext].h-1, map[curmap].boxcol,1);
|
||||
}
|
||||
SDL_UpdateRect(screen, area.x, area.y, area.w, area.h);
|
||||
return 0;
|
||||
|
|
|
@ -163,6 +163,9 @@ map_t map[MAXMAPS];
|
|||
|
||||
void addlinkpoint(int linkid, int x, int y);
|
||||
int addvector(vectorimg_t *vimg, int type, int x1, int y1, int x2, int y2, SDL_Color *c);
|
||||
void changelinearrow(int changeby);
|
||||
void changelinestyle(int changeby);
|
||||
void changelinethickness(int changeby);
|
||||
void changestate(int newstate);
|
||||
void cleanup(void);
|
||||
int createobject(int type, int x, int y);
|
||||
|
@ -171,13 +174,15 @@ void deletething(int id, int type);
|
|||
void deletelink(int linkid);
|
||||
void deleteobject(int oid );
|
||||
void deletetext(int textid);
|
||||
void drawarrowhead(SDL_Surface *screen, double x1, double y1, double x2, double y2, SDL_Color c, int arrowstyle, int arrowpos);
|
||||
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 drawline(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c, int linestyle);
|
||||
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 drawobject(SDL_Surface *dest, mapobject_t *o, int doublebuffer);
|
||||
void drawpixel(SDL_Surface *screen, int x, int y, SDL_Color c);
|
||||
void drawmap(void);
|
||||
void drawmapbox(void);
|
||||
|
|
BIN
netmapr.jpg
BIN
netmapr.jpg
Binary file not shown.
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 88 KiB |
Loading…
Reference in New Issue