- Grid is now off by default
- Added keyboard shortcuts ('0' through '9' to select or define) - Added documentation - Bumped version to 1.3
This commit is contained in:
parent
059d26bbd9
commit
8a7f3efcf1
|
@ -10,6 +10,11 @@ Ideas for future versions:
|
|||
- Implement a toggle-able traffic flow display (for example, you might click
|
||||
a button and have arrows appear to show all SMTP mail flows)
|
||||
|
||||
Version 1.3:
|
||||
- Grid is now off by default
|
||||
- Added keyboard shortcuts ('0' through '9' to select or define)
|
||||
- Added documentation
|
||||
|
||||
Version 1.2:
|
||||
- Implemented copy/paste of objects, text and maps
|
||||
- Changed background of object box to be light grey instead of black
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define VERSION "1.2a"
|
||||
#define VERSION "1.3"
|
||||
|
||||
#define BUFLEN 512
|
||||
|
||||
|
@ -40,6 +40,8 @@
|
|||
|
||||
#define MAXFILLSTACK 500000
|
||||
|
||||
#define SHORTCUTSIZE (10)
|
||||
|
||||
#define OLDMAXVECTORSPERIMAGE (60)
|
||||
#define MAXVECTORSPERIMAGE (120)
|
||||
|
||||
|
|
2
dist.sh
2
dist.sh
|
@ -7,11 +7,13 @@ WINFILE=${FULLNAME}-win32.zip
|
|||
|
||||
mkdir ${FULLNAME}
|
||||
cp README.txt INSTALL.txt Makefile.linux Makefile.freebsd Makefile.windows objects.dat buttons.dat netmapr.c netmapr.h constants.h convert.c convert.h icon.bmp verdana.ttf example.map ${FULLNAME}/
|
||||
cp -R doc ${FULLNAME}/
|
||||
tar zcvf ${TARFILE} ${FULLNAME}
|
||||
rm -rf ${FULLNAME}
|
||||
|
||||
|
||||
mkdir ${FULLNAME}
|
||||
cp README.txt INSTALL.txt objects.dat buttons.dat netmapr.exe netmapr.c netmapr.h constants.h convert.c convert.h verdana.ttf example.map icon.bmp windows_files/*.dll ${FULLNAME}/
|
||||
cp -R doc ${FULLNAME}/
|
||||
zip -r ${WINFILE} ${FULLNAME}
|
||||
rm -rf ${FULLNAME}
|
||||
|
|
89
netmapr.c
89
netmapr.c
|
@ -63,13 +63,16 @@ int copyfrom = -1;
|
|||
int copymap = -1;
|
||||
int copytype = T_MAP;
|
||||
|
||||
int grid = TRUE;
|
||||
int grid = FALSE;
|
||||
int gridsize = 10;
|
||||
int gridsizelist[] = {5, 10, 15, 20};
|
||||
int gridsizeindex = 1;
|
||||
int gridsizenum = 4;
|
||||
SDL_Color gridcol = {0, 0, 0, 0 };
|
||||
|
||||
int shortcut[] = { 9, 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
int shortcutnum = 10;
|
||||
|
||||
int matchtype = 0;
|
||||
|
||||
int numobjtypes = 0;
|
||||
|
@ -1620,6 +1623,51 @@ int main (int argc, char **argv) {
|
|||
drawstatusbar();
|
||||
}
|
||||
}
|
||||
/* keyboard shortcuts */
|
||||
if ((c >= '0') && (c <= '9')) {
|
||||
int mx,my;
|
||||
int onum;
|
||||
|
||||
onum = c - '0';
|
||||
|
||||
SDL_GetMouseState(&mx, &my);
|
||||
if (isonobox(mx, my)) {
|
||||
int seltype, tempx, tempy;
|
||||
/* define shortcut */
|
||||
tempx = (mx - obox.x) / (obox.gridsize+3);
|
||||
tempy = (my - obox.y) / (obox.gridsize+3);
|
||||
seltype = tempy*obox.gridrowlen + tempx + (obox.pos*3);
|
||||
|
||||
shortcut[onum] = seltype;
|
||||
sprintf(statustext,"Shortcut key '%c' set to '%s'.\n",c, objtype[seltype].name);
|
||||
drawstatusbar();
|
||||
drawobox();
|
||||
} else {
|
||||
/* select shortcut */
|
||||
int fitx, fity, fit;
|
||||
/* select object */
|
||||
map[curmap].selectedtype = shortcut[onum];
|
||||
/* these two should never happen... */
|
||||
if (map[curmap].selectedtype < 0 ) map[curmap].selectedtype = 0;
|
||||
if (map[curmap].selectedtype >= numobjtypes) map[curmap].selectedtype = numobjtypes-1;
|
||||
/* ensure that object is visible */
|
||||
fitx = (obox.width / obox.gridsize);
|
||||
fity = ((obox.height+3) / obox.gridsize);
|
||||
fit = fitx * fity;
|
||||
|
||||
/* scroll object box to make it visible */
|
||||
while (shortcut[onum] < (obox.pos*fitx)) {
|
||||
obox.pos--;
|
||||
}
|
||||
while (shortcut[onum] > ((obox.pos*fitx) + fit)) {
|
||||
obox.pos++;
|
||||
}
|
||||
|
||||
sprintf(statustext,"Object type shortcut #%d ('%s') selected.\n",onum, objtype[map[curmap].selectedtype].name);
|
||||
drawstatusbar();
|
||||
drawobox();
|
||||
}
|
||||
}
|
||||
if (c == SDLK_BACKSPACE) {
|
||||
goback();
|
||||
}
|
||||
|
@ -3362,6 +3410,8 @@ void drawobox(void) {
|
|||
fit = fitx * fity;
|
||||
|
||||
for (i = (obox.pos*3); i < numobjtypes; i++) {
|
||||
int n;
|
||||
|
||||
if ((x + obox.gridsize) >= (map[curmap].width + SIDEBARW)) {
|
||||
x = obox.x;
|
||||
if ((y + obox.gridsize) >= (map[curmap].height)) {
|
||||
|
@ -3383,7 +3433,7 @@ void drawobox(void) {
|
|||
area.h = obox.gridsize-1;
|
||||
SDL_FillRect(screen, &area, fillcol);
|
||||
|
||||
/* draw map[curmap].object */
|
||||
/* draw object */
|
||||
temp.type = i;
|
||||
temp.x = x+1;
|
||||
temp.y = y+1;
|
||||
|
@ -3391,6 +3441,40 @@ void drawobox(void) {
|
|||
temp.h = obox.gridsize-2;
|
||||
drawobject(screen, &temp, TRUE);
|
||||
|
||||
/* show keyboard shortcuts */
|
||||
for (n = 0; n < shortcutnum; n++) {
|
||||
if (shortcut[n] == i) {
|
||||
SDL_Surface *ts;
|
||||
SDL_Rect area;
|
||||
char numtext[2];
|
||||
int tw,th;
|
||||
|
||||
sprintf(numtext, "%d",n);
|
||||
|
||||
ts = TTF_RenderText_Blended(font[SHORTCUTSIZE], numtext, blue);
|
||||
TTF_SizeText(font[SHORTCUTSIZE], numtext, &tw,&th);
|
||||
|
||||
|
||||
drawfillbox(screen,x+2,y - 2 + (obox.gridsize) - SHORTCUTSIZE,
|
||||
x+2+tw, y + (obox.gridsize) - SHORTCUTSIZE + tw,
|
||||
yellow);
|
||||
//drawbox(screen,x+2,y + (obox.gridsize) - SHORTCUTSIZE,
|
||||
// x+2+tw, y + (obox.gridsize) + 1 - SHORTCUTSIZE + tw,
|
||||
// red);
|
||||
|
||||
|
||||
area.x = x + 3;
|
||||
area.y = y + (obox.gridsize) - 4 - SHORTCUTSIZE;
|
||||
area.w = tw;
|
||||
area.h = th;
|
||||
|
||||
SDL_BlitSurface(ts, 0, screen, &area);
|
||||
SDL_FreeSurface(ts);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//SDL_UpdateRect(screen, x, y, obox.gridsize+1,obox.gridsize+1);
|
||||
|
||||
x += obox.gridsize+3;
|
||||
|
@ -6603,7 +6687,6 @@ int endlinkmove(int x, int y) {
|
|||
}
|
||||
|
||||
void drillto(int mapnum) {
|
||||
printf("drilling to: %d\n",mapnum);
|
||||
if (mapnum == C_NONE) {
|
||||
if (nummaps < (MAXMAPS-1)) {
|
||||
/* push current map */
|
||||
|
|
Loading…
Reference in New Issue